From 7ee53b07ad59a1ee9cd2aa808c27cf2e1272b227 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Sat, 5 May 2012 11:11:33 +0200 Subject: [PATCH] first page handling code --- resources/style.qss | 15 +-- src/adaptors/UBImportImage.cpp | 1 - src/adaptors/UBImportPDF.cpp | 1 - src/adaptors/UBThumbnailAdaptor.cpp | 20 ++- .../publishing/UBDocumentPublisher.cpp | 12 +- src/board/UBBoardController.cpp | 9 +- src/board/UBBoardController.h | 2 + src/board/UBBoardPaletteManager.cpp | 4 +- src/board/UBBoardView.cpp | 15 +-- src/board/UBFeaturesController.h | 116 +++++++++--------- src/core/UBPersistenceManager.cpp | 44 ++++++- src/core/UBPersistenceManager.h | 6 +- src/gui/UBDocumentNavigator.cpp | 2 +- src/gui/UBNavigatorPalette.cpp | 5 +- src/gui/UBTeacherGuideWidget.cpp | 22 ++-- src/gui/UBThumbnailWidget.cpp | 1 + 16 files changed, 162 insertions(+), 113 deletions(-) diff --git a/resources/style.qss b/resources/style.qss index 31f1e671..90a78726 100644 --- a/resources/style.qss +++ b/resources/style.qss @@ -227,19 +227,13 @@ QLabel#UBTGPresentationDocumentTitle font-weight:bold; } -QLabel#UBTGEditionPageNumberLabel +QLabel#UBTGPageNumberLabel { color: black; font-size : 12px; font-weight:bold; } -QLabel#UBTGPresentationPageNumberLabel -{ - color: black; - font-size : 12px; -} - UBTGAdaptableText#UBTGEditionPageTitle, UBTGAdaptableText#UBTGEditionComment { @@ -266,3 +260,10 @@ QFrame#UBTGSeparator { background-color: #cccccc; } + +UBTGAdaptableText { + background-color: white; + border:1 solid #999999; + border-radius : 10px; + padding: 2px; +} diff --git a/src/adaptors/UBImportImage.cpp b/src/adaptors/UBImportImage.cpp index f2829dd6..16564540 100644 --- a/src/adaptors/UBImportImage.cpp +++ b/src/adaptors/UBImportImage.cpp @@ -14,7 +14,6 @@ */ #include "UBImportImage.h" -#include "UBSvgSubsetAdaptor.h" #include "document/UBDocumentProxy.h" diff --git a/src/adaptors/UBImportPDF.cpp b/src/adaptors/UBImportPDF.cpp index d3cf8b38..ef845f13 100644 --- a/src/adaptors/UBImportPDF.cpp +++ b/src/adaptors/UBImportPDF.cpp @@ -14,7 +14,6 @@ */ #include "UBImportPDF.h" -#include "UBSvgSubsetAdaptor.h" #include "document/UBDocumentProxy.h" diff --git a/src/adaptors/UBThumbnailAdaptor.cpp b/src/adaptors/UBThumbnailAdaptor.cpp index e45cf725..2cd1f4de 100644 --- a/src/adaptors/UBThumbnailAdaptor.cpp +++ b/src/adaptors/UBThumbnailAdaptor.cpp @@ -23,6 +23,8 @@ #include "core/UBApplication.h" #include "core/UBSettings.h" +#include "board/UBBoardController.h" + #include "document/UBDocumentProxy.h" #include "domain/UBGraphicsScene.h" @@ -42,8 +44,7 @@ QList UBThumbnailAdaptor::load(UBDocumentProxy* proxy) int existingPageCount = proxy->pageCount(); - QString thumbFileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", existingPageCount); + QString thumbFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", existingPageCount); QFile thumbFile(thumbFileName); @@ -80,8 +81,7 @@ QList UBThumbnailAdaptor::load(UBDocumentProxy* proxy) while (moreToProcess) { pageCount++; - QString fileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageCount); + QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageCount); QFile file(fileName); if (file.exists()) { @@ -108,8 +108,7 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index) return QPixmap(); //compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails - QString thumbFileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", existingPageCount); + QString thumbFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", existingPageCount); QFile thumbFile(thumbFileName); @@ -140,8 +139,8 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index) } //end compatibility with older format - QString fileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", index + 1); +// QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", index + 1); + QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", UBApplication::boardController->pageFromSceneIndex(index)); QFile file(fileName); if (file.exists()) @@ -160,7 +159,7 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index) void UBThumbnailAdaptor::persistScene(const QString& pDocPath, UBGraphicsScene* pScene, int pageIndex, bool overrideModified) { - QString fileName = pDocPath + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex + 1); + QString fileName = pDocPath + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); QFile thumbFile(fileName); @@ -206,8 +205,7 @@ void UBThumbnailAdaptor::persistScene(const QString& pDocPath, UBGraphicsScene* QUrl UBThumbnailAdaptor::thumbnailUrl(UBDocumentProxy* proxy, int pageIndex) { - QString fileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex + 1); + QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); return QUrl::fromLocalFile(fileName); } diff --git a/src/adaptors/publishing/UBDocumentPublisher.cpp b/src/adaptors/publishing/UBDocumentPublisher.cpp index 686b9d94..47e78ea6 100644 --- a/src/adaptors/publishing/UBDocumentPublisher.cpp +++ b/src/adaptors/publishing/UBDocumentPublisher.cpp @@ -28,6 +28,8 @@ #include "core/UBPersistenceManager.h" #include "core/UBApplicationController.h" +#include "board/UBBoardController.h" + #include "gui/UBMainWindow.h" #include "document/UBDocumentProxy.h" @@ -131,7 +133,7 @@ void UBDocumentPublisher::buildUbwFile() // remove all useless files for (int pageIndex = 0; pageIndex < mPublishingDocument->pageCount(); pageIndex++) { - QString filename = mPublishingDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", pageIndex + 1); + QString filename = mPublishingDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); QFile::remove(filename); } @@ -187,11 +189,11 @@ void UBDocumentPublisher::rasterizeScenes() for (int pageIndex = 0; pageIndex < mPublishingDocument->pageCount(); pageIndex++) { - UBApplication::showMessage(tr("Converting page %1/%2 ...").arg(pageIndex + 1).arg(mPublishingDocument->pageCount()), true); + UBApplication::showMessage(tr("Converting page %1/%2 ...").arg(UBApplication::boardController->pageFromSceneIndex(pageIndex)).arg(mPublishingDocument->pageCount()), true); UBSvgSubsetRasterizer rasterizer(mPublishingDocument, pageIndex); - QString filename = mPublishingDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.jpg", pageIndex + 1); + QString filename = mPublishingDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.jpg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); rasterizer.rasterizeToFile(filename); @@ -250,12 +252,12 @@ void UBDocumentPublisher::upgradeDocumentForPublishing() UBGraphicsW3CWidgetItem *widgetItem = dynamic_cast(item); if(widgetItem){ - generateWidgetPropertyScript(widgetItem, pageIndex + 1); + generateWidgetPropertyScript(widgetItem, UBApplication::boardController->pageFromSceneIndex(pageIndex)); widgets << widgetItem; } } - QString filename = mPublishingDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.json", pageIndex + 1); + QString filename = mPublishingDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.json", UBApplication::boardController->pageFromSceneIndex(pageIndex)); QFile jsonFile(filename); if (jsonFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 2f03f66f..90ea9bfa 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -151,11 +151,18 @@ UBBoardController::~UBBoardController() int UBBoardController::currentPage() { - if(!UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) + if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) return mActiveSceneIndex; return mActiveSceneIndex + 1; } +int UBBoardController::pageFromSceneIndex(int sceneIndex) +{ + if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) + return sceneIndex; + return sceneIndex+1; +} + void UBBoardController::setupViews() { mControlContainer = new QWidget(mMainWindow->centralWidget()); diff --git a/src/board/UBBoardController.h b/src/board/UBBoardController.h index 4b293c68..e07549be 100644 --- a/src/board/UBBoardController.h +++ b/src/board/UBBoardController.h @@ -59,6 +59,8 @@ class UBBoardController : public QObject int currentPage(); + int pageFromSceneIndex(int sceneIndex); + UBDocumentProxy* activeDocument() { return mActiveDocument; diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index 1a9c5e0a..ee10bff6 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -153,7 +153,7 @@ void UBBoardPaletteManager::setupDockPaletteWidgets() mRightPalette = new UBRightPalette(mContainer); // RIGHT palette widgets - + mpFeaturesWidget = new UBFeaturesWidget(); mRightPalette->registerWidget(mpFeaturesWidget); mRightPalette->addTab(mpFeaturesWidget); @@ -534,7 +534,7 @@ void UBBoardPaletteManager::activeSceneChanged() if (mpPageNavigWidget) { - mpPageNavigWidget->setPageNumber(pageIndex + 1, activeScene->document()->pageCount()); + mpPageNavigWidget->setPageNumber(UBApplication::boardController->pageFromSceneIndex(pageIndex), activeScene->document()->pageCount()); } if (mZoomPalette) diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 3dd30148..c8e746ef 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -585,9 +585,9 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event) else QGraphicsView::mouseMoveEvent (event); } else if ((UBDrawingController::drawingController()->isDrawingTool()) - && !mMouseButtonIsPressed) + && !mMouseButtonIsPressed) { - QGraphicsView::mouseMoveEvent (event); + QGraphicsView::mouseMoveEvent (event); } else if (currentTool == UBStylusTool::Text || currentTool == UBStylusTool::Capture) { @@ -849,11 +849,12 @@ void UBBoardView::dropEvent (QDropEvent *event) graphicsWidget->processDropEvent(event); event->acceptProposedAction(); - } else if (!event->source() - || dynamic_cast(event->source()) - || dynamic_cast(event->source()) - || dynamic_cast(event->source()) - || dynamic_cast(event->source()) ) { + } else if (!event->source() + || dynamic_cast(event->source()) + || dynamic_cast(event->source()) + || dynamic_cast(event->source()) + || dynamic_cast(event->source()) + || dynamic_cast(event->source())) { mController->processMimeData (event->mimeData (), mapToScene (event->pos ())); event->acceptProposedAction(); diff --git a/src/board/UBFeaturesController.h b/src/board/UBFeaturesController.h index a46c6e63..bd0c0870 100644 --- a/src/board/UBFeaturesController.h +++ b/src/board/UBFeaturesController.h @@ -8,39 +8,37 @@ #include #include -//#include "UBDockPaletteWidget.h" - enum UBFeatureElementType { FEATURE_CATEGORY, FEATURE_VIRTUALFOLDER, FEATURE_FOLDER, FEATURE_INTERACTIVE, - FEATURE_INTERNAL, + FEATURE_INTERNAL, FEATURE_ITEM, - FEATURE_TRASH, - FEATURE_FAVORITE + FEATURE_TRASH, + FEATURE_FAVORITE }; class UBFeature { public: UBFeature() {;} - //UBFeature(const UBFeature &f); + //UBFeature(const UBFeature &f); UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type = FEATURE_CATEGORY); virtual ~UBFeature() {;} QString getName() const { return mName; } QPixmap getThumbnail() const {return mThumbnail;} QString getUrl() const { return virtualPath; } - //QString getPath() const { return mPath; }; + //QString getPath() const { return mPath; }; QString getFullPath() const { return mPath; } UBFeatureElementType getType() const { return elementType; } - bool isFolder() const; + bool isFolder() const; private: - QString virtualPath; + QString virtualPath; QPixmap mThumbnail; QString mName; - QString mPath; + QString mPath; UBFeatureElementType elementType; }; Q_DECLARE_METATYPE( UBFeature ) @@ -50,73 +48,73 @@ class UBFeaturesController : public QObject { Q_OBJECT public: - UBFeaturesController(QWidget *parentWidget); + UBFeaturesController(QWidget *parentWidget); virtual ~UBFeaturesController(); QList * getFeatures()const { return featuresList; } - + const QString& getRootPath()const { return rootPath; } - void addItemToPage(const UBFeature &item); - const UBFeature& getCurrentElement()const { return currentElement; } - void setCurrentElement( const UBFeature &elem ) { currentElement = elem; } - const UBFeature & getTrashElement () const { return trashElement; } - UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination ); - UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination ); - void deleteItem( const QUrl &url ); - bool isTrash( const QUrl &url ); - UBFeature newFolder( const QString &name ); - UBFeature addToFavorite( const QUrl &path ); - void removeFromFavorite( const QUrl &path ); - - static QString fileNameFromUrl( const QUrl &url ); - static QPixmap thumbnailForFile( const QString &path ); + void addItemToPage(const UBFeature &item); + const UBFeature& getCurrentElement()const { return currentElement; } + void setCurrentElement( const UBFeature &elem ) { currentElement = elem; } + const UBFeature & getTrashElement () const { return trashElement; } + UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination ); + UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination ); + void deleteItem( const QUrl &url ); + bool isTrash( const QUrl &url ); + UBFeature newFolder( const QString &name ); + UBFeature addToFavorite( const QUrl &path ); + void removeFromFavorite( const QUrl &path ); + + static QString fileNameFromUrl( const QUrl &url ); + static QPixmap thumbnailForFile( const QString &path ); private: - void initDirectoryTree(); - void fileSystemScan(const QString &currPath, const QString & currVirtualPath); - static QPixmap createThumbnail(const QString &path); - //void addImageToCurrentPage( const QString &path ); - void loadFavoriteList(); - void saveFavoriteList(); + void initDirectoryTree(); + void fileSystemScan(const QString &currPath, const QString & currVirtualPath); + static QPixmap createThumbnail(const QString &path); + //void addImageToCurrentPage( const QString &path ); + void loadFavoriteList(); + void saveFavoriteList(); - static UBFeatureElementType fileTypeFromUrl( const QString &path ); + static UBFeatureElementType fileTypeFromUrl( const QString &path ); - QList *featuresList; - UBFeature *rootElement; + QList *featuresList; + UBFeature *rootElement; - QString mUserAudioDirectoryPath; + QString mUserAudioDirectoryPath; QString mUserVideoDirectoryPath; QString mUserPicturesDirectoryPath; QString mUserInteractiveDirectoryPath; QString mUserAnimationDirectoryPath; - QString libraryPath; - QString mLibAudioDirectoryPath; + QString libraryPath; + QString mLibAudioDirectoryPath; QString mLibVideoDirectoryPath; QString mLibPicturesDirectoryPath; QString mLibInteractiveDirectoryPath; QString mLibAnimationDirectoryPath; - QString mLibApplicationsDirectoryPath; - QString mLibShapesDirectoryPath; - QString trashDirectoryPath; - - QString rootPath; - QString audiosPath; - QString moviesPath; - QString picturesPath; - QString appPath; - QString flashPath; - QString shapesPath; - QString interactPath; - QString trashPath; - QString favoritePath; - - int mLastItemOffsetIndex; - UBFeature currentElement; - UBFeature trashElement; - UBFeature favoriteElement; - - QSet *favoriteSet; + QString mLibApplicationsDirectoryPath; + QString mLibShapesDirectoryPath; + QString trashDirectoryPath; + + QString rootPath; + QString audiosPath; + QString moviesPath; + QString picturesPath; + QString appPath; + QString flashPath; + QString shapesPath; + QString interactPath; + QString trashPath; + QString favoritePath; + + int mLastItemOffsetIndex; + UBFeature currentElement; + UBFeature trashElement; + UBFeature favoriteElement; + + QSet *favoriteSet; }; diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 8c3b6b1e..12341f7b 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -32,6 +32,10 @@ #include "adaptors/UBThumbnailAdaptor.h" #include "adaptors/UBMetadataDcSubsetAdaptor.h" +#include "board/UBBoardController.h" + +#include "interfaces/IDataStorage.h" + #include "core/memcheck.h" const QString UBPersistenceManager::imageDirectory = "images"; // added to UBPersistenceManager::mAllDirectories @@ -39,6 +43,7 @@ const QString UBPersistenceManager::objectDirectory = "objects"; // added to UBP const QString UBPersistenceManager::widgetDirectory = "widgets"; // added to UBPersistenceManager::mAllDirectories const QString UBPersistenceManager::videoDirectory = "videos"; // added to UBPersistenceManager::mAllDirectories const QString UBPersistenceManager::audioDirectory = "audios"; // added to +const QString UBPersistenceManager::teacherGuideDirectory = "teacherGuideObjects"; UBPersistenceManager * UBPersistenceManager::sSingleton = 0; @@ -52,6 +57,7 @@ UBPersistenceManager::UBPersistenceManager(QObject *pParent) mDocumentSubDirectories << widgetDirectory; mDocumentSubDirectories << videoDirectory; mDocumentSubDirectories << audioDirectory; + mDocumentSubDirectories << teacherGuideDirectory; documentProxies = allDocumentProxies(); emit proxyListChanged(); @@ -83,7 +89,6 @@ UBPersistenceManager::~UBPersistenceManager() } } - QList > UBPersistenceManager::allDocumentProxies() { mDocumentRepositoryPath = UBSettings::userDocumentDirectory(); @@ -363,7 +368,7 @@ UBDocumentProxy* UBPersistenceManager::duplicateDocument(UBDocumentProxy* pDocum void UBPersistenceManager::deleteDocumentScenes(UBDocumentProxy* proxy, const QList& indexes) { - checkIfDocumentRepositoryExists(); + checkIfDocumentRepositoryExists(); int pageCount = UBPersistenceManager::persistenceManager()->sceneCount(proxy); @@ -432,7 +437,7 @@ void UBPersistenceManager::deleteDocumentScenes(UBDocumentProxy* proxy, const QL QFile::remove(thumbFileName); - mSceneCache.removeScene(proxy, index); + mSceneCache.removeScene(proxy, index); proxy->decPageCount(); @@ -482,7 +487,7 @@ void UBPersistenceManager::duplicateDocumentScene(UBDocumentProxy* proxy, int in proxy->incPageCount(); - emit documentSceneCreated(proxy, index + 1); + emit documentSceneCreated(proxy, index + 1); } @@ -668,7 +673,7 @@ int UBPersistenceManager::sceneCountInDir(const QString& pPath) while (moreToProcess) { - QString fileName = pPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", pageIndex + 1); + QString fileName = pPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); QFile file(fileName); @@ -828,6 +833,35 @@ void UBPersistenceManager::purgeEmptyDocuments() } } +QString UBPersistenceManager::teacherGuideAbsoluteObjectPath(UBDocumentProxy* pDocumentProxy) +{ + return pDocumentProxy->persistencePath() + "/" + teacherGuideDirectory; +} + +QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy* pDocumentProxy, QString pPath) +{ + QFileInfo fi(pPath.replace("file://","")); + QString uuid = QUuid::createUuid(); + + if (!fi.exists() || !pDocumentProxy) + return ""; + + QString fileName = UBPersistenceManager::teacherGuideDirectory + "/" + uuid + "." + fi.suffix(); + + QString destPath = pDocumentProxy->persistencePath() + "/" + fileName; + + if (!QFile::exists(destPath)){ + QDir dir; + dir.mkdir(pDocumentProxy->persistencePath() + "/" + UBPersistenceManager::teacherGuideDirectory); + + QFile source(pPath); + + source.copy(destPath); + } + + return destPath; +} + QString UBPersistenceManager::addVideoFileToDocument(UBDocumentProxy* pDocumentProxy, QString path, QUuid objectUuid) { diff --git a/src/core/UBPersistenceManager.h b/src/core/UBPersistenceManager.h index b9c53579..75af2390 100644 --- a/src/core/UBPersistenceManager.h +++ b/src/core/UBPersistenceManager.h @@ -41,11 +41,12 @@ class UBPersistenceManager : public QObject static const QString videoDirectory; static const QString audioDirectory; static const QString widgetDirectory; + static const QString teacherGuideDirectory; static UBPersistenceManager* persistenceManager(); static void destroy(); - virtual UBDocumentProxy* createDocument(const QString& pGroupName = "", const QString& pName = "", bool withEmptyPage = true); + virtual UBDocumentProxy* createDocument(const QString& pGroupName = "", const QString& pName = "", bool withEmptyPage = true); virtual UBDocumentProxy* createDocumentFromDir(const QString& pDocumentDirectory, const QString& pGroupName = "", const QString& pName = "", bool withEmptyPage = false); virtual UBDocumentProxy* persistDocumentMetadata(UBDocumentProxy* pDocumentProxy); @@ -80,6 +81,9 @@ class UBPersistenceManager : public QObject virtual QString generateUniqueDocumentPath(); + QString teacherGuideAbsoluteObjectPath(UBDocumentProxy* pDocumentProxy); + QString addObjectToTeacherGuideDirectory(UBDocumentProxy* proxy, QString pPath); + virtual void addDirectoryContentToDocument(const QString& documentRootFolder, UBDocumentProxy* pDocument); virtual void upgradeDocumentIfNeeded(UBDocumentProxy* pDocumentProxy); diff --git a/src/gui/UBDocumentNavigator.cpp b/src/gui/UBDocumentNavigator.cpp index c2dd5df2..b37b2e68 100644 --- a/src/gui/UBDocumentNavigator.cpp +++ b/src/gui/UBDocumentNavigator.cpp @@ -113,7 +113,7 @@ void UBDocumentNavigator::generateThumbnails() { QPixmap pix = thumbs.at(i); QGraphicsPixmapItem* pixmapItem = new UBSceneThumbnailNavigPixmap(pix, mCrntDoc, i); - UBThumbnailTextItem *labelItem = new UBThumbnailTextItem(tr("Page %0").arg(i + 1)); + UBThumbnailTextItem *labelItem = new UBThumbnailTextItem(tr("Page %0").arg(UBApplication::boardController->pageFromSceneIndex(i))); UBImgTextThumbnailElement thumbWithText(pixmapItem, labelItem); thumbWithText.setBorder(border()); diff --git a/src/gui/UBNavigatorPalette.cpp b/src/gui/UBNavigatorPalette.cpp index ed5c7aa8..98a94159 100644 --- a/src/gui/UBNavigatorPalette.cpp +++ b/src/gui/UBNavigatorPalette.cpp @@ -33,8 +33,7 @@ UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name): { setOrientation(eUBDockOrientation_Left); setMaximumWidth(300); - //mCollapsedIcon = QPixmap(":images/pages_open.png"); - //mIcon = QPixmap(":images/pages_close.png"); + resize(UBSettings::settings()->navigPaletteWidth->get().toInt(), height()); mLastWidth = 300; @@ -129,7 +128,7 @@ void UBNavigatorPalette::changeCurrentPage() if(NO_PAGESELECTED != iPage) { // Display the selected page - UBApplication::boardController->setActiveDocumentScene(mNavigator->currentDoc(), iPage); + UBApplication::boardController->setActiveDocumentScene(mNavigator->currentDoc(), iPage); } } diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 77e3772d..d27ceffd 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -862,15 +862,19 @@ void UBTeacherGuidePageZeroWidget::loadData() void UBTeacherGuidePageZeroWidget::persistData() { - UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); - documentProxy->setMetaData(UBSettings::sessionTitle,mpSessionTitle->text()); - documentProxy->setMetaData(UBSettings::sessionAuthors, mpAuthors->text()); - documentProxy->setMetaData(UBSettings::sessionGoals,mpGoals->text()); - documentProxy->setMetaData(UBSettings::sessionKeywords,mpKeywords->text()); - documentProxy->setMetaData(UBSettings::sessionGradeLevel,mpSchoolLevelBox->currentText()); - documentProxy->setMetaData(UBSettings::sessionBranch,mpSchoolBranchBox->currentText()); - documentProxy->setMetaData(UBSettings::sessionType,mpSchoolTypeBox->currentText()); - documentProxy->setMetaData(UBSettings::sessionLicence,mpLicenceBox->currentText()); + // check necessary because at document closing hide event is send after boardcontroller set + // to NULL + if(UBApplication::boardController){ + UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); + documentProxy->setMetaData(UBSettings::sessionTitle,mpSessionTitle->text()); + documentProxy->setMetaData(UBSettings::sessionAuthors, mpAuthors->text()); + documentProxy->setMetaData(UBSettings::sessionGoals,mpGoals->text()); + documentProxy->setMetaData(UBSettings::sessionKeywords,mpKeywords->text()); + documentProxy->setMetaData(UBSettings::sessionGradeLevel,mpSchoolLevelBox->currentText()); + documentProxy->setMetaData(UBSettings::sessionBranch,mpSchoolBranchBox->currentText()); + documentProxy->setMetaData(UBSettings::sessionType,mpSchoolTypeBox->currentText()); + documentProxy->setMetaData(UBSettings::sessionLicence,mpLicenceBox->currentText()); + } } void UBTeacherGuidePageZeroWidget::updateSceneTitle() diff --git a/src/gui/UBThumbnailWidget.cpp b/src/gui/UBThumbnailWidget.cpp index a3c631fb..98437969 100644 --- a/src/gui/UBThumbnailWidget.cpp +++ b/src/gui/UBThumbnailWidget.cpp @@ -855,6 +855,7 @@ void UBSceneThumbnailNavigPixmap::deletePage() void UBSceneThumbnailNavigPixmap::moveUpPage() { + UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() - 1); }