fixed issue 794

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent 24f8135d25
commit 404ccb6de2
  1. 5
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 86
      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();
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){
if(eachItem->type == eElementType_START){
mXmlWriter.writeStartElement(eachItem->name);

@ -91,92 +91,34 @@ const QPixmap* UBThumbnailAdaptor::get(UBDocumentProxy* proxy, int pageIndex)
return pix;
}
void UBThumbnailAdaptor::load(UBDocumentProxy* proxy, QList<const QPixmap*>& list)
{
generateMissingThumbnails(proxy);
foreach(const QPixmap* pm, list)
delete pm;
list.clear();
for(int i=0; i<proxy->pageCount(); i++)
list.append(get(proxy, i));
}
/*
QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
void UBThumbnailAdaptor::updateDocumentToHandleZeroPage(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);
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()){
QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", 0);
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;
qDebug() << fileName;
if(!file.exists()){
UBPersistenceManager::persistenceManager()->persistDocumentScene(proxy,new UBGraphicsScene(proxy),0);
}
}
return thumbnails;
}
QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
void UBThumbnailAdaptor::load(UBDocumentProxy* proxy, QList<const QPixmap*>& list)
{
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
updateDocumentToHandleZeroPage(proxy);
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();
foreach(const QPixmap* pm, list)
delete pm;
list.clear();
for(int i=0; i<proxy->pageCount(); i++)
list.append(get(proxy, i));
}
*/
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);

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

@ -106,18 +106,6 @@ void UBBoardController::init()
setupViews();
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))
, this, SLOT(undoRedoStateChange(bool)));
@ -468,7 +456,6 @@ void UBBoardController::addScene()
QApplication::restoreOverrideCursor();
}
void UBBoardController::addScene(UBGraphicsScene* scene, bool replaceActiveIfEmpty)
{
if (scene)

@ -150,7 +150,7 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mLeftPalette->registerWidget(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();
mLeftPalette->registerWidget(mpTeacherGuideWidget);
mLeftPalette->addTab(mpTeacherGuideWidget);

@ -676,7 +676,7 @@ int UBPersistenceManager::sceneCountInDir(const QString& pPath)
}
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
// at all. Just importing a document without the first page using a configuartion
// that enables zero page.

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

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

Loading…
Cancel
Save