diff --git a/resources/style.qss b/resources/style.qss index 8ce2d992..c542d934 100644 --- a/resources/style.qss +++ b/resources/style.qss @@ -27,7 +27,8 @@ QWidget#UBMediaVideoContainer border: 2px solid #999999; } -QWidget#UBTeacherBarPreviewWidget + +QWidget#UBTBPreviewWidget { background: #FFFFFF; border-radius: 10px; diff --git a/src/gui/UBTBDocumentEditWidget.cpp b/src/gui/UBTBDocumentEditWidget.cpp index 30f3438e..97c00521 100644 --- a/src/gui/UBTBDocumentEditWidget.cpp +++ b/src/gui/UBTBDocumentEditWidget.cpp @@ -192,7 +192,6 @@ void UBTBDocumentEditWidget::clearFields() void UBTBDocumentEditWidget::onKeywordChanged(const QString &kw) { mpDataMgr->setKeywords(kw); - qDebug() << ">>> KEYWORD CHANGED: " << kw; emit valueChanged(); } diff --git a/src/gui/UBTBDocumentPreviewWidget.cpp b/src/gui/UBTBDocumentPreviewWidget.cpp index e5610061..81dbad2e 100644 --- a/src/gui/UBTBDocumentPreviewWidget.cpp +++ b/src/gui/UBTBDocumentPreviewWidget.cpp @@ -29,7 +29,7 @@ UBTBDocumentPreviewWidget::UBTBDocumentPreviewWidget(UBTeacherBarDataMgr *pDataM mpContainer = new QWidget(this); mpContainer->setLayout(&mContainerLayout); - mpContainer->setObjectName("UBTeacherBarPreviewWidget"); + mpContainer->setObjectName("UBTBPreviewWidget"); // Session Title mpSessionLabel = new QLabel(tr("Session"), mpContainer); diff --git a/src/gui/UBTeacherBarPreviewWidget.cpp b/src/gui/UBTeacherBarPreviewWidget.cpp index 1a7feefc..39b8eb15 100644 --- a/src/gui/UBTeacherBarPreviewWidget.cpp +++ b/src/gui/UBTeacherBarPreviewWidget.cpp @@ -144,6 +144,7 @@ UBTBPreviewContainer::~UBTBPreviewContainer() // ------------------------------------------------------------------------------------ UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(UBTeacherBarDataMgr* pDataMgr, QWidget *parent, const char *name):QWidget(parent) , mpEditButton(NULL) + , mpDocumentButton(NULL) , mpSessionTitle(NULL) , mpTitle(NULL) , mpTitleLabel(NULL) @@ -155,20 +156,27 @@ UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(UBTeacherBarDataMgr* pDataM setObjectName(name); mpDataMgr = pDataMgr; setLayout(&mLayout); + mLayout.setContentsMargins(0, 0, 0, 0); setAttribute(Qt::WA_StyledBackground, true); setStyleSheet(UBApplication::globalStyleSheet()); // Build the Preview widget + mpContainer = new QWidget(this); + mpContainer->setObjectName("UBTBPreviewWidget"); + mpContainer->setLayout(&mContainerLayout); + mLayout.addWidget(mpContainer, 1); + + // Session Title - mpTitleContainer = new QWidget(this); + mpTitleContainer = new QWidget(mpContainer); mpTitleContainer->setLayout(&mTitleLayout); - mpSessionTitle = new QLabel(this); + mpSessionTitle = new QLabel(mpContainer); mpSessionTitle->setText(tr("Session: ")); mpSessionTitle->setWordWrap(true); mpSessionTitle->setAlignment(Qt::AlignRight); mpSessionTitle->setObjectName("UBTBPreviewSessionTitle"); - mLayout.addWidget(mpSessionTitle); + mContainerLayout.addWidget(mpSessionTitle); // Title mpTitleContainer->setLayout(&mTitleLayout); @@ -187,27 +195,32 @@ UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(UBTeacherBarDataMgr* pDataM mpPageNbrLabel->setObjectName("UBTBPreviewSessionTitle"); mTitleLayout.addWidget(mpPageNbrLabel); mTitleLayout.addWidget(&mTitleSeparator); - mLayout.addWidget(mpTitleContainer); + mContainerLayout.addWidget(mpTitleContainer); // Content - mpContentContainer = new UBTBPreviewContainer(this); - mLayout.addWidget(mpContentContainer, 1); + mpContentContainer = new UBTBPreviewContainer(mpContainer); + mContainerLayout.addWidget(mpContentContainer, 1); // License - mLayout.addWidget(&mLicenseSeparator); - mpLicenseLabel = new UBTBLicenseWidget(this); - mLayout.addWidget(mpLicenseLabel); + mContainerLayout.addWidget(&mLicenseSeparator); + mpLicenseLabel = new UBTBLicenseWidget(mpContainer); + mContainerLayout.addWidget(mpLicenseLabel); - // Edit button - mpEditButton = new QPushButton(tr("Edit infos"), this); + // Document Button + mpDocumentButton = new QPushButton(tr("Document View"), this); + mpDocumentButton->setObjectName("DockPaletteWidgetButton"); + + // Edit Button + mpEditButton = new QPushButton(tr("Edit"), this); mpEditButton->setObjectName("DockPaletteWidgetButton"); - mEditLayout.addStretch(1); + mEditLayout.addWidget(mpDocumentButton, 0); mEditLayout.addWidget(mpEditButton, 0); mEditLayout.addStretch(1); mLayout.addLayout(&mEditLayout, 0); connect(mpEditButton, SIGNAL(clicked()), this, SLOT(onEdit())); + connect(mpDocumentButton, SIGNAL(clicked()), this, SLOT(onDocumentClicked())); connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged())); } @@ -225,6 +238,11 @@ void UBTeacherBarPreviewWidget::onEdit() emit showEditMode(); } +void UBTeacherBarPreviewWidget::onDocumentClicked() +{ + emit showDocumentPreview(); +} + void UBTeacherBarPreviewWidget::updateFields() { // Session Title diff --git a/src/gui/UBTeacherBarPreviewWidget.h b/src/gui/UBTeacherBarPreviewWidget.h index 7fb2f92b..61d4a892 100644 --- a/src/gui/UBTeacherBarPreviewWidget.h +++ b/src/gui/UBTeacherBarPreviewWidget.h @@ -62,6 +62,7 @@ public: signals: void showEditMode(); + void showDocumentPreview(); protected: void showEvent(QShowEvent* ev); @@ -69,6 +70,7 @@ protected: private slots: void onEdit(); void onActiveSceneChanged(); + void onDocumentClicked(); private: void generateActions(); @@ -77,8 +79,12 @@ private: void generateComments(); QVBoxLayout mLayout; + QVBoxLayout mContainerLayout; QHBoxLayout mEditLayout; QPushButton* mpEditButton; + QPushButton* mpDocumentButton; + + QWidget* mpContainer; // Titles QVBoxLayout mTitleLayout; @@ -95,7 +101,6 @@ private: // License UBTBSeparator mLicenseSeparator; - // TODO : replace the QLabel of the license by a widget done for that! UBTBLicenseWidget* mpLicenseLabel; diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp index 5aeb80a4..1596b6b0 100644 --- a/src/gui/UBTeacherBarWidget.cpp +++ b/src/gui/UBTeacherBarWidget.cpp @@ -57,6 +57,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock connect(UBApplication::boardController, SIGNAL(activeDocumentChanged()), this, SLOT(onActiveDocumentChanged())); connect(mpPreview, SIGNAL(showEditMode()), this, SLOT(onShowEditMode())); + connect(mpPreview, SIGNAL(showDocumentPreview()), this, SLOT(onShowDocumentPreview())); connect(mpDocPreviewWidget, SIGNAL(changeTBState(eTeacherBarState)), this, SLOT(onTBStateChanged(eTeacherBarState))); connect(mpDocEditWidget, SIGNAL(changeTBState(eTeacherBarState)), this, SLOT(onTBStateChanged(eTeacherBarState))); connect(mpPageEditWidget, SIGNAL(changeTBState(eTeacherBarState)), this, SLOT(onTBStateChanged(eTeacherBarState))); @@ -150,6 +151,11 @@ void UBTeacherBarWidget::onShowEditMode() onTBStateChanged(eTeacherBarState_PageEdit); } +void UBTeacherBarWidget::onShowDocumentPreview() +{ + onTBStateChanged(eTeacherBarState_DocumentPreview); +} + void UBTeacherBarWidget::onTBStateChanged(eTeacherBarState state) { switch(state){ diff --git a/src/gui/UBTeacherBarWidget.h b/src/gui/UBTeacherBarWidget.h index 26831bfe..a97a4626 100644 --- a/src/gui/UBTeacherBarWidget.h +++ b/src/gui/UBTeacherBarWidget.h @@ -48,6 +48,7 @@ private slots: void onShowEditMode(); void onTBStateChanged(eTeacherBarState state); void onActiveDocumentChanged(); + void onShowDocumentPreview(); private: bool isEmpty();