From 0fb7cad9883006f92a64346139d6dd7ce0b404d0 Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Thu, 5 Jan 2012 11:33:24 +0100 Subject: [PATCH] Added some logic in the teacher bar --- src/customWidgets/UBWidgetList.cpp | 5 +++++ src/customWidgets/UBWidgetList.h | 1 + src/gui/UBTeacherBarWidget.cpp | 16 ++++++++++++++-- src/gui/UBTeacherBarWidget.h | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/customWidgets/UBWidgetList.cpp b/src/customWidgets/UBWidgetList.cpp index 667d8908..5ec2ea96 100644 --- a/src/customWidgets/UBWidgetList.cpp +++ b/src/customWidgets/UBWidgetList.cpp @@ -155,5 +155,10 @@ void UBWidgetList::setEmptyText(const QString &text) } } +bool UBWidgetList::empty() +{ + return mWidgets.empty(); +} + // TODO : - add onHover 'delete' button diff --git a/src/customWidgets/UBWidgetList.h b/src/customWidgets/UBWidgetList.h index 87337458..0aa00572 100644 --- a/src/customWidgets/UBWidgetList.h +++ b/src/customWidgets/UBWidgetList.h @@ -27,6 +27,7 @@ public: void setMargin(int margin); void setEmptyText(const QString& text); int margin(); + bool empty(); protected: void resizeEvent(QResizeEvent* ev); diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp index d65e41fe..93e1fc61 100644 --- a/src/gui/UBTeacherBarWidget.cpp +++ b/src/gui/UBTeacherBarWidget.cpp @@ -245,7 +245,11 @@ UBTeacherBarWidget::~UBTeacherBarWidget() void UBTeacherBarWidget::onValueChanged() { - if( mpTitle->text() == "") + if( mpTitle->text() == "" && + mpLinks->empty() && + mpActions->empty() && + mpDropMediaZone->empty() && + mpComments->document()->toPlainText() == "") { mIconToLeft = QPixmap(":images/teacher_open_disabled.png"); mIconToRight = QPixmap(":images/teacher_close_disabled.png"); @@ -291,6 +295,7 @@ void UBTeacherBarWidget::onLinkButton() mpLinks->addWidget(pUrl); } +// --------------------------------------------------------------------------------------------- UBTeacherStudentAction::UBTeacherStudentAction(QWidget *parent, const char *name):QWidget(parent) , mpText(NULL) , mpLayout(NULL) @@ -359,11 +364,14 @@ QString UBTeacherStudentAction::comboValue() { QString str; - // TODO : Implement this method + if(NULL != mpCombo){ + str = mpCombo->currentText(); + } return str; } +// --------------------------------------------------------------------------------------------- UBTeacherBarDropMediaZone::UBTeacherBarDropMediaZone(QWidget *parent, const char *name):QWidget(parent) { @@ -385,6 +393,10 @@ UBTeacherBarDropMediaZone::~UBTeacherBarDropMediaZone() } } +bool UBTeacherBarDropMediaZone::empty() +{ + return mWidget->empty(); +} void UBTeacherBarDropMediaZone::dragEnterEvent(QDragEnterEvent *pEvent) { diff --git a/src/gui/UBTeacherBarWidget.h b/src/gui/UBTeacherBarWidget.h index 644b496a..b29b5136 100644 --- a/src/gui/UBTeacherBarWidget.h +++ b/src/gui/UBTeacherBarWidget.h @@ -45,6 +45,7 @@ class UBTeacherBarDropMediaZone : public QWidget public: UBTeacherBarDropMediaZone(QWidget* parent=0, const char* name="UBTeacherBarDropMediaZone"); ~UBTeacherBarDropMediaZone(); + bool empty(); private: QListmWidgetList;