added the action preview in the teacher bar

preferencesAboutTextFull
shibakaneki 13 years ago
parent c7c931b92a
commit e114d8adf0
  1. 61
      src/gui/UBTeacherBarWidget.cpp
  2. 22
      src/gui/UBTeacherBarWidget.h

@ -881,9 +881,10 @@ void UBTeacherBarPreviewWidget::setActions(QStringList actions)
if(2 <= desc.size()){ if(2 <= desc.size()){
QString owner = desc.at(0); QString owner = desc.at(0);
QString act = desc.at(1); QString act = desc.at(1);
mpTmpAction = new UBActionPreview(this);
// TODO : Create the action widget here and add it to mWidgets mpTmpAction->setOwner(owner);
mpTmpAction->setContent(act);
mWidgets << mpTmpAction;
} }
} }
mMediaViewer.loadWidgets(mWidgets); mMediaViewer.loadWidgets(mWidgets);
@ -967,3 +968,57 @@ void UBTeacherBarPreviewMedia::loadMedia(QStringList pMedias)
} }
} }
} }
// -----------------------------------------------------------------------------------------------
UBActionPreview::UBActionPreview(QWidget *parent, const char *name):QWidget(parent)
, mpOwner(NULL)
, mpContent(NULL)
{
setObjectName(name);
setLayout(&mLayout);
mpOwner = new QLabel(this);
mpOwner->setObjectName("UBActionPreviewOwner");
mOwnerLayout.addWidget(mpOwner, 0);
mOwnerLayout.addStretch(1);
mLayout.addLayout(&mOwnerLayout);
mpContent = new QLabel(this);
mpContent->setObjectName("UBActionPreviewContent");
mpContent->setWordWrap(true);
mLayout.addWidget(mpContent);
}
UBActionPreview::~UBActionPreview()
{
if(NULL != mpOwner){
delete mpOwner;
mpOwner = NULL;
}
if(NULL != mpContent){
delete mpContent;
mpContent = NULL;
}
}
void UBActionPreview::setOwner(const QString &owner)
{
if(NULL != mpOwner && NULL != mpContent){
switch(owner.toInt()){
case eActionOwner_Teacher:
mpOwner->setText(tr("Teacher"));
mpContent->setStyleSheet("background:lightblue;");
break;
case eActionOwner_Student:
mpOwner->setText(tr("Student"));
mpContent->setStyleSheet("background:lightgreen;");
break;
}
}
}
void UBActionPreview::setContent(const QString &content)
{
if(NULL != mpContent){
mpContent->setText(content);
}
}

@ -27,6 +27,11 @@ typedef enum{
eDuration_ThreeQuarter eDuration_ThreeQuarter
}eDuration; }eDuration;
typedef enum{
eActionOwner_Teacher,
eActionOwner_Student
}eActionOwner;
class UBTeacherStudentAction : public QWidget class UBTeacherStudentAction : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -107,6 +112,22 @@ private:
QLineEdit* mpUrl; QLineEdit* mpUrl;
}; };
class UBActionPreview : public QWidget
{
public:
UBActionPreview(QWidget* parent=0, const char* name="UBActionPreview");
~UBActionPreview();
void setOwner(const QString& owner);
void setContent(const QString& content);
private:
QLabel* mpOwner;
QLabel* mpContent;
QVBoxLayout mLayout;
QHBoxLayout mOwnerLayout;
};
class UBTeacherBarPreviewWidget : public QWidget class UBTeacherBarPreviewWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -145,6 +166,7 @@ private:
QLabel* mpComments; QLabel* mpComments;
QLabel* mpLinksLabel; QLabel* mpLinksLabel;
QLabel* mpTmpLink; QLabel* mpTmpLink;
UBActionPreview* mpTmpAction;
}; };
class UBTeacherBarWidget : public UBDockPaletteWidget class UBTeacherBarWidget : public UBDockPaletteWidget

Loading…
Cancel
Save