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();
}
// 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
{
// NOOP
@ -976,17 +964,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mGroupDarkBackgroundColor = 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);
groupDomDocument.appendChild(groupRoot);
static int i = 0;
qDebug() << "persist call no is " << ++i;
QBuffer buffer;
buffer.open(QBuffer::WriteOnly);
mXmlWriter.setDevice(&buffer);
//Unused variable
//QTime timer = QTime::currentTime();
mXmlWriter.setAutoFormatting(true);
mXmlWriter.writeStartDocument();

@ -23,7 +23,12 @@
#include "core/UBApplication.h"
#include "core/UBSettings.h"
#include "gui/UBDockTeacherGuideWidget.h"
#include "gui/UBTeacherGuideWidget.h"
#include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h"
#include "document/UBDocumentProxy.h"
@ -120,7 +125,7 @@ void UBThumbnailAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* p
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 nominalHeight = pScene->nominalSize().height();
@ -152,6 +157,12 @@ void UBThumbnailAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* p
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->setRenderingQuality(UBItem::RenderingQualityNormal);

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

@ -229,8 +229,6 @@ class UBBoardController : public UBDocumentContainer
signals:
void newPageAdded();
void activeSceneWillBePersisted();
void activeSceneWillChange();
void activeSceneChanged();
void zoomChanged(qreal pZoomFactor);
void systemScaleFactorChanged(qreal pSystemScaleFactor);
@ -286,6 +284,7 @@ class UBBoardController : public UBDocumentContainer
bool mCacheWidgetIsEnabled;
QGraphicsItem* mLastCreatedItem;
int mDeletingSceneIndex;
int mMovingSceneIndex;
QString mActionGroupText;
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));
mSceneCache.moveScene(proxy, source, target);
emit documentSceneMoved(proxy, target);
}
@ -612,7 +605,7 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
UBBoardPaletteManager* paletteManager = UBApplication::boardController->paletteManager();
bool teacherGuideModified = false;
if(paletteManager->teacherGuideDockWidget())
if(UBApplication::app()->boardController->currentPage() == pSceneIndex && paletteManager->teacherGuideDockWidget())
teacherGuideModified = paletteManager->teacherGuideDockWidget()->teacherGuideWidget()->isModified();
if (pDocumentProxy->isModified() || teacherGuideModified)
@ -628,8 +621,6 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
}
mSceneCache.insert(pDocumentProxy, pSceneIndex, pScene);
emit documentCommitted(pDocumentProxy);
}

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

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

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

@ -89,27 +89,9 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
{
const QPixmap* pix = source->pageAt(i);
QPixmap result(pix->width(),pix->height());
int pageIndex = UBDocumentContainer::pageFromSceneIndex(i);
QPainter composePainter;
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);
UBSceneThumbnailNavigPixmap* pixmapItem = new UBSceneThumbnailNavigPixmap(*pix, source->selectedDocument(), i);
QString label = pageIndex == 0 ? tr("Title page") : tr("Page %0").arg(pageIndex);
UBThumbnailTextItem *labelItem = new UBThumbnailTextItem(label);
@ -128,7 +110,6 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
void UBDocumentNavigator::onScrollToSelectedPage(int index)
{
qDebug() << "Selection in widget: " << index;
int c = 0;
foreach(UBImgTextThumbnailElement el, mThumbsWithLabels)
{
@ -286,7 +267,6 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
break;
}
}
qDebug() << "Selected Scene: " << index;
UBApplication::boardController->setActiveDocumentScene(index);
}
QGraphicsView::mousePressEvent(event);

Loading…
Cancel
Save