fixed issue 794

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent 24f8135d25
commit 404ccb6de2
  1. 5
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 88
      src/adaptors/UBThumbnailAdaptor.cpp
  3. 1
      src/adaptors/UBThumbnailAdaptor.h
  4. 13
      src/board/UBBoardController.cpp
  5. 2
      src/board/UBBoardPaletteManager.cpp
  6. 2
      src/core/UBPersistenceManager.cpp
  7. 7
      src/document/UBDocumentController.cpp
  8. 3
      src/document/UBDocumentController.h

@ -1405,7 +1405,10 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
} }
QMap<QString,IDataStorage*> elements = getAdditionalElementToStore(); QMap<QString,IDataStorage*> elements = getAdditionalElementToStore();
QVector<tIDataStorage*> dataStorageItems = elements.value("teacherGuide")->save(pageIndex); QVector<tIDataStorage*> dataStorageItems;
if(elements.value("teacherGuide"))
dataStorageItems = elements.value("teacherGuide")->save(pageIndex);
foreach(tIDataStorage* eachItem, dataStorageItems){ foreach(tIDataStorage* eachItem, dataStorageItems){
if(eachItem->type == eElementType_START){ if(eachItem->type == eElementType_START){
mXmlWriter.writeStartElement(eachItem->name); mXmlWriter.writeStartElement(eachItem->name);

@ -91,9 +91,22 @@ const QPixmap* UBThumbnailAdaptor::get(UBDocumentProxy* proxy, int pageIndex)
return pix; return pix;
} }
void UBThumbnailAdaptor::updateDocumentToHandleZeroPage(UBDocumentProxy* proxy)
{
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()){
QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", 0);
QFile file(fileName);
qDebug() << fileName;
if(!file.exists()){
UBPersistenceManager::persistenceManager()->persistDocumentScene(proxy,new UBGraphicsScene(proxy),0);
}
}
}
void UBThumbnailAdaptor::load(UBDocumentProxy* proxy, QList<const QPixmap*>& list) void UBThumbnailAdaptor::load(UBDocumentProxy* proxy, QList<const QPixmap*>& list)
{ {
generateMissingThumbnails(proxy); updateDocumentToHandleZeroPage(proxy);
generateMissingThumbnails(proxy);
foreach(const QPixmap* pm, list) foreach(const QPixmap* pm, list)
delete pm; delete pm;
@ -102,81 +115,10 @@ void UBThumbnailAdaptor::load(UBDocumentProxy* proxy, QList<const QPixmap*>& lis
list.append(get(proxy, i)); list.append(get(proxy, i));
} }
/*
QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
{
QList<QPixmap> thumbnails;
qDebug() << "Loadinf thumbnails for " << proxy->name();
if (!proxy || proxy->persistencePath().isEmpty())
return thumbnails;
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
generateMissingThumbnails(proxy);
//end compatibility with older format
bool moreToProcess = true;
int pageCount = UBApplication::boardController->sceneIndexFromPage(0);
while (moreToProcess) {
pageCount++;
QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageCount);
QFile file(fileName);
if (file.exists()) {
QPixmap pix;
//Warning. Works only with modified Qt
#ifdef Q_WS_X11
//pix.load(fileName, 0, Qt::AutoColor);
pix.load(fileName, 0);
#else
pix.load(fileName, 0, Qt::AutoColor, false);
#endif
thumbnails.append(pix);
} else {
moreToProcess = false;
}
}
return thumbnails;
}
QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
{
qDebug() << "Loadinf thumbnails for " << proxy->name();
int existingPageCount = proxy->pageCount();
if (!proxy || proxy->persistencePath().size() == 0 || index < 0 || index > existingPageCount)
return QPixmap();
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
generateMissingThumbnails(proxy);
//end compatibility with older format
QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", index);
QFile file(fileName);
if (file.exists())
{
QPixmap pix;
//Warning. Works only with modified Qt
#ifdef Q_WS_X11
pix.load(fileName, 0, Qt::AutoColor);
#else
pix.load(fileName, 0, Qt::AutoColor, false);
#endif
return pix;
}
return QPixmap();
}
*/
void UBThumbnailAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* pScene, int pageIndex, bool overrideModified) void UBThumbnailAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* pScene, int pageIndex, bool overrideModified)
{ {
qDebug() << "Persiste scene on path " << proxy->persistencePath() << ", index " << pageIndex; qDebug() << "Persist scene on path " << proxy->persistencePath() << ", index " << pageIndex;
QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex); QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex);

@ -35,6 +35,7 @@ public:
private: private:
static void generateMissingThumbnails(UBDocumentProxy* proxy); static void generateMissingThumbnails(UBDocumentProxy* proxy);
static void updateDocumentToHandleZeroPage(UBDocumentProxy* proxy);
UBThumbnailAdaptor() {} UBThumbnailAdaptor() {}
}; };

@ -106,18 +106,6 @@ void UBBoardController::init()
setupViews(); setupViews();
setupToolbar(); setupToolbar();
//connect(UBPersistenceManager::persistenceManager(), SIGNAL(documentWillBeDeleted(UBDocumentProxy*))
// , this, SLOT(documentWillBeDeleted(UBDocumentProxy*)));
//connect(UBPersistenceManager::persistenceManager(), SIGNAL(documentSceneCreated(UBDocumentProxy*, int))
// , this, SLOT(documentSceneChanged(UBDocumentProxy*, int)));
//connect(UBPersistenceManager::persistenceManager(), SIGNAL(documentSceneDeleted(UBDocumentProxy*, int))
// , this, SLOT(documentSceneChanged(UBDocumentProxy*, int)));
//connect(UBPersistenceManager::persistenceManager(), SIGNAL(documentSceneMoved(UBDocumentProxy*, int))
// , this, SLOT(documentSceneChanged(UBDocumentProxy*, int)));
connect(UBApplication::undoStack, SIGNAL(canUndoChanged(bool)) connect(UBApplication::undoStack, SIGNAL(canUndoChanged(bool))
, this, SLOT(undoRedoStateChange(bool))); , this, SLOT(undoRedoStateChange(bool)));
@ -468,7 +456,6 @@ void UBBoardController::addScene()
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
} }
void UBBoardController::addScene(UBGraphicsScene* scene, bool replaceActiveIfEmpty) void UBBoardController::addScene(UBGraphicsScene* scene, bool replaceActiveIfEmpty)
{ {
if (scene) if (scene)

@ -150,7 +150,7 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mLeftPalette->registerWidget(mpPageNavigWidget); mLeftPalette->registerWidget(mpPageNavigWidget);
mLeftPalette->addTab(mpPageNavigWidget); mLeftPalette->addTab(mpPageNavigWidget);
if(UBSettings::settings()->teacherGuidePageZeroActivated || UBSettings::settings()->teacherGuideLessonPagesActivated){ if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool() || UBSettings::settings()->teacherGuideLessonPagesActivated->get().toBool()){
mpTeacherGuideWidget = new UBDockTeacherGuideWidget(); mpTeacherGuideWidget = new UBDockTeacherGuideWidget();
mLeftPalette->registerWidget(mpTeacherGuideWidget); mLeftPalette->registerWidget(mpTeacherGuideWidget);
mLeftPalette->addTab(mpTeacherGuideWidget); mLeftPalette->addTab(mpTeacherGuideWidget);

@ -676,7 +676,7 @@ int UBPersistenceManager::sceneCountInDir(const QString& pPath)
} }
else else
{ {
if(UBSettings::settings()->teacherGuidePageZeroActivated && pageIndex == 0){ if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool() && pageIndex == 0){
// the document has no zero file but doesn't means that it hasn't any file // 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 // at all. Just importing a document without the first page using a configuartion
// that enables zero page. // that enables zero page.

@ -74,15 +74,9 @@ UBDocumentController::UBDocumentController(UBMainWindow* mainWindow)
setupToolbar(); setupToolbar();
this->selectDocument(UBApplication::boardController->selectedDocument()); this->selectDocument(UBApplication::boardController->selectedDocument());
connect(this, SIGNAL(exportDone()), mMainWindow, SLOT(onExportDone())); connect(this, SIGNAL(exportDone()), mMainWindow, SLOT(onExportDone()));
//connect(mMainWindow->actionNewPage, SIGNAL(triggered()), this, SLOT(reloadThumbs()));
connect(this, SIGNAL(documentThumbnailsUpdated(UBDocumentContainer*)), this, SLOT(refreshDocumentThumbnailsView(UBDocumentContainer*))); connect(this, SIGNAL(documentThumbnailsUpdated(UBDocumentContainer*)), this, SLOT(refreshDocumentThumbnailsView(UBDocumentContainer*)));
} }
//void UBDocumentController::reloadThumbs()
//{
// UBThumbnailAdaptor::load(selectedDocumentProxy(), mDocumentThumbs);
//}
UBDocumentController::~UBDocumentController() UBDocumentController::~UBDocumentController()
{ {
if (mDocumentUI) if (mDocumentUI)
@ -1654,6 +1648,5 @@ void UBDocumentController::refreshDocumentThumbnailsView(UBDocumentContainer*)
connect(mDocumentUI->thumbnailWidget->scene(), SIGNAL(selectionChanged()), this, SLOT(pageSelectionChanged())); connect(mDocumentUI->thumbnailWidget->scene(), SIGNAL(selectionChanged()), this, SLOT(pageSelectionChanged()));
} }
//emit refreshThumbnails();
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
} }

@ -57,9 +57,7 @@ class UBDocumentController : public UBDocumentContainer
bool pageCanBeDeleted(int page); bool pageCanBeDeleted(int page);
signals: signals:
//void refreshThumbnails();
void exportDone(); void exportDone();
//void movedToIndex(int index);
public slots: public slots:
void createNewDocument(); void createNewDocument();
@ -80,7 +78,6 @@ class UBDocumentController : public UBDocumentContainer
void copy(); void copy();
void paste(); void paste();
void focusChanged(QWidget *old, QWidget *current); void focusChanged(QWidget *old, QWidget *current);
//void reloadThumbs();
protected: protected:
virtual void setupViews(); virtual void setupViews();

Loading…
Cancel
Save