first page handling code

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent f85bb2d5fa
commit 7ee53b07ad
  1. 15
      resources/style.qss
  2. 1
      src/adaptors/UBImportImage.cpp
  3. 1
      src/adaptors/UBImportPDF.cpp
  4. 20
      src/adaptors/UBThumbnailAdaptor.cpp
  5. 12
      src/adaptors/publishing/UBDocumentPublisher.cpp
  6. 9
      src/board/UBBoardController.cpp
  7. 2
      src/board/UBBoardController.h
  8. 4
      src/board/UBBoardPaletteManager.cpp
  9. 3
      src/board/UBBoardView.cpp
  10. 2
      src/board/UBFeaturesController.h
  11. 38
      src/core/UBPersistenceManager.cpp
  12. 4
      src/core/UBPersistenceManager.h
  13. 2
      src/gui/UBDocumentNavigator.cpp
  14. 3
      src/gui/UBNavigatorPalette.cpp
  15. 4
      src/gui/UBTeacherGuideWidget.cpp
  16. 1
      src/gui/UBThumbnailWidget.cpp

@ -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;
}

@ -14,7 +14,6 @@
*/
#include "UBImportImage.h"
#include "UBSvgSubsetAdaptor.h"
#include "document/UBDocumentProxy.h"

@ -14,7 +14,6 @@
*/
#include "UBImportPDF.h"
#include "UBSvgSubsetAdaptor.h"
#include "document/UBDocumentProxy.h"

@ -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<QPixmap> 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<QPixmap> 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);
}

@ -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<UBGraphicsW3CWidgetItem*>(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))

@ -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());

@ -59,6 +59,8 @@ class UBBoardController : public QObject
int currentPage();
int pageFromSceneIndex(int sceneIndex);
UBDocumentProxy* activeDocument()
{
return mActiveDocument;

@ -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)

@ -853,7 +853,8 @@ void UBBoardView::dropEvent (QDropEvent *event)
|| dynamic_cast<UBThumbnailWidget *>(event->source())
|| dynamic_cast<QWebView*>(event->source())
|| dynamic_cast<UBTGMediaWidget*>(event->source())
|| dynamic_cast<QListView *>(event->source()) ) {
|| dynamic_cast<QListView *>(event->source())
|| dynamic_cast<UBTGDraggableTreeItem*>(event->source())) {
mController->processMimeData (event->mimeData (), mapToScene (event->pos ()));
event->acceptProposedAction();

@ -8,8 +8,6 @@
#include <QString>
#include <QPixmap>
//#include "UBDockPaletteWidget.h"
enum UBFeatureElementType
{
FEATURE_CATEGORY,

@ -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<QPointer<UBDocumentProxy> > UBPersistenceManager::allDocumentProxies()
{
mDocumentRepositoryPath = UBSettings::userDocumentDirectory();
@ -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)
{

@ -41,6 +41,7 @@ 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();
@ -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);

@ -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());

@ -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;

@ -862,6 +862,9 @@ void UBTeacherGuidePageZeroWidget::loadData()
void UBTeacherGuidePageZeroWidget::persistData()
{
// 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());
@ -872,6 +875,7 @@ void UBTeacherGuidePageZeroWidget::persistData()
documentProxy->setMetaData(UBSettings::sessionType,mpSchoolTypeBox->currentText());
documentProxy->setMetaData(UBSettings::sessionLicence,mpLicenceBox->currentText());
}
}
void UBTeacherGuidePageZeroWidget::updateSceneTitle()
{

@ -855,6 +855,7 @@ void UBSceneThumbnailNavigPixmap::deletePage()
void UBSceneThumbnailNavigPixmap::moveUpPage()
{
UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() - 1);
}

Loading…
Cancel
Save