preferencesAboutTextFull
shibakaneki 13 years ago
parent afab4879e1
commit 03fef88c4f
  1. 2
      src/customWidgets/UBWidgetList.cpp
  2. 135
      src/gui/UBTeacherBarWidget.cpp
  3. 23
      src/gui/UBTeacherBarWidget.h

@ -12,6 +12,8 @@ UBWidgetList::UBWidgetList(QWidget* parent, eWidgetListOrientation orientation,
mpContainer = new QWidget(this); mpContainer = new QWidget(this);
mpEmptyLabel = new QLabel(this); mpEmptyLabel = new QLabel(this);
mpEmptyLabel->setObjectName("emptyString"); mpEmptyLabel->setObjectName("emptyString");
mpEmptyLabel->setWordWrap(true);
mpEmptyLabel->setAlignment(Qt::AlignCenter);
if(eWidgetListOrientation_Vertical == orientation){ if(eWidgetListOrientation_Vertical == orientation){
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

@ -278,11 +278,11 @@ void UBTeacherBarWidget::saveContent()
infos.title = mpTitle->text(); infos.title = mpTitle->text();
// Duration // Duration
if(mpDuration1->isChecked()){ if(mpDuration1->isChecked()){
infos.Duration = 0; infos.Duration = eDuration_Quarter;
}else if(mpDuration2->isChecked()){ }else if(mpDuration2->isChecked()){
infos.Duration = 1; infos.Duration = eDuration_Half;
}else{ }else{
infos.Duration = 2; infos.Duration = eDuration_ThreeQuarter;
} }
// Actions // Actions
for(int i=0; i<mActionList.size(); i++){ for(int i=0; i<mActionList.size(); i++){
@ -312,11 +312,11 @@ void UBTeacherBarWidget::loadContent()
mpTitle->setText(nextInfos.title); mpTitle->setText(nextInfos.title);
// Duration // Duration
switch(nextInfos.Duration){ switch(nextInfos.Duration){
case 0: mpDuration1->setChecked(true); case eDuration_Quarter: mpDuration1->setChecked(true);
break; break;
case 1: mpDuration2->setChecked(true); case eDuration_Half: mpDuration2->setChecked(true);
break; break;
case 2: mpDuration3->setChecked(true); case eDuration_ThreeQuarter: mpDuration3->setChecked(true);
break; break;
default: mpDuration1->setChecked(true); default: mpDuration1->setChecked(true);
break; break;
@ -351,8 +351,18 @@ void UBTeacherBarWidget::loadContent()
} }
if(!isEmpty()){ if(!isEmpty()){
// Update the fields of the preview widget
mpPreview->setTitle(mpTitle->text());
mpPreview->mediaViewer()->loadMedia(nextInfos.medias); mpPreview->mediaViewer()->loadMedia(nextInfos.medias);
mpStackWidget->setCurrentWidget(mpPreview); mpStackWidget->setCurrentWidget(mpPreview);
if(mpDuration1->isChecked()){
mpPreview->setDuration(eDuration_Quarter);
}else if(mpDuration2->isChecked()){
mpPreview->setDuration(eDuration_Half);
}else{
mpPreview->setDuration(eDuration_ThreeQuarter);
}
} }
} }
@ -675,22 +685,60 @@ void UBUrlWidget::setUrl(const QString &url)
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(QWidget *parent, const char *name):QWidget(parent) UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(QWidget *parent, const char *name):QWidget(parent)
, mpLayout(NULL)
, mpEditButton(NULL) , mpEditButton(NULL)
, mpEditLayout(NULL) , mpTitle(NULL)
, mpDuration(NULL)
, mpActionsLabel(NULL)
, mpMediaLabel(NULL)
, mpCommentsLabel(NULL)
{ {
setObjectName(name); setObjectName(name);
mpLayout = new QVBoxLayout(this); setLayout(&mLayout);
setLayout(mpLayout);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
// Build the Preview widget
// Title + duration
mpTitle = new QLabel(this);
mpTitle->setObjectName("UBTeacherBarPreviewTitle");
mpTitle->setWordWrap(true);
mpTitle->setAlignment(Qt::AlignCenter);
mpDuration = new QLabel(this);
mTitleDurationLayout.addWidget(mpTitle, 0);
mTitleDurationLayout.addWidget(mpDuration, 1);
mLayout.addLayout(&mTitleDurationLayout, 0);
// Actions
mpActionsLabel = new QLabel(tr("Actions"), this);
mActionLabelLayout.addWidget(mpActionsLabel, 0);
mActionLabelLayout.addStretch(1);
mLayout.addLayout(&mActionLabelLayout);
// Media
mpMediaLabel = new QLabel(tr("Medias"), this);
mMediaLabelLayout.addWidget(mpMediaLabel, 0);
mMediaLabelLayout.addStretch(1);
mLayout.addLayout(&mMediaLabelLayout);
mLayout.addWidget(&mMediaViewer, 0);
// Temporary stretch
mLayout.addStretch(1);
// Comments
mpCommentsLabel = new QLabel(tr("Comments"), this);
mCommentsLabelLayout.addWidget(mpCommentsLabel, 0);
mCommentsLabelLayout.addStretch(1);
mLayout.addLayout(&mCommentsLabelLayout);
// Edit button
mpEditButton = new QPushButton(tr("Edit infos"), this); mpEditButton = new QPushButton(tr("Edit infos"), this);
mpEditLayout = new QVBoxLayout(); mpEditButton->setObjectName("DockPaletteWidgetButton");
mpEditLayout->addStretch(1); mEditLayout.addStretch(1);
mpEditLayout->addWidget(mpEditButton, 0); mEditLayout.addWidget(mpEditButton, 0);
mpEditLayout->addStretch(1); mEditLayout.addStretch(1);
mpEditLayout->addWidget(&mMediaViewer); mLayout.addLayout(&mEditLayout, 0);
mpLayout->addLayout(mpEditLayout);
connect(mpEditButton, SIGNAL(clicked()), this, SLOT(onEdit())); connect(mpEditButton, SIGNAL(clicked()), this, SLOT(onEdit()));
@ -698,18 +746,30 @@ UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(QWidget *parent, const char
UBTeacherBarPreviewWidget::~UBTeacherBarPreviewWidget() UBTeacherBarPreviewWidget::~UBTeacherBarPreviewWidget()
{ {
if(NULL != mpTitle){
delete mpTitle;
mpTitle = NULL;
}
if(NULL != mpDuration){
delete mpDuration;
mpDuration = NULL;
}
if(NULL != mpActionsLabel){
delete mpActionsLabel;
mpActionsLabel = NULL;
}
if(NULL != mpMediaLabel){
delete mpMediaLabel;
mpMediaLabel = NULL;
}
if(NULL != mpCommentsLabel){
delete mpCommentsLabel;
mpCommentsLabel = NULL;
}
if(NULL != mpEditButton){ if(NULL != mpEditButton){
delete mpEditButton; delete mpEditButton;
mpEditButton = NULL; mpEditButton = NULL;
} }
if(NULL != mpEditLayout){
delete mpEditLayout;
mpEditLayout = NULL;
}
if(NULL != mpLayout){
delete mpLayout;
mpLayout = NULL;
}
} }
void UBTeacherBarPreviewWidget::onEdit() void UBTeacherBarPreviewWidget::onEdit()
@ -717,6 +777,33 @@ void UBTeacherBarPreviewWidget::onEdit()
emit showEditMode(); emit showEditMode();
} }
void UBTeacherBarPreviewWidget::setTitle(const QString &title)
{
if(NULL != mpTitle){
mpTitle->setText(title);
}
}
void UBTeacherBarPreviewWidget::setDuration(eDuration duration)
{
if(NULL != mpDuration){
QPixmap p;
switch(duration){
case eDuration_Quarter:
p = QPixmap(":images/duration1.png");
break;
case eDuration_Half:
p = QPixmap(":images/duration2.png");
break;
case eDuration_ThreeQuarter:
p = QPixmap(":images/duration3.png");
break;
default:
break;
}
mpDuration->setPixmap(p.scaledToHeight(16, Qt::SmoothTransformation));
}
}
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
UBTeacherBarPreviewMedia::UBTeacherBarPreviewMedia(QWidget* parent, const char* name) : QWidget(parent) UBTeacherBarPreviewMedia::UBTeacherBarPreviewMedia(QWidget* parent, const char* name) : QWidget(parent)

@ -21,6 +21,12 @@ class UBMediaPlayer;
#define LABEL_MINWIDHT 80 #define LABEL_MINWIDHT 80
typedef enum{
eDuration_Quarter,
eDuration_Half,
eDuration_ThreeQuarter
}eDuration;
class UBTeacherStudentAction : public QWidget class UBTeacherStudentAction : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -111,6 +117,8 @@ public:
UBTeacherBarPreviewWidget(QWidget* parent=0, const char* name="UBTeacherBarPreviewWidget"); UBTeacherBarPreviewWidget(QWidget* parent=0, const char* name="UBTeacherBarPreviewWidget");
~UBTeacherBarPreviewWidget(); ~UBTeacherBarPreviewWidget();
UBTeacherBarPreviewMedia* mediaViewer() {return &mMediaViewer;} UBTeacherBarPreviewMedia* mediaViewer() {return &mMediaViewer;}
void setTitle(const QString& title);
void setDuration(eDuration duration);
signals: signals:
void showEditMode(); void showEditMode();
@ -119,10 +127,19 @@ private slots:
void onEdit(); void onEdit();
private: private:
QVBoxLayout* mpLayout; QVBoxLayout mLayout;
QPushButton* mpEditButton; QHBoxLayout mEditLayout;
QVBoxLayout* mpEditLayout; QHBoxLayout mTitleDurationLayout;
QHBoxLayout mActionLabelLayout;
QHBoxLayout mMediaLabelLayout;
QHBoxLayout mCommentsLabelLayout;
UBTeacherBarPreviewMedia mMediaViewer; UBTeacherBarPreviewMedia mMediaViewer;
QPushButton* mpEditButton;
QLabel* mpTitle;
QLabel* mpDuration;
QLabel* mpActionsLabel;
QLabel* mpMediaLabel;
QLabel* mpCommentsLabel;
}; };
class UBTeacherBarWidget : public UBDockPaletteWidget class UBTeacherBarWidget : public UBDockPaletteWidget

Loading…
Cancel
Save