From 9100597201d923855d71181a34d625bfa3f2aa57 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 27 Apr 2012 11:24:52 +0200 Subject: [PATCH 01/42] removed software update --- Sankore_3.1.pro | 1 - src/softwareupdate/UBRssHandler.cpp | 142 ---------- src/softwareupdate/UBRssHandler.h | 59 ---- src/softwareupdate/UBSoftwareUpdate.cpp | 52 ---- src/softwareupdate/UBSoftwareUpdate.h | 40 --- .../UBSoftwareUpdateController.cpp | 261 ------------------ .../UBSoftwareUpdateController.h | 61 ---- src/softwareupdate/softwareupdate.pri | 8 - 8 files changed, 624 deletions(-) delete mode 100644 src/softwareupdate/UBRssHandler.cpp delete mode 100644 src/softwareupdate/UBRssHandler.h delete mode 100644 src/softwareupdate/UBSoftwareUpdate.cpp delete mode 100644 src/softwareupdate/UBSoftwareUpdate.h delete mode 100644 src/softwareupdate/UBSoftwareUpdateController.cpp delete mode 100644 src/softwareupdate/UBSoftwareUpdateController.h delete mode 100644 src/softwareupdate/softwareupdate.pri diff --git a/Sankore_3.1.pro b/Sankore_3.1.pro index 96c00aa1..28e017c5 100644 --- a/Sankore_3.1.pro +++ b/Sankore_3.1.pro @@ -52,7 +52,6 @@ include(src/podcast/podcast.pri) include(src/tools/tools.pri) include(src/desktop/desktop.pri) include(src/web/web.pri) -include(src/softwareupdate/softwareupdate.pri) include(src/transition/transition.pri) include(src/customWidgets/customWidgets.pri) include(src/interfaces/interfaces.pri) diff --git a/src/softwareupdate/UBRssHandler.cpp b/src/softwareupdate/UBRssHandler.cpp deleted file mode 100644 index 5097600a..00000000 --- a/src/softwareupdate/UBRssHandler.cpp +++ /dev/null @@ -1,142 +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 3 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 "frameworks/UBVersion.h" - -#include "UBRssHandler.h" -#include "UBSoftwareUpdate.h" - -#include "core/memcheck.h" - -const QString UBRssHandler::sRssItemElementName = "item"; -const QString UBRssHandler::sRssLinkElementName = "link"; -const QString UBRssHandler::sUniboardVersionElementName = "ub:version"; // TODO UB 4.x map properly ub namespace - -UBRssHandler::UBRssHandler() - : mRssTagParsed(false) - , mInItem(false) - , mInVersion(false) -{ - // NOOP -} - -UBRssHandler::~UBRssHandler(void) -{ - while (!mSoftwareUpdates.isEmpty()) - { - delete mSoftwareUpdates.takeFirst(); - } -} - -bool UBRssHandler::startElement( - const QString & /* namespaceURI */, - const QString & /* localName */, - const QString &qualifiedName, - const QXmlAttributes &attributes) -{ - bool ok = true; - if (!mRssTagParsed && qualifiedName != "rss") - { - mError = "This file is not a RSS source."; - ok = false; - } - else if (qualifiedName == "rss") - { - QString version = attributes.value("version"); - if (!version.isEmpty() && version != "2.0") - { - mError = "Can only handle RSS 2.0."; - ok = false; - } - else - { - mRssTagParsed = true; - } - } - else if (qualifiedName == sRssItemElementName) - { - mInItem = true; - } - else if (qualifiedName == sUniboardVersionElementName) - { - mInVersion = true; - } - mCurrentText = ""; - return ok; -} - -bool UBRssHandler::characters(const QString &str) -{ - mCurrentText += str; - return true; -} - -bool UBRssHandler::endElement( - const QString & /* namespaceURI */, - const QString & /* localName */, - const QString &qualifiedName) -{ - bool ok = true; - if (qualifiedName == sRssItemElementName) - { - mInItem = false; - if (mVersion.isValid() && !mDownloadUrl.isEmpty()) - { - UBSoftwareUpdate *softwareUpdate = new UBSoftwareUpdate(mVersion, mDownloadUrl); - mSoftwareUpdates.append(softwareUpdate); - } - mVersion = UBVersion(); - mDownloadUrl = ""; - } - else if (qualifiedName == sRssLinkElementName) - { - if (mInItem) - { - QUrl url(mCurrentText); - if (url.isValid()) - mDownloadUrl = mCurrentText; - else - ok = false; - } - } - else if (qualifiedName == sUniboardVersionElementName) - { - if (mInItem) - { - mVersion.setString(mCurrentText); - ok = mVersion.isValid(); - mInVersion = false; - } - } - return ok; -} - -bool UBRssHandler::fatalError(const QXmlParseException &exception) -{ - qWarning() << "Fatal error at line " << exception.lineNumber() - << ", column " << exception.columnNumber() << ": " - << exception.message() << mError; - return false; -} - -QString UBRssHandler::error() const -{ - return mError; -} - -QList UBRssHandler::softwareUpdates() const -{ - return mSoftwareUpdates; -} diff --git a/src/softwareupdate/UBRssHandler.h b/src/softwareupdate/UBRssHandler.h deleted file mode 100644 index 04d75dcc..00000000 --- a/src/softwareupdate/UBRssHandler.h +++ /dev/null @@ -1,59 +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 3 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 UBRSSHANDLER_H_ -#define UBRSSHANDLER_H_ - -#include -#include - -#include "frameworks/UBVersion.h" -class UBSoftwareUpdate; - -class UBRssHandler: public QXmlDefaultHandler -{ - public: - UBRssHandler(); - virtual ~UBRssHandler(void); - - // QXmlDefaultHandler - virtual bool startElement(const QString &namespaceURI, - const QString &localName, const QString &qualifiedName, - const QXmlAttributes &attributes); - virtual bool endElement(const QString &namespaceURI, - const QString &localName, const QString &qualifiedName); - virtual bool characters(const QString &str); - virtual bool fatalError(const QXmlParseException &exception); - - // UBRssHandler - QString error() const; - QList softwareUpdates() const; - - private: - QList mSoftwareUpdates; - bool mRssTagParsed; - bool mInItem; - bool mInVersion; - QString mError; - QString mCurrentText; - UBVersion mVersion; - QString mDownloadUrl; - - static const QString sRssItemElementName; - static const QString sRssLinkElementName; - static const QString sUniboardVersionElementName; -}; - -#endif /* UBRSSHANDLER_H_ */ diff --git a/src/softwareupdate/UBSoftwareUpdate.cpp b/src/softwareupdate/UBSoftwareUpdate.cpp deleted file mode 100644 index 84a3e450..00000000 --- a/src/softwareupdate/UBSoftwareUpdate.cpp +++ /dev/null @@ -1,52 +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 3 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 "frameworks/UBVersion.h" - -#include "UBSoftwareUpdate.h" - -#include "core/memcheck.h" - -UBSoftwareUpdate::UBSoftwareUpdate() -{ - // NOOP -} - -UBSoftwareUpdate::UBSoftwareUpdate(UBVersion& version, const QString &downloadUrl) - : mVersion(version) - , mDownloadUrl(downloadUrl) -{ - // NOOP -} - -UBSoftwareUpdate::~UBSoftwareUpdate() -{ - // NOOP -} - -UBVersion UBSoftwareUpdate::version() const -{ - return mVersion; -} - -QString UBSoftwareUpdate::downloadUrl() const -{ - return mDownloadUrl; -} - -bool UBSoftwareUpdate::operator==(const UBSoftwareUpdate &other) const -{ - return version() == other.version(); -} diff --git a/src/softwareupdate/UBSoftwareUpdate.h b/src/softwareupdate/UBSoftwareUpdate.h deleted file mode 100644 index 0cdf9f90..00000000 --- a/src/softwareupdate/UBSoftwareUpdate.h +++ /dev/null @@ -1,40 +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 3 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 UBSOFTWAREUPDATE_H_ -#define UBSOFTWAREUPDATE_H_ - -#include - -#include "frameworks/UBVersion.h" - -class UBSoftwareUpdate -{ - public: - UBSoftwareUpdate(); - UBSoftwareUpdate(UBVersion& version, const QString &downloadUrl); - virtual ~UBSoftwareUpdate(); - - UBVersion version() const; - QString downloadUrl() const; - - bool operator==(const UBSoftwareUpdate &other) const; - - private: - UBVersion mVersion; - QString mDownloadUrl; -}; - -#endif // UBSOFTWAREUPDATE_H_ diff --git a/src/softwareupdate/UBSoftwareUpdateController.cpp b/src/softwareupdate/UBSoftwareUpdateController.cpp deleted file mode 100644 index 6f651db1..00000000 --- a/src/softwareupdate/UBSoftwareUpdateController.cpp +++ /dev/null @@ -1,261 +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 3 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 "frameworks/UBVersion.h" -//#include "frameworks/UBFileSystemUtils.h" -//#include "frameworks/UBPlatformUtils.h" - -//#include "UBSoftwareUpdateController.h" -//#include "UBRssHandler.h" -//#include "UBSoftwareUpdate.h" - -//#include "core/UBApplication.h" -//#include "core/UBSettings.h" -//#include "core/UBSetting.h" - -//#include "board/UBBoardController.h" - -//#include "document/UBDocumentProxy.h" - -//#include "network/UBHttpGet.h" -//#include "network/UBServerXMLHttpRequest.h" -//#include "network/UBNetworkAccessManager.h" - -//const qreal UBSoftwareUpdateController::sProgressPercentageStep = 1; -//const int UBSoftwareUpdateController::sMinDisplayedDownloadedSizeInBytes = 2 * 1024 * 1024; - -//UBSoftwareUpdateController::UBSoftwareUpdateController(QObject *parent) -// : QObject(parent) -// , mHttp(0) -//{ -// // NOOP -//} - - -//UBSoftwareUpdateController::~UBSoftwareUpdateController() -//{ -// delete mHttp; -//} - - -//void UBSoftwareUpdateController::beginRssDownload(const QUrl &url) -//{ -// UBServerXMLHttpRequest * request = new UBServerXMLHttpRequest(UBNetworkAccessManager::defaultAccessManager()); -// connect(request, SIGNAL(finished(bool, const QByteArray &)), this, SLOT(rssDownloadFinished(bool, const QByteArray &))); - -// request->get(url); -//} - - -//void UBSoftwareUpdateController::beginInstallerDownload(const QUrl &url) -//{ -// delete mHttp; -// mHttp = new UBHttpGet(); - -// connect(mHttp, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(installerDownloadProgress(qint64, qint64))); -// connect(mHttp, SIGNAL(downloadFinished(bool, QUrl, QString, QByteArray, QPointF, QSize, bool)), -// this, SLOT(installerDownloadFinished(bool, QUrl, QString, QByteArray))); - -// mLastDisplayedProgress = 0; - -// UBApplication::showMessage(tr("Downloading software update (%1%)").arg(0), true); -// mHttp->get(url, QPointF(), QSize()); -//} - - -//void UBSoftwareUpdateController::rssDownloadFinished(bool success, const QByteArray &payload) -//{ -// if (!success) -// { -// qWarning() << "Failed to download RSS file."; -// failedToRetrieveSoftwareUpdateInfo(); -// return; -// } - -// parseRss(payload); -//} - - -//void UBSoftwareUpdateController::installerDownloadProgress(qint64 receivedBytes, qint64 bytesTotal) -//{ -// if (bytesTotal > sMinDisplayedDownloadedSizeInBytes) -// { -// qreal progress = ((qreal)(receivedBytes * 100) / bytesTotal); -// if (progress >= mLastDisplayedProgress + sProgressPercentageStep || receivedBytes == bytesTotal) -// { -// mLastDisplayedProgress = progress; -// UBApplication::showMessage(tr("Downloading software update (%1%)").arg(progress, 0, 'f', 0), true); -// } -// } -//} - - -//void UBSoftwareUpdateController::installerDownloadFinished(bool success, QUrl sourceUrl, QString contentTypeHeader, QByteArray data) -//{ -// Q_UNUSED(contentTypeHeader); - -// if (!success) -// { -// UBApplication::showMessage(tr("Downloading software update failed")); -// return; -// } - -// UBApplication::showMessage(tr("Download finished")); - -// QStringList urlParts = sourceUrl.toString().split("/"); -// QString installerFileName = urlParts.last(); -// QString tempDirPath = UBFileSystemUtils::createTempDir(UBFileSystemUtils::defaultTempDirName(), false); -// QString installerFilePath = tempDirPath + "/" + installerFileName; - -// QFile file(installerFilePath); - -// if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) -// { -// qCritical() << "Cannot open " << installerFilePath << " for writing..."; -// return; -// } - -// file.write(data); -// file.flush(); -// file.close(); - -// if (QMessageBox::question( -// QApplication::activeWindow(), -// tr("Software Update"), -// tr("Are you sure you want to install this new version of Uniboard now?\nThis session will close as soon as installation begins."), -// QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) -// { - -// UBDocumentProxy* document = UBApplication::boardController->activeDocument(); -// int sceneIndex = UBApplication::boardController->activeSceneIndex(); - -// if (document) -// { -// UBSettings::settings()->appLastSessionDocumentUUID->set(UBStringUtils::toCanonicalUuid(document->uuid())); -// UBSettings::settings()->appLastSessionPageIndex->set(sceneIndex); -// } - -// UBSettings::settings()->appIsInSoftwareUpdateProcess->set(true); - -// UBPlatformUtils::runInstaller(installerFilePath); - -// UBApplication::quit(); -// } -//} - - -//void UBSoftwareUpdateController::parseRss(const QByteArray &rssContent) -//{ -// UBRssHandler rssHandler; -// QXmlSimpleReader xmlReader; -// xmlReader.setContentHandler(&rssHandler); -// xmlReader.setErrorHandler(&rssHandler); -// QXmlInputSource source; -// source.setData(rssContent); - -// if (!xmlReader.parse(source)) -// { -// failedToRetrieveSoftwareUpdateInfo(); -// return; -// } - -// if (rssHandler.error().length() > 0) -// { -// qWarning() << "Failed to parse RSS file. Reason: " << rssHandler.error(); -// failedToRetrieveSoftwareUpdateInfo(); -// return; -// } - -// if (rssHandler.softwareUpdates().isEmpty()) -// { -// qWarning() << "RSS file does not contain software update info."; -// failedToRetrieveSoftwareUpdateInfo(); -// return; -// } - -// UBVersion installedVersion(qApp->applicationVersion()); -// if (!installedVersion.isValid()) -// { -// qWarning() << "Failed to parse installed version format: " << qApp->applicationVersion(); -// failedToRetrieveSoftwareUpdateInfo(); -// return; -// } - -// QList softwareUpdates = rssHandler.softwareUpdates(); -// const UBSoftwareUpdate *mostRecentSoftwareUpdate = searchForMoreRecentAndAsStableSoftwareUpdate(installedVersion, softwareUpdates); - -// if (mostRecentSoftwareUpdate) -// { -// emit softwareUpdateAvailable(installedVersion, *mostRecentSoftwareUpdate); -// } -// else -// { -// emit noSoftwareUpdateAvailable(); -// } -//} - - -//const UBSoftwareUpdate* UBSoftwareUpdateController::searchForMoreRecentAndAsStableSoftwareUpdate(const UBVersion &installedVersion, const QList &softwareUpdates) -//{ -// const UBSoftwareUpdate *mostRecentSoftwareUpdate = 0; -// foreach (const UBSoftwareUpdate *softwareUpdate, softwareUpdates) -// { -// bool moreRecentAndAsStable = false; - -// if (Alpha == installedVersion.releaseStage()) -// { -// if (installedVersion < softwareUpdate->version() && -// installedVersion.platformNumber() == softwareUpdate->version().platformNumber()) -// { -// moreRecentAndAsStable = true; -// } -// } -// else if (Beta == installedVersion.releaseStage()) -// { -// if (Alpha != softwareUpdate->version().releaseStage() && -// installedVersion < softwareUpdate->version() && -// installedVersion.platformNumber() == softwareUpdate->version().platformNumber()) -// { -// moreRecentAndAsStable = true; -// } -// } -// else -// { -// if (ReleaseCandidate == softwareUpdate->version().releaseStage() && -// installedVersion < softwareUpdate->version() && -// installedVersion.platformNumber() == softwareUpdate->version().platformNumber()) -// { -// moreRecentAndAsStable = true; -// } -// } - -// if (moreRecentAndAsStable) -// { -// if (mostRecentSoftwareUpdate) -// { -// if (mostRecentSoftwareUpdate->version() < softwareUpdate->version()) -// { -// mostRecentSoftwareUpdate = softwareUpdate; -// } -// } -// else -// { -// mostRecentSoftwareUpdate = softwareUpdate; -// } -// } -// } - -// return mostRecentSoftwareUpdate; -//} diff --git a/src/softwareupdate/UBSoftwareUpdateController.h b/src/softwareupdate/UBSoftwareUpdateController.h deleted file mode 100644 index 306efe4c..00000000 --- a/src/softwareupdate/UBSoftwareUpdateController.h +++ /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 3 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 UBSOFTWAREUPDATECONTROLLER_H_ -//#define UBSOFTWAREUPDATECONTROLLER_H_ - -//#include -//#include - -//class UBVersion; -//class UBSoftwareUpdate; -//class UBHttpGet; - -//class UBSoftwareUpdateController : public QObject -//{ -// Q_OBJECT; - -// public: -// UBSoftwareUpdateController(QObject *parent = 0); -// virtual ~UBSoftwareUpdateController(); - -// void beginRssDownload(const QUrl &url); -// void beginInstallerDownload(const QUrl &url); - -// static const UBSoftwareUpdate* searchForMoreRecentAndAsStableSoftwareUpdate(const UBVersion &installedVersion, -// const QList &softwareUpdates); - -// signals: -// void softwareUpdateAvailable(const UBVersion &installedVersion, const UBSoftwareUpdate &softwareUpdate); -// void noSoftwareUpdateAvailable(); -// void failedToRetrieveSoftwareUpdateInfo(); - -// private slots: -// void rssDownloadFinished(bool success, const QByteArray &payload); -// void installerDownloadProgress(qint64 receivedBytes, qint64 bytesTotal); -// void installerDownloadFinished(bool success, QUrl sourceUrl, QString header, QByteArray data); - -// private: -// // Helpers -// void parseRss(const QByteArray &rssContent); - -// UBHttpGet *mHttp; -// qreal mLastDisplayedProgress; - -// static const int sMinDisplayedDownloadedSizeInBytes; -// static const qreal sProgressPercentageStep; -//}; - -//#endif // UBSOFTWAREUPDATECONTROLLER_H_ diff --git a/src/softwareupdate/softwareupdate.pri b/src/softwareupdate/softwareupdate.pri deleted file mode 100644 index 3e496778..00000000 --- a/src/softwareupdate/softwareupdate.pri +++ /dev/null @@ -1,8 +0,0 @@ - -HEADERS += src/softwareupdate/UBSoftwareUpdateController.h \ - src/softwareupdate/UBRssHandler.h \ - src/softwareupdate/UBSoftwareUpdate.h - -SOURCES += src/softwareupdate/UBSoftwareUpdateController.cpp \ - src/softwareupdate/UBRssHandler.cpp \ - src/softwareupdate/UBSoftwareUpdate.cpp \ No newline at end of file From 4a1e71d3c39ef657a99f3e48b4c1266758da6f5a Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 27 Apr 2012 12:09:52 +0200 Subject: [PATCH 02/42] before handlig the page number --- src/adaptors/UBCFFSubsetAdaptor.cpp | 2 + src/board/UBBoardController.cpp | 9 ++++ src/board/UBBoardController.h | 2 + src/board/UBBoardPaletteManager.cpp | 12 ++--- src/core/UBApplicationController.cpp | 3 -- src/core/UBSettings.cpp | 2 + src/core/UBSettings.h | 2 + src/gui/UBTeacherGuideWidget.cpp | 76 ++++++++++++++++------------ src/gui/UBTeacherGuideWidget.h | 9 ++-- 9 files changed, 71 insertions(+), 46 deletions(-) diff --git a/src/adaptors/UBCFFSubsetAdaptor.cpp b/src/adaptors/UBCFFSubsetAdaptor.cpp index 19e8a016..1dff442d 100644 --- a/src/adaptors/UBCFFSubsetAdaptor.cpp +++ b/src/adaptors/UBCFFSubsetAdaptor.cpp @@ -17,7 +17,9 @@ #include #include "core/UBPersistenceManager.h" + #include "document/UBDocumentProxy.h" + #include "domain/UBItem.h" #include "domain/UBGraphicsPolygonItem.h" #include "domain/UBGraphicsStroke.h" diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index d3faba2b..2f03f66f 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -65,6 +65,8 @@ #include "UBBoardPaletteManager.h" +#include "core/UBSettings.h" + #include "core/memcheck.h" //#include @@ -147,6 +149,13 @@ UBBoardController::~UBBoardController() } +int UBBoardController::currentPage() +{ + if(!UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) + return mActiveSceneIndex; + return mActiveSceneIndex + 1; +} + void UBBoardController::setupViews() { mControlContainer = new QWidget(mMainWindow->centralWidget()); diff --git a/src/board/UBBoardController.h b/src/board/UBBoardController.h index d5d6bee1..4b293c68 100644 --- a/src/board/UBBoardController.h +++ b/src/board/UBBoardController.h @@ -57,6 +57,8 @@ class UBBoardController : public QObject QRectF controlGeometry(); void closing(); + int currentPage(); + UBDocumentProxy* activeDocument() { return mActiveDocument; diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index f21c089b..1eeee92c 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -129,25 +129,25 @@ void UBBoardPaletteManager::setupDockPaletteWidgets() //------------------------------------------------// // Create the widgets for the dock palettes - - mpPageNavigWidget = new UBPageNavigationWidget(); - mpLibWidget = new UBLibWidget(); mpCachePropWidget = new UBCachePropertiesWidget(); mpDownloadWidget = new UBDockDownloadWidget(); - mpTeacherGuideWidget = new UBDockTeacherGuideWidget(); // Add the dock palettes mLeftPalette = new UBLeftPalette(mContainer); // LEFT palette widgets + mpPageNavigWidget = new UBPageNavigationWidget(); mLeftPalette->registerWidget(mpPageNavigWidget); mLeftPalette->addTab(mpPageNavigWidget); - mLeftPalette->registerWidget(mpTeacherGuideWidget); - mLeftPalette->addTab(mpTeacherGuideWidget); + if(UBSettings::settings()->teacherGuidePageZeroActivated || UBSettings::settings()->teacherGuideLessonPagesActivated){ + mpTeacherGuideWidget = new UBDockTeacherGuideWidget(); + mLeftPalette->registerWidget(mpTeacherGuideWidget); + mLeftPalette->addTab(mpTeacherGuideWidget); + } mLeftPalette->connectSignals(); diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index 81847ad5..328fe88c 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -24,9 +24,6 @@ #include "core/UBDocumentManager.h" #include "core/UBDisplayManager.h" -#include "softwareupdate/UBSoftwareUpdateController.h" -#include "softwareupdate/UBSoftwareUpdate.h" - #include "board/UBBoardView.h" #include "board/UBBoardController.h" #include "board/UBBoardPaletteManager.h" diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 28a2a8d5..541a6ca3 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -381,6 +381,8 @@ void UBSettings::init() angleTolerance = new UBSetting(this, "App", "AngleTolerance", 4); historyLimit = new UBSetting(this, "Web", "HistoryLimit", 15); + teacherGuidePageZeroActivated = new UBSetting(this,"DockPalette","TeacherGuideActivatePageZero",true); + teacherGuideLessonPagesActivated = new UBSetting(this,"DockPalette","TeacherGuideActvateLessonPages",true); } diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index 2bb7262b..d19b1378 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -330,6 +330,8 @@ class UBSettings : public QObject UBSetting* angleTolerance; UBSetting* historyLimit; + UBSetting* teacherGuidePageZeroActivated; + UBSetting* teacherGuideLessonPagesActivated; public slots: diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 9fc0fdcd..c1ab5023 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -25,6 +25,7 @@ #include "core/UBApplication.h" #include "core/UBPersistenceManager.h" +#include "core/UBSettings.h" #include "globals/UBGlobals.h" @@ -146,7 +147,7 @@ void UBTeacherGuideEditionWidget::showEvent(QShowEvent* event) void UBTeacherGuideEditionWidget::onActiveSceneChanged() { cleanData(); - mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->activeSceneIndex() + 1)); + mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->currentPage())); } void UBTeacherGuideEditionWidget::cleanData() @@ -359,7 +360,7 @@ void UBTeacherGuidePresentationWidget::cleanData() void UBTeacherGuidePresentationWidget::onActiveSceneChanged() { cleanData(); - mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->activeSceneIndex() + 1)); + mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->currentPage())); } void UBTeacherGuidePresentationWidget::createMediaButtonItem() @@ -459,7 +460,7 @@ void UBTeacherGuidePresentationWidget::onAddItemClicked(QTreeWidgetItem* widget, /*************************************************************************** * class UBTeacherGuidePageZeroEditionWidget * ***************************************************************************/ -UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget* parent, const char* name): QWidget(parent) +UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, const char* name): QWidget(parent) , mpLayout(NULL) , mpButtonTitleLayout(NULL) , mpModePushButton(NULL) @@ -626,7 +627,7 @@ UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget fillComboBoxes(); } -UBTeacherGuidePageZeroEditionWidget::~UBTeacherGuidePageZeroEditionWidget() +UBTeacherGuidePageZeroWidget::~UBTeacherGuidePageZeroWidget() { DELETEPTR(mpPageNumberLabel); DELETEPTR(mpSessionTitle); @@ -659,7 +660,7 @@ UBTeacherGuidePageZeroEditionWidget::~UBTeacherGuidePageZeroEditionWidget() DELETEPTR(mpLayout); } -void UBTeacherGuidePageZeroEditionWidget::fillComboBoxes() +void UBTeacherGuidePageZeroWidget::fillComboBoxes() { QString parametersConfigFilePath = UBSettings::settings()->applicationCustomizationDirectory() + "/teacherGuide/indexingParameters.xml"; QFile parametersFile(parametersConfigFilePath); @@ -704,7 +705,7 @@ void UBTeacherGuidePageZeroEditionWidget::fillComboBoxes() mpLicenceBox->addItems(licences); } -void UBTeacherGuidePageZeroEditionWidget::onSchoolLevelChanged(QString schoolLevel) +void UBTeacherGuidePageZeroWidget::onSchoolLevelChanged(QString schoolLevel) { QStringList subjects = mSubjects.value(mGradeLevelsMap.value(schoolLevel)); mpSchoolBranchBox->clear(); @@ -719,19 +720,19 @@ void UBTeacherGuidePageZeroEditionWidget::onSchoolLevelChanged(QString schoolLev } } -void UBTeacherGuidePageZeroEditionWidget::onActiveSceneChanged() +void UBTeacherGuidePageZeroWidget::onActiveSceneChanged() { UBDocumentProxy* documentProxy = UBApplication::documentController ? UBApplication::documentController->getCurrentDocument() : 0; - if(UBApplication::documentController && UBApplication::boardController->activeSceneIndex() == 0){ -// QDateTime creationDate = documentProxy->documentDate(); -// mpCreationLabel->setText(tr("Created the:") + creationDate.toString(Qt::SystemLocaleShortDate)); -// QDateTime updatedDate = documentProxy->lastUpdate(); -// mpLastModifiedLabel->setText(tr("Updated the:") + updatedDate.toString(Qt::SystemLocaleShortDate)); + if(UBApplication::documentController && UBApplication::boardController->currentPage() == 0){ + QDateTime creationDate = documentProxy->documentDate(); + mpCreationLabel->setText(tr("Created the:") + creationDate.toString(Qt::SystemLocaleShortDate)); + QDateTime updatedDate = documentProxy->lastUpdate(); + mpLastModifiedLabel->setText(tr("Updated the:") + updatedDate.toString(Qt::SystemLocaleShortDate)); } } -void UBTeacherGuidePageZeroEditionWidget::switchToMode(tUBTGZeroPageMode mode) +void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) { if(mode == tUBTGZeroPageMode_EDITION){ mpModePushButton->hide(); @@ -767,10 +768,8 @@ void UBTeacherGuidePageZeroEditionWidget::switchToMode(tUBTGZeroPageMode mode) mpLicenceValueLabel->setText(mpLicenceBox->currentText()); QStringList licenceIconList; licenceIconList << ":images/licenses/ccby.png" << ":images/licenses/ccbynd.png" << ":images/licenses/ccbysa.png" << ":images/licenses/ccbync.png" << ":images/licenses/ccbyncnd.png" << ":images/licenses/ccbyncsa.png"; - int licenceBoxCurrentIndex = mpLicenceBox->currentIndex(); - // -1 is return if there is no values on the box - if(licenceBoxCurrentIndex > 0 && licenceBoxCurrentIndex < licenceIconList.count()){ - mpLicenceIcon->setPixmap(licenceIconList.at(licenceBoxCurrentIndex)); + if(mpLicenceBox->currentIndex() < 6){ + mpLicenceIcon->setPixmap(licenceIconList.at(mpLicenceBox->currentIndex())); mpLicenceIcon->show(); } mpLicenceValueLabel->show(); @@ -778,7 +777,7 @@ void UBTeacherGuidePageZeroEditionWidget::switchToMode(tUBTGZeroPageMode mode) } } -QVector UBTeacherGuidePageZeroEditionWidget::getData() +QVector UBTeacherGuidePageZeroWidget::getData() { QVectorresult; tUBGEElementNode* elementNode = new tUBGEElementNode(); @@ -837,24 +836,25 @@ QVector UBTeacherGuidePageZeroEditionWidget::getData() * class UBTeacherGuideWidget * ***************************************************************************/ UBTeacherGuideWidget::UBTeacherGuideWidget(QWidget* parent, const char* name): QStackedWidget(parent) - , mpPageZeroEditonWidget(NULL) + , mpPageZeroWidget(NULL) , mpEditionWidget(NULL) , mpPresentationWidget(NULL) { setObjectName(name); - - mpPageZeroEditonWidget = new UBTeacherGuidePageZeroEditionWidget(this); - addWidget(mpPageZeroEditonWidget); - setCurrentWidget(mpPageZeroEditonWidget); - // mpEditionWidget = new UBTeacherGuideEditionWidget(this); -// addWidget(mpEditionWidget); -// mpPresentationWidget = new UBTeacherGuidePresentationWidget(this); -// addWidget(mpPresentationWidget); -// setCurrentWidget(mpPresentationWidget); - + if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()){ + mpPageZeroWidget = new UBTeacherGuidePageZeroWidget(this); + addWidget(mpPageZeroWidget); + } + if(UBSettings::settings()->teacherGuideLessonPagesActivated->get().toBool()){ + mpEditionWidget = new UBTeacherGuideEditionWidget(this); + addWidget(mpEditionWidget); + mpPresentationWidget = new UBTeacherGuidePresentationWidget(this); + addWidget(mpPresentationWidget); + } connect(UBApplication::boardController->controlView(),SIGNAL(clickOnBoard()),this,SLOT(showPresentationMode())); connectToStylusPalette(); + connect(UBApplication::boardController,SIGNAL(activeSceneChanged()),this,SLOT(onActiveSceneChanged())); } @@ -864,19 +864,29 @@ UBTeacherGuideWidget::~UBTeacherGuideWidget() DELETEPTR(mpPresentationWidget); } + +void UBTeacherGuideWidget::onActiveSceneChanged() +{ + if(UBApplication::boardController->currentPage() == 0) + setCurrentWidget(mpPageZeroWidget); + else + setCurrentWidget(mpPresentationWidget); + +} + void UBTeacherGuideWidget::connectToStylusPalette() { if(UBApplication::boardController->paletteManager()) connect(UBApplication::boardController->paletteManager()->stylusPalette(),SIGNAL(itemOnActionPaletteChanged()),this,SLOT(showPresentationMode())); else - QTimer::singleShot(500,this,SLOT(connectToStylusPalette())); + QTimer::singleShot(100,this,SLOT(connectToStylusPalette())); } void UBTeacherGuideWidget::showPresentationMode() { - if(currentWidget()==mpPageZeroEditonWidget){ - mCurrentData = mpPageZeroEditonWidget->getData(); - mpPageZeroEditonWidget->switchToMode(tUBTGZeroPageMode_PRESENTATION); + if(currentWidget()==mpPageZeroWidget){ + mCurrentData = mpPageZeroWidget->getData(); + mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_PRESENTATION); } else if(currentWidget()==mpEditionWidget){ mCurrentData = mpEditionWidget->getData(); diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 20d7e395..cc1e62f3 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -105,13 +105,13 @@ private: /*************************************************************************** * class UBTeacherGuidePageZeroPresentationWidget * ***************************************************************************/ -class UBTeacherGuidePageZeroEditionWidget : public QWidget +class UBTeacherGuidePageZeroWidget : public QWidget { Q_OBJECT public: - explicit UBTeacherGuidePageZeroEditionWidget(QWidget* parent, const char* name = "UBTeacherGuidePageZeroEditionWidget"); - ~UBTeacherGuidePageZeroEditionWidget(); + explicit UBTeacherGuidePageZeroWidget(QWidget* parent, const char* name = "UBTeacherGuidePageZeroEditionWidget"); + ~UBTeacherGuidePageZeroWidget(); QVector getData(); @@ -185,9 +185,10 @@ public slots: void changeMode(); void showPresentationMode(); void connectToStylusPalette(); + void onActiveSceneChanged(); private: - UBTeacherGuidePageZeroEditionWidget* mpPageZeroEditonWidget; + UBTeacherGuidePageZeroWidget* mpPageZeroWidget; UBTeacherGuideEditionWidget* mpEditionWidget; UBTeacherGuidePresentationWidget* mpPresentationWidget; QVectormCurrentData; From b98bd2d46f9504ac5574eb651e06aa3f2676ccc3 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 2 May 2012 10:07:10 +0200 Subject: [PATCH 03/42] fixed some issue on gui --- src/gui/UBTeacherGuideWidget.cpp | 73 +++++++++++++++--- src/gui/UBTeacherGuideWidget.h | 5 +- src/gui/UBTeacherGuideWidgetsTools.cpp | 101 ++++++++++++++++++++++--- src/gui/UBTeacherGuideWidgetsTools.h | 20 ++++- 4 files changed, 174 insertions(+), 25 deletions(-) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index c1ab5023..51cd25b6 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -701,8 +701,11 @@ void UBTeacherGuidePageZeroWidget::fillComboBoxes() QStringList licences; licences << tr("Attribution CC BY") << tr("Attribution-NoDerivs CC BY-ND") << tr("Attribution-ShareAlike CC BY-SA") << tr("Attribution-NonCommercial CC BY-NC") << tr("Attribution-NonCommercial-NoDerivs CC BY-NC-ND") << tr("Attribution-NonCommercial-ShareAlike CC BY-NC-SA") << tr("Public domain") << tr("Copyright"); - mpLicenceBox->addItems(licences); + QStringList licenceIconList; + licenceIconList << ":images/licenses/ccby.png" << ":images/licenses/ccbynd.png" << ":images/licenses/ccbysa.png" << ":images/licenses/ccbync.png" << ":images/licenses/ccbyncnd.png" << ":images/licenses/ccbyncsa.png"; + for(int i = 0; i < licenceIconList.count(); i+=1) + mpLicenceBox->setItemData(i,licenceIconList.at(i)); } void UBTeacherGuidePageZeroWidget::onSchoolLevelChanged(QString schoolLevel) @@ -722,21 +725,64 @@ void UBTeacherGuidePageZeroWidget::onSchoolLevelChanged(QString schoolLevel) void UBTeacherGuidePageZeroWidget::onActiveSceneChanged() { - UBDocumentProxy* documentProxy = UBApplication::documentController ? UBApplication::documentController->getCurrentDocument() : 0; - if(UBApplication::documentController && UBApplication::boardController->currentPage() == 0){ + UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); + if(documentProxy && UBApplication::boardController->currentPage() == 0){ QDateTime creationDate = documentProxy->documentDate(); - mpCreationLabel->setText(tr("Created the:") + creationDate.toString(Qt::SystemLocaleShortDate)); + mpCreationLabel->setText(tr("Created the: ") + creationDate.toString(Qt::SystemLocaleShortDate)); QDateTime updatedDate = documentProxy->lastUpdate(); - mpLastModifiedLabel->setText(tr("Updated the:") + updatedDate.toString(Qt::SystemLocaleShortDate)); + mpLastModifiedLabel->setText(tr("Updated the: ") + updatedDate.toString(Qt::SystemLocaleShortDate)); + persistData(); + loadData(); } } +void UBTeacherGuidePageZeroWidget::hideEvent ( QHideEvent * event ) +{ + persistData(); + QWidget::hideEvent(event); +} + +void UBTeacherGuidePageZeroWidget::loadData() +{ + + UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); + mpSessionTitle->setText(documentProxy->metaData(UBSettings::sessionTitle).toString()); + mpAuthors->setText(documentProxy->metaData(UBSettings::sessionAuthors).toString()); + mpGoals->setText(documentProxy->metaData(UBSettings::sessionGoals).toString()); + mpKeywords->setText(documentProxy->metaData(UBSettings::sessionKeywords).toString()); + + int currentIndex = mpSchoolLevelBox->findText(documentProxy->metaData(UBSettings::sessionGradeLevel).toString()); + mpSchoolLevelBox->setCurrentIndex((currentIndex!=-1) ? currentIndex : 0); + + currentIndex = mpSchoolBranchBox->findText(documentProxy->metaData(UBSettings::sessionBranch).toString()); + mpSchoolBranchBox->setCurrentIndex((currentIndex!=-1) ? currentIndex : 0); + + currentIndex = mpSchoolTypeBox->findText(documentProxy->metaData(UBSettings::sessionType).toString()); + mpSchoolTypeBox->setCurrentIndex((currentIndex!=-1) ? currentIndex : 0); + + currentIndex = mpLicenceBox->findText(documentProxy->metaData(UBSettings::sessionLicence).toString()); + mpLicenceBox->setCurrentIndex((currentIndex!=-1) ? currentIndex : 0); +} + +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()); +} void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) { if(mode == tUBTGZeroPageMode_EDITION){ mpModePushButton->hide(); mpSessionTitle->setReadOnly(false); + mpSessionTitle->setObjectName("UBTGEditionModeSessionTitle"); mpAuthors->setReadOnly(false); mpGoals->setReadOnly(false); mpKeywords->setReadOnly(false); @@ -753,6 +799,7 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) else{ mpModePushButton->show(); mpSessionTitle->setReadOnly(true); + mpSessionTitle->setObjectName("UBTGPresentationSessionTitle"); mpAuthors->setReadOnly(true); mpGoals->setReadOnly(true); mpKeywords->setReadOnly(true); @@ -766,14 +813,14 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) mpSchoolTypeValueLabel->show(); mpSchoolTypeBox->hide(); mpLicenceValueLabel->setText(mpLicenceBox->currentText()); - QStringList licenceIconList; - licenceIconList << ":images/licenses/ccby.png" << ":images/licenses/ccbynd.png" << ":images/licenses/ccbysa.png" << ":images/licenses/ccbync.png" << ":images/licenses/ccbyncnd.png" << ":images/licenses/ccbyncsa.png"; - if(mpLicenceBox->currentIndex() < 6){ - mpLicenceIcon->setPixmap(licenceIconList.at(mpLicenceBox->currentIndex())); + QString licenceIconPath = mpLicenceBox->itemData(mpLicenceBox->currentIndex()).toString(); + if(!licenceIconPath.isEmpty()){ + mpLicenceIcon->setPixmap(QPixmap(licenceIconPath)); mpLicenceIcon->show(); } mpLicenceValueLabel->show(); mpLicenceBox->hide(); + persistData(); } } @@ -860,6 +907,7 @@ UBTeacherGuideWidget::UBTeacherGuideWidget(QWidget* parent, const char* name): Q UBTeacherGuideWidget::~UBTeacherGuideWidget() { + DELETEPTR(mpPageZeroWidget); DELETEPTR(mpEditionWidget); DELETEPTR(mpPresentationWidget); } @@ -867,10 +915,11 @@ UBTeacherGuideWidget::~UBTeacherGuideWidget() void UBTeacherGuideWidget::onActiveSceneChanged() { - if(UBApplication::boardController->currentPage() == 0) + if(UBApplication::boardController->currentPage() == 0){ setCurrentWidget(mpPageZeroWidget); - else - setCurrentWidget(mpPresentationWidget); + mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_EDITION); + }else + setCurrentWidget(mpEditionWidget); } diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index cc1e62f3..2e98b429 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -103,7 +103,7 @@ private: }; /*************************************************************************** - * class UBTeacherGuidePageZeroPresentationWidget * + * class UBTeacherGuidePageZeroWidget * ***************************************************************************/ class UBTeacherGuidePageZeroWidget : public QWidget { @@ -122,6 +122,8 @@ public slots: private: void fillComboBoxes(); + void loadData(); + void hideEvent(QHideEvent* event); QVBoxLayout* mpLayout; QHBoxLayout* mpButtonTitleLayout; @@ -168,6 +170,7 @@ private: private slots: void onSchoolLevelChanged(QString schoolLevel); + void persistData(); }; /*************************************************************************** diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index 73b89276..2f2dbba0 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -21,13 +21,15 @@ #include #include #include -#include -#include #include #include "UBTeacherGuideWidgetsTools.h" #include "UBTGWidgetTreeDelegate.h" +#include "core/UBPersistenceManager.h" + +#include "domain/UBW3CWidget.h" + #include "globals/UBGlobals.h" #include "frameworks/UBFileSystemUtils.h" @@ -110,7 +112,6 @@ UBTGAdaptableText::UBTGAdaptableText(QTreeWidgetItem* widget, QWidget* parent, c connect(this,SIGNAL(textChanged()),this,SLOT(onTextChanged())); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setMinimumHeight(mMinimumHeight); } void UBTGAdaptableText::setPlaceHolderText(QString text) @@ -126,6 +127,13 @@ void UBTGAdaptableText::setPlaceHolderText(QString text) void UBTGAdaptableText::keyPressEvent(QKeyEvent* e) { + if(isReadOnly()){ + // this is important if you set a placeholder. In this case even if the text field is readonly the + // keypressed event came here. So if you don't ignore it you'll have a flick on the text zone + e->ignore(); + return; + } + if(toPlainText() == mPlaceHolderText){ setTextColor(QColor(Qt::black)); setPlainText(""); @@ -161,11 +169,18 @@ QString UBTGAdaptableText::text() void UBTGAdaptableText::onTextChanged() { + qreal documentSize = document()->size().height(); + + if(height() == documentSize + mBottomMargin) + return; mIsUpdatingSize = true; - if(document()->size().height() < mMinimumHeight) + + + if(documentSize < mMinimumHeight) setFixedHeight(mMinimumHeight); else - setFixedHeight(document()->size().height()+mBottomMargin); + setFixedHeight(documentSize+mBottomMargin); + updateGeometry(); //to trig the widget item to resize it if(mpTreeWidgetItem){ @@ -197,7 +212,51 @@ void UBTGAdaptableText::bottomMargin(int newValue) void UBTGAdaptableText::resizeEvent(QResizeEvent* e) { QTextEdit::resizeEvent(e); - QTimer::singleShot(100,this,SLOT(onTextChanged())); + //QTimer::singleShot(100,this,SLOT(onTextChanged())); +} + +/*************************************************************************** + * class UBTGDraggableWeb * + ***************************************************************************/ +UBDraggableWeb::UBDraggableWeb(QString& relativePath, QWidget* parent): QWebView(parent) + , mRelativePath(relativePath) + , mDragStartPosition(QPoint(-1,-1)) + , mDragStarted(false) + +{ + //NOOP +} + +void UBDraggableWeb::mousePressEvent(QMouseEvent* event) +{ + mDragStartPosition = event->pos(); + mDragStarted = true; + QWebView::mousePressEvent(event); +} + +void UBDraggableWeb::mouseReleaseEvent(QMouseEvent* event) +{ + mDragStarted = false; + QWebView::mouseReleaseEvent(event); +} + +void UBDraggableWeb::mouseMoveEvent(QMouseEvent* event) +{ + if(mDragStarted && (event->pos() - mDragStartPosition).manhattanLength() > QApplication::startDragDistance()){ + QDrag *drag = new QDrag(this); + QMimeData *mimeData = new QMimeData; + QList urlList; + urlList << QUrl(mRelativePath); + mimeData->setUrls(urlList); + drag->setMimeData(mimeData); + + drag->exec(); + event->accept(); + mDragStarted = false; + } + else + QWebView::mouseMoveEvent(event); + } /*************************************************************************** @@ -259,6 +318,22 @@ UBTGMediaWidget::~UBTGMediaWidget() DELETEPTR(mpWorkWidget); } +void UBTGMediaWidget::hideEvent(QHideEvent* event) +{ + if(mpWebView) + mpWebView->page()->mainFrame()->setContent(UBW3CWidget::freezedWidgetPage().toAscii()); + QWidget::hideEvent(event); +} + +void UBTGMediaWidget::showEvent(QShowEvent* event) +{ + QWidget::showEvent(event); + if(mpWebView){ + qDebug() << mRelativePath; + mpWebView->load(QUrl(mRelativePath + "/index.htm")); + } +} + tUBGEElementNode* UBTGMediaWidget::saveData() { if(!mpTitle) @@ -279,8 +354,8 @@ void UBTGMediaWidget::dragEnterEvent(QDragEnterEvent *event) void UBTGMediaWidget::createWorkWidget(QString& path) { QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(path); - qDebug() << mimeType; bool setMedia = true; + mRelativePath = path; if(mimeType.contains("audio") || mimeType.contains("video")){ mMediaType = mimeType.contains("audio")? "audio":"movie"; mpMediaWidget = new UBMediaWidget(mimeType.contains("audio")?eMediaType_Audio:eMediaType_Video); @@ -296,7 +371,11 @@ void UBTGMediaWidget::createWorkWidget(QString& path) } else if(mimeType.contains("application")){ mMediaType = "w3c"; - mpWebView = new QWebView(0); + if(!mIsPresentationMode){ + QDir baseW3CDirectory("/home/claudio"); + mRelativePath = UBW3CWidget::createNPAPIWrapperInDir(path,baseW3CDirectory,mimeType,QSize(100,100),"flashahaha"); + } + mpWebView = new UBDraggableWeb(mRelativePath); mpWebView->setAcceptDrops(false); mpWebView->settings()->setAttribute(QWebSettings::JavaEnabled, true); mpWebView->settings()->setAttribute(QWebSettings::PluginsEnabled, true); @@ -305,8 +384,8 @@ void UBTGMediaWidget::createWorkWidget(QString& path) mpWebView->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); mpWebView->settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); mpWebView->settings()->setAttribute(QWebSettings::DnsPrefetchEnabled, true); - mpWebView->load(QUrl(path)); - mpWebView->show(); + + mpWebView->load(QUrl(mRelativePath+"/index.htm")); } else{ qDebug() << "createWorkWidget mime type not handled" << mimeType; @@ -314,7 +393,6 @@ void UBTGMediaWidget::createWorkWidget(QString& path) } if(setMedia){ - mRelativePath = path; setAcceptDrops(false); mpWorkWidget = new QWidget(this); mpLayout = new QVBoxLayout(mpWorkWidget); @@ -336,6 +414,7 @@ void UBTGMediaWidget::createWorkWidget(QString& path) mpWebView->setMaximumHeight(mpTreeWidgetItem->treeWidget()->size().width()); mpWebView->setParent(mpWorkWidget); mpLayout->addWidget(mpWebView); + mpWebView->show(); } mpWorkWidget->setLayout(mpLayout); addWidget(mpWorkWidget); diff --git a/src/gui/UBTeacherGuideWidgetsTools.h b/src/gui/UBTeacherGuideWidgetsTools.h index fe1248d8..c73d15ff 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.h +++ b/src/gui/UBTeacherGuideWidgetsTools.h @@ -111,6 +111,22 @@ private: }; +class UBDraggableWeb : public QWebView +{ + Q_OBJECT +public: + explicit UBDraggableWeb(QString& relativePath, QWidget* parent = 0); + +private: + void mousePressEvent(QMouseEvent* event); + void mouseMoveEvent(QMouseEvent* event); + void mouseReleaseEvent(QMouseEvent* event); + + QString mRelativePath; + QPoint mDragStartPosition; + bool mDragStarted; +}; + class UBTGMediaWidget : public QStackedWidget , public iUBTGSavableData { Q_OBJECT @@ -124,6 +140,8 @@ protected: void dragEnterEvent(QDragEnterEvent* event); void dropEvent(QDropEvent* event); void mousePressEvent(QMouseEvent* event); + void hideEvent(QHideEvent* event); + void showEvent(QShowEvent* event); private: void parseMimeData(const QMimeData* pMimeData); @@ -137,7 +155,7 @@ private: UBTGAdaptableText* mpTitle; QLabel* mpMediaLabelWidget; UBMediaWidget* mpMediaWidget; - QWebView* mpWebView; + UBDraggableWeb* mpWebView; QString mRelativePath; bool mIsPresentationMode; QString mMediaType; From 6cafdcfcff30fd4ec73adea7bf823c42bac808c9 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 2 May 2012 21:25:14 +0200 Subject: [PATCH 04/42] on stop the video widget show a screen shot instead of the phonon::mediawidget --- src/customWidgets/UBMediaWidget.cpp | 98 ++++++++++++++++------------- src/customWidgets/UBMediaWidget.h | 12 ++-- 2 files changed, 59 insertions(+), 51 deletions(-) diff --git a/src/customWidgets/UBMediaWidget.cpp b/src/customWidgets/UBMediaWidget.cpp index cbc0b842..d192109b 100644 --- a/src/customWidgets/UBMediaWidget.cpp +++ b/src/customWidgets/UBMediaWidget.cpp @@ -26,6 +26,8 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name) , mpMediaObject(NULL) , mpVideoWidget(NULL) , mpAudioOutput(NULL) + , mpLayout(NULL) + , mpSeekerLayout(NULL) , mpPlayStopButton(NULL) , mpPauseButton(NULL) , mpSlider(NULL) @@ -33,15 +35,16 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name) , mGeneratingThumbnail(false) , mBorder(5) , mpMediaContainer(NULL) + , mMediaLayout(NULL) , mpCover(NULL) -// , mpVideoStackedWidget(NULL) -// , mpSnapshotVideoWidget(NULL) + , mpSnapshotVideoWidget(NULL) { SET_STYLE_SHEET(); addAction(eAction_Close); mType = type; - setLayout(&mLayout); + mpLayout = new QVBoxLayout(this); + setLayout(mpLayout); mpPlayStopButton = new UBMediaButton(this); mpPlayStopButton->setPixmap(QPixmap(":images/play.svg")); @@ -53,10 +56,11 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name) mpSlider->setMinimum(0); mpSlider->setMaximum(0); - mSeekerLayout.addWidget(mpPlayStopButton, 0); - mSeekerLayout.addWidget(mpPauseButton, 0); - mSeekerLayout.addWidget(mpSlider, 1); - mSeekerLayout.setContentsMargins(0, 0, 0, 0); + mpSeekerLayout = new QHBoxLayout(this); + mpSeekerLayout->addWidget(mpPlayStopButton, 0); + mpSeekerLayout->addWidget(mpPauseButton, 0); + mpSeekerLayout->addWidget(mpSlider, 1); + mpSeekerLayout->setContentsMargins(0, 0, 0, 0); connect(mpPlayStopButton, SIGNAL(clicked()), this, SLOT(onPlayStopClicked())); connect(mpPauseButton, SIGNAL(clicked()), this, SLOT(onPauseClicked())); @@ -74,10 +78,13 @@ UBMediaWidget::~UBMediaWidget() DELETEPTR(mpPlayStopButton); DELETEPTR(mpAudioOutput); DELETEPTR(mpVideoWidget); -// DELETEPTR(mpVideoStackedWidget); -// DELETEPTR(mpSnapshotVideoWidget); DELETEPTR(mpMediaObject); DELETEPTR(mpCover); + DELETEPTR(mpSnapshotVideoWidget); + DELETEPTR(mpVideoStackedWidget); + DELETEPTR(mpMediaContainer); + DELETEPTR(mpSeekerLayout); + DELETEPTR(mpLayout); } /** @@ -109,10 +116,14 @@ eMediaType UBMediaWidget::mediaType() void UBMediaWidget::showEvent(QShowEvent* event) { if(!mpVideoWidget){ + mpSnapshotVideoWidget = new QLabel(this); mpVideoWidget = new Phonon::VideoWidget(this); - mMediaLayout.addStretch(1); - mMediaLayout.addWidget(mpVideoWidget, 0); - mMediaLayout.addStretch(1); + mpVideoStackedWidget = new QStackedWidget(this); + mpVideoStackedWidget->addWidget(mpVideoWidget); + mpVideoStackedWidget->addWidget(mpSnapshotVideoWidget); + mMediaLayout->addStretch(1); + mMediaLayout->addWidget(mpVideoStackedWidget,0); + mMediaLayout->addStretch(1); Phonon::createPath(mpMediaObject, mpVideoWidget); adaptSizeToVideo(); mpMediaObject->play(); @@ -135,41 +146,39 @@ void UBMediaWidget::createMediaPlayer() { mpMediaContainer = new QWidget(this); mpMediaContainer->setObjectName("UBMediaVideoContainer"); - mpMediaContainer->setLayout(&mMediaLayout); + mMediaLayout = new QHBoxLayout(this); + mpMediaContainer->setLayout(mMediaLayout); if(eMediaType_Video == mType){ - mMediaLayout.setContentsMargins(10, 10, 10, 10); + mMediaLayout->setContentsMargins(10, 10, 10, 10); if(isVisible()){ + mpSnapshotVideoWidget = new QLabel(this); mpVideoWidget = new Phonon::VideoWidget(this); - mMediaLayout.addStretch(1); - -// mpVideoStackedWidget = new QStackedWidget(this); -// mpVideoStackedWidget->addWidget(mpVideoWidget); -// mpSnapshotVideoWidget = new QLabel(this); -// mpVideoStackedWidget->addWidget(mpSnapshotVideoWidget); -// mMediaLayout.addWidget(mpVideoStackedWidget,0); - - mMediaLayout.addWidget(mpVideoWidget, 0); - mMediaLayout.addStretch(1); + mpVideoStackedWidget = new QStackedWidget(this); + mpVideoStackedWidget->addWidget(mpVideoWidget); + mpVideoStackedWidget->addWidget(mpSnapshotVideoWidget); + mMediaLayout->addStretch(1); + mMediaLayout->addWidget(mpVideoStackedWidget, 0); + mMediaLayout->addStretch(1); Phonon::createPath(mpMediaObject, mpVideoWidget); adaptSizeToVideo(); } mpAudioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this); Phonon::createPath(mpMediaObject, mpAudioOutput); }else if(eMediaType_Audio == mType){ - mMediaLayout.setContentsMargins(10, 10, 10, 10); + mMediaLayout->setContentsMargins(10, 10, 10, 10); mpCover = new QLabel(mpMediaContainer); mpMediaContainer->setStyleSheet(QString("background: none;")); setAudioCover(":images/libpalette/soundIcon.svg"); mpCover->setScaledContents(true); - mMediaLayout.addStretch(1); - mMediaLayout.addWidget(mpCover, 0); - mMediaLayout.addStretch(1); + mMediaLayout->addStretch(1); + mMediaLayout->addWidget(mpCover, 0); + mMediaLayout->addStretch(1); mpAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); Phonon::createPath(mpMediaObject, mpAudioOutput); } - mLayout.addWidget(mpMediaContainer, 1); - mLayout.addLayout(&mSeekerLayout, 0); + mpLayout->addWidget(mpMediaContainer, 1); + mpLayout->addLayout(mpSeekerLayout, 0); setActionsParent(mpMediaContainer); } @@ -188,21 +197,19 @@ void UBMediaWidget::adaptSizeToVideo() } } -//void UBMediaWidget::updateView(Phonon::State nextState) -//{ -// if(eMediaType_Video == mType){ -// if(nextState != Phonon::PlayingState){ -// const QPixmap& snapshot = QPixmap::grabWindow(mpVideoWidget->winId()); -// if(snapshot.size().width()!= 0){ -// mpSnapshotVideoWidget->setPixmap(snapshot); -// mpVideoStackedWidget->setCurrentWidget(mpSnapshotVideoWidget); -// } -// } -// else -// mpVideoStackedWidget->setCurrentWidget(mpVideoWidget); -// } +void UBMediaWidget::updateView(Phonon::State nextState) +{ + if(eMediaType_Video == mType){ + if(nextState != Phonon::PlayingState){ + const QPixmap& snapshot = QPixmap::grabWindow(mpVideoWidget->winId()); + mpSnapshotVideoWidget->setPixmap(snapshot); + mpVideoStackedWidget->setCurrentWidget(mpSnapshotVideoWidget); + } + else + mpVideoStackedWidget->setCurrentWidget(mpVideoWidget); + } -//} +} /** * \brief Handle the media state change notification @@ -232,7 +239,8 @@ void UBMediaWidget::onStateChanged(Phonon::State newState, Phonon::State oldStat mpPauseButton->setEnabled(false); mpSlider->setValue(0); } - //updateView(newState); + if(mType == eMediaType_Video) + updateView(newState); } } diff --git a/src/customWidgets/UBMediaWidget.h b/src/customWidgets/UBMediaWidget.h index 0d4db8f0..240400a5 100644 --- a/src/customWidgets/UBMediaWidget.h +++ b/src/customWidgets/UBMediaWidget.h @@ -91,7 +91,7 @@ private slots: private: void createMediaPlayer(); void adaptSizeToVideo(); -// void updateView(Phonon::State nextState); + void updateView(Phonon::State nextState); /** The current media type */ eMediaType mType; @@ -102,9 +102,9 @@ private: /** The audio renderer */ Phonon::AudioOutput* mpAudioOutput; /** The principal layout of this widget */ - QVBoxLayout mLayout; + QVBoxLayout* mpLayout; /** The seeker layout */ - QHBoxLayout mSeekerLayout; + QHBoxLayout* mpSeekerLayout; /** The play-stop button */ UBMediaButton* mpPlayStopButton; /** The pause button */ @@ -120,14 +120,14 @@ private: /** A widget that will contain the media */ QWidget* mpMediaContainer; /** The media layout */ - QHBoxLayout mMediaLayout; + QHBoxLayout* mMediaLayout; /** The audio cover */ QLabel* mpCover; /** The media url */ QString mUrl; -// QStackedWidget* mpVideoStackedWidget; -// QLabel* mpSnapshotVideoWidget; + QStackedWidget* mpVideoStackedWidget; + QLabel* mpSnapshotVideoWidget; }; #endif // UBMEDIAWIDGET_H From 8ee02a4be1be4f0373bba8448dfc6c4ac4d482ee Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 2 May 2012 21:46:52 +0200 Subject: [PATCH 05/42] multiple layout bug fixed --- src/customWidgets/UBMediaWidget.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/customWidgets/UBMediaWidget.cpp b/src/customWidgets/UBMediaWidget.cpp index d192109b..67a20ad7 100644 --- a/src/customWidgets/UBMediaWidget.cpp +++ b/src/customWidgets/UBMediaWidget.cpp @@ -56,7 +56,7 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name) mpSlider->setMinimum(0); mpSlider->setMaximum(0); - mpSeekerLayout = new QHBoxLayout(this); + mpSeekerLayout = new QHBoxLayout(); mpSeekerLayout->addWidget(mpPlayStopButton, 0); mpSeekerLayout->addWidget(mpPauseButton, 0); mpSeekerLayout->addWidget(mpSlider, 1); @@ -144,9 +144,9 @@ void UBMediaWidget::hideEvent(QHideEvent* event) */ void UBMediaWidget::createMediaPlayer() { - mpMediaContainer = new QWidget(this); + mpMediaContainer = new QWidget(); mpMediaContainer->setObjectName("UBMediaVideoContainer"); - mMediaLayout = new QHBoxLayout(this); + mMediaLayout = new QHBoxLayout(); mpMediaContainer->setLayout(mMediaLayout); if(eMediaType_Video == mType){ From 1234e3e670a692d185d2068f92cb60767762b561 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 2 May 2012 21:49:46 +0200 Subject: [PATCH 06/42] screen shot when invisible bug fixed --- src/customWidgets/UBMediaWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/customWidgets/UBMediaWidget.cpp b/src/customWidgets/UBMediaWidget.cpp index 67a20ad7..f0def3ff 100644 --- a/src/customWidgets/UBMediaWidget.cpp +++ b/src/customWidgets/UBMediaWidget.cpp @@ -199,7 +199,7 @@ void UBMediaWidget::adaptSizeToVideo() void UBMediaWidget::updateView(Phonon::State nextState) { - if(eMediaType_Video == mType){ + if(isVisible() && eMediaType_Video == mType){ if(nextState != Phonon::PlayingState){ const QPixmap& snapshot = QPixmap::grabWindow(mpVideoWidget->winId()); mpSnapshotVideoWidget->setPixmap(snapshot); From c9180ee097baf9e83801fe08376c90d8277bc197 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 2 May 2012 22:53:51 +0200 Subject: [PATCH 07/42] lesson pages, presentation mode media titles are draggables --- src/gui/UBTeacherGuideWidget.cpp | 21 +++++++++++-------- src/gui/UBTeacherGuideWidget.h | 2 +- src/gui/UBTeacherGuideWidgetsTools.cpp | 28 ++++++++++++++++++++++---- src/gui/UBTeacherGuideWidgetsTools.h | 20 ++++++++++++++---- 4 files changed, 54 insertions(+), 17 deletions(-) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 51cd25b6..7eec4371 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -68,7 +68,7 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const mpLayout = new QVBoxLayout(this); mpPageNumberLabel = new QLabel(this); mpPageNumberLabel->setAlignment(Qt::AlignRight); - mpPageNumberLabel->setObjectName("UBTGEditionPageNumberLabel"); + mpPageNumberLabel->setObjectName("UBTGPageNumberLabel"); mpLayout->addWidget(mpPageNumberLabel); // tree basic configuration mpDocumentTitle = new QLabel(this); @@ -195,7 +195,7 @@ QVector UBTeacherGuideEditionWidget::getData() children << getChildrenList(mpAddALinkItem); result << getPageAndCommentData(); foreach(QTreeWidgetItem* widgetItem, children){ - tUBGEElementNode* node = dynamic_cast(mpTreeWidget->itemWidget(widgetItem,0))->saveData(); + tUBGEElementNode* node = dynamic_cast(mpTreeWidget->itemWidget(widgetItem,0))->saveData(); if(node) result << node; } @@ -205,7 +205,7 @@ QVector UBTeacherGuideEditionWidget::getData() void UBTeacherGuideEditionWidget::onAddItemClicked(QTreeWidgetItem* widget, int column) { int addSubItemWidgetType = widget->data(column,Qt::UserRole).toInt(); - if(column == 0 && addSubItemWidgetType != eUBTGAddSubItemWidgetType_None){ + if(addSubItemWidgetType != eUBTGAddSubItemWidgetType_None){ QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem(widget); newWidgetItem->setData(column,Qt::UserRole,eUBTGAddSubItemWidgetType_None); newWidgetItem->setData(1,Qt::UserRole,eUBTGAddSubItemWidgetType_None); @@ -279,7 +279,7 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare mpPageNumberLabel = new QLabel(this); mpPageNumberLabel->setAlignment(Qt::AlignRight); - mpPageNumberLabel->setObjectName("UBTGPresentationPageNumberLabel"); + mpPageNumberLabel->setObjectName("UBTGPageNumberLabel"); mpLayout->addWidget(mpPageNumberLabel); @@ -317,10 +317,11 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare mpSeparator->setObjectName("UBTGSepartor"); mpLayout->addWidget(mpSeparator); - mpTreeWidget = new QTreeWidget(this); + mpTreeWidget = new UBTGDraggableTreeItem(this); mpLayout->addWidget(mpTreeWidget); mpRootWidgetItem = mpTreeWidget->invisibleRootItem(); + mpTreeWidget->setDragEnabled(true); mpTreeWidget->setRootIsDecorated(false); mpTreeWidget->setIndentation(0); mpTreeWidget->setDropIndicatorShown(false); @@ -392,6 +393,7 @@ void UBTeacherGuidePresentationWidget::showData(QVector data) else if(element->type == "action"){ QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem(mpRootWidgetItem); newWidgetItem->setText(0,element->attributes.value("task")); + newWidgetItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); QString colorString = element->attributes.value("owner").toInt() == 0 ? "red":"green"; UBTGAdaptableText* textWidget = new UBTGAdaptableText(newWidgetItem,0); textWidget->bottomMargin(14); @@ -409,6 +411,8 @@ void UBTeacherGuidePresentationWidget::showData(QVector data) newWidgetItem->setText(0,element->attributes.value("title")); newWidgetItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_MEDIA); newWidgetItem->setData(0,Qt::FontRole, QVariant(QFont(QApplication::font().family(),11))); + newWidgetItem->setData(0, TG_USER_ROLE_MIME_TYPE, element->attributes.value("relativePath")); + newWidgetItem->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable); mpRootWidgetItem->addChild(newWidgetItem); QTreeWidgetItem* mediaItem = new QTreeWidgetItem(newWidgetItem); @@ -425,6 +429,7 @@ void UBTeacherGuidePresentationWidget::showData(QVector data) newWidgetItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_URL); newWidgetItem->setData(0,tUBTGTreeWidgetItemRole_HasAnUrl,QVariant(element->attributes.value("url"))); newWidgetItem->setData(0,Qt::FontRole, QVariant(QFont(QApplication::font().family(),11))); + newWidgetItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); mpRootWidgetItem->addChild(newWidgetItem); } } @@ -498,7 +503,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpLayout = new QVBoxLayout(this); mpPageNumberLabel = new QLabel(this); mpPageNumberLabel->setAlignment(Qt::AlignRight); - mpPageNumberLabel->setObjectName("UBTGPresentationPageNumberLabel"); + mpPageNumberLabel->setObjectName("UBTGPageNumberLabel"); mpPageNumberLabel->setText(tr("Page 0")); mpLayout->addWidget(mpPageNumberLabel); @@ -510,9 +515,9 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpButtonTitleLayout->addWidget(mpModePushButton); connect(mpModePushButton,SIGNAL(clicked()),this,SLOT(switchToMode())); - mpSessionTitle = new UBTGAdaptableText(0,this); + mpSessionTitle = new UBTGAdaptableText(0,this,"UBTGSessionTitle"); mpSessionTitle->setPlaceHolderText(tr("Type session title here ...")); - mpSessionTitle->setObjectName("UBTGEditionModeSessionTitle"); + //mpSessionTitle->setObjectName("UBTGSessionTitle"); mpButtonTitleLayout->addWidget(mpSessionTitle); mpLayout->addLayout(mpButtonTitleLayout); diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 2e98b429..2bdf52c4 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -96,7 +96,7 @@ private: QLabel* mpPageNumberLabel; QFrame* mpSeparator; QPushButton* mpModePushButton; - QTreeWidget* mpTreeWidget; + UBTGDraggableTreeItem* mpTreeWidget; QTreeWidgetItem* mpRootWidgetItem; QTreeWidgetItem* mpMediaSwitchItem; diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index 2f2dbba0..0e0fad07 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -103,15 +103,18 @@ tUBGEElementNode* UBTGActionWidget::saveData() UBTGAdaptableText::UBTGAdaptableText(QTreeWidgetItem* widget, QWidget* parent, const char* name):QTextEdit(parent) , mBottomMargin(5) , mpTreeWidgetItem(widget) - , mMinimumHeight(20) + , mMinimumHeight(0) , mHasPlaceHolder(false) , mIsUpdatingSize(false) { setObjectName(name); - setStyleSheet( "QWidget {background: white; border:1 solid #999999; border-radius : 10px; padding: 2px;}"); connect(this,SIGNAL(textChanged()),this,SLOT(onTextChanged())); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + + mMinimumHeight = document()->size().height() + mBottomMargin; + setMinimumHeight(mMinimumHeight); + } void UBTGAdaptableText::setPlaceHolderText(QString text) @@ -170,7 +173,6 @@ QString UBTGAdaptableText::text() void UBTGAdaptableText::onTextChanged() { qreal documentSize = document()->size().height(); - if(height() == documentSize + mBottomMargin) return; mIsUpdatingSize = true; @@ -478,7 +480,7 @@ void UBTGMediaWidget::updateSize() } /*************************************************************************** - * class UBTGUrlWdiget * + * class UBTGUrlWidget * ***************************************************************************/ UBTGUrlWidget::UBTGUrlWidget(QWidget* parent, const char* name ):QWidget(parent) , mpLayout(NULL) @@ -513,3 +515,21 @@ tUBGEElementNode* UBTGUrlWidget::saveData() result->attributes.insert("url",mpUrl->text()); return result; } + + +/*************************************************************************** + * class UBTGDraggableTreeItem * + ***************************************************************************/ +UBTGDraggableTreeItem::UBTGDraggableTreeItem(QWidget* parent, const char* name) : QTreeWidget(parent) +{ + setObjectName(name); +} + +QMimeData* UBTGDraggableTreeItem::mimeData(const QList items) const +{ + QMimeData* result = new QMimeData(); + QList urls; + urls << QUrl(items.at(0)->data(0,TG_USER_ROLE_MIME_TYPE).toString()); + result->setUrls(urls); + return result; +} diff --git a/src/gui/UBTeacherGuideWidgetsTools.h b/src/gui/UBTeacherGuideWidgetsTools.h index c73d15ff..8379c46c 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.h +++ b/src/gui/UBTeacherGuideWidgetsTools.h @@ -29,6 +29,9 @@ #include "customWidgets/UBMediaWidget.h" +#define TG_USER_ROLE_MIME_TYPE (Qt::UserRole+50) + + class QTreeWidget; class QVBoxLayout; class QComboBox; @@ -44,7 +47,7 @@ typedef struct }tUBGEElementNode; -class iUBTGSavableData +class iUBTGSaveData { public: virtual tUBGEElementNode* saveData() = 0; @@ -62,7 +65,7 @@ signals: public slots: }; -class UBTGActionWidget : public QWidget, public iUBTGSavableData +class UBTGActionWidget : public QWidget, public iUBTGSaveData { Q_OBJECT @@ -127,7 +130,7 @@ private: bool mDragStarted; }; -class UBTGMediaWidget : public QStackedWidget , public iUBTGSavableData +class UBTGMediaWidget : public QStackedWidget , public iUBTGSaveData { Q_OBJECT public: @@ -162,7 +165,7 @@ private: }; -class UBTGUrlWidget : public QWidget , public iUBTGSavableData +class UBTGUrlWidget : public QWidget , public iUBTGSaveData { Q_OBJECT public: @@ -175,5 +178,14 @@ private: QLineEdit* mpUrl; }; +class UBTGDraggableTreeItem : public QTreeWidget +{ + Q_OBJECT +public: + UBTGDraggableTreeItem(QWidget* parent = 0, const char* name = "UBTGDraggableTreeItem"); + +private: + QMimeData* mimeData(const QList items) const; +}; #endif // UBTEACHERGUIDEWIDGETSTOOLS_H From 2da43310c35d62804ee8f2ce336ade3c60d535ed Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 2 May 2012 23:46:28 +0200 Subject: [PATCH 08/42] add event filter to avoid the change of the button color on hover --- src/gui/UBTeacherGuideWidget.cpp | 19 +++++++++++++++++++ src/gui/UBTeacherGuideWidget.h | 3 +++ 2 files changed, 22 insertions(+) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 7eec4371..6833600d 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -210,6 +210,7 @@ void UBTeacherGuideEditionWidget::onAddItemClicked(QTreeWidgetItem* widget, int newWidgetItem->setData(column,Qt::UserRole,eUBTGAddSubItemWidgetType_None); newWidgetItem->setData(1,Qt::UserRole,eUBTGAddSubItemWidgetType_None); newWidgetItem->setIcon(1,QIcon(":images/close.svg")); + switch(addSubItemWidgetType) { case eUBTGAddSubItemWidgetType_Action: @@ -288,6 +289,7 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare mpModePushButton = new QPushButton(this); mpModePushButton->setIcon(QIcon(":images/pencil.svg")); mpModePushButton->setMaximumWidth(32); + mpModePushButton->installEventFilter(this); connect(mpModePushButton,SIGNAL(clicked()),parentWidget(),SLOT(changeMode())); @@ -345,6 +347,14 @@ UBTeacherGuidePresentationWidget::~UBTeacherGuidePresentationWidget() DELETEPTR(mpLayout); } +bool UBTeacherGuidePresentationWidget::eventFilter(QObject* object, QEvent* event) +{ + Q_UNUSED(object); + if(event->type() == QEvent::HoverEnter || event->type() == QEvent::HoverMove || event->type() == QEvent::HoverLeave) + return true; + return false; +} + void UBTeacherGuidePresentationWidget::cleanData() { mpPageTitle->showText(""); @@ -512,6 +522,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpModePushButton = new QPushButton(this); mpModePushButton->setIcon(QIcon(":images/pencil.svg")); mpModePushButton->setMaximumWidth(32); + mpModePushButton->installEventFilter(this); mpButtonTitleLayout->addWidget(mpModePushButton); connect(mpModePushButton,SIGNAL(clicked()),this,SLOT(switchToMode())); @@ -665,6 +676,14 @@ UBTeacherGuidePageZeroWidget::~UBTeacherGuidePageZeroWidget() DELETEPTR(mpLayout); } +bool UBTeacherGuidePageZeroWidget::eventFilter(QObject* object, QEvent* event) +{ + Q_UNUSED(object); + if(event->type() == QEvent::HoverEnter || event->type() == QEvent::HoverMove || event->type() == QEvent::HoverLeave) + return true; + return false; +} + void UBTeacherGuidePageZeroWidget::fillComboBoxes() { QString parametersConfigFilePath = UBSettings::settings()->applicationCustomizationDirectory() + "/teacherGuide/indexingParameters.xml"; diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 2bdf52c4..817f0062 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -86,6 +86,8 @@ public slots: void onActiveSceneChanged(); private: + bool eventFilter(QObject* object, QEvent* event); + void createMediaButtonItem(); UBTGAdaptableText* mpPageTitle; @@ -124,6 +126,7 @@ private: void fillComboBoxes(); void loadData(); void hideEvent(QHideEvent* event); + bool eventFilter(QObject* object, QEvent* event); QVBoxLayout* mpLayout; QHBoxLayout* mpButtonTitleLayout; From db3c5284bb13d597a1e31d6f0e51809181c1ea85 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 3 May 2012 09:53:26 +0200 Subject: [PATCH 09/42] added visible status --- src/gui/UBDockTeacherGuideWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/UBDockTeacherGuideWidget.cpp b/src/gui/UBDockTeacherGuideWidget.cpp index f8ad4f43..cc1a7995 100644 --- a/src/gui/UBDockTeacherGuideWidget.cpp +++ b/src/gui/UBDockTeacherGuideWidget.cpp @@ -25,7 +25,7 @@ UBDockTeacherGuideWidget::UBDockTeacherGuideWidget(QWidget* parent, const char* , mpTeacherGuideWidget(NULL) { mName = "TeacherGuide"; - + mVisibleState = true; SET_STYLE_SHEET(); mIconToLeft = QPixmap(":images/teacher_open.png"); From 5aa50c52dba8fa2734767ddbae72ff385d8a8278 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 3 May 2012 15:59:14 +0200 Subject: [PATCH 10/42] fixed some presentation issue on lessons page --- src/gui/UBTeacherGuideWidgetsTools.cpp | 44 ++++++++------------------ src/gui/UBTeacherGuideWidgetsTools.h | 1 - 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index 0e0fad07..3501573a 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -77,8 +77,8 @@ UBTGActionWidget::UBTGActionWidget(QTreeWidgetItem* widget, QWidget* parent, con mpTask->setAcceptRichText(true); mpTask->setTextColor(QColor().green()); mpTask->setObjectName("ActionWidgetTaskTextEdit"); - mpLayout->addWidget(mpOwner,0); - mpLayout->addWidget(mpTask,1); + mpLayout->addWidget(mpOwner); + mpLayout->addWidget(mpTask); } UBTGActionWidget::~UBTGActionWidget() @@ -88,6 +88,7 @@ UBTGActionWidget::~UBTGActionWidget() DELETEPTR(mpLayout); } + tUBGEElementNode* UBTGActionWidget::saveData() { tUBGEElementNode* result = new tUBGEElementNode(); @@ -159,6 +160,8 @@ void UBTGAdaptableText::showEvent(QShowEvent* e) Q_UNUSED(e); if(!mIsUpdatingSize && mHasPlaceHolder && toPlainText().isEmpty()) setPlainText(mPlaceHolderText); + else + onTextChanged(); } QString UBTGAdaptableText::text() @@ -184,10 +187,11 @@ void UBTGAdaptableText::onTextChanged() setFixedHeight(documentSize+mBottomMargin); updateGeometry(); - //to trig the widget item to resize it + //to trig a resize on the tree widget item if(mpTreeWidgetItem){ - mpTreeWidgetItem->setExpanded(false); + mpTreeWidgetItem->setDisabled(true); mpTreeWidgetItem->setExpanded(true); + mpTreeWidgetItem->setDisabled(false); setFocus(); } mIsUpdatingSize = false; @@ -196,13 +200,8 @@ void UBTGAdaptableText::onTextChanged() void UBTGAdaptableText::showText(const QString & text) { setText(text); - //A first rendering has to be done to calculate the text's size. - show(); - hide(); setReadOnly(true); onTextChanged(); - if(isHidden()) - show(); } void UBTGAdaptableText::bottomMargin(int newValue) @@ -211,11 +210,6 @@ void UBTGAdaptableText::bottomMargin(int newValue) onTextChanged(); } -void UBTGAdaptableText::resizeEvent(QResizeEvent* e) -{ - QTextEdit::resizeEvent(e); - //QTimer::singleShot(100,this,SLOT(onTextChanged())); -} /*************************************************************************** * class UBTGDraggableWeb * @@ -284,7 +278,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const setAcceptDrops(true); addWidget(mpDropMeWidget); - setMinimumHeight(200); + setMinimumHeight(250); } UBTGMediaWidget::UBTGMediaWidget(QString relativePath, QTreeWidgetItem* widget, QWidget* parent,const char* name): QStackedWidget(parent) @@ -303,7 +297,7 @@ UBTGMediaWidget::UBTGMediaWidget(QString relativePath, QTreeWidgetItem* widget, setObjectName(name); setAcceptDrops(false); createWorkWidget(mRelativePath); - setMinimumHeight(200); + setFixedHeight(200); } UBTGMediaWidget::~UBTGMediaWidget() @@ -401,19 +395,20 @@ void UBTGMediaWidget::createWorkWidget(QString& path) if(!mIsPresentationMode){ mpTitle = new UBTGAdaptableText(mpTreeWidgetItem,mpWorkWidget); mpTitle->setPlaceHolderText(tr("Type title here...")); - mpLayout->addWidget(mpTitle,1); + mpLayout->addWidget(mpTitle); } if(mpMediaLabelWidget){ + mpMediaLabelWidget->setMaximumHeight(width()); mpMediaLabelWidget->setParent(mpWorkWidget); mpLayout->addWidget(mpMediaLabelWidget); } else if (mpMediaWidget){ - mpMediaWidget->setMaximumHeight(mpTreeWidgetItem->treeWidget()->size().width()); + mpMediaWidget->setMaximumHeight(width()); mpMediaWidget->setParent(mpWorkWidget); mpLayout->addWidget(mpMediaWidget); } else if (mpWebView){ - mpWebView->setMaximumHeight(mpTreeWidgetItem->treeWidget()->size().width()); + mpWebView->setMaximumHeight(width()); mpWebView->setParent(mpWorkWidget); mpLayout->addWidget(mpWebView); mpWebView->show(); @@ -421,7 +416,6 @@ void UBTGMediaWidget::createWorkWidget(QString& path) mpWorkWidget->setLayout(mpLayout); addWidget(mpWorkWidget); setCurrentWidget(mpWorkWidget); - updateSize(); } } @@ -469,16 +463,6 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event) } } -void UBTGMediaWidget::updateSize() -{ - if(mpTreeWidgetItem){ - mpTreeWidgetItem->setExpanded(false); - mpTreeWidgetItem->setExpanded(true); - if(!mIsPresentationMode) - mpTitle->setFocus(); - } -} - /*************************************************************************** * class UBTGUrlWidget * ***************************************************************************/ diff --git a/src/gui/UBTeacherGuideWidgetsTools.h b/src/gui/UBTeacherGuideWidgetsTools.h index 8379c46c..b21fa0e7 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.h +++ b/src/gui/UBTeacherGuideWidgetsTools.h @@ -102,7 +102,6 @@ protected: void keyPressEvent(QKeyEvent* e); void keyReleaseEvent(QKeyEvent* e); void showEvent(QShowEvent* e); - void resizeEvent(QResizeEvent* e); private: int mBottomMargin; From 2b2d0b8c94f1cff7498a3e9fc8de6a8928de47f7 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 3 May 2012 15:59:59 +0200 Subject: [PATCH 11/42] the screenshot on media pause isn't more necessary --- src/customWidgets/UBMediaWidget.cpp | 54 ++++++++--------------------- src/customWidgets/UBMediaWidget.h | 4 --- 2 files changed, 15 insertions(+), 43 deletions(-) diff --git a/src/customWidgets/UBMediaWidget.cpp b/src/customWidgets/UBMediaWidget.cpp index f0def3ff..7c957198 100644 --- a/src/customWidgets/UBMediaWidget.cpp +++ b/src/customWidgets/UBMediaWidget.cpp @@ -37,7 +37,6 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name) , mpMediaContainer(NULL) , mMediaLayout(NULL) , mpCover(NULL) - , mpSnapshotVideoWidget(NULL) { SET_STYLE_SHEET(); @@ -73,15 +72,13 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name) UBMediaWidget::~UBMediaWidget() { unsetActionsParent(); + DELETEPTR(mpMediaObject); DELETEPTR(mpSlider); DELETEPTR(mpPauseButton); DELETEPTR(mpPlayStopButton); DELETEPTR(mpAudioOutput); DELETEPTR(mpVideoWidget); - DELETEPTR(mpMediaObject); DELETEPTR(mpCover); - DELETEPTR(mpSnapshotVideoWidget); - DELETEPTR(mpVideoStackedWidget); DELETEPTR(mpMediaContainer); DELETEPTR(mpSeekerLayout); DELETEPTR(mpLayout); @@ -116,13 +113,9 @@ eMediaType UBMediaWidget::mediaType() void UBMediaWidget::showEvent(QShowEvent* event) { if(!mpVideoWidget){ - mpSnapshotVideoWidget = new QLabel(this); mpVideoWidget = new Phonon::VideoWidget(this); - mpVideoStackedWidget = new QStackedWidget(this); - mpVideoStackedWidget->addWidget(mpVideoWidget); - mpVideoStackedWidget->addWidget(mpSnapshotVideoWidget); mMediaLayout->addStretch(1); - mMediaLayout->addWidget(mpVideoStackedWidget,0); + mMediaLayout->addWidget(mpVideoWidget); mMediaLayout->addStretch(1); Phonon::createPath(mpMediaObject, mpVideoWidget); adaptSizeToVideo(); @@ -152,13 +145,9 @@ void UBMediaWidget::createMediaPlayer() if(eMediaType_Video == mType){ mMediaLayout->setContentsMargins(10, 10, 10, 10); if(isVisible()){ - mpSnapshotVideoWidget = new QLabel(this); mpVideoWidget = new Phonon::VideoWidget(this); - mpVideoStackedWidget = new QStackedWidget(this); - mpVideoStackedWidget->addWidget(mpVideoWidget); - mpVideoStackedWidget->addWidget(mpSnapshotVideoWidget); mMediaLayout->addStretch(1); - mMediaLayout->addWidget(mpVideoStackedWidget, 0); + mMediaLayout->addWidget(mpVideoWidget); mMediaLayout->addStretch(1); Phonon::createPath(mpMediaObject, mpVideoWidget); adaptSizeToVideo(); @@ -197,20 +186,6 @@ void UBMediaWidget::adaptSizeToVideo() } } -void UBMediaWidget::updateView(Phonon::State nextState) -{ - if(isVisible() && eMediaType_Video == mType){ - if(nextState != Phonon::PlayingState){ - const QPixmap& snapshot = QPixmap::grabWindow(mpVideoWidget->winId()); - mpSnapshotVideoWidget->setPixmap(snapshot); - mpVideoStackedWidget->setCurrentWidget(mpSnapshotVideoWidget); - } - else - mpVideoStackedWidget->setCurrentWidget(mpVideoWidget); - } - -} - /** * \brief Handle the media state change notification * @param newState as the new state @@ -239,9 +214,10 @@ void UBMediaWidget::onStateChanged(Phonon::State newState, Phonon::State oldStat mpPauseButton->setEnabled(false); mpSlider->setValue(0); } - if(mType == eMediaType_Video) - updateView(newState); + } + // if(mType == eMediaType_Video) + // updateView(newState); } /** @@ -281,16 +257,16 @@ void UBMediaWidget::onSliderChanged(int value) void UBMediaWidget::onPlayStopClicked() { switch(mpMediaObject->state()){ - case Phonon::PlayingState: - mpMediaObject->stop(); - break; + case Phonon::PlayingState: + mpMediaObject->stop(); + break; - case Phonon::StoppedState: - case Phonon::PausedState: - mpMediaObject->play(); - break; - default: - break; + case Phonon::StoppedState: + case Phonon::PausedState: + mpMediaObject->play(); + break; + default: + break; } } diff --git a/src/customWidgets/UBMediaWidget.h b/src/customWidgets/UBMediaWidget.h index 240400a5..9919ca4e 100644 --- a/src/customWidgets/UBMediaWidget.h +++ b/src/customWidgets/UBMediaWidget.h @@ -91,7 +91,6 @@ private slots: private: void createMediaPlayer(); void adaptSizeToVideo(); - void updateView(Phonon::State nextState); /** The current media type */ eMediaType mType; @@ -125,9 +124,6 @@ private: QLabel* mpCover; /** The media url */ QString mUrl; - - QStackedWidget* mpVideoStackedWidget; - QLabel* mpSnapshotVideoWidget; }; #endif // UBMEDIAWIDGET_H From 01631d95f818386f529f73ea94d38c2f59623f39 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 3 May 2012 16:00:54 +0200 Subject: [PATCH 12/42] added entries for teacher guide session parameters --- src/core/UBSettings.cpp | 13 +++++++------ src/core/UBSettings.h | 13 ++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 541a6ca3..711b59f1 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -37,12 +37,13 @@ QString UBSettings::documentIdentifer = QString("ID"); QString UBSettings::documentVersion = QString("Version"); QString UBSettings::documentUpdatedAt = QString("UpdatedAt"); QString UBSettings::sessionTitle = QString("sessionTitle"); -QString UBSettings::sessionTarget = QString("sessionTarget"); -QString UBSettings::sessionLicence = QString("sessionLicence"); -QString UBSettings::sessionKeywords = QString("sessionKeywords"); -QString UBSettings::sessionLevel = QString("sessionLevel"); -QString UBSettings::sessionTopic = QString("sessionTopic"); QString UBSettings::sessionAuthors = QString("sessionAuthors"); +QString UBSettings::sessionGoals = QString("sessionGoals"); +QString UBSettings::sessionKeywords = QString("sessionKeywords"); +QString UBSettings::sessionGradeLevel = QString("sessionGradeLevel"); +QString UBSettings::sessionBranch = QString("sessionBranch"); +QString UBSettings::sessionType = QString("sessionType"); +QString UBSettings::sessionLicence = QString("sessionLicence"); QString UBSettings::documentDate = QString("date"); QString UBSettings::trashedDocumentGroupNamePrefix = QString("_Trash:"); @@ -382,7 +383,7 @@ void UBSettings::init() angleTolerance = new UBSetting(this, "App", "AngleTolerance", 4); historyLimit = new UBSetting(this, "Web", "HistoryLimit", 15); teacherGuidePageZeroActivated = new UBSetting(this,"DockPalette","TeacherGuideActivatePageZero",true); - teacherGuideLessonPagesActivated = new UBSetting(this,"DockPalette","TeacherGuideActvateLessonPages",true); + teacherGuideLessonPagesActivated = new UBSetting(this,"DockPalette","TeacherGuideActivateLessonPages",true); } diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index d19b1378..e28094c7 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -153,13 +153,16 @@ class UBSettings : public QObject static QString documentIdentifer; static QString documentVersion; static QString documentUpdatedAt; + static QString sessionTitle; - static QString sessionTarget; - static QString sessionLicence; - static QString sessionKeywords; - static QString sessionLevel; - static QString sessionTopic; static QString sessionAuthors; + static QString sessionGoals; + static QString sessionKeywords; + static QString sessionGradeLevel; + static QString sessionBranch; + static QString sessionType; + static QString sessionLicence; + static QString documentDate; static QString trashedDocumentGroupNamePrefix; From 55474fa8d6d48d84580d8309bf9cf3f0edb6086d Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 3 May 2012 16:02:27 +0200 Subject: [PATCH 13/42] added entries for teacher guide session parameters --- src/adaptors/UBMetadataDcSubsetAdaptor.cpp | 36 +++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp index 1608dece..c695249d 100644 --- a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp +++ b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp @@ -111,11 +111,13 @@ void UBMetadataDcSubsetAdaptor::persist(UBDocumentProxy* proxy) xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri, "updated-at", UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTimeUtc())); // introduced in OpenSankore 1.40.00 xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionTitle,proxy->metaData(UBSettings::sessionTitle).toString()); - xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionTarget,proxy->metaData(UBSettings::sessionTarget).toString()); - xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionLicence,proxy->metaData(UBSettings::sessionLicence).toString()); + xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionAuthors,proxy->metaData(UBSettings::sessionAuthors).toString()); + xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionGoals,proxy->metaData(UBSettings::sessionGoals).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionKeywords,proxy->metaData(UBSettings::sessionKeywords).toString()); - xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionLevel,proxy->metaData(UBSettings::sessionLevel).toString()); - xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionTopic,proxy->metaData(UBSettings::sessionTopic).toString()); + xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionGradeLevel,proxy->metaData(UBSettings::sessionGradeLevel).toString()); + xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionBranch,proxy->metaData(UBSettings::sessionBranch).toString()); + xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionType,proxy->metaData(UBSettings::sessionType).toString()); + xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionLicence,proxy->metaData(UBSettings::sessionLicence).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionAuthors,proxy->metaData(UBSettings::sessionAuthors).toString()); xmlWriter.writeEndElement(); //dc:Description @@ -222,36 +224,42 @@ QMap UBMetadataDcSubsetAdaptor::load(QString pPath) { metadata.insert(UBSettings::sessionTitle, xml.readElementText()); } - else if (xml.name() == UBSettings::sessionTarget // introduced in OpenSankore 1.40.00 + else if (xml.name() == UBSettings::sessionAuthors // introduced in OpenSankore 1.40.00 && xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri) { - metadata.insert(UBSettings::sessionTarget, xml.readElementText()); + metadata.insert(UBSettings::sessionAuthors, xml.readElementText()); } - else if (xml.name() == UBSettings::sessionLicence // introduced in OpenSankore 1.40.00 + else if (xml.name() == UBSettings::sessionGoals // introduced in OpenSankore 1.40.00 && xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri) { - metadata.insert(UBSettings::sessionLicence, xml.readElementText()); + metadata.insert(UBSettings::sessionGoals, xml.readElementText()); } else if (xml.name() == UBSettings::sessionKeywords // introduced in OpenSankore 1.40.00 && xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri) { metadata.insert(UBSettings::sessionKeywords, xml.readElementText()); } - else if (xml.name() == UBSettings::sessionLevel // introduced in OpenSankore 1.40.00 + else if (xml.name() == UBSettings::sessionGradeLevel // introduced in OpenSankore 1.40.00 && xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri) { - metadata.insert(UBSettings::sessionLevel, xml.readElementText()); + metadata.insert(UBSettings::sessionGradeLevel, xml.readElementText()); } - else if (xml.name() == UBSettings::sessionTopic // introduced in OpenSankore 1.40.00 + else if (xml.name() == UBSettings::sessionBranch // introduced in OpenSankore 1.40.00 && xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri) { - metadata.insert(UBSettings::sessionTopic, xml.readElementText()); + metadata.insert(UBSettings::sessionBranch, xml.readElementText()); } - else if (xml.name() == UBSettings::sessionAuthors // introduced in OpenSankore 1.40.00 + else if (xml.name() == UBSettings::sessionType // introduced in OpenSankore 1.40.00 && xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri) { - metadata.insert(UBSettings::sessionAuthors, xml.readElementText()); + metadata.insert(UBSettings::sessionType, xml.readElementText()); } + else if (xml.name() == UBSettings::sessionLicence // introduced in OpenSankore 1.40.00 + && xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri) + { + metadata.insert(UBSettings::sessionLicence, xml.readElementText()); + } + metadata.insert(UBSettings::documentVersion, docVersion); } From b45305da38944139bb9547692816d0241b9be881 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 3 May 2012 16:49:59 +0200 Subject: [PATCH 14/42] removed unused files --- src/gui/UBTGWidgetTreeDelegate.cpp | 34 ----------------------------- src/gui/UBTGWidgetTreeDelegate.h | 35 ------------------------------ src/gui/gui.pri | 6 ++--- 3 files changed, 2 insertions(+), 73 deletions(-) delete mode 100644 src/gui/UBTGWidgetTreeDelegate.cpp delete mode 100644 src/gui/UBTGWidgetTreeDelegate.h diff --git a/src/gui/UBTGWidgetTreeDelegate.cpp b/src/gui/UBTGWidgetTreeDelegate.cpp deleted file mode 100644 index 928beac9..00000000 --- a/src/gui/UBTGWidgetTreeDelegate.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#include "UBTGWidgetTreeDelegate.h" - -UBTGWidgetTreeDelegate::UBTGWidgetTreeDelegate(QObject *parent) : - QStyledItemDelegate(parent) -{ - //NOOP -} - -void UBTGWidgetTreeDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const -{ - if(index.data(Qt::UserRole) != eUBTGAddSubItemWidgetType_None){ - painter->setBackgroundMode(Qt::OpaqueMode); - painter->setBackground(QBrush(QColor(Qt::red))); - QStyleOptionButton styleButton; - styleButton.text = "pipo"; - styleButton.rect = option.rect; - QApplication::style()->drawControl(QStyle::CE_PushButtonLabel,&styleButton,painter); - } - else - QStyledItemDelegate::paint(painter,option,index); -} - -QSize UBTGWidgetTreeDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const -{ - QSize size = QStyledItemDelegate::sizeHint(option,index); - return size; -} diff --git a/src/gui/UBTGWidgetTreeDelegate.h b/src/gui/UBTGWidgetTreeDelegate.h deleted file mode 100644 index 75343346..00000000 --- a/src/gui/UBTGWidgetTreeDelegate.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef UBTGWIDGETTREEDELEGATE_H -#define UBTGWIDGETTREEDELEGATE_H - -class QPainter; -class QStyleOptionViewItem; -class QModelIndex; - -#include - - -typedef enum -{ - eUBTGAddSubItemWidgetType_None, - eUBTGAddSubItemWidgetType_Action , - eUBTGAddSubItemWidgetType_Media, - eUBTGAddSubItemWidgetType_Url -}eUBTGAddSubItemWidgetType; - - -class UBTGWidgetTreeDelegate : public QStyledItemDelegate -{ - Q_OBJECT -public: - explicit UBTGWidgetTreeDelegate(QObject *parent = 0); - - virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; - virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; - -signals: - -public slots: - -}; - -#endif // UBTGWIDGETTREEDELEGATE_H diff --git a/src/gui/gui.pri b/src/gui/gui.pri index a1dd1218..c6430a24 100644 --- a/src/gui/gui.pri +++ b/src/gui/gui.pri @@ -51,8 +51,7 @@ HEADERS += src/gui/UBThumbnailView.h \ src/gui/UBDockTeacherGuideWidget.h \ src/gui/UBTeacherGuideWidget.h \ src/gui/UBTeacherGuideWidgetsTools.h \ - src/gui/UBTeacherGuideDelegate.h \ - src/gui/UBTGWidgetTreeDelegate.h + src/gui/UBTeacherGuideDelegate.h SOURCES += src/gui/UBThumbnailView.cpp \ src/gui/UBFloatingPalette.cpp \ @@ -106,8 +105,7 @@ SOURCES += src/gui/UBThumbnailView.cpp \ src/gui/UBDockTeacherGuideWidget.cpp \ src/gui/UBTeacherGuideWidget.cpp \ src/gui/UBTeacherGuideWidgetsTools.cpp \ - src/gui/UBTeacherGuideDelegate.cpp \ - src/gui/UBTGWidgetTreeDelegate.cpp + src/gui/UBTeacherGuideDelegate.cpp win32 { From bd2feb05e6fc16de6bece6bac3e3929e9711f2ac Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 4 May 2012 08:24:21 +0200 Subject: [PATCH 15/42] removed unused files --- src/gui/UBTeacherGuideDelegate.cpp | 5 ----- src/gui/UBTeacherGuideDelegate.h | 10 ---------- src/gui/gui.pri | 6 ++---- 3 files changed, 2 insertions(+), 19 deletions(-) delete mode 100644 src/gui/UBTeacherGuideDelegate.cpp delete mode 100644 src/gui/UBTeacherGuideDelegate.h diff --git a/src/gui/UBTeacherGuideDelegate.cpp b/src/gui/UBTeacherGuideDelegate.cpp deleted file mode 100644 index 33dba6fe..00000000 --- a/src/gui/UBTeacherGuideDelegate.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "UBTeacherGuideDelegate.h" - -UBTeacherGuideDelegate::UBTeacherGuideDelegate() -{ -} diff --git a/src/gui/UBTeacherGuideDelegate.h b/src/gui/UBTeacherGuideDelegate.h deleted file mode 100644 index 1c1134f5..00000000 --- a/src/gui/UBTeacherGuideDelegate.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef UBTEACHERGUIDEDELEGATE_H -#define UBTEACHERGUIDEDELEGATE_H - -class UBTeacherGuideDelegate -{ -public: - UBTeacherGuideDelegate(); -}; - -#endif // UBTEACHERGUIDEDELEGATE_H diff --git a/src/gui/gui.pri b/src/gui/gui.pri index c6430a24..52939d44 100644 --- a/src/gui/gui.pri +++ b/src/gui/gui.pri @@ -50,8 +50,7 @@ HEADERS += src/gui/UBThumbnailView.h \ src/gui/UBFeaturesActionBar.h \ src/gui/UBDockTeacherGuideWidget.h \ src/gui/UBTeacherGuideWidget.h \ - src/gui/UBTeacherGuideWidgetsTools.h \ - src/gui/UBTeacherGuideDelegate.h + src/gui/UBTeacherGuideWidgetsTools.h SOURCES += src/gui/UBThumbnailView.cpp \ src/gui/UBFloatingPalette.cpp \ @@ -104,8 +103,7 @@ SOURCES += src/gui/UBThumbnailView.cpp \ src/gui/UBFeaturesActionBar.cpp \ src/gui/UBDockTeacherGuideWidget.cpp \ src/gui/UBTeacherGuideWidget.cpp \ - src/gui/UBTeacherGuideWidgetsTools.cpp \ - src/gui/UBTeacherGuideDelegate.cpp + src/gui/UBTeacherGuideWidgetsTools.cpp win32 { From c6e990454cf6f086f52f471163496fc70c85e93a Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 4 May 2012 09:04:46 +0200 Subject: [PATCH 16/42] stored zero page informations --- src/adaptors/UBMetadataDcSubsetAdaptor.cpp | 2 - src/document/UBDocumentController.cpp | 1 + src/document/UBDocumentProxy.cpp | 106 ++------------------- src/document/UBDocumentProxy.h | 14 --- src/gui/UBTeacherGuideWidget.cpp | 16 ++-- src/gui/UBTeacherGuideWidget.h | 2 - src/gui/UBTeacherGuideWidgetsTools.cpp | 1 - 7 files changed, 19 insertions(+), 123 deletions(-) diff --git a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp index c695249d..3ed029a1 100644 --- a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp +++ b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp @@ -118,7 +118,6 @@ void UBMetadataDcSubsetAdaptor::persist(UBDocumentProxy* proxy) xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionBranch,proxy->metaData(UBSettings::sessionBranch).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionType,proxy->metaData(UBSettings::sessionType).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionLicence,proxy->metaData(UBSettings::sessionLicence).toString()); - xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionAuthors,proxy->metaData(UBSettings::sessionAuthors).toString()); xmlWriter.writeEndElement(); //dc:Description xmlWriter.writeEndElement(); //RDF @@ -299,7 +298,6 @@ QMap UBMetadataDcSubsetAdaptor::load(QString pPath) metadata.insert(UBSettings::documentDate, QVariant(date)); - return metadata; } diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 30b3f4d8..f1638a20 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -12,6 +12,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + #include "UBDocumentController.h" #include diff --git a/src/document/UBDocumentProxy.cpp b/src/document/UBDocumentProxy.cpp index c37f9b28..dff6cf9a 100644 --- a/src/document/UBDocumentProxy.cpp +++ b/src/document/UBDocumentProxy.cpp @@ -50,13 +50,15 @@ void UBDocumentProxy::init() setDefaultDocumentSize(UBSettings::settings()->pageSize->get().toSize()); - setSessionTitle(""); - setSessionTarget(""); - setSessionLicence(""); - setSessionKeywords(""); - setSessionLevel(""); - setSessionTopic(""); - setSessionAuthor(""); + //teacherGuide metadata + setMetaData(UBSettings::sessionTitle,""); + setMetaData(UBSettings::sessionAuthors,""); + setMetaData(UBSettings::sessionGoals,""); + setMetaData(UBSettings::sessionKeywords,""); + setMetaData(UBSettings::sessionGradeLevel,""); + setMetaData(UBSettings::sessionBranch,""); + setMetaData(UBSettings::sessionType,""); + setMetaData(UBSettings::sessionLicence,""); } @@ -204,96 +206,6 @@ void UBDocumentProxy::setUuid(const QUuid& uuid) UBSettings::uniboardDocumentNamespaceUri + "/" + UBStringUtils::toCanonicalUuid(uuid)); } -QString UBDocumentProxy::sessionTitle() const -{ - if(mMetaDatas.contains(UBSettings::sessionTitle)) - return metaData(UBSettings::sessionTitle).toString(); - else - return QString(); -} - -void UBDocumentProxy::setSessionTitle(const QString & sessionTitle) -{ - setMetaData(UBSettings::sessionTitle,QVariant(sessionTitle)); -} - -QString UBDocumentProxy::sessionTarget() const -{ - if(mMetaDatas.contains(UBSettings::sessionTarget)) - return metaData(UBSettings::sessionTarget).toString(); - else - return QString(); -} - -void UBDocumentProxy::setSessionTarget(const QString & sessionTarget) -{ - setMetaData(UBSettings::sessionTarget,QVariant(sessionTarget)); -} - -QString UBDocumentProxy::sessionLicence() const -{ - if(mMetaDatas.contains(UBSettings::sessionLicence)) - return metaData(UBSettings::sessionLicence).toString(); - else - return QString(); -} - -void UBDocumentProxy::setSessionLicence(const QString & sessionLicence) -{ - setMetaData(UBSettings::sessionLicence,QVariant(sessionLicence)); -} - -void UBDocumentProxy::setSessionKeywords(const QString &kw) -{ - setMetaData(UBSettings::sessionKeywords,QVariant(kw)); -} - -QString UBDocumentProxy::sessionKeywords() -{ - if(mMetaDatas.contains(UBSettings::sessionKeywords)) - return metaData(UBSettings::sessionKeywords).toString(); - else - return QString(); -} - -void UBDocumentProxy::setSessionLevel(const QString &level) -{ - setMetaData(UBSettings::sessionLevel,QVariant(level)); -} - -QString UBDocumentProxy::sessionLevel() -{ - if(mMetaDatas.contains(UBSettings::sessionLevel)) - return metaData(UBSettings::sessionLevel).toString(); - else - return QString(); -} - -void UBDocumentProxy::setSessionTopic(const QString &topic) -{ - setMetaData(UBSettings::sessionTopic,QVariant(topic)); -} - -QString UBDocumentProxy::sessionTopic() -{ - if(mMetaDatas.contains(UBSettings::sessionTopic)) - return metaData(UBSettings::sessionTopic).toString(); - else - return QString(); -} - -void UBDocumentProxy::setSessionAuthor(const QString &authors) -{ - setMetaData(UBSettings::sessionAuthors,QVariant(authors)); -} - -QString UBDocumentProxy::sessionAuthors() -{ - if(mMetaDatas.contains(UBSettings::sessionAuthors)) - return metaData(UBSettings::sessionAuthors).toString(); - else - return QString(); -} QDateTime UBDocumentProxy::documentDate() { diff --git a/src/document/UBDocumentProxy.h b/src/document/UBDocumentProxy.h index b35a62a5..4879d664 100644 --- a/src/document/UBDocumentProxy.h +++ b/src/document/UBDocumentProxy.h @@ -45,20 +45,6 @@ class UBDocumentProxy : public QObject QString name() const; QString groupName() const; - QString sessionTitle() const; - void setSessionTitle(const QString& sessionTitle); - QString sessionTarget() const; - void setSessionTarget(const QString& sessionTarget); - QString sessionLicence() const; - void setSessionLicence(const QString& sessionLicence); - void setSessionKeywords(const QString& kw); - QString sessionKeywords(); - void setSessionLevel(const QString& level); - QString sessionLevel(); - void setSessionTopic(const QString& topic); - QString sessionTopic(); - void setSessionAuthor(const QString& authors); - QString sessionAuthors(); QDateTime documentDate(); QDateTime lastUpdate(); diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 6833600d..a5ce6280 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -43,6 +43,15 @@ #define UBTG_SEPARATOR_FIXED_HEIGHT 3 +typedef enum +{ + eUBTGAddSubItemWidgetType_None, + eUBTGAddSubItemWidgetType_Action , + eUBTGAddSubItemWidgetType_Media, + eUBTGAddSubItemWidgetType_Url +}eUBTGAddSubItemWidgetType; + + /*************************************************************************** * class UBTeacherGuideEditionWidget * @@ -61,7 +70,6 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const , mpAddAnActionItem(NULL) , mpAddAMediaItem(NULL) , mpAddALinkItem(NULL) - , mpTreeDelegate(NULL) { setObjectName(name); @@ -94,10 +102,7 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const mpTreeWidget = new QTreeWidget(this); mpLayout->addWidget(mpTreeWidget); - mpTreeDelegate = new UBTGWidgetTreeDelegate(); - mpRootWidgetItem = mpTreeWidget->invisibleRootItem(); - //mpTreeWidget->setItemDelegate(mpTreeDelegate); mpTreeWidget->setRootIsDecorated(false); mpTreeWidget->setIndentation(0); mpTreeWidget->setDropIndicatorShown(false); @@ -131,7 +136,6 @@ UBTeacherGuideEditionWidget::~UBTeacherGuideEditionWidget() DELETEPTR(mpAddAnActionItem); DELETEPTR(mpAddAMediaItem); DELETEPTR(mpAddALinkItem); - DELETEPTR(mpTreeDelegate); DELETEPTR(mpTreeWidget) DELETEPTR(mpLayout); } @@ -755,7 +759,6 @@ void UBTeacherGuidePageZeroWidget::onActiveSceneChanged() mpCreationLabel->setText(tr("Created the: ") + creationDate.toString(Qt::SystemLocaleShortDate)); QDateTime updatedDate = documentProxy->lastUpdate(); mpLastModifiedLabel->setText(tr("Updated the: ") + updatedDate.toString(Qt::SystemLocaleShortDate)); - persistData(); loadData(); } } @@ -768,7 +771,6 @@ void UBTeacherGuidePageZeroWidget::hideEvent ( QHideEvent * event ) void UBTeacherGuidePageZeroWidget::loadData() { - UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); mpSessionTitle->setText(documentProxy->metaData(UBSettings::sessionTitle).toString()); mpAuthors->setText(documentProxy->metaData(UBSettings::sessionAuthors).toString()); diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 817f0062..9f67440c 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -24,7 +24,6 @@ class QPushButton; class UBDocumentProxy; #include "UBTeacherGuideWidgetsTools.h" -#include "UBTGWidgetTreeDelegate.h" typedef enum { @@ -64,7 +63,6 @@ private: UBAddItem* mpAddAnActionItem; UBAddItem* mpAddAMediaItem; UBAddItem* mpAddALinkItem; - UBTGWidgetTreeDelegate* mpTreeDelegate; }; diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index 3501573a..2083b1d2 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -24,7 +24,6 @@ #include #include "UBTeacherGuideWidgetsTools.h" -#include "UBTGWidgetTreeDelegate.h" #include "core/UBPersistenceManager.h" From a8bfdc6e704703ccd2a34a7a8d55fe53b5f7933a Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 4 May 2012 12:17:32 +0200 Subject: [PATCH 17/42] Removed unused interfaces and added the data storageinterface --- src/customWidgets/UBMediaWidget.h | 2 +- src/interfaces/IDataStorage.h | 19 +++++++++++++++++++ src/interfaces/IDropable.h | 21 --------------------- src/interfaces/IResizeable.h | 15 --------------- src/interfaces/interfaces.pri | 5 ++--- 5 files changed, 22 insertions(+), 40 deletions(-) create mode 100644 src/interfaces/IDataStorage.h delete mode 100644 src/interfaces/IDropable.h delete mode 100644 src/interfaces/IResizeable.h diff --git a/src/customWidgets/UBMediaWidget.h b/src/customWidgets/UBMediaWidget.h index 9919ca4e..12281243 100644 --- a/src/customWidgets/UBMediaWidget.h +++ b/src/customWidgets/UBMediaWidget.h @@ -27,7 +27,7 @@ #include #include -#include "interfaces/IResizeable.h" +//#include "interfaces/IResizeable.h" #include "UBActionableWidget.h" #define UBMEDIABUTTON_SIZE 32 diff --git a/src/interfaces/IDataStorage.h b/src/interfaces/IDataStorage.h new file mode 100644 index 00000000..c3795773 --- /dev/null +++ b/src/interfaces/IDataStorage.h @@ -0,0 +1,19 @@ +/* + * 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 3 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 IDATASTORAGE_H +#define IDATASTORAGE_H + +#endif // IDATASTORAGE_H diff --git a/src/interfaces/IDropable.h b/src/interfaces/IDropable.h deleted file mode 100644 index a75f4f16..00000000 --- a/src/interfaces/IDropable.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef IDROPABLE_H -#define IDROPABLE_H - -#include -#include -#include -#include - -class IDropable -{ -public: - virtual ~IDropable(){} - -protected: - virtual void dropEvent(QDropEvent* pEvent) = 0; - virtual void dragEnterEvent(QDragEnterEvent* pEvent) = 0; - virtual void dragMoveEvent(QDragMoveEvent* pEvent) = 0; - virtual void dragLeaveEvent(QDragLeaveEvent* pEvent) = 0; -}; - -#endif // IDROPABLE_H diff --git a/src/interfaces/IResizeable.h b/src/interfaces/IResizeable.h deleted file mode 100644 index b84ac8e5..00000000 --- a/src/interfaces/IResizeable.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef IRESIZEABLE_H -#define IRESIZEABLE_H - -#include - -class IResizeable -{ -public: - ~IResizeable(); - -protected: - virtual void resizeEvent(QResizeEvent* pEvent) = 0; -}; - -#endif // IRESIZEABLE_H diff --git a/src/interfaces/interfaces.pri b/src/interfaces/interfaces.pri index 55098bf3..bac61bda 100644 --- a/src/interfaces/interfaces.pri +++ b/src/interfaces/interfaces.pri @@ -1,3 +1,2 @@ -HEADERS += src/interfaces/IDropable.h \ - src/interfaces/IDropable.h \ - src/interfaces/IResizeable.h +HEADERS += \ + src/interfaces/IDataStorage.h From 201bcc33dd9f779f7a73206d8402dbe2f21f8048 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 4 May 2012 12:18:06 +0200 Subject: [PATCH 18/42] Removed unused interfaces and added the data storageinterface --- src/customWidgets/UBMediaWidget.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/customWidgets/UBMediaWidget.h b/src/customWidgets/UBMediaWidget.h index 12281243..13a96a84 100644 --- a/src/customWidgets/UBMediaWidget.h +++ b/src/customWidgets/UBMediaWidget.h @@ -27,7 +27,6 @@ #include #include -//#include "interfaces/IResizeable.h" #include "UBActionableWidget.h" #define UBMEDIABUTTON_SIZE 32 From 66db92929071c6fd3dd7260bdb31686e663a2581 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 4 May 2012 21:07:28 +0200 Subject: [PATCH 19/42] add import for lessons pages --- src/adaptors/UBSvgSubsetAdaptor.cpp | 84 +++++++++++++++------ src/adaptors/UBSvgSubsetAdaptor.h | 13 +++- src/gui/UBTeacherGuideWidget.cpp | 100 +++++++++++++++++++------ src/gui/UBTeacherGuideWidget.h | 13 +++- src/gui/UBTeacherGuideWidgetsTools.cpp | 89 +++++++++++++++------- src/gui/UBTeacherGuideWidgetsTools.h | 11 ++- src/interfaces/IDataStorage.h | 8 ++ 7 files changed, 240 insertions(+), 78 deletions(-) diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 86ade4c9..c9af3e92 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -53,6 +53,8 @@ #include "core/UBPersistenceManager.h" #include "core/UBApplication.h" +#include "interfaces/IDataStorage.h" + #include "pdf/PDFRenderer.h" #include "core/memcheck.h" @@ -68,6 +70,15 @@ const QString UBSvgSubsetAdaptor::sPixelUnit = "px"; const QString UBSvgSubsetAdaptor::sFontWeightPrefix = "font-weight:"; const QString UBSvgSubsetAdaptor::sFontStylePrefix = "font-style:"; const QString UBSvgSubsetAdaptor::sFormerUniboardDocumentNamespaceUri = "http://www.mnemis.com/uniboard"; +QMap UBSvgSubsetAdaptor::additionalElementToStore; + +// Why using such a string? +// Media file path are relative to the current document. So if we are reading the +// first page of a document the document path has not been updated. +// Concatenate relative media path with the old document path leads to mess +// This string is so used only for activeDocumentChanged signal +QString UBSvgSubsetAdaptor::sTeacherGuideNode = ""; + @@ -133,8 +144,7 @@ void UBSvgSubsetAdaptor::upgradeScene(UBDocumentProxy* proxy, const int pageInde QDomDocument UBSvgSubsetAdaptor::loadSceneDocument(UBDocumentProxy* proxy, const int pPageIndex) { - QString fileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.svg", pPageIndex + 1); + QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(pPageIndex)); QFile file(fileName); QDomDocument doc("page"); @@ -157,8 +167,7 @@ QDomDocument UBSvgSubsetAdaptor::loadSceneDocument(UBDocumentProxy* proxy, const void UBSvgSubsetAdaptor::setSceneUuid(UBDocumentProxy* proxy, const int pageIndex, QUuid pUuid) { - QString fileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.svg", pageIndex + 1); + QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); QFile file(fileName); @@ -207,6 +216,16 @@ void UBSvgSubsetAdaptor::setSceneUuid(UBDocumentProxy* proxy, const int pageInde } } +bool UBSvgSubsetAdaptor::addElementToBeStored(QString domName, IDataStorage *dataStorageClass) +{ + if(domName.isEmpty() || additionalElementToStore.contains(domName)){ + qWarning() << "Error adding the element that should persist"; + return false; + } + + additionalElementToStore.insert(domName,dataStorageClass); + return true; +} QString UBSvgSubsetAdaptor::uniboardDocumentNamespaceUriFromVersion(int mFileVersion) { @@ -216,8 +235,7 @@ QString UBSvgSubsetAdaptor::uniboardDocumentNamespaceUriFromVersion(int mFileVer UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const int pageIndex) { - QString fileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.svg", pageIndex + 1); + QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); QFile file(fileName); @@ -243,7 +261,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const int QUuid UBSvgSubsetAdaptor::sceneUuid(UBDocumentProxy* proxy, const int pageIndex) { QString fileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.svg", pageIndex + 1); + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); QFile file(fileName); @@ -429,13 +447,13 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() else if (mXmlReader.name() == "g") { // Create new stroke, if its NULL or already has polygons - if (annotationGroup) - { - if (!annotationGroup->polygons().empty()) - annotationGroup = new UBGraphicsStroke(); - } - else - annotationGroup = new UBGraphicsStroke(); + if (annotationGroup) + { + if (!annotationGroup->polygons().empty()) + annotationGroup = new UBGraphicsStroke(); + } + else + annotationGroup = new UBGraphicsStroke(); if(eDrawingMode_Vector == dc->drawingMode()){ strokesGroup = new UBGraphicsStrokesGroup(); @@ -709,7 +727,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() UBGraphicsItem::assignZValue(triangle, zFromSvg); } } - else if(mXmlReader.name() == "cache") + else if (mXmlReader.name() == "cache") { UBGraphicsCache* cache = cacheFromSvg(); if(cache) @@ -830,6 +848,18 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() currentWidget->setDatastoreEntry(key, value); } + else if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){ + sTeacherGuideNode.clear(); + sTeacherGuideNode += ""; + sTeacherGuideNode += "\n"; + } + else if (mXmlReader.name() == "media" || mXmlReader.name() == "link" || mXmlReader.name() == "title" || mXmlReader.name() == "comment" || mXmlReader.name() == "action") + { + sTeacherGuideNode += "<" + mXmlReader.name().toString() + " "; + foreach(QXmlStreamAttribute attribute, mXmlReader.attributes()) + sTeacherGuideNode += attribute.name().toString() + "=\"" + attribute.value().toString() + "\" "; + sTeacherGuideNode += " />\n"; + } else { // NOOP @@ -844,15 +874,23 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() //graphicsItemFromSvg(strokesGroup); } - if (annotationGroup) - { - if (!annotationGroup->polygons().empty()) - annotationGroup = 0; - } + if (annotationGroup) + { + if (!annotationGroup->polygons().empty()) + annotationGroup = 0; + } mGroupHasInfo = false; mGroupDarkBackgroundColor = QColor(); mGroupLightBackgroundColor = QColor(); } + else if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){ + sTeacherGuideNode += ""; + QMap elements = getAdditionalElementToStore(); + IDataStorage* storageClass = elements.value("teacherGuide"); + if(storageClass){ + storageClass->load(sTeacherGuideNode); + } + } } } @@ -1152,7 +1190,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene() } mXmlWriter.writeEndDocument(); - QString fileName = mDocumentPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", mPageIndex + 1); + QString fileName = mDocumentPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(mPageIndex)); QFile file(fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) @@ -1167,7 +1205,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene() } else { - qDebug() << "ignoring unmodified page" << mPageIndex + 1; + qDebug() << "ignoring unmodified page" << UBApplication::boardController->pageFromSceneIndex(mPageIndex); } return true; @@ -2504,7 +2542,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::curtainItemToSvg(UBGraphicsCurtainIt mXmlWriter.writeAttribute("width", QString("%1").arg(curtainItem->boundingRect().width())); mXmlWriter.writeAttribute("height", QString("%1").arg(curtainItem->boundingRect().height())); mXmlWriter.writeAttribute("transform", toSvgTransform(curtainItem->sceneMatrix())); - + //graphicsItemToSvg(curtainItem); QString zs; zs.setNum(curtainItem->zValue(), 'f'); // 'f' keeps precision diff --git a/src/adaptors/UBSvgSubsetAdaptor.h b/src/adaptors/UBSvgSubsetAdaptor.h index 188bba2f..37eacb07 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.h +++ b/src/adaptors/UBSvgSubsetAdaptor.h @@ -41,6 +41,7 @@ class UBGraphicsStroke; class UBPersistenceManager; class UBGraphicsTriangle; class UBGraphicsCache; +class IDataStorage; class UBSvgSubsetAdaptor { @@ -58,9 +59,14 @@ class UBSvgSubsetAdaptor static QUuid sceneUuid(UBDocumentProxy* proxy, const int pageIndex); static void setSceneUuid(UBDocumentProxy* proxy, const int pageIndex, QUuid pUuid); + static bool addElementToBeStored(QString domName,IDataStorage* dataStorageClass); + static void convertPDFObjectsToImages(UBDocumentProxy* proxy); static void convertSvgImagesToImages(UBDocumentProxy* proxy); + static QMap getAdditionalElementToStore() { return additionalElementToStore;} + static QString sTeacherGuideNode; + static const QString nsSvg; static const QString nsXLink; static const QString nsXHtml; @@ -86,6 +92,9 @@ class UBSvgSubsetAdaptor static QString toSvgTransform(const QMatrix& matrix); static QMatrix fromSvgTransform(const QString& transform); + static QMap additionalElementToStore; + + class UBSvgSubsetReader { public: @@ -188,9 +197,9 @@ class UBSvgSubsetAdaptor QLocale loc(QLocale::C); sBuf = sBuf.arg(loc.toFloat(temp1)).arg(loc.toFloat(temp2)); - + svgPoints.insert(length, sBuf); - length += sBuf.length(); + length += sBuf.length(); } return svgPoints; } diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index a5ce6280..51c4017d 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -23,6 +23,8 @@ #include "UBTeacherGuideWidget.h" +#include "adaptors/UBSvgSubsetAdaptor.h" + #include "core/UBApplication.h" #include "core/UBPersistenceManager.h" #include "core/UBSettings.h" @@ -79,10 +81,12 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const mpPageNumberLabel->setObjectName("UBTGPageNumberLabel"); mpLayout->addWidget(mpPageNumberLabel); // tree basic configuration - mpDocumentTitle = new QLabel(this); - mpDocumentTitle->setText("Document title"); - mpDocumentTitle->setObjectName("UBTGEditionDocumentTitle"); - mpLayout->addWidget(mpDocumentTitle); + + if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()){ + mpDocumentTitle = new QLabel(this); + mpDocumentTitle->setObjectName("UBTGPresentationDocumentTitle"); + mpLayout->addWidget(mpDocumentTitle); + } mpPageTitle = new UBTGAdaptableText(0,this); mpPageTitle->setObjectName("UBTGEditionPageTitle"); @@ -124,6 +128,11 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const mpRootWidgetItem->addChild(mpAddAnActionItem); mpRootWidgetItem->addChild(mpAddAMediaItem); mpRootWidgetItem->addChild(mpAddALinkItem); + + if(UBSettings::settings()->teacherGuideLessonPagesActivated->get().toBool()){ + UBSvgSubsetAdaptor::addElementToBeStored(QString("teacherGuide"),this); + connect(UBApplication::boardController,SIGNAL(activeDocumentChanged()),this,SLOT(onActiveDocumentChanged())); + } } UBTeacherGuideEditionWidget::~UBTeacherGuideEditionWidget() @@ -142,16 +151,52 @@ UBTeacherGuideEditionWidget::~UBTeacherGuideEditionWidget() void UBTeacherGuideEditionWidget::showEvent(QShowEvent* event) { - mpPageTitle->setFocus(); - mpComment->setFocus(); +// mpPageTitle->setFocus(); +// mpComment->setFocus(); setFocus(); QWidget::showEvent(event); } -void UBTeacherGuideEditionWidget::onActiveSceneChanged() +void UBTeacherGuideEditionWidget::onActiveDocumentChanged() +{ + load(UBSvgSubsetAdaptor::sTeacherGuideNode); +} + +void UBTeacherGuideEditionWidget::load(QString element) { cleanData(); + QDomDocument doc("TeacherGuide"); + doc.setContent(element); + + for(QDomElement element = doc.documentElement().firstChildElement(); !element.isNull(); element = element.nextSiblingElement()) { + QString tagName = element.tagName(); + if(tagName == "title") + mpPageTitle->setInitialText(element.attribute("value")); + else if(tagName == "comment") + mpComment->setInitialText(element.attribute("value")); + else if(tagName == "media") + onAddItemClicked(mpAddAMediaItem,0,&element); + else if(tagName == "link") + onAddItemClicked(mpAddALinkItem,0,&element); + else if(tagName == "action") + onAddItemClicked(mpAddAnActionItem,0,&element); + } +} + + + +QDomElement* UBTeacherGuideEditionWidget::save(QDomElement* parentElement) +{ + qDebug() << parentElement; + return 0; +} + +void UBTeacherGuideEditionWidget::onActiveSceneChanged() +{ mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->currentPage())); + UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); + if(mpDocumentTitle) + mpDocumentTitle->setText(documentProxy->metaData(UBSettings::sessionTitle).toString()); } void UBTeacherGuideEditionWidget::cleanData() @@ -165,7 +210,6 @@ void UBTeacherGuideEditionWidget::cleanData() foreach(QTreeWidgetItem* item, children){ DELETEPTR(item); } - } QList UBTeacherGuideEditionWidget::getChildrenList(QTreeWidgetItem* widgetItem) @@ -206,7 +250,7 @@ QVector UBTeacherGuideEditionWidget::getData() return result; } -void UBTeacherGuideEditionWidget::onAddItemClicked(QTreeWidgetItem* widget, int column) +void UBTeacherGuideEditionWidget::onAddItemClicked(QTreeWidgetItem* widget, int column, QDomElement *element) { int addSubItemWidgetType = widget->data(column,Qt::UserRole).toInt(); if(addSubItemWidgetType != eUBTGAddSubItemWidgetType_None){ @@ -217,15 +261,24 @@ void UBTeacherGuideEditionWidget::onAddItemClicked(QTreeWidgetItem* widget, int switch(addSubItemWidgetType) { - case eUBTGAddSubItemWidgetType_Action: - mpTreeWidget->setItemWidget(newWidgetItem,0,new UBTGActionWidget(widget)); + case eUBTGAddSubItemWidgetType_Action:{ + UBTGActionWidget* actionWidget = new UBTGActionWidget(widget); + if(element) actionWidget->initializeWithDom(*element); + mpTreeWidget->setItemWidget(newWidgetItem,0,actionWidget); break; - case eUBTGAddSubItemWidgetType_Media: - mpTreeWidget->setItemWidget(newWidgetItem,0,new UBTGMediaWidget(widget)); + } + case eUBTGAddSubItemWidgetType_Media:{ + UBTGMediaWidget* mediaWidget = new UBTGMediaWidget(widget); + if(element) mediaWidget->initializeWithDom(*element); + mpTreeWidget->setItemWidget(newWidgetItem,0,mediaWidget); break; - case eUBTGAddSubItemWidgetType_Url: - mpTreeWidget->setItemWidget(newWidgetItem,0,new UBTGUrlWidget()); + } + case eUBTGAddSubItemWidgetType_Url:{ + UBTGUrlWidget* urlWidget = new UBTGUrlWidget(); + if(element) urlWidget->initializeWithDom(*element); + mpTreeWidget->setItemWidget(newWidgetItem,0,urlWidget); break; + } default: delete newWidgetItem; qCritical() << "onAddItemClicked no action set"; @@ -296,13 +349,13 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare mpModePushButton->installEventFilter(this); connect(mpModePushButton,SIGNAL(clicked()),parentWidget(),SLOT(changeMode())); - - mpDocumentTitle = new QLabel(this); - mpDocumentTitle->setObjectName("UBTGPresentationDocumentTitle"); - mpDocumentTitle->setText(tr("Document title")); - mpButtonTitleLayout->addWidget(mpModePushButton); - mpButtonTitleLayout->addWidget(mpDocumentTitle); + + if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()){ + mpDocumentTitle = new QLabel(this); + mpDocumentTitle->setObjectName("UBTGPresentationDocumentTitle"); + mpButtonTitleLayout->addWidget(mpDocumentTitle); + } mpLayout->addLayout(mpButtonTitleLayout); @@ -376,14 +429,15 @@ void UBTeacherGuidePresentationWidget::onActiveSceneChanged() { cleanData(); mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->currentPage())); + UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); + if(mpDocumentTitle) + mpDocumentTitle->setText(documentProxy->metaData(UBSettings::sessionTitle).toString()); } void UBTeacherGuidePresentationWidget::createMediaButtonItem() { if(!mpMediaSwitchItem){ - //create the media button mpMediaSwitchItem = new QTreeWidgetItem(mpRootWidgetItem); - //mpMediaSwitchItem->setIcon(0,QIcon(":images/plus.svg")); mpMediaSwitchItem->setText(0,"+"); mpMediaSwitchItem->setExpanded(false); mpMediaSwitchItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_EXPAND); diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 9f67440c..bd43b8b2 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -23,8 +23,11 @@ class QVBoxLayout; class QPushButton; class UBDocumentProxy; + #include "UBTeacherGuideWidgetsTools.h" +#include "interfaces/IDataStorage.h" + typedef enum { tUBTGZeroPageMode_EDITION, @@ -34,7 +37,7 @@ typedef enum /*************************************************************************** * class UBTeacherGuideEditionWidget * ***************************************************************************/ -class UBTeacherGuideEditionWidget : public QWidget +class UBTeacherGuideEditionWidget : public QWidget , public IDataStorage { Q_OBJECT public: @@ -43,8 +46,11 @@ public: void cleanData(); QVector getData(); + void load(QString element); + QDomElement* save(QDomElement* parentElement); + public slots: - void onAddItemClicked(QTreeWidgetItem* widget, int column); + void onAddItemClicked(QTreeWidgetItem* widget, int column, QDomElement* element = 0); void onActiveSceneChanged(); void showEvent(QShowEvent* event); @@ -64,6 +70,9 @@ private: UBAddItem* mpAddAMediaItem; UBAddItem* mpAddALinkItem; +private slots: + void onActiveDocumentChanged(); + }; diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index 2083b1d2..e5c6d657 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -26,6 +26,9 @@ #include "UBTeacherGuideWidgetsTools.h" #include "core/UBPersistenceManager.h" +#include "core/UBApplication.h" + +#include "board/UBBoardController.h" #include "domain/UBW3CWidget.h" @@ -87,6 +90,11 @@ UBTGActionWidget::~UBTGActionWidget() DELETEPTR(mpLayout); } +void UBTGActionWidget::initializeWithDom(QDomElement element) +{ + mpOwner->setCurrentIndex(element.attribute("owner").toInt()); + mpTask->setInitialText(element.attribute("task")); +} tUBGEElementNode* UBTGActionWidget::saveData() { @@ -195,6 +203,12 @@ void UBTGAdaptableText::onTextChanged() } mIsUpdatingSize = false; } +void UBTGAdaptableText::setInitialText(const QString& text) +{ + setText(text); + setReadOnly(false); + onTextChanged(); +} void UBTGAdaptableText::showText(const QString & text) { @@ -266,8 +280,9 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const , mpMediaLabelWidget(NULL) , mpMediaWidget(NULL) , mpWebView(NULL) - , mRelativePath(QString("")) + , mMediaPath(QString("")) , mIsPresentationMode(false) + , mIsInitializationMode(false) { setObjectName(name); mpDropMeWidget = new QLabel(); @@ -280,7 +295,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const setMinimumHeight(250); } -UBTGMediaWidget::UBTGMediaWidget(QString relativePath, QTreeWidgetItem* widget, QWidget* parent,const char* name): QStackedWidget(parent) +UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWidget* parent,const char* name): QStackedWidget(parent) , mpTreeWidgetItem(widget) , mpDropMeWidget(NULL) , mpWorkWidget(NULL) @@ -289,13 +304,14 @@ UBTGMediaWidget::UBTGMediaWidget(QString relativePath, QTreeWidgetItem* widget, , mpMediaLabelWidget(NULL) , mpMediaWidget(NULL) , mpWebView(NULL) - , mRelativePath(relativePath) + , mMediaPath(mediaPath) , mIsPresentationMode(true) , mMediaType("") + , mIsInitializationMode(false) { setObjectName(name); setAcceptDrops(false); - createWorkWidget(mRelativePath); + createWorkWidget(); setFixedHeight(200); } @@ -313,6 +329,17 @@ UBTGMediaWidget::~UBTGMediaWidget() DELETEPTR(mpWorkWidget); } +void UBTGMediaWidget::initializeWithDom(QDomElement element) +{ + mIsInitializationMode = true; + setAcceptDrops(false); + mMediaPath = UBApplication::boardController->activeDocument()->persistencePath() + "/" + element.attribute("relativePath"); + createWorkWidget(); + setFixedHeight(200); + mpTitle->setInitialText(element.attribute("title")); + mIsInitializationMode = false; +} + void UBTGMediaWidget::hideEvent(QHideEvent* event) { if(mpWebView) @@ -323,10 +350,8 @@ void UBTGMediaWidget::hideEvent(QHideEvent* event) void UBTGMediaWidget::showEvent(QShowEvent* event) { QWidget::showEvent(event); - if(mpWebView){ - qDebug() << mRelativePath; - mpWebView->load(QUrl(mRelativePath + "/index.htm")); - } + if(mpWebView) + mpWebView->load(QUrl(mMediaPath + "/index.htm")); } tUBGEElementNode* UBTGMediaWidget::saveData() @@ -336,7 +361,7 @@ tUBGEElementNode* UBTGMediaWidget::saveData() tUBGEElementNode* result = new tUBGEElementNode(); result->type = "media"; result->attributes.insert("title",mpTitle->text()); - result->attributes.insert("relativePath",mRelativePath); + result->attributes.insert("relativePath",mMediaPath); result->attributes.insert("mediaType",mMediaType); return result; } @@ -346,31 +371,40 @@ void UBTGMediaWidget::dragEnterEvent(QDragEnterEvent *event) event->accept(); } -void UBTGMediaWidget::createWorkWidget(QString& path) +void UBTGMediaWidget::createWorkWidget() { - QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(path); + QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(mMediaPath); bool setMedia = true; - mRelativePath = path; + UBDocumentProxy* proxyDocument = UBApplication::boardController->activeDocument(); if(mimeType.contains("audio") || mimeType.contains("video")){ mMediaType = mimeType.contains("audio")? "audio":"movie"; mpMediaWidget = new UBMediaWidget(mimeType.contains("audio")?eMediaType_Audio:eMediaType_Video); - mpMediaWidget->setFile(path); + if(mIsPresentationMode || mIsInitializationMode){ + mpMediaWidget->setFile(mMediaPath); + } + else{ + mMediaPath = UBPersistenceManager::persistenceManager()->addObjectToTeacherGuideDirectory(proxyDocument, mMediaPath); + mpMediaWidget->setFile(mMediaPath); + } } else if(mimeType.contains("image")){ mMediaType = "image"; + if(!(mIsPresentationMode || mIsInitializationMode)) + mMediaPath = UBPersistenceManager::persistenceManager()->addObjectToTeacherGuideDirectory(proxyDocument, mMediaPath); + mpMediaLabelWidget = new QLabel(); - QPixmap pixmap = QPixmap(QUrl(path).toLocalFile()); + QPixmap pixmap = QPixmap(mMediaPath); pixmap = pixmap.scaledToWidth(mpTreeWidgetItem->treeWidget()->size().width()); mpMediaLabelWidget->setPixmap(pixmap); mpMediaLabelWidget->setScaledContents(true); } else if(mimeType.contains("application")){ mMediaType = "w3c"; - if(!mIsPresentationMode){ - QDir baseW3CDirectory("/home/claudio"); - mRelativePath = UBW3CWidget::createNPAPIWrapperInDir(path,baseW3CDirectory,mimeType,QSize(100,100),"flashahaha"); + if(!(mIsPresentationMode || mIsInitializationMode)){ + QDir baseW3CDirectory(UBPersistenceManager::persistenceManager()->teacherGuideAbsoluteObjectPath(proxyDocument)); + mMediaPath = UBW3CWidget::createNPAPIWrapperInDir(mMediaPath,baseW3CDirectory,mimeType,QSize(100,100),QUuid::createUuid()); } - mpWebView = new UBDraggableWeb(mRelativePath); + mpWebView = new UBDraggableWeb(mMediaPath); mpWebView->setAcceptDrops(false); mpWebView->settings()->setAttribute(QWebSettings::JavaEnabled, true); mpWebView->settings()->setAttribute(QWebSettings::PluginsEnabled, true); @@ -380,7 +414,7 @@ void UBTGMediaWidget::createWorkWidget(QString& path) mpWebView->settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); mpWebView->settings()->setAttribute(QWebSettings::DnsPrefetchEnabled, true); - mpWebView->load(QUrl(mRelativePath+"/index.htm")); + mpWebView->load(QUrl(mMediaPath+"/index.htm")); } else{ qDebug() << "createWorkWidget mime type not handled" << mimeType; @@ -420,13 +454,12 @@ void UBTGMediaWidget::createWorkWidget(QString& path) void UBTGMediaWidget::parseMimeData(const QMimeData* pMimeData) { - QString path; if(pMimeData){ if(pMimeData->hasText()){ - path = QUrl::fromLocalFile(pMimeData->text()).toString(); + mMediaPath = QUrl::fromLocalFile(pMimeData->text()).toString(); } else if(pMimeData->hasUrls()){ - path = pMimeData->urls().at(0).toString(); + mMediaPath = pMimeData->urls().at(0).toString(); } else if(pMimeData->hasImage()){ qDebug() << "Not yet implemented"; @@ -435,7 +468,7 @@ void UBTGMediaWidget::parseMimeData(const QMimeData* pMimeData) else qDebug() << "No mime data present"; - createWorkWidget(path); + createWorkWidget(); } void UBTGMediaWidget::dropEvent(QDropEvent* event) @@ -451,9 +484,9 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event) else{ QDrag *drag = new QDrag(this); - QMimeData *mimeData = new QMimeData; + QMimeData *mimeData = new QMimeData(); QList urlList; - urlList << QUrl(mRelativePath); + urlList << QUrl(mMediaPath); mimeData->setUrls(urlList); drag->setMimeData(mimeData); @@ -490,6 +523,12 @@ UBTGUrlWidget::~UBTGUrlWidget() DELETEPTR(mpLayout); } +void UBTGUrlWidget::initializeWithDom(QDomElement element) +{ + mpTitle->setText(element.attribute("title")); + mpUrl->setText(element.attribute("url")); +} + tUBGEElementNode* UBTGUrlWidget::saveData() { tUBGEElementNode* result = new tUBGEElementNode(); diff --git a/src/gui/UBTeacherGuideWidgetsTools.h b/src/gui/UBTeacherGuideWidgetsTools.h index b21fa0e7..b15c2cfc 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.h +++ b/src/gui/UBTeacherGuideWidgetsTools.h @@ -74,6 +74,7 @@ public: ~UBTGActionWidget(); void update(); tUBGEElementNode* saveData(); + void initializeWithDom(QDomElement element); private: QVBoxLayout* mpLayout; @@ -94,6 +95,7 @@ public: void bottomMargin(int newValue); void setPlaceHolderText(QString text); QString text(); + void setInitialText(const QString& text); public slots: void onTextChanged(); @@ -134,9 +136,10 @@ class UBTGMediaWidget : public QStackedWidget , public iUBTGSaveData Q_OBJECT public: UBTGMediaWidget(QTreeWidgetItem* widget = 0, QWidget* parent = 0, const char* name = "UBTGMediaWidget"); - UBTGMediaWidget(QString relativePath, QTreeWidgetItem* widget = 0, QWidget* parent = 0, const char* name = "UBTGMediaWidget"); + UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget = 0, QWidget* parent = 0, const char* name = "UBTGMediaWidget"); ~UBTGMediaWidget(); tUBGEElementNode* saveData(); + void initializeWithDom(QDomElement element); protected: void dragEnterEvent(QDragEnterEvent* event); @@ -147,7 +150,7 @@ protected: private: void parseMimeData(const QMimeData* pMimeData); - void createWorkWidget(QString& path); + void createWorkWidget(); void updateSize(); QTreeWidgetItem* mpTreeWidgetItem; @@ -158,9 +161,10 @@ private: QLabel* mpMediaLabelWidget; UBMediaWidget* mpMediaWidget; UBDraggableWeb* mpWebView; - QString mRelativePath; + QString mMediaPath; bool mIsPresentationMode; QString mMediaType; + bool mIsInitializationMode; }; @@ -171,6 +175,7 @@ public: UBTGUrlWidget(QWidget* parent = 0, const char* name = "UBTGUrlWidget"); ~UBTGUrlWidget(); tUBGEElementNode* saveData(); + void initializeWithDom(QDomElement element); private: QVBoxLayout* mpLayout; QLineEdit* mpTitle; diff --git a/src/interfaces/IDataStorage.h b/src/interfaces/IDataStorage.h index c3795773..02695707 100644 --- a/src/interfaces/IDataStorage.h +++ b/src/interfaces/IDataStorage.h @@ -16,4 +16,12 @@ #ifndef IDATASTORAGE_H #define IDATASTORAGE_H +class QDomElement; + +class IDataStorage +{ +public: + virtual void load(QString element) = 0; + virtual QDomElement* save(QDomElement* parentElement) = 0 ; +}; #endif // IDATASTORAGE_H From 9ed62340ac7f30e1365f29924383087758ad9172 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Sat, 5 May 2012 09:58:05 +0200 Subject: [PATCH 20/42] first implementation of title on scene --- src/domain/UBGraphicsScene.cpp | 64 ++++++++++++++++++++++---------- src/domain/UBGraphicsScene.h | 9 +++-- src/gui/UBTeacherGuideWidget.cpp | 46 ++++++++++++++++++++--- src/gui/UBTeacherGuideWidget.h | 4 +- 4 files changed, 92 insertions(+), 31 deletions(-) diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 1494ce85..e6dbdd1b 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -396,15 +396,15 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre mAddedItems.clear(); mRemovedItems.clear(); - if (UBDrawingController::drawingController()->mActiveRuler) + if (UBDrawingController::drawingController()->mActiveRuler) { UBDrawingController::drawingController()->mActiveRuler->StartLine(scenePos, width); - } - else - { - moveTo(scenePos); + } + else + { + moveTo(scenePos); drawLineTo(scenePos, width, UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Line); - } + } accepted = true; } else if (currentTool == UBStylusTool::Eraser) @@ -590,8 +590,8 @@ bool UBGraphicsScene::inputDeviceRelease() mCurrentStroke = 0; } } - } - + } + if (mRemovedItems.size() > 0 || mAddedItems.size() > 0) { @@ -654,7 +654,7 @@ void UBGraphicsScene::drawPointer(const QPointF &pPoint, bool isFirstDraw) // call this function when user release mouse button in Magnifier mode void UBGraphicsScene::DisposeMagnifierQWidgets() { - if(magniferControlViewWidget) + if(magniferControlViewWidget) { magniferControlViewWidget->hide(); magniferControlViewWidget->setParent(0); @@ -662,7 +662,7 @@ void UBGraphicsScene::DisposeMagnifierQWidgets() magniferControlViewWidget = NULL; } - if(magniferDisplayViewWidget) + if(magniferDisplayViewWidget) { magniferDisplayViewWidget->hide(); magniferDisplayViewWidget->setParent(0); @@ -679,7 +679,7 @@ void UBGraphicsScene::DisposeMagnifierQWidgets() catch (...) { } - + } void UBGraphicsScene::moveTo(const QPointF &pPoint) @@ -711,7 +711,7 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth, } } - if (bLineStyle) + if (bLineStyle) { QSetIterator itItems(mAddedItems); @@ -736,7 +736,7 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth, mPreviousPolygonItems.append(polygonItem); - if (!bLineStyle) + if (!bLineStyle) { mPreviousPoint = pEndPoint; mPreviousWidth = pWidth; @@ -1473,6 +1473,30 @@ UBGraphicsTextItem* UBGraphicsScene::addText(const QString& pString, const QPoin , UBSettings::settings()->isItalicFont()); } +UBGraphicsTextItem* UBGraphicsScene::textForObjectName(const QString& pString, const QString& objectName) +{ + UBGraphicsTextItem* textItem = 0; + bool found = false; + //looking for a previous such item text + for(int i=0; i < mFastAccessItems.count() && !found ; i += 1){ + UBGraphicsTextItem* currentItem = dynamic_cast(mFastAccessItems.at(i)); + if(currentItem && currentItem->objectName() == objectName){ + textItem = currentItem; + found=true; + } + } + if(!textItem){ + textItem = addTextWithFont(pString,QPointF(0,0) ,64,"",true,false); + textItem->setObjectName(objectName); + textItem->Delegate()->setCanDuplicate(false); + } + + textItem->setPlainText(pString); + textItem->adjustSize(); + QSizeF size = textItem->size(); + textItem->setPos(QPointF(-size.width()/2.0,-size.height()/2.0)); + return textItem; +} UBGraphicsTextItem* UBGraphicsScene::addTextWithFont(const QString& pString, const QPointF& pTopLeft , int pointSize, const QString& fontFamily, bool bold, bool italic) @@ -1926,11 +1950,11 @@ void UBGraphicsScene::addCache() } void UBGraphicsScene::addMask(const QPointF ¢er) -{ +{ UBGraphicsCurtainItem* curtain = new UBGraphicsCurtainItem(); // mem : owned and destroyed by the scene mTools << curtain; - addItem(curtain); + addItem(curtain); QRectF rect = UBApplication::boardController->activeScene()->normalizedSceneRect(); rect.setRect(center.x() - rect.width()/4, center.y() - rect.height()/4, rect.width()/2 , rect.height()/2); @@ -2010,7 +2034,7 @@ void UBGraphicsScene::setNominalSize(int pWidth, int pHeight) } void UBGraphicsScene::setSelectedZLevel(QGraphicsItem * item) -{ +{ item->setZValue(mZLayerController->generateZLevel(itemLayerType::SelectedItem)); } void UBGraphicsScene::setOwnZlevel(QGraphicsItem *item) @@ -2180,7 +2204,7 @@ void UBGraphicsScene::keyReleaseEvent(QKeyEvent * keyEvent) UBGraphicsW3CWidgetItem *wc3_widget = dynamic_cast(item); if (0 != wc3_widget) if (!wc3_widget->hasFocus()) - wc3_widget->remove(); + wc3_widget->remove(); break; } case UBGraphicsAppleWidgetItem::Type: @@ -2188,7 +2212,7 @@ void UBGraphicsScene::keyReleaseEvent(QKeyEvent * keyEvent) UBGraphicsAppleWidgetItem *Apple_widget = dynamic_cast(item); if (0 !=Apple_widget) if (!Apple_widget->hasFocus()) - Apple_widget->remove(); + Apple_widget->remove(); break; } case UBGraphicsTextItem::Type: @@ -2196,7 +2220,7 @@ void UBGraphicsScene::keyReleaseEvent(QKeyEvent * keyEvent) UBGraphicsTextItem *text_item = dynamic_cast(item); if (0 != text_item) if (!text_item->hasFocus()) - text_item->remove(); + text_item->remove(); break; } @@ -2206,7 +2230,7 @@ void UBGraphicsScene::keyReleaseEvent(QKeyEvent * keyEvent) if (0 != ubgi) ubgi->remove(); else - UBCoreGraphicsScene::removeItem(item); + UBCoreGraphicsScene::removeItem(item); } } } diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index 4b9d946f..b8de208b 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -133,6 +133,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem UBGraphicsAudioItem* addAudio(const QUrl& pAudioFileUrl, bool shouldPlayAsap, const QPointF& pPos = QPointF(0, 0)); UBGraphicsSvgItem* addSvg(const QUrl& pSvgFileUrl, const QPointF& pPos = QPointF(0, 0)); UBGraphicsTextItem* addText(const QString& pString, const QPointF& pTopLeft = QPointF(0, 0)); + UBGraphicsTextItem* textForObjectName(const QString& pString, const QString &objectName = "UBTGZeroPageSessionTitle"); UBGraphicsTextItem* addTextWithFont(const QString& pString, const QPointF& pTopLeft = QPointF(0, 0) , int pointSize = -1, const QString& fontFamily = "", bool bold = false, bool italic = false); @@ -280,10 +281,10 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem mTools << item; } - const QPointF& previousPoint() - { - return mPreviousPoint; - } + const QPointF& previousPoint() + { + return mPreviousPoint; + } void setSelectedZLevel(QGraphicsItem *item); void setOwnZlevel(QGraphicsItem *item); diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 51c4017d..b7022a73 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -43,6 +43,8 @@ #include "document/UBDocumentProxy.h" #include "document/UBDocumentController.h" +#include "domain/UBGraphicsTextItem.h" + #define UBTG_SEPARATOR_FIXED_HEIGHT 3 typedef enum @@ -193,6 +195,8 @@ QDomElement* UBTeacherGuideEditionWidget::save(QDomElement* parentElement) void UBTeacherGuideEditionWidget::onActiveSceneChanged() { + load(UBSvgSubsetAdaptor::sTeacherGuideNode); + qDebug() << "UBSvgSubsetAdaptor::sTeacherGuideNode " << UBSvgSubsetAdaptor::sTeacherGuideNode; mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->currentPage())); UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); if(mpDocumentTitle) @@ -565,8 +569,10 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons , mpLicenceBox(NULL) , mpLicenceIcon(NULL) , mpLicenceLayout(NULL) + , mpSceneItemSessionTitle(NULL) { setObjectName(name); + QString chapterStyle("QLabel {font-size:16px; font-weight:bold;}"); mpLayout = new QVBoxLayout(this); mpPageNumberLabel = new QLabel(this); @@ -586,7 +592,6 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpSessionTitle = new UBTGAdaptableText(0,this,"UBTGSessionTitle"); mpSessionTitle->setPlaceHolderText(tr("Type session title here ...")); - //mpSessionTitle->setObjectName("UBTGSessionTitle"); mpButtonTitleLayout->addWidget(mpSessionTitle); mpLayout->addLayout(mpButtonTitleLayout); @@ -599,6 +604,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpAuthorsLabel = new QLabel(this); mpAuthorsLabel->setObjectName("UBTGZeroPageEditionModeTitle"); mpAuthorsLabel->setText(tr("Author(s)")); + mpAuthorsLabel->setStyleSheet(chapterStyle); mpLayout->addWidget(mpAuthorsLabel); mpAuthors = new UBTGAdaptableText(0,this); @@ -622,6 +628,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpGoalsLabel = new QLabel(this); mpGoalsLabel->setObjectName("UBTGZeroPageEditionModeTitle"); mpGoalsLabel->setText(tr("Goal(s)")); + mpGoalsLabel->setStyleSheet(chapterStyle); mpLayout->addWidget(mpGoalsLabel); mpGoals = new UBTGAdaptableText(0,this); @@ -637,11 +644,13 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpIndexLabel = new QLabel(this); mpIndexLabel->setObjectName("UBTGZeroPageEditionModeTitle"); mpIndexLabel->setText(tr("Resource indexing")); + mpIndexLabel->setStyleSheet(chapterStyle); mpLayout->addWidget(mpIndexLabel); mpKeywordsLabel = new QLabel(this); mpKeywordsLabel->setObjectName("UBTGZeroPageItemLabel"); mpKeywordsLabel->setText(tr("Keywords:")); + mpKeywordsLabel->setStyleSheet(chapterStyle); mpLayout->addWidget(mpKeywordsLabel); mpKeywords = new UBTGAdaptableText(0,this); mpKeywords->setPlaceHolderText(tr("Type keywords here ...")); @@ -650,6 +659,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpSchoolLevelItemLabel = new QLabel(this); mpSchoolLevelItemLabel->setObjectName("UBTGZeroPageItemLabel"); mpSchoolLevelItemLabel->setText(tr("Level:")); + mpSchoolLevelItemLabel->setStyleSheet(chapterStyle); mpLayout->addWidget(mpSchoolLevelItemLabel); mpSchoolLevelBox = new QComboBox(this); mpSchoolLevelBox->setObjectName("DockPaletteWidgetComboBox"); @@ -661,6 +671,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpSchoolBranchItemLabel = new QLabel(this); mpSchoolBranchItemLabel->setObjectName("UBTGZeroPageItemLabel"); mpSchoolBranchItemLabel->setText(tr("Branch:")); + mpSchoolBranchItemLabel->setStyleSheet(chapterStyle); mpLayout->addWidget(mpSchoolBranchItemLabel); mpSchoolBranchBox = new QComboBox(this); mpSchoolBranchBox->setObjectName("DockPaletteWidgetComboBox"); @@ -671,6 +682,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpSchoolTypeItemLabel = new QLabel(this); mpSchoolTypeItemLabel->setObjectName("UBTGZeroPageItemLabel"); mpSchoolTypeItemLabel->setText(tr("Type:")); + mpSchoolTypeItemLabel->setStyleSheet(chapterStyle); mpLayout->addWidget(mpSchoolTypeItemLabel); mpSchoolTypeBox = new QComboBox(this); mpSchoolTypeBox->setObjectName("DockPaletteWidgetComboBox"); @@ -685,7 +697,8 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpLicenceLabel = new QLabel(this); mpLicenceLabel->setObjectName("UBTGZeroPageItemLabel"); - mpLicenceLabel->setText(tr("Licence:")); + mpLicenceLabel->setText(tr("Licence")); + mpLicenceLabel->setStyleSheet(chapterStyle); mpLayout->addWidget(mpLicenceLabel); mpLicenceBox = new QComboBox(this); mpLicenceBox->setObjectName("DockPaletteWidgetComboBox"); @@ -697,6 +710,8 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpLicenceLayout->addWidget(mpLicenceValueLabel); mpLayout->addLayout(mpLicenceLayout); mpLayout->addStretch(1); + + setLayout(mpLayout); connect(UBApplication::boardController,SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged())); fillComboBoxes(); } @@ -810,10 +825,11 @@ void UBTeacherGuidePageZeroWidget::onActiveSceneChanged() UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); if(documentProxy && UBApplication::boardController->currentPage() == 0){ QDateTime creationDate = documentProxy->documentDate(); - mpCreationLabel->setText(tr("Created the: ") + creationDate.toString(Qt::SystemLocaleShortDate)); + mpCreationLabel->setText(tr("Created the:\n") + creationDate.toString(Qt::SystemLocaleShortDate)); QDateTime updatedDate = documentProxy->lastUpdate(); - mpLastModifiedLabel->setText(tr("Updated the: ") + updatedDate.toString(Qt::SystemLocaleShortDate)); + mpLastModifiedLabel->setText(tr("Updated the:\n") + updatedDate.toString(Qt::SystemLocaleShortDate)); loadData(); + UBApplication::boardController->activeScene()->textForObjectName(mpSessionTitle->text()); } } @@ -860,12 +876,18 @@ void UBTeacherGuidePageZeroWidget::persistData() void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) { if(mode == tUBTGZeroPageMode_EDITION){ + QString inputStyleSheet("QTextEdit { background: white; border-radius: 10px; border: 2px;}"); mpModePushButton->hide(); mpSessionTitle->setReadOnly(false); - mpSessionTitle->setObjectName("UBTGEditionModeSessionTitle"); + mpSessionTitle->setStyleSheet(inputStyleSheet); + QFont titleFont(QApplication::font().family(),11,-1); + mpSessionTitle->document()->setDefaultFont(titleFont); mpAuthors->setReadOnly(false); + mpAuthors->setStyleSheet(inputStyleSheet); mpGoals->setReadOnly(false); + mpGoals->setStyleSheet(inputStyleSheet); mpKeywords->setReadOnly(false); + mpKeywords->setStyleSheet(inputStyleSheet); mpSchoolLevelValueLabel->hide(); mpSchoolLevelBox->show(); mpSchoolBranchValueLabel->hide(); @@ -877,12 +899,23 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) mpLicenceBox->show(); } else{ + QString inputStyleSheet("QTextEdit { background: transparent; border: none;}"); mpModePushButton->show(); mpSessionTitle->setReadOnly(true); - mpSessionTitle->setObjectName("UBTGPresentationSessionTitle"); + UBApplication::boardController->activeScene()->textForObjectName(mpSessionTitle->text()); + mpSessionTitle->setStyleSheet(inputStyleSheet); + mpSessionTitle->setTextColor(QColor(Qt::black)); + QFont titleFont(QApplication::font().family(),14,1); + mpSessionTitle->document()->setDefaultFont(titleFont); mpAuthors->setReadOnly(true); + mpAuthors->setStyleSheet(inputStyleSheet); + mpAuthors->setTextColor(QColor(Qt::black)); mpGoals->setReadOnly(true); + mpGoals->setStyleSheet(inputStyleSheet); + mpGoals->setTextColor(QColor(Qt::black)); mpKeywords->setReadOnly(true); + mpKeywords->setStyleSheet(inputStyleSheet); + mpKeywords->setTextColor(QColor(Qt::black)); mpSchoolLevelValueLabel->setText(mpSchoolLevelBox->currentText()); mpSchoolLevelValueLabel->show(); mpSchoolLevelBox->hide(); @@ -902,6 +935,7 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) mpLicenceBox->hide(); persistData(); } + update(); } QVector UBTeacherGuidePageZeroWidget::getData() diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index bd43b8b2..c8ed2574 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -22,6 +22,7 @@ class QLabel; class QVBoxLayout; class QPushButton; class UBDocumentProxy; +class UBGraphicsTextItem; #include "UBTeacherGuideWidgetsTools.h" @@ -175,6 +176,8 @@ private: QLabel* mpLicenceIcon; QHBoxLayout* mpLicenceLayout; + UBGraphicsTextItem* mpSceneItemSessionTitle; + QMap mGradeLevelsMap; QMap mSubjects; @@ -205,7 +208,6 @@ private: UBTeacherGuideEditionWidget* mpEditionWidget; UBTeacherGuidePresentationWidget* mpPresentationWidget; QVectormCurrentData; - }; #endif // UBTEACHERGUIDEWIDGET_H From f85bb2d5fa767c7bb63c739f45d7a20e86f3aaaf Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Sat, 5 May 2012 10:43:05 +0200 Subject: [PATCH 21/42] the title is found after reloading the document using the text --- src/domain/UBGraphicsScene.cpp | 9 ++++++--- src/gui/UBTeacherGuideWidget.cpp | 11 +++++++++-- src/gui/UBTeacherGuideWidget.h | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index e6dbdd1b..387c7f72 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1480,15 +1480,18 @@ UBGraphicsTextItem* UBGraphicsScene::textForObjectName(const QString& pString, c //looking for a previous such item text for(int i=0; i < mFastAccessItems.count() && !found ; i += 1){ UBGraphicsTextItem* currentItem = dynamic_cast(mFastAccessItems.at(i)); - if(currentItem && currentItem->objectName() == objectName){ + if(currentItem && (currentItem->objectName() == objectName || currentItem->toPlainText() == pString)){ + // The second condition is necessary because the object name isn't stored. On reopeining the file we + // need another rule than the objectName textItem = currentItem; found=true; + if(currentItem->objectName() != objectName) + textItem->setObjectName(objectName); } } if(!textItem){ - textItem = addTextWithFont(pString,QPointF(0,0) ,64,"",true,false); + textItem = addTextWithFont(pString,QPointF(0,0) ,48,"",true,false); textItem->setObjectName(objectName); - textItem->Delegate()->setCanDuplicate(false); } textItem->setPlainText(pString); diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index b7022a73..77e3772d 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -829,7 +829,7 @@ void UBTeacherGuidePageZeroWidget::onActiveSceneChanged() QDateTime updatedDate = documentProxy->lastUpdate(); mpLastModifiedLabel->setText(tr("Updated the:\n") + updatedDate.toString(Qt::SystemLocaleShortDate)); loadData(); - UBApplication::boardController->activeScene()->textForObjectName(mpSessionTitle->text()); + updateSceneTitle(); } } @@ -873,6 +873,13 @@ void UBTeacherGuidePageZeroWidget::persistData() documentProxy->setMetaData(UBSettings::sessionLicence,mpLicenceBox->currentText()); } +void UBTeacherGuidePageZeroWidget::updateSceneTitle() +{ + QString sessionTitle = mpSessionTitle->text(); + if(!sessionTitle.isEmpty()) + UBApplication::boardController->activeScene()->textForObjectName(mpSessionTitle->text()); +} + void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) { if(mode == tUBTGZeroPageMode_EDITION){ @@ -902,7 +909,7 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) QString inputStyleSheet("QTextEdit { background: transparent; border: none;}"); mpModePushButton->show(); mpSessionTitle->setReadOnly(true); - UBApplication::boardController->activeScene()->textForObjectName(mpSessionTitle->text()); + updateSceneTitle(); mpSessionTitle->setStyleSheet(inputStyleSheet); mpSessionTitle->setTextColor(QColor(Qt::black)); QFont titleFont(QApplication::font().family(),14,1); diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index c8ed2574..81fb483f 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -135,6 +135,7 @@ private: void loadData(); void hideEvent(QHideEvent* event); bool eventFilter(QObject* object, QEvent* event); + void updateSceneTitle(); QVBoxLayout* mpLayout; QHBoxLayout* mpButtonTitleLayout; From 7ee53b07ad59a1ee9cd2aa808c27cf2e1272b227 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Sat, 5 May 2012 11:11:33 +0200 Subject: [PATCH 22/42] 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); } From 50a237306f12aacb40f399840f39adc040c9d373 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Sat, 5 May 2012 15:18:01 +0200 Subject: [PATCH 23/42] first merge --- resources/style.qss | 7 + src/adaptors/UBExportCFF.cpp | 1 + src/adaptors/UBThumbnailAdaptor.cpp | 22 +- src/board/UBBoardController.cpp | 27 +- src/board/UBBoardController.h | 1 + src/board/UBBoardPaletteManager.cpp | 26 +- src/board/UBBoardPaletteManager.h | 8 + src/board/UBFeaturesController.cpp | 92 +- src/board/UBFeaturesController.h | 208 ++- src/core/main.cpp | 2 +- src/customWidgets/UBActionableWidget.cpp | 2 + src/customWidgets/UBMediaWidget.cpp | 2 + src/domain/UBAbstractUndoCommand.cpp | 2 + src/domain/UBAngleWidget.cpp | 2 + src/domain/UBGraphicsDelegateFrame.cpp | 1596 +++++++++-------- src/domain/UBGraphicsItemDelegate.cpp | 101 +- src/domain/UBGraphicsItemDelegate.h | 54 +- src/domain/UBGraphicsItemUndoCommand.cpp | 4 +- src/domain/UBGraphicsMediaItem.cpp | 4 +- src/domain/UBGraphicsStrokesGroup.cpp | 2 + src/domain/UBGraphicsTextItemDelegate.cpp | 17 +- src/domain/UBGraphicsVideoItemDelegate.cpp | 687 +++---- src/domain/UBGraphicsVideoItemDelegate.h | 230 +-- src/domain/ubgraphicsgroupcontaineritem.cpp | 2 + .../ubgraphicsgroupcontaineritemdelegate.cpp | 3 +- src/frameworks/UBCoreGraphicsScene.cpp | 3 +- src/gui/UBDockDownloadWidget.cpp | 2 + src/gui/UBDockTeacherGuideWidget.cpp | 2 + src/gui/UBFeaturesActionBar.cpp | 19 + src/gui/UBFeaturesActionBar.h | 3 +- src/gui/UBFeaturesWidget.cpp | 202 ++- src/gui/UBFeaturesWidget.h | 33 +- src/gui/UBLibItemProperties.cpp | 3 +- src/gui/UBLibNavigatorWidget.cpp | 3 +- src/gui/UBLibPathViewer.cpp | 3 +- src/gui/UBLibWebView.cpp | 3 +- src/gui/UBLibWidget.cpp | 3 +- src/gui/UBPageNavigationWidget.cpp | 5 +- src/gui/UBTeacherGuideWidget.cpp | 2 +- src/gui/UBTeacherGuideWidgetsTools.cpp | 2 + src/pdf-merger/CCITTFaxDecode.cpp | 2 + src/pdf-merger/DCTDecode.cpp | 2 + src/pdf-merger/JBIG2Decode.cpp | 1 + src/web/UBOEmbedParser.cpp | 2 + 44 files changed, 1952 insertions(+), 1445 deletions(-) diff --git a/resources/style.qss b/resources/style.qss index 90a78726..9525babb 100644 --- a/resources/style.qss +++ b/resources/style.qss @@ -26,6 +26,13 @@ QWidget#UBLibWebView border: 2px solid #999999; } +QWidget#UBFeaturesWebView +{ + background: #EEEEEE; + border-radius : 10px; + border: 2px solid #999999; +} + QListView { background: #EEEEEE; diff --git a/src/adaptors/UBExportCFF.cpp b/src/adaptors/UBExportCFF.cpp index 741eb871..bc97a730 100644 --- a/src/adaptors/UBExportCFF.cpp +++ b/src/adaptors/UBExportCFF.cpp @@ -3,6 +3,7 @@ #include "document/UBDocumentProxy.h" #include "core/UBDocumentManager.h" #include "core/UBApplication.h" +#include "core/memcheck.h" UBExportCFF::UBExportCFF(QObject *parent) diff --git a/src/adaptors/UBThumbnailAdaptor.cpp b/src/adaptors/UBThumbnailAdaptor.cpp index 2cd1f4de..ff24cfda 100644 --- a/src/adaptors/UBThumbnailAdaptor.cpp +++ b/src/adaptors/UBThumbnailAdaptor.cpp @@ -37,14 +37,14 @@ QList UBThumbnailAdaptor::load(UBDocumentProxy* proxy) { QList thumbnails; - if (!proxy || proxy->persistencePath().size() == 0) + if (!proxy || proxy->persistencePath().isEmpty()) return thumbnails; //compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails 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", UBApplication::boardController->sceneIndexFromPage(existingPageCount)); QFile thumbFile(thumbFileName); @@ -63,7 +63,7 @@ QList UBThumbnailAdaptor::load(UBDocumentProxy* proxy) thumbCount++; if (displayMessage && thumbCount == 1) - UBApplication::showMessage(tr("Generating preview thumbnails ...")); + UBApplication::showMessage(tr("Generating preview thumbnails ...")); persistScene(proxy->persistencePath(), scene, i); } @@ -77,7 +77,7 @@ QList UBThumbnailAdaptor::load(UBDocumentProxy* proxy) //end compatibility with older format bool moreToProcess = true; - int pageCount = 0; + int pageCount = UBApplication::boardController->sceneIndexFromPage(0); while (moreToProcess) { pageCount++; @@ -104,8 +104,8 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index) { int existingPageCount = proxy->pageCount(); - if (!proxy || proxy->persistencePath().size() == 0 || index < 0 || index >= existingPageCount) - return QPixmap(); + if (!proxy || proxy->persistencePath().size() == 0 || index < 0 || index >= existingPageCount) + 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); @@ -127,7 +127,7 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index) thumbCount++; if (displayMessage && thumbCount == 1) - UBApplication::showMessage(tr("Generating preview thumbnails ...")); + UBApplication::showMessage(tr("Generating preview thumbnails ...")); persistScene(proxy->persistencePath(), scene, i); } @@ -144,7 +144,7 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index) QFile file(fileName); if (file.exists()) - { + { QPixmap pix; //Warning. Works only with modified Qt #ifdef Q_WS_X11 @@ -152,9 +152,9 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index) #else pix.load(fileName, 0, Qt::AutoColor, false); #endif - return pix; - } - return QPixmap(); + return pix; + } + return QPixmap(); } void UBThumbnailAdaptor::persistScene(const QString& pDocPath, UBGraphicsScene* pScene, int pageIndex, bool overrideModified) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 90ea9bfa..25f54053 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -163,6 +163,13 @@ int UBBoardController::pageFromSceneIndex(int sceneIndex) return sceneIndex+1; } +int UBBoardController::sceneIndexFromPage(int page) +{ + if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) + return page-1; + return page; +} + void UBBoardController::setupViews() { mControlContainer = new QWidget(mMainWindow->centralWidget()); @@ -686,7 +693,7 @@ void UBBoardController::zoom(const qreal ratio, QPointF scenePoint) void UBBoardController::handScroll(qreal dx, qreal dy) { mControlView->translate(dx, dy); - + UBApplication::applicationController->adjustDisplayView(); emit controlViewportChanged(); @@ -1549,17 +1556,17 @@ void UBBoardController::updateSystemScaleFactor() if (mActiveScene) { QSize pageNominalSize = mActiveScene->nominalSize(); - //we're going to keep scale factor untouched if the size is custom - QMap sizesMap = UBSettings::settings()->documentSizes; - if(pageNominalSize == sizesMap.value(DocumentSizeRatio::Ratio16_9) || pageNominalSize == sizesMap.value(DocumentSizeRatio::Ratio4_3)) - { - QSize controlSize = controlViewport(); + //we're going to keep scale factor untouched if the size is custom + QMap sizesMap = UBSettings::settings()->documentSizes; + if(pageNominalSize == sizesMap.value(DocumentSizeRatio::Ratio16_9) || pageNominalSize == sizesMap.value(DocumentSizeRatio::Ratio4_3)) + { + QSize controlSize = controlViewport(); - qreal hFactor = ((qreal)controlSize.width()) / ((qreal)pageNominalSize.width()); - qreal vFactor = ((qreal)controlSize.height()) / ((qreal)pageNominalSize.height()); + qreal hFactor = ((qreal)controlSize.width()) / ((qreal)pageNominalSize.width()); + qreal vFactor = ((qreal)controlSize.height()) / ((qreal)pageNominalSize.height()); - newScaleFactor = qMin(hFactor, vFactor); - } + newScaleFactor = qMin(hFactor, vFactor); + } } if (mSystemScaleFactor != newScaleFactor) diff --git a/src/board/UBBoardController.h b/src/board/UBBoardController.h index e07549be..5a794b36 100644 --- a/src/board/UBBoardController.h +++ b/src/board/UBBoardController.h @@ -60,6 +60,7 @@ class UBBoardController : public QObject int currentPage(); int pageFromSceneIndex(int sceneIndex); + int sceneIndexFromPage(int page); UBDocumentProxy* activeDocument() { diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index ee10bff6..5212008a 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -58,10 +58,10 @@ #include "UBBoardController.h" -#include "core/memcheck.h" - #include "document/UBDocumentController.h" +#include "core/memcheck.h" + UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardController* pBoardController) : QObject(container) , mKeyboardPalette(0) @@ -81,7 +81,9 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll , mPendingPanButtonPressed(false) , mPendingEraseButtonPressed(false) , mpPageNavigWidget(NULL) +#ifdef USE_WEB_WIDGET , mpLibWidget(NULL) +#endif , mpCachePropWidget(NULL) , mpDownloadWidget(NULL) , mpDesktopLibWidget(NULL) @@ -129,7 +131,12 @@ void UBBoardPaletteManager::setupDockPaletteWidgets() //------------------------------------------------// // Create the widgets for the dock palettes + + mpPageNavigWidget = new UBPageNavigationWidget(); + +#ifdef USE_WEB_WIDGET mpLibWidget = new UBLibWidget(); +#endif mpCachePropWidget = new UBCachePropertiesWidget(); @@ -158,8 +165,11 @@ void UBBoardPaletteManager::setupDockPaletteWidgets() mRightPalette->addTab(mpFeaturesWidget); //Do not show deprecated lib widget to prevent collisions. Uncomment to return lib widget -// mRightPalette->registerWidget(mpLibWidget); -// mRightPalette->addTab(mpLibWidget); + +#ifdef USE_WEB_WIDGET + mRightPalette->registerWidget(mpLibWidget); + mRightPalette->addTab(mpLibWidget); +#endif // The cache widget will be visible only if a cache is put on the page @@ -840,10 +850,10 @@ void UBBoardPaletteManager::addItemToLibrary() } QImage image = mPixmap.toImage(); - if(NULL != mpLibWidget) - { - mpLibWidget->libNavigator()->libraryWidget()->libraryController()->importImageOnLibrary(image); - } +#ifdef USE_WEB_WIDGET + mpLibWidget->libNavigator()->libraryWidget()->libraryController()->importImageOnLibrary(image); +#endif + } else { diff --git a/src/board/UBBoardPaletteManager.h b/src/board/UBBoardPaletteManager.h index 6a1c60a1..45b982de 100644 --- a/src/board/UBBoardPaletteManager.h +++ b/src/board/UBBoardPaletteManager.h @@ -43,6 +43,10 @@ class UBMainWindow; class UBApplicationController; class UBDockTeacherGuideWidget; +// Uncomment this to use old-styles lib paletter +// #define USE_WEB_WIDGET + + class UBBoardPaletteManager : public QObject { Q_OBJECT @@ -125,8 +129,12 @@ class UBBoardPaletteManager : public QObject /** The page navigator widget */ UBPageNavigationWidget* mpPageNavigWidget; + +#ifdef USE_WEB_WIDGET /** The library widget */ UBLibWidget* mpLibWidget; +#endif + /** The cache properties widget */ UBCachePropertiesWidget* mpCachePropWidget; diff --git a/src/board/UBFeaturesController.cpp b/src/board/UBFeaturesController.cpp index 863606da..e25893d8 100644 --- a/src/board/UBFeaturesController.cpp +++ b/src/board/UBFeaturesController.cpp @@ -24,7 +24,15 @@ UBFeature::UBFeature(const QString &url, const QPixmap &icon, const QString &nam } +bool UBFeature::operator ==( const UBFeature &f )const +{ + return virtualPath == f.getUrl() && mName == f.getName() && mPath == f.getFullPath() && elementType == f.getType(); +} +bool UBFeature::operator !=( const UBFeature &f )const +{ + return !(*this == f); +} bool UBFeature::isFolder() const { @@ -32,6 +40,10 @@ bool UBFeature::isFolder() const || elementType == FEATURE_FOLDER; } +bool UBFeature::isDeletable()const +{ + return elementType == FEATURE_ITEM; +} UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) : QObject(pParentWidget), @@ -53,6 +65,7 @@ void UBFeaturesController::initDirectoryTree() mLibInteractiveDirectoryPath = UBSettings::settings()->applicationInteractivesDirectory(); mLibApplicationsDirectoryPath = UBSettings::settings()->applicationApplicationsLibraryDirectory(); mLibShapesDirectoryPath = UBSettings::settings()->applicationShapeLibraryDirectory() ; + mLibSearchDirectoryPath = UBSettings::settings()->userSearchDirectory(); trashDirectoryPath = UBSettings::userTrashDirPath(); featuresList = new QList (); @@ -72,18 +85,24 @@ void UBFeaturesController::initDirectoryTree() trashPath = rootPath + "/Trash"; favoritePath = rootPath + "/Favorites"; - featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/AudiosCategory.svg"), "Audios" , mUserAudioDirectoryPath ) ); - featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/MoviesCategory.svg"), "Movies" , mUserVideoDirectoryPath ) ); - featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/PicturesCategory.svg"), "Pictures" , mUserPicturesDirectoryPath ) ); + audiosElement = UBFeature( rootPath, QPixmap(":images/libpalette/AudiosCategory.svg"), "Audios" , mUserAudioDirectoryPath ); + featuresList->append( audiosElement ); + moviesElement = UBFeature( rootPath, QPixmap(":images/libpalette/MoviesCategory.svg"), "Movies" , mUserVideoDirectoryPath ); + featuresList->append( moviesElement ); + picturesElement = UBFeature( rootPath, QPixmap(":images/libpalette/PicturesCategory.svg"), "Pictures" , mUserPicturesDirectoryPath ); + featuresList->append( picturesElement ); featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/ApplicationsCategory.svg"), "Applications" , mUserInteractiveDirectoryPath ) ); - featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/FlashCategory.svg"), "Animations" , mUserAnimationDirectoryPath ) ); - featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/InteractivesCategory.svg"), "Interactivities" , mLibInteractiveDirectoryPath ) ); + flashElement = UBFeature( rootPath, QPixmap(":images/libpalette/FlashCategory.svg"), "Animations" , mUserAnimationDirectoryPath ); + featuresList->append( flashElement ); + interactElement = UBFeature( rootPath, QPixmap(":images/libpalette/InteractivesCategory.svg"), "Interactivities" , mLibInteractiveDirectoryPath ); + featuresList->append( interactElement ); featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/ShapesCategory.svg"), "Shapes" , mLibShapesDirectoryPath ) ); trashElement = UBFeature( rootPath, QPixmap(":images/libpalette/TrashCategory.svg"), "Trash", trashDirectoryPath, FEATURE_TRASH ); featuresList->append( trashElement ); favoriteElement = UBFeature( rootPath, QPixmap(":images/libpalette/FavoritesCategory.svg"), "Favorites", "favorites", FEATURE_FAVORITE ); featuresList->append( favoriteElement ); - + searchElement = UBFeature( rootPath, QPixmap(":images/libpalette/WebSearchCategory.svg"), "Web search", mLibSearchDirectoryPath ); + featuresList->append( searchElement ); loadFavoriteList(); foreach (UBToolsManager::UBToolDescriptor tool, tools) @@ -105,7 +124,7 @@ void UBFeaturesController::initDirectoryTree() fileSystemScan( mLibShapesDirectoryPath, shapesPath ); fileSystemScan( mLibInteractiveDirectoryPath, interactPath ); fileSystemScan( trashDirectoryPath, trashPath ); - + fileSystemScan( mLibSearchDirectoryPath, rootPath + "/" + "Web search" ); } @@ -120,8 +139,14 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt UBFeatureElementType fileType = fileInfo->isDir() ? FEATURE_FOLDER : FEATURE_ITEM; QString fileName = fileInfo->fileName(); - if ( UBFileSystemUtils::mimeTypeFromFileName(fileName).contains("application") ) { - fileType = FEATURE_INTERACTIVE; + if ( UBFileSystemUtils::mimeTypeFromFileName(fileName).contains("application") ) + { + if ( UBFileSystemUtils::mimeTypeFromFileName(fileName).contains("application/search") ) + { + fileType = FEATURE_SEARCH; + } + else + fileType = FEATURE_INTERACTIVE; } QString itemName = (fileType != FEATURE_ITEM) ? fileName : fileInfo->completeBaseName(); QPixmap icon = QPixmap(":images/libpalette/soundIcon.svg"); @@ -268,6 +293,12 @@ QPixmap UBFeaturesController::thumbnailForFile(const QString &path) return thumb; } +bool UBFeaturesController::isDeletable( const QUrl &url ) +{ + UBFeatureElementType type = fileTypeFromUrl( fileNameFromUrl(url) ); + return type == FEATURE_ITEM; +} + QPixmap UBFeaturesController::createThumbnail(const QString &path) { QString thumbnailPath = UBFileSystemUtils::thumbnailPath(path); @@ -315,7 +346,34 @@ UBFeature UBFeaturesController::newFolder( const QString &name ) void UBFeaturesController::addItemToPage(const UBFeature &item) { - UBApplication::boardController->downloadURL( QUrl::fromLocalFile( item.getFullPath() ) ); + if ( item.getType() == FEATURE_INTERNAL ) + { + UBApplication::boardController->downloadURL( QUrl( item.getFullPath() ) ); + } + else + { + UBApplication::boardController->downloadURL( QUrl::fromLocalFile( item.getFullPath() ) ); + } +} + +UBFeature UBFeaturesController::getDestinationForItem( const QUrl &url ) +{ + QString mimetype = UBFileSystemUtils::mimeTypeFromFileName( fileNameFromUrl(url) ); + + if ( mimetype.contains("audio") ) + return audiosElement; + if ( mimetype.contains("video") ) + return moviesElement; + else if ( mimetype.contains("image") ) + return picturesElement; + else if ( mimetype.contains("application") ) + { + if ( mimetype.contains( "x-shockwave-flash") ) + return flashElement; + else + return interactElement; + } + return UBFeature(); } UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeature &destination ) @@ -331,9 +389,19 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu Q_ASSERT( QFileInfo( sourcePath ).exists() ); + UBFeature possibleDest = getDestinationForItem( url ); + + UBFeature dest = destination; + + if ( destination != trashElement && + !destination.getVirtualPath().startsWith( possibleDest.getVirtualPath(), Qt::CaseInsensitive ) ) + { + dest = possibleDest; + } + QString name = QFileInfo( sourcePath ).fileName(); - QString destPath = destination.getFullPath(); - QString destVirtualPath = destination.getUrl() + "/" + destination.getName(); + QString destPath = dest.getFullPath(); + QString destVirtualPath = dest.getVirtualPath(); QString newFullPath = destPath + "/" + name; QFile( sourcePath ).copy( newFullPath ); diff --git a/src/board/UBFeaturesController.h b/src/board/UBFeaturesController.h index bd0c0870..7569bba6 100644 --- a/src/board/UBFeaturesController.h +++ b/src/board/UBFeaturesController.h @@ -4,117 +4,133 @@ #include #include #include +#include #include #include #include enum UBFeatureElementType { - FEATURE_CATEGORY, - FEATURE_VIRTUALFOLDER, - FEATURE_FOLDER, - FEATURE_INTERACTIVE, - FEATURE_INTERNAL, - FEATURE_ITEM, - FEATURE_TRASH, - FEATURE_FAVORITE + FEATURE_CATEGORY, + FEATURE_VIRTUALFOLDER, + FEATURE_FOLDER, + FEATURE_INTERACTIVE, + FEATURE_INTERNAL, + FEATURE_ITEM, + FEATURE_TRASH, + FEATURE_FAVORITE, + FEATURE_SEARCH }; class UBFeature { -public: - UBFeature() {;} - //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 getFullPath() const { return mPath; } - UBFeatureElementType getType() const { return elementType; } - bool isFolder() const; -private: - QString virtualPath; - QPixmap mThumbnail; - QString mName; - QString mPath; - UBFeatureElementType elementType; + public: + UBFeature() {;} + //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 getFullPath() const { return mPath; } + QString getVirtualPath() const { return virtualPath + "/" + mName; } + UBFeatureElementType getType() const { return elementType; } + bool isFolder() const; + bool isDeletable() const; + bool operator ==( const UBFeature &f )const; + bool operator !=( const UBFeature &f )const; + private: + QString virtualPath; + QPixmap mThumbnail; + QString mName; + QString mPath; + UBFeatureElementType elementType; }; Q_DECLARE_METATYPE( UBFeature ) -class UBFeaturesController : public QObject + class UBFeaturesController : public QObject { -Q_OBJECT -public: - 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 ); -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(); - - static UBFeatureElementType fileTypeFromUrl( const QString &path ); - - QList *featuresList; - UBFeature *rootElement; - - QString mUserAudioDirectoryPath; - QString mUserVideoDirectoryPath; - QString mUserPicturesDirectoryPath; - QString mUserInteractiveDirectoryPath; - QString mUserAnimationDirectoryPath; - - 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; + Q_OBJECT + public: + 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 ); + static bool isDeletable( const QUrl &url ); + 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(); + UBFeature getDestinationForItem( const QUrl &url ); + + static UBFeatureElementType fileTypeFromUrl( const QString &path ); + + QList *featuresList; + UBFeature *rootElement; + + QString mUserAudioDirectoryPath; + QString mUserVideoDirectoryPath; + QString mUserPicturesDirectoryPath; + QString mUserInteractiveDirectoryPath; + QString mUserAnimationDirectoryPath; + + QString libraryPath; + QString mLibAudioDirectoryPath; + QString mLibVideoDirectoryPath; + QString mLibPicturesDirectoryPath; + QString mLibInteractiveDirectoryPath; + QString mLibAnimationDirectoryPath; + QString mLibApplicationsDirectoryPath; + QString mLibShapesDirectoryPath; + QString trashDirectoryPath; + QString mLibSearchDirectoryPath; + + 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; + UBFeature audiosElement; + UBFeature moviesElement; + UBFeature picturesElement; + UBFeature interactElement; + UBFeature flashElement; + UBFeature shapesElement; + UBFeature searchElement; + + QSet *favoriteSet; }; diff --git a/src/core/main.cpp b/src/core/main.cpp index 80c8a989..33cb711c 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) // Uncomment next section to have memory leaks information // tracing in VC++ debug mode under Windows - /* +/* #if defined(_MSC_VER) && defined(_DEBUG) _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif diff --git a/src/customWidgets/UBActionableWidget.cpp b/src/customWidgets/UBActionableWidget.cpp index 78d8ea6b..25c1809e 100644 --- a/src/customWidgets/UBActionableWidget.cpp +++ b/src/customWidgets/UBActionableWidget.cpp @@ -18,6 +18,8 @@ #include "UBActionableWidget.h" +#include "core/memcheck.h" + UBActionableWidget::UBActionableWidget(QWidget *parent, const char *name):QWidget(parent) , mShowActions(false) { diff --git a/src/customWidgets/UBMediaWidget.cpp b/src/customWidgets/UBMediaWidget.cpp index 7c957198..bc3d4f8a 100644 --- a/src/customWidgets/UBMediaWidget.cpp +++ b/src/customWidgets/UBMediaWidget.cpp @@ -16,6 +16,8 @@ #include "globals/UBGlobals.h" #include "UBMediaWidget.h" +#include "core/memcheck.h" + /** * \brief Constructor * @param type as the media type diff --git a/src/domain/UBAbstractUndoCommand.cpp b/src/domain/UBAbstractUndoCommand.cpp index fe623acc..fc5d9fdf 100644 --- a/src/domain/UBAbstractUndoCommand.cpp +++ b/src/domain/UBAbstractUndoCommand.cpp @@ -15,6 +15,8 @@ #include "UBAbstractUndoCommand.h" +#include "core/memcheck.h" + UBAbstractUndoCommand::UBAbstractUndoCommand() { // NOOP diff --git a/src/domain/UBAngleWidget.cpp b/src/domain/UBAngleWidget.cpp index 542a7eed..7be0bf39 100644 --- a/src/domain/UBAngleWidget.cpp +++ b/src/domain/UBAngleWidget.cpp @@ -1,6 +1,8 @@ #include "UBAngleWidget.h" #include +#include "core/memcheck.h" + UBAngleWidget::UBAngleWidget(QWidget *parent) : QWidget(parent) { diff --git a/src/domain/UBGraphicsDelegateFrame.cpp b/src/domain/UBGraphicsDelegateFrame.cpp index bb47e5c6..54dc4650 100644 --- a/src/domain/UBGraphicsDelegateFrame.cpp +++ b/src/domain/UBGraphicsDelegateFrame.cpp @@ -1,794 +1,802 @@ -/* - * 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 3 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 "UBGraphicsDelegateFrame.h" - -#include -#include - -#include "core/UBApplication.h" -#include "core/UBSettings.h" - -#include "domain/UBGraphicsItemDelegate.h" -#include "domain/UBGraphicsScene.h" -#include "domain/UBGraphicsProxyWidget.h" - -#include "gui/UBResources.h" - -#include "core/memcheck.h" - -UBGraphicsDelegateFrame::UBGraphicsDelegateFrame(UBGraphicsItemDelegate* pDelegate, QRectF pRect, qreal pFrameWidth, bool respectRatio) - : QGraphicsRectItem(), QObject(pDelegate) - , mCurrentTool(None) - , mDelegate(pDelegate) - , mVisible(true) - , mFrameWidth(pFrameWidth) - , mNominalFrameWidth(pFrameWidth) - , mRespectRatio(respectRatio) - , mAngle(0) - , mAngleOffset(0) - , mTotalScaleX(-1) - , mTotalScaleY(-1) - , mTranslateX(0) - , mTranslateY(0) - , mTotalTranslateX(0) - , mTotalTranslateY(0) - , mOperationMode(Scaling) - , mMirrorX(false) - , mMirrorY(false) -{ - mAngleTolerance = UBSettings::settings()->angleTolerance->get().toReal(); - - setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); - - setAcceptedMouseButtons(Qt::LeftButton); - setRect(pRect.adjusted(mFrameWidth, mFrameWidth, mFrameWidth * -1, mFrameWidth * -1)); - - setBrush(QBrush(UBSettings::paletteColor)); - setPen(Qt::NoPen); - setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); - - mBottomRightResizeGripSvgItem = new QGraphicsSvgItem(":/images/resize.svg", this); - mBottomResizeGripSvgItem = new QGraphicsSvgItem(":/images/resizeBottom.svg", this); - mLeftResizeGripSvgItem = new QGraphicsSvgItem(":/images/resizeLeft.svg", this); - mRightResizeGripSvgItem = new QGraphicsSvgItem(":/images/resizeRight.svg", this); - mTopResizeGripSvgItem = new QGraphicsSvgItem(":/images/resizeTop.svg", this); - - mBottomRightResizeGrip = new QGraphicsRectItem(this); - mBottomRightResizeGrip->setPen(Qt::NoPen); - mBottomResizeGrip = new QGraphicsRectItem(this); - mBottomResizeGrip->setPen(Qt::NoPen); - mLeftResizeGrip = new QGraphicsRectItem(this); - mLeftResizeGrip->setToolTip("left"); - mLeftResizeGrip->setPen(Qt::NoPen); - mRightResizeGrip = new QGraphicsRectItem(this); - mRightResizeGrip->setPen(Qt::NoPen); - mRightResizeGrip->setToolTip("Right"); - mTopResizeGrip = new QGraphicsRectItem(this); - mTopResizeGrip->setPen(Qt::NoPen); - - mRotateButton = new QGraphicsSvgItem(":/images/rotate.svg", this); - mRotateButton->setCursor(UBResources::resources()->rotateCursor); - mRotateButton->setVisible(mDelegate->canRotate()); - - updateResizeCursors(); - - setAntiScale(1.0); - - positionHandles(); - - this->setAcceptHoverEvents(true); - - angleWidget = new UBAngleWidget(); -} - - -UBGraphicsDelegateFrame::~UBGraphicsDelegateFrame() -{ -delete angleWidget; - // NOOP -} - -void UBGraphicsDelegateFrame::setAntiScale(qreal pAntiScale) -{ - mFrameWidth = mNominalFrameWidth * pAntiScale; - - QTransform tr; - tr.scale(pAntiScale, pAntiScale); - - mBottomRightResizeGripSvgItem->setTransform(tr); - mBottomResizeGripSvgItem->setTransform(tr); - mLeftResizeGripSvgItem->setTransform(tr); - mRightResizeGripSvgItem->setTransform(tr); - mTopResizeGripSvgItem->setTransform(tr); - mRotateButton->setTransform(tr); -} - - -void UBGraphicsDelegateFrame::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - QPainterPath path; - path.addRoundedRect(rect(), mFrameWidth / 2, mFrameWidth / 2); - - if (rect().width() > 1 && rect().height() > 1) - { - QPainterPath extruded; - extruded.addRect(rect().adjusted(mFrameWidth, mFrameWidth, (mFrameWidth * -1), (mFrameWidth * -1))); - path = path.subtracted(extruded); - } - - painter->fillPath(path, brush()); -} - - -QPainterPath UBGraphicsDelegateFrame::shape() const -{ - QPainterPath path; - - //We do not use the rounded rect here because we want the bottom right corner - //to be included in the frame (for resize grip handling : #702) - path.addRect(rect()); - - if (rect().width() > 0 && rect().height() > 0) - { - QPainterPath extruded; - extruded.addRect(rect().adjusted(mFrameWidth, mFrameWidth, mFrameWidth * -1, mFrameWidth * -1)); - path = path.subtracted(extruded); - } - - return path; -} - - -void UBGraphicsDelegateFrame::initializeTransform() -{ - QTransform itemTransform = delegated()->sceneTransform(); - QRectF itemRect = delegated()->boundingRect(); - QPointF topLeft = itemTransform.map(itemRect.topLeft()); - QPointF topRight = itemTransform.map(itemRect.topRight()); - QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft()); - - qreal horizontalFlip = (topLeft.x() > topRight.x()) ? -1 : 1; - mMirrorX = horizontalFlip < 0 ; - if(horizontalFlip < 0){ - // why this is because of the way of calculating the translations that checks which side is the most is the - // nearest instead of checking which one is the left side. - QPointF tmp = topLeft; - topLeft = topRight; - topRight = tmp; - - // because of the calculation of the height is done by lenght and not deltaY - bottomLeft = itemTransform.map(itemRect.bottomRight()); - } - - qreal verticalFlip = (bottomLeft.y() < topLeft.y()) ? -1 : 1; - // not sure that is usefull - mMirrorY = verticalFlip < 0; - if(verticalFlip < 0 && !mMirrorX){ - topLeft = itemTransform.map(itemRect.bottomLeft()); - topRight = itemTransform.map(itemRect.bottomRight()); - bottomLeft = itemTransform.map(itemRect.topLeft()); - } - - QLineF topLine(topLeft, topRight); - QLineF leftLine(topLeft, bottomLeft); - qreal width = topLine.length(); - qreal height = leftLine.length(); - - mAngle = topLine.angle(); - - // the fact the the length is used we loose the horizontalFlip information - // a better way to do this is using DeltaX that preserve the direction information. - mTotalScaleX = (width / itemRect.width()) * horizontalFlip; - mTotalScaleY = height / itemRect.height() * verticalFlip; - - QTransform tr; - QPointF center = delegated()->boundingRect().center(); - tr.translate(center.x() * mTotalScaleX, center.y() * mTotalScaleY); - tr.rotate(-mAngle); - tr.translate(-center.x() * mTotalScaleX, -center.y() * mTotalScaleY); - tr.scale(mTotalScaleX, mTotalScaleY); - - mTotalTranslateX = delegated()->transform().dx() - tr.dx(); - mTotalTranslateY = delegated()->transform().dy() - tr.dy(); -} - - -void UBGraphicsDelegateFrame::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - mDelegate->startUndoStep(); - - mStartingPoint = event->scenePos(); - - initializeTransform(); - - mScaleX = 1; - mScaleY = 1; - mTranslateX = 0; - mTranslateY = 0; - mAngleOffset = 0; - - mInitialTransform = buildTransform(); - - mCurrentTool = toolFromPos(event->pos()); - - event->accept(); -} - -bool UBGraphicsDelegateFrame::canResizeBottomRight(qreal width, qreal height, qreal scaleFactor) -{ - bool res = false; - - if(!mMirrorX && !mMirrorX && ((width * scaleFactor) > 2*mFrameWidth && (height * scaleFactor) > 2*mFrameWidth)){ - res = true; - }else if(mMirrorX && !mMirrorY && (-width * scaleFactor) > 2*mFrameWidth && (height*scaleFactor) > 2*mFrameWidth){ - res = true; - }else if(!mMirrorX && mMirrorY && (width * scaleFactor) > 2*mFrameWidth && (-height*scaleFactor) > 2*mFrameWidth){ - res = true; - }else if(mMirrorX && mMirrorY && (-width * scaleFactor) > 2*mFrameWidth && (-height*scaleFactor) > 2*mFrameWidth){ - res = true; - } - - return res; -} - -void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - QLineF move(mStartingPoint, event->scenePos()); - qreal moveX = move.length() * cos((move.angle() - mAngle) * PI / 180); - qreal moveY = -move.length() * sin((move.angle() - mAngle) * PI / 180); - qreal width = delegated()->boundingRect().width() * mTotalScaleX; - qreal height = delegated()->boundingRect().height() * mTotalScaleY; - - if(mOperationMode == Scaling) - { - mTranslateX = moveX; - // Perform the resize - if (resizingBottomRight()) - { - // ----------------------------------------------------- - // ! We want to keep the aspect ratio with this resize ! - // ----------------------------------------------------- - qreal scaleX; - qreal scaleY; - - if(!mMirrorX){ - scaleX = (width + moveX) / width; - }else{ - scaleX = (width - moveX) / width; - } - - if(!mMirrorY){ - scaleY = (height + moveY) / height; - }else{ - scaleY = (height - moveY) / height; - } - - qreal scaleFactor = (scaleX + scaleY) / 2; - - // Do not allow resizing of image size under frame size - if (canResizeBottomRight(width, height, scaleFactor)) - { - if (mRespectRatio) - { - mScaleX = scaleFactor; - mScaleY = scaleFactor; - } - else - { - mScaleX = scaleX; - mScaleY = scaleY; - } - } - }else if (resizingLeft() || resizingRight()) - { - if(width != 0){ - qreal scaleX = 0.0; - if(resizingLeft()){ - scaleX = (width - moveX) / width; - }else if(resizingRight()){ - scaleX = (width + moveX) / width; - } - if(mDelegate->isFlippable() && qAbs(scaleX) != 0){ - if((qAbs(width * scaleX)) < 2*mFrameWidth){ - bool negative = (scaleX < 0)?true:false; - if(negative){ - if(mMirrorX) - scaleX = 2*mFrameWidth/width; - else - scaleX = -2*mFrameWidth/width; - }else{ - scaleX = -1; - } - } - mScaleX = scaleX; - }else if (scaleX > 1 || (width * scaleX) > 2 * mFrameWidth){ - mScaleX = scaleX; - if(resizingLeft()){ - mTranslateX = moveX; - } - } - } - }else if(resizingTop() || resizingBottom()){ - if(height != 0){ - qreal scaleY = 0.0; - if(resizingTop()){ - scaleY = (height - moveY) / height; - }else if(resizingBottom()){ - scaleY = (height + moveY) / height; - } - - if(mDelegate->isFlippable() && qAbs(scaleY) != 0){ - if((qAbs(height * scaleY)) < 2*mFrameWidth){ - bool negative = (scaleY < 0)?true:false; - if(negative){ - if(mMirrorY) - scaleY = 2*mFrameWidth/width; - else - scaleY = -2*mFrameWidth/width; - }else{ - scaleY = -1; - } - } - mScaleY = scaleY; - }else if (scaleY > 1 || (height * scaleY) > 2 * mFrameWidth) - { - mScaleY = scaleY; - if(resizingTop()){ - mTranslateY = moveY; - } - } - } - } - } - else if (mOperationMode == Resizing) - { - mTranslateX = moveX; - UBResizableGraphicsItem* resizableItem = dynamic_cast(delegated()); - - if (resizableItem) - { - QLineF mousePosDelta(delegated()->mapFromScene(event->lastScenePos()) - , delegated()->mapFromScene(event->scenePos())); - QSizeF incVector(0, 0); - - if (resizingBottomRight()) - { - incVector = QSizeF(mousePosDelta.dx(), mousePosDelta.dy()); - } - else if (resizingRight()) - { - incVector = QSizeF(mousePosDelta.dx(), 0); - } - else if (resizingBottom()) - { - incVector = QSizeF(0, mousePosDelta.dy()); - } - else if (resizingLeft()) - { - incVector = QSizeF(- mousePosDelta.dx(), 0); - } - else if (resizingTop()) - { - incVector = QSizeF(0, - mousePosDelta.dy()); - } - - QSizeF newSize = resizableItem->size() + incVector; - - resizableItem->resize(newSize); - } - } - - if (rotating()) - { - mTranslateX = 0; - mTranslateY = 0; - - QLineF startLine(sceneBoundingRect().center(), event->lastScenePos()); - QLineF currentLine(sceneBoundingRect().center(), event->scenePos()); - mAngle += startLine.angleTo(currentLine); - - if ((int)mAngle % 45 >= 45 - mAngleTolerance || (int)mAngle % 45 <= mAngleTolerance) - { - mAngle = qRound(mAngle / 45) * 45; - mAngleOffset += startLine.angleTo(currentLine); - if ((int)mAngleOffset % 360 > mAngleTolerance && (int)mAngleOffset % 360 < 360 - mAngleTolerance) - { - mAngle += mAngleOffset; - mAngleOffset = 0; - } - } - else if ((int)mAngle % 30 >= 30 - mAngleTolerance || (int)mAngle % 30 <= mAngleTolerance) - { - mAngle = qRound(mAngle / 30) * 30; - mAngleOffset += startLine.angleTo(currentLine); - if ((int)mAngleOffset % 360 > mAngleTolerance && (int)mAngleOffset % 360 < 360 - mAngleTolerance) - { - mAngle += mAngleOffset; - mAngleOffset = 0; - } - } - - if (!angleWidget->isVisible()) - angleWidget->show(); - - angleWidget->setText(QString::number((int)mAngle % 360)); - angleWidget->update(); - - } - else if (moving()) - { - mTranslateX = move.dx(); - mTranslateY = move.dy(); - } - - QTransform tr = buildTransform(); - - //TODO UB 4.x: Could find a better solution ? - if (resizingRight() || resizingBottom() || resizingBottomRight()) - { - QPointF ref; - if(!mMirrorX && !mMirrorY){ - ref = delegated()->boundingRect().topLeft(); - }else if(mMirrorX && !mMirrorY){ - ref = delegated()->boundingRect().topLeft(); - }else if(!mMirrorX && mMirrorY){ - ref = delegated()->boundingRect().topLeft(); - }else if(mMirrorX && mMirrorY){ - ref = delegated()->boundingRect().topRight(); - } - - // Map the item topleft point to the current mouse move transform - QPointF topLeft = tr.map(ref); - - // Map the item topleft point to the mouse press transform - QPointF fixedPoint = mInitialTransform.map(ref); - - // Update the translation coordinates - mTranslateX += fixedPoint.x() - topLeft.x(); - mTranslateY += fixedPoint.y() - topLeft.y(); - - // Update the transform - tr = buildTransform(); - } - else if (resizingTop() || resizingLeft()) - { - if (mOperationMode == Scaling) - { - QPointF bottomRight = tr.map(delegated()->boundingRect().bottomRight()); - QPointF fixedPoint = mInitialTransform.map(delegated()->boundingRect().bottomRight()); - mTranslateX += fixedPoint.x() - bottomRight.x(); - mTranslateY += fixedPoint.y() - bottomRight.y(); - } - else - { - QLineF vector; - if (resizingLeft()) - { - QPointF topRight1 = mInitialTransform.map(QPointF(delegated()->boundingRect().width() - moveX, 0)); - QPointF topRight2 = mInitialTransform.map(QPointF(delegated()->boundingRect().width(), 0)); - vector.setPoints(topRight1, topRight2); - } - else - { - QPointF bottomLeft1 = mInitialTransform.map(QPointF(0, delegated()->boundingRect().height() - moveY)); - QPointF bottomLeft2 = mInitialTransform.map(QPointF(0, delegated()->boundingRect().height())); - vector.setPoints(bottomLeft1, bottomLeft2); - } - mTranslateX = vector.dx(); - mTranslateY = vector.dy(); - } - tr = buildTransform(); - } - - delegated()->setTransform(tr); - event->accept(); -} - - -QTransform UBGraphicsDelegateFrame::buildTransform() -{ - QTransform tr; - QPointF center = delegated()->boundingRect().center(); - - // Translate - tr.translate(mTotalTranslateX + mTranslateX, mTotalTranslateY + mTranslateY); - - // Set angle - tr.translate(center.x() * mTotalScaleX * mScaleX, center.y() * mTotalScaleY * mScaleY); - tr.rotate(-mAngle); - tr.translate(-center.x() * mTotalScaleX * mScaleX, -center.y() * mTotalScaleY * mScaleY); - - // Scale - tr.scale(mTotalScaleX * mScaleX, mTotalScaleY * mScaleY); - return tr; -} - - -void UBGraphicsDelegateFrame::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - if (angleWidget->isVisible()) - angleWidget->hide(); - - updateResizeCursors(); - - mDelegate->commitUndoStep(); - mTotalScaleX *= mScaleX; - mTotalScaleY *= mScaleY; - mTotalTranslateX += mTranslateX; - mTotalTranslateY += mTranslateY; - event->accept(); - - mCurrentTool = None; - QGraphicsRectItem::mouseReleaseEvent(event); - - // Show the buttons - if(isResizing()){ - mResizing = false; - } - mDelegate->setButtonsVisible(true); -} - - -void UBGraphicsDelegateFrame::updateResizeCursors() -{ - QPixmap pix(":/images/cursors/resize.png"); - QTransform tr; - - tr.rotate(-mAngle); - QCursor resizeCursor = QCursor(pix.transformed(tr, Qt::SmoothTransformation), pix.width() / 2, pix.height() / 2); - mLeftResizeGrip->setCursor(resizeCursor); - mRightResizeGrip->setCursor(resizeCursor); - - tr.rotate(-90); - resizeCursor = QCursor(pix.transformed(tr, Qt::SmoothTransformation), pix.width() / 2, pix.height() / 2); - mBottomResizeGrip->setCursor(resizeCursor); - mTopResizeGrip->setCursor(resizeCursor); - - tr.rotate(-45); - resizeCursor = QCursor(pix.transformed(tr, Qt::SmoothTransformation), pix.width() / 2, pix.height() / 2); - mBottomRightResizeGrip->setCursor(resizeCursor); -} - - -void UBGraphicsDelegateFrame::setVisible(bool visible) -{ - mVisible = visible; - if (mVisible) - setBrush(QBrush(UBSettings::paletteColor)); - else - setBrush(Qt::NoBrush); -} - - -void UBGraphicsDelegateFrame::positionHandles() -{ - QRectF itemRect = delegated()->boundingRect(); - QTransform itemTransform = delegated()->sceneTransform(); - QPointF topLeft = itemTransform.map(itemRect.topLeft()); - QPointF topRight = itemTransform.map(itemRect.topRight()); - QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft()); - QPointF bottomRight = itemTransform.map(itemRect.bottomRight()); - QPointF center = itemTransform.map(itemRect.center()); - int rotateHeight = QLineF(topLeft, bottomLeft).length(); - - // Handle the mirroring - if(topLeft.x() > topRight.x()){ - QPointF topTmp = topRight; - QPointF bottomTmp = bottomRight; - topRight = topLeft; - topLeft = topTmp; - bottomRight = bottomLeft; - bottomLeft = bottomTmp; - } - - if(bottomLeft.y() > topLeft.y()){ - QPointF leftTmp = bottomLeft; - QPointF rightTmp = bottomRight; - bottomLeft = topLeft; - topLeft = leftTmp; - bottomRight = topRight; - topRight = rightTmp; - } - - QLineF topLine(topLeft, topRight); - qreal angle = topLine.angle(); - qreal width = topLine.length(); - - QLineF leftLine(topLeft, bottomLeft); - qreal height = leftLine.length(); - - int h = rotating()?rotateHeight:height; - - if (mVisible) - { - setRect(center.x() - mFrameWidth - width / 2, center.y() - mFrameWidth - h / 2, width + 2 * mFrameWidth, h + 2 * mFrameWidth); - } - else - { - setRect(center.x() - width / 2, center.y() - h / 2, width, h); - } - - resetTransform(); - translate(center.x(), center.y()); - rotate(-angle); - translate(-center.x(), -center.y()); - - mBottomRightResizeGripSvgItem->setParentItem(this); - mBottomResizeGripSvgItem->setParentItem(this); - mLeftResizeGripSvgItem->setParentItem(this); - mRightResizeGripSvgItem->setParentItem(this); - mTopResizeGripSvgItem->setParentItem(this); - mRotateButton->setParentItem(this); - - mBottomRightResizeGrip->setParentItem(this); - mBottomResizeGrip->setParentItem(this); - mLeftResizeGrip->setParentItem(this); - mRightResizeGrip->setParentItem(this); - mTopResizeGrip->setParentItem(this); - - QRectF brRect = mBottomRightResizeGripSvgItem->mapRectToParent(mBottomRightResizeGripSvgItem->boundingRect()); - QRectF bRect = mBottomResizeGripSvgItem->mapRectToParent(mBottomResizeGripSvgItem->boundingRect()); - QRectF lRect = mLeftResizeGripSvgItem->mapRectToParent(mLeftResizeGripSvgItem->boundingRect()); - QRectF rRect = mRightResizeGripSvgItem->mapRectToParent(mRightResizeGripSvgItem->boundingRect()); - QRectF trRect = mTopResizeGripSvgItem->mapRectToParent(mTopResizeGripSvgItem->boundingRect()); - - mBottomRightResizeGripSvgItem->setPos(rect().right() - brRect.width(), rect().bottom() - brRect.height()); - mBottomResizeGripSvgItem->setPos(rect().center().x() - bRect.width() / 2, rect().bottom() - bRect.height()); - - mLeftResizeGripSvgItem->setPos(rect().left(), rect().center().y() - lRect.height() / 2); - mRightResizeGripSvgItem->setPos(rect().right() - rRect.width(), rect().center().y() - rRect.height() / 2); - - mTopResizeGripSvgItem->setPos(rect().center().x() - trRect.width() / 2, rect().y()); - mRotateButton->setPos(rect().right() - mFrameWidth - 5, rect().top() + 5); - - mBottomRightResizeGrip->setRect(bottomRightResizeGripRect()); - mBottomResizeGrip->setRect(bottomResizeGripRect()); - mLeftResizeGrip->setRect(leftResizeGripRect()); - mRightResizeGrip->setRect(rightResizeGripRect()); - mTopResizeGrip->setRect(topResizeGripRect()); - - QVariant vLocked = delegated()->data(UBGraphicsItemData::ItemLocked); - bool isLocked = (vLocked.isValid() && vLocked.toBool()); - - mBottomRightResizeGripSvgItem->setVisible(!isLocked); - mBottomResizeGripSvgItem->setVisible(!isLocked); - mLeftResizeGripSvgItem->setVisible(!isLocked); - mRightResizeGripSvgItem->setVisible(!isLocked); - mTopResizeGripSvgItem->setVisible(!isLocked); - mRotateButton->setVisible(mDelegate->canRotate() && !isLocked); - - mBottomRightResizeGrip->setVisible(!isLocked); - mBottomResizeGrip->setVisible(!isLocked); - mLeftResizeGrip->setVisible(!isLocked); - mRightResizeGrip->setVisible(!isLocked); - mTopResizeGrip->setVisible(!isLocked); - - if (isLocked) - { - QColor baseColor = UBSettings::paletteColor; - baseColor.setAlphaF(baseColor.alphaF() / 3); - setBrush(QBrush(baseColor)); - } - else - { - setBrush(QBrush(UBSettings::paletteColor)); - } - - //make frame interact like delegated item when selected. Maybe should be deleted if selection logic will change - setZValue(delegated()->zValue()); -} - - -QGraphicsItem* UBGraphicsDelegateFrame::delegated() -{ - return mDelegate->delegated(); -} - -UBGraphicsDelegateFrame::FrameTool UBGraphicsDelegateFrame::toolFromPos(QPointF pos) -{ - if(mDelegate->isLocked()) - return None; - else if (bottomRightResizeGripRect().contains(pos)) - return ResizeBottomRight; - else if (bottomResizeGripRect().contains(pos)){ - if(mMirrorY){ - return ResizeTop; - }else{ - return ResizeBottom; - } - } - else if (leftResizeGripRect().contains(pos)){ - if(mMirrorX){ - return ResizeRight; - }else{ - return ResizeLeft; - } - return ResizeLeft; - } - else if (rightResizeGripRect().contains(pos)){ - if(mMirrorX){ - return ResizeLeft; - }else{ - return ResizeRight; - } - } - else if (topResizeGripRect().contains(pos)){ - if(mMirrorY){ - return ResizeBottom; - }else{ - return ResizeTop; - } - } - else if (rotateButtonBounds().contains(pos) && mDelegate && mDelegate->canRotate()) - return Rotate; - else - return Move; -} - - -QRectF UBGraphicsDelegateFrame::bottomRightResizeGripRect() const -{ - return QRectF(rect().right() - mFrameWidth, rect().bottom() - mFrameWidth, mFrameWidth, mFrameWidth); -} - - -QRectF UBGraphicsDelegateFrame::bottomResizeGripRect() const -{ - return QRectF(rect().center().x() - mFrameWidth / 2, rect().bottom() - mFrameWidth, mFrameWidth, mFrameWidth); -} - - -QRectF UBGraphicsDelegateFrame::leftResizeGripRect() const -{ - return QRectF(rect().left(), rect().center().y() - mFrameWidth / 2, mFrameWidth, mFrameWidth); -} - - -QRectF UBGraphicsDelegateFrame::rightResizeGripRect() const -{ - return QRectF(rect().right() - mFrameWidth, rect().center().y() - mFrameWidth / 2, mFrameWidth, mFrameWidth); -} - - -QRectF UBGraphicsDelegateFrame::topResizeGripRect() const -{ - return QRectF(rect().center().x() - mFrameWidth / 2, rect().top(), mFrameWidth, mFrameWidth); -} - - -QRectF UBGraphicsDelegateFrame::rotateButtonBounds() const -{ - return QRectF(rect().right()- mFrameWidth, rect().top(), mFrameWidth, mFrameWidth); -} - -void UBGraphicsDelegateFrame::refreshGeometry() -{ - // Here we want to have the left on the left, the right on the right, the top on the top and the bottom on the bottom! - QRectF itemRect = delegated()->boundingRect(); - QTransform itemTransform = delegated()->sceneTransform(); - QPointF topLeft = itemTransform.map(itemRect.topLeft()); - QPointF topRight = itemTransform.map(itemRect.topRight()); - QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft()); - - QLineF topLine(topLeft, topRight); - qreal width = topLine.length(); - QLineF leftLine(topLeft, bottomLeft); - qreal height = leftLine.length(); - setRect(topRight.x() - mFrameWidth, topLeft.y() - mFrameWidth, width + 2*mFrameWidth, height + 2*mFrameWidth); -} +/* + * 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 3 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 "UBGraphicsDelegateFrame.h" + +#include +#include + +#include "core/UBApplication.h" +#include "core/UBSettings.h" + +#include "domain/UBGraphicsItemDelegate.h" +#include "domain/UBGraphicsScene.h" +#include "domain/UBGraphicsProxyWidget.h" + +#include "gui/UBResources.h" + +#include "core/memcheck.h" + +UBGraphicsDelegateFrame::UBGraphicsDelegateFrame(UBGraphicsItemDelegate* pDelegate, QRectF pRect, qreal pFrameWidth, bool respectRatio) + : QGraphicsRectItem(), QObject(pDelegate) + , mCurrentTool(None) + , mDelegate(pDelegate) + , mVisible(true) + , mFrameWidth(pFrameWidth) + , mNominalFrameWidth(pFrameWidth) + , mRespectRatio(respectRatio) + , mAngle(0) + , mAngleOffset(0) + , mTotalScaleX(-1) + , mTotalScaleY(-1) + , mTranslateX(0) + , mTranslateY(0) + , mTotalTranslateX(0) + , mTotalTranslateY(0) + , mOperationMode(Scaling) + , mMirrorX(false) + , mMirrorY(false) +{ + mAngleTolerance = UBSettings::settings()->angleTolerance->get().toReal(); + + setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); + + setAcceptedMouseButtons(Qt::LeftButton); + setRect(pRect.adjusted(mFrameWidth, mFrameWidth, mFrameWidth * -1, mFrameWidth * -1)); + + setBrush(QBrush(UBSettings::paletteColor)); + setPen(Qt::NoPen); + setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); + + mBottomRightResizeGripSvgItem = new QGraphicsSvgItem(":/images/resize.svg", this); + mBottomResizeGripSvgItem = new QGraphicsSvgItem(":/images/resizeBottom.svg", this); + mLeftResizeGripSvgItem = new QGraphicsSvgItem(":/images/resizeLeft.svg", this); + mRightResizeGripSvgItem = new QGraphicsSvgItem(":/images/resizeRight.svg", this); + mTopResizeGripSvgItem = new QGraphicsSvgItem(":/images/resizeTop.svg", this); + + mBottomRightResizeGrip = new QGraphicsRectItem(this); + mBottomRightResizeGrip->setPen(Qt::NoPen); + mBottomResizeGrip = new QGraphicsRectItem(this); + mBottomResizeGrip->setPen(Qt::NoPen); + mLeftResizeGrip = new QGraphicsRectItem(this); + mLeftResizeGrip->setToolTip("left"); + mLeftResizeGrip->setPen(Qt::NoPen); + mRightResizeGrip = new QGraphicsRectItem(this); + mRightResizeGrip->setPen(Qt::NoPen); + mRightResizeGrip->setToolTip("Right"); + mTopResizeGrip = new QGraphicsRectItem(this); + mTopResizeGrip->setPen(Qt::NoPen); + + mRotateButton = new QGraphicsSvgItem(":/images/rotate.svg", this); + mRotateButton->setCursor(UBResources::resources()->rotateCursor); + mRotateButton->setVisible(mDelegate->canRotate()); + + updateResizeCursors(); + + setAntiScale(1.0); + + positionHandles(); + + this->setAcceptHoverEvents(true); + + angleWidget = new UBAngleWidget(); +} + + +UBGraphicsDelegateFrame::~UBGraphicsDelegateFrame() +{ +delete angleWidget; + // NOOP +} + +void UBGraphicsDelegateFrame::setAntiScale(qreal pAntiScale) +{ + mFrameWidth = mNominalFrameWidth * pAntiScale; + + QTransform tr; + tr.scale(pAntiScale, pAntiScale); + + mBottomRightResizeGripSvgItem->setTransform(tr); + mBottomResizeGripSvgItem->setTransform(tr); + mLeftResizeGripSvgItem->setTransform(tr); + mRightResizeGripSvgItem->setTransform(tr); + mTopResizeGripSvgItem->setTransform(tr); + mRotateButton->setTransform(tr); +} + + +void UBGraphicsDelegateFrame::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + + QPainterPath path; + path.addRoundedRect(rect(), mFrameWidth / 2, mFrameWidth / 2); + + if (rect().width() > 1 && rect().height() > 1) + { + QPainterPath extruded; + extruded.addRect(rect().adjusted(mFrameWidth, mFrameWidth, (mFrameWidth * -1), (mFrameWidth * -1))); + path = path.subtracted(extruded); + } + + painter->fillPath(path, brush()); +} + + +QPainterPath UBGraphicsDelegateFrame::shape() const +{ + QPainterPath path; + + //We do not use the rounded rect here because we want the bottom right corner + //to be included in the frame (for resize grip handling : #702) + path.addRect(rect()); + + if (rect().width() > 0 && rect().height() > 0) + { + QPainterPath extruded; + extruded.addRect(rect().adjusted(mFrameWidth, mFrameWidth, mFrameWidth * -1, mFrameWidth * -1)); + path = path.subtracted(extruded); + } + + return path; +} + + +void UBGraphicsDelegateFrame::initializeTransform() +{ + QTransform itemTransform = delegated()->sceneTransform(); + QRectF itemRect = delegated()->boundingRect(); + QPointF topLeft = itemTransform.map(itemRect.topLeft()); + QPointF topRight = itemTransform.map(itemRect.topRight()); + QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft()); + + qreal horizontalFlip = (topLeft.x() > topRight.x()) ? -1 : 1; + mMirrorX = horizontalFlip < 0 ; + if(horizontalFlip < 0){ + // why this is because of the way of calculating the translations that checks which side is the most is the + // nearest instead of checking which one is the left side. + QPointF tmp = topLeft; + topLeft = topRight; + topRight = tmp; + + // because of the calculation of the height is done by lenght and not deltaY + bottomLeft = itemTransform.map(itemRect.bottomRight()); + } + + qreal verticalFlip = (bottomLeft.y() < topLeft.y()) ? -1 : 1; + // not sure that is usefull + mMirrorY = verticalFlip < 0; + if(verticalFlip < 0 && !mMirrorX){ + topLeft = itemTransform.map(itemRect.bottomLeft()); + topRight = itemTransform.map(itemRect.bottomRight()); + bottomLeft = itemTransform.map(itemRect.topLeft()); + } + + QLineF topLine(topLeft, topRight); + QLineF leftLine(topLeft, bottomLeft); + qreal width = topLine.length(); + qreal height = leftLine.length(); + + mAngle = topLine.angle(); + + // the fact the the length is used we loose the horizontalFlip information + // a better way to do this is using DeltaX that preserve the direction information. + mTotalScaleX = (width / itemRect.width()) * horizontalFlip; + mTotalScaleY = height / itemRect.height() * verticalFlip; + + QTransform tr; + QPointF center = delegated()->boundingRect().center(); + tr.translate(center.x() * mTotalScaleX, center.y() * mTotalScaleY); + tr.rotate(-mAngle); + tr.translate(-center.x() * mTotalScaleX, -center.y() * mTotalScaleY); + tr.scale(mTotalScaleX, mTotalScaleY); + + mTotalTranslateX = delegated()->transform().dx() - tr.dx(); + mTotalTranslateY = delegated()->transform().dy() - tr.dy(); +} + + +void UBGraphicsDelegateFrame::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + mDelegate->startUndoStep(); + + mStartingPoint = event->scenePos(); + + initializeTransform(); + + mScaleX = 1; + mScaleY = 1; + mTranslateX = 0; + mTranslateY = 0; + mAngleOffset = 0; + + mInitialTransform = buildTransform(); + + mCurrentTool = toolFromPos(event->pos()); + + event->accept(); +} + +bool UBGraphicsDelegateFrame::canResizeBottomRight(qreal width, qreal height, qreal scaleFactor) +{ + bool res = false; + + if(!mMirrorX && !mMirrorX && ((width * scaleFactor) > 2*mFrameWidth && (height * scaleFactor) > 2*mFrameWidth)){ + res = true; + }else if(mMirrorX && !mMirrorY && (-width * scaleFactor) > 2*mFrameWidth && (height*scaleFactor) > 2*mFrameWidth){ + res = true; + }else if(!mMirrorX && mMirrorY && (width * scaleFactor) > 2*mFrameWidth && (-height*scaleFactor) > 2*mFrameWidth){ + res = true; + }else if(mMirrorX && mMirrorY && (-width * scaleFactor) > 2*mFrameWidth && (-height*scaleFactor) > 2*mFrameWidth){ + res = true; + } + + return res; +} + +void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + QLineF move(mStartingPoint, event->scenePos()); + qreal moveX = move.length() * cos((move.angle() - mAngle) * PI / 180); + qreal moveY = -move.length() * sin((move.angle() - mAngle) * PI / 180); + qreal width = delegated()->boundingRect().width() * mTotalScaleX; + qreal height = delegated()->boundingRect().height() * mTotalScaleY; + + if(mOperationMode == Scaling) + { + mTranslateX = moveX; + // Perform the resize + if (resizingBottomRight()) + { + // ----------------------------------------------------- + // ! We want to keep the aspect ratio with this resize ! + // ----------------------------------------------------- + qreal scaleX; + qreal scaleY; + + if(!mMirrorX){ + scaleX = (width + moveX) / width; + }else{ + scaleX = (width - moveX) / width; + } + + if(!mMirrorY){ + scaleY = (height + moveY) / height; + }else{ + scaleY = (height - moveY) / height; + } + + qreal scaleFactor = (scaleX + scaleY) / 2; + + // Do not allow resizing of image size under frame size + if (canResizeBottomRight(width, height, scaleFactor)) + { + if (mRespectRatio) + { + mScaleX = scaleFactor; + mScaleY = scaleFactor; + } + else + { + mScaleX = scaleX; + mScaleY = scaleY; + } + } + }else if (resizingLeft() || resizingRight()) + { + if(width != 0){ + qreal scaleX = 0.0; + if(resizingLeft()){ + scaleX = (width - moveX) / width; + }else if(resizingRight()){ + scaleX = (width + moveX) / width; + } + if(mDelegate->isFlippable() && qAbs(scaleX) != 0){ + if((qAbs(width * scaleX)) < 2*mFrameWidth){ + bool negative = (scaleX < 0)?true:false; + if(negative){ + if(mMirrorX) + scaleX = 2*mFrameWidth/width; + else + scaleX = -2*mFrameWidth/width; + }else{ + scaleX = -1; + } + } + mScaleX = scaleX; + }else if (scaleX > 1 || (width * scaleX) > 2 * mFrameWidth){ + mScaleX = scaleX; + if(resizingLeft()){ + mTranslateX = moveX; + } + } + } + }else if(resizingTop() || resizingBottom()){ + if(height != 0){ + qreal scaleY = 0.0; + if(resizingTop()){ + scaleY = (height - moveY) / height; + }else if(resizingBottom()){ + scaleY = (height + moveY) / height; + } + + if(mDelegate->isFlippable() && qAbs(scaleY) != 0){ + if((qAbs(height * scaleY)) < 2*mFrameWidth){ + bool negative = (scaleY < 0)?true:false; + if(negative){ + if(mMirrorY) + scaleY = 2*mFrameWidth/width; + else + scaleY = -2*mFrameWidth/width; + }else{ + scaleY = -1; + } + } + mScaleY = scaleY; + }else if (scaleY > 1 || (height * scaleY) > 2 * mFrameWidth) + { + mScaleY = scaleY; + if(resizingTop()){ + mTranslateY = moveY; + } + } + } + } + } + else if (mOperationMode == Resizing) + { + mTranslateX = moveX; + UBResizableGraphicsItem* resizableItem = dynamic_cast(delegated()); + + if (resizableItem) + { + QLineF mousePosDelta(delegated()->mapFromScene(event->lastScenePos()) + , delegated()->mapFromScene(event->scenePos())); + QSizeF incVector(0, 0); + + if (resizingBottomRight()) + { + incVector = QSizeF(mousePosDelta.dx(), mousePosDelta.dy()); + } + else if (resizingRight()) + { + incVector = QSizeF(mousePosDelta.dx(), 0); + } + else if (resizingBottom()) + { + incVector = QSizeF(0, mousePosDelta.dy()); + } + else if (resizingLeft()) + { + incVector = QSizeF(- mousePosDelta.dx(), 0); + } + else if (resizingTop()) + { + incVector = QSizeF(0, - mousePosDelta.dy()); + } + + QSizeF newSize = resizableItem->size() + incVector; + + if (!(mDelegate->getToolBarItem()->isVisibleOnBoard() + && (newSize.width() < mDelegate->getToolBarItem()->minWidth() / mDelegate->antiScaleRatio() + || newSize.height() < mDelegate->getToolBarItem()->minWidth() / mDelegate->antiScaleRatio() * 3/4))) + resizableItem->resize(newSize); + } + } + + if (rotating()) + { + mTranslateX = 0; + mTranslateY = 0; + + QLineF startLine(sceneBoundingRect().center(), event->lastScenePos()); + QLineF currentLine(sceneBoundingRect().center(), event->scenePos()); + mAngle += startLine.angleTo(currentLine); + + if ((int)mAngle % 45 >= 45 - mAngleTolerance || (int)mAngle % 45 <= mAngleTolerance) + { + mAngle = qRound(mAngle / 45) * 45; + mAngleOffset += startLine.angleTo(currentLine); + if ((int)mAngleOffset % 360 > mAngleTolerance && (int)mAngleOffset % 360 < 360 - mAngleTolerance) + { + mAngle += mAngleOffset; + mAngleOffset = 0; + } + } + else if ((int)mAngle % 30 >= 30 - mAngleTolerance || (int)mAngle % 30 <= mAngleTolerance) + { + mAngle = qRound(mAngle / 30) * 30; + mAngleOffset += startLine.angleTo(currentLine); + if ((int)mAngleOffset % 360 > mAngleTolerance && (int)mAngleOffset % 360 < 360 - mAngleTolerance) + { + mAngle += mAngleOffset; + mAngleOffset = 0; + } + } + + if (!angleWidget->isVisible()) + angleWidget->show(); + + angleWidget->setText(QString::number((int)mAngle % 360)); + angleWidget->update(); + + } + else if (moving()) + { + mTranslateX = move.dx(); + mTranslateY = move.dy(); + } + + QTransform tr = buildTransform(); + + //TODO UB 4.x: Could find a better solution ? + if (resizingRight() || resizingBottom() || resizingBottomRight()) + { + QPointF ref; + if(!mMirrorX && !mMirrorY){ + ref = delegated()->boundingRect().topLeft(); + }else if(mMirrorX && !mMirrorY){ + ref = delegated()->boundingRect().topLeft(); + }else if(!mMirrorX && mMirrorY){ + ref = delegated()->boundingRect().topLeft(); + }else if(mMirrorX && mMirrorY){ + ref = delegated()->boundingRect().topRight(); + } + + // Map the item topleft point to the current mouse move transform + QPointF topLeft = tr.map(ref); + + // Map the item topleft point to the mouse press transform + QPointF fixedPoint = mInitialTransform.map(ref); + + // Update the translation coordinates + mTranslateX += fixedPoint.x() - topLeft.x(); + mTranslateY += fixedPoint.y() - topLeft.y(); + + // Update the transform + tr = buildTransform(); + } + else if (resizingTop() || resizingLeft()) + { + if (mOperationMode == Scaling) + { + QPointF bottomRight = tr.map(delegated()->boundingRect().bottomRight()); + QPointF fixedPoint = mInitialTransform.map(delegated()->boundingRect().bottomRight()); + mTranslateX += fixedPoint.x() - bottomRight.x(); + mTranslateY += fixedPoint.y() - bottomRight.y(); + } + else + { + QLineF vector; + if (resizingLeft()) + { + QPointF topRight1 = mInitialTransform.map(QPointF(delegated()->boundingRect().width() - moveX, 0)); + QPointF topRight2 = mInitialTransform.map(QPointF(delegated()->boundingRect().width(), 0)); + vector.setPoints(topRight1, topRight2); + } + else + { + QPointF bottomLeft1 = mInitialTransform.map(QPointF(0, delegated()->boundingRect().height() - moveY)); + QPointF bottomLeft2 = mInitialTransform.map(QPointF(0, delegated()->boundingRect().height())); + vector.setPoints(bottomLeft1, bottomLeft2); + } + mTranslateX = vector.dx(); + mTranslateY = vector.dy(); + } + tr = buildTransform(); + } + + delegated()->setTransform(tr); + event->accept(); +} + + +QTransform UBGraphicsDelegateFrame::buildTransform() +{ + QTransform tr; + QPointF center = delegated()->boundingRect().center(); + + // Translate + tr.translate(mTotalTranslateX + mTranslateX, mTotalTranslateY + mTranslateY); + + // Set angle + tr.translate(center.x() * mTotalScaleX * mScaleX, center.y() * mTotalScaleY * mScaleY); + tr.rotate(-mAngle); + tr.translate(-center.x() * mTotalScaleX * mScaleX, -center.y() * mTotalScaleY * mScaleY); + + // Scale + tr.scale(mTotalScaleX * mScaleX, mTotalScaleY * mScaleY); + return tr; +} + + +void UBGraphicsDelegateFrame::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + if (angleWidget->isVisible()) + angleWidget->hide(); + + updateResizeCursors(); + + mDelegate->commitUndoStep(); + mTotalScaleX *= mScaleX; + mTotalScaleY *= mScaleY; + mTotalTranslateX += mTranslateX; + mTotalTranslateY += mTranslateY; + event->accept(); + + mCurrentTool = None; + QGraphicsRectItem::mouseReleaseEvent(event); + + // Show the buttons + if(isResizing()){ + mResizing = false; + } + mDelegate->setButtonsVisible(true); +} + + +void UBGraphicsDelegateFrame::updateResizeCursors() +{ + QPixmap pix(":/images/cursors/resize.png"); + QTransform tr; + + tr.rotate(-mAngle); + QCursor resizeCursor = QCursor(pix.transformed(tr, Qt::SmoothTransformation), pix.width() / 2, pix.height() / 2); + mLeftResizeGrip->setCursor(resizeCursor); + mRightResizeGrip->setCursor(resizeCursor); + + tr.rotate(-90); + resizeCursor = QCursor(pix.transformed(tr, Qt::SmoothTransformation), pix.width() / 2, pix.height() / 2); + mBottomResizeGrip->setCursor(resizeCursor); + mTopResizeGrip->setCursor(resizeCursor); + + tr.rotate(-45); + resizeCursor = QCursor(pix.transformed(tr, Qt::SmoothTransformation), pix.width() / 2, pix.height() / 2); + mBottomRightResizeGrip->setCursor(resizeCursor); +} + + +void UBGraphicsDelegateFrame::setVisible(bool visible) +{ + mVisible = visible; + if (mVisible) + setBrush(QBrush(UBSettings::paletteColor)); + else + setBrush(Qt::NoBrush); +} + + +void UBGraphicsDelegateFrame::positionHandles() +{ + QRectF itemRect = delegated()->boundingRect(); + + if (mDelegate->getToolBarItem()->isVisibleOnBoard() + && mDelegate->getToolBarItem()->isShifting()) + itemRect.setHeight(itemRect.height() + mDelegate->getToolBarItem()->rect().height() * mDelegate->antiScaleRatio() * 1.1); + + QTransform itemTransform = delegated()->sceneTransform(); + QPointF topLeft = itemTransform.map(itemRect.topLeft()); + QPointF topRight = itemTransform.map(itemRect.topRight()); + QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft()); + QPointF bottomRight = itemTransform.map(itemRect.bottomRight()); + QPointF center = itemTransform.map(itemRect.center()); + int rotateHeight = QLineF(topLeft, bottomLeft).length(); + + // Handle the mirroring + if(topLeft.x() > topRight.x()){ + QPointF topTmp = topRight; + QPointF bottomTmp = bottomRight; + topRight = topLeft; + topLeft = topTmp; + bottomRight = bottomLeft; + bottomLeft = bottomTmp; + } + + if(bottomLeft.y() > topLeft.y()){ + QPointF leftTmp = bottomLeft; + QPointF rightTmp = bottomRight; + bottomLeft = topLeft; + topLeft = leftTmp; + bottomRight = topRight; + topRight = rightTmp; + } + + QLineF topLine(topLeft, topRight); + qreal angle = topLine.angle(); + qreal width = topLine.length(); + + QLineF leftLine(topLeft, bottomLeft); + qreal height = leftLine.length(); + + int h = rotating()?rotateHeight:height; + + if (mVisible) + { + setRect(center.x() - mFrameWidth - width / 2, center.y() - mFrameWidth - h / 2, width + 2 * mFrameWidth, h + 2 * mFrameWidth); + } + else + { + setRect(center.x() - width / 2, center.y() - h / 2, width, h); + } + + resetTransform(); + translate(center.x(), center.y()); + rotate(-angle); + translate(-center.x(), -center.y()); + + mBottomRightResizeGripSvgItem->setParentItem(this); + mBottomResizeGripSvgItem->setParentItem(this); + mLeftResizeGripSvgItem->setParentItem(this); + mRightResizeGripSvgItem->setParentItem(this); + mTopResizeGripSvgItem->setParentItem(this); + mRotateButton->setParentItem(this); + + mBottomRightResizeGrip->setParentItem(this); + mBottomResizeGrip->setParentItem(this); + mLeftResizeGrip->setParentItem(this); + mRightResizeGrip->setParentItem(this); + mTopResizeGrip->setParentItem(this); + + QRectF brRect = mBottomRightResizeGripSvgItem->mapRectToParent(mBottomRightResizeGripSvgItem->boundingRect()); + QRectF bRect = mBottomResizeGripSvgItem->mapRectToParent(mBottomResizeGripSvgItem->boundingRect()); + QRectF lRect = mLeftResizeGripSvgItem->mapRectToParent(mLeftResizeGripSvgItem->boundingRect()); + QRectF rRect = mRightResizeGripSvgItem->mapRectToParent(mRightResizeGripSvgItem->boundingRect()); + QRectF trRect = mTopResizeGripSvgItem->mapRectToParent(mTopResizeGripSvgItem->boundingRect()); + + mBottomRightResizeGripSvgItem->setPos(rect().right() - brRect.width(), rect().bottom() - brRect.height()); + mBottomResizeGripSvgItem->setPos(rect().center().x() - bRect.width() / 2, rect().bottom() - bRect.height()); + + mLeftResizeGripSvgItem->setPos(rect().left(), rect().center().y() - lRect.height() / 2); + mRightResizeGripSvgItem->setPos(rect().right() - rRect.width(), rect().center().y() - rRect.height() / 2); + + mTopResizeGripSvgItem->setPos(rect().center().x() - trRect.width() / 2, rect().y()); + mRotateButton->setPos(rect().right() - mFrameWidth - 5, rect().top() + 5); + + mBottomRightResizeGrip->setRect(bottomRightResizeGripRect()); + mBottomResizeGrip->setRect(bottomResizeGripRect()); + mLeftResizeGrip->setRect(leftResizeGripRect()); + mRightResizeGrip->setRect(rightResizeGripRect()); + mTopResizeGrip->setRect(topResizeGripRect()); + + QVariant vLocked = delegated()->data(UBGraphicsItemData::ItemLocked); + bool isLocked = (vLocked.isValid() && vLocked.toBool()); + + mBottomRightResizeGripSvgItem->setVisible(!isLocked); + mBottomResizeGripSvgItem->setVisible(!isLocked); + mLeftResizeGripSvgItem->setVisible(!isLocked); + mRightResizeGripSvgItem->setVisible(!isLocked); + mTopResizeGripSvgItem->setVisible(!isLocked); + mRotateButton->setVisible(mDelegate->canRotate() && !isLocked); + + mBottomRightResizeGrip->setVisible(!isLocked); + mBottomResizeGrip->setVisible(!isLocked); + mLeftResizeGrip->setVisible(!isLocked); + mRightResizeGrip->setVisible(!isLocked); + mTopResizeGrip->setVisible(!isLocked); + + if (isLocked) + { + QColor baseColor = UBSettings::paletteColor; + baseColor.setAlphaF(baseColor.alphaF() / 3); + setBrush(QBrush(baseColor)); + } + else + { + setBrush(QBrush(UBSettings::paletteColor)); + } + + //make frame interact like delegated item when selected. Maybe should be deleted if selection logic will change + setZValue(delegated()->zValue()); +} + + +QGraphicsItem* UBGraphicsDelegateFrame::delegated() +{ + return mDelegate->delegated(); +} + +UBGraphicsDelegateFrame::FrameTool UBGraphicsDelegateFrame::toolFromPos(QPointF pos) +{ + if(mDelegate->isLocked()) + return None; + else if (bottomRightResizeGripRect().contains(pos)) + return ResizeBottomRight; + else if (bottomResizeGripRect().contains(pos)){ + if(mMirrorY){ + return ResizeTop; + }else{ + return ResizeBottom; + } + } + else if (leftResizeGripRect().contains(pos)){ + if(mMirrorX){ + return ResizeRight; + }else{ + return ResizeLeft; + } + return ResizeLeft; + } + else if (rightResizeGripRect().contains(pos)){ + if(mMirrorX){ + return ResizeLeft; + }else{ + return ResizeRight; + } + } + else if (topResizeGripRect().contains(pos)){ + if(mMirrorY){ + return ResizeBottom; + }else{ + return ResizeTop; + } + } + else if (rotateButtonBounds().contains(pos) && mDelegate && mDelegate->canRotate()) + return Rotate; + else + return Move; +} + + +QRectF UBGraphicsDelegateFrame::bottomRightResizeGripRect() const +{ + return QRectF(rect().right() - mFrameWidth, rect().bottom() - mFrameWidth, mFrameWidth, mFrameWidth); +} + + +QRectF UBGraphicsDelegateFrame::bottomResizeGripRect() const +{ + return QRectF(rect().center().x() - mFrameWidth / 2, rect().bottom() - mFrameWidth, mFrameWidth, mFrameWidth); +} + + +QRectF UBGraphicsDelegateFrame::leftResizeGripRect() const +{ + return QRectF(rect().left(), rect().center().y() - mFrameWidth / 2, mFrameWidth, mFrameWidth); +} + + +QRectF UBGraphicsDelegateFrame::rightResizeGripRect() const +{ + return QRectF(rect().right() - mFrameWidth, rect().center().y() - mFrameWidth / 2, mFrameWidth, mFrameWidth); +} + + +QRectF UBGraphicsDelegateFrame::topResizeGripRect() const +{ + return QRectF(rect().center().x() - mFrameWidth / 2, rect().top(), mFrameWidth, mFrameWidth); +} + + +QRectF UBGraphicsDelegateFrame::rotateButtonBounds() const +{ + return QRectF(rect().right()- mFrameWidth, rect().top(), mFrameWidth, mFrameWidth); +} + +void UBGraphicsDelegateFrame::refreshGeometry() +{ + // Here we want to have the left on the left, the right on the right, the top on the top and the bottom on the bottom! + QRectF itemRect = delegated()->boundingRect(); + QTransform itemTransform = delegated()->sceneTransform(); + QPointF topLeft = itemTransform.map(itemRect.topLeft()); + QPointF topRight = itemTransform.map(itemRect.topRight()); + QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft()); + + QLineF topLine(topLeft, topRight); + qreal width = topLine.length(); + QLineF leftLine(topLeft, bottomLeft); + qreal height = leftLine.length(); + setRect(topRight.x() - mFrameWidth, topLeft.y() - mFrameWidth, width + 2*mFrameWidth, height + 2*mFrameWidth); +} diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index cadbf191..c081d40e 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -37,6 +37,9 @@ #include "UBGraphicsWidgetItem.h" #include "domain/UBAbstractWidget.h" +#include "domain/UBGraphicsTextItem.h" +#include "domain/UBGraphicsAudioItem.h" +#include "domain/UBGraphicsVideoItem.h" #include "web/UBWebController.h" @@ -47,6 +50,27 @@ class UBGraphicsParaschoolEditorWidgetItem; +DelegateButton::DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent, Qt::WindowFrameSection section) + : QGraphicsSvgItem(fileName, parent) + , mDelegated(pDelegated) + , mIsTransparentToMouseEvent(false) + , mButtonAlignmentSection(section) +{ + setAcceptedMouseButtons(Qt::LeftButton); + setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); +} + +DelegateButton::~DelegateButton() +{ + // NOOP +} + +void DelegateButton::setFileName(const QString & fileName) +{ + QGraphicsSvgItem::setSharedRenderer(new QSvgRenderer (fileName, this)); +} + + void DelegateButton::mousePressEvent(QGraphicsSceneMouseEvent *event) { // make sure delegate is selected, to avoid control being hidden @@ -93,6 +117,8 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec void UBGraphicsItemDelegate::init() { + mToolBarItem = new UBGraphicsToolBarItem(delegated()); + mFrame = new UBGraphicsDelegateFrame(this, QRectF(0, 0, 0, 0), mFrameWidth, mRespectRatio); mFrame->hide(); mFrame->setFlag(QGraphicsItem::ItemIsSelectable, true); @@ -123,10 +149,13 @@ void UBGraphicsItemDelegate::init() foreach(DelegateButton* button, mButtons) { + if (button->getSection() != Qt::TitleBarArea) + { button->hide(); button->setFlag(QGraphicsItem::ItemIsSelectable, true); } } +} UBGraphicsItemDelegate::~UBGraphicsItemDelegate() @@ -292,13 +321,20 @@ void UBGraphicsItemDelegate::positionHandles() updateButtons(true); + if (mToolBarItem->isVisibleOnBoard()) + { + updateToolBar(); + mToolBarItem->show(); + } } else { foreach(DelegateButton* button, mButtons) button->hide(); mFrame->hide(); + mToolBarItem->hide(); } } + void UBGraphicsItemDelegate::setZOrderButtonsVisible(bool visible) { if (visible) { @@ -335,6 +371,7 @@ void UBGraphicsItemDelegate::remove(bool canUndo) scene->removeItem(mFrame); scene->removeItem(mDelegated); + scene->removeItem(mToolBarItem); if (canUndo) { @@ -577,14 +614,16 @@ void UBGraphicsItemDelegate::updateButtons(bool showUpdated) int i = 1, j = 0, k = 0; while ((i + j + k) < mButtons.size()) { DelegateButton* button = mButtons[i + j]; - button->setParentItem(mFrame); - button->setTransform(tr); if (button->getSection() == Qt::TopLeftSection) { + button->setParentItem(mFrame); button->setPos(topX + (i++ * 1.6 * mFrameWidth * mAntiScaleRatio), topY); + button->setTransform(tr); } else if (button->getSection() == Qt::BottomLeftSection) { + button->setParentItem(mFrame); button->setPos(bottomX + (++j * 1.6 * mFrameWidth * mAntiScaleRatio), bottomY); - } else if (button->getSection() == Qt::NoSection) { + button->setTransform(tr); + } else if (button->getSection() == Qt::TitleBarArea || button->getSection() == Qt::NoSection){ ++k; } if (!button->scene()) @@ -599,9 +638,65 @@ void UBGraphicsItemDelegate::updateButtons(bool showUpdated) } } +void UBGraphicsItemDelegate::updateToolBar() +{ + QTransform transformForToolbarButtons; + transformForToolbarButtons.scale(mAntiScaleRatio, 1); + + QRectF toolBarRect = mToolBarItem->rect(); + toolBarRect.setWidth(delegated()->boundingRect().width() - 10); + mToolBarItem->setRect(toolBarRect); + + if (mToolBarItem->isShifting()) + mToolBarItem->setPos(delegated()->boundingRect().bottomLeft() + QPointF(5 * mAntiScaleRatio, 0)); + else mToolBarItem->setPos(delegated()->boundingRect().bottomLeft() - QPointF(-5 * mAntiScaleRatio, mToolBarItem->rect().height() * 1.1 * mAntiScaleRatio)); + + int offsetOnToolBar = 5 * mAntiScaleRatio; + QList itemList = mToolBarItem->itemsOnToolBar(); + foreach (QGraphicsItem* item, itemList) + { + item->setPos(offsetOnToolBar, 0); + offsetOnToolBar += (item->boundingRect().width() + 5) * mAntiScaleRatio; + item->setTransform(transformForToolbarButtons); + item->show(); + } + + mToolBarItem->setOffsetOnToolBar(offsetOnToolBar); + + QTransform tr; + tr.scale(1, mAntiScaleRatio); + mToolBarItem->setTransform(tr); +} + void UBGraphicsItemDelegate::setButtonsVisible(bool visible) { foreach(DelegateButton* pButton, mButtons){ pButton->setVisible(visible); } } + +UBGraphicsToolBarItem::UBGraphicsToolBarItem(QGraphicsItem * parent) : + QGraphicsRectItem(parent), + mShifting(true), + mVisible(false), + mMinWidth(200) +{ + QRectF rect = this->rect(); + rect.setHeight(26); + this->setRect(rect); + + setBrush(QColor(UBSettings::paletteColor)); + setPen(Qt::NoPen); + hide(); +} + +void UBGraphicsToolBarItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + + QPainterPath path; + path.addRoundedRect(rect(), 10, 10); + + painter->fillPath(path, brush()); +} \ No newline at end of file diff --git a/src/domain/UBGraphicsItemDelegate.h b/src/domain/UBGraphicsItemDelegate.h index f560b546..b6994a84 100644 --- a/src/domain/UBGraphicsItemDelegate.h +++ b/src/domain/UBGraphicsItemDelegate.h @@ -35,30 +35,16 @@ class DelegateButton: public QGraphicsSvgItem Q_OBJECT public: - DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0, Qt::WindowFrameSection section = Qt::TopLeftSection) - : QGraphicsSvgItem(fileName, parent) - , mDelegated(pDelegated) - , mIsTransparentToMouseEvent(false) - , mButtonAlignmentSection(section) - { - setAcceptedMouseButtons(Qt::LeftButton); - setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); - } + DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0, Qt::WindowFrameSection section = Qt::TopLeftSection); - virtual ~DelegateButton() - { - // NOOP - } + virtual ~DelegateButton(); void setTransparentToMouseEvent(bool tr) { mIsTransparentToMouseEvent = tr; } - void setFileName(const QString & fileName) - { - QGraphicsSvgItem::setSharedRenderer(new QSvgRenderer (fileName, this)); - } + void setFileName(const QString & fileName); void setSection(Qt::WindowFrameSection section) {mButtonAlignmentSection = section;} Qt::WindowFrameSection getSection() const {return mButtonAlignmentSection;} @@ -84,6 +70,31 @@ class DelegateButton: public QGraphicsSvgItem }; +class UBGraphicsToolBarItem : public QGraphicsRectItem, public QObject +{ + public: + UBGraphicsToolBarItem(QGraphicsItem * parent = 0); + virtual ~UBGraphicsToolBarItem() {}; + + bool isVisibleOnBoard() const { return mVisible; } + void setVisibleOnBoard(bool visible) { mVisible = visible; } + bool isShifting() const { return mShifting; } + void setShifting(bool shifting) { mShifting = shifting; } + int offsetOnToolBar() const { return mOffsetOnToolBar; } + void setOffsetOnToolBar(int pOffset) { mOffsetOnToolBar = pOffset; } + QList itemsOnToolBar() const { return mItemsOnToolBar; } + void setItemsOnToolBar(QList itemsOnToolBar) { mItemsOnToolBar = itemsOnToolBar;} + int minWidth() { return mMinWidth; } + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, + QWidget *widget); + + private: + bool mShifting; + bool mVisible; + int mOffsetOnToolBar; + int mMinWidth; + QList mItemsOnToolBar; +}; class UBGraphicsItemDelegate : public QObject { @@ -138,6 +149,10 @@ class UBGraphicsItemDelegate : public QObject void setButtonsVisible(bool visible); + UBGraphicsToolBarItem* getToolBarItem() const { return mToolBarItem; } + + qreal antiScaleRatio() const { return mAntiScaleRatio; } + signals: void showOnDisplayChanged(bool shown); void lockChanged(bool locked); @@ -183,12 +198,17 @@ class UBGraphicsItemDelegate : public QObject QList mButtons; + UBGraphicsToolBarItem* mToolBarItem; + protected slots: virtual void gotoContentSource(bool checked); private: void updateFrame(); void updateButtons(bool showUpdated = false); + void updateToolBar(); + + QPointF mOffset; QTransform mPreviousTransform; diff --git a/src/domain/UBGraphicsItemUndoCommand.cpp b/src/domain/UBGraphicsItemUndoCommand.cpp index d027c1f0..bc8c4c82 100644 --- a/src/domain/UBGraphicsItemUndoCommand.cpp +++ b/src/domain/UBGraphicsItemUndoCommand.cpp @@ -19,12 +19,12 @@ #include "UBGraphicsScene.h" -#include "core/memcheck.h" - #include "core/UBApplication.h" #include "board/UBBoardController.h" +#include "core/memcheck.h" + UBGraphicsItemUndoCommand::UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, const QSet& pRemovedItems, const QSet& pAddedItems) : mScene(pScene) diff --git a/src/domain/UBGraphicsMediaItem.cpp b/src/domain/UBGraphicsMediaItem.cpp index 9342cb66..dd19e275 100644 --- a/src/domain/UBGraphicsMediaItem.cpp +++ b/src/domain/UBGraphicsMediaItem.cpp @@ -23,10 +23,10 @@ #include "board/UBBoardController.h" -#include "core/memcheck.h" - #include "frameworks/UBFileSystemUtils.h" +#include "core/memcheck.h" + bool UBGraphicsMediaItem::sIsMutedByDefault = false; UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsItem *parent) diff --git a/src/domain/UBGraphicsStrokesGroup.cpp b/src/domain/UBGraphicsStrokesGroup.cpp index ac7aadf0..a7f658dd 100644 --- a/src/domain/UBGraphicsStrokesGroup.cpp +++ b/src/domain/UBGraphicsStrokesGroup.cpp @@ -1,5 +1,7 @@ #include "UBGraphicsStrokesGroup.h" +#include "core/memcheck.h" + UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent):QGraphicsItemGroup(parent) { mDelegate = new UBGraphicsItemDelegate(this, 0, true, true); diff --git a/src/domain/UBGraphicsTextItemDelegate.cpp b/src/domain/UBGraphicsTextItemDelegate.cpp index c567ef43..2a911fbf 100644 --- a/src/domain/UBGraphicsTextItemDelegate.cpp +++ b/src/domain/UBGraphicsTextItemDelegate.cpp @@ -24,9 +24,10 @@ #include "domain/UBGraphicsDelegateFrame.h" #include "core/UBSettings.h" -#include "core/memcheck.h" #include "board/UBBoardController.h" +#include "core/memcheck.h" + const int UBGraphicsTextItemDelegate::sMinPixelSize = 8; const int UBGraphicsTextItemDelegate::sMinPointSize = 8; @@ -94,17 +95,21 @@ void UBGraphicsTextItemDelegate::buildButtons() { UBGraphicsItemDelegate::buildButtons(); - mFontButton = new DelegateButton(":/images/font.svg", mDelegated, mFrame, Qt::TopLeftSection); - mColorButton = new DelegateButton(":/images/color.svg", mDelegated, mFrame, Qt::TopLeftSection); - mDecreaseSizeButton = new DelegateButton(":/images/minus.svg", mDelegated, mFrame, Qt::TopLeftSection); - mIncreaseSizeButton = new DelegateButton(":/images/plus.svg", mDelegated, mFrame, Qt::TopLeftSection); + mFontButton = new DelegateButton(":/images/font.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); + mColorButton = new DelegateButton(":/images/color.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); + mDecreaseSizeButton = new DelegateButton(":/images/minus.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); + mIncreaseSizeButton = new DelegateButton(":/images/plus.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); connect(mFontButton, SIGNAL(clicked(bool)), this, SLOT(pickFont())); connect(mColorButton, SIGNAL(clicked(bool)), this, SLOT(pickColor())); connect(mDecreaseSizeButton, SIGNAL(clicked(bool)), this, SLOT(decreaseSize())); connect(mIncreaseSizeButton, SIGNAL(clicked(bool)), this, SLOT(increaseSize())); - mButtons << mFontButton << mColorButton << mDecreaseSizeButton << mIncreaseSizeButton; + QList itemsOnToolBar; + itemsOnToolBar << mFontButton << mColorButton << mDecreaseSizeButton << mIncreaseSizeButton; + mToolBarItem->setItemsOnToolBar(itemsOnToolBar); + + mToolBarItem->setVisibleOnBoard(true); } void UBGraphicsTextItemDelegate::contentsChanged() diff --git a/src/domain/UBGraphicsVideoItemDelegate.cpp b/src/domain/UBGraphicsVideoItemDelegate.cpp index 35620cf0..e02640c5 100644 --- a/src/domain/UBGraphicsVideoItemDelegate.cpp +++ b/src/domain/UBGraphicsVideoItemDelegate.cpp @@ -1,336 +1,351 @@ -/* - * 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 3 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 -#include - -#include "UBGraphicsVideoItemDelegate.h" - -#include "UBGraphicsScene.h" - -#include "core/UBSettings.h" -#include "core/UBApplication.h" -#include "core/UBApplicationController.h" -#include "core/UBDisplayManager.h" - -#include "domain/UBGraphicsVideoItem.h" -#include "domain/UBGraphicsDelegateFrame.h" - -#include "core/memcheck.h" - -UBGraphicsVideoItemDelegate::UBGraphicsVideoItemDelegate(UBGraphicsVideoItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent) - : UBGraphicsItemDelegate(pDelegated, parent, true, false) - , mMedia(pMedia) -{ - // NOOP -} - -void UBGraphicsVideoItemDelegate::buildButtons() -{ - mPlayPauseButton = new DelegateButton(":/images/play.svg", mDelegated, mFrame); - - mStopButton = new DelegateButton(":/images/stop.svg", mDelegated, mFrame); - mStopButton->hide(); - - if (delegated()->isMuted()) - mMuteButton = new DelegateButton(":/images/soundOff.svg", mDelegated, mFrame); - else - mMuteButton = new DelegateButton(":/images/soundOn.svg", mDelegated, mFrame); - - mMuteButton->hide(); - - mVideoControl = new DelegateVideoControl(delegated(), mFrame); - UBGraphicsItem::assignZValue(mVideoControl, delegated()->zValue()); - mVideoControl->setFlag(QGraphicsItem::ItemIsSelectable, true); - - connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause())); - connect(mStopButton, SIGNAL(clicked(bool)), mMedia, SLOT(stop())); - connect(mMuteButton, SIGNAL(clicked(bool)), delegated(), SLOT(toggleMute())); - connect(mMuteButton, SIGNAL(clicked(bool)), this, SLOT(toggleMute())); - - mButtons << mPlayPauseButton << mStopButton << mMuteButton; - - mMedia->setTickInterval(50); - - connect(mMedia, SIGNAL(stateChanged (Phonon::State, Phonon::State)), this, SLOT(mediaStateChanged (Phonon::State, Phonon::State))); - connect(mMedia, SIGNAL(finished()), this, SLOT(updatePlayPauseState())); - connect(mMedia, SIGNAL(tick(qint64)), this, SLOT(updateTicker(qint64))); - connect(mMedia, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64))); - -} - - -UBGraphicsVideoItemDelegate::~UBGraphicsVideoItemDelegate() -{ - //NOOP -} - - -void UBGraphicsVideoItemDelegate::positionHandles() -{ - UBGraphicsItemDelegate::positionHandles(); - - if (mDelegated->isSelected()) - { - qreal scaledFrameWidth = mFrameWidth * mAntiScaleRatio; - - - qreal width = mFrame->rect().width(); - qreal height = mFrame->rect().height(); - - qreal x = mFrame->rect().left(); - qreal y = mFrame->rect().top(); - - mVideoControl->setRect(x + 2 * scaledFrameWidth - , y + height - 3 * scaledFrameWidth - , width - 4 * scaledFrameWidth - , 2 * scaledFrameWidth); - - if (!mVideoControl->scene()) - { - mVideoControl->setParentItem(mFrame);//update parent for the case the item has been previously removed from scene - mDelegated->scene()->addItem(mVideoControl); - } - - mVideoControl->setAntiScale(mAntiScaleRatio); - mVideoControl->setZValue(delegated()->zValue()); - mVideoControl->show(); - } - else - { - mVideoControl->hide(); - } -} - - -void UBGraphicsVideoItemDelegate::remove(bool canUndo) -{ - if (delegated() && delegated()->mediaObject()) - delegated()->mediaObject()->stop(); - - QGraphicsScene* scene = mDelegated->scene(); - - scene->removeItem(mVideoControl); - - UBGraphicsItemDelegate::remove(canUndo); -} - - -void UBGraphicsVideoItemDelegate::toggleMute() -{ - if (delegated()->isMuted()) - mMuteButton->setFileName(":/images/soundOff.svg"); - else - mMuteButton->setFileName(":/images/soundOn.svg"); - -} - - -UBGraphicsVideoItem* UBGraphicsVideoItemDelegate::delegated() -{ - return static_cast(mDelegated); -} - - -void UBGraphicsVideoItemDelegate::togglePlayPause() -{ - if (delegated() && delegated()->mediaObject()) { - - Phonon::MediaObject* media = delegated()->mediaObject(); - if (media->state() == Phonon::StoppedState) { - media->play(); - } else if (media->state() == Phonon::PlayingState) { - if (media->remainingTime() <= 0) { - media->stop(); - media->play(); - } else { - media->pause(); - if(delegated()->scene()) - delegated()->scene()->setModified(true); - } - } else if (media->state() == Phonon::PausedState) { - if (media->remainingTime() <= 0) { - media->stop(); - } - media->play(); - } else if ( media->state() == Phonon::LoadingState ) { - delegated()->mediaObject()->setCurrentSource(delegated()->mediaFileUrl()); - media->play(); - } else if (media->state() == Phonon::ErrorState){ - qDebug() << "Error appeared." << media->errorString(); - } - } -} - -void UBGraphicsVideoItemDelegate::mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate ) -{ - Q_UNUSED(newstate); - Q_UNUSED(oldstate); - updatePlayPauseState(); -} - - -void UBGraphicsVideoItemDelegate::updatePlayPauseState() -{ - Phonon::MediaObject* media = delegated()->mediaObject(); - - if (media->state() == Phonon::PlayingState) - mPlayPauseButton->setFileName(":/images/pause.svg"); - else - mPlayPauseButton->setFileName(":/images/play.svg"); -} - - -void UBGraphicsVideoItemDelegate::updateTicker(qint64 time) -{ - Phonon::MediaObject* media = delegated()->mediaObject(); - mVideoControl->totalTimeChanged(media->totalTime()); - - mVideoControl->updateTicker(time); -} - - -void UBGraphicsVideoItemDelegate::totalTimeChanged(qint64 newTotalTime) -{ - mVideoControl->totalTimeChanged(newTotalTime); -} - - -DelegateVideoControl::DelegateVideoControl(UBGraphicsVideoItem* pDelegated, QGraphicsItem * parent) - : QGraphicsRectItem(parent) - , mDelegate(pDelegated) - , mDisplayCurrentTime(false) - , mAntiScale(1.0) - , mCurrentTimeInMs(0) - , mTotalTimeInMs(0) -{ - setAcceptedMouseButtons(Qt::LeftButton); - - setBrush(QBrush(UBSettings::paletteColor)); - setPen(Qt::NoPen); - setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); -} - - -void DelegateVideoControl::paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - painter->fillPath(shape(), brush()); - - qreal frameWidth = rect().height() / 2; - int position = frameWidth; - - if (mTotalTimeInMs > 0) - { - position = frameWidth + (rect().width() - (2 * frameWidth)) / mTotalTimeInMs * mCurrentTimeInMs; - } - - int radius = rect().height() / 6; - QRectF r(rect().x() + position - radius, rect().y() + (rect().height() / 4) - radius, radius * 2, radius * 2); - - painter->setBrush(UBSettings::documentViewLightColor); - painter->drawEllipse(r); - - if(mDisplayCurrentTime) - { - painter->setBrush(UBSettings::paletteColor); - painter->setPen(QPen(Qt::NoPen)); - QRectF balloon(rect().x() + position - frameWidth, rect().y() - (frameWidth * 1.2), 2 * frameWidth, frameWidth); - painter->drawRoundedRect(balloon, frameWidth/2, frameWidth/2); - - QTime t; - t = t.addMSecs(mCurrentTimeInMs < 0 ? 0 : mCurrentTimeInMs); - QFont f = painter->font(); - f.setPointSizeF(f.pointSizeF() * mAntiScale); - painter->setFont(f); - painter->setPen(Qt::white); - painter->drawText(balloon, Qt::AlignCenter, t.toString("m:ss")); - } -} - - -QPainterPath DelegateVideoControl::shape() const -{ - QPainterPath path; - QRectF r = rect().adjusted(0,0,0,- rect().height() / 2); - path.addRoundedRect(r, rect().height() / 4, rect().height() / 4); - return path; -} - - -void DelegateVideoControl::updateTicker(qint64 time ) -{ - mCurrentTimeInMs = time; - update(); -} - - -void DelegateVideoControl::totalTimeChanged(qint64 newTotalTime) -{ - mTotalTimeInMs = newTotalTime; - update(); -} - - -void DelegateVideoControl::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - mDisplayCurrentTime = true; - seekToMousePos(event->pos()); - update(); - event->accept(); -} - - -void DelegateVideoControl::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - seekToMousePos(event->pos()); - update(); - event->accept(); -} - - -void DelegateVideoControl::seekToMousePos(QPointF mousePos) -{ - qreal minX, length; - qreal frameWidth = rect().height() / 2; - - minX = rect().x() + frameWidth; - length = rect().width() - (2 * frameWidth); - - qreal mouseX = mousePos.x(); - - if (mTotalTimeInMs > 0 && length > 0 && mDelegate - && mDelegate->mediaObject() && mDelegate->mediaObject()->isSeekable()) - { - qint64 tickPos = mTotalTimeInMs / length * (mouseX - minX); - mDelegate->mediaObject()->seek(tickPos); - - //OSX is a bit lazy - updateTicker(tickPos); - } -} - -void DelegateVideoControl::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - mDisplayCurrentTime = false; - update(); - event->accept(); -} - - - +/* + * 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 3 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 +#include + +#include "UBGraphicsVideoItemDelegate.h" + +#include "UBGraphicsScene.h" + +#include "core/UBSettings.h" +#include "core/UBApplication.h" +#include "core/UBApplicationController.h" +#include "core/UBDisplayManager.h" + +#include "domain/UBGraphicsVideoItem.h" +#include "domain/UBGraphicsDelegateFrame.h" + +#include "core/memcheck.h" + +UBGraphicsVideoItemDelegate::UBGraphicsVideoItemDelegate(UBGraphicsVideoItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent) + : UBGraphicsItemDelegate(pDelegated, parent, true, false) + , mMedia(pMedia) +{ + // NOOP +} + +void UBGraphicsVideoItemDelegate::buildButtons() +{ + mPlayPauseButton = new DelegateButton(":/images/play.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); + + mStopButton = new DelegateButton(":/images/stop.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); + + mVideoControl = new DelegateVideoControl(delegated(), mToolBarItem); + UBGraphicsItem::assignZValue(mVideoControl, delegated()->zValue()); + mVideoControl->setFlag(QGraphicsItem::ItemIsSelectable, true); + + if (delegated()->isMuted()) + mMuteButton = new DelegateButton(":/images/soundOff.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); + else + mMuteButton = new DelegateButton(":/images/soundOn.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); + + connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause())); + connect(mStopButton, SIGNAL(clicked(bool)), mMedia, SLOT(stop())); + connect(mMuteButton, SIGNAL(clicked(bool)), delegated(), SLOT(toggleMute())); + connect(mMuteButton, SIGNAL(clicked(bool)), this, SLOT(toggleMute())); + + mButtons << mPlayPauseButton << mStopButton << mMuteButton; + + QList itemsOnToolBar; + itemsOnToolBar << mPlayPauseButton << mStopButton << mVideoControl << mMuteButton; + mToolBarItem->setItemsOnToolBar(itemsOnToolBar); + + mMedia->setTickInterval(50); + + connect(mMedia, SIGNAL(stateChanged (Phonon::State, Phonon::State)), this, SLOT(mediaStateChanged (Phonon::State, Phonon::State))); + connect(mMedia, SIGNAL(finished()), this, SLOT(updatePlayPauseState())); + connect(mMedia, SIGNAL(tick(qint64)), this, SLOT(updateTicker(qint64))); + connect(mMedia, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64))); + + mToolBarItem->setVisibleOnBoard(true); + mToolBarItem->setShifting(false); +} + + +UBGraphicsVideoItemDelegate::~UBGraphicsVideoItemDelegate() +{ + //NOOP +} + + +void UBGraphicsVideoItemDelegate::positionHandles() +{ + UBGraphicsItemDelegate::positionHandles(); + + if (mDelegated->isSelected()) + { + qreal scaledFrameWidth = mFrameWidth * mAntiScaleRatio; + + int offset = 0; + foreach (DelegateButton* button, mButtons) + { + if (button->getSection() == Qt::TitleBarArea) + offset += button->boundingRect().width() * mAntiScaleRatio; + } + + mVideoControl->setRect(mVideoControl->rect().x() + , scaledFrameWidth/6 - 0.5 + , (mToolBarItem->rect().width() - 35 - offset) / mAntiScaleRatio + , (2 * scaledFrameWidth) / mAntiScaleRatio); + + offset += (mVideoControl->rect().width() + 5) * mAntiScaleRatio; + mMuteButton->setPos(offset, 0); + + if (!mVideoControl->scene()) + { + mVideoControl->setParentItem(mToolBarItem);//update parent for the case the item has been previously removed from scene + mDelegated->scene()->addItem(mVideoControl); + } + + mVideoControl->setAntiScale(mAntiScaleRatio); + mVideoControl->setZValue(delegated()->zValue()); + mVideoControl->show(); + } + else + { + mVideoControl->hide(); + } +} + + +void UBGraphicsVideoItemDelegate::remove(bool canUndo) +{ + if (delegated() && delegated()->mediaObject()) + delegated()->mediaObject()->stop(); + + QGraphicsScene* scene = mDelegated->scene(); + + scene->removeItem(mVideoControl); + + UBGraphicsItemDelegate::remove(canUndo); +} + + +void UBGraphicsVideoItemDelegate::toggleMute() +{ + if (delegated()->isMuted()) + mMuteButton->setFileName(":/images/soundOff.svg"); + else + mMuteButton->setFileName(":/images/soundOn.svg"); + +} + + +UBGraphicsVideoItem* UBGraphicsVideoItemDelegate::delegated() +{ + return static_cast(mDelegated); +} + + +void UBGraphicsVideoItemDelegate::togglePlayPause() +{ + if (delegated() && delegated()->mediaObject()) { + + Phonon::MediaObject* media = delegated()->mediaObject(); + if (media->state() == Phonon::StoppedState) { + media->play(); + } else if (media->state() == Phonon::PlayingState) { + if (media->remainingTime() <= 0) { + media->stop(); + media->play(); + } else { + media->pause(); + if(delegated()->scene()) + delegated()->scene()->setModified(true); + } + } else if (media->state() == Phonon::PausedState) { + if (media->remainingTime() <= 0) { + media->stop(); + } + media->play(); + } else if ( media->state() == Phonon::LoadingState ) { + delegated()->mediaObject()->setCurrentSource(delegated()->mediaFileUrl()); + media->play(); + } else if (media->state() == Phonon::ErrorState){ + qDebug() << "Error appeared." << media->errorString(); + } + } +} + +void UBGraphicsVideoItemDelegate::mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate ) +{ + Q_UNUSED(newstate); + Q_UNUSED(oldstate); + updatePlayPauseState(); +} + + +void UBGraphicsVideoItemDelegate::updatePlayPauseState() +{ + Phonon::MediaObject* media = delegated()->mediaObject(); + + if (media->state() == Phonon::PlayingState) + mPlayPauseButton->setFileName(":/images/pause.svg"); + else + mPlayPauseButton->setFileName(":/images/play.svg"); +} + + +void UBGraphicsVideoItemDelegate::updateTicker(qint64 time) +{ + Phonon::MediaObject* media = delegated()->mediaObject(); + mVideoControl->totalTimeChanged(media->totalTime()); + + mVideoControl->updateTicker(time); +} + + +void UBGraphicsVideoItemDelegate::totalTimeChanged(qint64 newTotalTime) +{ + mVideoControl->totalTimeChanged(newTotalTime); +} + + +DelegateVideoControl::DelegateVideoControl(UBGraphicsVideoItem* pDelegated, QGraphicsItem * parent) + : QGraphicsRectItem(parent) + , mDelegate(pDelegated) + , mDisplayCurrentTime(false) + , mAntiScale(1.0) + , mCurrentTimeInMs(0) + , mTotalTimeInMs(0) + , mStartWidth(200) +{ + setAcceptedMouseButtons(Qt::LeftButton); + + setBrush(QBrush(Qt::white)); + setPen(Qt::NoPen); + setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); + + QRectF rect = this->rect(); + rect.setWidth(mStartWidth); + this->setRect(rect); +} + + +void DelegateVideoControl::paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + + painter->fillPath(shape(), brush()); + + qreal frameWidth = rect().height() / 2; + int position = frameWidth; + + if (mTotalTimeInMs > 0) + { + position = frameWidth + (rect().width() - (2 * frameWidth)) / mTotalTimeInMs * mCurrentTimeInMs; + } + + int radius = rect().height() / 6; + QRectF r(rect().x() + position - radius, rect().y() + (rect().height() / 4) - radius, radius * 2, radius * 2); + + painter->setBrush(UBSettings::documentViewLightColor); + painter->drawEllipse(r); + + if(mDisplayCurrentTime) + { + painter->setBrush(UBSettings::paletteColor); + painter->setPen(QPen(Qt::NoPen)); + mBalloon.setRect(rect().x() + position - frameWidth, rect().y() - (frameWidth * 1.2), 2 * frameWidth, frameWidth); + painter->drawRoundedRect(mBalloon, frameWidth/2, frameWidth/2); + + QTime t; + t = t.addMSecs(mCurrentTimeInMs < 0 ? 0 : mCurrentTimeInMs); + QFont f = painter->font(); + f.setPointSizeF(f.pointSizeF() * mAntiScale); + painter->setFont(f); + painter->setPen(Qt::white); + painter->drawText(mBalloon, Qt::AlignCenter, t.toString("m:ss")); + } +} + + +QPainterPath DelegateVideoControl::shape() const +{ + QPainterPath path; + QRectF r = rect().adjusted(0,0,0,- rect().height() / 2); + path.addRoundedRect(r, rect().height() / 4, rect().height() / 4); + return path; +} + + +void DelegateVideoControl::updateTicker(qint64 time ) +{ + mCurrentTimeInMs = time; + update(); +} + + +void DelegateVideoControl::totalTimeChanged(qint64 newTotalTime) +{ + mTotalTimeInMs = newTotalTime; + update(); +} + + +void DelegateVideoControl::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + mDisplayCurrentTime = true; + seekToMousePos(event->pos()); + update(); + event->accept(); +} + + +void DelegateVideoControl::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + if (shape().contains(event->pos() - QPointF(mBalloon.width()/2,0)) + && shape().contains(event->pos() + QPointF(mBalloon.width()/2,0))) + { + seekToMousePos(event->pos()); + update(); + event->accept(); + } +} + + +void DelegateVideoControl::seekToMousePos(QPointF mousePos) +{ + qreal minX, length; + qreal frameWidth = rect().height() / 2; + + minX = rect().x() + frameWidth; + length = rect().width() - (2 * frameWidth); + + qreal mouseX = mousePos.x(); + + if (mTotalTimeInMs > 0 && length > 0 && mDelegate + && mDelegate->mediaObject() && mDelegate->mediaObject()->isSeekable()) + { + qint64 tickPos = mTotalTimeInMs / length * (mouseX - minX); + mDelegate->mediaObject()->seek(tickPos); + + //OSX is a bit lazy + updateTicker(tickPos); + } +} + +void DelegateVideoControl::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + mDisplayCurrentTime = false; + update(); + event->accept(); +} + + + diff --git a/src/domain/UBGraphicsVideoItemDelegate.h b/src/domain/UBGraphicsVideoItemDelegate.h index 8fd36bcc..66dcd8a8 100644 --- a/src/domain/UBGraphicsVideoItemDelegate.h +++ b/src/domain/UBGraphicsVideoItemDelegate.h @@ -1,114 +1,116 @@ -/* - * 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 3 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 UBGRAPHICSVIDEOITEMDELEGATE_H_ -#define UBGRAPHICSVIDEOITEMDELEGATE_H_ - -#include -#include - -#include "core/UB.h" -#include "UBGraphicsItemDelegate.h" - -class QGraphicsSceneMouseEvent; -class QGraphicsItem; -class UBGraphicsVideoItem; - -class DelegateVideoControl: public QGraphicsRectItem -{ - public: - - DelegateVideoControl(UBGraphicsVideoItem* pDelegated, QGraphicsItem * parent = 0); - - virtual ~DelegateVideoControl() - { - // NOOP - } - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - - QPainterPath shape() const; - - void setAntiScale(qreal antiScale){ mAntiScale = antiScale; } - - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - - void updateTicker(qint64 time); - void totalTimeChanged( qint64 newTotalTime); - - protected: - - - void seekToMousePos(QPointF mousePos); - - UBGraphicsVideoItem* mDelegate; - bool mDisplayCurrentTime; - - qreal mAntiScale; - qint64 mCurrentTimeInMs; - qint64 mTotalTimeInMs; - -}; - - -class UBGraphicsVideoItemDelegate : public UBGraphicsItemDelegate -{ - Q_OBJECT - - public: - UBGraphicsVideoItemDelegate(UBGraphicsVideoItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent = 0); - virtual ~UBGraphicsVideoItemDelegate(); - - virtual void positionHandles(); - - public slots: - - void toggleMute(); - void updateTicker(qint64 time); - - protected slots: - - virtual void remove(bool canUndo = true); - - void togglePlayPause(); - - void mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate ); - - void updatePlayPauseState(); - - void totalTimeChanged( qint64 newTotalTime); - - protected: - - virtual void buildButtons(); - - private: - - UBGraphicsVideoItem* delegated(); - - DelegateButton* mPlayPauseButton; - DelegateButton* mStopButton; - DelegateButton* mMuteButton; - DelegateVideoControl *mVideoControl; - - Phonon::MediaObject* mMedia; - -}; - - -#endif /* UBGRAPHICSVIDEOITEMDELEGATE_H_ */ +/* + * 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 3 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 UBGRAPHICSVIDEOITEMDELEGATE_H_ +#define UBGRAPHICSVIDEOITEMDELEGATE_H_ + +#include +#include + +#include "core/UB.h" +#include "UBGraphicsItemDelegate.h" + +class QGraphicsSceneMouseEvent; +class QGraphicsItem; +class UBGraphicsVideoItem; + +class DelegateVideoControl: public QGraphicsRectItem +{ + public: + + DelegateVideoControl(UBGraphicsVideoItem* pDelegated, QGraphicsItem * parent = 0); + + virtual ~DelegateVideoControl() + { + // NOOP + } + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, + QWidget *widget); + + QPainterPath shape() const; + + void setAntiScale(qreal antiScale){ mAntiScale = antiScale; } + + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + + void updateTicker(qint64 time); + void totalTimeChanged( qint64 newTotalTime); + + protected: + + + void seekToMousePos(QPointF mousePos); + + UBGraphicsVideoItem* mDelegate; + bool mDisplayCurrentTime; + + qreal mAntiScale; + qint64 mCurrentTimeInMs; + qint64 mTotalTimeInMs; + + private: + int mStartWidth; + QRectF mBalloon; +}; + + +class UBGraphicsVideoItemDelegate : public UBGraphicsItemDelegate +{ + Q_OBJECT + + public: + UBGraphicsVideoItemDelegate(UBGraphicsVideoItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent = 0); + virtual ~UBGraphicsVideoItemDelegate(); + + virtual void positionHandles(); + + public slots: + + void toggleMute(); + void updateTicker(qint64 time); + + protected slots: + + virtual void remove(bool canUndo = true); + + void togglePlayPause(); + + void mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate ); + + void updatePlayPauseState(); + + void totalTimeChanged( qint64 newTotalTime); + + protected: + + virtual void buildButtons(); + + private: + + UBGraphicsVideoItem* delegated(); + + DelegateButton* mPlayPauseButton; + DelegateButton* mStopButton; + DelegateButton* mMuteButton; + DelegateVideoControl *mVideoControl; + + Phonon::MediaObject* mMedia; +}; + + +#endif /* UBGRAPHICSVIDEOITEMDELEGATE_H_ */ diff --git a/src/domain/ubgraphicsgroupcontaineritem.cpp b/src/domain/ubgraphicsgroupcontaineritem.cpp index 0a706099..22990d79 100644 --- a/src/domain/ubgraphicsgroupcontaineritem.cpp +++ b/src/domain/ubgraphicsgroupcontaineritem.cpp @@ -6,6 +6,8 @@ #include "domain/ubgraphicsgroupcontaineritemdelegate.h" #include "domain/UBGraphicsScene.h" +#include "core/memcheck.h" + UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent) : QGraphicsItemGroup(parent) { diff --git a/src/domain/ubgraphicsgroupcontaineritemdelegate.cpp b/src/domain/ubgraphicsgroupcontaineritemdelegate.cpp index ff763520..19997a2b 100644 --- a/src/domain/ubgraphicsgroupcontaineritemdelegate.cpp +++ b/src/domain/ubgraphicsgroupcontaineritemdelegate.cpp @@ -8,9 +8,10 @@ #include "domain/UBGraphicsDelegateFrame.h" #include "domain/ubgraphicsgroupcontaineritem.h" -#include "core/memcheck.h" #include "board/UBBoardController.h" +#include "core/memcheck.h" + UBGraphicsGroupContainerItemDelegate::UBGraphicsGroupContainerItemDelegate(QGraphicsItem *pDelegated, QObject *parent) : UBGraphicsItemDelegate(pDelegated, parent), mDestroyGroupButton(0) diff --git a/src/frameworks/UBCoreGraphicsScene.cpp b/src/frameworks/UBCoreGraphicsScene.cpp index 68ffed2d..9eb68db7 100644 --- a/src/frameworks/UBCoreGraphicsScene.cpp +++ b/src/frameworks/UBCoreGraphicsScene.cpp @@ -15,12 +15,13 @@ #include "UBCoreGraphicsScene.h" -#include "core/memcheck.h" #include "domain/UBGraphicsAudioItem.h" #include "domain/UBGraphicsVideoItem.h" #include "domain/UBGraphicsMediaItem.h" #include "domain/UBGraphicsWidgetItem.h" +#include "core/memcheck.h" + UBCoreGraphicsScene::UBCoreGraphicsScene(QObject * parent) : QGraphicsScene ( parent ) { diff --git a/src/gui/UBDockDownloadWidget.cpp b/src/gui/UBDockDownloadWidget.cpp index 4ce9d07e..a09ab966 100644 --- a/src/gui/UBDockDownloadWidget.cpp +++ b/src/gui/UBDockDownloadWidget.cpp @@ -17,6 +17,8 @@ #include "globals/UBGlobals.h" +#include "core/memcheck.h" + UBDockDownloadWidget::UBDockDownloadWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent, name) , mpLayout(NULL) , mpDLWidget(NULL) diff --git a/src/gui/UBDockTeacherGuideWidget.cpp b/src/gui/UBDockTeacherGuideWidget.cpp index cc1a7995..42599b66 100644 --- a/src/gui/UBDockTeacherGuideWidget.cpp +++ b/src/gui/UBDockTeacherGuideWidget.cpp @@ -19,6 +19,8 @@ #include "UBDockTeacherGuideWidget.h" #include "UBTeacherGuideWidget.h" +#include "core/memcheck.h" + UBDockTeacherGuideWidget::UBDockTeacherGuideWidget(QWidget* parent, const char* name): UBDockPaletteWidget(parent,name) diff --git a/src/gui/UBFeaturesActionBar.cpp b/src/gui/UBFeaturesActionBar.cpp index e9a560e1..ac009c48 100644 --- a/src/gui/UBFeaturesActionBar.cpp +++ b/src/gui/UBFeaturesActionBar.cpp @@ -1,4 +1,5 @@ #include "UBFeaturesActionBar.h" +#include "core/memcheck.h" UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWidget* parent, const char* name ) : QWidget (parent) , featuresController(controller) @@ -143,6 +144,16 @@ void UBFeaturesActionBar::setButtons() mpRemoveFavoriteBtn->show(); mpNewFolderBtn->hide(); break; + case IN_TRASH: + mpFavoriteBtn->hide(); + mpSocialBtn->hide(); + mSearchBar->show(); + //mpSearchBtn->show(); + //mpDeleteBtn->hide(); + mpCloseBtn->hide(); + //mpRemoveFavoriteBtn->show(); + mpNewFolderBtn->hide(); + break; default: break; } @@ -169,7 +180,9 @@ void UBFeaturesActionBar::dragMoveEvent(QDragMoveEvent *event) void UBFeaturesActionBar::dragEnterEvent( QDragEnterEvent *event ) { if (event->mimeData()->hasFormat("text/uri-list")) + { event->acceptProposedAction(); + } } void UBFeaturesActionBar::dropEvent( QDropEvent *event ) @@ -177,6 +190,12 @@ void UBFeaturesActionBar::dropEvent( QDropEvent *event ) QWidget *dest = childAt( event->pos() ); if ( dest == mpDeleteBtn ) { + QList urls = event->mimeData()->urls(); + foreach ( QUrl url, urls ) + { + if ( !UBFeaturesController::isDeletable( url ) ) + return; + } event->setDropAction( Qt::MoveAction ); event->accept(); emit deleteElements( *event->mimeData() ); diff --git a/src/gui/UBFeaturesActionBar.h b/src/gui/UBFeaturesActionBar.h index 653fbbac..a45371d8 100644 --- a/src/gui/UBFeaturesActionBar.h +++ b/src/gui/UBFeaturesActionBar.h @@ -12,7 +12,8 @@ enum UBFeaturesActionBarState IN_ROOT, IN_FOLDER, IN_PROPERTIES, - IN_FAVORITE + IN_FAVORITE, + IN_TRASH }; class UBFeaturesActionBar : public QWidget diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp index e3affd5c..f40f9e16 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -1,3 +1,5 @@ +#include + #include "UBFeaturesWidget.h" #include "domain/UBAbstractWidget.h" #include "gui/UBThumbnailWidget.h" @@ -6,6 +8,7 @@ #include "core/UBApplication.h" #include "core/UBDownloadManager.h" #include "globals/UBGlobals.h" +#include "board/UBBoardController.h" UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) { @@ -49,12 +52,14 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale //featuresListView->setStyleSheet( QString("background: #EEEEEE;border-radius: 10px;border: 2px solid #999999;") ); featuresListView->setDragDropMode( QAbstractItemView::DragDrop ); + featuresListView->setSelectionMode( QAbstractItemView::ContiguousSelection ); featuresListView->setModel( featuresProxyModel ); featuresListView->setResizeMode( QListView::Adjust ); featuresListView->setViewMode( QListView::IconMode ); itemDelegate = new UBFeaturesItemDelegate( this, featuresListView ); featuresListView->setItemDelegate( itemDelegate ); + //featuresListView->setSelectionRectVisible(false); featuresListView->setIconSize( QSize(defaultThumbnailSize, defaultThumbnailSize) ); featuresListView->setGridSize( QSize(defaultThumbnailSize * 1.75, defaultThumbnailSize * 1.75) ); @@ -70,13 +75,17 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale pathListView->setSelectionMode( QAbstractItemView::NoSelection ); pathListView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); pathListView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); + pathListView->setFlow( QListView::LeftToRight ); + pathListView->setWrapping(false); + //pathListView->setResizeMode( QListView::Adjust ); //pathListView->setMovement( QListView::Static ); - pathListView->setDragDropMode( QAbstractItemView::DragDrop ); + pathListView->setDragDropMode( QAbstractItemView::DropOnly ); pathScene = new QGraphicsScene(this); //pathViewer = new UBFeaturesPathViewer( QPixmap(":images/libpalette/home.png"), controller->getRootPath(), pathScene, this ); featureProperties = new UBFeatureProperties(this); + webView = new UBFeaturesWebView(this); //layout->addWidget( pathViewer ); //pathViewer->show(); @@ -86,6 +95,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale stackedWidget->addWidget( featuresListView ); stackedWidget->addWidget( featureProperties ); + stackedWidget->addWidget( webView ); stackedWidget->setCurrentIndex(ID_LISTVIEW); currentStackedWidget = ID_LISTVIEW; @@ -169,11 +179,20 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t) { mActionBar->setCurrentState( IN_FAVORITE ); } + else if (feature.getType() == FEATURE_TRASH) + { + mActionBar->setCurrentState( IN_TRASH ); + } else { mActionBar->setCurrentState( IN_FOLDER ); } } + else if ( feature.getType() == FEATURE_SEARCH ) + { + webView->showElement( feature ); + switchToWebView(); + } else { featureProperties->showElement( feature ); @@ -207,6 +226,10 @@ void UBFeaturesWidget::currentPathChanged(const QModelIndex &index) { mActionBar->setCurrentState( IN_FAVORITE ); } + else if (feature.getType() == FEATURE_TRASH) + { + mActionBar->setCurrentState( IN_TRASH ); + } else { mActionBar->setCurrentState( IN_FOLDER ); @@ -223,7 +246,6 @@ void UBFeaturesWidget::createNewFolder() featuresModel->addItem( newFolder ); featuresProxyModel->invalidate(); } - } void UBFeaturesWidget::deleteElements( const QMimeData & mimeData ) @@ -295,6 +317,11 @@ void UBFeaturesWidget::switchToProperties() currentStackedWidget = ID_PROPERTIES; } +void UBFeaturesWidget::switchToWebView() +{ + stackedWidget->setCurrentIndex(ID_WEBVIEW); + currentStackedWidget = ID_WEBVIEW; +} /* @@ -314,11 +341,39 @@ UBFeaturesWidget::~UBFeaturesWidget() { } -UBFeaturesListView::UBFeaturesListView( QWidget* parent, const char* name ) : QListView(parent) +UBFeaturesListView::UBFeaturesListView( QWidget* parent, const char* name ) +: QListView(parent) { setObjectName(name); + //rubberBand = new UBRubberBand( QRubberBand::Rectangle, this ); } +/* +void UBFeaturesListView::mousePressEvent( QMouseEvent *event ) +{ + rubberOrigin = event->pos(); + rubberBand->setGeometry( QRect( rubberOrigin, QSize() ) ); + //qDebug() << rubberOrigin.x() << rubberOrigin.y(); + rubberBand->show(); + QListView::mousePressEvent(event); +} + +void UBFeaturesListView::mouseMoveEvent( QMouseEvent *event ) +{ + QPoint current = event->pos(); + rubberBand->setGeometry( QRect( rubberOrigin, current ).normalized() ); + + //setSelection( rubberBand->rect(), QItemSelectionModel::Select ); + QListView::mouseMoveEvent(event); +} + +void UBFeaturesListView::mouseReleaseEvent( QMouseEvent *event ) +{ + rubberBand->hide(); + QListView::mouseReleaseEvent(event); +} + +*/ void UBFeaturesListView::dragEnterEvent( QDragEnterEvent *event ) { if ( event->mimeData()->hasUrls() ) @@ -335,6 +390,96 @@ void UBFeaturesListView::dropEvent( QDropEvent *event ) } +UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(parent) + , mpView(NULL) + , mpWebSettings(NULL) + , mpLayout(NULL) + , mpSankoreAPI(NULL) +{ + setObjectName(name); + + SET_STYLE_SHEET(); + + mpLayout = new QVBoxLayout(); + setLayout(mpLayout); + + mpView = new QWebView(this); + mpView->setObjectName("SearchEngineView"); + mpSankoreAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene()); + mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI); + + mpWebSettings = QWebSettings::globalSettings(); + mpWebSettings->setAttribute(QWebSettings::JavaEnabled, true); + mpWebSettings->setAttribute(QWebSettings::PluginsEnabled, true); + mpWebSettings->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true); + mpWebSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true); + mpWebSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); + mpWebSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); + mpWebSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true); + + mpLayout->addWidget(mpView); + + connect(mpView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); +} + +UBFeaturesWebView::~UBFeaturesWebView() +{ + if(NULL != mpSankoreAPI){ + delete mpSankoreAPI; + mpSankoreAPI = NULL; + } + if(NULL != mpView){ + delete mpView; + mpView = NULL; + } + if(NULL != mpLayout){ + delete mpLayout; + mpLayout = NULL; + } +} + +void UBFeaturesWebView::showElement(const UBFeature &elem) +{ + QString qsWidgetName; + QString path = elem.getFullPath(); + + QString qsConfigPath = QString("%0/config.xml").arg(path); + + if(QFile::exists(qsConfigPath)) + { + QFile f(qsConfigPath); + if(f.open(QIODevice::ReadOnly)) + { + QDomDocument domDoc; + domDoc.setContent(QString(f.readAll())); + QDomElement root = domDoc.documentElement(); + + QDomNode node = root.firstChild(); + while(!node.isNull()) + { + if(node.toElement().tagName() == "content") + { + QDomAttr srcAttr = node.toElement().attributeNode("src"); + qsWidgetName = srcAttr.value(); + break; + } + node = node.nextSibling(); + } + f.close(); + } + } + + mpView->load(QUrl::fromLocalFile(QString("%0/%1").arg(path).arg(qsWidgetName))); +} + +void UBFeaturesWebView::onLoadFinished(bool ok) +{ + if(ok && NULL != mpSankoreAPI){ + mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI); + } +} + + UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) : QWidget(parent) , mpLayout(NULL) , mpButtonLayout(NULL) @@ -460,6 +605,16 @@ void UBFeatureProperties::onAddToPage() UBFeatureProperties::~UBFeatureProperties() { + if ( mpOrigPixmap ) + { + delete mpOrigPixmap; + mpOrigPixmap = NULL; + } + if ( mpElement ) + { + delete mpElement; + mpElement = NULL; + } } UBFeatureItemButton::UBFeatureItemButton(QWidget *parent, const char *name):QPushButton(parent) @@ -536,19 +691,15 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act int endRow = 0; + UBFeature parentFeature; if ( !parent.isValid() ) { - return false; - /*if (row < 0) - endRow = featuresList->size(); - else - endRow = qMin( row, featuresList->size() );*/ + parentFeature = dynamic_cast(QObject::parent())->getFeaturesController()->getCurrentElement(); } else - endRow = parent.row(); - Q_UNUSED(endRow) //why do we need this variable? - - UBFeature parentFeature = parent.data( Qt::UserRole + 1).value(); + { + parentFeature = parent.data( Qt::UserRole + 1).value(); + } QList urls = mimeData->urls(); @@ -627,8 +778,25 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const return Qt::ItemIsDragEnabled | defaultFlags; if ( item.isFolder() && !item.getFullPath().isNull() ) return defaultFlags | Qt::ItemIsDropEnabled; - else return defaultFlags; + else return defaultFlags | Qt::ItemIsDropEnabled; } + /*if ( index.isValid() ) + { + UBFeature item = index.data( Qt::UserRole + 1 ).value(); + switch( item.getType() ) + { + case FEATURE_CATEGORY: + case FEATURE_FOLDER: + case FEATURE_FAVORITE: + case FEATURE_TRASH: + return Qt::ItemIsDropEnabled | Qt::ItemIsEnabled; + case FEATURE_INTERACTIVE: + case FEATURE_INTERNAL: + case FEATURE_ITEM: + return Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable; + default:; + } + }*/ return defaultFlags | Qt::ItemIsDropEnabled; } @@ -692,13 +860,7 @@ QString UBFeaturesItemDelegate::displayText ( const QVariant & value, const QLoc { const QFontMetrics fm = listView->fontMetrics(); const QSize iSize = listView->iconSize(); - - if ( iSize.width() > 0 && fm.width(text) > iSize.width() ) - { - while (fm.width(text) > iSize.width()) - text.resize(text.size()-1); - text += "..."; - } + return elidedText( fm, iSize.width(), Qt::ElideRight, text ); } return text; } diff --git a/src/gui/UBFeaturesWidget.h b/src/gui/UBFeaturesWidget.h index ea718f22..faaea0c4 100644 --- a/src/gui/UBFeaturesWidget.h +++ b/src/gui/UBFeaturesWidget.h @@ -18,12 +18,15 @@ #include "UBDockPaletteWidget.h" //#include "UBLibActionBar.h" #include "board/UBFeaturesController.h" +#include "api/UBWidgetUniboardAPI.h" #include "UBFeaturesActionBar.h" +#include "UBRubberBand.h" #define THUMBNAIL_WIDTH 400 #define ID_LISTVIEW 0 #define ID_PROPERTIES 1 +#define ID_WEBVIEW 2 class UBListModel; @@ -37,6 +40,7 @@ class UBFeaturesPathViewer; class UBFeatureProperties; class UBFeatureItemButton; class UBFeaturesListView; +class UBFeaturesWebView; class UBFeaturesWidget : public UBDockPaletteWidget { @@ -58,6 +62,7 @@ public: private: void switchToListView(); void switchToProperties(); + void switchToWebView(); UBFeaturesController *controller; @@ -78,7 +83,9 @@ private: QGraphicsScene *pathScene; UBFeaturesActionBar *mActionBar; UBFeatureProperties *featureProperties; + UBFeaturesWebView *webView; QStackedWidget *stackedWidget; + int currentStackedWidget; QModelIndex trashIndex; @@ -105,8 +112,32 @@ public: protected: virtual void dragEnterEvent( QDragEnterEvent *event ); virtual void dropEvent( QDropEvent *event ); + /*virtual void mousePressEvent( QMouseEvent *event ); + virtual void mouseMoveEvent( QMouseEvent *event ); + virtual void mouseReleaseEvent( QMouseEvent *event );*/ +private: + //UBRubberBand *rubberBand; + //QPoint rubberOrigin; }; +class UBFeaturesWebView : public QWidget +{ + Q_OBJECT +public: + UBFeaturesWebView(QWidget* parent = 0, const char* name = "UBFeaturesWebView"); + ~UBFeaturesWebView(); + + void showElement(const UBFeature &elem); + +private slots: + void onLoadFinished(bool ok); + +private: + QWebView* mpView; + QWebSettings* mpWebSettings; + QVBoxLayout* mpLayout; + UBWidgetUniboardAPI* mpSankoreAPI; +}; class UBFeatureProperties : public QWidget { @@ -174,7 +205,7 @@ public: Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; } - void setFeaturesList( QList *flist ) { featuresList = flist; } + void setFeaturesList(QList *flist ) { featuresList = flist; } private: QList *featuresList; }; diff --git a/src/gui/UBLibItemProperties.cpp b/src/gui/UBLibItemProperties.cpp index 4d2eada3..86c9233d 100644 --- a/src/gui/UBLibItemProperties.cpp +++ b/src/gui/UBLibItemProperties.cpp @@ -18,12 +18,13 @@ #include "core/UBApplication.h" #include "core/UBDownloadManager.h" -#include "core/memcheck.h" #include "frameworks/UBFileSystemUtils.h" #include "globals/UBGlobals.h" +#include "core/memcheck.h" + /** * \brief Constructor diff --git a/src/gui/UBLibNavigatorWidget.cpp b/src/gui/UBLibNavigatorWidget.cpp index 5974c4ea..d7b50551 100644 --- a/src/gui/UBLibNavigatorWidget.cpp +++ b/src/gui/UBLibNavigatorWidget.cpp @@ -16,10 +16,11 @@ #include "UBLibWidget.h" #include "core/UBApplication.h" -#include "core/memcheck.h" #include "globals/UBGlobals.h" +#include "core/memcheck.h" + static int lowBoundForSlider = 40; static int topBoundForSlider = 120; static int tickIntervalForSlider = 10; diff --git a/src/gui/UBLibPathViewer.cpp b/src/gui/UBLibPathViewer.cpp index fe31b290..9ca91d82 100644 --- a/src/gui/UBLibPathViewer.cpp +++ b/src/gui/UBLibPathViewer.cpp @@ -20,10 +20,11 @@ #include "core/UBApplication.h" #include "board/UBBoardController.h" -#include "core/memcheck.h" #include "core/UBDownloadManager.h" #include "board/UBBoardPaletteManager.h" +#include "core/memcheck.h" + /** * \brief Constructor * @param parent as the parent widget diff --git a/src/gui/UBLibWebView.cpp b/src/gui/UBLibWebView.cpp index ac6e11a5..a70cbcdc 100644 --- a/src/gui/UBLibWebView.cpp +++ b/src/gui/UBLibWebView.cpp @@ -1,7 +1,6 @@ #include #include "core/UBApplication.h" -#include "core/memcheck.h" #include "board/UBBoardController.h" @@ -9,7 +8,7 @@ #include "UBLibWebView.h" - +#include "core/memcheck.h" UBLibWebView::UBLibWebView(QWidget* parent, const char* name):QWidget(parent) , mpView(NULL) diff --git a/src/gui/UBLibWidget.cpp b/src/gui/UBLibWidget.cpp index 9765bae4..5fbfad49 100644 --- a/src/gui/UBLibWidget.cpp +++ b/src/gui/UBLibWidget.cpp @@ -17,10 +17,11 @@ #include "UBLibWidget.h" #include "core/UBApplication.h" -#include "core/memcheck.h" #include "globals/UBGlobals.h" +#include "core/memcheck.h" + /** * \brief Constructor * @param parent as the parent widget diff --git a/src/gui/UBPageNavigationWidget.cpp b/src/gui/UBPageNavigationWidget.cpp index 6ff72dd8..1d13223f 100644 --- a/src/gui/UBPageNavigationWidget.cpp +++ b/src/gui/UBPageNavigationWidget.cpp @@ -14,12 +14,13 @@ */ #include "UBPageNavigationWidget.h" #include "core/UBApplication.h" -#include "core/memcheck.h" #include "board/UBBoardController.h" #include "globals/UBGlobals.h" +#include "core/memcheck.h" + /** * \brief Constructor * @param parent as the parent widget @@ -175,7 +176,7 @@ void UBPageNavigationWidget::updateTime() */ void UBPageNavigationWidget::setPageNumber(int current, int total) { - mPageNbr->setText(QString("%1 / %2").arg(current).arg(total)); + mPageNbr->setText(QString("%1 / %2").arg(current).arg(UBApplication::boardController->sceneIndexFromPage(total))); } /** diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index d27ceffd..11c5cdab 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -44,6 +44,7 @@ #include "document/UBDocumentController.h" #include "domain/UBGraphicsTextItem.h" +#include "core/memcheck.h" #define UBTG_SEPARATOR_FIXED_HEIGHT 3 @@ -196,7 +197,6 @@ QDomElement* UBTeacherGuideEditionWidget::save(QDomElement* parentElement) void UBTeacherGuideEditionWidget::onActiveSceneChanged() { load(UBSvgSubsetAdaptor::sTeacherGuideNode); - qDebug() << "UBSvgSubsetAdaptor::sTeacherGuideNode " << UBSvgSubsetAdaptor::sTeacherGuideNode; mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->currentPage())); UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); if(mpDocumentTitle) diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index e5c6d657..0a109813 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -36,6 +36,8 @@ #include "frameworks/UBFileSystemUtils.h" +#include "core/memcheck.h" + /*************************************************************************** * class UBAddItem * diff --git a/src/pdf-merger/CCITTFaxDecode.cpp b/src/pdf-merger/CCITTFaxDecode.cpp index 1b9310c9..5c1ab0af 100644 --- a/src/pdf-merger/CCITTFaxDecode.cpp +++ b/src/pdf-merger/CCITTFaxDecode.cpp @@ -16,6 +16,8 @@ #include #include "CCITTFaxDecode.h" +#include "core/memcheck.h" + using namespace merge_lib; bool CCITTFaxDecode::encode(std::string & decoded) diff --git a/src/pdf-merger/DCTDecode.cpp b/src/pdf-merger/DCTDecode.cpp index 603926c5..392c4862 100644 --- a/src/pdf-merger/DCTDecode.cpp +++ b/src/pdf-merger/DCTDecode.cpp @@ -16,6 +16,8 @@ #include #include "DCTDecode.h" +#include "core/memcheck.h" + using namespace merge_lib; bool DCTDecode::encode(std::string & decoded) diff --git a/src/pdf-merger/JBIG2Decode.cpp b/src/pdf-merger/JBIG2Decode.cpp index 6ef248d0..f6e601de 100644 --- a/src/pdf-merger/JBIG2Decode.cpp +++ b/src/pdf-merger/JBIG2Decode.cpp @@ -15,6 +15,7 @@ #include #include "JBIG2Decode.h" +#include "core/memcheck.h" using namespace merge_lib; diff --git a/src/web/UBOEmbedParser.cpp b/src/web/UBOEmbedParser.cpp index 1cb8e1f8..786d2883 100644 --- a/src/web/UBOEmbedParser.cpp +++ b/src/web/UBOEmbedParser.cpp @@ -24,6 +24,8 @@ #include "UBOEmbedParser.h" +#include "core/memcheck.h" + UBOEmbedParser::UBOEmbedParser(QObject *parent, const char* name) { Q_UNUSED(parent); From b20862b75174f41b0d01cf77813f50ebb31b9aa6 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Sat, 5 May 2012 18:18:15 +0200 Subject: [PATCH 24/42] fixed issue with relativePath --- src/adaptors/UBSvgSubsetAdaptor.cpp | 21 ++++++- src/gui/UBTeacherGuideWidget.cpp | 81 +++++++++++++++++++------- src/gui/UBTeacherGuideWidget.h | 2 +- src/gui/UBTeacherGuideWidgetsTools.cpp | 10 ++-- src/gui/UBTeacherGuideWidgetsTools.h | 2 +- src/interfaces/IDataStorage.h | 19 +++++- 6 files changed, 104 insertions(+), 31 deletions(-) diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index c9af3e92..b7c94c18 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -120,7 +120,6 @@ QMatrix UBSvgSubsetAdaptor::fromSvgTransform(const QString& transform) static bool itemZIndexComp(const QGraphicsItem* item1, const QGraphicsItem* item2) { -// return item1->zValue() < item2->zValue(); return item1->data(UBGraphicsItemData::ItemOwnZValue).toReal() < item2->data(UBGraphicsItemData::ItemOwnZValue).toReal(); } @@ -1189,6 +1188,26 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene() openStroke = 0; } + QMap elements = getAdditionalElementToStore(); + QVector dataStorageItems = elements.value("teacherGuide")->save(); + foreach(tIDataStorage* eachItem, dataStorageItems){ + if(eachItem->type == eElementType_START){ + mXmlWriter.writeStartElement(eachItem->name); + foreach(QString key,eachItem->attributes.keys()) + mXmlWriter.writeAttribute(key,eachItem->attributes.value(key)); + } + else if (eachItem->type == eElementType_END) + mXmlWriter.writeEndElement(); + else if (eachItem->type == eElementType_UNIQUE){ + mXmlWriter.writeStartElement(eachItem->name); + foreach(QString key,eachItem->attributes.keys()) + mXmlWriter.writeAttribute(key,eachItem->attributes.value(key)); + mXmlWriter.writeEndElement(); + } + else + qWarning() << "unknown type"; + } + mXmlWriter.writeEndDocument(); QString fileName = mDocumentPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(mPageIndex)); QFile file(fileName); diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index df578d4b..7b9014dc 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -189,10 +189,49 @@ void UBTeacherGuideEditionWidget::load(QString element) -QDomElement* UBTeacherGuideEditionWidget::save(QDomElement* parentElement) +QVector UBTeacherGuideEditionWidget::save() { - qDebug() << parentElement; - return 0; + QVector result; + QMap attributes; + tIDataStorage* data = new tIDataStorage(); + data->name = "teacherBar"; + data->type = eElementType_START; + data->attributes.insert("version","1.50"); + result << data; + + data = new tIDataStorage(); + data->name = "title"; + data->type = eElementType_UNIQUE; + data->attributes.insert("value",mpPageTitle->text()); + result << data; + + data = new tIDataStorage(); + data->name = "comment"; + data->type = eElementType_UNIQUE; + data->attributes.insert("value",mpComment->text()); + result << data; + + QList children = getChildrenList(mpAddAnActionItem); + children << getChildrenList(mpAddAMediaItem); + children << getChildrenList(mpAddALinkItem); + + foreach(QTreeWidgetItem* widgetItem, children){ + tUBGEElementNode* node = dynamic_cast(mpTreeWidget->itemWidget(widgetItem,0))->saveData(); + if(node){ + data = new tIDataStorage(); + data->name = node->name; + data->type = eElementType_UNIQUE; + foreach(QString currentKey, node->attributes.keys()) + data->attributes.insert(currentKey,node->attributes.value(currentKey)); + result << data; + } + } + + data = new tIDataStorage(); + data->name = "teacherBar"; + data->type = eElementType_END; + result << data; + return result; } void UBTeacherGuideEditionWidget::onActiveSceneChanged() @@ -229,12 +268,12 @@ QVector UBTeacherGuideEditionWidget::getPageAndCommentData() { QVectorresult; tUBGEElementNode* pageTitle = new tUBGEElementNode(); - pageTitle->type = "pageTitle"; + pageTitle->name = "pageTitle"; pageTitle->attributes.insert("value",mpPageTitle->text()); result << pageTitle; tUBGEElementNode* comment = new tUBGEElementNode(); - comment->type = "comment"; + comment->name = "comment"; comment->attributes.insert("value",mpComment->text()); result << comment; return result; @@ -459,11 +498,11 @@ void UBTeacherGuidePresentationWidget::showData(QVector data) cleanData(); foreach(tUBGEElementNode* element, data){ - if(element->type == "pageTitle") + if(element->name == "pageTitle") mpPageTitle->showText(element->attributes.value("value")); - else if (element->type == "comment") + else if (element->name == "comment") mpComment->showText(element->attributes.value("value")); - else if(element->type == "action"){ + else if(element->name == "action"){ QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem(mpRootWidgetItem); newWidgetItem->setText(0,element->attributes.value("task")); newWidgetItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); @@ -477,14 +516,14 @@ void UBTeacherGuidePresentationWidget::showData(QVector data) mpRootWidgetItem->addChild(newWidgetItem); } - else if(element->type == "media"){ + else if(element->name == "media"){ createMediaButtonItem(); QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem(mpMediaSwitchItem); newWidgetItem->setIcon(0,QIcon(":images/teacherGuide/"+ element->attributes.value("mediaType") +".png")); newWidgetItem->setText(0,element->attributes.value("title")); newWidgetItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_MEDIA); newWidgetItem->setData(0,Qt::FontRole, QVariant(QFont(QApplication::font().family(),11))); - newWidgetItem->setData(0, TG_USER_ROLE_MIME_TYPE, element->attributes.value("relativePath")); + newWidgetItem->setData(0, TG_USER_ROLE_MIME_TYPE, UBApplication::boardController->activeDocument()->persistencePath()+ "/" + element->attributes.value("relativePath")); newWidgetItem->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable); mpRootWidgetItem->addChild(newWidgetItem); @@ -494,7 +533,7 @@ void UBTeacherGuidePresentationWidget::showData(QVector data) newWidgetItem->setExpanded(false); mpTreeWidget->setItemWidget(mediaItem,0,mediaWidget); } - else if(element->type == "link"){ + else if(element->name == "link"){ createMediaButtonItem(); QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem(mpMediaSwitchItem); newWidgetItem->setIcon(0,QIcon(":images/teacherGuide/link.png")); @@ -954,52 +993,52 @@ QVector UBTeacherGuidePageZeroWidget::getData() { QVectorresult; tUBGEElementNode* elementNode = new tUBGEElementNode(); - elementNode->type = "sessionTitle"; + elementNode->name = "sessionTitle"; elementNode->attributes.insert("value",mpSessionTitle->text()); result << elementNode; elementNode = new tUBGEElementNode(); - elementNode->type = "authors"; + elementNode->name = "authors"; elementNode->attributes.insert("value",mpAuthors->text()); result << elementNode; elementNode = new tUBGEElementNode(); - elementNode->type = "creationDate"; + elementNode->name = "creationDate"; elementNode->attributes.insert("value",mpCreationLabel->text()); result << elementNode; elementNode = new tUBGEElementNode(); - elementNode->type = "lastModifiedDate"; + elementNode->name = "lastModifiedDate"; elementNode->attributes.insert("value",mpLastModifiedLabel->text()); result << elementNode; elementNode = new tUBGEElementNode(); - elementNode->type = "goals"; + elementNode->name = "goals"; elementNode->attributes.insert("value",mpGoals->text()); result << elementNode; elementNode = new tUBGEElementNode(); - elementNode->type = "keywords"; + elementNode->name = "keywords"; elementNode->attributes.insert("value",mpKeywords->text()); result << elementNode; elementNode = new tUBGEElementNode(); - elementNode->type = "schoolLevel"; + elementNode->name = "schoolLevel"; elementNode->attributes.insert("value",mpSchoolLevelBox->currentText()); result << elementNode; elementNode = new tUBGEElementNode(); - elementNode->type = "schoolBranch"; + elementNode->name = "schoolBranch"; elementNode->attributes.insert("value",mpSchoolBranchBox->currentText()); result << elementNode; elementNode = new tUBGEElementNode(); - elementNode->type = "schoolType"; + elementNode->name = "schoolType"; elementNode->attributes.insert("value",mpSchoolTypeBox->currentText()); result << elementNode; elementNode = new tUBGEElementNode(); - elementNode->type = "licence"; + elementNode->name = "licence"; elementNode->attributes.insert("value",mpLicenceBox->currentText()); result << elementNode; return result; diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 81fb483f..387a7a64 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -48,7 +48,7 @@ public: QVector getData(); void load(QString element); - QDomElement* save(QDomElement* parentElement); + QVector save(); public slots: void onAddItemClicked(QTreeWidgetItem* widget, int column, QDomElement* element = 0); diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index 0a109813..eefb8714 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -101,7 +101,7 @@ void UBTGActionWidget::initializeWithDom(QDomElement element) tUBGEElementNode* UBTGActionWidget::saveData() { tUBGEElementNode* result = new tUBGEElementNode(); - result->type = "action"; + result->name = "action"; result->attributes.insert("owner",QString("%0").arg(mpOwner->currentIndex())); result->attributes.insert("task",mpTask->text()); return result; @@ -306,12 +306,12 @@ UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWi , mpMediaLabelWidget(NULL) , mpMediaWidget(NULL) , mpWebView(NULL) - , mMediaPath(mediaPath) , mIsPresentationMode(true) , mMediaType("") , mIsInitializationMode(false) { setObjectName(name); + mMediaPath = UBApplication::boardController->activeDocument()->persistencePath()+ "/" + mediaPath; setAcceptDrops(false); createWorkWidget(); setFixedHeight(200); @@ -361,9 +361,9 @@ tUBGEElementNode* UBTGMediaWidget::saveData() if(!mpTitle) return 0; tUBGEElementNode* result = new tUBGEElementNode(); - result->type = "media"; + result->name = "media"; result->attributes.insert("title",mpTitle->text()); - result->attributes.insert("relativePath",mMediaPath); + result->attributes.insert("relativePath",mMediaPath.replace(UBApplication::boardController->activeDocument()->persistencePath()+"/","")); result->attributes.insert("mediaType",mMediaType); return result; } @@ -534,7 +534,7 @@ void UBTGUrlWidget::initializeWithDom(QDomElement element) tUBGEElementNode* UBTGUrlWidget::saveData() { tUBGEElementNode* result = new tUBGEElementNode(); - result->type = "link"; + result->name = "link"; result->attributes.insert("title",mpTitle->text()); result->attributes.insert("url",mpUrl->text()); return result; diff --git a/src/gui/UBTeacherGuideWidgetsTools.h b/src/gui/UBTeacherGuideWidgetsTools.h index b15c2cfc..bb89add2 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.h +++ b/src/gui/UBTeacherGuideWidgetsTools.h @@ -42,7 +42,7 @@ class QDomElement; typedef struct { - QString type; + QString name; QMap attributes; }tUBGEElementNode; diff --git a/src/interfaces/IDataStorage.h b/src/interfaces/IDataStorage.h index 02695707..a703227d 100644 --- a/src/interfaces/IDataStorage.h +++ b/src/interfaces/IDataStorage.h @@ -16,12 +16,27 @@ #ifndef IDATASTORAGE_H #define IDATASTORAGE_H -class QDomElement; +#include +#include + +typedef enum +{ + eElementType_START, + eElementType_END, + eElementType_UNIQUE +}eElementType; + +typedef struct +{ + QString name; + QMap attributes; + eElementType type; +}tIDataStorage; class IDataStorage { public: virtual void load(QString element) = 0; - virtual QDomElement* save(QDomElement* parentElement) = 0 ; + virtual QVectorsave() = 0 ; }; #endif // IDATASTORAGE_H From f53d4b13f9f073d6293aa7f782732a25495eafcd Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Sat, 5 May 2012 18:39:34 +0200 Subject: [PATCH 25/42] french translation done --- resources/i18n/sankore_ar.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_da.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_de.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_en.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_en_UK.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_es.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_fr.ts | 203 ++++++++++++++++++++++++++--- resources/i18n/sankore_fr_CH.ts | 221 ++++++++++++++++++++++++++++---- resources/i18n/sankore_it.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_iw.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_ja.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_ko.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_nb.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_nl.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_pl.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_pt.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_rm.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_ro.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_ru.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_sk.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_sv.ts | 177 ++++++++++++++++++++++++- resources/i18n/sankore_zh.ts | 177 ++++++++++++++++++++++++- 22 files changed, 3885 insertions(+), 79 deletions(-) diff --git a/resources/i18n/sankore_ar.ts b/resources/i18n/sankore_ar.ts index e8dab019..5e154424 100644 --- a/resources/i18n/sankore_ar.ts +++ b/resources/i18n/sankore_ar.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ التصدير لمتصفح الويب + + UBFeatureProperties + + Add to page + الاضافة الى الصفحة + + + Set as background + تعيين كخلفية + + + Add to library + الاضافة الى المكتبة + + + Object informations + معلومات حول الأشياء + + + + UBFeaturesActionBar + + Add to favorites + الاضافة الى المفضلة + + + Share + تقاسم + + + Search + بحث + + + Delete + حذف + + + Back to folder + العودة الى المجلد + + + Remove from favorites + الحذف المفضلة + + + Create new folder + انشاء مجلد جديد + + + + UBGraphicsGroupContainerItemDelegate + + Locked + مقفل + + + Visible on Extended Screen + مرئي على الشاشة الكبيرة + + UBGraphicsItemDelegate @@ -1857,11 +1922,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2833,6 +2991,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_da.ts b/resources/i18n/sankore_da.ts index e8d23158..a964566b 100644 --- a/resources/i18n/sankore_da.ts +++ b/resources/i18n/sankore_da.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ Eksport til webbrowser + + UBFeatureProperties + + Add to page + Tilføj til side + + + Set as background + Brug som baggrund + + + Add to library + Tilføj til bibliotek + + + Object informations + Oplysninger om objekt + + + + UBFeaturesActionBar + + Add to favorites + Tilføj til favoritter + + + Share + Del + + + Search + Søg + + + Delete + Slet + + + Back to folder + Tilbage til mappe + + + Remove from favorites + Fjern fra favoritter + + + Create new folder + Opret ny mappe + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Låst + + + Visible on Extended Screen + Synlig på udvidet skærm + + UBGraphicsItemDelegate @@ -1863,11 +1928,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2840,6 +2998,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_de.ts b/resources/i18n/sankore_de.ts index 46df491a..95bf9796 100644 --- a/resources/i18n/sankore_de.ts +++ b/resources/i18n/sankore_de.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ In Web-Browser exportieren + + UBFeatureProperties + + Add to page + Zur Seite hinzufügen + + + Set as background + Als Hintergrund festlegen + + + Add to library + Zur Bibliothek hinzufügen + + + Object informations + Objektinformationen + + + + UBFeaturesActionBar + + Add to favorites + Zu Favoriten hinzufügen + + + Share + Teilen + + + Search + Suchen + + + Delete + Löschen + + + Back to folder + Zurück zum Ordner + + + Remove from favorites + Aus Favoritenliste entfernen + + + Create new folder + Neuen Ordner erstellen + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Gesperrt + + + Visible on Extended Screen + Auf erweitertem Bildschirm sichtbar + + UBGraphicsItemDelegate @@ -1863,11 +1928,104 @@ Möchten Sie diese Fehler auf diesem Computer ignorieren? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2840,6 +2998,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_en.ts b/resources/i18n/sankore_en.ts index eef93edd..44b72077 100644 --- a/resources/i18n/sankore_en.ts +++ b/resources/i18n/sankore_en.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ + + UBFeatureProperties + + Add to page + + + + Set as background + + + + Add to library + + + + Object informations + + + + + UBFeaturesActionBar + + Add to favorites + + + + Share + + + + Search + + + + Delete + + + + Back to folder + + + + Remove from favorites + + + + Create new folder + + + + + UBGraphicsGroupContainerItemDelegate + + Locked + + + + Visible on Extended Screen + + + UBGraphicsItemDelegate @@ -1857,11 +1922,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + - Document title + Type authors here ... + + Goal(s) + + + + Type goals here... + + + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2833,6 +2991,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_en_UK.ts b/resources/i18n/sankore_en_UK.ts index 1a355789..c95f69dd 100644 --- a/resources/i18n/sankore_en_UK.ts +++ b/resources/i18n/sankore_en_UK.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ + + UBFeatureProperties + + Add to page + + + + Set as background + + + + Add to library + + + + Object informations + + + + + UBFeaturesActionBar + + Add to favorites + + + + Share + + + + Search + + + + Delete + + + + Back to folder + + + + Remove from favorites + + + + Create new folder + + + + + UBGraphicsGroupContainerItemDelegate + + Locked + + + + Visible on Extended Screen + + + UBGraphicsItemDelegate @@ -1857,11 +1922,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + - Document title + Type authors here ... + + Goal(s) + + + + Type goals here... + + + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2833,6 +2991,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_es.ts b/resources/i18n/sankore_es.ts index ba9938d4..908ef5f8 100644 --- a/resources/i18n/sankore_es.ts +++ b/resources/i18n/sankore_es.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents Importar viejos documentos de Sankore o Uniboard + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ Exportar al explorador web + + UBFeatureProperties + + Add to page + Añadir a la página + + + Set as background + Definir como fondo + + + Add to library + Añadir a biblioteca + + + Object informations + Información del objeto + + + + UBFeaturesActionBar + + Add to favorites + Añadir a favoritos + + + Share + Compartir + + + Search + + + + Delete + Eliminar + + + Back to folder + Regresar a la carpeta + + + Remove from favorites + Eliminar de favoritos + + + Create new folder + Crear nueva carpeta + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Bloqueado + + + Visible on Extended Screen + Visible en pantalla extendida + + UBGraphicsItemDelegate @@ -1863,11 +1928,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2844,6 +3002,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_fr.ts b/resources/i18n/sankore_fr.ts index 29fd90e9..25b02ecc 100644 --- a/resources/i18n/sankore_fr.ts +++ b/resources/i18n/sankore_fr.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents Importer les anciens documents Sankoré et Uniboard + + Gtorup items + Groupe les éléments + PasswordDialog @@ -1331,6 +1335,67 @@ Exporter vers un navigateur Web + + UBFeatureProperties + + Add to page + Ajouter à la page + + + Set as background + Ajouter en arrière plan + + + Add to library + Ajouter à la librarie + + + Object informations + Informations + + + + UBFeaturesActionBar + + Add to favorites + Ajouter aux favoris + + + Share + Partager + + + Search + Rechercher + + + Delete + Supprimer + + + Back to folder + Retour au répertoire + + + Remove from favorites + Supprimer des favoris + + + Create new folder + Créer un nouveau dossier + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Verrouillé + + + Visible on Extended Screen + Visible sur l'écran de projection + + UBGraphicsItemDelegate @@ -1801,33 +1866,33 @@ Voulez-vous ignorer les erreurs pour ce serveur? UBTGActionWidget Teacher - + Professeur Student - + Elève Type task here ... - + Ajouter une action UBTGMediaWidget drop media here ... - + Glisser un média ici ... Type title here... - + Titre de l'activité UBTGUrlWidget Insert link title here... - + Titre @@ -1841,39 +1906,132 @@ Voulez-vous ignorer les erreurs pour ce serveur? UBTeacherGuideEditionWidget Type title here ... - + Titre Type comment here ... - + Commentaire, descriptif Add an action - + Ajouter une action Add a media - + Ajouter un média Add a link - + Ajouter un lien Page: %0 - + Page: %0 - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + Titre de la séance + + + Author(s) + Auteur(s) + + + Type authors here ... + Auteur(s) + + + Goal(s) + Objectif(s) + + + Type goals here... + Objectifs + + + Resource indexing + Indexation de la ressource + + + Keywords: + Mots clé(s) + + + Type keywords here ... + Mots clés + + + Level: + Niveau scolaire + + + Branch: + Discipline + - Document title + Type: + Type + + + Licence + Licence + + + Attribution CC BY - Page: %0 + Attribution-NoDerivs CC BY-ND + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + Crée le: + + + Updated the: + + Modifié le: + + + + UBTeacherGuidePresentationWidget + + Page: %0 + + UBThumbnailAdaptor @@ -2842,6 +3000,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_fr_CH.ts b/resources/i18n/sankore_fr_CH.ts index e44d3ccc..25b02ecc 100644 --- a/resources/i18n/sankore_fr_CH.ts +++ b/resources/i18n/sankore_fr_CH.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents Importer les anciens documents Sankoré et Uniboard + + Gtorup items + Groupe les éléments + PasswordDialog @@ -1196,8 +1200,8 @@ %1 pages copied - %1 page(s) copiée(s) - + %1 page copiée + %1 pages copiées @@ -1331,6 +1335,67 @@ Exporter vers un navigateur Web + + UBFeatureProperties + + Add to page + Ajouter à la page + + + Set as background + Ajouter en arrière plan + + + Add to library + Ajouter à la librarie + + + Object informations + Informations + + + + UBFeaturesActionBar + + Add to favorites + Ajouter aux favoris + + + Share + Partager + + + Search + Rechercher + + + Delete + Supprimer + + + Back to folder + Retour au répertoire + + + Remove from favorites + Supprimer des favoris + + + Create new folder + Créer un nouveau dossier + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Verrouillé + + + Visible on Extended Screen + Visible sur l'écran de projection + + UBGraphicsItemDelegate @@ -1473,7 +1538,7 @@ UBKeyboardPalette Enter - + Retour @@ -1801,33 +1866,33 @@ Voulez-vous ignorer les erreurs pour ce serveur? UBTGActionWidget Teacher - + Professeur Student - + Elève Type task here ... - + Ajouter une action UBTGMediaWidget drop media here ... - + Glisser un média ici ... Type title here... - + Titre de l'activité UBTGUrlWidget Insert link title here... - + Titre @@ -1841,39 +1906,132 @@ Voulez-vous ignorer les erreurs pour ce serveur? UBTeacherGuideEditionWidget Type title here ... - + Titre Type comment here ... - + Commentaire, descriptif Add an action - + Ajouter une action Add a media - + Ajouter un média Add a link - + Ajouter un lien Page: %0 - + Page: %0 - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + Titre de la séance + + + Author(s) + Auteur(s) + + + Type authors here ... + Auteur(s) + + + Goal(s) + Objectif(s) + + + Type goals here... + Objectifs + + + Resource indexing + Indexation de la ressource + + + Keywords: + Mots clé(s) + + + Type keywords here ... + Mots clés + + + Level: + Niveau scolaire + + + Branch: + Discipline + - Document title + Type: + Type + + + Licence + Licence + + + Attribution CC BY - Page: %0 + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + Crée le: + + + Updated the: + + Modifié le: + + + + UBTeacherGuidePresentationWidget + + Page: %0 + + UBThumbnailAdaptor @@ -2567,27 +2725,27 @@ p, li { white-space: pre-wrap; } Multi display - + Multi-écran Swap control display and view display - + Inverser les écrans Mode - + Mode Mode to start in: - + Démarrer en mode: Board - Tableau + Tableau Desktop - + Bureau Proxy User: @@ -2842,6 +3000,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_it.ts b/resources/i18n/sankore_it.ts index 82c562cf..e36e6437 100644 --- a/resources/i18n/sankore_it.ts +++ b/resources/i18n/sankore_it.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents Importa i vecchi documenti Sankoré o Uniboard + + Gtorup items + + PasswordDialog @@ -1331,6 +1335,67 @@ Esporta nel browser web + + UBFeatureProperties + + Add to page + Aggiungi alla pagina + + + Set as background + Imposta come sfondo + + + Add to library + Aggiungi alla libreria + + + Object informations + Informazioni sull'oggetto + + + + UBFeaturesActionBar + + Add to favorites + Aggiungi ai preferiti + + + Share + Condividi + + + Search + + + + Delete + Cancella + + + Back to folder + Torna alla cartella + + + Remove from favorites + Rimuovi dai preferiti + + + Create new folder + Crea nuova cartella + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Bloccato + + + Visible on Extended Screen + Visibile sullo schermo esteso + + UBGraphicsItemDelegate @@ -1865,11 +1930,104 @@ Vuoi ignorare gli errori per questo host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2846,6 +3004,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_iw.ts b/resources/i18n/sankore_iw.ts index f8b24ced..0a11fd45 100644 --- a/resources/i18n/sankore_iw.ts +++ b/resources/i18n/sankore_iw.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ ייצא לדפדפן + + UBFeatureProperties + + Add to page + הוסף לדף + + + Set as background + קבע כרקע + + + Add to library + הוסף לספרייה + + + Object informations + מידע על האובייקט + + + + UBFeaturesActionBar + + Add to favorites + הוסף למועדפים + + + Share + שתף + + + Search + + + + Delete + מחק + + + Back to folder + חזרה לקובץ + + + Remove from favorites + הסר מהמועדפים + + + Create new folder + צור תיקייה חדשה + + + + UBGraphicsGroupContainerItemDelegate + + Locked + נעול + + + Visible on Extended Screen + ניתן לראותו במסך רחב + + UBGraphicsItemDelegate @@ -1857,11 +1922,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2834,6 +2992,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_ja.ts b/resources/i18n/sankore_ja.ts index ef0b6697..ec8f21da 100644 --- a/resources/i18n/sankore_ja.ts +++ b/resources/i18n/sankore_ja.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ ウェブブラウザへエクスポート + + UBFeatureProperties + + Add to page + ページに追加 + + + Set as background + 背景として設定 + + + Add to library + ライブラリに追加 + + + Object informations + オブジェクトインフォーメーション + + + + UBFeaturesActionBar + + Add to favorites + お気に入りに追加 + + + Share + シェアする + + + Search + 検索 + + + Delete + 削除 + + + Back to folder + フォルダーに戻る + + + Remove from favorites + お気に入りから削除 + + + Create new folder + 新規フォルダーを作成 + + + + UBGraphicsGroupContainerItemDelegate + + Locked + ロック + + + Visible on Extended Screen + 拡張画面でみることができます + + UBGraphicsItemDelegate @@ -1864,11 +1929,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2841,6 +2999,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_ko.ts b/resources/i18n/sankore_ko.ts index fcbfa379..8216c3ca 100644 --- a/resources/i18n/sankore_ko.ts +++ b/resources/i18n/sankore_ko.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ 웹 브라우저로 내보내기 + + UBFeatureProperties + + Add to page + 페이지에 추가 + + + Set as background + 배경으로 지정 + + + Add to library + 라이브러리에 추가 + + + Object informations + 객체 정보 + + + + UBFeaturesActionBar + + Add to favorites + 즐겨찾기에 추가 + + + Share + 공유 + + + Search + 검색 + + + Delete + 삭제 + + + Back to folder + 폴더로 돌아가기 + + + Remove from favorites + 즐겨찾기에서 제거 + + + Create new folder + 새 폴더 만들기 + + + + UBGraphicsGroupContainerItemDelegate + + Locked + 잠김 + + + Visible on Extended Screen + 확장 화면에 보이기 + + UBGraphicsItemDelegate @@ -1863,11 +1928,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2844,6 +3002,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_nb.ts b/resources/i18n/sankore_nb.ts index ea4200cf..38c5ed50 100644 --- a/resources/i18n/sankore_nb.ts +++ b/resources/i18n/sankore_nb.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1330,6 +1334,67 @@ Eksporter til nettleser + + UBFeatureProperties + + Add to page + Legg til side + + + Set as background + Bruk som bakgrunn + + + Add to library + Legg til bibliotek + + + Object informations + Objektopplysninger + + + + UBFeaturesActionBar + + Add to favorites + Legg til favoritter + + + Share + Del + + + Search + Søk + + + Delete + + + + Back to folder + Tilbake til mappe + + + Remove from favorites + Fjern fra favoritter + + + Create new folder + Opprett ny mappe + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Låst + + + Visible on Extended Screen + Synlig på utvidet skjerm + + UBGraphicsItemDelegate @@ -1858,11 +1923,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2838,6 +2996,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_nl.ts b/resources/i18n/sankore_nl.ts index f88a567f..812ea07e 100644 --- a/resources/i18n/sankore_nl.ts +++ b/resources/i18n/sankore_nl.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ Exporteren naar Web Browser + + UBFeatureProperties + + Add to page + Aan pagina toevoegen + + + Set as background + Als achtergrond gebruiken + + + Add to library + Aan bibliotheek toevoegen + + + Object informations + Object informaties + + + + UBFeaturesActionBar + + Add to favorites + Aan favorieten toevoegen + + + Share + Delen + + + Search + Zoeken + + + Delete + Verwijderen + + + Back to folder + Terug naar map + + + Remove from favorites + Uit favorieten verwijderen + + + Create new folder + Nieuwe map maken + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Vergrendeld + + + Visible on Extended Screen + Weergeven op Verbreed scherm + + UBGraphicsItemDelegate @@ -1857,11 +1922,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2833,6 +2991,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_pl.ts b/resources/i18n/sankore_pl.ts index c28e1f13..4a7fa701 100644 --- a/resources/i18n/sankore_pl.ts +++ b/resources/i18n/sankore_pl.ts @@ -800,6 +800,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1330,6 +1334,67 @@ Eksportowanie do przeglądarki sieci Web + + UBFeatureProperties + + Add to page + Dodaj do strony + + + Set as background + Ustaw jako tło + + + Add to library + Dodaj do biblioteki + + + Object informations + Informacje o obiekcie + + + + UBFeaturesActionBar + + Add to favorites + Dodaj do ulubionych + + + Share + Udostępniaj + + + Search + Szukaj + + + Delete + Usuń + + + Back to folder + Powrót do folderu + + + Remove from favorites + Usuń z ulubionych + + + Create new folder + Utwórz nowy folder + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Zablokowane + + + Visible on Extended Screen + Widoczne na ekranie rozszerzonym + + UBGraphicsItemDelegate @@ -1864,11 +1929,104 @@ Czy chcesz ignorować te błędy dla tego hosta? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2846,6 +3004,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_pt.ts b/resources/i18n/sankore_pt.ts index d8e58cac..2b2388ee 100644 --- a/resources/i18n/sankore_pt.ts +++ b/resources/i18n/sankore_pt.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ + + UBFeatureProperties + + Add to page + + + + Set as background + + + + Add to library + + + + Object informations + + + + + UBFeaturesActionBar + + Add to favorites + + + + Share + + + + Search + + + + Delete + + + + Back to folder + + + + Remove from favorites + + + + Create new folder + + + + + UBGraphicsGroupContainerItemDelegate + + Locked + + + + Visible on Extended Screen + + + UBGraphicsItemDelegate @@ -1857,11 +1922,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + - Document title + Type authors here ... + + Goal(s) + + + + Type goals here... + + + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2833,6 +2991,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_rm.ts b/resources/i18n/sankore_rm.ts index bb9b2e7b..6084285a 100644 --- a/resources/i18n/sankore_rm.ts +++ b/resources/i18n/sankore_rm.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ + + UBFeatureProperties + + Add to page + + + + Set as background + + + + Add to library + + + + Object informations + + + + + UBFeaturesActionBar + + Add to favorites + + + + Share + + + + Search + + + + Delete + + + + Back to folder + + + + Remove from favorites + + + + Create new folder + + + + + UBGraphicsGroupContainerItemDelegate + + Locked + + + + Visible on Extended Screen + + + UBGraphicsItemDelegate @@ -1857,11 +1922,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + - Document title + Type authors here ... + + Goal(s) + + + + Type goals here... + + + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2833,6 +2991,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_ro.ts b/resources/i18n/sankore_ro.ts index 00316c90..de1591e2 100644 --- a/resources/i18n/sankore_ro.ts +++ b/resources/i18n/sankore_ro.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ Exportare în browser web + + UBFeatureProperties + + Add to page + Adăugare la pagină + + + Set as background + Setare ca fundal + + + Add to library + Adăugare la bibliotecă + + + Object informations + Informaţii despre obiect + + + + UBFeaturesActionBar + + Add to favorites + Adăugare la favorite + + + Share + Distribuire + + + Search + Căutare + + + Delete + Ştergere + + + Back to folder + Înapoi la folder + + + Remove from favorites + Eliminare din favorite + + + Create new folder + Creare folder nou + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Blocat + + + Visible on Extended Screen + Vizibil pe ecran extins + + UBGraphicsItemDelegate @@ -1863,11 +1928,104 @@ Doriţi să ignoraţi aceste erori pentru acest host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2844,6 +3002,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_ru.ts b/resources/i18n/sankore_ru.ts index de76b79e..48172401 100644 --- a/resources/i18n/sankore_ru.ts +++ b/resources/i18n/sankore_ru.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1331,6 +1335,67 @@ Экспорт в веб-браузер + + UBFeatureProperties + + Add to page + Добавить на страницу + + + Set as background + Сделать фоновым изображением + + + Add to library + Добавить в библиотеку + + + Object informations + Информация об объекте + + + + UBFeaturesActionBar + + Add to favorites + Добавить в избранное + + + Share + Совместный доступ + + + Search + Поиск + + + Delete + Удалить + + + Back to folder + Назад в папку + + + Remove from favorites + Удалить из избранного + + + Create new folder + Создать новую папку + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Заблокированный + + + Visible on Extended Screen + Видимый на втором экране + + UBGraphicsItemDelegate @@ -1865,11 +1930,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2846,6 +3004,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_sk.ts b/resources/i18n/sankore_sk.ts index 7f1dc035..68d6f10a 100644 --- a/resources/i18n/sankore_sk.ts +++ b/resources/i18n/sankore_sk.ts @@ -799,6 +799,10 @@ Erase Annotation Vymazať anotáciu + + Gtorup items + + PasswordDialog @@ -1333,6 +1337,67 @@ Exportovať do webového prehliadača + + UBFeatureProperties + + Add to page + Pridať na stránku + + + Set as background + Nastaviť ako pozadie + + + Add to library + Pridať do knižnice + + + Object informations + Informácie o objekte + + + + UBFeaturesActionBar + + Add to favorites + Ajouter au favoris + + + Share + Partager + + + Search + + + + Delete + + + + Back to folder + Retour au répertoire + + + Remove from favorites + Supprimer des favoris + + + Create new folder + Créer un nouveau dossier + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Zamknuté + + + Visible on Extended Screen + Vidieť to na rozšírenej obrazovke + + UBGraphicsItemDelegate @@ -1867,11 +1932,104 @@ Chcete ignorovať tieto chyby na tomto serveri? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2848,6 +3006,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_sv.ts b/resources/i18n/sankore_sv.ts index 1d7547b7..0264b215 100644 --- a/resources/i18n/sankore_sv.ts +++ b/resources/i18n/sankore_sv.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ Exportera till Webläsare + + UBFeatureProperties + + Add to page + Lägg till sida + + + Set as background + Infoga som bakgrund + + + Add to library + Lägg till bibliotek + + + Object informations + Objekt information + + + + UBFeaturesActionBar + + Add to favorites + Lägg till favoriter + + + Share + Dela + + + Search + Sök + + + Delete + Radera + + + Back to folder + Tillbaka till mapp + + + Remove from favorites + Ta bort från favoriter + + + Create new folder + Skapa ny mapp + + + + UBGraphicsGroupContainerItemDelegate + + Locked + Låst + + + Visible on Extended Screen + Synlig på utvidgad skärm + + UBGraphicsItemDelegate @@ -1863,11 +1928,104 @@ Vill du ignorera felen för den här värden? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2844,6 +3002,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog diff --git a/resources/i18n/sankore_zh.ts b/resources/i18n/sankore_zh.ts index 9c3a3869..345a332c 100644 --- a/resources/i18n/sankore_zh.ts +++ b/resources/i18n/sankore_zh.ts @@ -799,6 +799,10 @@ Import old Sankore or Uniboard documents + + Gtorup items + + PasswordDialog @@ -1329,6 +1333,67 @@ 导出到网页浏览器 + + UBFeatureProperties + + Add to page + 添加至页面 + + + Set as background + 设置为背景 + + + Add to library + 添加至图书馆 + + + Object informations + 素材信息 + + + + UBFeaturesActionBar + + Add to favorites + 添加至收藏夹 + + + Share + 分享 + + + Search + 搜索 + + + Delete + 删除 + + + Back to folder + 返回上级文件夹 + + + Remove from favorites + 从收藏夹中移除 + + + Create new folder + 新建文件夹 + + + + UBGraphicsGroupContainerItemDelegate + + Locked + 位置锁定 + + + Visible on Extended Screen + 宽屏上可见 + + UBGraphicsItemDelegate @@ -1863,11 +1928,104 @@ Do you want to ignore these errors for this host? - UBTeacherGuidePresentationWidget + UBTeacherGuidePageZeroWidget + + Page 0 + + + + Type session title here ... + + + + Author(s) + + + + Type authors here ... + + + + Goal(s) + + - Document title + Type goals here... + + Resource indexing + + + + Keywords: + + + + Type keywords here ... + + + + Level: + + + + Branch: + + + + Type: + + + + Licence + + + + Attribution CC BY + + + + Attribution-NoDerivs CC BY-ND + + + + Attribution-ShareAlike CC BY-SA + + + + Attribution-NonCommercial CC BY-NC + + + + Attribution-NonCommercial-NoDerivs CC BY-NC-ND + + + + Attribution-NonCommercial-ShareAlike CC BY-NC-SA + + + + Public domain + + + + Copyright + + + + Created the: + + + + + Updated the: + + + + + + UBTeacherGuidePresentationWidget Page: %0 @@ -2840,6 +2998,21 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; color:#3c3c3c;">GIPENA</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Délégation Interministérielle à l'Education Numérique en Afrique</span><span style=" font-size:9pt;"><br /></span><span style=" font-size:9pt; color:#3c3c3c;">20 Avenue Ségur Paris 75007</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">Téléphone : 01 43 17 68 08</span><span style=" font-size:9pt;"><br /><br /></span><span style=" font-size:9pt; color:#3c3c3c;">email: </span><a href="mailto:contact@sankore.org"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">contact@sankore.org</span></a><span style=" font-size:9pt;"> </span></p></body></html> + + Credits + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + trapFlashDialog From cb0f817b1919724d3f37132c32a99b33c8db8b21 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Sat, 5 May 2012 20:59:28 +0200 Subject: [PATCH 26/42] changed teacherbar with teacherGuide --- src/gui/UBTeacherGuideWidget.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 7b9014dc..758088c6 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -194,7 +194,7 @@ QVector UBTeacherGuideEditionWidget::save() QVector result; QMap attributes; tIDataStorage* data = new tIDataStorage(); - data->name = "teacherBar"; + data->name = "teacherGuide"; data->type = eElementType_START; data->attributes.insert("version","1.50"); result << data; @@ -228,7 +228,7 @@ QVector UBTeacherGuideEditionWidget::save() } data = new tIDataStorage(); - data->name = "teacherBar"; + data->name = "teacherGuide"; data->type = eElementType_END; result << data; return result; @@ -236,11 +236,16 @@ QVector UBTeacherGuideEditionWidget::save() void UBTeacherGuideEditionWidget::onActiveSceneChanged() { - load(UBSvgSubsetAdaptor::sTeacherGuideNode); - mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->currentPage())); - UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); - if(mpDocumentTitle) - mpDocumentTitle->setText(documentProxy->metaData(UBSettings::sessionTitle).toString()); + int currentPage = UBApplication::boardController->currentPage(); + if(currentPage > 0){ + cleanData(); + qDebug() << UBSvgSubsetAdaptor::sTeacherGuideNode; + load(UBSvgSubsetAdaptor::sTeacherGuideNode); + mpPageNumberLabel->setText(tr("Page: %0").arg(currentPage)); + UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); + if(mpDocumentTitle) + mpDocumentTitle->setText(documentProxy->metaData(UBSettings::sessionTitle).toString()); + } } void UBTeacherGuideEditionWidget::cleanData() From bbb5ba76ca1d38fe40c9c67e4e484ba377e98721 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Sun, 6 May 2012 09:13:36 +0200 Subject: [PATCH 27/42] fixed issue with date format --- src/gui/UBTeacherGuideWidget.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 758088c6..e0389b44 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -618,8 +618,8 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons { setObjectName(name); QString chapterStyle("QLabel {font-size:16px; font-weight:bold;}"); - - mpLayout = new QVBoxLayout(this); + mpLayout = new QVBoxLayout(0); + setLayout(mpLayout); mpPageNumberLabel = new QLabel(this); mpPageNumberLabel->setAlignment(Qt::AlignRight); mpPageNumberLabel->setObjectName("UBTGPageNumberLabel"); @@ -756,7 +756,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpLayout->addLayout(mpLicenceLayout); mpLayout->addStretch(1); - setLayout(mpLayout); + connect(UBApplication::boardController,SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged())); fillComboBoxes(); } @@ -870,9 +870,9 @@ void UBTeacherGuidePageZeroWidget::onActiveSceneChanged() UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); if(documentProxy && UBApplication::boardController->currentPage() == 0){ QDateTime creationDate = documentProxy->documentDate(); - mpCreationLabel->setText(tr("Created the:\n") + creationDate.toString(Qt::SystemLocaleShortDate)); + mpCreationLabel->setText(tr("Created the:\n") + creationDate.toString(Qt::DefaultLocaleShortDate)); QDateTime updatedDate = documentProxy->lastUpdate(); - mpLastModifiedLabel->setText(tr("Updated the:\n") + updatedDate.toString(Qt::SystemLocaleShortDate)); + mpLastModifiedLabel->setText(tr("Updated the:\n") + updatedDate.toString(Qt::DefaultLocaleShortDate)); loadData(); updateSceneTitle(); } From cd7a2cd39f7a118ad30a30de3bf6e0ad51bd9a88 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Sun, 6 May 2012 09:13:58 +0200 Subject: [PATCH 28/42] fixed space before date --- resources/i18n/sankore_fr.ts | 4 ++-- resources/i18n/sankore_fr_CH.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/i18n/sankore_fr.ts b/resources/i18n/sankore_fr.ts index 25b02ecc..23085912 100644 --- a/resources/i18n/sankore_fr.ts +++ b/resources/i18n/sankore_fr.ts @@ -2018,12 +2018,12 @@ Voulez-vous ignorer les erreurs pour ce serveur? Created the: - Crée le: + Crée le: Updated the: - Modifié le: + Modifié le: diff --git a/resources/i18n/sankore_fr_CH.ts b/resources/i18n/sankore_fr_CH.ts index 25b02ecc..23085912 100644 --- a/resources/i18n/sankore_fr_CH.ts +++ b/resources/i18n/sankore_fr_CH.ts @@ -2018,12 +2018,12 @@ Voulez-vous ignorer les erreurs pour ce serveur? Created the: - Crée le: + Crée le: Updated the: - Modifié le: + Modifié le: From f602efd3ba77fe02b515cd72d29375c25f84bddd Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Sun, 6 May 2012 09:15:13 +0200 Subject: [PATCH 29/42] fixed issue with page zero default font family --- src/domain/UBGraphicsScene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 387c7f72..e0089662 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1490,7 +1490,7 @@ UBGraphicsTextItem* UBGraphicsScene::textForObjectName(const QString& pString, c } } if(!textItem){ - textItem = addTextWithFont(pString,QPointF(0,0) ,48,"",true,false); + textItem = addTextWithFont(pString,QPointF(0,0) ,72,UBSettings::settings()->fontFamily(),true,false); textItem->setObjectName(objectName); } From 46b33afae3609e4672ab736c00874fa5d6b96d7a Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Mon, 7 May 2012 11:07:29 +0200 Subject: [PATCH 30/42] added page on save call --- src/adaptors/UBSvgSubsetAdaptor.cpp | 10 +++++++--- src/adaptors/UBSvgSubsetAdaptor.h | 2 +- src/gui/UBTeacherGuideWidget.cpp | 22 +++++++++++++--------- src/gui/UBTeacherGuideWidget.h | 2 +- src/interfaces/IDataStorage.h | 2 +- 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index b7c94c18..5fc372fe 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -333,6 +333,9 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() UBGraphicsStrokesGroup* strokesGroup = 0; UBDrawingController* dc = UBDrawingController::drawingController(); + sTeacherGuideNode = ""; + + while (!mXmlReader.atEnd()) { mXmlReader.readNext(); @@ -915,7 +918,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() void UBSvgSubsetAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* pScene, const int pageIndex) { UBSvgSubsetWriter writer(proxy, pScene, pageIndex); - writer.persistScene(); + writer.persistScene(pageIndex); } @@ -963,8 +966,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement() mXmlWriter.writeEndElement(); } -bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene() +bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) { + sTeacherGuideNode = ""; if (mScene->isModified()) { QBuffer buffer; @@ -1189,7 +1193,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene() } QMap elements = getAdditionalElementToStore(); - QVector dataStorageItems = elements.value("teacherGuide")->save(); + QVector dataStorageItems = elements.value("teacherGuide")->save(pageIndex); foreach(tIDataStorage* eachItem, dataStorageItems){ if(eachItem->type == eElementType_START){ mXmlWriter.writeStartElement(eachItem->name); diff --git a/src/adaptors/UBSvgSubsetAdaptor.h b/src/adaptors/UBSvgSubsetAdaptor.h index 37eacb07..8edb3389 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.h +++ b/src/adaptors/UBSvgSubsetAdaptor.h @@ -164,7 +164,7 @@ class UBSvgSubsetAdaptor UBSvgSubsetWriter(UBDocumentProxy* proxy, UBGraphicsScene* pScene, const int pageIndex); - bool persistScene(); + bool persistScene(int pageIndex); virtual ~UBSvgSubsetWriter(){} diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index e0389b44..b51b9232 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -189,10 +189,11 @@ void UBTeacherGuideEditionWidget::load(QString element) -QVector UBTeacherGuideEditionWidget::save() +QVector UBTeacherGuideEditionWidget::save(int pageIndex) { QVector result; - QMap attributes; + if(pageIndex != UBApplication::boardController->currentPage()) + return result; tIDataStorage* data = new tIDataStorage(); data->name = "teacherGuide"; data->type = eElementType_START; @@ -239,7 +240,7 @@ void UBTeacherGuideEditionWidget::onActiveSceneChanged() int currentPage = UBApplication::boardController->currentPage(); if(currentPage > 0){ cleanData(); - qDebug() << UBSvgSubsetAdaptor::sTeacherGuideNode; + qDebug() << "active scene changed current page " << currentPage << " " << UBSvgSubsetAdaptor::sTeacherGuideNode; load(UBSvgSubsetAdaptor::sTeacherGuideNode); mpPageNumberLabel->setText(tr("Page: %0").arg(currentPage)); UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); @@ -936,14 +937,18 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) mpModePushButton->hide(); mpSessionTitle->setReadOnly(false); mpSessionTitle->setStyleSheet(inputStyleSheet); + mpSessionTitle->setTextColor(QColor(Qt::lightGray)); QFont titleFont(QApplication::font().family(),11,-1); mpSessionTitle->document()->setDefaultFont(titleFont); mpAuthors->setReadOnly(false); mpAuthors->setStyleSheet(inputStyleSheet); + mpAuthors->setTextColor(QColor(Qt::lightGray)); mpGoals->setReadOnly(false); mpGoals->setStyleSheet(inputStyleSheet); + mpGoals->setTextColor(QColor(Qt::lightGray)); mpKeywords->setReadOnly(false); mpKeywords->setStyleSheet(inputStyleSheet); + mpKeywords->setTextColor(QColor(Qt::lightGray)); mpSchoolLevelValueLabel->hide(); mpSchoolLevelBox->show(); mpSchoolBranchValueLabel->hide(); @@ -957,21 +962,20 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) else{ QString inputStyleSheet("QTextEdit { background: transparent; border: none;}"); mpModePushButton->show(); - mpSessionTitle->setReadOnly(true); - updateSceneTitle(); + mpSessionTitle->showText(mpSessionTitle->text()); mpSessionTitle->setStyleSheet(inputStyleSheet); - mpSessionTitle->setTextColor(QColor(Qt::black)); + updateSceneTitle(); QFont titleFont(QApplication::font().family(),14,1); mpSessionTitle->document()->setDefaultFont(titleFont); - mpAuthors->setReadOnly(true); mpAuthors->setStyleSheet(inputStyleSheet); mpAuthors->setTextColor(QColor(Qt::black)); - mpGoals->setReadOnly(true); + mpAuthors->showText(mpAuthors->text()); mpGoals->setStyleSheet(inputStyleSheet); mpGoals->setTextColor(QColor(Qt::black)); - mpKeywords->setReadOnly(true); + mpGoals->showText(mpGoals->text()); mpKeywords->setStyleSheet(inputStyleSheet); mpKeywords->setTextColor(QColor(Qt::black)); + mpKeywords->showText(mpKeywords->text()); mpSchoolLevelValueLabel->setText(mpSchoolLevelBox->currentText()); mpSchoolLevelValueLabel->show(); mpSchoolLevelBox->hide(); diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 387a7a64..3f9834c4 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -48,7 +48,7 @@ public: QVector getData(); void load(QString element); - QVector save(); + QVector save(int pageIndex); public slots: void onAddItemClicked(QTreeWidgetItem* widget, int column, QDomElement* element = 0); diff --git a/src/interfaces/IDataStorage.h b/src/interfaces/IDataStorage.h index a703227d..10e69c93 100644 --- a/src/interfaces/IDataStorage.h +++ b/src/interfaces/IDataStorage.h @@ -37,6 +37,6 @@ class IDataStorage { public: virtual void load(QString element) = 0; - virtual QVectorsave() = 0 ; + virtual QVectorsave(int pageIndex) = 0 ; }; #endif // IDATASTORAGE_H From abd1c8cb1ab03fe58cb5ad2ae54881bbe0e97aa8 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 9 May 2012 09:10:21 +0200 Subject: [PATCH 31/42] fixed issue with handling zero pages --- src/adaptors/UBSvgSubsetAdaptor.cpp | 10 ++-- src/adaptors/UBThumbnailAdaptor.cpp | 9 ++-- .../publishing/UBDocumentPublisher.cpp | 6 +-- src/core/UBPersistenceManager.cpp | 54 +++++++++---------- src/document/UBDocumentController.cpp | 3 +- src/document/UBDocumentController.h | 3 -- src/frameworks/UBFileSystemUtils.cpp | 8 ++- src/gui/UBDocumentNavigator.cpp | 1 + src/gui/UBDocumentTreeWidget.cpp | 4 +- src/gui/UBTeacherGuideWidget.cpp | 3 -- src/gui/UBThumbnailWidget.cpp | 17 +++--- 11 files changed, 62 insertions(+), 56 deletions(-) diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 5fc372fe..49bb4b6b 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -143,7 +143,7 @@ void UBSvgSubsetAdaptor::upgradeScene(UBDocumentProxy* proxy, const int pageInde QDomDocument UBSvgSubsetAdaptor::loadSceneDocument(UBDocumentProxy* proxy, const int pPageIndex) { - QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(pPageIndex)); + QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg",pPageIndex); QFile file(fileName); QDomDocument doc("page"); @@ -166,7 +166,7 @@ QDomDocument UBSvgSubsetAdaptor::loadSceneDocument(UBDocumentProxy* proxy, const void UBSvgSubsetAdaptor::setSceneUuid(UBDocumentProxy* proxy, const int pageIndex, QUuid pUuid) { - QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); + QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg",pageIndex); QFile file(fileName); @@ -234,7 +234,7 @@ QString UBSvgSubsetAdaptor::uniboardDocumentNamespaceUriFromVersion(int mFileVer UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const int pageIndex) { - QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); + QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", pageIndex); QFile file(fileName); @@ -260,7 +260,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const int QUuid UBSvgSubsetAdaptor::sceneUuid(UBDocumentProxy* proxy, const int pageIndex) { QString fileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); + UBFileSystemUtils::digitFileFormat("/page%1.svg", pageIndex); QFile file(fileName); @@ -1213,7 +1213,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) } mXmlWriter.writeEndDocument(); - QString fileName = mDocumentPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(mPageIndex)); + QString fileName = mDocumentPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", mPageIndex); QFile file(fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) diff --git a/src/adaptors/UBThumbnailAdaptor.cpp b/src/adaptors/UBThumbnailAdaptor.cpp index ff24cfda..ebca17ea 100644 --- a/src/adaptors/UBThumbnailAdaptor.cpp +++ b/src/adaptors/UBThumbnailAdaptor.cpp @@ -44,7 +44,7 @@ QList UBThumbnailAdaptor::load(UBDocumentProxy* proxy) int existingPageCount = proxy->pageCount(); - QString thumbFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", UBApplication::boardController->sceneIndexFromPage(existingPageCount)); + QString thumbFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", existingPageCount); QFile thumbFile(thumbFileName); @@ -139,8 +139,7 @@ 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", UBApplication::boardController->pageFromSceneIndex(index)); + QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", index); QFile file(fileName); if (file.exists()) @@ -159,7 +158,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", UBApplication::boardController->pageFromSceneIndex(pageIndex)); + QString fileName = pDocPath + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex); QFile thumbFile(fileName); @@ -205,7 +204,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", UBApplication::boardController->pageFromSceneIndex(pageIndex)); + QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex); return QUrl::fromLocalFile(fileName); } diff --git a/src/adaptors/publishing/UBDocumentPublisher.cpp b/src/adaptors/publishing/UBDocumentPublisher.cpp index 47e78ea6..0198328b 100644 --- a/src/adaptors/publishing/UBDocumentPublisher.cpp +++ b/src/adaptors/publishing/UBDocumentPublisher.cpp @@ -133,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", UBApplication::boardController->pageFromSceneIndex(pageIndex)); + QString filename = mPublishingDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg",pageIndex); QFile::remove(filename); } @@ -193,7 +193,7 @@ void UBDocumentPublisher::rasterizeScenes() UBSvgSubsetRasterizer rasterizer(mPublishingDocument, pageIndex); - QString filename = mPublishingDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.jpg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); + QString filename = mPublishingDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.jpg",pageIndex); rasterizer.rasterizeToFile(filename); @@ -257,7 +257,7 @@ void UBDocumentPublisher::upgradeDocumentForPublishing() } } - QString filename = mPublishingDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.json", UBApplication::boardController->pageFromSceneIndex(pageIndex)); + QString filename = mPublishingDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.json",pageIndex); QFile jsonFile(filename); if (jsonFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 12341f7b..e306f532 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -427,13 +427,11 @@ void UBPersistenceManager::deleteDocumentScenes(UBDocumentProxy* proxy, const QL foreach(int index, compactedIndexes) { - QString svgFileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.svg", index + 1); + QString svgFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", index); QFile::remove(svgFileName); - QString thumbFileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", index + 1); + QString thumbFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", index); QFile::remove(thumbFileName); @@ -496,9 +494,7 @@ UBGraphicsScene* UBPersistenceManager::createDocumentSceneAt(UBDocumentProxy* pr int count = sceneCount(proxy); for(int i = count - 1; i >= index; i--) - { renamePage(proxy, i , i + 1); - } mSceneCache.shiftUpScenes(proxy, index, count -1); @@ -548,11 +544,11 @@ void UBPersistenceManager::moveSceneToIndex(UBDocumentProxy* proxy, int source, if (source == target) return; - QFile svgTmp(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", source + 1)); - svgTmp.rename(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.tmp", target + 1)); + QFile svgTmp(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", source)); + svgTmp.rename(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.tmp", target)); - QFile thumbTmp(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", source + 1)); - thumbTmp.rename(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.tmp", target + 1)); + QFile thumbTmp(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", source)); + thumbTmp.rename(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.tmp", target)); if (source < target) { @@ -569,11 +565,11 @@ void UBPersistenceManager::moveSceneToIndex(UBDocumentProxy* proxy, int source, } } - QFile svg(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.tmp", target + 1)); - svg.rename(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", target + 1)); + QFile svg(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.tmp", target)); + svg.rename(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", target)); - QFile thumb(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.tmp", target + 1)); - thumb.rename(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", target + 1)); + QFile thumb(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.tmp", target)); + thumb.rename(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", target)); mSceneCache.moveScene(proxy, source, target); @@ -586,10 +582,14 @@ UBGraphicsScene* UBPersistenceManager::loadDocumentScene(UBDocumentProxy* proxy, if (mSceneCache.contains(proxy, sceneIndex)) { //qDebug() << "scene" << sceneIndex << "retrieved from cache ..."; + //updating teacher guide node + //TODO Claudio find a way to store extra information like teacher guid + UBSvgSubsetAdaptor::loadScene(proxy, sceneIndex); return mSceneCache.value(proxy, sceneIndex); } else { + qDebug() << "scene" << sceneIndex << "retrieved from file ..."; UBGraphicsScene* scene = UBSvgSubsetAdaptor::loadScene(proxy, sceneIndex); if (scene) @@ -641,23 +641,23 @@ UBDocumentProxy* UBPersistenceManager::persistDocumentMetadata(UBDocumentProxy* void UBPersistenceManager::renamePage(UBDocumentProxy* pDocumentProxy, const int sourceIndex, const int targetIndex) { - QFile svg(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", sourceIndex + 1)); - svg.rename(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", targetIndex + 1)); + QFile svg(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", sourceIndex)); + svg.rename(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", targetIndex)); - QFile thumb(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", sourceIndex + 1)); - thumb.rename(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", targetIndex + 1)); + QFile thumb(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", sourceIndex)); + thumb.rename(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", targetIndex)); } void UBPersistenceManager::copyPage(UBDocumentProxy* pDocumentProxy, const int sourceIndex, const int targetIndex) { - QFile svg(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", sourceIndex + 1)); - svg.copy(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", targetIndex + 1)); + QFile svg(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg",sourceIndex)); + svg.copy(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", targetIndex)); UBSvgSubsetAdaptor::setSceneUuid(pDocumentProxy, targetIndex, QUuid::createUuid()); - QFile thumb(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", sourceIndex + 1)); - thumb.copy(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", targetIndex + 1)); + QFile thumb(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", sourceIndex)); + thumb.copy(pDocumentProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", targetIndex)); } @@ -673,7 +673,7 @@ int UBPersistenceManager::sceneCountInDir(const QString& pPath) while (moreToProcess) { - QString fileName = pPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", UBApplication::boardController->pageFromSceneIndex(pageIndex)); + QString fileName = pPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", pageIndex); QFile file(fileName); @@ -721,13 +721,13 @@ void UBPersistenceManager::addDirectoryContentToDocument(const QString& document { int targetIndex = targetPageCount + sourceIndex; - QFile svg(documentRootFolder + UBFileSystemUtils::digitFileFormat("/page%1.svg", sourceIndex + 1)); - svg.copy(pDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", targetIndex + 1)); + QFile svg(documentRootFolder + UBFileSystemUtils::digitFileFormat("/page%1.svg", sourceIndex)); + svg.copy(pDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", targetIndex)); UBSvgSubsetAdaptor::setSceneUuid(pDocument, targetIndex, QUuid::createUuid()); - QFile thumb(documentRootFolder + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", sourceIndex + 1)); - thumb.copy(pDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", targetIndex + 1)); + QFile thumb(documentRootFolder + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", sourceIndex)); + thumb.copy(pDocument->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", targetIndex)); } foreach(QString dir, mDocumentSubDirectories) diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index f1638a20..669e140f 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -162,6 +162,7 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr mDocumentUI->documentTreeWidget->scrollToItem(selected); mDocumentThumbs = UBThumbnailAdaptor::load(selectedDocumentProxy()); + qDebug() << mDocumentThumbs.size(); refreshDocumentThumbnailsView(); mSelectionType = Document; @@ -1635,7 +1636,7 @@ int UBDocumentController::getSelectedItemIndex() if (selectedItems.count() > 0) { - UBSceneThumbnailPixmap* thumb = dynamic_cast (selectedItems.last()); + UBSceneThumbnailPixmap* thumb = dynamic_cast (selectedItems.last()); return thumb->sceneIndex(); } else return -1; diff --git a/src/document/UBDocumentController.h b/src/document/UBDocumentController.h index 76a8d42e..de6f118f 100644 --- a/src/document/UBDocumentController.h +++ b/src/document/UBDocumentController.h @@ -111,9 +111,6 @@ class UBDocumentController : public QObject UBDocumentProxy* mCurrentDocument; QList mDocumentThumbs; -// UBKeyboardPalette *mKeyboardPalette; - - private slots: void documentZoomSliderValueChanged (int value); void loadDocumentProxies(); diff --git a/src/frameworks/UBFileSystemUtils.cpp b/src/frameworks/UBFileSystemUtils.cpp index 97a7d157..5d9e018c 100644 --- a/src/frameworks/UBFileSystemUtils.cpp +++ b/src/frameworks/UBFileSystemUtils.cpp @@ -16,6 +16,11 @@ #include "UBFileSystemUtils.h" #include + +#include "core/UBApplication.h" + +#include "board/UBBoardController.h" + #include "globals/UBGlobals.h" THIRD_PARTY_WARNINGS_DISABLE @@ -313,7 +318,8 @@ QString UBFileSystemUtils::normalizeFilePath(const QString& pFilePath) QString UBFileSystemUtils::digitFileFormat(const QString& s, int digit) { - return s.arg(digit, 3, 10, QLatin1Char('0')); + int pageDigit = UBApplication::boardController->pageFromSceneIndex(digit); + return s.arg(pageDigit, 3, 10, QLatin1Char('0')); } diff --git a/src/gui/UBDocumentNavigator.cpp b/src/gui/UBDocumentNavigator.cpp index b37b2e68..1c349038 100644 --- a/src/gui/UBDocumentNavigator.cpp +++ b/src/gui/UBDocumentNavigator.cpp @@ -56,6 +56,7 @@ UBDocumentNavigator::UBDocumentNavigator(QWidget *parent, const char *name):QGra setFrameShadow(QFrame::Plain); connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(addNewPage())); + connect(UBApplication::boardController, SIGNAL(setDocOnPageNavigator(UBDocumentProxy*)), this, SLOT(generateThumbnails())); connect(mScene, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); connect(UBApplication::boardController, SIGNAL(documentReorganized(int)), this, SLOT(onMovedToIndex(int))); connect(UBApplication::boardController, SIGNAL(scrollToSelectedPage()), this, SLOT(onScrollToSelectedPage())); diff --git a/src/gui/UBDocumentTreeWidget.cpp b/src/gui/UBDocumentTreeWidget.cpp index e693e865..afc9b2d8 100644 --- a/src/gui/UBDocumentTreeWidget.cpp +++ b/src/gui/UBDocumentTreeWidget.cpp @@ -327,7 +327,7 @@ void UBDocumentTreeWidget::dropEvent(QDropEvent *event) //due to incorrect generation of thumbnails of invisible scene I've used direct copying of thumbnail files //it's not universal and good way but it's faster - QString from = sourceItem.documentProxy()->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", sourceItem.sceneIndex() + 1); + QString from = sourceItem.documentProxy()->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", sourceItem.sceneIndex()); QString to = targetDocProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", targetDocProxy->pageCount()); QFile::remove(to); QFile::copy(from, to); @@ -452,4 +452,4 @@ bool UBDocumentGroupTreeItem::isDefaultFolder() const void UBDocumentTreeWidget::autoScroll() { this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude); -} \ No newline at end of file +} diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index b51b9232..2fa8758b 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -155,8 +155,6 @@ UBTeacherGuideEditionWidget::~UBTeacherGuideEditionWidget() void UBTeacherGuideEditionWidget::showEvent(QShowEvent* event) { -// mpPageTitle->setFocus(); -// mpComment->setFocus(); setFocus(); QWidget::showEvent(event); } @@ -240,7 +238,6 @@ void UBTeacherGuideEditionWidget::onActiveSceneChanged() int currentPage = UBApplication::boardController->currentPage(); if(currentPage > 0){ cleanData(); - qDebug() << "active scene changed current page " << currentPage << " " << UBSvgSubsetAdaptor::sTeacherGuideNode; load(UBSvgSubsetAdaptor::sTeacherGuideNode); mpPageNumberLabel->setText(tr("Page: %0").arg(currentPage)); UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); diff --git a/src/gui/UBThumbnailWidget.cpp b/src/gui/UBThumbnailWidget.cpp index 98437969..371e8abb 100644 --- a/src/gui/UBThumbnailWidget.cpp +++ b/src/gui/UBThumbnailWidget.cpp @@ -18,6 +18,8 @@ #include "UBThumbnailWidget.h" #include "UBRubberBand.h" +#include "board/UBBoardController.h" + #include "core/UBSettings.h" #include "core/UBApplication.h" @@ -354,7 +356,7 @@ void UBThumbnailWidget::mouseMoveEvent(QMouseEvent *event) // for vertical moving - QSet incSelectedItemsY = scene()->items(incrementYSelection, Qt::IntersectsItemBoundingRect).toSet(); + QSet incSelectedItemsY = scene()->items(incrementYSelection, Qt::IntersectsItemBoundingRect).toSet(); foreach (QGraphicsItem *lassoSelectedItem, incSelectedItemsY) { if (lassoSelectedItem) @@ -389,7 +391,7 @@ void UBThumbnailWidget::mouseMoveEvent(QMouseEvent *event) { item->setSelected(false); } - + mSelectedThumbnailItems += lassoSelectedThumbnailItems; mPrevLassoRect = lassoRect; @@ -749,8 +751,10 @@ UBSceneThumbnailNavigPixmap::UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBD , bCanMoveUp(false) , bCanMoveDown(false) { - setAcceptsHoverEvents(true); - setFlag(QGraphicsItem::ItemIsSelectable, true); + if(UBApplication::boardController->pageFromSceneIndex(pSceneIndex)){ + setAcceptsHoverEvents(true); + setFlag(QGraphicsItem::ItemIsSelectable, true); + } } UBSceneThumbnailNavigPixmap::~UBSceneThumbnailNavigPixmap() @@ -822,7 +826,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState() bCanMoveDown = false; UBDocumentProxy* p = proxy(); - if(NULL != p) + if(NULL != p && UBApplication::boardController->pageFromSceneIndex(sceneIndex())) { int iNbPages = p->pageCount(); if(1 < iNbPages) @@ -838,6 +842,8 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState() } } } + if(UBSettings::settings()->teacherGuidePageZeroActivated and sceneIndex()<=1) + bCanMoveUp = false; if(bCanDelete || bCanMoveUp || bCanMoveDown) { @@ -855,7 +861,6 @@ void UBSceneThumbnailNavigPixmap::deletePage() void UBSceneThumbnailNavigPixmap::moveUpPage() { - UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() - 1); } From 75b7fd5666609bf17e9bb199d3b3e3329948e7d7 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 9 May 2012 14:15:30 +0200 Subject: [PATCH 32/42] handling the documents without zero page when using a program set to handle zero pages --- src/adaptors/UBThumbnailAdaptor.cpp | 11 +- src/board/UBFeaturesController.h | 222 ++++++++++++++------------ src/core/UBPersistenceManager.cpp | 17 +- src/document/UBDocumentController.cpp | 14 +- 4 files changed, 148 insertions(+), 116 deletions(-) diff --git a/src/adaptors/UBThumbnailAdaptor.cpp b/src/adaptors/UBThumbnailAdaptor.cpp index ebca17ea..69de0876 100644 --- a/src/adaptors/UBThumbnailAdaptor.cpp +++ b/src/adaptors/UBThumbnailAdaptor.cpp @@ -45,7 +45,6 @@ QList UBThumbnailAdaptor::load(UBDocumentProxy* proxy) int existingPageCount = proxy->pageCount(); QString thumbFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", existingPageCount); - QFile thumbFile(thumbFileName); if (!thumbFile.exists()) @@ -67,6 +66,16 @@ QList UBThumbnailAdaptor::load(UBDocumentProxy* proxy) persistScene(proxy->persistencePath(), scene, i); } + else{ + if(i==0){ + // we are working a document without zero page but on a system that enable it + // we have to create an empty zero scene + scene = new UBGraphicsScene(proxy); + UBSvgSubsetAdaptor::persistScene(proxy,scene,0); + persistScene(proxy->persistencePath(),scene,i); + thumbCount++; + } + } } if (displayMessage && thumbCount > 0) diff --git a/src/board/UBFeaturesController.h b/src/board/UBFeaturesController.h index 1348d289..254514a4 100644 --- a/src/board/UBFeaturesController.h +++ b/src/board/UBFeaturesController.h @@ -12,128 +12,140 @@ #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_SEARCH + FEATURE_TRASH, + FEATURE_FAVORITE, + FEATURE_SEARCH }; class UBFeature { - public: - UBFeature() {;} - //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 getFullPath() const { return mPath; } - QString getVirtualPath() const { return virtualPath + "/" + mName; } - UBFeatureElementType getType() const { return elementType; } - bool isFolder() const; - bool isDeletable() const; - bool operator ==( const UBFeature &f )const; - bool operator !=( const UBFeature &f )const; - private: - QString virtualPath; - QPixmap mThumbnail; - QString mName; - QString mPath; - UBFeatureElementType elementType; +public: + UBFeature() {;} + //UBFeature(const UBFeature &f); + UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QUrl &realPath, UBFeatureElementType type = FEATURE_CATEGORY); + virtual ~UBFeature() {;} + QString getName() const { return mName; } + QPixmap getThumbnail() const {return mThumbnail;} + QString getVirtualPath() const { return virtualPath; } + //QString getPath() const { return mPath; }; + QUrl getFullPath() const { return mPath; } + QString getFullVirtualPath() const { return virtualPath + "/" + mName; } + QString getUrl() const; + UBFeatureElementType getType() const { return elementType; } + + bool isFolder() const; + bool isDeletable() const; + bool operator ==( const UBFeature &f )const; + bool operator !=( const UBFeature &f )const; + const QMap & getMetadata() const { return metadata; } + void setMetadata( const QMap &data ) { metadata = data; } +private: + QString virtualPath; + QPixmap mThumbnail; + QString mName; + QUrl mPath; + UBFeatureElementType elementType; + QMap metadata; }; Q_DECLARE_METATYPE( UBFeature ) class UBFeaturesController : public QObject { - Q_OBJECT - public: - 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 ); - static bool isDeletable( const QUrl &url ); - 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(); - UBFeature getDestinationForItem( const QUrl &url ); - - static UBFeatureElementType fileTypeFromUrl( const QString &path ); - - QList *featuresList; - UBFeature *rootElement; - - QString mUserAudioDirectoryPath; - QString mUserVideoDirectoryPath; - QString mUserPicturesDirectoryPath; - QString mUserInteractiveDirectoryPath; - QString mUserAnimationDirectoryPath; - - QString libraryPath; - QString mLibAudioDirectoryPath; - QString mLibVideoDirectoryPath; - QString mLibPicturesDirectoryPath; - QString mLibInteractiveDirectoryPath; - QString mLibAnimationDirectoryPath; - QString mLibApplicationsDirectoryPath; - QString mLibShapesDirectoryPath; - QString trashDirectoryPath; - QString mLibSearchDirectoryPath; - - 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; - UBFeature audiosElement; - UBFeature moviesElement; - UBFeature picturesElement; - UBFeature interactElement; - UBFeature flashElement; - UBFeature shapesElement; - UBFeature searchElement; - - QSet *favoriteSet; +Q_OBJECT +public: + UBFeaturesController(QWidget *parentWidget); + virtual ~UBFeaturesController(); + + QList * getFeatures()const { return featuresList; } + + const QString& getRootPath()const { return rootPath; } + + void addItemToPage( const UBFeature &item ); + void addItemAsBackground( const UBFeature &item ); + const UBFeature& getCurrentElement()const { return currentElement; } + void setCurrentElement( const UBFeature &elem ) { currentElement = elem; } + const UBFeature & getTrashElement () const { return trashElement; } + + UBFeature addDownloadedFile( const QUrl &sourceUrl, const QByteArray &pData ); + + 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 ); + UBFeature importImage( const QImage &image, const UBFeature &destination ); + + static QString fileNameFromUrl( const QUrl &url ); + static QPixmap thumbnailForFile( const QString &path ); + static bool isDeletable( const QUrl &url ); +private: + void initDirectoryTree(); + void fileSystemScan(const QUrl &currPath, const QString & currVirtualPath); + static QPixmap createThumbnail(const QString &path); + //void addImageToCurrentPage( const QString &path ); + void loadFavoriteList(); + void saveFavoriteList(); + UBFeature getDestinationForItem( const QUrl &url ); + + static UBFeatureElementType fileTypeFromUrl( const QString &path ); + + QList *featuresList; + UBFeature *rootElement; + + QUrl mUserAudioDirectoryPath; + QUrl mUserVideoDirectoryPath; + QUrl mUserPicturesDirectoryPath; + QUrl mUserInteractiveDirectoryPath; + QUrl mUserAnimationDirectoryPath; + + QString libraryPath; + QUrl mLibAudioDirectoryPath; + QUrl mLibVideoDirectoryPath; + QUrl mLibPicturesDirectoryPath; + QUrl mLibInteractiveDirectoryPath; + QUrl mLibAnimationDirectoryPath; + QUrl mLibApplicationsDirectoryPath; + QUrl mLibShapesDirectoryPath; + QUrl trashDirectoryPath; + QUrl mLibSearchDirectoryPath; + + 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; + UBFeature audiosElement; + UBFeature moviesElement; + UBFeature picturesElement; + UBFeature interactElement; + UBFeature flashElement; + UBFeature shapesElement; + UBFeature webSearchElement; + + QSet *favoriteSet; }; diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index e306f532..84b2d242 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -670,6 +670,7 @@ int UBPersistenceManager::sceneCountInDir(const QString& pPath) { int pageIndex = 0; bool moreToProcess = true; + bool addedMissingZeroPage = false; while (moreToProcess) { @@ -683,10 +684,24 @@ int UBPersistenceManager::sceneCountInDir(const QString& pPath) } else { - moreToProcess = false; + if(UBSettings::settings()->teacherGuidePageZeroActivated && pageIndex == 0){ + // the document has no zero file but doesn't means that it hasn't any file + // at all. Just importing a document without the first page using a configuartion + // that enables zero page. + pageIndex++; + addedMissingZeroPage = true; + } + else + moreToProcess = false; } } + if(pageIndex == 1 && addedMissingZeroPage){ + // increment is done only to check if there are other pages than the missing zero page + // This situation means -> no pages on the document + return 0; + } + return pageIndex; } diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 22f11c69..d12ae4ea 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -168,7 +168,6 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr mDocumentUI->documentTreeWidget->scrollToItem(selected); mDocumentThumbs = UBThumbnailAdaptor::load(selectedDocumentProxy()); - qDebug() << mDocumentThumbs.size(); refreshDocumentThumbnailsView(); mSelectionType = Document; @@ -291,9 +290,9 @@ void UBDocumentController::refreshDocumentThumbnailsView() } items << pixmapItem; - labels << tr("Page %1").arg(i + 1); + labels << tr("Page %1").arg(UBApplication::boardController->pageFromSceneIndex(i)); - itemsPath.append(QUrl::fromLocalFile(proxy->persistencePath() + QString("/pages/%1").arg(i + 1))); + itemsPath.append(QUrl::fromLocalFile(proxy->persistencePath() + QString("/pages/%1").arg(UBApplication::boardController->pageFromSceneIndex(i)))); } } @@ -307,15 +306,12 @@ void UBDocumentController::refreshDocumentThumbnailsView() mDocumentUI->thumbnailWidget->ensureVisible(0, 0, 10, 10); - if (selection) - { - disconnect(mDocumentUI->thumbnailWidget->scene(), SIGNAL(selectionChanged()), - this, SLOT(pageSelectionChanged())); + if (selection) { + disconnect(mDocumentUI->thumbnailWidget->scene(), SIGNAL(selectionChanged()), this, SLOT(pageSelectionChanged())); UBSceneThumbnailPixmap *currentScene = dynamic_cast(selection); if (currentScene) mDocumentUI->thumbnailWidget->hightlightItem(currentScene->sceneIndex()); - connect(mDocumentUI->thumbnailWidget->scene(), SIGNAL(selectionChanged()), - this, SLOT(pageSelectionChanged())); + connect(mDocumentUI->thumbnailWidget->scene(), SIGNAL(selectionChanged()), this, SLOT(pageSelectionChanged())); } emit refreshThumbnails(); From 76d5c99e21b2df8c99a5041412a72ede5eae2873 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 9 May 2012 17:33:33 +0200 Subject: [PATCH 33/42] fixed issue with teacher guide data persistance --- src/adaptors/UBSvgSubsetAdaptor.cpp | 104 ++++++++++++++++++---------- src/adaptors/UBSvgSubsetAdaptor.h | 2 +- src/board/UBBoardController.cpp | 1 + src/core/UBPersistenceManager.cpp | 9 +-- src/core/UBPersistenceManager.h | 2 + src/document/UBDocumentProxy.cpp | 2 - src/gui/UBTeacherGuideWidget.cpp | 6 +- src/interfaces/IDataStorage.h | 2 +- 8 files changed, 79 insertions(+), 49 deletions(-) diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index e028d143..23b3f408 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -72,16 +72,6 @@ const QString UBSvgSubsetAdaptor::sFontStylePrefix = "font-style:"; const QString UBSvgSubsetAdaptor::sFormerUniboardDocumentNamespaceUri = "http://www.mnemis.com/uniboard"; QMap UBSvgSubsetAdaptor::additionalElementToStore; -// Why using such a string? -// Media file path are relative to the current document. So if we are reading the -// first page of a document the document path has not been updated. -// Concatenate relative media path with the old document path leads to mess -// This string is so used only for activeDocumentChanged signal -QString UBSvgSubsetAdaptor::sTeacherGuideNode = ""; - - - - QString UBSvgSubsetAdaptor::toSvgTransform(const QMatrix& matrix) { return QString("matrix(%1, %2, %3, %4, %5, %6)") @@ -259,8 +249,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const int QUuid UBSvgSubsetAdaptor::sceneUuid(UBDocumentProxy* proxy, const int pageIndex) { - QString fileName = proxy->persistencePath() + - UBFileSystemUtils::digitFileFormat("/page%1.svg", pageIndex); + QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", pageIndex); QFile file(fileName); @@ -312,6 +301,53 @@ UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const QBy } +QString UBSvgSubsetAdaptor::readTeacherGuideNode(int sceneIndex) +{ + QString result; + + QString fileName = UBApplication::boardController->activeDocument()->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", sceneIndex); + QFile file(fileName); + file.open(QIODevice::ReadOnly); + QByteArray fileByteArray=file.readAll(); + file.close(); + QXmlStreamReader mXmlReader(fileByteArray); + + while (!mXmlReader.atEnd()) + { + mXmlReader.readNext(); + if (mXmlReader.isStartElement()) + { + if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){ + result.clear(); + result += ""; + result += "\n"; + } + else if (mXmlReader.name() == "media" || mXmlReader.name() == "link" || mXmlReader.name() == "title" || mXmlReader.name() == "comment" || mXmlReader.name() == "action") + { + result += "<" + mXmlReader.name().toString() + " "; + foreach(QXmlStreamAttribute attribute, mXmlReader.attributes()) + result += attribute.name().toString() + "=\"" + attribute.value().toString() + "\" "; + result += " />\n"; + } + else + { + // NOOP + } + } + else if (mXmlReader.isEndElement() && (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide")){ + result += ""; + } + } + + if (mXmlReader.hasError()) + { + qWarning() << "error parsing Sankore file " << mXmlReader.errorString(); + } + + return result; +} + + UBSvgSubsetAdaptor::UBSvgSubsetReader::UBSvgSubsetReader(UBDocumentProxy* pProxy, const QByteArray& pXmlData) : mXmlReader(pXmlData) , mProxy(pProxy) @@ -333,8 +369,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() UBGraphicsStrokesGroup* strokesGroup = 0; UBDrawingController* dc = UBDrawingController::drawingController(); - sTeacherGuideNode = ""; - while (!mXmlReader.atEnd()) { @@ -851,18 +885,18 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() currentWidget->setDatastoreEntry(key, value); } - else if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){ - sTeacherGuideNode.clear(); - sTeacherGuideNode += ""; - sTeacherGuideNode += "\n"; - } - else if (mXmlReader.name() == "media" || mXmlReader.name() == "link" || mXmlReader.name() == "title" || mXmlReader.name() == "comment" || mXmlReader.name() == "action") - { - sTeacherGuideNode += "<" + mXmlReader.name().toString() + " "; - foreach(QXmlStreamAttribute attribute, mXmlReader.attributes()) - sTeacherGuideNode += attribute.name().toString() + "=\"" + attribute.value().toString() + "\" "; - sTeacherGuideNode += " />\n"; - } +// else if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){ +// sTeacherGuideNode.clear(); +// sTeacherGuideNode += ""; +// sTeacherGuideNode += "\n"; +// } +// else if (mXmlReader.name() == "media" || mXmlReader.name() == "link" || mXmlReader.name() == "title" || mXmlReader.name() == "comment" || mXmlReader.name() == "action") +// { +// sTeacherGuideNode += "<" + mXmlReader.name().toString() + " "; +// foreach(QXmlStreamAttribute attribute, mXmlReader.attributes()) +// sTeacherGuideNode += attribute.name().toString() + "=\"" + attribute.value().toString() + "\" "; +// sTeacherGuideNode += " />\n"; +// } else { // NOOP @@ -886,14 +920,15 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() mGroupDarkBackgroundColor = QColor(); mGroupLightBackgroundColor = QColor(); } - else if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){ - sTeacherGuideNode += ""; - QMap elements = getAdditionalElementToStore(); - IDataStorage* storageClass = elements.value("teacherGuide"); - if(storageClass){ - storageClass->load(sTeacherGuideNode); - } - } +// else if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){ +// sTeacherGuideNode += ""; +// qDebug() << sTeacherGuideNode; +// QMap elements = getAdditionalElementToStore(); +// IDataStorage* storageClass = elements.value("teacherGuide"); +// if(storageClass){ +// storageClass->load(sTeacherGuideNode); +// } +// } } } @@ -969,7 +1004,6 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement() bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) { - sTeacherGuideNode = ""; if (mScene->isModified()) { QBuffer buffer; diff --git a/src/adaptors/UBSvgSubsetAdaptor.h b/src/adaptors/UBSvgSubsetAdaptor.h index 8edb3389..d3b39c37 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.h +++ b/src/adaptors/UBSvgSubsetAdaptor.h @@ -65,7 +65,6 @@ class UBSvgSubsetAdaptor static void convertSvgImagesToImages(UBDocumentProxy* proxy); static QMap getAdditionalElementToStore() { return additionalElementToStore;} - static QString sTeacherGuideNode; static const QString nsSvg; static const QString nsXLink; @@ -79,6 +78,7 @@ class UBSvgSubsetAdaptor static const QString sFontWeightPrefix; static const QString sFontStylePrefix; + static QString readTeacherGuideNode(int sceneIndex); private: static UBGraphicsScene* loadScene(UBDocumentProxy* proxy, const QByteArray& pArray); diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 25f54053..b78b829c 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -62,6 +62,7 @@ #include "podcast/UBPodcastController.h" #include "adaptors/UBMetadataDcSubsetAdaptor.h" +#include "adaptors/UBSvgSubsetAdaptor.h" #include "UBBoardPaletteManager.h" diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 84b2d242..91b1f478 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -580,15 +580,8 @@ void UBPersistenceManager::moveSceneToIndex(UBDocumentProxy* proxy, int source, UBGraphicsScene* UBPersistenceManager::loadDocumentScene(UBDocumentProxy* proxy, int sceneIndex) { if (mSceneCache.contains(proxy, sceneIndex)) - { - //qDebug() << "scene" << sceneIndex << "retrieved from cache ..."; - //updating teacher guide node - //TODO Claudio find a way to store extra information like teacher guid - UBSvgSubsetAdaptor::loadScene(proxy, sceneIndex); return mSceneCache.value(proxy, sceneIndex); - } - else - { + else { qDebug() << "scene" << sceneIndex << "retrieved from file ..."; UBGraphicsScene* scene = UBSvgSubsetAdaptor::loadScene(proxy, sceneIndex); diff --git a/src/core/UBPersistenceManager.h b/src/core/UBPersistenceManager.h index 75af2390..e5e88114 100644 --- a/src/core/UBPersistenceManager.h +++ b/src/core/UBPersistenceManager.h @@ -157,6 +157,8 @@ class UBPersistenceManager : public QObject QString mDocumentRepositoryPath; + QHashteacherBarNodeString; + private slots: void documentRepositoryChanged(const QString& path); diff --git a/src/document/UBDocumentProxy.cpp b/src/document/UBDocumentProxy.cpp index dff6cf9a..6dac0203 100644 --- a/src/document/UBDocumentProxy.cpp +++ b/src/document/UBDocumentProxy.cpp @@ -209,8 +209,6 @@ void UBDocumentProxy::setUuid(const QUuid& uuid) QDateTime UBDocumentProxy::documentDate() { - qDebug()<< UBSettings::documentDate; - qDebug()<activeSceneIndex(); + if(UBApplication::boardController->pageFromSceneIndex(activeSceneIndex) != 0) + load(UBSvgSubsetAdaptor::readTeacherGuideNode(activeSceneIndex)); } void UBTeacherGuideEditionWidget::load(QString element) @@ -238,7 +240,7 @@ void UBTeacherGuideEditionWidget::onActiveSceneChanged() int currentPage = UBApplication::boardController->currentPage(); if(currentPage > 0){ cleanData(); - load(UBSvgSubsetAdaptor::sTeacherGuideNode); + load(UBSvgSubsetAdaptor::readTeacherGuideNode(UBApplication::boardController->activeSceneIndex())); mpPageNumberLabel->setText(tr("Page: %0").arg(currentPage)); UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); if(mpDocumentTitle) diff --git a/src/interfaces/IDataStorage.h b/src/interfaces/IDataStorage.h index 10e69c93..8de8a585 100644 --- a/src/interfaces/IDataStorage.h +++ b/src/interfaces/IDataStorage.h @@ -36,7 +36,7 @@ typedef struct class IDataStorage { public: - virtual void load(QString element) = 0; + //virtual void load(QString element) = 0; virtual QVectorsave(int pageIndex) = 0 ; }; #endif // IDATASTORAGE_H From f0734e71174ded053e8d8f064b71b496b59724aa Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 11 May 2012 11:49:23 +0200 Subject: [PATCH 34/42] fixed some working issue on english --- src/adaptors/UBMetadataDcSubsetAdaptor.cpp | 12 +-- src/core/UBSettings.cpp | 6 +- src/core/UBSettings.h | 4 +- src/document/UBDocumentProxy.cpp | 4 +- src/gui/UBTeacherGuideWidget.cpp | 116 ++++++++++----------- src/gui/UBTeacherGuideWidget.h | 12 +-- 6 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp index 3ed029a1..066f924d 100644 --- a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp +++ b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp @@ -112,10 +112,10 @@ void UBMetadataDcSubsetAdaptor::persist(UBDocumentProxy* proxy) // introduced in OpenSankore 1.40.00 xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionTitle,proxy->metaData(UBSettings::sessionTitle).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionAuthors,proxy->metaData(UBSettings::sessionAuthors).toString()); - xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionGoals,proxy->metaData(UBSettings::sessionGoals).toString()); + xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionObjectives,proxy->metaData(UBSettings::sessionObjectives).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionKeywords,proxy->metaData(UBSettings::sessionKeywords).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionGradeLevel,proxy->metaData(UBSettings::sessionGradeLevel).toString()); - xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionBranch,proxy->metaData(UBSettings::sessionBranch).toString()); + xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionSubjects,proxy->metaData(UBSettings::sessionSubjects).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionType,proxy->metaData(UBSettings::sessionType).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionLicence,proxy->metaData(UBSettings::sessionLicence).toString()); @@ -228,10 +228,10 @@ QMap UBMetadataDcSubsetAdaptor::load(QString pPath) { metadata.insert(UBSettings::sessionAuthors, xml.readElementText()); } - else if (xml.name() == UBSettings::sessionGoals // introduced in OpenSankore 1.40.00 + else if (xml.name() == UBSettings::sessionObjectives // introduced in OpenSankore 1.40.00 && xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri) { - metadata.insert(UBSettings::sessionGoals, xml.readElementText()); + metadata.insert(UBSettings::sessionObjectives, xml.readElementText()); } else if (xml.name() == UBSettings::sessionKeywords // introduced in OpenSankore 1.40.00 && xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri) @@ -243,10 +243,10 @@ QMap UBMetadataDcSubsetAdaptor::load(QString pPath) { metadata.insert(UBSettings::sessionGradeLevel, xml.readElementText()); } - else if (xml.name() == UBSettings::sessionBranch // introduced in OpenSankore 1.40.00 + else if (xml.name() == UBSettings::sessionSubjects // introduced in OpenSankore 1.40.00 && xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri) { - metadata.insert(UBSettings::sessionBranch, xml.readElementText()); + metadata.insert(UBSettings::sessionSubjects, xml.readElementText()); } else if (xml.name() == UBSettings::sessionType // introduced in OpenSankore 1.40.00 && xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri) diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 711b59f1..292b5a4a 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -38,10 +38,10 @@ QString UBSettings::documentVersion = QString("Version"); QString UBSettings::documentUpdatedAt = QString("UpdatedAt"); QString UBSettings::sessionTitle = QString("sessionTitle"); QString UBSettings::sessionAuthors = QString("sessionAuthors"); -QString UBSettings::sessionGoals = QString("sessionGoals"); +QString UBSettings::sessionObjectives = QString("sessionObjectives"); QString UBSettings::sessionKeywords = QString("sessionKeywords"); QString UBSettings::sessionGradeLevel = QString("sessionGradeLevel"); -QString UBSettings::sessionBranch = QString("sessionBranch"); +QString UBSettings::sessionSubjects = QString("sessionSubjects"); QString UBSettings::sessionType = QString("sessionType"); QString UBSettings::sessionLicence = QString("sessionLicence"); QString UBSettings::documentDate = QString("date"); @@ -55,7 +55,7 @@ QString UBSettings::uniboardApplicationNamespaceUri = "http://uniboard.mnemis.co const int UBSettings::sDefaultFontPixelSize = 36; const char *UBSettings::sDefaultFontFamily = "Arial"; -QString UBSettings::currentFileVersion = "4.5.0"; +QString UBSettings::currentFileVersion = "4.6.0"; QColor UBSettings::crossDarkBackground = QColor(44, 44, 44, 200); QColor UBSettings::crossLightBackground = QColor(165, 225, 255); diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index e28094c7..f97d7b4c 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -156,10 +156,10 @@ class UBSettings : public QObject static QString sessionTitle; static QString sessionAuthors; - static QString sessionGoals; + static QString sessionObjectives; static QString sessionKeywords; static QString sessionGradeLevel; - static QString sessionBranch; + static QString sessionSubjects; static QString sessionType; static QString sessionLicence; diff --git a/src/document/UBDocumentProxy.cpp b/src/document/UBDocumentProxy.cpp index 6dac0203..a128a16a 100644 --- a/src/document/UBDocumentProxy.cpp +++ b/src/document/UBDocumentProxy.cpp @@ -53,10 +53,10 @@ void UBDocumentProxy::init() //teacherGuide metadata setMetaData(UBSettings::sessionTitle,""); setMetaData(UBSettings::sessionAuthors,""); - setMetaData(UBSettings::sessionGoals,""); + setMetaData(UBSettings::sessionObjectives,""); setMetaData(UBSettings::sessionKeywords,""); setMetaData(UBSettings::sessionGradeLevel,""); - setMetaData(UBSettings::sessionBranch,""); + setMetaData(UBSettings::sessionSubjects,""); setMetaData(UBSettings::sessionType,""); setMetaData(UBSettings::sessionLicence,""); } diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 8fad4f87..e32bf674 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -594,18 +594,18 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons , mpSeparatorAuthors(NULL) , mpCreationLabel(NULL) , mpLastModifiedLabel(NULL) - , mpGoalsLabel(NULL) - , mpGoals(NULL) - , mpSeparatorGoals(NULL) + , mpObjectivesLabel(NULL) + , mpObjectives(NULL) + , mpSeparatorObjectives(NULL) , mpIndexLabel(NULL) , mpKeywordsLabel(NULL) , mpKeywords(NULL) , mpSchoolLevelItemLabel(NULL) , mpSchoolLevelBox(NULL) , mpSchoolLevelValueLabel(NULL) - , mpSchoolBranchItemLabel(NULL) - , mpSchoolBranchBox(NULL) - , mpSchoolBranchValueLabel(NULL) + , mpSchoolSubjectsItemLabel(NULL) + , mpSchoolSubjectsBox(NULL) + , mpSchoolSubjectsValueLabel(NULL) , mpSchoolTypeItemLabel(NULL) , mpSchoolTypeBox(NULL) , mpSchoolTypeValueLabel(NULL) @@ -670,21 +670,21 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpSeparatorAuthors->setObjectName("UBTGSeparator"); mpLayout->addWidget(mpSeparatorAuthors); - mpGoalsLabel = new QLabel(this); - mpGoalsLabel->setObjectName("UBTGZeroPageEditionModeTitle"); - mpGoalsLabel->setText(tr("Goal(s)")); - mpGoalsLabel->setStyleSheet(chapterStyle); - mpLayout->addWidget(mpGoalsLabel); + mpObjectivesLabel = new QLabel(this); + mpObjectivesLabel->setObjectName("UBTGZeroPageEditionModeTitle"); + mpObjectivesLabel->setText(tr("Objective(s)")); + mpObjectivesLabel->setStyleSheet(chapterStyle); + mpLayout->addWidget(mpObjectivesLabel); - mpGoals = new UBTGAdaptableText(0,this); - mpGoals->setObjectName("UBTGZeroPageInputText"); - mpGoals->setPlaceHolderText(tr("Type goals here...")); - mpLayout->addWidget(mpGoals); + mpObjectives = new UBTGAdaptableText(0,this); + mpObjectives->setObjectName("UBTGZeroPageInputText"); + mpObjectives->setPlaceHolderText(tr("Type objectives here...")); + mpLayout->addWidget(mpObjectives); - mpSeparatorGoals = new QFrame(this); - mpSeparatorGoals->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT); - mpSeparatorGoals->setObjectName("UBTGSeparator"); - mpLayout->addWidget(mpSeparatorGoals); + mpSeparatorObjectives = new QFrame(this); + mpSeparatorObjectives->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT); + mpSeparatorObjectives->setObjectName("UBTGSeparator"); + mpLayout->addWidget(mpSeparatorObjectives); mpIndexLabel = new QLabel(this); mpIndexLabel->setObjectName("UBTGZeroPageEditionModeTitle"); @@ -713,16 +713,16 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpSchoolLevelValueLabel = new QLabel(this); mpLayout->addWidget(mpSchoolLevelValueLabel); - mpSchoolBranchItemLabel = new QLabel(this); - mpSchoolBranchItemLabel->setObjectName("UBTGZeroPageItemLabel"); - mpSchoolBranchItemLabel->setText(tr("Branch:")); - mpSchoolBranchItemLabel->setStyleSheet(chapterStyle); - mpLayout->addWidget(mpSchoolBranchItemLabel); - mpSchoolBranchBox = new QComboBox(this); - mpSchoolBranchBox->setObjectName("DockPaletteWidgetComboBox"); - mpLayout->addWidget(mpSchoolBranchBox); - mpSchoolBranchValueLabel = new QLabel(this); - mpLayout->addWidget(mpSchoolBranchValueLabel); + mpSchoolSubjectsItemLabel = new QLabel(this); + mpSchoolSubjectsItemLabel->setObjectName("UBTGZeroPageItemLabel"); + mpSchoolSubjectsItemLabel->setText(tr("Subjects:")); + mpSchoolSubjectsItemLabel->setStyleSheet(chapterStyle); + mpLayout->addWidget(mpSchoolSubjectsItemLabel); + mpSchoolSubjectsBox = new QComboBox(this); + mpSchoolSubjectsBox->setObjectName("DockPaletteWidgetComboBox"); + mpLayout->addWidget(mpSchoolSubjectsBox); + mpSchoolSubjectsValueLabel = new QLabel(this); + mpLayout->addWidget(mpSchoolSubjectsValueLabel); mpSchoolTypeItemLabel = new QLabel(this); mpSchoolTypeItemLabel->setObjectName("UBTGZeroPageItemLabel"); @@ -771,16 +771,16 @@ UBTeacherGuidePageZeroWidget::~UBTeacherGuidePageZeroWidget() DELETEPTR(mpSeparatorAuthors); DELETEPTR(mpCreationLabel); DELETEPTR(mpLastModifiedLabel); - DELETEPTR(mpGoalsLabel); - DELETEPTR(mpGoals); - DELETEPTR(mpSeparatorGoals); + DELETEPTR(mpObjectivesLabel); + DELETEPTR(mpObjectives); + DELETEPTR(mpSeparatorObjectives); DELETEPTR(mpIndexLabel); DELETEPTR(mpKeywordsLabel); DELETEPTR(mpKeywords); DELETEPTR(mpSchoolLevelItemLabel); DELETEPTR(mpSchoolLevelBox); - DELETEPTR(mpSchoolBranchItemLabel); - DELETEPTR(mpSchoolBranchBox); + DELETEPTR(mpSchoolSubjectsItemLabel); + DELETEPTR(mpSchoolSubjectsBox); DELETEPTR(mpSchoolTypeItemLabel); DELETEPTR(mpSchoolTypeBox); DELETEPTR(mpSeparatorIndex); @@ -853,15 +853,15 @@ void UBTeacherGuidePageZeroWidget::fillComboBoxes() void UBTeacherGuidePageZeroWidget::onSchoolLevelChanged(QString schoolLevel) { QStringList subjects = mSubjects.value(mGradeLevelsMap.value(schoolLevel)); - mpSchoolBranchBox->clear(); + mpSchoolSubjectsBox->clear(); if(subjects.count()){ - mpSchoolBranchItemLabel->setEnabled(true); - mpSchoolBranchBox->setEnabled(true); - mpSchoolBranchBox->addItems(subjects); + mpSchoolSubjectsItemLabel->setEnabled(true); + mpSchoolSubjectsBox->setEnabled(true); + mpSchoolSubjectsBox->addItems(subjects); } else{ - mpSchoolBranchItemLabel->setDisabled(true); - mpSchoolBranchBox->setDisabled(true); + mpSchoolSubjectsItemLabel->setDisabled(true); + mpSchoolSubjectsBox->setDisabled(true); } } @@ -889,14 +889,14 @@ void UBTeacherGuidePageZeroWidget::loadData() UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); mpSessionTitle->setText(documentProxy->metaData(UBSettings::sessionTitle).toString()); mpAuthors->setText(documentProxy->metaData(UBSettings::sessionAuthors).toString()); - mpGoals->setText(documentProxy->metaData(UBSettings::sessionGoals).toString()); + mpObjectives->setText(documentProxy->metaData(UBSettings::sessionObjectives).toString()); mpKeywords->setText(documentProxy->metaData(UBSettings::sessionKeywords).toString()); int currentIndex = mpSchoolLevelBox->findText(documentProxy->metaData(UBSettings::sessionGradeLevel).toString()); mpSchoolLevelBox->setCurrentIndex((currentIndex!=-1) ? currentIndex : 0); - currentIndex = mpSchoolBranchBox->findText(documentProxy->metaData(UBSettings::sessionBranch).toString()); - mpSchoolBranchBox->setCurrentIndex((currentIndex!=-1) ? currentIndex : 0); + currentIndex = mpSchoolSubjectsBox->findText(documentProxy->metaData(UBSettings::sessionSubjects).toString()); + mpSchoolSubjectsBox->setCurrentIndex((currentIndex!=-1) ? currentIndex : 0); currentIndex = mpSchoolTypeBox->findText(documentProxy->metaData(UBSettings::sessionType).toString()); mpSchoolTypeBox->setCurrentIndex((currentIndex!=-1) ? currentIndex : 0); @@ -913,10 +913,10 @@ 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::sessionObjectives,mpObjectives->text()); documentProxy->setMetaData(UBSettings::sessionKeywords,mpKeywords->text()); documentProxy->setMetaData(UBSettings::sessionGradeLevel,mpSchoolLevelBox->currentText()); - documentProxy->setMetaData(UBSettings::sessionBranch,mpSchoolBranchBox->currentText()); + documentProxy->setMetaData(UBSettings::sessionSubjects,mpSchoolSubjectsBox->currentText()); documentProxy->setMetaData(UBSettings::sessionType,mpSchoolTypeBox->currentText()); documentProxy->setMetaData(UBSettings::sessionLicence,mpLicenceBox->currentText()); } @@ -942,16 +942,16 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) mpAuthors->setReadOnly(false); mpAuthors->setStyleSheet(inputStyleSheet); mpAuthors->setTextColor(QColor(Qt::lightGray)); - mpGoals->setReadOnly(false); - mpGoals->setStyleSheet(inputStyleSheet); - mpGoals->setTextColor(QColor(Qt::lightGray)); + mpObjectives->setReadOnly(false); + mpObjectives->setStyleSheet(inputStyleSheet); + mpObjectives->setTextColor(QColor(Qt::lightGray)); mpKeywords->setReadOnly(false); mpKeywords->setStyleSheet(inputStyleSheet); mpKeywords->setTextColor(QColor(Qt::lightGray)); mpSchoolLevelValueLabel->hide(); mpSchoolLevelBox->show(); - mpSchoolBranchValueLabel->hide(); - mpSchoolBranchBox->show(); + mpSchoolSubjectsValueLabel->hide(); + mpSchoolSubjectsBox->show(); mpSchoolTypeValueLabel->hide(); mpSchoolTypeBox->show(); mpLicenceIcon->hide(); @@ -969,18 +969,18 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) mpAuthors->setStyleSheet(inputStyleSheet); mpAuthors->setTextColor(QColor(Qt::black)); mpAuthors->showText(mpAuthors->text()); - mpGoals->setStyleSheet(inputStyleSheet); - mpGoals->setTextColor(QColor(Qt::black)); - mpGoals->showText(mpGoals->text()); + mpObjectives->setStyleSheet(inputStyleSheet); + mpObjectives->setTextColor(QColor(Qt::black)); + mpObjectives->showText(mpObjectives->text()); mpKeywords->setStyleSheet(inputStyleSheet); mpKeywords->setTextColor(QColor(Qt::black)); mpKeywords->showText(mpKeywords->text()); mpSchoolLevelValueLabel->setText(mpSchoolLevelBox->currentText()); mpSchoolLevelValueLabel->show(); mpSchoolLevelBox->hide(); - mpSchoolBranchValueLabel->setText(mpSchoolBranchBox->currentText()); - mpSchoolBranchValueLabel->show(); - mpSchoolBranchBox->hide(); + mpSchoolSubjectsValueLabel->setText(mpSchoolSubjectsBox->currentText()); + mpSchoolSubjectsValueLabel->show(); + mpSchoolSubjectsBox->hide(); mpSchoolTypeValueLabel->setText(mpSchoolTypeBox->currentText()); mpSchoolTypeValueLabel->show(); mpSchoolTypeBox->hide(); @@ -1022,7 +1022,7 @@ QVector UBTeacherGuidePageZeroWidget::getData() elementNode = new tUBGEElementNode(); elementNode->name = "goals"; - elementNode->attributes.insert("value",mpGoals->text()); + elementNode->attributes.insert("value",mpObjectives->text()); result << elementNode; elementNode = new tUBGEElementNode(); @@ -1037,7 +1037,7 @@ QVector UBTeacherGuidePageZeroWidget::getData() elementNode = new tUBGEElementNode(); elementNode->name = "schoolBranch"; - elementNode->attributes.insert("value",mpSchoolBranchBox->currentText()); + elementNode->attributes.insert("value",mpSchoolSubjectsBox->currentText()); result << elementNode; elementNode = new tUBGEElementNode(); diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 3f9834c4..1a8b78b7 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -150,9 +150,9 @@ private: QLabel* mpCreationLabel; QLabel* mpLastModifiedLabel; - QLabel* mpGoalsLabel; - UBTGAdaptableText* mpGoals; - QFrame* mpSeparatorGoals; + QLabel* mpObjectivesLabel; + UBTGAdaptableText* mpObjectives; + QFrame* mpSeparatorObjectives; QLabel* mpIndexLabel; QLabel* mpKeywordsLabel; @@ -162,9 +162,9 @@ private: QComboBox* mpSchoolLevelBox; QLabel* mpSchoolLevelValueLabel; - QLabel* mpSchoolBranchItemLabel; - QComboBox* mpSchoolBranchBox; - QLabel* mpSchoolBranchValueLabel; + QLabel* mpSchoolSubjectsItemLabel; + QComboBox* mpSchoolSubjectsBox; + QLabel* mpSchoolSubjectsValueLabel; QLabel* mpSchoolTypeItemLabel; QComboBox* mpSchoolTypeBox; From c806f2acfde7bc4245702694bfffdbe1090c9882 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 11 May 2012 11:54:42 +0200 Subject: [PATCH 35/42] fixed color issue when placeholder is set on UBTGAdaptableText --- src/gui/UBTeacherGuideWidgetsTools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index eefb8714..230ff8ce 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -148,9 +148,9 @@ void UBTGAdaptableText::keyPressEvent(QKeyEvent* e) } if(toPlainText() == mPlaceHolderText){ - setTextColor(QColor(Qt::black)); setPlainText(""); } + setTextColor(QColor(Qt::black)); QTextEdit::keyPressEvent(e); } From 30cb5a970ad20aad9c55ef528dff899fbd9ef93b Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 11 May 2012 12:01:57 +0200 Subject: [PATCH 36/42] fixed size on qcombobox to handle correctly the style sheet properties --- src/gui/UBTeacherGuideWidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index e32bf674..e4c66a58 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -707,6 +707,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpSchoolLevelItemLabel->setStyleSheet(chapterStyle); mpLayout->addWidget(mpSchoolLevelItemLabel); mpSchoolLevelBox = new QComboBox(this); + mpSchoolLevelBox->setMinimumHeight(22); mpSchoolLevelBox->setObjectName("DockPaletteWidgetComboBox"); connect(mpSchoolLevelBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(onSchoolLevelChanged(QString))); mpLayout->addWidget(mpSchoolLevelBox); @@ -719,6 +720,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpSchoolSubjectsItemLabel->setStyleSheet(chapterStyle); mpLayout->addWidget(mpSchoolSubjectsItemLabel); mpSchoolSubjectsBox = new QComboBox(this); + mpSchoolSubjectsBox->setMinimumHeight(22); mpSchoolSubjectsBox->setObjectName("DockPaletteWidgetComboBox"); mpLayout->addWidget(mpSchoolSubjectsBox); mpSchoolSubjectsValueLabel = new QLabel(this); @@ -730,6 +732,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpSchoolTypeItemLabel->setStyleSheet(chapterStyle); mpLayout->addWidget(mpSchoolTypeItemLabel); mpSchoolTypeBox = new QComboBox(this); + mpSchoolTypeBox->setMinimumHeight(22); mpSchoolTypeBox->setObjectName("DockPaletteWidgetComboBox"); mpLayout->addWidget(mpSchoolTypeBox); mpSchoolTypeValueLabel = new QLabel(this); @@ -746,6 +749,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpLicenceLabel->setStyleSheet(chapterStyle); mpLayout->addWidget(mpLicenceLabel); mpLicenceBox = new QComboBox(this); + mpLicenceBox->setMinimumHeight(22); mpLicenceBox->setObjectName("DockPaletteWidgetComboBox"); mpLayout->addWidget(mpLicenceBox); mpLicenceLayout = new QHBoxLayout(0); From 726150fa93b7c59636684ad8743764ac4ea18af5 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 11 May 2012 13:47:45 +0200 Subject: [PATCH 37/42] removed wrong text color --- src/gui/UBTeacherGuideWidget.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index e4c66a58..b591f753 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -940,18 +940,14 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode) mpModePushButton->hide(); mpSessionTitle->setReadOnly(false); mpSessionTitle->setStyleSheet(inputStyleSheet); - mpSessionTitle->setTextColor(QColor(Qt::lightGray)); QFont titleFont(QApplication::font().family(),11,-1); mpSessionTitle->document()->setDefaultFont(titleFont); mpAuthors->setReadOnly(false); mpAuthors->setStyleSheet(inputStyleSheet); - mpAuthors->setTextColor(QColor(Qt::lightGray)); mpObjectives->setReadOnly(false); mpObjectives->setStyleSheet(inputStyleSheet); - mpObjectives->setTextColor(QColor(Qt::lightGray)); mpKeywords->setReadOnly(false); mpKeywords->setStyleSheet(inputStyleSheet); - mpKeywords->setTextColor(QColor(Qt::lightGray)); mpSchoolLevelValueLabel->hide(); mpSchoolLevelBox->show(); mpSchoolSubjectsValueLabel->hide(); From a7415550febd91d4dde1ebbde41f7ec87e2bef67 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 11 May 2012 15:19:55 +0200 Subject: [PATCH 38/42] fixed issue of flash that wasn't embedded on w3c wrapper --- src/domain/UBW3CWidget.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/domain/UBW3CWidget.cpp b/src/domain/UBW3CWidget.cpp index 1209ba76..9b423322 100644 --- a/src/domain/UBW3CWidget.cpp +++ b/src/domain/UBW3CWidget.cpp @@ -246,6 +246,8 @@ QString UBW3CWidget::createNPAPIWrapperInDir(const QString& pUrl, const QDir& pD const QString& pName) { QString url = pUrl; + // if the file name start with file:// it has be removed because QFileInfo doesn't support this form + url = url.replace("file://",""); QString name = pName; QFileInfo fi(url); @@ -299,9 +301,11 @@ QString UBW3CWidget::createNPAPIWrapperInDir(const QString& pUrl, const QDir& pD } widgetLibraryDir.mkpath(widgetLibraryPath); - if (fi.exists()) { + if (fi.exists()){ QString target = widgetLibraryPath + "/" + fi.fileName(); - QFile::copy(pUrl, target); + QString source = pUrl; + source.replace("file://",""); + QFile::copy(source, target); } QFile configFile(widgetLibraryPath + "/config.xml"); From 70efd6d93fb893e284bbd48e3457cf033b1784b0 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 11 May 2012 15:20:23 +0200 Subject: [PATCH 39/42] fixed issue af flash not showed --- src/gui/UBTeacherGuideWidget.cpp | 2 ++ src/gui/UBTeacherGuideWidgetsTools.cpp | 13 ++++++++++++- src/gui/UBTeacherGuideWidgetsTools.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index b591f753..fabeffba 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -343,6 +343,8 @@ void UBTeacherGuideEditionWidget::onAddItemClicked(QTreeWidgetItem* widget, int } } else if(column == 1 && addSubItemWidgetType == eUBTGAddSubItemWidgetType_None){ + UBTGMediaWidget* media = dynamic_cast(mpTreeWidget->itemWidget(widget,0)); + if(media) media->removeSource(); int index = mpTreeWidget->currentIndex().row(); QTreeWidgetItem* toBeDeletedWidgetItem = widget->parent()->takeChild(index); delete toBeDeletedWidgetItem; diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index 230ff8ce..bbda8fd1 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -342,6 +342,15 @@ void UBTGMediaWidget::initializeWithDom(QDomElement element) mIsInitializationMode = false; } +void UBTGMediaWidget::removeSource() +{ + QFileInfo fileInfo(mMediaPath); + if(fileInfo.isFile()) + QFile(mMediaPath).remove(); + else + UBFileSystemUtils::deleteDir(mMediaPath); +} + void UBTGMediaWidget::hideEvent(QHideEvent* event) { if(mpWebView) @@ -361,9 +370,11 @@ tUBGEElementNode* UBTGMediaWidget::saveData() if(!mpTitle) return 0; tUBGEElementNode* result = new tUBGEElementNode(); + QString relativePath = mMediaPath; + relativePath = relativePath.replace(UBApplication::boardController->activeDocument()->persistencePath()+"/",""); result->name = "media"; result->attributes.insert("title",mpTitle->text()); - result->attributes.insert("relativePath",mMediaPath.replace(UBApplication::boardController->activeDocument()->persistencePath()+"/","")); + result->attributes.insert("relativePath",relativePath); result->attributes.insert("mediaType",mMediaType); return result; } diff --git a/src/gui/UBTeacherGuideWidgetsTools.h b/src/gui/UBTeacherGuideWidgetsTools.h index bb89add2..7249c6dd 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.h +++ b/src/gui/UBTeacherGuideWidgetsTools.h @@ -140,6 +140,7 @@ public: ~UBTGMediaWidget(); tUBGEElementNode* saveData(); void initializeWithDom(QDomElement element); + void removeSource(); protected: void dragEnterEvent(QDragEnterEvent* event); From a20422439994a9a6a7670eacd351661af24c72aa Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 11 May 2012 16:59:05 +0200 Subject: [PATCH 40/42] added group button --- resources/forms/mainWindow.ui | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/forms/mainWindow.ui b/resources/forms/mainWindow.ui index e81c986b..a2ac84b8 100644 --- a/resources/forms/mainWindow.ui +++ b/resources/forms/mainWindow.ui @@ -69,6 +69,7 @@ + @@ -1642,10 +1643,10 @@ :/images/toolbar/library.png:/images/toolbar/library.png - Gtorup items + Group Items - Erase Content + Group items From 063167af7ed30bafdc2fb07d3c9f0093f42d07a7 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 11 May 2012 17:22:03 +0200 Subject: [PATCH 41/42] fixed building issue on mac --- src/frameworks/UBPlatformUtils_mac.mm | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index 8ab96c0d..78f41d21 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -3,8 +3,6 @@ #include "UBPlatformUtils.h" #include "core/UBApplication.h" #include "core/UBSettings.h" -#include "softwareupdate/UBSoftwareUpdate.h" -#include "softwareupdate/UBSoftwareUpdateController.h" #include "frameworks/UBFileSystemUtils.h" #include From d5ac53e3f15050ea7a7f46bd7bf91ebc1a5f26dd Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 11 May 2012 17:43:53 +0200 Subject: [PATCH 42/42] removed the pcc build --- Sankore_3.1.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sankore_3.1.pro b/Sankore_3.1.pro index 48f67cdc..a4d29bf0 100644 --- a/Sankore_3.1.pro +++ b/Sankore_3.1.pro @@ -136,7 +136,7 @@ macx { LIBS += -framework AppKit LIBS += -framework WebKit - CONFIG(release, debug|release):CONFIG += x86 ppc + CONFIG(release, debug|release):CONFIG += x86 # [03-02-2011] We must use the 32bit version for the moment # because the Quicktime components used by this application