before handlig the page number

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent 9100597201
commit 4a1e71d3c3
  1. 2
      src/adaptors/UBCFFSubsetAdaptor.cpp
  2. 9
      src/board/UBBoardController.cpp
  3. 2
      src/board/UBBoardController.h
  4. 12
      src/board/UBBoardPaletteManager.cpp
  5. 3
      src/core/UBApplicationController.cpp
  6. 2
      src/core/UBSettings.cpp
  7. 2
      src/core/UBSettings.h
  8. 76
      src/gui/UBTeacherGuideWidget.cpp
  9. 9
      src/gui/UBTeacherGuideWidget.h

@ -17,7 +17,9 @@
#include <QSvgRenderer> #include <QSvgRenderer>
#include "core/UBPersistenceManager.h" #include "core/UBPersistenceManager.h"
#include "document/UBDocumentProxy.h" #include "document/UBDocumentProxy.h"
#include "domain/UBItem.h" #include "domain/UBItem.h"
#include "domain/UBGraphicsPolygonItem.h" #include "domain/UBGraphicsPolygonItem.h"
#include "domain/UBGraphicsStroke.h" #include "domain/UBGraphicsStroke.h"

@ -65,6 +65,8 @@
#include "UBBoardPaletteManager.h" #include "UBBoardPaletteManager.h"
#include "core/UBSettings.h"
#include "core/memcheck.h" #include "core/memcheck.h"
//#include <typeinfo> //#include <typeinfo>
@ -147,6 +149,13 @@ UBBoardController::~UBBoardController()
} }
int UBBoardController::currentPage()
{
if(!UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool())
return mActiveSceneIndex;
return mActiveSceneIndex + 1;
}
void UBBoardController::setupViews() void UBBoardController::setupViews()
{ {
mControlContainer = new QWidget(mMainWindow->centralWidget()); mControlContainer = new QWidget(mMainWindow->centralWidget());

@ -57,6 +57,8 @@ class UBBoardController : public QObject
QRectF controlGeometry(); QRectF controlGeometry();
void closing(); void closing();
int currentPage();
UBDocumentProxy* activeDocument() UBDocumentProxy* activeDocument()
{ {
return mActiveDocument; return mActiveDocument;

@ -129,25 +129,25 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
//------------------------------------------------// //------------------------------------------------//
// Create the widgets for the dock palettes // Create the widgets for the dock palettes
mpPageNavigWidget = new UBPageNavigationWidget();
mpLibWidget = new UBLibWidget(); mpLibWidget = new UBLibWidget();
mpCachePropWidget = new UBCachePropertiesWidget(); mpCachePropWidget = new UBCachePropertiesWidget();
mpDownloadWidget = new UBDockDownloadWidget(); mpDownloadWidget = new UBDockDownloadWidget();
mpTeacherGuideWidget = new UBDockTeacherGuideWidget();
// Add the dock palettes // Add the dock palettes
mLeftPalette = new UBLeftPalette(mContainer); mLeftPalette = new UBLeftPalette(mContainer);
// LEFT palette widgets // LEFT palette widgets
mpPageNavigWidget = new UBPageNavigationWidget();
mLeftPalette->registerWidget(mpPageNavigWidget); mLeftPalette->registerWidget(mpPageNavigWidget);
mLeftPalette->addTab(mpPageNavigWidget); mLeftPalette->addTab(mpPageNavigWidget);
mLeftPalette->registerWidget(mpTeacherGuideWidget); if(UBSettings::settings()->teacherGuidePageZeroActivated || UBSettings::settings()->teacherGuideLessonPagesActivated){
mLeftPalette->addTab(mpTeacherGuideWidget); mpTeacherGuideWidget = new UBDockTeacherGuideWidget();
mLeftPalette->registerWidget(mpTeacherGuideWidget);
mLeftPalette->addTab(mpTeacherGuideWidget);
}
mLeftPalette->connectSignals(); mLeftPalette->connectSignals();

@ -24,9 +24,6 @@
#include "core/UBDocumentManager.h" #include "core/UBDocumentManager.h"
#include "core/UBDisplayManager.h" #include "core/UBDisplayManager.h"
#include "softwareupdate/UBSoftwareUpdateController.h"
#include "softwareupdate/UBSoftwareUpdate.h"
#include "board/UBBoardView.h" #include "board/UBBoardView.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h" #include "board/UBBoardPaletteManager.h"

@ -381,6 +381,8 @@ void UBSettings::init()
angleTolerance = new UBSetting(this, "App", "AngleTolerance", 4); angleTolerance = new UBSetting(this, "App", "AngleTolerance", 4);
historyLimit = new UBSetting(this, "Web", "HistoryLimit", 15); historyLimit = new UBSetting(this, "Web", "HistoryLimit", 15);
teacherGuidePageZeroActivated = new UBSetting(this,"DockPalette","TeacherGuideActivatePageZero",true);
teacherGuideLessonPagesActivated = new UBSetting(this,"DockPalette","TeacherGuideActvateLessonPages",true);
} }

@ -330,6 +330,8 @@ class UBSettings : public QObject
UBSetting* angleTolerance; UBSetting* angleTolerance;
UBSetting* historyLimit; UBSetting* historyLimit;
UBSetting* teacherGuidePageZeroActivated;
UBSetting* teacherGuideLessonPagesActivated;
public slots: public slots:

@ -25,6 +25,7 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBPersistenceManager.h" #include "core/UBPersistenceManager.h"
#include "core/UBSettings.h"
#include "globals/UBGlobals.h" #include "globals/UBGlobals.h"
@ -146,7 +147,7 @@ void UBTeacherGuideEditionWidget::showEvent(QShowEvent* event)
void UBTeacherGuideEditionWidget::onActiveSceneChanged() void UBTeacherGuideEditionWidget::onActiveSceneChanged()
{ {
cleanData(); cleanData();
mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->activeSceneIndex() + 1)); mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->currentPage()));
} }
void UBTeacherGuideEditionWidget::cleanData() void UBTeacherGuideEditionWidget::cleanData()
@ -359,7 +360,7 @@ void UBTeacherGuidePresentationWidget::cleanData()
void UBTeacherGuidePresentationWidget::onActiveSceneChanged() void UBTeacherGuidePresentationWidget::onActiveSceneChanged()
{ {
cleanData(); cleanData();
mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->activeSceneIndex() + 1)); mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->currentPage()));
} }
void UBTeacherGuidePresentationWidget::createMediaButtonItem() void UBTeacherGuidePresentationWidget::createMediaButtonItem()
@ -459,7 +460,7 @@ void UBTeacherGuidePresentationWidget::onAddItemClicked(QTreeWidgetItem* widget,
/*************************************************************************** /***************************************************************************
* class UBTeacherGuidePageZeroEditionWidget * * class UBTeacherGuidePageZeroEditionWidget *
***************************************************************************/ ***************************************************************************/
UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget* parent, const char* name): QWidget(parent) UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, const char* name): QWidget(parent)
, mpLayout(NULL) , mpLayout(NULL)
, mpButtonTitleLayout(NULL) , mpButtonTitleLayout(NULL)
, mpModePushButton(NULL) , mpModePushButton(NULL)
@ -626,7 +627,7 @@ UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget
fillComboBoxes(); fillComboBoxes();
} }
UBTeacherGuidePageZeroEditionWidget::~UBTeacherGuidePageZeroEditionWidget() UBTeacherGuidePageZeroWidget::~UBTeacherGuidePageZeroWidget()
{ {
DELETEPTR(mpPageNumberLabel); DELETEPTR(mpPageNumberLabel);
DELETEPTR(mpSessionTitle); DELETEPTR(mpSessionTitle);
@ -659,7 +660,7 @@ UBTeacherGuidePageZeroEditionWidget::~UBTeacherGuidePageZeroEditionWidget()
DELETEPTR(mpLayout); DELETEPTR(mpLayout);
} }
void UBTeacherGuidePageZeroEditionWidget::fillComboBoxes() void UBTeacherGuidePageZeroWidget::fillComboBoxes()
{ {
QString parametersConfigFilePath = UBSettings::settings()->applicationCustomizationDirectory() + "/teacherGuide/indexingParameters.xml"; QString parametersConfigFilePath = UBSettings::settings()->applicationCustomizationDirectory() + "/teacherGuide/indexingParameters.xml";
QFile parametersFile(parametersConfigFilePath); QFile parametersFile(parametersConfigFilePath);
@ -704,7 +705,7 @@ void UBTeacherGuidePageZeroEditionWidget::fillComboBoxes()
mpLicenceBox->addItems(licences); mpLicenceBox->addItems(licences);
} }
void UBTeacherGuidePageZeroEditionWidget::onSchoolLevelChanged(QString schoolLevel) void UBTeacherGuidePageZeroWidget::onSchoolLevelChanged(QString schoolLevel)
{ {
QStringList subjects = mSubjects.value(mGradeLevelsMap.value(schoolLevel)); QStringList subjects = mSubjects.value(mGradeLevelsMap.value(schoolLevel));
mpSchoolBranchBox->clear(); mpSchoolBranchBox->clear();
@ -719,19 +720,19 @@ void UBTeacherGuidePageZeroEditionWidget::onSchoolLevelChanged(QString schoolLev
} }
} }
void UBTeacherGuidePageZeroEditionWidget::onActiveSceneChanged() void UBTeacherGuidePageZeroWidget::onActiveSceneChanged()
{ {
UBDocumentProxy* documentProxy = UBApplication::documentController ? UBApplication::documentController->getCurrentDocument() : 0; UBDocumentProxy* documentProxy = UBApplication::documentController ? UBApplication::documentController->getCurrentDocument() : 0;
if(UBApplication::documentController && UBApplication::boardController->activeSceneIndex() == 0){ if(UBApplication::documentController && UBApplication::boardController->currentPage() == 0){
// QDateTime creationDate = documentProxy->documentDate(); QDateTime creationDate = documentProxy->documentDate();
// mpCreationLabel->setText(tr("Created the:") + creationDate.toString(Qt::SystemLocaleShortDate)); mpCreationLabel->setText(tr("Created the:") + creationDate.toString(Qt::SystemLocaleShortDate));
// QDateTime updatedDate = documentProxy->lastUpdate(); QDateTime updatedDate = documentProxy->lastUpdate();
// mpLastModifiedLabel->setText(tr("Updated the:") + updatedDate.toString(Qt::SystemLocaleShortDate)); mpLastModifiedLabel->setText(tr("Updated the:") + updatedDate.toString(Qt::SystemLocaleShortDate));
} }
} }
void UBTeacherGuidePageZeroEditionWidget::switchToMode(tUBTGZeroPageMode mode) void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode)
{ {
if(mode == tUBTGZeroPageMode_EDITION){ if(mode == tUBTGZeroPageMode_EDITION){
mpModePushButton->hide(); mpModePushButton->hide();
@ -767,10 +768,8 @@ void UBTeacherGuidePageZeroEditionWidget::switchToMode(tUBTGZeroPageMode mode)
mpLicenceValueLabel->setText(mpLicenceBox->currentText()); mpLicenceValueLabel->setText(mpLicenceBox->currentText());
QStringList licenceIconList; QStringList licenceIconList;
licenceIconList << ":images/licenses/ccby.png" << ":images/licenses/ccbynd.png" << ":images/licenses/ccbysa.png" << ":images/licenses/ccbync.png" << ":images/licenses/ccbyncnd.png" << ":images/licenses/ccbyncsa.png"; licenceIconList << ":images/licenses/ccby.png" << ":images/licenses/ccbynd.png" << ":images/licenses/ccbysa.png" << ":images/licenses/ccbync.png" << ":images/licenses/ccbyncnd.png" << ":images/licenses/ccbyncsa.png";
int licenceBoxCurrentIndex = mpLicenceBox->currentIndex(); if(mpLicenceBox->currentIndex() < 6){
// -1 is return if there is no values on the box mpLicenceIcon->setPixmap(licenceIconList.at(mpLicenceBox->currentIndex()));
if(licenceBoxCurrentIndex > 0 && licenceBoxCurrentIndex < licenceIconList.count()){
mpLicenceIcon->setPixmap(licenceIconList.at(licenceBoxCurrentIndex));
mpLicenceIcon->show(); mpLicenceIcon->show();
} }
mpLicenceValueLabel->show(); mpLicenceValueLabel->show();
@ -778,7 +777,7 @@ void UBTeacherGuidePageZeroEditionWidget::switchToMode(tUBTGZeroPageMode mode)
} }
} }
QVector<tUBGEElementNode*> UBTeacherGuidePageZeroEditionWidget::getData() QVector<tUBGEElementNode*> UBTeacherGuidePageZeroWidget::getData()
{ {
QVector<tUBGEElementNode*>result; QVector<tUBGEElementNode*>result;
tUBGEElementNode* elementNode = new tUBGEElementNode(); tUBGEElementNode* elementNode = new tUBGEElementNode();
@ -837,24 +836,25 @@ QVector<tUBGEElementNode*> UBTeacherGuidePageZeroEditionWidget::getData()
* class UBTeacherGuideWidget * * class UBTeacherGuideWidget *
***************************************************************************/ ***************************************************************************/
UBTeacherGuideWidget::UBTeacherGuideWidget(QWidget* parent, const char* name): QStackedWidget(parent) UBTeacherGuideWidget::UBTeacherGuideWidget(QWidget* parent, const char* name): QStackedWidget(parent)
, mpPageZeroEditonWidget(NULL) , mpPageZeroWidget(NULL)
, mpEditionWidget(NULL) , mpEditionWidget(NULL)
, mpPresentationWidget(NULL) , mpPresentationWidget(NULL)
{ {
setObjectName(name); setObjectName(name);
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()){
mpPageZeroEditonWidget = new UBTeacherGuidePageZeroEditionWidget(this); mpPageZeroWidget = new UBTeacherGuidePageZeroWidget(this);
addWidget(mpPageZeroEditonWidget); addWidget(mpPageZeroWidget);
setCurrentWidget(mpPageZeroEditonWidget); }
// mpEditionWidget = new UBTeacherGuideEditionWidget(this); if(UBSettings::settings()->teacherGuideLessonPagesActivated->get().toBool()){
// addWidget(mpEditionWidget); mpEditionWidget = new UBTeacherGuideEditionWidget(this);
// mpPresentationWidget = new UBTeacherGuidePresentationWidget(this); addWidget(mpEditionWidget);
// addWidget(mpPresentationWidget); mpPresentationWidget = new UBTeacherGuidePresentationWidget(this);
// setCurrentWidget(mpPresentationWidget); addWidget(mpPresentationWidget);
}
connect(UBApplication::boardController->controlView(),SIGNAL(clickOnBoard()),this,SLOT(showPresentationMode())); connect(UBApplication::boardController->controlView(),SIGNAL(clickOnBoard()),this,SLOT(showPresentationMode()));
connectToStylusPalette(); connectToStylusPalette();
connect(UBApplication::boardController,SIGNAL(activeSceneChanged()),this,SLOT(onActiveSceneChanged()));
} }
@ -864,19 +864,29 @@ UBTeacherGuideWidget::~UBTeacherGuideWidget()
DELETEPTR(mpPresentationWidget); DELETEPTR(mpPresentationWidget);
} }
void UBTeacherGuideWidget::onActiveSceneChanged()
{
if(UBApplication::boardController->currentPage() == 0)
setCurrentWidget(mpPageZeroWidget);
else
setCurrentWidget(mpPresentationWidget);
}
void UBTeacherGuideWidget::connectToStylusPalette() void UBTeacherGuideWidget::connectToStylusPalette()
{ {
if(UBApplication::boardController->paletteManager()) if(UBApplication::boardController->paletteManager())
connect(UBApplication::boardController->paletteManager()->stylusPalette(),SIGNAL(itemOnActionPaletteChanged()),this,SLOT(showPresentationMode())); connect(UBApplication::boardController->paletteManager()->stylusPalette(),SIGNAL(itemOnActionPaletteChanged()),this,SLOT(showPresentationMode()));
else else
QTimer::singleShot(500,this,SLOT(connectToStylusPalette())); QTimer::singleShot(100,this,SLOT(connectToStylusPalette()));
} }
void UBTeacherGuideWidget::showPresentationMode() void UBTeacherGuideWidget::showPresentationMode()
{ {
if(currentWidget()==mpPageZeroEditonWidget){ if(currentWidget()==mpPageZeroWidget){
mCurrentData = mpPageZeroEditonWidget->getData(); mCurrentData = mpPageZeroWidget->getData();
mpPageZeroEditonWidget->switchToMode(tUBTGZeroPageMode_PRESENTATION); mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_PRESENTATION);
} }
else if(currentWidget()==mpEditionWidget){ else if(currentWidget()==mpEditionWidget){
mCurrentData = mpEditionWidget->getData(); mCurrentData = mpEditionWidget->getData();

@ -105,13 +105,13 @@ private:
/*************************************************************************** /***************************************************************************
* class UBTeacherGuidePageZeroPresentationWidget * * class UBTeacherGuidePageZeroPresentationWidget *
***************************************************************************/ ***************************************************************************/
class UBTeacherGuidePageZeroEditionWidget : public QWidget class UBTeacherGuidePageZeroWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit UBTeacherGuidePageZeroEditionWidget(QWidget* parent, const char* name = "UBTeacherGuidePageZeroEditionWidget"); explicit UBTeacherGuidePageZeroWidget(QWidget* parent, const char* name = "UBTeacherGuidePageZeroEditionWidget");
~UBTeacherGuidePageZeroEditionWidget(); ~UBTeacherGuidePageZeroWidget();
QVector<tUBGEElementNode*> getData(); QVector<tUBGEElementNode*> getData();
@ -185,9 +185,10 @@ public slots:
void changeMode(); void changeMode();
void showPresentationMode(); void showPresentationMode();
void connectToStylusPalette(); void connectToStylusPalette();
void onActiveSceneChanged();
private: private:
UBTeacherGuidePageZeroEditionWidget* mpPageZeroEditonWidget; UBTeacherGuidePageZeroWidget* mpPageZeroWidget;
UBTeacherGuideEditionWidget* mpEditionWidget; UBTeacherGuideEditionWidget* mpEditionWidget;
UBTeacherGuidePresentationWidget* mpPresentationWidget; UBTeacherGuidePresentationWidget* mpPresentationWidget;
QVector<tUBGEElementNode*>mCurrentData; QVector<tUBGEElementNode*>mCurrentData;

Loading…
Cancel
Save