Added the actions

preferencesAboutTextFull
shibakaneki 13 years ago
parent 89e16fdecd
commit 9b47022783
  1. 128
      src/gui/UBTeacherBarWidget.cpp
  2. 27
      src/gui/UBTeacherBarWidget.h

@ -243,9 +243,7 @@ UBTeacherBarWidget::~UBTeacherBarWidget()
void UBTeacherBarWidget::onValueChanged() void UBTeacherBarWidget::onValueChanged()
{ {
if( mpTitle->text() == "" if( mpTitle->text() == "")
&& mpAction1->teacherText() == ""
&& mpAction1->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");
@ -279,7 +277,9 @@ void UBTeacherBarWidget::onTitleTextChanged(const QString& text)
void UBTeacherBarWidget::onActionButton() void UBTeacherBarWidget::onActionButton()
{ {
UBTeacherStudentAction* pAction = new UBTeacherStudentAction(this);
mActionList << pAction;
mpActions->addWidget(pAction);
} }
void UBTeacherBarWidget::onLinkButton() void UBTeacherBarWidget::onLinkButton()
@ -287,126 +287,74 @@ void UBTeacherBarWidget::onLinkButton()
} }
UBTeacherStudentAction::UBTeacherStudentAction(int actionNumber, QWidget *parent, const char *name):QWidget(parent) UBTeacherStudentAction::UBTeacherStudentAction(QWidget *parent, const char *name):QWidget(parent)
, mpActionLabel(NULL) , mpText(NULL)
, mpTeacherLabel(NULL)
, mpStudentLabel(NULL)
, mpTeacher(NULL)
, mpStudent(NULL)
, mpLayout(NULL) , mpLayout(NULL)
, mpTeacherLayout(NULL) , mpComboLayout(NULL)
, mpStudentLayout(NULL) , mpCombo(NULL)
{ {
setObjectName(name); setObjectName(name);
mActionNumber = actionNumber;
setAttribute(Qt::WA_StyledBackground, true); setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet()); setStyleSheet(UBApplication::globalStyleSheet());
// Create the GUI // Create the GUI
mpLayout = new QVBoxLayout(this); mpLayout = new QHBoxLayout(this);
setLayout(mpLayout); setLayout(mpLayout);
mpActionLabel = new QLabel(tr("Action %0").arg(mActionNumber), this); mpComboLayout = new QVBoxLayout();
mpLayout->addWidget(mpActionLabel, 0);
mpCombo = new QComboBox(this);
mpCombo->addItem(tr("Teacher"));
mpCombo->addItem(tr("Student"));
mpComboLayout->addWidget(0);
mpComboLayout->addStretch(1);
mpTeacherLayout = new QHBoxLayout(); mpLayout->addLayout(mpComboLayout, 0);
mpTeacherLabel = new QLabel(tr("Teacher"), this); mpText = new QTextEdit(this);
mpTeacherLabel->setAlignment(Qt::AlignTop); mpLayout->addWidget(mpText, 1);
mpTeacher = new QTextEdit(this);
mpTeacher->setObjectName("TeacherStudentBox");
mpTeacher->setStyleSheet("background-color:#FF9F6D");
mpTeacherLayout->addWidget(mpTeacherLabel, 0);
mpTeacherLayout->addWidget(mpTeacher, 1);
mpLayout->addLayout(mpTeacherLayout, 1);
mpStudentLayout = new QHBoxLayout();
mpStudentLabel = new QLabel(tr("Student"), this);
mpStudentLabel->setAlignment(Qt::AlignTop);
mpStudent = new QTextEdit(this);
mpStudent->setObjectName("TeacherStudentBox");
mpStudent->setStyleSheet("background-color:#06E983");
mpStudentLayout->addWidget(mpStudentLabel, 0);
mpStudentLayout->addWidget(mpStudent, 1);
mpLayout->addLayout(mpStudentLayout, 1);
} }
UBTeacherStudentAction::~UBTeacherStudentAction() UBTeacherStudentAction::~UBTeacherStudentAction()
{ {
if(NULL != mpActionLabel) if(NULL != mpCombo){
{ delete mpCombo;
delete mpActionLabel; mpCombo = NULL;
mpActionLabel = NULL;
} }
if(NULL != mpTeacherLabel) if(NULL != mpText){
{ delete mpText;
delete mpTeacherLabel; mpText = NULL;
mpTeacherLabel = NULL;
} }
if(NULL != mpTeacher) if(NULL != mpComboLayout){
{ delete mpComboLayout;
delete mpTeacher; mpComboLayout = NULL;
mpTeacher = NULL;
}
if(NULL != mpTeacherLayout)
{
delete mpTeacherLayout;
mpTeacherLayout = NULL;
}
if(NULL != mpStudentLabel)
{
delete mpStudentLabel;
mpStudentLabel = NULL;
}
if(NULL != mpStudent)
{
delete mpStudent;
mpStudent = NULL;
} }
if(NULL != mpStudentLayout) if(NULL != mpLayout){
{
delete mpStudentLayout;
mpStudentLayout = NULL;
}
if(NULL != mpLayout)
{
delete mpLayout; delete mpLayout;
mpLayout = NULL; mpLayout = NULL;
} }
} }
QString UBTeacherStudentAction::teacherText() QString UBTeacherStudentAction::text()
{
return mpTeacher->document()->toPlainText();
}
QString UBTeacherStudentAction::studentText()
{ {
return mpStudent->document()->toPlainText(); QString str;
if(NULL != mpText){
str = mpText->document()->toPlainText();
} }
return str;
void UBTeacherStudentAction::setTeacherText(QString text)
{
mpTeacher->setText(text);
} }
void UBTeacherStudentAction::setStudentText(QString text) QString UBTeacherStudentAction::comboValue()
{ {
mpStudent->setText(text); QString str;
}
QTextEdit* UBTeacherStudentAction::teacher() // TODO : Implement this method
{
return mpTeacher;
}
QTextEdit* UBTeacherStudentAction::student() return str;
{
return mpStudent;
} }
UBTeacherBarDropMediaZone::UBTeacherBarDropMediaZone(QWidget *parent, const char *name):QWidget(parent) UBTeacherBarDropMediaZone::UBTeacherBarDropMediaZone(QWidget *parent, const char *name):QWidget(parent)
{ {

@ -13,7 +13,7 @@ class UBMediaPlayer;
#include <QTabWidget> #include <QTabWidget>
#include <QButtonGroup> #include <QButtonGroup>
#include <QPushButton> #include <QPushButton>
#include "customWidgets/UBWidgetList.h" #include <QComboBox>
#include "UBDockPaletteWidget.h" #include "UBDockPaletteWidget.h"
#include "customWidgets/UBWidgetList.h" #include "customWidgets/UBWidgetList.h"
@ -25,25 +25,16 @@ class UBTeacherStudentAction : public QWidget
Q_OBJECT Q_OBJECT
public: public:
UBTeacherStudentAction(int actionNumber, QWidget* parent=0, const char* name="UBTeacherStudentAction"); UBTeacherStudentAction(QWidget* parent=0, const char* name="UBTeacherStudentAction");
~UBTeacherStudentAction(); ~UBTeacherStudentAction();
QString teacherText(); QString comboValue();
QString studentText(); QString text();
void setTeacherText(QString text);
void setStudentText(QString text);
QTextEdit* teacher();
QTextEdit* student();
private: private:
int mActionNumber; QTextEdit* mpText;
QLabel* mpActionLabel; QHBoxLayout* mpLayout;
QLabel* mpTeacherLabel; QVBoxLayout* mpComboLayout;
QLabel* mpStudentLabel; QComboBox* mpCombo;
QTextEdit* mpTeacher;
QTextEdit* mpStudent;
QVBoxLayout* mpLayout;
QHBoxLayout* mpTeacherLayout;
QHBoxLayout* mpStudentLayout;
}; };
@ -109,6 +100,8 @@ private:
QHBoxLayout* mpLinkLayout; QHBoxLayout* mpLinkLayout;
QLabel* mpCommentLabel; QLabel* mpCommentLabel;
QTextEdit* mpComments; QTextEdit* mpComments;
QVector<UBTeacherStudentAction*> mActionList;
}; };
#endif // UBTEACHERBARWIDGET_H #endif // UBTEACHERBARWIDGET_H

Loading…
Cancel
Save