From 2b8c26028c775908f8f56d908f87a0a72339e9a6 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Tue, 26 Jun 2012 14:18:16 +0200 Subject: [PATCH] developped and improved Sankore-473 and sankore-597 --- resources/forms/mainWindow.ui | 12 ++++ .../images/erasePalette/eraseBackground.svg | 58 +++++++++++++++++++ resources/sankore.qrc | 1 + src/board/UBBoardController.cpp | 9 +++ src/board/UBBoardController.h | 1 + src/board/UBBoardPaletteManager.cpp | 4 +- src/core/UBApplication.cpp | 3 - src/core/UBPersistenceManager.cpp | 4 +- src/domain/UBGraphicsScene.cpp | 11 ++++ src/domain/UBGraphicsScene.h | 1 + src/gui/UBTeacherGuideWidgetsTools.cpp | 1 + 11 files changed, 99 insertions(+), 6 deletions(-) create mode 100644 resources/images/erasePalette/eraseBackground.svg diff --git a/resources/forms/mainWindow.ui b/resources/forms/mainWindow.ui index 6f81085c..c113ce7c 100644 --- a/resources/forms/mainWindow.ui +++ b/resources/forms/mainWindow.ui @@ -1665,6 +1665,18 @@ Interact with items + + + + :/images/erasePalette/eraseBackground.svg:/images/erasePalette/eraseBackground.svg + + + Erase Background + + + Remove the backgound + + diff --git a/resources/images/erasePalette/eraseBackground.svg b/resources/images/erasePalette/eraseBackground.svg new file mode 100644 index 00000000..6bae3993 --- /dev/null +++ b/resources/images/erasePalette/eraseBackground.svg @@ -0,0 +1,58 @@ + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/sankore.qrc b/resources/sankore.qrc index ced5d120..2d05cf89 100644 --- a/resources/sankore.qrc +++ b/resources/sankore.qrc @@ -173,6 +173,7 @@ images/erasePalette/eraseAll.svg images/erasePalette/eraseItem.svg images/erasePalette/eraseAnnotation.svg + images/erasePalette/eraseBackground.svg images/cursors/eraser.png images/cursors/laser.png images/cursors/marker.png diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index edfcd5c6..88912af5 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -376,6 +376,7 @@ void UBBoardController::connectToolbar() connect(mMainWindow->actionClearPage, SIGNAL(triggered()), this, SLOT(clearScene())); connect(mMainWindow->actionEraseItems, SIGNAL(triggered()), this, SLOT(clearSceneItems())); connect(mMainWindow->actionEraseAnnotations, SIGNAL(triggered()), this, SLOT(clearSceneAnnotation())); + connect(mMainWindow->actionEraseBackground,SIGNAL(triggered()),this,SLOT(clearSceneBackground())); connect(mMainWindow->actionUndo, SIGNAL(triggered()), UBApplication::undoStack, SLOT(undo())); connect(mMainWindow->actionRedo, SIGNAL(triggered()), UBApplication::undoStack, SLOT(redo())); @@ -580,6 +581,14 @@ void UBBoardController::clearSceneAnnotation() } } +void UBBoardController::clearSceneBackground() +{ + if (mActiveScene) + { + mActiveScene->clearBackground(); + updateActionStates(); + } +} void UBBoardController::showDocumentsDialog() { diff --git a/src/board/UBBoardController.h b/src/board/UBBoardController.h index fe1c802f..eeb15b02 100644 --- a/src/board/UBBoardController.h +++ b/src/board/UBBoardController.h @@ -174,6 +174,7 @@ class UBBoardController : public QObject void clearScene(); void clearSceneItems(); void clearSceneAnnotation(); + void clearSceneBackground(); void zoomIn(QPointF scenePoint = QPointF(0,0)); void zoomOut(QPointF scenePoint = QPointF(0,0)); void zoomRestore(); diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index ca124809..a05ca1f7 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -66,6 +66,7 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardController* pBoardController) : QObject(container) , mKeyboardPalette(0) + , mWebToolsCurrentPalette(0) , mContainer(container) , mBoardControler(pBoardController) , mStylusPalette(0) @@ -74,7 +75,6 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll , mRightPalette(NULL) , mBackgroundsPalette(0) , mToolsPalette(0) - , mWebToolsCurrentPalette(0) , mAddItemPalette(0) , mErasePalette(NULL) , mPagePalette(NULL) @@ -304,6 +304,7 @@ void UBBoardPaletteManager::setupPalettes() eraseActions << UBApplication::mainWindow->actionEraseAnnotations; eraseActions << UBApplication::mainWindow->actionEraseItems; eraseActions << UBApplication::mainWindow->actionClearPage; + eraseActions << UBApplication::mainWindow->actionEraseBackground; mErasePalette = new UBActionPalette(eraseActions, Qt::Horizontal , mContainer); mErasePalette->setButtonIconSize(QSize(128, 128)); @@ -447,6 +448,7 @@ void UBBoardPaletteManager::connectPalettes() connect(UBApplication::mainWindow->actionEraseItems, SIGNAL(triggered()), mErasePalette, SLOT(close())); connect(UBApplication::mainWindow->actionEraseAnnotations, SIGNAL(triggered()), mErasePalette, SLOT(close())); connect(UBApplication::mainWindow->actionClearPage, SIGNAL(triggered()), mErasePalette, SLOT(close())); + connect(UBApplication::mainWindow->actionEraseBackground,SIGNAL(triggered()),mErasePalette,SLOT(close())); connect(mErasePalette, SIGNAL(closed()), this, SLOT(erasePaletteClosed())); foreach(QWidget *widget, UBApplication::mainWindow->actionErase->associatedWidgets()) diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 699f9a37..fc02804d 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -36,8 +36,6 @@ #include "UBIdleTimer.h" #include "UBApplicationController.h" -//#include "softwareupdate/UBSoftwareUpdateController.h" - #include "board/UBBoardController.h" #include "board/UBDrawingController.h" #include "board/UBBoardView.h" @@ -203,7 +201,6 @@ UBApplication::~UBApplication() staticMemoryCleaner = 0; } - void UBApplication::setupTranslator(QString forcedLanguage) { QStringList availablesTranslations = UBPlatformUtils::availableTranslations(); diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 98261e3a..ba754ed6 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -849,9 +849,9 @@ QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy* { QString path = pPath; //windows - path.replace("file:///",""); + //path=path.replace("file:///",""); //others - path.replace("file://",""); + path=path.replace("file://",""); QFileInfo fi(path); QString uuid = QUuid::createUuid(); diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 20d657d7..c62dd36d 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1286,6 +1286,17 @@ void UBGraphicsScene::clearAnnotations() setDocumentUpdated(); } +void UBGraphicsScene::clearBackground() +{ + if(mBackgroundObject){ + removeItem(mBackgroundObject); + mBackgroundObject = 0; + } + update(sceneRect()); + + setDocumentUpdated(); +} + UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const QPointF& pPos, qreal pScaleFactor, bool pUseAnimation) { UBGraphicsPixmapItem* pixmapItem = new UBGraphicsPixmapItem(); diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index 69c92abb..d9bdf9cc 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -113,6 +113,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem void clearItemsAndAnnotations(); void clearItems(); void clearAnnotations(); + void clearBackground(); bool inputDevicePress(const QPointF& scenePos, const qreal& pressure = 1.0); bool inputDeviceMove(const QPointF& scenePos, const qreal& pressure = 1.0); diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index cba4e8bc..fc11319f 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -339,6 +339,7 @@ void UBTGMediaWidget::initializeWithDom(QDomElement element) mIsInitializationMode = true; setAcceptDrops(false); mMediaPath = UBApplication::boardController->activeDocument()->persistencePath() + "/" + element.attribute("relativePath"); + qDebug() << mMediaPath; createWorkWidget(); setFixedHeight(200); mpTitle->setInitialText(element.attribute("title"));