fixed issue with toque teacher bar

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent 04561f96f2
commit 11129a97dc
  1. 30
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 13
      src/adaptors/UBThumbnailAdaptor.cpp
  3. 13
      src/board/UBBoardController.cpp
  4. 3
      src/board/UBBoardController.h
  5. 11
      src/core/UBPersistenceManager.cpp
  6. 3
      src/core/UBPersistenceManager.h
  7. 2
      src/document/UBDocumentContainer.cpp
  8. 4
      src/document/UBDocumentContainer.h
  9. 22
      src/gui/UBDocumentNavigator.cpp

@ -941,18 +941,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
readGroupRoot(); readGroupRoot();
} }
// else if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){
// sTeacherGuideNode.clear();
// sTeacherGuideNode += "<teacherGuide version=\"" + mXmlReader.attributes().value("version").toString() + "\">";
// 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 else
{ {
// NOOP // NOOP
@ -976,17 +964,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mGroupDarkBackgroundColor = QColor(); mGroupDarkBackgroundColor = QColor();
mGroupLightBackgroundColor = QColor(); mGroupLightBackgroundColor = QColor();
} }
// else if (mXmlReader.name() == "teacherBar" || mXmlReader.name() == "teacherGuide"){
// sTeacherGuideNode += "</teacherGuide>";
// qDebug() << sTeacherGuideNode;
// QMap<QString,IDataStorage*> elements = getAdditionalElementToStore();
// IDataStorage* storageClass = elements.value("teacherGuide");
// if(storageClass){
// storageClass->load(sTeacherGuideNode);
// }
// }
} }
} }
@ -1147,17 +1124,10 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
QDomElement groupRoot = groupDomDocument.createElement(tGroups); QDomElement groupRoot = groupDomDocument.createElement(tGroups);
groupDomDocument.appendChild(groupRoot); groupDomDocument.appendChild(groupRoot);
static int i = 0;
qDebug() << "persist call no is " << ++i;
QBuffer buffer; QBuffer buffer;
buffer.open(QBuffer::WriteOnly); buffer.open(QBuffer::WriteOnly);
mXmlWriter.setDevice(&buffer); mXmlWriter.setDevice(&buffer);
//Unused variable
//QTime timer = QTime::currentTime();
mXmlWriter.setAutoFormatting(true); mXmlWriter.setAutoFormatting(true);
mXmlWriter.writeStartDocument(); mXmlWriter.writeStartDocument();

@ -23,7 +23,12 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "gui/UBDockTeacherGuideWidget.h"
#include "gui/UBTeacherGuideWidget.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h"
#include "document/UBDocumentProxy.h" #include "document/UBDocumentProxy.h"
@ -120,7 +125,7 @@ void UBThumbnailAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* p
QFile thumbFile(fileName); QFile thumbFile(fileName);
if (pScene->isModified() || overrideModified || !thumbFile.exists()) if (pScene->isModified() || overrideModified || !thumbFile.exists() || UBApplication::boardController->paletteManager()->teacherGuideDockWidget()->teacherGuideWidget()->isModified())
{ {
qreal nominalWidth = pScene->nominalSize().width(); qreal nominalWidth = pScene->nominalSize().width();
qreal nominalHeight = pScene->nominalSize().height(); qreal nominalHeight = pScene->nominalSize().height();
@ -152,6 +157,12 @@ void UBThumbnailAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* p
pScene->render(&painter, imageRect, sceneRect, Qt::KeepAspectRatio); pScene->render(&painter, imageRect, sceneRect, Qt::KeepAspectRatio);
if(UBApplication::boardController->paletteManager()->teacherGuideDockWidget()->teacherGuideWidget()->isModified()){
QPixmap toque(":images/toque.png");
painter.setOpacity(0.6);
painter.drawPixmap(QPoint(width - toque.width(),0),toque);
}
pScene->setRenderingContext(UBGraphicsScene::Screen); pScene->setRenderingContext(UBGraphicsScene::Screen);
pScene->setRenderingQuality(UBItem::RenderingQualityNormal); pScene->setRenderingQuality(UBItem::RenderingQualityNormal);

@ -95,6 +95,7 @@ UBBoardController::UBBoardController(UBMainWindow* mainWindow)
, mCleanupDone(false) , mCleanupDone(false)
, mCacheWidgetIsEnabled(false) , mCacheWidgetIsEnabled(false)
, mDeletingSceneIndex(-1) , mDeletingSceneIndex(-1)
, mMovingSceneIndex(-1)
, mActionGroupText(tr("Group")) , mActionGroupText(tr("Group"))
, mActionUngroupText(tr("Ungroup")) , mActionUngroupText(tr("Ungroup"))
{ {
@ -1450,9 +1451,6 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
{ {
freezeW3CWidgets(true); freezeW3CWidgets(true);
if(sceneChange)
emit activeSceneWillChange();
persistCurrentScene(); persistCurrentScene();
ClearUndoStack(); ClearUndoStack();
@ -1500,14 +1498,17 @@ void UBBoardController::moveSceneToIndex(int source, int target)
{ {
if (selectedDocument()) if (selectedDocument())
{ {
persistCurrentScene(); persistCurrentScene();
UBDocumentContainer::movePageToIndex(source, target); UBDocumentContainer::movePageToIndex(source, target);
selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
UBMetadataDcSubsetAdaptor::persist(selectedDocument()); UBMetadataDcSubsetAdaptor::persist(selectedDocument());
mMovingSceneIndex = source;
setActiveDocumentScene(target); setActiveDocumentScene(target);
mMovingSceneIndex = -1;
} }
} }
@ -1807,11 +1808,9 @@ void UBBoardController::persistCurrentScene()
{ {
if(UBPersistenceManager::persistenceManager() if(UBPersistenceManager::persistenceManager()
&& selectedDocument() && mActiveScene && mActiveSceneIndex != mDeletingSceneIndex && selectedDocument() && mActiveScene && mActiveSceneIndex != mDeletingSceneIndex
&& (mActiveSceneIndex >= 0) && (mActiveSceneIndex >= 0) && mActiveSceneIndex != mMovingSceneIndex
&& (mActiveScene->isModified() || (UBApplication::boardController->paletteManager()->teacherGuideDockWidget() && UBApplication::boardController->paletteManager()->teacherGuideDockWidget()->teacherGuideWidget()->isModified()))) && (mActiveScene->isModified() || (UBApplication::boardController->paletteManager()->teacherGuideDockWidget() && UBApplication::boardController->paletteManager()->teacherGuideDockWidget()->teacherGuideWidget()->isModified())))
{ {
emit activeSceneWillBePersisted();
UBPersistenceManager::persistenceManager()->persistDocumentScene(selectedDocument(), mActiveScene, mActiveSceneIndex); UBPersistenceManager::persistenceManager()->persistDocumentScene(selectedDocument(), mActiveScene, mActiveSceneIndex);
updatePage(mActiveSceneIndex); updatePage(mActiveSceneIndex);
} }

@ -229,8 +229,6 @@ class UBBoardController : public UBDocumentContainer
signals: signals:
void newPageAdded(); void newPageAdded();
void activeSceneWillBePersisted();
void activeSceneWillChange();
void activeSceneChanged(); void activeSceneChanged();
void zoomChanged(qreal pZoomFactor); void zoomChanged(qreal pZoomFactor);
void systemScaleFactorChanged(qreal pSystemScaleFactor); void systemScaleFactorChanged(qreal pSystemScaleFactor);
@ -286,6 +284,7 @@ class UBBoardController : public UBDocumentContainer
bool mCacheWidgetIsEnabled; bool mCacheWidgetIsEnabled;
QGraphicsItem* mLastCreatedItem; QGraphicsItem* mLastCreatedItem;
int mDeletingSceneIndex; int mDeletingSceneIndex;
int mMovingSceneIndex;
QString mActionGroupText; QString mActionGroupText;
QString mActionUngroupText; QString mActionUngroupText;

@ -463,11 +463,6 @@ void UBPersistenceManager::deleteDocumentScenes(UBDocumentProxy* proxy, const QL
} }
} }
foreach(int index, compactedIndexes)
{
emit documentSceneDeleted(proxy, index);
}
} }
@ -576,8 +571,6 @@ void UBPersistenceManager::moveSceneToIndex(UBDocumentProxy* proxy, int source,
thumb.rename(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", target)); thumb.rename(proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", target));
mSceneCache.moveScene(proxy, source, target); mSceneCache.moveScene(proxy, source, target);
emit documentSceneMoved(proxy, target);
} }
@ -612,7 +605,7 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
UBBoardPaletteManager* paletteManager = UBApplication::boardController->paletteManager(); UBBoardPaletteManager* paletteManager = UBApplication::boardController->paletteManager();
bool teacherGuideModified = false; bool teacherGuideModified = false;
if(paletteManager->teacherGuideDockWidget()) if(UBApplication::app()->boardController->currentPage() == pSceneIndex && paletteManager->teacherGuideDockWidget())
teacherGuideModified = paletteManager->teacherGuideDockWidget()->teacherGuideWidget()->isModified(); teacherGuideModified = paletteManager->teacherGuideDockWidget()->teacherGuideWidget()->isModified();
if (pDocumentProxy->isModified() || teacherGuideModified) if (pDocumentProxy->isModified() || teacherGuideModified)
@ -628,8 +621,6 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
} }
mSceneCache.insert(pDocumentProxy, pSceneIndex, pScene); mSceneCache.insert(pDocumentProxy, pSceneIndex, pScene);
emit documentCommitted(pDocumentProxy);
} }

@ -117,13 +117,10 @@ class UBPersistenceManager : public QObject
void documentCreated(UBDocumentProxy* pDocumentProxy); void documentCreated(UBDocumentProxy* pDocumentProxy);
void documentMetadataChanged(UBDocumentProxy* pDocumentProxy); void documentMetadataChanged(UBDocumentProxy* pDocumentProxy);
void documentCommitted(UBDocumentProxy* pDocumentProxy);
void documentWillBeDeleted(UBDocumentProxy* pDocumentProxy); void documentWillBeDeleted(UBDocumentProxy* pDocumentProxy);
void documentSceneCreated(UBDocumentProxy* pDocumentProxy, int pIndex); void documentSceneCreated(UBDocumentProxy* pDocumentProxy, int pIndex);
void documentSceneMoved(UBDocumentProxy* pDocumentProxy, int pIndex);
void documentSceneWillBeDeleted(UBDocumentProxy* pDocumentProxy, int pIndex); void documentSceneWillBeDeleted(UBDocumentProxy* pDocumentProxy, int pIndex);
void documentSceneDeleted(UBDocumentProxy* pDocumentProxy, int pDeletedIndex);
private: private:

@ -94,7 +94,6 @@ void UBDocumentContainer::updatePage(int index)
void UBDocumentContainer::deleteThumbPage(int index) void UBDocumentContainer::deleteThumbPage(int index)
{ {
mDocumentThumbs.removeAt(index); mDocumentThumbs.removeAt(index);
emit documentPageDeleted(index);
} }
void UBDocumentContainer::updateThumbPage(int index) void UBDocumentContainer::updateThumbPage(int index)
@ -106,7 +105,6 @@ void UBDocumentContainer::updateThumbPage(int index)
void UBDocumentContainer::insertThumbPage(int index) void UBDocumentContainer::insertThumbPage(int index)
{ {
mDocumentThumbs.insert(index, UBThumbnailAdaptor::get(mCurrentDocument, index)); mDocumentThumbs.insert(index, UBThumbnailAdaptor::get(mCurrentDocument, index));
emit documentPageAdded(index);
} }
void UBDocumentContainer::reloadThumbnails() void UBDocumentContainer::reloadThumbnails()

@ -58,8 +58,8 @@ class UBDocumentContainer : public QObject
signals: signals:
void documentSet(UBDocumentProxy* document); void documentSet(UBDocumentProxy* document);
void documentPageAdded(int index); // void documentPageAdded(int index);
void documentPageDeleted(int index); // void documentPageDeleted(int index);
void documentPageUpdated(int index); void documentPageUpdated(int index);
void documentThumbnailsUpdated(UBDocumentContainer* source); void documentThumbnailsUpdated(UBDocumentContainer* source);
}; };

@ -89,27 +89,9 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
{ {
const QPixmap* pix = source->pageAt(i); const QPixmap* pix = source->pageAt(i);
QPixmap result(pix->width(),pix->height());
int pageIndex = UBDocumentContainer::pageFromSceneIndex(i); int pageIndex = UBDocumentContainer::pageFromSceneIndex(i);
QPainter composePainter; UBSceneThumbnailNavigPixmap* pixmapItem = new UBSceneThumbnailNavigPixmap(*pix, source->selectedDocument(), i);
composePainter.begin(&result);
composePainter.drawPixmap(QPoint(0,0),*pix);
if(pageIndex == UBApplication::boardController->currentPage() &&
((pageIndex == 0 && UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) ||
(pageIndex && UBSettings::settings()->teacherGuideLessonPagesActivated->get().toBool()))
) {
if(UBApplication::boardController->paletteManager()->teacherGuideDockWidget()->teacherGuideWidget()->isModified()){
QPixmap toque(":images/toque.png");
composePainter.setOpacity(0.6);
composePainter.drawPixmap(QPoint(pix->width() - toque.width(),0),toque);
}
}
composePainter.end();
UBSceneThumbnailNavigPixmap* pixmapItem = new UBSceneThumbnailNavigPixmap(result, source->selectedDocument(), i);
QString label = pageIndex == 0 ? tr("Title page") : tr("Page %0").arg(pageIndex); QString label = pageIndex == 0 ? tr("Title page") : tr("Page %0").arg(pageIndex);
UBThumbnailTextItem *labelItem = new UBThumbnailTextItem(label); UBThumbnailTextItem *labelItem = new UBThumbnailTextItem(label);
@ -128,7 +110,6 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
void UBDocumentNavigator::onScrollToSelectedPage(int index) void UBDocumentNavigator::onScrollToSelectedPage(int index)
{ {
qDebug() << "Selection in widget: " << index;
int c = 0; int c = 0;
foreach(UBImgTextThumbnailElement el, mThumbsWithLabels) foreach(UBImgTextThumbnailElement el, mThumbsWithLabels)
{ {
@ -286,7 +267,6 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
break; break;
} }
} }
qDebug() << "Selected Scene: " << index;
UBApplication::boardController->setActiveDocumentScene(index); UBApplication::boardController->setActiveDocumentScene(index);
} }
QGraphicsView::mousePressEvent(event); QGraphicsView::mousePressEvent(event);

Loading…
Cancel
Save