src/adaptors

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

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

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

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

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

Loading…
Cancel
Save