diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index bc572989..80917eab 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -2415,7 +2415,6 @@ UBGraphicsCurtainItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::curtainItemFromSvg QRectF rect = curtainItem->rect(); rect.setWidth(svgWidth.toString().toFloat()); rect.setHeight(svgHeight.toString().toFloat()); - rect.translate(-rect.center()); curtainItem->setRect(rect); diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index ad0ec53d..6efd102d 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -1981,3 +1981,4 @@ void UBBoardController::notifyPageChanged() } + diff --git a/src/board/UBBoardController.h b/src/board/UBBoardController.h index a587b8be..ef2564f6 100644 --- a/src/board/UBBoardController.h +++ b/src/board/UBBoardController.h @@ -263,7 +263,6 @@ class UBBoardController : public QObject void pageChanged(); void setDocOnPageNavigator(UBDocumentProxy* doc); void documentReorganized(int index); - void pageWillChange(int page, int nextPage); protected: diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index 94c28397..3338582e 100755 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -38,6 +38,9 @@ #include "web/browser/WBTabWidget.h" #include "web/browser/WBWebView.h" +#include "desktop/UBDesktopAnnotationController.h" + + #include "network/UBNetworkAccessManager.h" #include "network/UBServerXMLHttpRequest.h" @@ -76,7 +79,7 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll , mpPageNavigWidget(NULL) , mpLibWidget(NULL) , mpCachePropWidget(NULL) - , mDesktopRightPalette(NULL) +// , mDesktopRightPalette(NULL) , mpTeacherBarWidget(NULL) , mpDesktopLibWidget(NULL) { @@ -131,11 +134,11 @@ UBBoardPaletteManager::~UBBoardPaletteManager() delete mpDesktopLibWidget; mpDesktopLibWidget = NULL; } - if(NULL != mDesktopRightPalette) - { - delete mDesktopRightPalette; - mDesktopRightPalette = NULL; - } +// if(NULL != mDesktopRightPalette) +// { +// delete mDesktopRightPalette; +// mDesktopRightPalette = NULL; +// } } void UBBoardPaletteManager::initPalettesPosAtStartup() @@ -153,34 +156,65 @@ void UBBoardPaletteManager::setupLayout() */ void UBBoardPaletteManager::setupDockPaletteWidgets() { + + //------------------------------------------------// + // Create the widgets for the dock palettes + + mpPageNavigWidget = new UBPageNavigationWidget(); + mpPageNavigWidget->registerMode(eUBDockPaletteWidget_BOARD); + connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpPageNavigWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode))); + + mpLibWidget = new UBLibWidget(); + mpLibWidget ->registerMode(eUBDockPaletteWidget_BOARD); + mpLibWidget ->registerMode(eUBDockPaletteWidget_DESKTOP); + connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpLibWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode))); + +// mpCachePropWidget = new UBCachePropertiesWidget(); +// mpCachePropWidget->registerMode(eUBDockPaletteWidget_BOARD); +// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpCachePropWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode))); + +// mpTeacherBarWidget = new UBTeacherBarWidget(); +// mpTeacherBarWidget->registerMode(eUBDockPaletteWidget_BOARD); +// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpTeacherBarWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode))); + + //------------------------------------------------// + // Add the dock palettes + mLeftPalette = new UBLeftPalette(mContainer); + // LEFT palette widgets mLeftPalette->registerWidget(mpPageNavigWidget); mLeftPalette->addTabWidget(mpPageNavigWidget); + mLeftPalette->connectSignals(); + //------------------------------------------------// + + mRightPalette = new UBRightPalette(mContainer); + // RIGHT palette widgets mRightPalette->registerWidget(mpLibWidget); - mRightPalette->registerWidget(mpCachePropWidget); mRightPalette->addTabWidget(mpLibWidget); - mRightPalette->registerWidget(mpTeacherBarWidget); - mRightPalette->addTabWidget(mpTeacherBarWidget); +// // ??? +// mRightPalette->registerWidget(mpCachePropWidget); +// mRightPalette->addTabWidget(mpCachePropWidget); + +// // ??? +// mRightPalette->registerWidget(mpTeacherBarWidget); +// mRightPalette->addTabWidget(mpTeacherBarWidget); + mRightPalette->connectSignals(); + + //------------------------------------------------// + mLeftPalette->showTabWidget(0); mRightPalette->showTabWidget(0); + + //------------------------------------------------// } void UBBoardPaletteManager::setupPalettes() { - // Add the dock palettes - mLeftPalette = new UBLeftPalette(mContainer); - mRightPalette = new UBRightPalette(mContainer); - - // Create the widgets for the dock palettes - mpPageNavigWidget = new UBPageNavigationWidget(); - mpLibWidget = new UBLibWidget(); - mpCachePropWidget = new UBCachePropertiesWidget(); - mpTeacherBarWidget = new UBTeacherBarWidget(); setupDockPaletteWidgets(); @@ -435,6 +469,8 @@ void UBBoardPaletteManager::containerResized() mKeyboardPalette->adjustSizeAndPosition(); } + mLeftPalette->resize(mLeftPalette->width()-1, mContainer->height()); + mRightPalette->resize(mRightPalette->width()-1, mContainer->height()); mLeftPalette->resize(mLeftPalette->width(), mContainer->height()); mRightPalette->resize(mRightPalette->width(), mContainer->height()); } @@ -569,6 +605,53 @@ void UBBoardPaletteManager::addItem(const QUrl& pUrl) } +void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode) +{ + switch( newMode ) + { + case eUBDockPaletteWidget_BOARD: + { + mLeftPalette->setParent(UBApplication::boardController->controlContainer()); + mRightPalette->setParent(UBApplication::boardController->controlContainer()); + + mLeftPalette->setVisible(true); + mRightPalette->setVisible(true); + + containerResized(); + } + break; + + case eUBDockPaletteWidget_DESKTOP: + { + mLeftPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); + mRightPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); + + mLeftPalette->setVisible(false); + mRightPalette->setVisible(true); + + UBApplication::applicationController->uninotesController()->TransparentWidgetResized(); + } + break; + + default: + { + mLeftPalette->setVisible(false); + mRightPalette->setVisible(false); + mLeftPalette->setParent(0); + mRightPalette->setParent(0); + } + break; + } + + emit signal_changeMode(newMode); +} + +/* +void UBBoardPaletteManager::slot_changeMode(eUBDockPaletteWidgetMode newMode) +{ + emit signal_changeMode(newMode); +} +*/ void UBBoardPaletteManager::addItem(const QPixmap& pPixmap, const QPointF& pos, qreal scaleFactor, const QUrl& sourceUrl) { @@ -719,6 +802,7 @@ void UBBoardPaletteManager::changeStylusPaletteOrientation(QVariant var) mStylusPalette->setVisible(bVisible); // always show stylus palette at startup } +/* UBRightPalette* UBBoardPaletteManager::createDesktopRightPalette(QWidget* parent) { mpDesktopLibWidget = new UBLibWidget(); @@ -729,6 +813,7 @@ UBRightPalette* UBBoardPaletteManager::createDesktopRightPalette(QWidget* parent return mDesktopRightPalette; } +*/ void UBBoardPaletteManager::connectToDocumentController() { diff --git a/src/board/UBBoardPaletteManager.h b/src/board/UBBoardPaletteManager.h index 1399898a..a9aa9e87 100644 --- a/src/board/UBBoardPaletteManager.h +++ b/src/board/UBBoardPaletteManager.h @@ -48,16 +48,20 @@ class UBBoardPaletteManager : public QObject void setupLayout(); UBLeftPalette* leftPalette(){return mLeftPalette;} + UBRightPalette* rightPalette(){return mRightPalette;} void showVirtualKeyboard(bool show = true); void initPalettesPosAtStartup(); void connectToDocumentController(); void refreshPalettes(); UBKeyboardPalette *mKeyboardPalette; - UBRightPalette* createDesktopRightPalette(QWidget* parent); +// UBRightPalette* createDesktopRightPalette(QWidget* parent); + + void changeMode(eUBDockPaletteWidgetMode newMode); signals: void connectToDocController(); + void signal_changeMode(eUBDockPaletteWidgetMode newMode); public slots: @@ -66,6 +70,8 @@ class UBBoardPaletteManager : public QObject void addItem(const QUrl& pUrl); void addItem(const QPixmap& pPixmap, const QPointF& p = QPointF(0.0, 0.0), qreal scale = 1.0, const QUrl& sourceUrl = QUrl()); +// void slot_changeMode(eUBDockPaletteWidgetMode newMode); + private: void setupPalettes(); @@ -85,10 +91,10 @@ class UBBoardPaletteManager : public QObject /** The right dock palette */ UBRightPalette* mRightPalette; - // HACK: here we duplicate the right palette for the desktop mode - // we MUST refactor the architecture in order to use only one - // right palette! - UBRightPalette* mDesktopRightPalette; +// // HACK: here we duplicate the right palette for the desktop mode +// // we MUST refactor the architecture in order to use only one +// // right palette! +// UBRightPalette* mDesktopRightPalette; UBActionPalette *mBackgroundsPalette; UBActionPalette *mToolsPalette; diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 2eed5112..2cb28ef9 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -660,8 +660,8 @@ UBBoardView::wheelEvent (QWheelEvent *wheelEvent) QBool isSlectedAndMouseHower = itemsList.contains(selItem); if(isSlectedAndMouseHower) { - wheelEvent->accept(); QGraphicsView::wheelEvent(wheelEvent); + wheelEvent->accept(); } } diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index 4fad106a..f6b002ee 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -336,6 +336,7 @@ void UBApplicationController::showBoard() mMainWindow->boardToolBar->show(); mMainMode = Board; + UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_BOARD); adaptToolBar(); @@ -352,6 +353,8 @@ void UBApplicationController::showBoard() mUninoteController->hideWindow(); mMainWindow->show(); +// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_BOARD); + emit mainModeChanged(Board); } @@ -365,6 +368,8 @@ void UBApplicationController::showInternet() UBApplication::boardController->hide(); } + UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_WEB); + if (UBSettings::settings()->webUseExternalBrowser->get().toBool()) { showDesktop(true); @@ -384,8 +389,10 @@ void UBApplicationController::showInternet() mUninoteController->hideWindow(); emit mainModeChanged(Internet); } - UBApplication::webController->show(UBWebController::WebBrowser); +// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_WEB); + + UBApplication::webController->show(UBWebController::WebBrowser); } @@ -397,6 +404,7 @@ void UBApplicationController::showDocument() mMainWindow->documentToolBar->show(); mMainMode = Document; + UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_DOCUMENT); adaptToolBar(); @@ -418,6 +426,8 @@ void UBApplicationController::showDocument() mUninoteController->hideWindow(); +// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_DOCUMENT); + emit mainModeChanged(Document); } @@ -429,6 +439,8 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess) UBApplication::boardController->hide(); mMainWindow->hide(); + UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_DESKTOP); + mUninoteController->showWindow(); if (mMirror) @@ -444,6 +456,8 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess) UBPlatformUtils::bringPreviousProcessToFront(); } +// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_DESKTOP); + UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); } diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 87f2a340..3987f615 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -592,6 +592,7 @@ UBGraphicsScene* UBPersistenceManager::loadDocumentScene(UBDocumentProxy* proxy, { if (mSceneCache.contains(proxy, sceneIndex)) { + //qDebug() << "scene" << sceneIndex << "retrieved from cache ..."; return mSceneCache.value(proxy, sceneIndex); } else @@ -617,6 +618,8 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy, QDir dir(pDocumentProxy->persistencePath()); dir.mkpath(pDocumentProxy->persistencePath()); + qDebug() << "saving page" << pSceneIndex + 1 << pDocumentProxy->persistencePath(); + if (pDocumentProxy->isModified()) UBMetadataDcSubsetAdaptor::persist(pDocumentProxy); @@ -635,92 +638,6 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy, } -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; -} UBDocumentProxy* UBPersistenceManager::persistDocumentMetadata(UBDocumentProxy* pDocumentProxy) { diff --git a/src/core/UBPersistenceManager.h b/src/core/UBPersistenceManager.h index b2a41937..9189e38f 100644 --- a/src/core/UBPersistenceManager.h +++ b/src/core/UBPersistenceManager.h @@ -20,21 +20,6 @@ #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; @@ -75,10 +60,6 @@ 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); virtual void insertDocumentSceneAt(UBDocumentProxy* pDocumentProxy, UBGraphicsScene* scene, int index); diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 458c3534..a4b9c92d 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -56,7 +56,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) , mDesktopPenPalette(NULL) , mDesktopMarkerPalette(NULL) , mDesktopEraserPalette(NULL) - , mRightPalette(NULL) +// , mRightPalette(NULL) , mWindowPositionInitialized(0) , mIsFullyTransparent(false) , mDesktopToolsPalettePositioned(false) @@ -89,7 +89,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) mTransparentDrawingScene = new UBGraphicsScene(0); mTransparentDrawingView->setScene(mTransparentDrawingScene); - mRightPalette = UBApplication::boardController->paletteManager()->createDesktopRightPalette(mTransparentDrawingView); +// mRightPalette = UBApplication::boardController->paletteManager()->createDesktopRightPalette(mTransparentDrawingView); //mRightPalette = new UBRightPalette(mTransparentDrawingView); mDesktopPalette = new UBDesktopPalette(mTransparentDrawingView); @@ -158,7 +158,8 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) #ifdef Q_WS_X11 connect(mDesktopPalette, SIGNAL(moving()), this, SLOT(refreshMask())); - connect(mRightPalette, SIGNAL(resized()), this, SLOT(refreshMask())); +// connect(mRightPalette, SIGNAL(resized()), this, SLOT(refreshMask())); + connect(UBApplication::boardController->paletteManager()->rightPalette(), SIGNAL(resized()), this, SLOT(refreshMask())); #endif onDesktopPaletteMaximized(); } @@ -859,12 +860,34 @@ void UBDesktopAnnotationController::onDesktopPaletteMinimize() } } +void UBDesktopAnnotationController::TransparentWidgetResized() +{ +/* + int rW = UBApplication::boardController->paletteManager()->rightPalette()->width(); + int rH_ = UBApplication::boardController->paletteManager()->rightPalette()->height(); + int rH = mTransparentDrawingView->height(); + + UBApplication::boardController->paletteManager()->rightPalette()->resize(rW+1, rH); + + // UBApplication::boardController->paletteManager()->rightPalette()->resize(500, 500); +*/ + + onTransparentWidgetResized(); +} + /** * \brief Resize the library palette. */ void UBDesktopAnnotationController::onTransparentWidgetResized() { - mRightPalette->resize(mRightPalette->width(), mTransparentDrawingView->height()); + int rW = UBApplication::boardController->paletteManager()->rightPalette()->width(); + int rH_ = UBApplication::boardController->paletteManager()->rightPalette()->height(); + int rH = mTransparentDrawingView->height(); + + UBApplication::boardController->paletteManager()->rightPalette()->resize(rW+1, rH); + UBApplication::boardController->paletteManager()->rightPalette()->resize(rW, rH); + +// mRightPalette->resize(mRightPalette->width(), mTransparentDrawingView->height()); } void UBDesktopAnnotationController::updateMask(bool bTransparent) @@ -891,10 +914,15 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent) { p.drawRect(mKeyboardPalette->geometry().x(), mKeyboardPalette->geometry().y(), mKeyboardPalette->width(), mKeyboardPalette->height()); } - if(mRightPalette->isVisible()) + +// UBApplication::boardController->paletteManager()->mDesktopRightPalette + if(UBApplication::boardController->paletteManager()->rightPalette()->isVisible()) { qDebug() << ">>>>>> Drawing the mask for the right palette"; - p.drawRect(mRightPalette->geometry().x(), mRightPalette->geometry().y(), mRightPalette->width(), mRightPalette->height()); + p.drawRect(UBApplication::boardController->paletteManager()->rightPalette()->geometry().x(), + UBApplication::boardController->paletteManager()->rightPalette()->geometry().y(), + UBApplication::boardController->paletteManager()->rightPalette()->width(), + UBApplication::boardController->paletteManager()->rightPalette()->height()); } p.end(); diff --git a/src/desktop/UBDesktopAnnotationController.h b/src/desktop/UBDesktopAnnotationController.h index d61d7607..b3a9e37f 100644 --- a/src/desktop/UBDesktopAnnotationController.h +++ b/src/desktop/UBDesktopAnnotationController.h @@ -55,6 +55,9 @@ class UBDesktopAnnotationController : public QObject UBDesktopPalette *desktopPalette(); UBBoardView *drawingView(); + void TransparentWidgetResized(); + + public slots: void screenLayoutChanged(); diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 524d7054..58c57a02 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1171,7 +1171,7 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co if (graphicsWidget->widgetWebView()->canBeContent()) { - graphicsWidget->widgetWebView()->loadMainHtml(); +// graphicsWidget->widgetWebView()->loadMainHtml(); graphicsWidget->setSelected(true); UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, graphicsWidget); diff --git a/src/gui/UBDockPalette.h b/src/gui/UBDockPalette.h index 627535da..b69d0653 100644 --- a/src/gui/UBDockPalette.h +++ b/src/gui/UBDockPalette.h @@ -123,6 +123,8 @@ protected: /** The current widget */ QVector mRegisteredWidgets; +// QVector mVisibleWidgets; // ??? + private slots: void onToolbarPosUpdated(); void onResizeRequest(QResizeEvent* event); diff --git a/src/gui/UBDockPaletteWidget.cpp b/src/gui/UBDockPaletteWidget.cpp index d649d9a5..9cd1197c 100644 --- a/src/gui/UBDockPaletteWidget.cpp +++ b/src/gui/UBDockPaletteWidget.cpp @@ -24,3 +24,16 @@ QString UBDockPaletteWidget::name() { return mName; } + +void UBDockPaletteWidget::registerMode(eUBDockPaletteWidgetMode mode) +{ + if(!mRegisteredModes.contains(mode)) + mRegisteredModes.append(mode); +} + +void UBDockPaletteWidget::slot_changeMode(eUBDockPaletteWidgetMode newMode) +{ + this->setVisible(mRegisteredModes.contains(newMode)); +} + + diff --git a/src/gui/UBDockPaletteWidget.h b/src/gui/UBDockPaletteWidget.h index 69a70a8a..aa97a029 100644 --- a/src/gui/UBDockPaletteWidget.h +++ b/src/gui/UBDockPaletteWidget.h @@ -5,8 +5,17 @@ #include #include +typedef enum +{ + eUBDockPaletteWidget_BOARD, + eUBDockPaletteWidget_WEB, + eUBDockPaletteWidget_DOCUMENT, + eUBDockPaletteWidget_DESKTOP, +} eUBDockPaletteWidgetMode; + class UBDockPaletteWidget : public QWidget { + Q_OBJECT public: UBDockPaletteWidget(QWidget* parent=0, const char* name="UBDockPaletteWidget"); @@ -16,10 +25,21 @@ public: QPixmap iconToLeft(); QString name(); + void registerMode(eUBDockPaletteWidgetMode mode); + + /* The current widget available mode list */ + QVector mRegisteredModes; + + + signals: void hideTab(const QString& widgetName); void showTab(const QString& widgetName); +public slots: + void slot_changeMode(eUBDockPaletteWidgetMode newMode); + + protected: QPixmap mIconToRight; // arrow like this: > QPixmap mIconToLeft; // arrow like this: < diff --git a/src/gui/UBDocumentNavigator.cpp b/src/gui/UBDocumentNavigator.cpp index 730911c8..74bd3611 100644 --- a/src/gui/UBDocumentNavigator.cpp +++ b/src/gui/UBDocumentNavigator.cpp @@ -141,13 +141,8 @@ 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(); - } - - // Now, update the thumbnail UBThumbnailAdaptor::persistScene(mCrntDoc->persistencePath(), pScene, iPage); // Load it diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp index 2644cb0f..1cc481fe 100644 --- a/src/gui/UBTeacherBarWidget.cpp +++ b/src/gui/UBTeacherBarWidget.cpp @@ -242,50 +242,14 @@ 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() @@ -311,7 +275,6 @@ void UBTeacherBarWidget::onValueChanged() mIconToRight = QPixmap(":images/teacher_close.png"); } - // TODO: refresh the icon UBApplication::boardController->paletteManager()->refreshPalettes(); } diff --git a/src/gui/UBTeacherBarWidget.h b/src/gui/UBTeacherBarWidget.h index 555b6ef6..55fd98d3 100644 --- a/src/gui/UBTeacherBarWidget.h +++ b/src/gui/UBTeacherBarWidget.h @@ -39,7 +39,6 @@ private: class UBTeacherBarWidget : public UBDockPaletteWidget { - Q_OBJECT public: UBTeacherBarWidget(QWidget* parent=0, const char* name="UBTeacherBarWidget"); ~UBTeacherBarWidget();