diff --git a/resources/images/teacher_close.png b/resources/images/teacher_close.png
new file mode 100644
index 00000000..bee2ea0d
Binary files /dev/null and b/resources/images/teacher_close.png differ
diff --git a/resources/images/teacher_close_disabled.png b/resources/images/teacher_close_disabled.png
new file mode 100644
index 00000000..8f3c988c
Binary files /dev/null and b/resources/images/teacher_close_disabled.png differ
diff --git a/resources/images/teacher_open.png b/resources/images/teacher_open.png
new file mode 100644
index 00000000..17469cc7
Binary files /dev/null and b/resources/images/teacher_open.png differ
diff --git a/resources/images/teacher_open_disabled.png b/resources/images/teacher_open_disabled.png
new file mode 100644
index 00000000..99e78cd9
Binary files /dev/null and b/resources/images/teacher_open_disabled.png differ
diff --git a/resources/sankore.qrc b/resources/sankore.qrc
index 501755ef..88354189 100644
--- a/resources/sankore.qrc
+++ b/resources/sankore.qrc
@@ -319,12 +319,16 @@
images/pages_open.png
images/cache_close.png
images/cache_open.png
- style.qss
images/cache_circle.png
images/cache_square.png
images/down_arrow.png
images/up_arrow.png
images/left_arrow.png
images/right_arrow.png
+ style.qss
+ images/teacher_close.png
+ images/teacher_close_disabled.png
+ images/teacher_open.png
+ images/teacher_open_disabled.png
diff --git a/resources/style.qss b/resources/style.qss
index 9f79a645..1c0ab3a3 100644
--- a/resources/style.qss
+++ b/resources/style.qss
@@ -1,7 +1,8 @@
QWidget#DockPaletteWidgetBox,
QWidget#documentNavigator,
QWidget#UBLibraryWidget,
-QWidget#UBLibPathViewer
+QWidget#UBLibPathViewer,
+QWidget#UBTeacherStudentAction
{
background: #EEEEEE;
border-radius: 10px;
@@ -21,6 +22,40 @@ QLabel#DockPaletteWidgetTitle
font-weight:bold;
}
+QLineEdit#DockPaletteWidgetLineEdit
+{
+ background: white;
+ border-radius : 10px;
+ padding: 2px;
+}
+
+QComboBox#DockPaletteWidgetComboBox
+{
+ background: white;
+ border-radius : 10px;
+ padding: 2px;
+}
+
+QComboBox#DockPaletteWidgetComboBox:drop-down
+{
+ background: white;
+ width:1px;
+ height:1px;
+ margin: 9px 5px 0px 0px;
+}
+
+QComboBox#DockPaletteWidgetComboBox::down-arrow
+{
+ image:url(:/images/down_arrow.png);
+ background:#BBBBBB;
+ border: 2px solid #999999;
+ height:16px;
+ width:16px;
+ padding: 0px 0px 0px 0px;
+ margin: 5px 10px 0px 0px;
+ border-radius: 10px;
+}
+
QPushButton#DockPaletteWidgetButton
{
background-color : #DDDDDD;
@@ -31,6 +66,13 @@ QPushButton#DockPaletteWidgetButton
font-size : 12px;
}
+QTextEdit#TeacherStudentBox
+{
+ background: white;
+ border: 2px solid #999999;
+ border-radius: 10px;
+}
+
QPushButton#DockPaletteWidgetButton::checked
{
background-color: #BBBBBB;
diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp
index 08d609bf..a6461bc5 100755
--- a/src/board/UBBoardPaletteManager.cpp
+++ b/src/board/UBBoardPaletteManager.cpp
@@ -76,6 +76,7 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
, mpPageNavigWidget(NULL)
, mpLibWidget(NULL)
, mpCachePropWidget(NULL)
+ , mpTeacherBarWidget(NULL)
, mDesktopRightPalette(NULL)
, mpDesktopLibWidget(NULL)
{
@@ -96,6 +97,11 @@ UBBoardPaletteManager::~UBBoardPaletteManager()
delete mpLibWidget;
mpLibWidget = NULL;
}
+ if(NULL != mpTeacherBarWidget)
+ {
+ delete mpTeacherBarWidget;
+ mpTeacherBarWidget = NULL;
+ }
if(NULL != mpCachePropWidget)
{
delete mpCachePropWidget;
@@ -155,8 +161,13 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
// RIGHT palette widgets
mRightPalette->registerWidget(mpLibWidget);
mRightPalette->registerWidget(mpCachePropWidget);
+ mRightPalette->registerWidget(mpTeacherBarWidget);
mRightPalette->addTabWidget(mpLibWidget);
+ mRightPalette->addTabWidget(mpTeacherBarWidget);
mRightPalette->connectSignals();
+
+ mLeftPalette->showTabWidget(0);
+ mRightPalette->showTabWidget(0);
}
void UBBoardPaletteManager::setupPalettes()
@@ -169,6 +180,7 @@ void UBBoardPaletteManager::setupPalettes()
mpPageNavigWidget = new UBPageNavigationWidget();
mpLibWidget = new UBLibWidget();
mpCachePropWidget = new UBCachePropertiesWidget();
+ mpTeacherBarWidget = new UBTeacherBarWidget();
setupDockPaletteWidgets();
@@ -717,3 +729,9 @@ UBRightPalette* UBBoardPaletteManager::createDesktopRightPalette(QWidget* parent
return mDesktopRightPalette;
}
+
+void UBBoardPaletteManager::refreshPalettes()
+{
+ mRightPalette->update();
+ mLeftPalette->update();
+}
diff --git a/src/board/UBBoardPaletteManager.h b/src/board/UBBoardPaletteManager.h
index 4ca00fd7..dc81dd17 100644
--- a/src/board/UBBoardPaletteManager.h
+++ b/src/board/UBBoardPaletteManager.h
@@ -25,6 +25,7 @@
#include "gui/UBPageNavigationWidget.h"
#include "gui/UBLibWidget.h"
#include "gui/UBCachePropertiesWidget.h"
+#include "gui/UBTeacherBarWidget.h"
class UBStylusPalette;
class UBClockPalette;
@@ -49,6 +50,7 @@ class UBBoardPaletteManager : public QObject
UBLeftPalette* leftPalette(){return mLeftPalette;}
void showVirtualKeyboard(bool show = true);
void initPalettesPosAtStartup();
+ void refreshPalettes();
UBKeyboardPalette *mKeyboardPalette;
UBRightPalette* createDesktopRightPalette(QWidget* parent);
@@ -113,6 +115,8 @@ class UBBoardPaletteManager : public QObject
UBLibWidget* mpLibWidget;
/** The cache properties widget */
UBCachePropertiesWidget* mpCachePropWidget;
+ /** The teacherbar widget */
+ UBTeacherBarWidget* mpTeacherBarWidget;
// HACK: here we duplicate the lib widget for the desktop mode
// we MUST refactor the architecture in order to use only one
diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp
index bdb0a11b..8c2f3f95 100644
--- a/src/core/UBPersistenceManager.cpp
+++ b/src/core/UBPersistenceManager.cpp
@@ -1056,3 +1056,89 @@ bool UBPersistenceManager::mayHaveWidget(UBDocumentProxy* pDocumentProxy)
return widgetDir.exists() && widgetDir.entryInfoList(QDir::Dirs).length() > 0;
}
+void UBPersistenceManager::persistTeacherBar(UBDocumentProxy* pDocumentProxy, int page, sTeacherBarInfos infos)
+{
+ if(NULL != pDocumentProxy)
+ {
+ QFile f(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", page + 1));
+ if(f.exists())
+ {
+ if(f.open(QIODevice::ReadOnly))
+ {
+ QDomDocument domDoc;
+ if(domDoc.setContent(f.readAll()))
+ {
+ f.close();
+ if(f.open(QIODevice::WriteOnly))
+ {
+ QDomElement rootElem = domDoc.documentElement();
+ QDomNode teacherBarNode = domDoc.namedItem("teacherBar");
+ if(teacherBarNode.isNull())
+ {
+ // Create the element
+ QDomElement teacherElem = domDoc.createElement("teacherBar");
+ rootElem.appendChild(teacherElem);
+ teacherBarNode = teacherElem;
+ }
+
+ // Set the element values
+ QDomElement teacherBarElem = teacherBarNode.toElement();
+ teacherBarElem.setAttribute("title", infos.title);
+ teacherBarElem.setAttribute("phasis", infos.phasis);
+ teacherBarElem.setAttribute("duration", infos.Duration);
+ teacherBarElem.setAttribute("equipment", infos.material);
+ teacherBarElem.setAttribute("activity", infos.activity);
+ teacherBarElem.setAttribute("action1Teacher", infos.action1Master);
+ teacherBarElem.setAttribute("action1Student", infos.action1Student);
+ teacherBarElem.setAttribute("action2Teacher", infos.action2Master);
+ teacherBarElem.setAttribute("action2Student", infos.action2Student);
+ teacherBarElem.setAttribute("action3Teacher", infos.action3Master);
+ teacherBarElem.setAttribute("action3Student", infos.action3Student);
+
+ // Save the file
+ f.write(domDoc.toString().toAscii());
+ f.close();
+ }
+ }
+ f.close();
+ }
+ }
+ }
+}
+
+sTeacherBarInfos UBPersistenceManager::getTeacherBarInfos(UBDocumentProxy* pDocumentProxy, int page)
+{
+ sTeacherBarInfos infos;
+
+ if(NULL != pDocumentProxy)
+ {
+ QFile f(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", page + 1));
+ if(f.exists())
+ {
+ if(f.open(QIODevice::ReadWrite))
+ {
+ QDomDocument domDoc;
+ if(domDoc.setContent(f.readAll()))
+ {
+ QDomElement rootElem = domDoc.documentElement();
+ QDomNode teacherBarNode = rootElem.namedItem("teacherBar");
+
+ infos.title = teacherBarNode.toElement().attributeNode("title").value();
+ infos.phasis = teacherBarNode.toElement().attributeNode("phasis").value().toInt();
+ infos.Duration = teacherBarNode.toElement().attributeNode("duration").value().toInt();
+ infos.material = teacherBarNode.toElement().attributeNode("equipment").value();
+ infos.activity = teacherBarNode.toElement().attributeNode("activity").value().toInt();
+ infos.action1Master = teacherBarNode.toElement().attributeNode("action1Teacher").value();
+ infos.action1Student = teacherBarNode.toElement().attributeNode("action1Student").value();
+ infos.action2Master = teacherBarNode.toElement().attributeNode("action2Teacher").value();
+ infos.action2Student = teacherBarNode.toElement().attributeNode("action2Student").value();
+ infos.action3Master = teacherBarNode.toElement().attributeNode("action3Teacher").value();
+ infos.action3Student = teacherBarNode.toElement().attributeNode("action3Student").value();
+ }
+ f.close();
+ }
+ }
+ }
+
+ return infos;
+}
diff --git a/src/core/UBPersistenceManager.h b/src/core/UBPersistenceManager.h
index 9189e38f..98a296f6 100644
--- a/src/core/UBPersistenceManager.h
+++ b/src/core/UBPersistenceManager.h
@@ -20,6 +20,21 @@
#include "UBSceneCache.h"
+struct sTeacherBarInfos
+{
+ QString title;
+ int phasis;
+ int Duration;
+ QString material;
+ int activity;
+ QString action1Master;
+ QString action1Student;
+ QString action2Master;
+ QString action2Student;
+ QString action3Master;
+ QString action3Student;
+};
+
class UBDocument;
class UBDocumentProxy;
class UBGraphicsScene;
@@ -59,6 +74,9 @@ class UBPersistenceManager : public QObject
virtual void persistDocumentScene(UBDocumentProxy* pDocumentProxy,
UBGraphicsScene* pScene, const int pSceneIndex);
+ virtual void persistTeacherBar(UBDocumentProxy* pDocumentProxy, int page, sTeacherBarInfos infos);
+
+ sTeacherBarInfos getTeacherBarInfos(UBDocumentProxy* pDocumentProxy, int page);
virtual UBGraphicsScene* createDocumentSceneAt(UBDocumentProxy* pDocumentProxy, int index);
diff --git a/src/gui/UBDocumentNavigator.cpp b/src/gui/UBDocumentNavigator.cpp
index afd62d79..4d3ee9a0 100644
--- a/src/gui/UBDocumentNavigator.cpp
+++ b/src/gui/UBDocumentNavigator.cpp
@@ -138,7 +138,10 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage)
{
// Save the current state of the scene
pScene->setModified(true);
- UBSvgSubsetAdaptor::persistScene(mCrntDoc,pScene, iPage);
+ if(UBApplication::boardController)
+ {
+ UBApplication::boardController->persistCurrentScene();
+ }
UBThumbnailAdaptor::persistScene(mCrntDoc->persistencePath(), pScene, iPage);
diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp
new file mode 100644
index 00000000..513cd246
--- /dev/null
+++ b/src/gui/UBTeacherBarWidget.cpp
@@ -0,0 +1,431 @@
+#include "UBTeacherBarWidget.h"
+
+#include "core/UBApplication.h"
+#include "core/UBPersistenceManager.h"
+
+#include "document/UBDocumentController.h"
+#include "document/UBDocumentProxy.h"
+
+#include "board/UBBoardController.h"
+#include "board/UBBoardPaletteManager.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();
+
+ connect(UBApplication::boardController, SIGNAL(activeSceneWillChange()), this, SLOT(saveContent()));
+ connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(loadContent()));
+ connect(mpTitle, SIGNAL(textChanged(QString)), this, SLOT(onValueChanged()));
+ connect(mpPhasis, SIGNAL(currentIndexChanged(int)), this, SLOT(onValueChanged()));
+ connect(mpDuration, SIGNAL(currentIndexChanged(int)), this, SLOT(onValueChanged()));
+ connect(mpEquipment, SIGNAL(textChanged(QString)), this, SLOT(onValueChanged()));
+ connect(mpActivity, SIGNAL(currentIndexChanged(int)), this, SLOT(onValueChanged()));
+ connect(mpAction1->teacher(), 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()
+{
+ 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("") << tr("I discover") << tr("I experiment") << tr("I train myself") << tr("I play") << tr("I memorize");
+ mpPhasis->insertItems(0, qslPhasis);
+ mpPhasis->setCurrentIndex(0);
+
+ QStringList qslDuration;
+ qslDuration << tr("") << tr("Short") << tr("Middle") << tr("Long");
+ mpDuration->insertItems(0, qslDuration);
+ mpDuration->setCurrentIndex(0);
+
+ QStringList qslActivity;
+ qslActivity << tr("") << tr("Alone") << tr("By Group") << tr("All together");
+ mpActivity->insertItems(0, qslActivity);
+ mpActivity->setCurrentIndex(0);
+}
+
+void UBTeacherBarWidget::saveContent()
+{
+ sTeacherBarInfos infos;
+ infos.title = mpTitle->text();
+ infos.phasis = mpPhasis->currentIndex();
+ infos.Duration = mpDuration->currentIndex();
+ infos.material = mpEquipment->text();
+ infos.activity = mpActivity->currentIndex();
+ infos.action1Master = mpAction1->teacherText();
+ 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);
+}
+
+void UBTeacherBarWidget::loadContent()
+{
+ sTeacherBarInfos nextInfos = UBPersistenceManager::persistenceManager()->getTeacherBarInfos(UBApplication::boardController->activeDocument(), UBApplication::boardController->activeSceneIndex());
+ mpTitle->setText(nextInfos.title);
+ mpPhasis->setCurrentIndex(nextInfos.phasis);
+ mpDuration->setCurrentIndex(nextInfos.Duration);
+ mpEquipment->setText(nextInfos.material);
+ mpActivity->setCurrentIndex(nextInfos.activity);
+ mpAction1->setTeacherText(nextInfos.action1Master);
+ mpAction1->setStudentText(nextInfos.action1Student);
+ mpAction2->setTeacherText(nextInfos.action2Master);
+ mpAction2->setStudentText(nextInfos.action2Student);
+ mpAction3->setTeacherText(nextInfos.action3Master);
+ mpAction3->setStudentText(nextInfos.action3Student);
+}
+
+void UBTeacherBarWidget::onValueChanged()
+{
+ if( mpTitle->text() == ""
+ && mpDuration->currentIndex() == 0
+ && mpPhasis->currentIndex() == 0
+ && mpEquipment->text() == ""
+ && mpActivity->currentIndex() == 0
+ && mpAction1->teacherText() == ""
+ && mpAction1->studentText() == ""
+ && mpAction2->teacherText() == ""
+ && mpAction2->studentText() == ""
+ && mpAction3->teacherText() == ""
+ && mpAction3->studentText() == "")
+ {
+ mIconToLeft = QPixmap(":images/teacher_open_disabled.png");
+ mIconToRight = QPixmap(":images/teacher_close_disabled.png");
+ }
+ else
+ {
+ mIconToLeft = QPixmap(":images/teacher_open.png");
+ mIconToRight = QPixmap(":images/teacher_close.png");
+ }
+
+ UBApplication::boardController->paletteManager()->refreshPalettes();
+}
+
+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();
+}
+
+void UBTeacherStudentAction::setTeacherText(QString text)
+{
+ mpTeacher->setText(text);
+}
+
+void UBTeacherStudentAction::setStudentText(QString text)
+{
+ mpStudent->setText(text);
+}
+
+QTextEdit* UBTeacherStudentAction::teacher()
+{
+ return mpTeacher;
+}
+
+QTextEdit* UBTeacherStudentAction::student()
+{
+ return mpStudent;
+}
diff --git a/src/gui/UBTeacherBarWidget.h b/src/gui/UBTeacherBarWidget.h
new file mode 100644
index 00000000..555b6ef6
--- /dev/null
+++ b/src/gui/UBTeacherBarWidget.h
@@ -0,0 +1,78 @@
+#ifndef UBTEACHERBARWIDGET_H
+#define UBTEACHERBARWIDGET_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#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();
+ void setTeacherText(QString text);
+ void setStudentText(QString text);
+ QTextEdit* teacher();
+ QTextEdit* student();
+
+private:
+ int mActionNumber;
+ QLabel* mpActionLabel;
+ QLabel* mpTeacherLabel;
+ QLabel* mpStudentLabel;
+ QTextEdit* mpTeacher;
+ QTextEdit* mpStudent;
+ QVBoxLayout* mpLayout;
+ QHBoxLayout* mpTeacherLayout;
+ QHBoxLayout* mpStudentLayout;
+};
+
+class UBTeacherBarWidget : public UBDockPaletteWidget
+{
+ Q_OBJECT
+public:
+ UBTeacherBarWidget(QWidget* parent=0, const char* name="UBTeacherBarWidget");
+ ~UBTeacherBarWidget();
+
+private slots:
+ void saveContent();
+ void loadContent();
+ void onValueChanged();
+
+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
diff --git a/src/gui/gui.pri b/src/gui/gui.pri
index 3dae376c..d7ad9d1e 100644
--- a/src/gui/gui.pri
+++ b/src/gui/gui.pri
@@ -42,7 +42,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBPageNavigationWidget.h \
src/gui/UBLibWidget.h \
src/gui/UBMagnifer.h \
- src/gui/UBCachePropertiesWidget.h
+ src/gui/UBCachePropertiesWidget.h \
+ src/gui/UBTeacherBarWidget.h
SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \
@@ -87,7 +88,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBPageNavigationWidget.cpp \
src/gui/UBLibWidget.cpp \
src/gui/UBMagnifer.cpp \
- src/gui/UBCachePropertiesWidget.cpp
+ src/gui/UBCachePropertiesWidget.cpp \
+ src/gui/UBTeacherBarWidget.cpp
win32 {