Commit ad6f1ea6 authored by Claudio Valerio's avatar Claudio Valerio

Merge branch 'master' of github.com:Sankore/Sankore-3.1

parents f0bf15a3 45ec8db8
...@@ -9,7 +9,7 @@ CONFIG += debug_and_release \ ...@@ -9,7 +9,7 @@ CONFIG += debug_and_release \
VERSION_MAJ = 1 VERSION_MAJ = 1
VERSION_MIN = 40 VERSION_MIN = 40
VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 00 VERSION_PATCH = 01
VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}" VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}"
VERSION = $$replace(VERSION, "\\.r", "") VERSION = $$replace(VERSION, "\\.r", "")
......
...@@ -208,7 +208,7 @@ function modeEdit() ...@@ -208,7 +208,7 @@ function modeEdit()
// if no sankore api, insert ok button // if no sankore api, insert ok button
if( !isSankore ) if( !isSankore )
{ {
$( "#mp_setup" ).empty().append( '<input type="button" value="OK">' ); $( "#mp_setup" ).empty().append( '<input type="button" value="View">' );
$( "#mp_setup input:button" ).click( function(){ $( "#mp_setup input:button" ).click( function(){
modeView(); modeView();
}); });
......
...@@ -236,7 +236,7 @@ function modeEdit() ...@@ -236,7 +236,7 @@ function modeEdit()
// if no sankore api, insert ok button // if no sankore api, insert ok button
if( !isSankore ) if( !isSankore )
{ {
$( "#mp_setup" ).empty().append( '<input type="button" value="OK">' ); $( "#mp_setup" ).empty().append( '<input type="button" value="View">' );
$( "#mp_setup input:button" ).click( function(){ $( "#mp_setup input:button" ).click( function(){
modeView(); modeView();
}); });
...@@ -249,9 +249,11 @@ $(window).mouseout(function(){ ...@@ -249,9 +249,11 @@ $(window).mouseout(function(){
if(window.sankore){ if(window.sankore){
var str = ""; var str = "";
$( "#mp_word .letter" ).each( function(){ $( "#mp_word .letter" ).each( function(){
str += $(this).text(); str += $(this).text() + "*";
}); });
str = str.substr(0, str.length - 1);
sankore.setPreference("currentOrdWords", str); sankore.setPreference("currentOrdWords", str);
sankore.setPreference("rightOrdWords", word); sankore.setPreference("rightOrdWords", word);
} }
......
...@@ -999,6 +999,7 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::repositionSvgItem(QGraphicsItem *ite ...@@ -999,6 +999,7 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::repositionSvgItem(QGraphicsItem *ite
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::createNewScene() bool UBCFFSubsetAdaptor::UBCFFSubsetReader::createNewScene()
{ {
mCurrentScene = UBPersistenceManager::persistenceManager()->createDocumentSceneAt(mProxy, mProxy->pageCount()); mCurrentScene = UBPersistenceManager::persistenceManager()->createDocumentSceneAt(mProxy, mProxy->pageCount());
mCurrentScene->setURStackEnable(false);
mCurrentSceneRect = mCurrentScene->normalizedSceneRect(); mCurrentSceneRect = mCurrentScene->normalizedSceneRect();
mVBTransFactor = qMin(mCurrentSceneRect.width() / mViewPort.width(), mVBTransFactor = qMin(mCurrentSceneRect.width() / mViewPort.width(),
mCurrentSceneRect.height() / mViewPort.height()); mCurrentSceneRect.height() / mViewPort.height());
...@@ -1035,7 +1036,6 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::persistScenes() ...@@ -1035,7 +1036,6 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::persistScenes()
UBThumbnailAdaptor::persistScene(mProxy->persistencePath(), tmpScene, i); UBThumbnailAdaptor::persistScene(mProxy->persistencePath(), tmpScene, i);
delete tmpScene; delete tmpScene;
mCurrentScene->setModified(false); mCurrentScene->setModified(false);
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "domain/UBGraphicsTextItem.h" #include "domain/UBGraphicsTextItem.h"
#include "domain/UBAbstractWidget.h" #include "domain/UBAbstractWidget.h"
#include "domain/UBGraphicsStroke.h" #include "domain/UBGraphicsStroke.h"
#include "domain/UBItem.h"
#include "tools/UBGraphicsRuler.h" #include "tools/UBGraphicsRuler.h"
#include "tools/UBGraphicsCompass.h" #include "tools/UBGraphicsCompass.h"
...@@ -106,7 +107,8 @@ QMatrix UBSvgSubsetAdaptor::fromSvgTransform(const QString& transform) ...@@ -106,7 +107,8 @@ QMatrix UBSvgSubsetAdaptor::fromSvgTransform(const QString& transform)
static bool itemZIndexComp(const QGraphicsItem* item1, static bool itemZIndexComp(const QGraphicsItem* item1,
const QGraphicsItem* item2) const QGraphicsItem* item2)
{ {
return item1->zValue() < item2->zValue(); // return item1->zValue() < item2->zValue();
return item1->data(UBGraphicsItemData::ItemOwnZValue).toReal() < item2->data(UBGraphicsItemData::ItemOwnZValue).toReal();
} }
...@@ -1337,11 +1339,13 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol ...@@ -1337,11 +1339,13 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
if (!ubZValue.isNull()) if (!ubZValue.isNull())
{ {
polygonItem->setZValue(ubZValue.toString().toFloat()); // polygonItem->setZValue (ubZValue.toString().toFloat());
UBGraphicsItem::assignZValue(polygonItem, ubZValue.toString().toFloat());
} }
else else
{ {
polygonItem->setZValue(mGroupZIndex); // polygonItem->setZValue(mGroupZIndex);
UBGraphicsItem::assignZValue(polygonItem, mGroupZIndex);
} }
QStringRef ubFillOnDarkBackground = mXmlReader.attributes().value(mNamespaceUri, "fill-on-dark-background"); QStringRef ubFillOnDarkBackground = mXmlReader.attributes().value(mNamespaceUri, "fill-on-dark-background");
...@@ -1444,11 +1448,13 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromLin ...@@ -1444,11 +1448,13 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromLin
if (!ubZValue.isNull()) if (!ubZValue.isNull())
{ {
polygonItem->setZValue(ubZValue.toString().toFloat()); // polygonItem->setZValue(ubZValue.toString().toFloat());
UBGraphicsItem::assignZValue(polygonItem, ubZValue.toString().toFloat());
} }
else else
{ {
polygonItem->setZValue(mGroupZIndex); // polygonItem->setZValue(mGroupZIndex);
UBGraphicsItem::assignZValue(polygonItem, mGroupZIndex);
} }
...@@ -1587,7 +1593,8 @@ QList<UBGraphicsPolygonItem*> UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItem ...@@ -1587,7 +1593,8 @@ QList<UBGraphicsPolygonItem*> UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItem
{ {
UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem(QLineF(points.at(i), points.at(i + 1)), lineWidth); UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem(QLineF(points.at(i), points.at(i + 1)), lineWidth);
polygonItem->setColor(brushColor); polygonItem->setColor(brushColor);
polygonItem->setZValue(zValue); // polygonItem->setZValue(zValue);
UBGraphicsItem::assignZValue(polygonItem, zValue);
polygonItem->setColorOnDarkBackground(colorOnDarkBackground); polygonItem->setColorOnDarkBackground(colorOnDarkBackground);
polygonItem->setColorOnLightBackground(colorOnLightBackground); polygonItem->setColorOnLightBackground(colorOnLightBackground);
...@@ -1931,7 +1938,8 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g ...@@ -1931,7 +1938,8 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
if (!ubZValue.isNull()) if (!ubZValue.isNull())
{ {
gItem->setZValue(ubZValue.toString().toFloat()); // gItem->setZValue(ubZValue.toString().toFloat());
UBGraphicsItem::assignZValue(gItem, ubZValue.toString().toFloat());
} }
UBItem* ubItem = dynamic_cast<UBItem*>(gItem); UBItem* ubItem = dynamic_cast<UBItem*>(gItem);
...@@ -2484,7 +2492,8 @@ UBGraphicsRuler* UBSvgSubsetAdaptor::UBSvgSubsetReader::rulerFromSvg() ...@@ -2484,7 +2492,8 @@ UBGraphicsRuler* UBSvgSubsetAdaptor::UBSvgSubsetReader::rulerFromSvg()
graphicsItemFromSvg(ruler); graphicsItemFromSvg(ruler);
ruler->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetRuler); // ruler->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetRuler);
UBGraphicsItem::assignZValue(ruler, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetRuler);
ruler->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); ruler->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
QStringRef svgWidth = mXmlReader.attributes().value("width"); QStringRef svgWidth = mXmlReader.attributes().value("width");
...@@ -2542,7 +2551,8 @@ UBGraphicsCompass* UBSvgSubsetAdaptor::UBSvgSubsetReader::compassFromSvg() ...@@ -2542,7 +2551,8 @@ UBGraphicsCompass* UBSvgSubsetAdaptor::UBSvgSubsetReader::compassFromSvg()
graphicsItemFromSvg(compass); graphicsItemFromSvg(compass);
compass->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCompass); //compass->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCompass);
UBGraphicsItem::assignZValue(compass, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCompass);
compass->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); compass->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
QStringRef svgX = mXmlReader.attributes().value("x"); QStringRef svgX = mXmlReader.attributes().value("x");
...@@ -2606,7 +2616,8 @@ UBGraphicsProtractor* UBSvgSubsetAdaptor::UBSvgSubsetReader::protractorFromSvg() ...@@ -2606,7 +2616,8 @@ UBGraphicsProtractor* UBSvgSubsetAdaptor::UBSvgSubsetReader::protractorFromSvg()
{ {
UBGraphicsProtractor* protractor = new UBGraphicsProtractor(); UBGraphicsProtractor* protractor = new UBGraphicsProtractor();
protractor->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetProtractor); // protractor->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetProtractor);
UBGraphicsItem::assignZValue(protractor, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetProtractor);
protractor->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); protractor->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
graphicsItemFromSvg(protractor); graphicsItemFromSvg(protractor);
...@@ -2676,7 +2687,8 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg() ...@@ -2676,7 +2687,8 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
{ {
UBGraphicsTriangle* triangle = new UBGraphicsTriangle(); UBGraphicsTriangle* triangle = new UBGraphicsTriangle();
triangle->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetTriangle); // triangle->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetTriangle);
UBGraphicsItem::assignZValue(triangle, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetTriangle);
triangle->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); triangle->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
graphicsItemFromSvg(triangle); graphicsItemFromSvg(triangle);
...@@ -2695,7 +2707,6 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg() ...@@ -2695,7 +2707,6 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
triangle->setRect(svgX.toString().toFloat(), svgY.toString().toFloat(), svgWidth.toString().toFloat(), svgHeight.toString().toFloat(), orientation); triangle->setRect(svgX.toString().toFloat(), svgY.toString().toFloat(), svgWidth.toString().toFloat(), svgHeight.toString().toFloat(), orientation);
} }
triangle->setVisible(true); triangle->setVisible(true);
return triangle; return triangle;
} }
...@@ -2703,7 +2714,8 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg() ...@@ -2703,7 +2714,8 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
UBGraphicsCache* UBSvgSubsetAdaptor::UBSvgSubsetReader::cacheFromSvg() UBGraphicsCache* UBSvgSubsetAdaptor::UBSvgSubsetReader::cacheFromSvg()
{ {
UBGraphicsCache* pCache = new UBGraphicsCache(); UBGraphicsCache* pCache = new UBGraphicsCache();
//pCache->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCache); pCache->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCache);
// UBGraphicsItem::assignZValue(pCache, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCache);
pCache->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); pCache->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
graphicsItemFromSvg(pCache); graphicsItemFromSvg(pCache);
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#include "UBBoardPaletteManager.h" #include "UBBoardPaletteManager.h"
#include "core/memcheck.h" #include "core/memcheck.h"
//#include <typeinfo>
UBBoardController::UBBoardController(UBMainWindow* mainWindow) UBBoardController::UBBoardController(UBMainWindow* mainWindow)
: QObject(mainWindow->centralWidget()) : QObject(mainWindow->centralWidget())
...@@ -776,6 +777,12 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString ...@@ -776,6 +777,12 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
{ {
QString mimeType = pContentTypeHeader; QString mimeType = pContentTypeHeader;
// In some cases "image/jpeg;charset=" is retourned by the drag-n-drop. That is
// why we will check if an ; exists and take the first part (the standard allows this kind of mimetype)
int position=mimeType.indexOf(";");
if(position != -1)
mimeType=mimeType.left(position);
if (!pSuccess) if (!pSuccess)
{ {
UBApplication::showMessage(tr("Downloading content %1 failed").arg(sourceUrl.toString())); UBApplication::showMessage(tr("Downloading content %1 failed").arg(sourceUrl.toString()));
...@@ -1132,7 +1139,7 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, ...@@ -1132,7 +1139,7 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
if(sceneChange) if(sceneChange)
emit activeSceneWillChange(); emit activeSceneWillChange();
UBApplication::undoStack->clear(); ClearUndoStack();
mActiveScene = targetScene; mActiveScene = targetScene;
mActiveDocument = pDocumentProxy; mActiveDocument = pDocumentProxy;
...@@ -1173,6 +1180,57 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, ...@@ -1173,6 +1180,57 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
} }
} }
void UBBoardController::ClearUndoStack()
{
QSet<QGraphicsItem*> uniqueItems;
// go through all stack command
int count = UBApplication::undoStack->count();
for(int i = 0; i < UBApplication::undoStack->count(); i++)
{
UBAbstractUndoCommand *abstractCmd = (UBAbstractUndoCommand*)UBApplication::undoStack->command(i);
if(abstractCmd->getType() != UBAbstractUndoCommand::undotype_GRAPHICITEM)
continue;
UBGraphicsItemUndoCommand *cmd = (UBGraphicsItemUndoCommand*)UBApplication::undoStack->command(i);
// go through all added and removed objects, for create list of unique objects
QSetIterator<QGraphicsItem*> itAdded(cmd->GetAddedList());
while (itAdded.hasNext())
{
QGraphicsItem* item = itAdded.next();
if( !uniqueItems.contains(item) )
uniqueItems.insert(item);
}
QSetIterator<QGraphicsItem*> itRemoved(cmd->GetRemovedList());
while (itRemoved.hasNext())
{
QGraphicsItem* item = itRemoved.next();
if( !uniqueItems.contains(item) )
uniqueItems.insert(item);
}
}
// clear stack, and command list
UBApplication::undoStack->clear();
count = UBApplication::undoStack->count();
// go through all unique items, and check, ot on scene, or not.
// if not on scene, than item can be deleted
QSetIterator<QGraphicsItem*> itUniq(uniqueItems);
while (itUniq.hasNext())
{
QGraphicsItem* item = itUniq.next();
UBGraphicsScene *scene = (UBGraphicsScene*)item->scene();
if(!scene)
{
bool retCode = mActiveScene->deleteItem(item);
}
}
}
void UBBoardController::adjustDisplayViews() void UBBoardController::adjustDisplayViews()
{ {
...@@ -1842,7 +1900,8 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint ...@@ -1842,7 +1900,8 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
if (gi) if (gi)
{ {
gi->setZValue(mActiveScene->getNextObjectZIndex()); // gi->setZValue(mActiveScene->getNextObjectZIndex());
UBGraphicsItem::assignZValue(gi, mActiveScene->getNextObjectZIndex());
mActiveScene->addItem(gi); mActiveScene->addItem(gi);
gi->setPos(gi->pos() + QPointF(50, 50)); gi->setPos(gi->pos() + QPointF(50, 50));
} }
......
...@@ -150,6 +150,9 @@ class UBBoardController : public QObject ...@@ -150,6 +150,9 @@ class UBBoardController : public QObject
void notifyPageChanged(); void notifyPageChanged();
void displayMetaData(QMap<QString, QString> metadatas); void displayMetaData(QMap<QString, QString> metadatas);
void ClearUndoStack();
public slots: public slots:
void setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, int pSceneIndex = 0); void setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, int pSceneIndex = 0);
void showDocumentsDialog(); void showDocumentsDialog();
......
...@@ -78,6 +78,7 @@ struct UBGraphicsItemData ...@@ -78,6 +78,7 @@ struct UBGraphicsItemData
ItemLayerType ItemLayerType
, ItemLocked , ItemLocked
, ItemEditable//for text only , ItemEditable//for text only
, ItemOwnZValue
}; };
}; };
......
...@@ -460,6 +460,7 @@ void UBApplicationController::showTutorial() ...@@ -460,6 +460,7 @@ void UBApplicationController::showTutorial()
UBApplication::boardController->hide(); UBApplication::boardController->hide();
} }
// it's needed not to duplicate webbrowser search in web mode. If I've breaked smbd's code let Ivan know
UBApplication::webController->show(UBWebController::Tutorial); UBApplication::webController->show(UBWebController::Tutorial);
mMainWindow->webToolBar->hide(); mMainWindow->webToolBar->hide();
...@@ -488,6 +489,7 @@ void UBApplicationController::showSankoreEditor() ...@@ -488,6 +489,7 @@ void UBApplicationController::showSankoreEditor()
UBApplication::boardController->hide(); UBApplication::boardController->hide();
} }
// it's needed not to duplicate webbrowser search in web mode. If I've breaked smbd's code let Ivan know
UBApplication::webController->show(UBWebController::Paraschool); UBApplication::webController->show(UBWebController::Paraschool);
mMainWindow->webToolBar->hide(); mMainWindow->webToolBar->hide();
......
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBAbstractUndoCommand.h"
UBAbstractUndoCommand::UBAbstractUndoCommand()
{
// NOOP
}
UBAbstractUndoCommand::~UBAbstractUndoCommand()
{
// NOOP
}
void UBAbstractUndoCommand::undo()
{
// NOOP
}
void UBAbstractUndoCommand::redo()
{
// NOOP
}
//void UBAbstractUndoCommand::UndoType getType(UndoType type);
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBABSTRACTUNDOCOMMAND_H_
#define UBABSTRACTUNDOCOMMAND_H_
#include <QtGui>
class UBAbstractUndoCommand : public QUndoCommand
{
public:
UBAbstractUndoCommand();
~UBAbstractUndoCommand();
enum UndoType
{
undotype_UNKNOWN = 0,
undotype_DOCUMENT = 1,
undotype_GRAPHICITEMTRANSFORM = 2,
undotype_GRAPHICITEM = 3,
undotype_GRAPHICTEXTITEM = 4,
undotype_PAGESIZE = 5
};
virtual UndoType getType() { return undotype_UNKNOWN; }
protected:
virtual void undo();
virtual void redo();
};
#endif /* UBABSTRACTUNDOCOMMAND_H_ */
...@@ -17,18 +17,20 @@ ...@@ -17,18 +17,20 @@
#define UBDOCUMENTUNDOCOMMAND_H_ #define UBDOCUMENTUNDOCOMMAND_H_
#include <QtGui> #include <QtGui>
#include "UBAbstractUndoCommand.h"
class UBDocumentProxy; class UBDocumentProxy;
class UBGraphicsScene; class UBGraphicsScene;
class UBDocumentUndoCommand: public UBAbstractUndoCommand
class UBDocumentUndoCommand: public QUndoCommand
{ {
public: public:
UBDocumentUndoCommand(UBDocumentProxy* pDocument, const QList<UBGraphicsScene*>& pOldScenes, UBDocumentUndoCommand(UBDocumentProxy* pDocument, const QList<UBGraphicsScene*>& pOldScenes,
const QList<UBGraphicsScene*>& pNewScenes, const int& pActiveSceneIndex); const QList<UBGraphicsScene*>& pNewScenes, const int& pActiveSceneIndex);
virtual ~UBDocumentUndoCommand(); virtual ~UBDocumentUndoCommand();
virtual UndoType getType() { return undotype_DOCUMENT; };
protected: protected:
virtual void undo(); virtual void undo();
......
...@@ -95,7 +95,8 @@ UBItem* UBGraphicsAudioItem::deepCopy() const ...@@ -95,7 +95,8 @@ UBItem* UBGraphicsAudioItem::deepCopy() const
UBGraphicsAudioItem *copy = new UBGraphicsAudioItem(audioUrl, parentItem()); UBGraphicsAudioItem *copy = new UBGraphicsAudioItem(audioUrl, parentItem());
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setZValue(this->zValue()); // copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -531,6 +531,9 @@ void UBGraphicsDelegateFrame::positionHandles() ...@@ -531,6 +531,9 @@ void UBGraphicsDelegateFrame::positionHandles()
{ {
setBrush(QBrush(UBSettings::paletteColor)); setBrush(QBrush(UBSettings::paletteColor));
} }
//make frame interact like delegated item when selected. Maybe should be deleted if selection logic will change
setZValue(delegated()->zValue());
} }
......
...@@ -72,7 +72,8 @@ void UBGraphicsItemDelegate::init() ...@@ -72,7 +72,8 @@ void UBGraphicsItemDelegate::init()
{ {
mFrame = new UBGraphicsDelegateFrame(this, QRectF(0, 0, 0, 0), mFrameWidth, mRespectRatio); mFrame = new UBGraphicsDelegateFrame(this, QRectF(0, 0, 0, 0), mFrameWidth, mRespectRatio);
mFrame->hide(); mFrame->hide();
mFrame->setZValue(UBGraphicsScene::toolLayerStart + 1); // mFrame->setZValue(UBGraphicsScene::toolLayerStart + 1);
UBGraphicsItem::assignZValue(mFrame, UBGraphicsScene::toolLayerStart + 1);
mFrame->setFlag(QGraphicsItem::ItemIsSelectable, true); mFrame->setFlag(QGraphicsItem::ItemIsSelectable, true);
mDeleteButton = new DelegateButton(":/images/close.svg", mDelegated, mFrame); mDeleteButton = new DelegateButton(":/images/close.svg", mDelegated, mFrame);
...@@ -92,7 +93,8 @@ void UBGraphicsItemDelegate::init() ...@@ -92,7 +93,8 @@ void UBGraphicsItemDelegate::init()
foreach(DelegateButton* button, mButtons) foreach(DelegateButton* button, mButtons)
{ {
button->hide(); button->hide();
button->setZValue(UBGraphicsScene::toolLayerStart + 2); // button->setZValue(UBGraphicsScene::toolLayerStart + 2);
UBGraphicsItem::assignZValue(button, UBGraphicsScene::toolLayerStart + 2);
button->setFlag(QGraphicsItem::ItemIsSelectable, true); button->setFlag(QGraphicsItem::ItemIsSelectable, true);
} }
} }
...@@ -282,8 +284,8 @@ void UBGraphicsItemDelegate::positionHandles() ...@@ -282,8 +284,8 @@ void UBGraphicsItemDelegate::positionHandles()
void UBGraphicsItemDelegate::remove(bool canUndo) void UBGraphicsItemDelegate::remove(bool canUndo)
{ {
QGraphicsScene* scene = mDelegated->scene(); // QGraphicsScene* scene = mDelegated->scene();
UBGraphicsScene* scene = (UBGraphicsScene*)(mDelegated->scene());
if (scene) if (scene)
{ {
foreach(DelegateButton* button, mButtons) foreach(DelegateButton* button, mButtons)
...@@ -321,12 +323,10 @@ void UBGraphicsItemDelegate::lock(bool locked) ...@@ -321,12 +323,10 @@ void UBGraphicsItemDelegate::lock(bool locked)
if (locked) if (locked)
{ {
mDelegated->setData(UBGraphicsItemData::ItemLocked, QVariant(true)); mDelegated->setData(UBGraphicsItemData::ItemLocked, QVariant(true));
qDebug() << "item's data is called for locked" << mDelegated->data(UBGraphicsItemData::ItemLocked);
} }
else else
{ {
mDelegated->setData(UBGraphicsItemData::ItemLocked, QVariant(false)); mDelegated->setData(UBGraphicsItemData::ItemLocked, QVariant(false));
qDebug() << "item's data is called for unlocked" << mDelegated->data(UBGraphicsItemData::ItemLocked);
} }
mDelegated->update(); mDelegated->update();
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "UBGraphicsItemTransformUndoCommand.h" #include "UBGraphicsItemTransformUndoCommand.h"
#include "UBResizableGraphicsItem.h" #include "UBResizableGraphicsItem.h"
#include "domain/UBItem.h"
#include "core/memcheck.h" #include "core/memcheck.h"
...@@ -49,6 +50,7 @@ void UBGraphicsItemTransformUndoCommand::undo() ...@@ -49,6 +50,7 @@ void UBGraphicsItemTransformUndoCommand::undo()
mItem->setPos(mPreviousPosition); mItem->setPos(mPreviousPosition);
mItem->setTransform(mPreviousTransform); mItem->setTransform(mPreviousTransform);
mItem->setZValue(mPreviousZValue); mItem->setZValue(mPreviousZValue);
// UBGraphicsItem::assignZValue(mItem, mPreviousZValue);
UBResizableGraphicsItem* resizableItem = dynamic_cast<UBResizableGraphicsItem*>(mItem); UBResizableGraphicsItem* resizableItem = dynamic_cast<UBResizableGraphicsItem*>(mItem);
...@@ -62,6 +64,8 @@ void UBGraphicsItemTransformUndoCommand::redo() ...@@ -62,6 +64,8 @@ void UBGraphicsItemTransformUndoCommand::redo()
mItem->setTransform(mCurrentTransform); mItem->setTransform(mCurrentTransform);
mItem->setZValue(mCurrentZValue); mItem->setZValue(mCurrentZValue);
// UBGraphicsItem::assignZValue(mItem, /*mCurrentZValue*/mItem->data(UBGraphicsItemData::ItemOwnZValue).toReal());
UBResizableGraphicsItem* resizableItem = dynamic_cast<UBResizableGraphicsItem*>(mItem); UBResizableGraphicsItem* resizableItem = dynamic_cast<UBResizableGraphicsItem*>(mItem);
if (resizableItem) if (resizableItem)
......
...@@ -19,9 +19,10 @@ ...@@ -19,9 +19,10 @@
#include <QtGui> #include <QtGui>
#include "UBResizableGraphicsItem.h" #include "UBResizableGraphicsItem.h"
#include "UBAbstractUndoCommand.h"
class UBGraphicsItemTransformUndoCommand : public QUndoCommand class UBGraphicsItemTransformUndoCommand : public UBAbstractUndoCommand
{ {
public: public:
UBGraphicsItemTransformUndoCommand(QGraphicsItem* pItem, UBGraphicsItemTransformUndoCommand(QGraphicsItem* pItem,
...@@ -31,6 +32,8 @@ class UBGraphicsItemTransformUndoCommand : public QUndoCommand ...@@ -31,6 +32,8 @@ class UBGraphicsItemTransformUndoCommand : public QUndoCommand
const QSizeF& prevSize = QSizeF()); const QSizeF& prevSize = QSizeF());
virtual ~UBGraphicsItemTransformUndoCommand(); virtual ~UBGraphicsItemTransformUndoCommand();
virtual UndoType getType() { return undotype_GRAPHICITEMTRANSFORM; };
protected: protected:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
......
...@@ -17,11 +17,13 @@ ...@@ -17,11 +17,13 @@
#define UBGRAPHICSITEMUNDOCOMMAND_H_ #define UBGRAPHICSITEMUNDOCOMMAND_H_
#include <QtGui> #include <QtGui>
#include "UBAbstractUndoCommand.h"
class UBGraphicsScene; class UBGraphicsScene;
class UBGraphicsItemUndoCommand : public QUndoCommand class UBGraphicsItemUndoCommand : public UBAbstractUndoCommand
{ {
public: public:
UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, const QSet<QGraphicsItem*>& pRemovedItems, UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, const QSet<QGraphicsItem*>& pRemovedItems,
...@@ -32,6 +34,11 @@ class UBGraphicsItemUndoCommand : public QUndoCommand ...@@ -32,6 +34,11 @@ class UBGraphicsItemUndoCommand : public QUndoCommand
virtual ~UBGraphicsItemUndoCommand(); virtual ~UBGraphicsItemUndoCommand();
QSet<QGraphicsItem*> GetAddedList() { return mAddedItems; };
QSet<QGraphicsItem*> GetRemovedList() { return mRemovedItems; };
virtual UndoType getType() { return undotype_GRAPHICITEM; };
protected: protected:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
......
...@@ -84,7 +84,8 @@ UBItem* UBGraphicsPDFItem::deepCopy() const ...@@ -84,7 +84,8 @@ UBItem* UBGraphicsPDFItem::deepCopy() const
UBGraphicsPDFItem *copy = new UBGraphicsPDFItem(mRenderer, mPageNumber, parentItem()); UBGraphicsPDFItem *copy = new UBGraphicsPDFItem(mRenderer, mPageNumber, parentItem());
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setZValue(this->zValue()); // copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
...@@ -134,7 +135,8 @@ UBGraphicsPixmapItem* UBGraphicsPDFItem::toPixmapItem() const ...@@ -134,7 +135,8 @@ UBGraphicsPixmapItem* UBGraphicsPDFItem::toPixmapItem() const
pixmapItem->setPixmap(pixmap); pixmapItem->setPixmap(pixmap);
pixmapItem->setPos(this->pos()); pixmapItem->setPos(this->pos());
pixmapItem->setZValue(this->zValue()); // pixmapItem->setZValue(this->zValue());
UBGraphicsItem::assignZValue(pixmapItem, this->zValue());
pixmapItem->setTransform(this->transform()); pixmapItem->setTransform(this->transform());
pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true);
pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -98,7 +98,8 @@ UBItem* UBGraphicsPixmapItem::deepCopy() const ...@@ -98,7 +98,8 @@ UBItem* UBGraphicsPixmapItem::deepCopy() const
copy->setPixmap(this->pixmap()); copy->setPixmap(this->pixmap());
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setZValue(this->zValue()); // copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -153,7 +153,9 @@ UBGraphicsPolygonItem* UBGraphicsPolygonItem::deepCopy(const QPolygonF& pol) con ...@@ -153,7 +153,9 @@ UBGraphicsPolygonItem* UBGraphicsPolygonItem::deepCopy(const QPolygonF& pol) con
copy->setPen(this->pen()); copy->setPen(this->pen());
copy->mHasAlpha = this->mHasAlpha; copy->mHasAlpha = this->mHasAlpha;
copy->setZValue(this->zValue()); // copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setColorOnDarkBackground(this->colorOnDarkBackground()); copy->setColorOnDarkBackground(this->colorOnDarkBackground());
copy->setColorOnLightBackground(this->colorOnLightBackground()); copy->setColorOnLightBackground(this->colorOnLightBackground());
......
This diff is collapsed.
...@@ -55,6 +55,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -55,6 +55,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
Q_OBJECT Q_OBJECT
public: public:
// tmp stub for divide addings scene objects from undo mechanism implementation
void setURStackEnable(bool set = true) {enableUndoRedoStack = set;}
UBGraphicsScene(UBDocumentProxy *parent); UBGraphicsScene(UBDocumentProxy *parent);
virtual ~UBGraphicsScene(); virtual ~UBGraphicsScene();
...@@ -363,8 +365,13 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -363,8 +365,13 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
//int mMesure1Ms, mMesure2Ms; //int mMesure1Ms, mMesure2Ms;
bool mHasCache; bool mHasCache;
// tmp stub for divide addings scene objects from undo mechanism implementation
bool enableUndoRedoStack;
UBMagnifier *magniferControlViewWidget; UBMagnifier *magniferControlViewWidget;
UBMagnifier *magniferDisplayViewWidget; UBMagnifier *magniferDisplayViewWidget;
}; };
#endif /* UBGRAPHICSSCENE_H_ */ #endif /* UBGRAPHICSSCENE_H_ */
...@@ -132,7 +132,8 @@ UBItem* UBGraphicsSvgItem::deepCopy() const ...@@ -132,7 +132,8 @@ UBItem* UBGraphicsSvgItem::deepCopy() const
UBGraphicsSvgItem* copy = new UBGraphicsSvgItem(this->fileData()); UBGraphicsSvgItem* copy = new UBGraphicsSvgItem(this->fileData());
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setZValue(this->zValue()); // copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
...@@ -186,7 +187,8 @@ UBGraphicsPixmapItem* UBGraphicsSvgItem::toPixmapItem() const ...@@ -186,7 +187,8 @@ UBGraphicsPixmapItem* UBGraphicsSvgItem::toPixmapItem() const
pixmapItem->setPixmap(QPixmap::fromImage(image)); pixmapItem->setPixmap(QPixmap::fromImage(image));
pixmapItem->setPos(this->pos()); pixmapItem->setPos(this->pos());
pixmapItem->setZValue(this->zValue()); // pixmapItem->setZValue(this->zValue());
UBGraphicsItem::assignZValue(pixmapItem, this->zValue());
pixmapItem->setTransform(this->transform()); pixmapItem->setTransform(this->transform());
pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true);
pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -205,7 +205,8 @@ UBItem* UBGraphicsTextItem::deepCopy() const ...@@ -205,7 +205,8 @@ UBItem* UBGraphicsTextItem::deepCopy() const
copy->setHtml(toHtml()); copy->setHtml(toHtml());
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setZValue(this->zValue()); // copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -17,16 +17,19 @@ ...@@ -17,16 +17,19 @@
#define UBGRAPHICSTEXTITEMUNDOCOMMAND_H_ #define UBGRAPHICSTEXTITEMUNDOCOMMAND_H_
#include <QtGui> #include <QtGui>
#include "UBAbstractUndoCommand.h"
#include "UBGraphicsTextItem.h" #include "UBGraphicsTextItem.h"
class UBGraphicsTextItemUndoCommand: public QUndoCommand class UBGraphicsTextItemUndoCommand : public UBAbstractUndoCommand
{ {
public: public:
UBGraphicsTextItemUndoCommand(UBGraphicsTextItem *textItem); UBGraphicsTextItemUndoCommand(UBGraphicsTextItem *textItem);
virtual ~UBGraphicsTextItemUndoCommand(); virtual ~UBGraphicsTextItemUndoCommand();
virtual UndoType getType() { return undotype_GRAPHICTEXTITEM; };
protected: protected:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
......
...@@ -68,7 +68,8 @@ UBItem* UBGraphicsVideoItem::deepCopy() const ...@@ -68,7 +68,8 @@ UBItem* UBGraphicsVideoItem::deepCopy() const
UBGraphicsVideoItem *copy = new UBGraphicsVideoItem(videoUrl, parentItem()); UBGraphicsVideoItem *copy = new UBGraphicsVideoItem(videoUrl, parentItem());
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setZValue(this->zValue()); // copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -52,7 +52,8 @@ void UBGraphicsVideoItemDelegate::buildButtons() ...@@ -52,7 +52,8 @@ void UBGraphicsVideoItemDelegate::buildButtons()
mMuteButton->hide(); mMuteButton->hide();
mVideoControl = new DelegateVideoControl(delegated(), mFrame); mVideoControl = new DelegateVideoControl(delegated(), mFrame);
mVideoControl->setZValue(UBGraphicsScene::toolLayerStart + 2); // mVideoControl->setZValue(UBGraphicsScene::toolLayerStart + 2);
UBGraphicsItem::assignZValue(mVideoControl, UBGraphicsScene::toolLayerStart + 2);
mVideoControl->setFlag(QGraphicsItem::ItemIsSelectable, true); mVideoControl->setFlag(QGraphicsItem::ItemIsSelectable, true);
connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause())); connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause()));
......
...@@ -366,7 +366,8 @@ UBItem* UBGraphicsW3CWidgetItem::deepCopy() const ...@@ -366,7 +366,8 @@ UBItem* UBGraphicsW3CWidgetItem::deepCopy() const
UBGraphicsW3CWidgetItem *copy = new UBGraphicsW3CWidgetItem(mWebKitWidget->widgetUrl(), parentItem()); UBGraphicsW3CWidgetItem *copy = new UBGraphicsW3CWidgetItem(mWebKitWidget->widgetUrl(), parentItem());
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setZValue(this->zValue()); // copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -28,3 +28,9 @@ UBItem::~UBItem() ...@@ -28,3 +28,9 @@ UBItem::~UBItem()
{ {
// NOOP // NOOP
} }
void UBGraphicsItem::assignZValue(QGraphicsItem *item, int value)
{
item->setZValue(value);
item->setData(UBGraphicsItemData::ItemOwnZValue, value);
}
...@@ -100,6 +100,7 @@ protected: ...@@ -100,6 +100,7 @@ protected:
public: public:
static void assignZValue(QGraphicsItem*, int value);
virtual UBGraphicsItemDelegate *Delegate() const = 0; virtual UBGraphicsItemDelegate *Delegate() const = 0;
virtual void remove() = 0; virtual void remove() = 0;
......
...@@ -17,16 +17,19 @@ ...@@ -17,16 +17,19 @@
#define UBPageSizeUndoCommand_H_ #define UBPageSizeUndoCommand_H_
#include <QtGui> #include <QtGui>
#include "UBAbstractUndoCommand.h"
class UBGraphicsScene; class UBGraphicsScene;
class UBPageSizeUndoCommand : public QUndoCommand class UBPageSizeUndoCommand : public UBAbstractUndoCommand
{ {
public: public:
UBPageSizeUndoCommand(UBGraphicsScene* pScene, const QSize& previousSize, const QSize& newSize); UBPageSizeUndoCommand(UBGraphicsScene* pScene, const QSize& previousSize, const QSize& newSize);
virtual ~UBPageSizeUndoCommand(); virtual ~UBPageSizeUndoCommand();
virtual UndoType getType() { return undotype_PAGESIZE; };
protected: protected:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
......
...@@ -21,7 +21,8 @@ HEADERS += src/domain/UBGraphicsScene.h \ ...@@ -21,7 +21,8 @@ HEADERS += src/domain/UBGraphicsScene.h \
src/domain/UBGraphicsStroke.h \ src/domain/UBGraphicsStroke.h \
src/domain/UBGraphicsMediaItem.h \ src/domain/UBGraphicsMediaItem.h \
src/domain/UBGraphicsAudioItem.h \ src/domain/UBGraphicsAudioItem.h \
src/domain/UBGraphicsAudioItemDelegate.h src/domain/UBGraphicsAudioItemDelegate.h \
src/domain/UBAbstractUndoCommand.h
HEADERS += src/domain/UBGraphicsItemDelegate.h \ HEADERS += src/domain/UBGraphicsItemDelegate.h \
src/domain/UBGraphicsVideoItemDelegate.h \ src/domain/UBGraphicsVideoItemDelegate.h \
...@@ -52,7 +53,8 @@ SOURCES += src/domain/UBGraphicsScene.cpp \ ...@@ -52,7 +53,8 @@ SOURCES += src/domain/UBGraphicsScene.cpp \
src/domain/UBGraphicsStroke.cpp \ src/domain/UBGraphicsStroke.cpp \
src/domain/UBGraphicsMediaItem.cpp \ src/domain/UBGraphicsMediaItem.cpp \
src/domain/UBGraphicsAudioItem.cpp \ src/domain/UBGraphicsAudioItem.cpp \
src/domain/UBGraphicsAudioItemDelegate.cpp src/domain/UBGraphicsAudioItemDelegate.cpp \
src/domain/UBAbstractUndoCommand.cpp
SOURCES += src/domain/UBGraphicsItemDelegate.cpp \ SOURCES += src/domain/UBGraphicsItemDelegate.cpp \
src/domain/UBGraphicsVideoItemDelegate.cpp \ src/domain/UBGraphicsVideoItemDelegate.cpp \
......
...@@ -53,3 +53,16 @@ void UBCoreGraphicsScene::removeItem(QGraphicsItem* item, bool forceDelete) ...@@ -53,3 +53,16 @@ void UBCoreGraphicsScene::removeItem(QGraphicsItem* item, bool forceDelete)
delete item; delete item;
} }
} }
bool UBCoreGraphicsScene::deleteItem(QGraphicsItem* item)
{
if(mItemsToDelete.contains(item))
{
mItemsToDelete.remove(item);
delete item;
return true;
}
else
return false;
}
...@@ -28,6 +28,9 @@ class UBCoreGraphicsScene : public QGraphicsScene ...@@ -28,6 +28,9 @@ class UBCoreGraphicsScene : public QGraphicsScene
virtual void removeItem(QGraphicsItem* item, bool forceDelete = false); virtual void removeItem(QGraphicsItem* item, bool forceDelete = false);
virtual bool deleteItem(QGraphicsItem* item);
private: private:
QSet<QGraphicsItem*> mItemsToDelete; QSet<QGraphicsItem*> mItemsToDelete;
}; };
......
...@@ -159,6 +159,7 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage) ...@@ -159,6 +159,7 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage)
mScene->removeItem(pItem); mScene->removeItem(pItem);
mScene->addItem(pixmapItem); mScene->addItem(pixmapItem);
mThumbnails.replace(iPage, pixmapItem); mThumbnails.replace(iPage, pixmapItem);
delete pItem;
} }
} }
} }
......
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#include "core/UBDocumentManager.h" #include "core/UBDocumentManager.h"
#include "document/UBDocumentController.h" #include "document/UBDocumentController.h"
#include "adaptors/UBThumbnailAdaptor.h"
#include "adaptors/UBSvgSubsetAdaptor.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h" #include "core/memcheck.h"
UBDocumentTreeWidget::UBDocumentTreeWidget(QWidget * parent) UBDocumentTreeWidget::UBDocumentTreeWidget(QWidget * parent)
...@@ -290,6 +294,13 @@ void UBDocumentTreeWidget::dropEvent(QDropEvent *event) ...@@ -290,6 +294,13 @@ void UBDocumentTreeWidget::dropEvent(QDropEvent *event)
} }
UBPersistenceManager::persistenceManager()->insertDocumentSceneAt(targetDocProxy, sceneClone, targetDocProxy->pageCount()); UBPersistenceManager::persistenceManager()->insertDocumentSceneAt(targetDocProxy, sceneClone, targetDocProxy->pageCount());
//due to incorrect generation of thumbnails of invisible scene I've used direct copying of thumbnail files
//it's not universal and good way but it's faster
QString from = sourceItem.documentProxy()->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", sourceItem.sceneIndex() + 1);
QString to = targetDocProxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", targetDocProxy->pageCount());
QFile::remove(to);
QFile::copy(from, to);
} }
} }
......
...@@ -23,7 +23,7 @@ class UBDocumentProxyTreeItem; ...@@ -23,7 +23,7 @@ class UBDocumentProxyTreeItem;
class UBDocumentTreeWidget : public QTreeWidget class UBDocumentTreeWidget : public QTreeWidget
{ {
Q_OBJECT; Q_OBJECT
public: public:
UBDocumentTreeWidget(QWidget *parent = 0); UBDocumentTreeWidget(QWidget *parent = 0);
......
...@@ -62,6 +62,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock ...@@ -62,6 +62,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
mpTitleLabel->setAlignment(Qt::AlignRight); mpTitleLabel->setAlignment(Qt::AlignRight);
mpTitle = new QLineEdit(mpContainer); mpTitle = new QLineEdit(mpContainer);
mpTitle->setObjectName("DockPaletteWidgetLineEdit"); mpTitle->setObjectName("DockPaletteWidgetLineEdit");
connect(mpTitle, SIGNAL(textChanged(const QString&)), this, SLOT(onTitleTextChanged(const QString&)));
mpTitleLayout = new QHBoxLayout(); mpTitleLayout = new QHBoxLayout();
mpTitleLayout->addWidget(mpTitleLabel, 0); mpTitleLayout->addWidget(mpTitleLabel, 0);
mpTitleLayout->addWidget(mpTitle, 1); mpTitleLayout->addWidget(mpTitle, 1);
...@@ -95,6 +96,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock ...@@ -95,6 +96,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
mpEquipmentLabel->setAlignment(Qt::AlignRight); mpEquipmentLabel->setAlignment(Qt::AlignRight);
mpEquipment = new QLineEdit(mpContainer); mpEquipment = new QLineEdit(mpContainer);
mpEquipment->setObjectName("DockPaletteWidgetLineEdit"); mpEquipment->setObjectName("DockPaletteWidgetLineEdit");
connect(mpEquipment, SIGNAL(textChanged(const QString&)), this, SLOT(onEquipmentTextChanged(const QString&)));
mpEquipmentLayout = new QHBoxLayout(); mpEquipmentLayout = new QHBoxLayout();
mpEquipmentLayout->addWidget(mpEquipmentLabel, 0); mpEquipmentLayout->addWidget(mpEquipmentLabel, 0);
mpEquipmentLayout->addWidget(mpEquipment, 1); mpEquipmentLayout->addWidget(mpEquipment, 1);
...@@ -319,6 +321,16 @@ void UBTeacherBarWidget::loadContent() ...@@ -319,6 +321,16 @@ void UBTeacherBarWidget::loadContent()
mpAction3->setStudentText(nextInfos.action3Student); mpAction3->setStudentText(nextInfos.action3Student);
} }
void UBTeacherBarWidget::onTitleTextChanged(const QString& text)
{
mpTitle->setToolTip(text);
}
void UBTeacherBarWidget::onEquipmentTextChanged(const QString& text)
{
mpEquipment->setToolTip(text);
}
UBTeacherStudentAction::UBTeacherStudentAction(int actionNumber, QWidget *parent, const char *name):QWidget(parent) UBTeacherStudentAction::UBTeacherStudentAction(int actionNumber, QWidget *parent, const char *name):QWidget(parent)
, mpActionLabel(NULL) , mpActionLabel(NULL)
, mpTeacherLabel(NULL) , mpTeacherLabel(NULL)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment