Backup of the teacher bar

preferencesAboutTextFull
shibakaneki 13 years ago
parent 724a0dba36
commit f02cb47847
  1. 12
      src/board/UBBoardPaletteManager.cpp
  2. 3
      src/board/UBBoardPaletteManager.h
  3. 329
      src/gui/UBTeacherBarWidget.cpp
  4. 68
      src/gui/UBTeacherBarWidget.h
  5. 6
      src/gui/gui.pri

@ -77,6 +77,7 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
, mpLibWidget(NULL) , mpLibWidget(NULL)
, mpCachePropWidget(NULL) , mpCachePropWidget(NULL)
, mDesktopRightPalette(NULL) , mDesktopRightPalette(NULL)
, mpTeacherBarWidget(NULL)
, mpDesktopLibWidget(NULL) , mpDesktopLibWidget(NULL)
{ {
setupPalettes(); setupPalettes();
@ -86,6 +87,11 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
UBBoardPaletteManager::~UBBoardPaletteManager() UBBoardPaletteManager::~UBBoardPaletteManager()
{ {
if(NULL != mpTeacherBarWidget)
{
delete mpTeacherBarWidget;
mpTeacherBarWidget = NULL;
}
if(NULL != mpPageNavigWidget) if(NULL != mpPageNavigWidget)
{ {
delete mpPageNavigWidget; delete mpPageNavigWidget;
@ -156,7 +162,12 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mRightPalette->registerWidget(mpLibWidget); mRightPalette->registerWidget(mpLibWidget);
mRightPalette->registerWidget(mpCachePropWidget); mRightPalette->registerWidget(mpCachePropWidget);
mRightPalette->addTabWidget(mpLibWidget); mRightPalette->addTabWidget(mpLibWidget);
mRightPalette->registerWidget(mpTeacherBarWidget);
//mRightPalette->addTabWidget(mpTeacherBarWidget);
mRightPalette->connectSignals(); mRightPalette->connectSignals();
mLeftPalette->showTabWidget(0);
mRightPalette->showTabWidget(0);
} }
void UBBoardPaletteManager::setupPalettes() void UBBoardPaletteManager::setupPalettes()
@ -169,6 +180,7 @@ void UBBoardPaletteManager::setupPalettes()
mpPageNavigWidget = new UBPageNavigationWidget(); mpPageNavigWidget = new UBPageNavigationWidget();
mpLibWidget = new UBLibWidget(); mpLibWidget = new UBLibWidget();
mpCachePropWidget = new UBCachePropertiesWidget(); mpCachePropWidget = new UBCachePropertiesWidget();
mpTeacherBarWidget = new UBTeacherBarWidget();
setupDockPaletteWidgets(); setupDockPaletteWidgets();

@ -25,6 +25,7 @@
#include "gui/UBPageNavigationWidget.h" #include "gui/UBPageNavigationWidget.h"
#include "gui/UBLibWidget.h" #include "gui/UBLibWidget.h"
#include "gui/UBCachePropertiesWidget.h" #include "gui/UBCachePropertiesWidget.h"
#include "gui/UBTeacherBarWidget.h"
class UBStylusPalette; class UBStylusPalette;
class UBClockPalette; class UBClockPalette;
@ -117,6 +118,8 @@ class UBBoardPaletteManager : public QObject
UBLibWidget* mpLibWidget; UBLibWidget* mpLibWidget;
/** The cache properties widget */ /** The cache properties widget */
UBCachePropertiesWidget* mpCachePropWidget; UBCachePropertiesWidget* mpCachePropWidget;
/** The teacher bar widget */
UBTeacherBarWidget* mpTeacherBarWidget;
// HACK: here we duplicate the lib widget for the desktop mode // HACK: here we duplicate the lib widget for the desktop mode
// we MUST refactor the architecture in order to use only one // we MUST refactor the architecture in order to use only one

@ -0,0 +1,329 @@
#include "UBTeacherBarWidget.h"
#include "core/UBApplication.h"
UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent)
, mpLayout(NULL)
, mpTitleLayout(NULL)
, mpPhasisLayout(NULL)
, mpDurationLayout(NULL)
, mpEquipmentLayout(NULL)
, mpActivityLayout(NULL)
, mpTitleLabel(NULL)
, mpPhasisLabel(NULL)
, mpDurationLabel(NULL)
, mpEquipmentLabel(NULL)
, mpActivityLabel(NULL)
, mpTitle(NULL)
, mpEquipment(NULL)
, mpPhasis(NULL)
, mpDuration(NULL)
, mpActivity(NULL)
, mpAction1(NULL)
, mpAction2(NULL)
, mpAction3(NULL)
, mpContainer(NULL)
, mpContainerLayout(NULL)
{
setObjectName(name);
mName = "TeacherBarWidget";
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
mIconToLeft = QPixmap(":images/teacher_open.png");
mIconToRight = QPixmap(":images/teacher_close.png");
// Create the GUI
mpContainerLayout = new QVBoxLayout(this);
setLayout(mpContainerLayout);
mpContainer = new QWidget(this);
mpContainer->setObjectName("DockPaletteWidgetBox");
mpContainerLayout->addWidget(mpContainer);
mpLayout = new QVBoxLayout(mpContainer);
mpContainer->setLayout(mpLayout);
// Title
mpTitleLabel = new QLabel(tr("Title"), mpContainer);
mpTitleLabel->setMinimumWidth(LABEL_MINWIDHT);
mpTitleLabel->setAlignment(Qt::AlignRight);
mpTitle = new QLineEdit(mpContainer);
mpTitle->setObjectName("DockPaletteWidgetLineEdit");
mpTitleLayout = new QHBoxLayout();
mpTitleLayout->addWidget(mpTitleLabel, 0);
mpTitleLayout->addWidget(mpTitle, 1);
mpLayout->addLayout(mpTitleLayout);
// Phasis
mpPhasisLabel = new QLabel(tr("Phasis"), mpContainer);
mpPhasisLabel->setMinimumWidth(LABEL_MINWIDHT);
mpPhasisLabel->setAlignment(Qt::AlignRight);
mpPhasis = new QComboBox(mpContainer);
mpPhasis->setObjectName("DockPaletteWidgetComboBox");
mpPhasisLayout = new QHBoxLayout();
mpPhasisLayout->addWidget(mpPhasisLabel, 0);
mpPhasisLayout->addWidget(mpPhasis, 1);
mpLayout->addLayout(mpPhasisLayout);
// Duration
mpDurationLabel = new QLabel(tr("Duration"), mpContainer);
mpDurationLabel->setMinimumWidth(LABEL_MINWIDHT);
mpDurationLabel->setAlignment(Qt::AlignRight);
mpDuration = new QComboBox(mpContainer);
mpDuration->setObjectName("DockPaletteWidgetComboBox");
mpDurationLayout = new QHBoxLayout();
mpDurationLayout->addWidget(mpDurationLabel, 0);
mpDurationLayout->addWidget(mpDuration, 1);
mpLayout->addLayout(mpDurationLayout);
// Equipment
mpEquipmentLabel = new QLabel(tr("Equipment"), mpContainer);
mpEquipmentLabel->setMinimumWidth(LABEL_MINWIDHT);
mpEquipmentLabel->setAlignment(Qt::AlignRight);
mpEquipment = new QLineEdit(mpContainer);
mpEquipment->setObjectName("DockPaletteWidgetLineEdit");
mpEquipmentLayout = new QHBoxLayout();
mpEquipmentLayout->addWidget(mpEquipmentLabel, 0);
mpEquipmentLayout->addWidget(mpEquipment, 1);
mpLayout->addLayout(mpEquipmentLayout);
// Activity
mpActivityLabel = new QLabel(tr("Activity"), mpContainer);
mpActivityLabel->setMinimumWidth(LABEL_MINWIDHT);
mpActivityLabel->setAlignment(Qt::AlignRight);
mpActivity = new QComboBox(mpContainer);
mpActivity->setObjectName("DockPaletteWidgetComboBox");
mpActivityLayout = new QHBoxLayout();
mpActivityLayout->addWidget(mpActivityLabel, 0);
mpActivityLayout->addWidget(mpActivity, 1);
mpLayout->addLayout(mpActivityLayout);
// 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);
populateCombos();
}
UBTeacherBarWidget::~UBTeacherBarWidget()
{
if(NULL != mpAction3)
{
delete mpAction3;
mpAction3 = NULL;
}
if(NULL != mpAction2)
{
delete mpAction2;
mpAction2 = NULL;
}
if(NULL != mpAction1)
{
delete mpAction1;
mpAction1 = NULL;
}
if(NULL != mpActivityLabel)
{
delete mpActivityLabel;
mpActivityLabel = NULL;
}
if(NULL != mpActivity)
{
delete mpActivity;
mpActivity = NULL;
}
if(NULL != mpActivityLayout)
{
delete mpActivityLayout;
mpActivityLayout = NULL;
}
if(NULL != mpEquipmentLabel)
{
delete mpEquipmentLabel;
mpEquipmentLabel = NULL;
}
if(NULL != mpEquipment)
{
delete mpEquipment;
mpEquipment = NULL;
}
if(NULL != mpEquipmentLayout)
{
delete mpEquipmentLayout;
mpEquipmentLayout = NULL;
}
if(NULL != mpDurationLabel)
{
delete mpDurationLabel;
mpDurationLabel = NULL;
}
if(NULL != mpDuration)
{
delete mpDuration;
mpDuration = NULL;
}
if(NULL != mpDurationLayout)
{
delete mpDurationLayout;
mpDurationLayout = NULL;
}
if(NULL != mpPhasisLabel)
{
delete mpPhasisLabel;
mpPhasisLabel = NULL;
}
if(NULL != mpPhasisLayout)
{
delete mpPhasisLayout;
mpPhasisLayout = NULL;
}
if(NULL != mpTitleLabel)
{
delete mpTitleLabel;
mpTitleLabel = NULL;
}
if(NULL != mpTitle)
{
delete mpTitle;
mpTitle = NULL;
}
if(NULL != mpTitleLayout)
{
delete mpTitleLayout;
mpTitleLayout = NULL;
}
if(NULL != mpLayout)
{
delete mpLayout;
mpLayout = NULL;
}
if(NULL != mpContainer)
{
delete mpContainer;
mpContainer = NULL;
}
if(NULL != mpContainerLayout)
{
delete mpContainerLayout;
mpContainerLayout = NULL;
}
}
void UBTeacherBarWidget::populateCombos()
{
QStringList qslPhasis;
qslPhasis << tr("I discover") << tr("I experiment") << tr("I train myself") << tr("I play") << tr("I memorize");
mpPhasis->insertItems(0, qslPhasis);
QStringList qslDuration;
qslDuration << tr("Short") << tr("Middle") << tr("Long");
mpDuration->insertItems(0, qslDuration);
QStringList qslActivity;
qslActivity << tr("Alone") << tr("By Group") << tr("All together");
mpActivity->insertItems(0, qslActivity);
}
UBTeacherStudentAction::UBTeacherStudentAction(int actionNumber, QWidget *parent, const char *name):QWidget(parent)
, mpActionLabel(NULL)
, mpTeacherLabel(NULL)
, mpStudentLabel(NULL)
, mpTeacher(NULL)
, mpStudent(NULL)
, mpLayout(NULL)
, mpTeacherLayout(NULL)
, mpStudentLayout(NULL)
{
setObjectName(name);
mActionNumber = actionNumber;
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
// Create the GUI
mpLayout = new QVBoxLayout(this);
setLayout(mpLayout);
mpActionLabel = new QLabel(tr("Action %0").arg(mActionNumber), this);
mpLayout->addWidget(mpActionLabel, 0);
mpTeacherLayout = new QHBoxLayout();
mpTeacherLabel = new QLabel(tr("Teacher"), this);
mpTeacherLabel->setAlignment(Qt::AlignTop);
mpTeacher = new QTextEdit(this);
mpTeacher->setObjectName("TeacherStudentBox");
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");
mpStudentLayout->addWidget(mpStudentLabel, 0);
mpStudentLayout->addWidget(mpStudent, 1);
mpLayout->addLayout(mpStudentLayout, 1);
}
UBTeacherStudentAction::~UBTeacherStudentAction()
{
if(NULL != mpActionLabel)
{
delete mpActionLabel;
mpActionLabel = NULL;
}
if(NULL != mpTeacherLabel)
{
delete mpTeacherLabel;
mpTeacherLabel = NULL;
}
if(NULL != mpTeacher)
{
delete mpTeacher;
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)
{
delete mpStudentLayout;
mpStudentLayout = NULL;
}
if(NULL != mpLayout)
{
delete mpLayout;
mpLayout = NULL;
}
}
QString UBTeacherStudentAction::teacherText()
{
return mpTeacher->document()->toPlainText();
}
QString UBTeacherStudentAction::studentText()
{
return mpStudent->document()->toPlainText();
}

@ -0,0 +1,68 @@
#ifndef UBTEACHERBARWIDGET_H
#define UBTEACHERBARWIDGET_H
#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QTextEdit>
#include <QLineEdit>
#include <QComboBox>
#include "UBDockPaletteWidget.h"
#define LABEL_MINWIDHT 80
class UBTeacherStudentAction : public QWidget
{
public:
UBTeacherStudentAction(int actionNumber, QWidget* parent=0, const char* name="UBTeacherStudentAction");
~UBTeacherStudentAction();
QString teacherText();
QString studentText();
private:
int mActionNumber;
QLabel* mpActionLabel;
QLabel* mpTeacherLabel;
QLabel* mpStudentLabel;
QTextEdit* mpTeacher;
QTextEdit* mpStudent;
QVBoxLayout* mpLayout;
QHBoxLayout* mpTeacherLayout;
QHBoxLayout* mpStudentLayout;
};
class UBTeacherBarWidget : public UBDockPaletteWidget
{
public:
UBTeacherBarWidget(QWidget* parent=0, const char* name="UBTeacherBarWidget");
~UBTeacherBarWidget();
private:
void populateCombos();
QVBoxLayout* mpLayout;
QHBoxLayout* mpTitleLayout;
QHBoxLayout* mpPhasisLayout;
QHBoxLayout* mpDurationLayout;
QHBoxLayout* mpEquipmentLayout;
QHBoxLayout* mpActivityLayout;
QLabel* mpTitleLabel;
QLabel* mpPhasisLabel;
QLabel* mpDurationLabel;
QLabel* mpEquipmentLabel;
QLabel* mpActivityLabel;
QLineEdit* mpTitle;
QLineEdit* mpEquipment;
QComboBox* mpPhasis;
QComboBox* mpDuration;
QComboBox* mpActivity;
UBTeacherStudentAction* mpAction1;
UBTeacherStudentAction* mpAction2;
UBTeacherStudentAction* mpAction3;
QWidget* mpContainer;
QVBoxLayout* mpContainerLayout;
};
#endif // UBTEACHERBARWIDGET_H

@ -42,7 +42,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBPageNavigationWidget.h \ src/gui/UBPageNavigationWidget.h \
src/gui/UBLibWidget.h \ src/gui/UBLibWidget.h \
src/gui/UBMagnifer.h \ src/gui/UBMagnifer.h \
src/gui/UBCachePropertiesWidget.h src/gui/UBCachePropertiesWidget.h \
src/gui/UBTeacherBarWidget.h
SOURCES += src/gui/UBThumbnailView.cpp \ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \ src/gui/UBFloatingPalette.cpp \
@ -87,7 +88,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBPageNavigationWidget.cpp \ src/gui/UBPageNavigationWidget.cpp \
src/gui/UBLibWidget.cpp \ src/gui/UBLibWidget.cpp \
src/gui/UBMagnifer.cpp \ src/gui/UBMagnifer.cpp \
src/gui/UBCachePropertiesWidget.cpp src/gui/UBCachePropertiesWidget.cpp \
src/gui/UBTeacherBarWidget.cpp
win32 { win32 {

Loading…
Cancel
Save