src/adaptors

preferencesAboutTextFull
shibakaneki 13 years ago
parent cc66b585e8
commit f5931f0f05
  1. 18
      src/customWidgets/UBWidgetList.cpp
  2. 1
      src/customWidgets/UBWidgetList.h
  3. 35
      src/gui/UBTeacherBarWidget.cpp
  4. 2
      src/gui/UBTeacherBarWidget.h

@ -11,6 +11,8 @@ UBWidgetList::UBWidgetList(QWidget* parent, eWidgetListOrientation orientation,
mOrientation = orientation;
mpContainer = new QWidget(this);
mWidgets.clear();
mpEmptyLabel = new QLabel(this);
mpEmptyLabel->setObjectName("emptyString");
if(eWidgetListOrientation_Vertical == orientation){
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
@ -47,6 +49,7 @@ UBWidgetList::~UBWidgetList()
void UBWidgetList::addWidget(QWidget *widget)
{
if(NULL != mpLayout){
mpEmptyLabel->setVisible(false);
updateSize(true, widget);
mpLayout->addWidget(widget);
mWidgets << widget;
@ -60,6 +63,9 @@ void UBWidgetList::removeWidget(QWidget *widget)
mWidgets.remove(mWidgets.indexOf(widget));
updateSize(false, widget);
widget->setVisible(false);
if(0 == mpLayout->count()){
mpEmptyLabel->setVisible(true);
}
}
}
@ -98,6 +104,10 @@ void UBWidgetList::updateSize(bool widgetAdded, QWidget *widget)
void UBWidgetList::resizeEvent(QResizeEvent *ev)
{
mpEmptyLabel->setGeometry((width() - mpEmptyLabel->width()) / 2,
(height() - mpEmptyLabel->height()) /2,
mpEmptyLabel->width(),
mpEmptyLabel->height());
if(ev->oldSize().width() >= 0 && ev->oldSize().height() >= 0){
float scale;
if(eWidgetListOrientation_Vertical == mOrientation){
@ -129,5 +139,11 @@ int UBWidgetList::margin()
return mMargin;
}
void UBWidgetList::setEmptyText(const QString &text)
{
if(NULL != mpEmptyLabel){
mpEmptyLabel->setText(text);
}
}
// TODO : - add onHover 'delete' button
// - add empty label

@ -25,6 +25,7 @@ public:
void addWidget(QWidget* widget);
void removeWidget(QWidget* widget);
void setMargin(int margin);
void setEmptyText(const QString& text);
int margin();
protected:

@ -20,8 +20,6 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
, mpDurationLabel(NULL)
, mpTitle(NULL)
, mpAction1(NULL)
, mpAction2(NULL)
, mpAction3(NULL)
, mpDropMediaZone(NULL)
, mpContainer(NULL)
, mpContainerLayout(NULL)
@ -53,8 +51,6 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
// Title
mpTitleLabel = new QLabel(tr("Title"), mpContainer);
mpTitleLabel->setMinimumWidth(LABEL_MINWIDHT);
mpTitleLabel->setAlignment(Qt::AlignRight);
mpTitle = new QLineEdit(mpContainer);
mpTitle->setObjectName("DockPaletteWidgetLineEdit");
connect(mpTitle, SIGNAL(textChanged(const QString&)), this, SLOT(onTitleTextChanged(const QString&)));
@ -65,7 +61,6 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
// Duration
mpDurationLabel = new QLabel(tr("Duration"), mpContainer);
mpDurationLabel->setMinimumWidth(LABEL_MINWIDHT);
mpDurationLayout = new QHBoxLayout();
mpDurationLayout->addWidget(mpDurationLabel, 1);
mpDuration1 = new QCheckBox(this);
@ -85,12 +80,8 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
// Actions
mpAction1 = new UBTeacherStudentAction(1, mpContainer);
mpAction2 = new UBTeacherStudentAction(2, mpContainer);
mpAction3 = new UBTeacherStudentAction(3, mpContainer);
mpLayout->addWidget(mpAction1);
mpLayout->addWidget(mpAction2);
mpLayout->addWidget(mpAction3);
// Media
mpDropMediaZone = new UBTeacherBarDropMediaZone();
@ -104,10 +95,6 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
connect(mpTitle, SIGNAL(textChanged(QString)), this, SLOT(onValueChanged()));
connect(mpAction1->teacher(), SIGNAL(textChanged()), this, SLOT(onValueChanged()));
connect(mpAction1->student(), SIGNAL(textChanged()), this, SLOT(onValueChanged()));
connect(mpAction2->teacher(), SIGNAL(textChanged()), this, SLOT(onValueChanged()));
connect(mpAction2->student(), SIGNAL(textChanged()), this, SLOT(onValueChanged()));
connect(mpAction3->teacher(), SIGNAL(textChanged()), this, SLOT(onValueChanged()));
connect(mpAction3->student(), SIGNAL(textChanged()), this, SLOT(onValueChanged()));
}
UBTeacherBarWidget::~UBTeacherBarWidget()
@ -116,14 +103,6 @@ UBTeacherBarWidget::~UBTeacherBarWidget()
delete mpDropMediaZone;
mpDropMediaZone = NULL;
}
if(NULL != mpAction3){
delete mpAction3;
mpAction3 = NULL;
}
if(NULL != mpAction2){
delete mpAction2;
mpAction2 = NULL;
}
if(NULL != mpAction1){
delete mpAction1;
mpAction1 = NULL;
@ -187,11 +166,7 @@ void UBTeacherBarWidget::onValueChanged()
{
if( mpTitle->text() == ""
&& mpAction1->teacherText() == ""
&& mpAction1->studentText() == ""
&& mpAction2->teacherText() == ""
&& mpAction2->studentText() == ""
&& mpAction3->teacherText() == ""
&& mpAction3->studentText() == "")
&& mpAction1->studentText() == "")
{
mIconToLeft = QPixmap(":images/teacher_open_disabled.png");
mIconToRight = QPixmap(":images/teacher_close_disabled.png");
@ -211,10 +186,6 @@ void UBTeacherBarWidget::saveContent()
infos.title = mpTitle->text();
infos.action1Master = mpAction1->teacherText();
infos.action1Student = mpAction1->studentText();
infos.action2Master = mpAction2->teacherText();
infos.action2Student = mpAction2->studentText();
infos.action3Master = mpAction3->teacherText();
infos.action3Student = mpAction3->studentText();
UBPersistenceManager::persistenceManager()->persistTeacherBar(UBApplication::boardController->activeDocument(), UBApplication::boardController->activeSceneIndex(), infos);
}
@ -224,10 +195,6 @@ void UBTeacherBarWidget::loadContent()
mpTitle->setText(nextInfos.title);
mpAction1->setTeacherText(nextInfos.action1Master);
mpAction1->setStudentText(nextInfos.action1Student);
mpAction2->setTeacherText(nextInfos.action2Master);
mpAction2->setStudentText(nextInfos.action2Student);
mpAction3->setTeacherText(nextInfos.action3Master);
mpAction3->setStudentText(nextInfos.action3Student);
}
void UBTeacherBarWidget::onTitleTextChanged(const QString& text)

@ -92,8 +92,6 @@ private:
QLabel* mpDurationLabel;
QLineEdit* mpTitle;
UBTeacherStudentAction* mpAction1;
UBTeacherStudentAction* mpAction2;
UBTeacherStudentAction* mpAction3;
UBTeacherBarDropMediaZone* mpDropMediaZone;
QWidget* mpContainer;
QVBoxLayout* mpContainerLayout;

Loading…
Cancel
Save