Merge branch 'Bett-2012' of github.com:Sankore/Sankore-3.1 into Bett-2012

Conflicts:
	src/customWidgets/UBWidgetList.cpp
preferencesAboutTextFull
shibakaneki 13 years ago
commit 9a80913b35
  1. 4
      Sankore_3.1.pro
  2. 13
      src/customWidgets/UBWidgetList.cpp
  3. 10
      src/customWidgets/UBWidgetList.h
  4. 4
      src/gui/UBMediaPlayer.cpp
  5. 36
      src/gui/UBTeacherBarWidget.cpp
  6. 5
      src/gui/UBTeacherBarWidget.h

@ -12,8 +12,8 @@ linux-g++-64 {
VERSION_MAJ = 1 VERSION_MAJ = 1
VERSION_MIN = 40 VERSION_MIN = 40
VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error VERSION_TYPE = a # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 01 VERSION_PATCH = 00
VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}" VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}"
VERSION = $$replace(VERSION, "\\.r", "") VERSION = $$replace(VERSION, "\\.r", "")

@ -83,9 +83,16 @@ int UBWidgetList::scaleWidgets(QSize pSize)
result += newWidgetHeight; result += newWidgetHeight;
} }
else{ else{
scaleFactor = (float)mWidgetInfo[eachWidget].height() / (float)pSize.height(); if(eWidgetListOrientation_Vertical == mOrientation){
newWidgetWidth = mWidgetInfo[eachWidget].width()/scaleFactor; result += mWidgetInfo[eachWidget].height();
result += newWidgetWidth; eachWidget->setMinimumHeight(mWidgetInfo[eachWidget].height());
eachWidget->setMaximumHeight(mWidgetInfo[eachWidget].height() + 1);
}
else{
result += mWidgetInfo[eachWidget].width();
eachWidget->setMinimumWidth(mWidgetInfo[eachWidget].width());
eachWidget->setMaximumWidth(mWidgetInfo[eachWidget].width() + 1);
}
} }
//Adding a vertical/horizontal space between each element of the list //Adding a vertical/horizontal space between each element of the list
result += mListElementsSpacing; result += mListElementsSpacing;

@ -22,10 +22,16 @@ class UBWidgetList : public QScrollArea
{ {
Q_OBJECT Q_OBJECT
typedef struct
{
QSize size;
bool isResizable;
} sWidgetProperties;
public: public:
UBWidgetList(QWidget* parent=0, eWidgetListOrientation orientation = eWidgetListOrientation_Vertical, const char* name = "UBWidgetList"); UBWidgetList(QWidget* parent=0, eWidgetListOrientation orientation = eWidgetListOrientation_Vertical, const char* name = "UBWidgetList");
~UBWidgetList(); ~UBWidgetList();
void addWidget(QWidget* widget); void addWidget(QWidget* widget, bool isResizable = true);
void removeWidget(QWidget* widget); void removeWidget(QWidget* widget);
void setMargin(int margin); void setMargin(int margin);
void setEmptyText(const QString& text); void setEmptyText(const QString& text);
@ -47,7 +53,7 @@ private:
eWidgetListOrientation mOrientation; eWidgetListOrientation mOrientation;
int mMargin; int mMargin;
int mListElementsSpacing; int mListElementsSpacing;
QMap<QWidget*,QSize> mWidgetInfo; QMap<QWidget*, sWidgetProperties> mWidgetInfo;
QLabel* mpEmptyLabel; QLabel* mpEmptyLabel;
}; };

@ -102,7 +102,9 @@ UBMediaPlayer::UBMediaPlayer() :
vLayout->addWidget(&m_videoWindow); vLayout->addWidget(&m_videoWindow);
// m_videoWidget->setStyleSheet(QString("background:red;")); // m_videoWidget->setStyleSheet(QString("background:red;"));
QVBoxLayout *buttonPanelLayout = new QVBoxLayout(); QVBoxLayout *buttonPanelLayout = new QVBoxLayout();
m_videoWindow.hide(); #ifndef Q_WS_WIN
m_videoWindow.hide();
#endif
// buttonPanelLayout->addLayout(layout); // buttonPanelLayout->addLayout(layout);
// timeLabel = new QLabel(this); // timeLabel = new QLabel(this);

@ -120,7 +120,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
mpLayout->addLayout(mpActionLayout, 0); mpLayout->addLayout(mpActionLayout, 0);
// Media // Media
mpMediaLabel = new QLabel(tr("Media"), mpContainer); mpMediaLabel = new QLabel(tr("Medias"), mpContainer);
mpLayout->addWidget(mpMediaLabel, 0); mpLayout->addWidget(mpMediaLabel, 0);
mpMediaContainer = new UBTBMediaContainer(this); mpMediaContainer = new UBTBMediaContainer(this);
mpLayout->addWidget(mpMediaContainer, 1); mpLayout->addWidget(mpMediaContainer, 1);
@ -391,7 +391,15 @@ void UBTeacherBarWidget::loadContent()
} }
// Add the media // Add the media
mpPreview->mediaViewer()->loadMedia(nextInfos.medias); if(nextInfos.medias.count() > 0){
QList<QWidget*> widgetList;
widgetList.append(mpPreview->mediaLabel());
mpPreview->mediaViewer()->loadWidgets(widgetList,false);
int loadedMedia = mpPreview->mediaViewer()->loadMedia(nextInfos.medias);
if(loadedMedia)
mpPreview->mediaLabel()->setVisible(true);
}
// Add the links // Add the links
if(!mUrlList.empty()){ if(!mUrlList.empty()){
@ -910,8 +918,10 @@ void UBTeacherBarPreviewWidget::setComments(const QString &comments)
mpComments->setVisible(true); mpComments->setVisible(true);
mpCommentsLabel->setVisible(true); mpCommentsLabel->setVisible(true);
mWidgets << mpCommentsLabel; mWidgets << mpCommentsLabel;
mMediaViewer.loadWidgets(mWidgets, false);
mWidgets.clear();
mWidgets << mpComments; mWidgets << mpComments;
mMediaViewer.loadWidgets(mWidgets); mMediaViewer.loadWidgets(mWidgets, true);
} }
} }
@ -925,7 +935,7 @@ void UBTeacherBarPreviewWidget::hideElements()
{ {
mpActionsLabel = new QLabel(tr("Actions"), this); mpActionsLabel = new QLabel(tr("Actions"), this);
mpActionsLabel->setObjectName("UBTeacherBarPreviewSubtitle"); mpActionsLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mpMediaLabel = new QLabel(tr("Media"), this); mpMediaLabel = new QLabel(tr("Medias"), this);
mpMediaLabel->setObjectName("UBTeacherBarPreviewSubtitle"); mpMediaLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mpCommentsLabel = new QLabel(tr("Comments"), this); mpCommentsLabel = new QLabel(tr("Comments"), this);
mpCommentsLabel->setObjectName("UBTeacherBarPreviewSubtitle"); mpCommentsLabel->setObjectName("UBTeacherBarPreviewSubtitle");
@ -948,6 +958,8 @@ void UBTeacherBarPreviewWidget::setActions(QStringList actions)
mWidgets.clear(); mWidgets.clear();
mpActionsLabel->setVisible(true); mpActionsLabel->setVisible(true);
mWidgets << mpActionsLabel; mWidgets << mpActionsLabel;
mediaViewer()->loadWidgets(mWidgets,false);
mWidgets.clear();
foreach(QString action, actions){ foreach(QString action, actions){
QStringList desc = action.split(';'); QStringList desc = action.split(';');
if(2 <= desc.size()){ if(2 <= desc.size()){
@ -959,7 +971,7 @@ void UBTeacherBarPreviewWidget::setActions(QStringList actions)
mWidgets << mpTmpAction; mWidgets << mpTmpAction;
} }
} }
mMediaViewer.loadWidgets(mWidgets); mMediaViewer.loadWidgets(mWidgets, true);
} }
} }
@ -969,12 +981,14 @@ void UBTeacherBarPreviewWidget::setLinks(QStringList links)
mWidgets.clear(); mWidgets.clear();
mpLinksLabel->setVisible(true); mpLinksLabel->setVisible(true);
mWidgets << mpLinksLabel; mWidgets << mpLinksLabel;
mMediaViewer.loadWidgets(mWidgets, false);
mWidgets.clear();
foreach(QString link, links){ foreach(QString link, links){
mpTmpLink = new QLabel(link, this); mpTmpLink = new QLabel(link, this);
mpTmpLink->setOpenExternalLinks(true); mpTmpLink->setOpenExternalLinks(true);
mWidgets << mpTmpLink; mWidgets << mpTmpLink;
} }
mMediaViewer.loadWidgets(mWidgets); mMediaViewer.loadWidgets(mWidgets, true);
} }
} }
@ -1014,17 +1028,18 @@ void UBTeacherBarPreviewMedia::cleanMedia()
mWidgetList.clear(); mWidgetList.clear();
} }
void UBTeacherBarPreviewMedia::loadWidgets(QList<QWidget*> pWidgetsList) void UBTeacherBarPreviewMedia::loadWidgets(QList<QWidget*> pWidgetsList, bool isResizable)
{ {
foreach(QWidget*eachWidget, pWidgetsList){ foreach(QWidget*eachWidget, pWidgetsList){
mWidget->addWidget(eachWidget); mWidget->addWidget(eachWidget,isResizable);
mWidgetList[eachWidget]="DRAG UNAVAILABLE"; mWidgetList[eachWidget]="DRAG UNAVAILABLE";
} }
} }
void UBTeacherBarPreviewMedia::loadMedia(QStringList pMedias) int UBTeacherBarPreviewMedia::loadMedia(QStringList pMedias)
{ {
int addedMedia = 0;
foreach(QString eachString, pMedias){ foreach(QString eachString, pMedias){
if(!eachString.isEmpty()){ if(!eachString.isEmpty()){
QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(eachString); QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(eachString);
@ -1033,12 +1048,14 @@ void UBTeacherBarPreviewMedia::loadMedia(QStringList pMedias)
label->loadImage(eachString); label->loadImage(eachString);
mWidget->addWidget(label); mWidget->addWidget(label);
mWidgetList[label]=eachString; mWidgetList[label]=eachString;
addedMedia += 1;
} }
else if(mimeType.contains("video") || mimeType.contains("audio")){ else if(mimeType.contains("video") || mimeType.contains("audio")){
UBDraggableMediaPlayer* mediaPlayer = new UBDraggableMediaPlayer(); UBDraggableMediaPlayer* mediaPlayer = new UBDraggableMediaPlayer();
mediaPlayer->setFile(eachString); mediaPlayer->setFile(eachString);
mWidget->addWidget(mediaPlayer); mWidget->addWidget(mediaPlayer);
mWidgetList[mediaPlayer] = eachString; mWidgetList[mediaPlayer] = eachString;
addedMedia += 1;
} }
else{ else{
qWarning() << "pMediaPath" << eachString; qWarning() << "pMediaPath" << eachString;
@ -1046,6 +1063,7 @@ void UBTeacherBarPreviewMedia::loadMedia(QStringList pMedias)
} }
} }
} }
return addedMedia;
} }
// ----------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------

@ -88,8 +88,8 @@ class UBTeacherBarPreviewMedia : public QWidget
public: public:
UBTeacherBarPreviewMedia(QWidget* parent=0, const char* name="UBTeacherBarPreviewMedia"); UBTeacherBarPreviewMedia(QWidget* parent=0, const char* name="UBTeacherBarPreviewMedia");
~UBTeacherBarPreviewMedia(); ~UBTeacherBarPreviewMedia();
void loadMedia(QStringList pMedias); int loadMedia(QStringList pMedias);
void loadWidgets(QList<QWidget*> pWidgetList); void loadWidgets(QList<QWidget*> pWidgetList, bool isResizable = true);
void cleanMedia(); void cleanMedia();
private: private:
@ -147,6 +147,7 @@ public:
void setActions(QStringList actions); void setActions(QStringList actions);
void setLinks(QStringList links); void setLinks(QStringList links);
void clean(); void clean();
QLabel* mediaLabel() { return mpMediaLabel;}
signals: signals:
void showEditMode(); void showEditMode();

Loading…
Cancel
Save