diff --git a/plugins/cffadaptor/src/UBCFFAdaptor.cpp b/plugins/cffadaptor/src/UBCFFAdaptor.cpp index 10a8aca5..39652710 100644 --- a/plugins/cffadaptor/src/UBCFFAdaptor.cpp +++ b/plugins/cffadaptor/src/UBCFFAdaptor.cpp @@ -1085,7 +1085,9 @@ bool UBCFFAdaptor::UBToCFFConverter::setContentFromUBZ(const QDomElement &ubzEle if (bRet) { svgElement.setAttribute(aSVGHref, sDstContentFolder+"/"+sDstFileName); - svgElement.setAttribute(aSVGRequiredExtension, svgRequiredExtensionPrefix+convertExtention(fileExtention)); + // NOT by standard! Enable it later! + // validator http://validator.imsglobal.org/iwb/index.jsp?validate=package + //svgElement.setAttribute(aSVGRequiredExtension, svgRequiredExtensionPrefix+convertExtention(fileExtention)); } } else @@ -1112,7 +1114,9 @@ bool UBCFFAdaptor::UBToCFFConverter::setContentFromUBZ(const QDomElement &ubzEle if (bRet) { svgElement.setAttribute(aSVGHref, sDstContentFolder+"/"+sDstFileName); - svgElement.setAttribute(aSVGRequiredExtension, svgRequiredExtensionPrefix+fePng); + // NOT by standard! Enable it later! + // validator http://validator.imsglobal.org/iwb/index.jsp?validate=package + //svgElement.setAttribute(aSVGRequiredExtension, svgRequiredExtensionPrefix+fePng); } } }else diff --git a/plugins/cffadaptor/src/UBCFFConstants.h b/plugins/cffadaptor/src/UBCFFConstants.h index 3243f72f..adeeb507 100644 --- a/plugins/cffadaptor/src/UBCFFConstants.h +++ b/plugins/cffadaptor/src/UBCFFConstants.h @@ -106,7 +106,7 @@ const QString ubNS = "http://uniboard.mnemis.com/document"; const QString svgUBZNS = "http://www.imsglobal.org/xsd/iwb_v1p0"; const QString svgIWBNS = "http://www.w3.org/2000/svg"; const QString xlinkNS = "http://www.w3.org/1999/xlink"; -const QString iwbNS = "http://www.becta.org.uk/iwb"; +const QString iwbNS = "http://www.imsglobal.org/xsd/iwb_v1p0"; const QString xsiNS = "http://www.w3.org/2001/XMLSchema-instance"; const QString xsiShemaLocation = "\ http://www.imsglobal.org/xsd/iwb_v1p0 \ diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 4a66d8b9..8f0b6fdc 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -315,7 +315,11 @@ int UBApplication::exec(const QString& pFileToImport) UBDrawingController::drawingController()->setStylusTool((int)UBStylusTool::Pen); - applicationController = new UBApplicationController(boardController->controlView(), boardController->displayView(), mainWindow, staticMemoryCleaner); + applicationController = new UBApplicationController(boardController->controlView(), + boardController->displayView(), + mainWindow, + staticMemoryCleaner, + boardController->paletteManager()->rightPalette()); connect(applicationController, SIGNAL(mainModeChanged(UBApplicationController::MainMode)), diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index c711184b..867e2b8c 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -59,8 +59,11 @@ #include "core/memcheck.h" -UBApplicationController::UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, - UBMainWindow* pMainWindow, QObject* parent) +UBApplicationController::UBApplicationController(UBBoardView *pControlView, + UBBoardView *pDisplayView, + UBMainWindow* pMainWindow, + QObject* parent, + UBRightPalette* rightPalette) : QObject(parent) , mMainWindow(pMainWindow) , mControlView(pControlView) @@ -75,7 +78,7 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, UBBo { mDisplayManager = new UBDisplayManager(this); - mUninoteController = new UBDesktopAnnotationController(this); + mUninoteController = new UBDesktopAnnotationController(this, rightPalette); connect(mDisplayManager, SIGNAL(screenLayoutChanged()), this, SLOT(screenLayoutChanged())); connect(mDisplayManager, SIGNAL(screenLayoutChanged()), mUninoteController, SLOT(screenLayoutChanged())); diff --git a/src/core/UBApplicationController.h b/src/core/UBApplicationController.h index 88688d2d..7d2e7bfd 100644 --- a/src/core/UBApplicationController.h +++ b/src/core/UBApplicationController.h @@ -31,6 +31,7 @@ class UBSoftwareUpdate; class QNetworkAccessManager; class QNetworkReply; class QHttp; +class UBRightPalette; class UBApplicationController : public QObject @@ -39,7 +40,7 @@ class UBApplicationController : public QObject public: - UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, UBMainWindow *pMainWindow, QObject* parent = 0); + UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, UBMainWindow *pMainWindow, QObject* parent, UBRightPalette* rightPalette); virtual ~UBApplicationController(); int initialHScroll() { return mInitialHScroll; } diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index b95b433d..547be184 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -38,16 +38,14 @@ #include "UBCustomCaptureWindow.h" #include "UBWindowCapture.h" #include "UBDesktopPalette.h" -#include "UBDesktopPenPalette.h" -#include "UBDesktopMarkerPalette.h" -#include "UBDesktopEraserPalette.h" +#include "UBDesktopPropertyPalette.h" #include "gui/UBKeyboardPalette.h" #include "gui/UBResources.h" #include "core/memcheck.h" -UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) +UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UBRightPalette* rightPalette) : QObject(parent) , mTransparentDrawingView(0) , mTransparentDrawingScene(0) @@ -55,6 +53,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) , mDesktopPenPalette(NULL) , mDesktopMarkerPalette(NULL) , mDesktopEraserPalette(NULL) + , mRightPalette(rightPalette) , mWindowPositionInitialized(0) , mIsFullyTransparent(false) , mDesktopToolsPalettePositioned(false) @@ -86,7 +85,9 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) mTransparentDrawingView->setScene(mTransparentDrawingScene); mTransparentDrawingScene->setDrawingMode(true); - mDesktopPalette = new UBDesktopPalette(NULL); // FIX #633: The palette must be 'floating' in order to stay on top of the library palette + mDesktopPalette = new UBDesktopPalette(mTransparentDrawingView, rightPalette); + // This was not fix, parent reverted + // FIX #633: The palette must be 'floating' in order to stay on top of the library palette if (UBPlatformUtils::hasVirtualKeyboard()) { @@ -119,13 +120,13 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) connect(UBDrawingController::drawingController(), SIGNAL(stylusToolChanged(int)), this, SLOT(stylusToolChanged(int))); // Add the desktop associated palettes - mDesktopPenPalette = new UBDesktopPenPalette(NULL); // FIX #633: The palette must be 'floating' in order to stay on top of the library palette + mDesktopPenPalette = new UBDesktopPenPalette(mTransparentDrawingView, rightPalette); connect(mDesktopPalette, SIGNAL(maximized()), mDesktopPenPalette, SLOT(onParentMaximized())); connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), mDesktopPenPalette, SLOT(onParentMinimized())); - mDesktopMarkerPalette = new UBDesktopMarkerPalette(NULL); // FIX #633: The palette must be 'floating' in order to stay on top of the library palette - mDesktopEraserPalette = new UBDesktopEraserPalette(NULL); // FIX #633: The palette must be 'floating' in order to stay on top of the library palette + mDesktopMarkerPalette = new UBDesktopMarkerPalette(mTransparentDrawingView, rightPalette); + mDesktopEraserPalette = new UBDesktopEraserPalette(mTransparentDrawingView, rightPalette); mDesktopPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor); mDesktopPenPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor); @@ -156,39 +157,15 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) onDesktopPaletteMaximized(); // FIX #633: Ensure that these palettes stay on top of the other elements - mDesktopEraserPalette->raise(); - mDesktopMarkerPalette->raise(); - mDesktopPenPalette->raise(); - mDesktopPalette->raise(); + //mDesktopEraserPalette->raise(); + //mDesktopMarkerPalette->raise(); + //mDesktopPenPalette->raise(); } UBDesktopAnnotationController::~UBDesktopAnnotationController() { delete mTransparentDrawingScene; delete mTransparentDrawingView; - - /* - if(NULL != mDesktopPenPalette) - { - delete mDesktopPalette; - mDesktopPenPalette = NULL; - } - if(NULL != mDesktopMarkerPalette) - { - delete mDesktopMarkerPalette; - mDesktopMarkerPalette = NULL; - } - if(NULL != mDesktopEraserPalette) - { - delete mDesktopEraserPalette; - mDesktopEraserPalette = NULL; - } - if(NULL != mRightPalette) - { - delete mRightPalette; - mRightPalette = NULL; - } - */ } @@ -255,7 +232,7 @@ void UBDesktopAnnotationController::setAssociatedPalettePosition(UBActionPalette } // First determine if the palette must be shown on the left or on the right - if(desktopPalettePos.x() <= (mTransparentDrawingView->width() - (palette->width() + mDesktopPalette->width() + 20))) // we take a small margin of 20 pixels + if(desktopPalettePos.x() <= (mTransparentDrawingView->width() - (palette->width() + mDesktopPalette->width() + mRightPalette->width() + 20))) // we take a small margin of 20 pixels { // Display it on the right desktopPalettePos += QPoint(mDesktopPalette->width(), yPen); diff --git a/src/desktop/UBDesktopAnnotationController.h b/src/desktop/UBDesktopAnnotationController.h index c98b2466..5e8c9e08 100644 --- a/src/desktop/UBDesktopAnnotationController.h +++ b/src/desktop/UBDesktopAnnotationController.h @@ -29,8 +29,8 @@ class UBDesktopPenPalette; class UBDesktopMarkerPalette; class UBDesktopEraserPalette; class UBActionPalette; -//class UBKeyboardPalette; class UBMainWindow; +class UBRightPalette; #define PROPERTY_PALETTE_TIMER 1000 @@ -47,7 +47,7 @@ class UBDesktopAnnotationController : public QObject Q_OBJECT; public: - UBDesktopAnnotationController(QObject *parent = 0); + UBDesktopAnnotationController(QObject *parent, UBRightPalette* rightPalette); virtual ~UBDesktopAnnotationController(); void showWindow(); void hideWindow(); diff --git a/src/desktop/UBDesktopEraserPalette.cpp b/src/desktop/UBDesktopEraserPalette.cpp deleted file mode 100644 index aeb615ee..00000000 --- a/src/desktop/UBDesktopEraserPalette.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include "UBDesktopEraserPalette.h" - -#include "core/UBApplication.h" -#include "core/UBSettings.h" -#include "board/UBBoardController.h" -#include "board/UBDrawingController.h" -#include "gui/UBMainWindow.h" -#include "gui/UBToolbarButtonGroup.h" - - -#include "core/memcheck.h" - -UBDesktopEraserPalette::UBDesktopEraserPalette(QWidget *parent) - : UBPropertyPalette(Qt::Horizontal, parent) -{ - // Setup eraser width choice widget - QList eraserWidthActions; - eraserWidthActions.append(UBApplication::mainWindow->actionEraserSmall); - eraserWidthActions.append(UBApplication::mainWindow->actionEraserMedium); - eraserWidthActions.append(UBApplication::mainWindow->actionEraserLarge); - - UBToolbarButtonGroup *eraserWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, eraserWidthActions); - - connect(eraserWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setEraserWidthIndex(int))); - connect(eraserWidthChoice, SIGNAL(activated(int)), this, SLOT(close())); - connect(UBApplication::mainWindow->actionEraseDesktopAnnotations, SIGNAL(triggered()), this, SLOT(close())); - - eraserWidthChoice->displayText(false); - eraserWidthChoice->setCurrentIndex(UBSettings::settings()->eraserWidthIndex()); - - layout()->addWidget(eraserWidthChoice); - - addAction(UBApplication::mainWindow->actionEraseDesktopAnnotations); -} diff --git a/src/desktop/UBDesktopEraserPalette.h b/src/desktop/UBDesktopEraserPalette.h deleted file mode 100644 index 846b1c4c..00000000 --- a/src/desktop/UBDesktopEraserPalette.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef UBDESKTOPERASERPALETTE_H -#define UBDESKTOPERASERPALETTE_H - -#include - -#include "gui/UBPropertyPalette.h" - -class UBDesktopEraserPalette : public UBPropertyPalette -{ - public: - UBDesktopEraserPalette(QWidget *parent = 0); - virtual ~UBDesktopEraserPalette(){} -}; - -#endif // UBDESKTOPERASERPALETTE_H diff --git a/src/desktop/UBDesktopMarkerPalette.cpp b/src/desktop/UBDesktopMarkerPalette.cpp deleted file mode 100644 index b2189987..00000000 --- a/src/desktop/UBDesktopMarkerPalette.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include "UBDesktopMarkerPalette.h" - -#include "core/UBApplication.h" -#include "board/UBBoardController.h" -#include "board/UBDrawingController.h" -#include "gui/UBMainWindow.h" -#include "gui/UBToolbarButtonGroup.h" - -#include "core/memcheck.h" - -UBDesktopMarkerPalette::UBDesktopMarkerPalette(QWidget *parent) - : UBPropertyPalette(Qt::Horizontal, parent) -{ - // Setup color choice widget - QList colorActions; - colorActions.append(UBApplication::mainWindow->actionColor0); - colorActions.append(UBApplication::mainWindow->actionColor1); - colorActions.append(UBApplication::mainWindow->actionColor2); - colorActions.append(UBApplication::mainWindow->actionColor3); - - UBToolbarButtonGroup *colorChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions); - colorChoice->displayText(false); - - //connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int))); - connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int))); - connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close())); - connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged())); - connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close())); - - layout()->addWidget(colorChoice); - - // Setup line width choice widget - QList lineWidthActions; - lineWidthActions.append(UBApplication::mainWindow->actionLineSmall); - lineWidthActions.append(UBApplication::mainWindow->actionLineMedium); - lineWidthActions.append(UBApplication::mainWindow->actionLineLarge); - - UBToolbarButtonGroup *lineWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions); - lineWidthChoice->displayText(false); - - connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int))); - connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close())); - connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int))); - connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close())); - - layout()->addWidget(lineWidthChoice); -} diff --git a/src/desktop/UBDesktopMarkerPalette.h b/src/desktop/UBDesktopMarkerPalette.h deleted file mode 100644 index 7918a81e..00000000 --- a/src/desktop/UBDesktopMarkerPalette.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef UBDESKTOPMARKERPALETTE_H -#define UBDESKTOPMARKERPALETTE_H - -#include - -#include "gui/UBPropertyPalette.h" - -class UBDesktopMarkerPalette : public UBPropertyPalette -{ - public: - UBDesktopMarkerPalette(QWidget *parent = 0); - virtual ~UBDesktopMarkerPalette(){} -}; - -#endif // UBDESKTOPMARKERPALETTE_H diff --git a/src/desktop/UBDesktopPalette.cpp b/src/desktop/UBDesktopPalette.cpp index 2b3902b2..25bbad61 100644 --- a/src/desktop/UBDesktopPalette.cpp +++ b/src/desktop/UBDesktopPalette.cpp @@ -21,10 +21,11 @@ #include "core/memcheck.h" -UBDesktopPalette::UBDesktopPalette(QWidget *parent) +UBDesktopPalette::UBDesktopPalette(QWidget *parent, UBRightPalette* _rightPalette) : UBActionPalette(Qt::TopLeftCorner, parent) - , mShowHideAction(0) - , mDisplaySelectAction(0) + , rightPalette(_rightPalette) + , mShowHideAction(0) + , mDisplaySelectAction(0) { QList actions; @@ -72,6 +73,8 @@ UBDesktopPalette::UBDesktopPalette(QWidget *parent) connect(this, SIGNAL(maximizeStart()), this, SLOT(maximizeMe())); connect(this, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(minimizeMe(eMinimizedLocation))); setMinimizePermission(true); + + connect(rightPalette, SIGNAL(resized()), this, SLOT(parentResized())); } @@ -109,6 +112,9 @@ void UBDesktopPalette::updateShowHideState(bool pShowEnabled) mShowHideAction->setToolTip(tr("Show Board on Secondary Screen")); else mShowHideAction->setToolTip(tr("Show Desktop on Secondary Screen")); + + if (pShowEnabled) + raise(); } @@ -217,3 +223,20 @@ QPoint UBDesktopPalette::buttonPos(QAction *action) return p; } + + +int UBDesktopPalette::getParentRightOffset() +{ + return rightPalette->width(); +} + +void UBDesktopPalette::parentResized() +{ + QPoint p = pos(); + if (minimizedLocation() == eMinimizedLocation_Right) + { + p.setX(parentWidget()->width() - getParentRightOffset() -width()); + } + + moveInsideParent(p); +} \ No newline at end of file diff --git a/src/desktop/UBDesktopPalette.h b/src/desktop/UBDesktopPalette.h index cd22d43e..aaa47273 100644 --- a/src/desktop/UBDesktopPalette.h +++ b/src/desktop/UBDesktopPalette.h @@ -12,6 +12,7 @@ #include #include "gui/UBActionPalette.h" +#include "gui/UBRightPalette.h" /** * The uninotes window. This window is controlled by UBUninotesWindowController. @@ -21,7 +22,7 @@ class UBDesktopPalette : public UBActionPalette Q_OBJECT; public: - UBDesktopPalette(QWidget *parent = 0); + UBDesktopPalette(QWidget *parent, UBRightPalette* rightPalette); virtual ~UBDesktopPalette(); void disappearForCapture(); @@ -41,17 +42,19 @@ class UBDesktopPalette : public UBActionPalette public slots: void showHideClick(bool checked); - void updateShowHideState(bool pShowEnabled); void setShowHideButtonVisible(bool visible); void setDisplaySelectButtonVisible(bool show); - void minimizeMe(eMinimizedLocation location); + void minimizeMe(eMinimizedLocation location); void maximizeMe(); + void parentResized(); protected: void showEvent(QShowEvent *event); void hideEvent(QHideEvent *event); + virtual int getParentRightOffset(); + private: QAction *mShowHideAction; QAction *mDisplaySelectAction; @@ -60,6 +63,9 @@ protected: QAction *mActionCustomSelect; QAction* mActionTest; + + UBRightPalette* rightPalette; + signals: void stylusToolChanged(int tool); diff --git a/src/desktop/UBDesktopPenPalette.cpp b/src/desktop/UBDesktopPenPalette.cpp deleted file mode 100644 index 10af7ab0..00000000 --- a/src/desktop/UBDesktopPenPalette.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include "UBDesktopPenPalette.h" - -#include "core/UBApplication.h" -#include "board/UBBoardController.h" -#include "board/UBDrawingController.h" -#include "gui/UBMainWindow.h" -#include "gui/UBToolbarButtonGroup.h" - -#include "core/memcheck.h" - -UBDesktopPenPalette::UBDesktopPenPalette(QWidget *parent) - : UBPropertyPalette(Qt::Horizontal, parent) -{ - // Setup color choice widget - QList colorActions; - colorActions.append(UBApplication::mainWindow->actionColor0); - colorActions.append(UBApplication::mainWindow->actionColor1); - colorActions.append(UBApplication::mainWindow->actionColor2); - colorActions.append(UBApplication::mainWindow->actionColor3); - - UBToolbarButtonGroup *colorChoice = - new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions); - - colorChoice->displayText(false); - - //connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int))); - connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int))); - connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close())); - connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged())); - connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close())); - - layout()->addWidget(colorChoice); - - // Setup line width choice widget - QList lineWidthActions; - lineWidthActions.append(UBApplication::mainWindow->actionLineSmall); - lineWidthActions.append(UBApplication::mainWindow->actionLineMedium); - lineWidthActions.append(UBApplication::mainWindow->actionLineLarge); - - UBToolbarButtonGroup *lineWidthChoice = - new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions); - lineWidthChoice->displayText(false); - - connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int))); - connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close())); - connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int))); - connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close())); - - onParentMaximized(); - - layout()->addWidget(lineWidthChoice); -} - -void UBDesktopPenPalette::onButtonReleased() -{ - qDebug() << "Pen palette released!"; - // trigger the related action - - - // Close the palette - close(); -} - -/** - * \brief Disconnect the released event of the buttons - */ -void UBDesktopPenPalette::onParentMinimized() -{ - for(int i = 0; i < mButtons.size(); i++) - { - disconnect(mButtons.at(i), SIGNAL(released()), this, SLOT(onButtonReleased())); - } -} - -/** - * \brief Connect the released event of the buttons - */ -void UBDesktopPenPalette::onParentMaximized() -{ - for(int i = 0; i < mButtons.size(); i++) - { - connect(mButtons.at(i), SIGNAL(released()), this, SLOT(onButtonReleased())); - } -} - -void UBDesktopPenPalette::resizeEvent(QResizeEvent *) -{ - qDebug("pen palette resized!"); -} diff --git a/src/desktop/UBDesktopPropertyPalette.cpp b/src/desktop/UBDesktopPropertyPalette.cpp new file mode 100644 index 00000000..e694e7f3 --- /dev/null +++ b/src/desktop/UBDesktopPropertyPalette.cpp @@ -0,0 +1,170 @@ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "UBDesktopPropertyPalette.h" + +#include "core/UBApplication.h" +#include "board/UBBoardController.h" +#include "board/UBDrawingController.h" +#include "gui/UBMainWindow.h" +#include "gui/UBToolbarButtonGroup.h" +#include "gui/UBRightPalette.h" + +#include "core/memcheck.h" + +UBDesktopPropertyPalette::UBDesktopPropertyPalette(QWidget *parent, UBRightPalette* _rightPalette) + :UBPropertyPalette(Qt::Horizontal, parent) + ,rightPalette(_rightPalette) +{} + +int UBDesktopPropertyPalette::getParentRightOffset() +{ + return rightPalette->width(); +} + + +UBDesktopPenPalette::UBDesktopPenPalette(QWidget *parent, UBRightPalette* rightPalette) + : UBDesktopPropertyPalette(parent, rightPalette) +{ + // Setup color choice widget + QList colorActions; + colorActions.append(UBApplication::mainWindow->actionColor0); + colorActions.append(UBApplication::mainWindow->actionColor1); + colorActions.append(UBApplication::mainWindow->actionColor2); + colorActions.append(UBApplication::mainWindow->actionColor3); + + UBToolbarButtonGroup *colorChoice = + new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions); + + colorChoice->displayText(false); + + //connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int))); + connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int))); + connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close())); + connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged())); + connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close())); + + layout()->addWidget(colorChoice); + + // Setup line width choice widget + QList lineWidthActions; + lineWidthActions.append(UBApplication::mainWindow->actionLineSmall); + lineWidthActions.append(UBApplication::mainWindow->actionLineMedium); + lineWidthActions.append(UBApplication::mainWindow->actionLineLarge); + + UBToolbarButtonGroup *lineWidthChoice = + new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions); + lineWidthChoice->displayText(false); + + connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int))); + connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close())); + connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int))); + connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close())); + + onParentMaximized(); + + layout()->addWidget(lineWidthChoice); +} + + +void UBDesktopPenPalette::onButtonReleased() +{ + close(); +} + +/** + * \brief Disconnect the released event of the buttons + */ +void UBDesktopPenPalette::onParentMinimized() +{ + for(int i = 0; i < mButtons.size(); i++) + { + disconnect(mButtons.at(i), SIGNAL(released()), this, SLOT(onButtonReleased())); + } +} + +/** + * \brief Connect the released event of the buttons + */ +void UBDesktopPenPalette::onParentMaximized() +{ + for(int i = 0; i < mButtons.size(); i++) + { + connect(mButtons.at(i), SIGNAL(released()), this, SLOT(onButtonReleased())); + } +} + + +UBDesktopEraserPalette::UBDesktopEraserPalette(QWidget *parent, UBRightPalette* rightPalette) + : UBDesktopPropertyPalette(parent, rightPalette) +{ + // Setup eraser width choice widget + QList eraserWidthActions; + eraserWidthActions.append(UBApplication::mainWindow->actionEraserSmall); + eraserWidthActions.append(UBApplication::mainWindow->actionEraserMedium); + eraserWidthActions.append(UBApplication::mainWindow->actionEraserLarge); + + UBToolbarButtonGroup *eraserWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, eraserWidthActions); + + connect(eraserWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setEraserWidthIndex(int))); + connect(eraserWidthChoice, SIGNAL(activated(int)), this, SLOT(close())); + connect(UBApplication::mainWindow->actionEraseDesktopAnnotations, SIGNAL(triggered()), this, SLOT(close())); + + eraserWidthChoice->displayText(false); + eraserWidthChoice->setCurrentIndex(UBSettings::settings()->eraserWidthIndex()); + + layout()->addWidget(eraserWidthChoice); + + addAction(UBApplication::mainWindow->actionEraseDesktopAnnotations); +} + + +UBDesktopMarkerPalette::UBDesktopMarkerPalette(QWidget *parent, UBRightPalette* rightPalette) + : UBDesktopPropertyPalette(parent, rightPalette) +{ + // Setup color choice widget + QList colorActions; + colorActions.append(UBApplication::mainWindow->actionColor0); + colorActions.append(UBApplication::mainWindow->actionColor1); + colorActions.append(UBApplication::mainWindow->actionColor2); + colorActions.append(UBApplication::mainWindow->actionColor3); + + UBToolbarButtonGroup *colorChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions); + colorChoice->displayText(false); + + //connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int))); + connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int))); + connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close())); + connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged())); + connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close())); + + layout()->addWidget(colorChoice); + + // Setup line width choice widget + QList lineWidthActions; + lineWidthActions.append(UBApplication::mainWindow->actionLineSmall); + lineWidthActions.append(UBApplication::mainWindow->actionLineMedium); + lineWidthActions.append(UBApplication::mainWindow->actionLineLarge); + + UBToolbarButtonGroup *lineWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions); + lineWidthChoice->displayText(false); + + connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int))); + connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close())); + connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int))); + connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close())); + + layout()->addWidget(lineWidthChoice); +} + diff --git a/src/desktop/UBDesktopPenPalette.h b/src/desktop/UBDesktopPropertyPalette.h similarity index 55% rename from src/desktop/UBDesktopPenPalette.h rename to src/desktop/UBDesktopPropertyPalette.h index 6ed2c2ee..0a8bb138 100644 --- a/src/desktop/UBDesktopPenPalette.h +++ b/src/desktop/UBDesktopPropertyPalette.h @@ -20,22 +20,48 @@ #include "gui/UBPropertyPalette.h" -class UBDesktopPenPalette : public UBPropertyPalette +class UBRightPalette; + +class UBDesktopPropertyPalette : public UBPropertyPalette { Q_OBJECT + public: - UBDesktopPenPalette(QWidget *parent = 0); - virtual ~UBDesktopPenPalette(){} + UBDesktopPropertyPalette(QWidget *parent, UBRightPalette* _rightPalette); + private: + UBRightPalette* rightPalette; + protected: + virtual int getParentRightOffset(); +}; +class UBDesktopPenPalette : public UBDesktopPropertyPalette +{ + Q_OBJECT + public: + UBDesktopPenPalette(QWidget *parent, UBRightPalette* rightPalette); + virtual ~UBDesktopPenPalette(){} public slots: void onParentMinimized(); void onParentMaximized(); - protected: - void resizeEvent(QResizeEvent *); - private slots: void onButtonReleased(); + +}; + +class UBDesktopEraserPalette : public UBDesktopPropertyPalette +{ + public: + UBDesktopEraserPalette(QWidget *parent, UBRightPalette* rightPalette); + virtual ~UBDesktopEraserPalette(){} }; +class UBDesktopMarkerPalette : public UBDesktopPropertyPalette +{ + public: + UBDesktopMarkerPalette(QWidget *parent, UBRightPalette* rightPalette); + virtual ~UBDesktopMarkerPalette(){} +}; + + #endif // UBDESKTOPPENPALETTE_H diff --git a/src/desktop/desktop.pri b/src/desktop/desktop.pri index d17410a2..5fb3934e 100644 --- a/src/desktop/desktop.pri +++ b/src/desktop/desktop.pri @@ -2,16 +2,12 @@ HEADERS += src/desktop/UBDesktopPalette.h \ src/desktop/UBDesktopAnnotationController.h \ src/desktop/UBCustomCaptureWindow.h \ src/desktop/UBWindowCapture.h \ - src/desktop/UBDesktopPenPalette.h \ - src/desktop/UBDesktopMarkerPalette.h \ - src/desktop/UBDesktopEraserPalette.h + src/desktop/UBDesktopPropertyPalette.h SOURCES += src/desktop/UBDesktopPalette.cpp \ src/desktop/UBDesktopAnnotationController.cpp \ src/desktop/UBCustomCaptureWindow.cpp \ - src/desktop/UBDesktopPenPalette.cpp \ - src/desktop/UBDesktopMarkerPalette.cpp \ - src/desktop/UBDesktopEraserPalette.cpp + src/desktop/UBDesktopPropertyPalette.cpp win32 { HEADERS += src/desktop/UBWindowCaptureDelegate_win.h diff --git a/src/domain/UBGraphicsItemUndoCommand.cpp b/src/domain/UBGraphicsItemUndoCommand.cpp index c8637242..be716a5e 100644 --- a/src/domain/UBGraphicsItemUndoCommand.cpp +++ b/src/domain/UBGraphicsItemUndoCommand.cpp @@ -112,8 +112,8 @@ void UBGraphicsItemUndoCommand::undo() } QMapIterator curMapElement(mExcludedFromGroup); - UBGraphicsGroupContainerItem *nextGroup = 0; - UBGraphicsGroupContainerItem *previousGroupItem; + UBGraphicsGroupContainerItem *nextGroup = NULL; + UBGraphicsGroupContainerItem *previousGroupItem = NULL; bool groupChanged = false; while (curMapElement.hasNext()) { @@ -157,8 +157,8 @@ void UBGraphicsItemUndoCommand::redo() } QMapIterator curMapElement(mExcludedFromGroup); - UBGraphicsGroupContainerItem *nextGroup = 0; - UBGraphicsGroupContainerItem *previousGroupItem; + UBGraphicsGroupContainerItem *nextGroup = NULL; + UBGraphicsGroupContainerItem *previousGroupItem = NULL; bool groupChanged = false; while (curMapElement.hasNext()) { diff --git a/src/gui/UBFloatingPalette.cpp b/src/gui/UBFloatingPalette.cpp index 6be397c7..e52893b2 100644 --- a/src/gui/UBFloatingPalette.cpp +++ b/src/gui/UBFloatingPalette.cpp @@ -129,6 +129,11 @@ void UBFloatingPalette::mouseReleaseEvent(QMouseEvent *event) } } +int UBFloatingPalette::getParentRightOffset() +{ + return 0; +} + void UBFloatingPalette::moveInsideParent(const QPoint &position) { QWidget *parent = parentWidget(); @@ -136,7 +141,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position) if (parent) { int margin = UBSettings::boardMargin - border(); - qreal newX = qMax(margin, qMin(parent->width() - width() - margin, position.x())); + qreal newX = qMax(margin, qMin(parent->width() - getParentRightOffset() - width() - margin, position.x())); qreal newY = qMax(margin, qMin(parent->height() - height() - margin, position.y())); if (!mCustomPosition && !mIsMoving) @@ -147,7 +152,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position) } else { - newX = qMax(margin, parent->width() - width() - margin); + newX = qMax(margin, parent->width() - getParentRightOffset() - width() - margin); } } move(newX, newY); @@ -260,7 +265,6 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos) return; } - QSize parentSize = parentWidget()->size(); if(mMinimizedLocation == eMinimizedLocation_None) { // Verify if we have to minimize this palette @@ -272,7 +276,7 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos) // { // mMinimizedLocation = eMinimizedLocation_Top; // } - else if(pos.x() == parentSize.width() - width() - 5) + else if(pos.x() == parentWidget()->width() - getParentRightOffset() - width() - 5) { mMinimizedLocation = eMinimizedLocation_Right; } @@ -292,8 +296,8 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos) // Restore the palette if(pos.x() > 5 && pos.y() > 5 && - pos.x() < parentSize.width() - width() - 5 && - pos.y() < parentSize.height() - height() - 5) + pos.x() < parentWidget()->width() - getParentRightOffset() - width() - 5 && + pos.y() < parentWidget()->size().height() - height() - 5) { mMinimizedLocation = eMinimizedLocation_None; emit maximizeStart(); diff --git a/src/gui/UBFloatingPalette.h b/src/gui/UBFloatingPalette.h index 0ddc6ade..2f670b8f 100644 --- a/src/gui/UBFloatingPalette.h +++ b/src/gui/UBFloatingPalette.h @@ -63,6 +63,10 @@ class UBFloatingPalette : public QWidget bool mCustomPosition; bool mIsMoving; + virtual int getParentRightOffset(); + + eMinimizedLocation minimizedLocation(){return mMinimizedLocation;} + private: void removeAllAssociatedPalette(); void minimizePalette(const QPoint& pos); diff --git a/src/gui/UBPropertyPalette.cpp b/src/gui/UBPropertyPalette.cpp index 643f87a7..8d587c99 100644 --- a/src/gui/UBPropertyPalette.cpp +++ b/src/gui/UBPropertyPalette.cpp @@ -25,7 +25,6 @@ UBPropertyPalette::UBPropertyPalette(QWidget *parent, const char *name):UBAction { setObjectName(name); mbGrip = false; - setMaximumHeight(MAX_HEIGHT); } /** @@ -36,7 +35,6 @@ UBPropertyPalette::UBPropertyPalette(QWidget *parent, const char *name):UBAction UBPropertyPalette::UBPropertyPalette(Qt::Orientation orientation, QWidget *parent):UBActionPalette(orientation, parent) { mbGrip = false; - setMaximumHeight(MAX_HEIGHT); } /** diff --git a/src/gui/UBPropertyPalette.h b/src/gui/UBPropertyPalette.h index 47bacf13..777e976e 100644 --- a/src/gui/UBPropertyPalette.h +++ b/src/gui/UBPropertyPalette.h @@ -20,8 +20,6 @@ #include "UBActionPalette.h" -#define MAX_HEIGHT 20 - class UBPropertyPalette : public UBActionPalette { Q_OBJECT