Merge branch 'OEFUniboard' of github.com:stayonshadow/PrivateBoard into OEFUniboard

preferencesAboutTextFull
Didier Clerc 12 years ago
commit c39ba64fa6
  1. 24
      src/adaptors/UBImportAdaptor.cpp
  2. 23
      src/board/UBBoardController.cpp
  3. 2
      src/board/UBBoardController.h
  4. 9
      src/core/UB.h
  5. 75
      src/core/UBPersistenceManager.cpp
  6. 2
      src/core/UBPersistenceManager.h
  7. 7
      src/domain/UBGraphicsItemGroupUndoCommand.cpp
  8. 6
      src/domain/UBGraphicsItemGroupUndoCommand.h
  9. 2
      src/domain/UBGraphicsItemTransformUndoCommand.cpp
  10. 6
      src/domain/UBGraphicsItemTransformUndoCommand.h
  11. 10
      src/domain/UBGraphicsItemUndoCommand.cpp
  12. 6
      src/domain/UBGraphicsItemUndoCommand.h
  13. 2
      src/domain/UBGraphicsMediaItem.h
  14. 15
      src/domain/UBGraphicsPixmapItem.cpp
  15. 2
      src/domain/UBGraphicsPixmapItem.h
  16. 9
      src/domain/UBGraphicsProxyWidget.cpp
  17. 1
      src/domain/UBGraphicsProxyWidget.h
  18. 36
      src/domain/UBGraphicsScene.cpp
  19. 15
      src/domain/UBGraphicsSvgItem.cpp
  20. 4
      src/domain/UBGraphicsSvgItem.h
  21. 6
      src/domain/UBGraphicsTextItemUndoCommand.h
  22. 4
      src/domain/UBGraphicsWidgetItem.cpp
  23. 3
      src/domain/UBGraphicsWidgetItem.h
  24. 6
      src/domain/UBPageSizeUndoCommand.h
  25. 19
      src/domain/UBUndoCommand.cpp
  26. 26
      src/domain/UBUndoCommand.h
  27. 8
      src/domain/domain.pri
  28. 53
      src/gui/UBStylusPalette.cpp

@ -53,27 +53,3 @@ UBDocumentBasedImportAdaptor::UBDocumentBasedImportAdaptor(QObject *parent)
{
// NOOP
}
/*
UBDocumentProxy* UBImportAdaptor::importFile(const QFile& pFile, const QString& pGroup)
{
QString documentName = QFileInfo(pFile.fileName()).completeBaseName();
UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocument(pGroup, documentName);
bool result = addFileToDocument(newDocument, pFile);
if (result)
{
UBPersistenceManager::persistenceManager()->persistDocumentMetadata(newDocument);
}
else
{
UBPersistenceManager::persistenceManager()->deleteDocument(newDocument);
newDocument = 0;
}
return newDocument;
}
*/

@ -51,7 +51,6 @@
#include "domain/UBGraphicsPixmapItem.h"
#include "domain/UBGraphicsItemUndoCommand.h"
#include "domain/UBGraphicsProxyWidget.h"
#include "domain/UBGraphicsSvgItem.h"
#include "domain/UBGraphicsWidgetItem.h"
#include "domain/UBGraphicsMediaItem.h"
@ -1319,6 +1318,7 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QUrl
Q_UNUSED(internalData)
QString widgetUrl = UBGraphicsW3CWidgetItem::createNPAPIWrapper(sUrl, mimeType, size);
UBFileSystemUtils::deleteFile(sourceUrl.toLocalFile());
emit npapiWidgetCreated(widgetUrl);
if (widgetUrl.length() > 0)
@ -1326,6 +1326,13 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QUrl
UBGraphicsWidgetItem *widgetItem = mActiveScene->addW3CWidget(QUrl::fromLocalFile(widgetUrl), pPos);
widgetItem->setUuid(QUuid::createUuid());
widgetItem->setSourceUrl(QUrl::fromLocalFile(widgetUrl));
qDebug() << widgetItem->getOwnFolder();
qDebug() << widgetItem->getSnapshotPath();
QString ownFolder = selectedDocument()->persistencePath() + "/" + UBPersistenceManager::widgetDirectory + "/" + widgetItem->uuid().toString() + ".wgt";
widgetItem->setOwnFolder(ownFolder);
QString adaptedUUid = widgetItem->uuid().toString().replace("{","").replace("}","");
ownFolder = ownFolder.replace(widgetItem->uuid().toString() + ".wgt", adaptedUUid + ".png");
widgetItem->setSnapshotPath(ownFolder);
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector);
@ -1551,11 +1558,11 @@ void UBBoardController::moveSceneToIndex(int source, int target)
}
}
void UBBoardController::fitUniqIems(const QUndoCommand *parent, QSet<QGraphicsItem*> &itms)
void UBBoardController::findUniquesItems(const QUndoCommand *parent, QSet<QGraphicsItem*> &itms)
{
if (parent->childCount()) {
for (int i = 0; i < parent->childCount(); i++) {
fitUniqIems(parent->child(i), itms);
findUniquesItems(parent->child(i), itms);
}
}
@ -1564,11 +1571,11 @@ void UBBoardController::fitUniqIems(const QUndoCommand *parent, QSet<QGraphicsIt
return;
}
const UBAbstractUndoCommand *abstractCmd = static_cast<const UBAbstractUndoCommand*>(parent);
if(abstractCmd->getType() != UBAbstractUndoCommand::undotype_GRAPHICITEM)
const UBUndoCommand *undoCmd = static_cast<const UBUndoCommand*>(parent);
if(undoCmd->getType() != UBUndoType::undotype_GRAPHICITEM)
return;
const UBGraphicsItemUndoCommand *cmd = static_cast<const UBGraphicsItemUndoCommand*>(parent);
const UBGraphicsItemUndoCommand *cmd = dynamic_cast<const UBGraphicsItemUndoCommand*>(parent);
// go through all added and removed objects, for create list of unique objects
// grouped items will be deleted by groups, so we don't need do delete that items.
@ -1594,7 +1601,7 @@ void UBBoardController::ClearUndoStack()
QSet<QGraphicsItem*> uniqueItems;
// go through all stack command
for (int i = 0; i < UBApplication::undoStack->count(); i++) {
fitUniqIems(UBApplication::undoStack->command(i), uniqueItems);
findUniquesItems(UBApplication::undoStack->command(i), uniqueItems);
}
// go through all unique items, and check, if they are on scene, or not.
@ -2124,7 +2131,7 @@ UBGraphicsWidgetItem *UBBoardController::addW3cWidget(const QUrl &pUrl, const QP
QUuid uuid = QUuid::createUuid();
QString destPath;
if (!UBPersistenceManager::persistenceManager()->addGraphicsWidgteToDocument(selectedDocument(), pUrl.toLocalFile(), uuid, destPath))
if (!UBPersistenceManager::persistenceManager()->addGraphicsWidgetToDocument(selectedDocument(), pUrl.toLocalFile(), uuid, destPath))
return NULL;
QUrl newUrl = QUrl::fromLocalFile(destPath);

@ -160,7 +160,7 @@ class UBBoardController : public UBDocumentContainer
void notifyPageChanged();
void displayMetaData(QMap<QString, QString> metadatas);
void fitUniqIems(const QUndoCommand *parent, QSet<QGraphicsItem *> &itms);
void findUniquesItems(const QUndoCommand *parent, QSet<QGraphicsItem *> &itms);
void ClearUndoStack();
void setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, int pSceneIndex = 0, bool forceReload = false);

@ -195,4 +195,13 @@ struct DocumentSizeRatio
};
};
struct UBUndoType
{
enum Enum
{
undotype_UNKNOWN = 0, undotype_DOCUMENT, undotype_GRAPHICITEMTRANSFORM, undotype_GRAPHICITEM, undotype_GRAPHICTEXTITEM, undotype_PAGESIZE, undotype_GRAPHICSGROUPITEM
};
};
#endif /* UB_H_ */

@ -40,6 +40,11 @@
#include "adaptors/UBThumbnailAdaptor.h"
#include "adaptors/UBMetadataDcSubsetAdaptor.h"
#include "domain/UBGraphicsMediaItem.h"
#include "domain/UBGraphicsWidgetItem.h"
#include "domain/UBGraphicsPixmapItem.h"
#include "domain/UBGraphicsSvgItem.h"
#include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h"
@ -255,7 +260,7 @@ UBDocumentProxy* UBPersistenceManager::createDocument(const QString& pGroupName,
}
doc->setMetaData(UBSettings::documentVersion, UBSettings::currentFileVersion);
QString currentDate = UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime());
QString currentDate = UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime());
doc->setMetaData(UBSettings::documentUpdatedAt,currentDate);
doc->setMetaData(UBSettings::documentDate,currentDate);
@ -396,12 +401,14 @@ void UBPersistenceManager::deleteDocumentScenes(UBDocumentProxy* proxy, const QL
foreach(int index, compactedIndexes)
{
// trig the reload of the thumbnails
emit documentSceneWillBeDeleted(proxy, index);
}
QString sourceGroupName = proxy->metaData(UBSettings::documentGroupName).toString();
QString sourceName = proxy->metaData(UBSettings::documentName).toString();
UBDocumentProxy *trashDocProxy = createDocument(UBSettings::trashedDocumentGroupNamePrefix + sourceGroupName, sourceName, false);
generatePathIfNeeded(trashDocProxy);
foreach(int index, compactedIndexes)
{
@ -418,7 +425,7 @@ void UBPersistenceManager::deleteDocumentScenes(UBDocumentProxy* proxy, const QL
QDir d = fi.dir();
d.mkpath(d.absolutePath());
QFile::copy(source, target);
Q_ASSERT(QFile::rename(source, target));
}
insertDocumentSceneAt(trashDocProxy, scene, trashDocProxy->pageCount());
@ -467,6 +474,8 @@ void UBPersistenceManager::deleteDocumentScenes(UBDocumentProxy* proxy, const QL
}
void UBPersistenceManager::duplicateDocumentScene(UBDocumentProxy* proxy, int index)
{
checkIfDocumentRepositoryExists();
@ -483,6 +492,66 @@ void UBPersistenceManager::duplicateDocumentScene(UBDocumentProxy* proxy, int in
copyPage(proxy, index , index + 1);
//TODO: write a proper way to handle object on disk
UBGraphicsScene *scene = loadDocumentScene(proxy, index + 1);
foreach(QGraphicsItem* item, scene->items())
{
UBGraphicsMediaItem *mediaItem = qgraphicsitem_cast<UBGraphicsMediaItem*> (item);
if (mediaItem){
QString source = mediaItem->mediaFileUrl().toLocalFile();
QString destination = source;
QUuid newUuid = QUuid::createUuid();
QString fileName = QFileInfo(source).completeBaseName();
destination = destination.replace(fileName,newUuid.toString());
Q_ASSERT(QFile::copy(source,destination));
mediaItem->mediaFileUrl(QUrl::fromLocalFile(destination));
continue;
}
UBGraphicsWidgetItem* widget = qgraphicsitem_cast<UBGraphicsWidgetItem*>(item);
if(widget){
QUuid newUUid = QUuid::createUuid();
QString newUUidString = newUUid.toString().remove("{").remove("}");
QString actualUuidString = widget->uuid().toString().remove("{").remove("}");
QString widgetSourcePath = proxy->persistencePath() + "/" + UBPersistenceManager::widgetDirectory + "/{" + actualUuidString + "}.wgt";
QString screenshotSourcePath = proxy->persistencePath() + "/" + UBPersistenceManager::widgetDirectory + "/" + actualUuidString + ".png";
QString widgetDestinationPath = widgetSourcePath;
widgetDestinationPath = widgetDestinationPath.replace(actualUuidString,newUUidString);
QString screenshotDestinationPath = screenshotSourcePath;
screenshotDestinationPath = screenshotDestinationPath.replace(actualUuidString,newUUidString);
Q_ASSERT(UBFileSystemUtils::copyDir(widgetSourcePath,widgetDestinationPath));
Q_ASSERT(QFile::copy(screenshotSourcePath,screenshotDestinationPath));
widget->setUuid(newUUid);
widget->widgetUrl(QUrl::fromLocalFile(widgetDestinationPath));
continue;
}
UBGraphicsPixmapItem* pixmapItem = qgraphicsitem_cast<UBGraphicsPixmapItem*>(item);
if(pixmapItem){
pixmapItem->setUuid(QUuid::createUuid());
continue;
}
UBGraphicsSvgItem* svgItem = qgraphicsitem_cast<UBGraphicsSvgItem*>(item);
if(svgItem){
svgItem->setUuid(QUuid::createUuid());
continue;
}
}
scene->setModified(true);
persistDocumentScene(proxy,scene, index + 1);
proxy->incPageCount();
emit documentSceneCreated(proxy, index + 1);
@ -859,7 +928,7 @@ bool UBPersistenceManager::addFileToDocument(UBDocumentProxy* pDocumentProxy,
}
}
bool UBPersistenceManager::addGraphicsWidgteToDocument(UBDocumentProxy *pDocumentProxy,
bool UBPersistenceManager::addGraphicsWidgetToDocument(UBDocumentProxy *pDocumentProxy,
QString path,
QUuid objectUuid,
QString& destinationPath)

@ -103,7 +103,7 @@ class UBPersistenceManager : public QObject
virtual bool isEmpty(UBDocumentProxy* pDocumentProxy);
virtual void purgeEmptyDocuments();
bool addGraphicsWidgteToDocument(UBDocumentProxy *mDocumentProxy, QString path, QUuid objectUuid, QString& destinationPath);
bool addGraphicsWidgetToDocument(UBDocumentProxy *mDocumentProxy, QString path, QUuid objectUuid, QString& destinationPath);
bool addFileToDocument(UBDocumentProxy* pDocumentProxy, QString path, const QString& subdir, QUuid objectUuid, QString& destinationPath, QByteArray* data = NULL);
signals:

@ -28,9 +28,10 @@
#include "core/memcheck.h"
UBGraphicsItemGroupUndoCommand::UBGraphicsItemGroupUndoCommand(UBGraphicsScene *pScene, UBGraphicsGroupContainerItem *pGroupCreated) :
mScene (pScene), mGroup(pGroupCreated), mFirstRedo(true)
UBGraphicsItemGroupUndoCommand::UBGraphicsItemGroupUndoCommand(UBGraphicsScene *pScene, UBGraphicsGroupContainerItem *pGroupCreated) : UBUndoCommand()
, mScene (pScene)
, mGroup(pGroupCreated)
, mFirstRedo(true)
{
if (pGroupCreated->childItems().count()) {
foreach (QGraphicsItem *item, pGroupCreated->childItems()) {

@ -25,18 +25,18 @@
#define UBGRAPHICSITEMGROUPUNDOCOMMAND_H
#include <QList>
#include "UBAbstractUndoCommand.h"
#include "UBUndoCommand.h"
class UBGraphicsScene;
class UBGraphicsGroupContainerItem;
class UBGraphicsItemGroupUndoCommand : public UBAbstractUndoCommand
class UBGraphicsItemGroupUndoCommand : public UBUndoCommand
{
public:
UBGraphicsItemGroupUndoCommand(UBGraphicsScene *pScene, UBGraphicsGroupContainerItem *pGroupCreated);
virtual ~UBGraphicsItemGroupUndoCommand();
virtual UndoType getType() { return undotype_GRAPHICSGROUPITEM; }
virtual int getType() const { return UBUndoType::undotype_GRAPHICSGROUPITEM; }
protected:
virtual void undo();

@ -29,7 +29,7 @@
UBGraphicsItemTransformUndoCommand::UBGraphicsItemTransformUndoCommand(QGraphicsItem* pItem,
const QPointF& prevPos, const QTransform& prevTransform, const qreal& prevZValue,
const QSizeF& prevSize)
const QSizeF& prevSize):UBUndoCommand()
{
mItem = pItem;
mPreviousTransform = prevTransform;

@ -27,10 +27,10 @@
#include <QtGui>
#include "UBResizableGraphicsItem.h"
#include "UBAbstractUndoCommand.h"
#include "UBUndoCommand.h"
class UBGraphicsItemTransformUndoCommand : public UBAbstractUndoCommand
class UBGraphicsItemTransformUndoCommand : public UBUndoCommand
{
public:
UBGraphicsItemTransformUndoCommand(QGraphicsItem* pItem,
@ -40,7 +40,7 @@ class UBGraphicsItemTransformUndoCommand : public UBAbstractUndoCommand
const QSizeF& prevSize = QSizeF());
virtual ~UBGraphicsItemTransformUndoCommand();
virtual UndoType getType() { return undotype_GRAPHICITEMTRANSFORM; }
virtual int getType() const { return UBUndoType::undotype_GRAPHICITEMTRANSFORM; }
protected:
virtual void undo();

@ -35,9 +35,8 @@
#include "domain/UBGraphicsGroupContainerItem.h"
#include "domain/UBGraphicsPolygonItem.h"
UBGraphicsItemUndoCommand::UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, const QSet<QGraphicsItem*>& pRemovedItems,
const QSet<QGraphicsItem*>& pAddedItems, const GroupDataTable &groupsMap)
: mScene(pScene)
UBGraphicsItemUndoCommand::UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, const QSet<QGraphicsItem*>& pRemovedItems, const QSet<QGraphicsItem*>& pAddedItems, const GroupDataTable &groupsMap): UBUndoCommand()
, mScene(pScene)
, mRemovedItems(pRemovedItems - pAddedItems)
, mAddedItems(pAddedItems - pRemovedItems)
, mExcludedFromGroup(groupsMap)
@ -57,9 +56,8 @@ UBGraphicsItemUndoCommand::UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, co
}
}
UBGraphicsItemUndoCommand::UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, QGraphicsItem* pRemovedItem,
QGraphicsItem* pAddedItem) :
mScene(pScene)
UBGraphicsItemUndoCommand::UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, QGraphicsItem* pRemovedItem, QGraphicsItem* pAddedItem) : UBUndoCommand()
, mScene(pScene)
{
if (pRemovedItem)

@ -25,14 +25,14 @@
#define UBGRAPHICSITEMUNDOCOMMAND_H_
#include <QtGui>
#include "UBAbstractUndoCommand.h"
#include "UBUndoCommand.h"
#include "UBGraphicsGroupContainerItem.h"
class UBGraphicsScene;
class UBGraphicsItemUndoCommand : public UBAbstractUndoCommand
class UBGraphicsItemUndoCommand : public UBUndoCommand
{
public:
typedef QMultiMap<UBGraphicsGroupContainerItem*, QUuid> GroupDataTable;
@ -48,7 +48,7 @@ class UBGraphicsItemUndoCommand : public UBAbstractUndoCommand
QSet<QGraphicsItem*> GetAddedList() const { return mAddedItems; }
QSet<QGraphicsItem*> GetRemovedList() const { return mRemovedItems; }
virtual UndoType getType() { return undotype_GRAPHICITEM; }
virtual int getType() const { return UBUndoType::undotype_GRAPHICITEM; }
protected:
virtual void undo();

@ -57,6 +57,8 @@ public:
return mMediaFileUrl;
}
virtual void mediaFileUrl(QUrl url){mMediaFileUrl=url;}
Phonon::MediaObject* mediaObject() const
{
return mMediaObject;

@ -31,6 +31,13 @@
#include "UBGraphicsItemDelegate.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/UBApplication.h"
#include "core/UBPersistenceManager.h"
#include "board/UBBoardController.h"
#include "core/memcheck.h"
UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
@ -164,3 +171,11 @@ qreal UBGraphicsPixmapItem::opacity() const
{
return QGraphicsPixmapItem::opacity();
}
void UBGraphicsPixmapItem::clearSource()
{
QString fileName = UBPersistenceManager::imageDirectory + "/" + uuid().toString() + ".png";
QString diskPath = UBApplication::boardController->selectedDocument()->persistencePath() + "/" + fileName;
UBFileSystemUtils::deleteFile(diskPath);
}

@ -57,7 +57,7 @@ class UBGraphicsPixmapItem : public QObject, public QGraphicsPixmapItem, public
void setOpacity(qreal op);
qreal opacity() const;
virtual void clearSource(){;}
virtual void clearSource();
virtual void setUuid(const QUuid &pUuid);

@ -30,6 +30,13 @@
#include "UBGraphicsDelegateFrame.h"
#include "core/UBApplication.h"
#include "core/UBPersistenceManager.h"
#include "board/UBBoardController.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
UBGraphicsProxyWidget::UBGraphicsProxyWidget(QGraphicsItem* parent)
@ -198,5 +205,3 @@ UBGraphicsScene* UBGraphicsProxyWidget::scene()
{
return static_cast<UBGraphicsScene*>(QGraphicsItem::scene());
}

@ -44,7 +44,6 @@ class UBGraphicsProxyWidget: public QGraphicsProxyWidget, public UBItem, public
virtual UBGraphicsScene* scene();
virtual void clearSource(){;}
virtual void setUuid(const QUuid &pUuid);
protected:

@ -2089,11 +2089,39 @@ QList<QUrl> UBGraphicsScene::relativeDependencies() const
while (itItems.hasNext())
{
UBGraphicsMediaItem *videoItem = qgraphicsitem_cast<UBGraphicsMediaItem*> (itItems.next());
QGraphicsItem* item = itItems.next();
UBGraphicsMediaItem *mediaItem = qgraphicsitem_cast<UBGraphicsMediaItem*> (item);
if (videoItem && videoItem->mediaFileUrl().isRelative())
{
relativePathes << videoItem->mediaFileUrl();
if (mediaItem){
QString completeFileName = QFileInfo(mediaItem->mediaFileUrl().toLocalFile()).fileName();
QString path;
if(mediaItem->getMediaType() == UBGraphicsMediaItem::mediaType_Video)
path = UBPersistenceManager::videoDirectory + "/";
else
path = UBPersistenceManager::audioDirectory + "/";
relativePathes << QUrl(path + completeFileName);
continue;
}
UBGraphicsWidgetItem* widget = qgraphicsitem_cast<UBGraphicsWidgetItem*>(item);
if(widget){
QString widgetPath = UBPersistenceManager::widgetDirectory + "/" + widget->uuid().toString() + ".wgt";
QString screenshotPath = UBPersistenceManager::widgetDirectory + "/" + widget->uuid().toString().remove("{").remove("}") + ".png";
relativePathes << QUrl(widgetPath);
relativePathes << QUrl(screenshotPath);
continue;
}
UBGraphicsPixmapItem* pixmapItem = qgraphicsitem_cast<UBGraphicsPixmapItem*>(item);
if(pixmapItem){
relativePathes << QUrl(UBPersistenceManager::imageDirectory + "/" + pixmapItem->uuid().toString() + ".png");
continue;
}
UBGraphicsSvgItem* svgItem = qgraphicsitem_cast<UBGraphicsSvgItem*>(item);
if(svgItem){
relativePathes << QUrl(UBPersistenceManager::imageDirectory + "/" + svgItem->uuid().toString() + ".svg");
continue;
}
}

@ -29,6 +29,13 @@
#include "UBGraphicsItemDelegate.h"
#include "UBGraphicsPixmapItem.h"
#include "core/UBApplication.h"
#include "core/UBPersistenceManager.h"
#include "board/UBBoardController.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
UBGraphicsSvgItem::UBGraphicsSvgItem(const QString& pFilePath, QGraphicsItem* parent)
@ -217,3 +224,11 @@ void UBGraphicsSvgItem::setUuid(const QUuid &pUuid)
UBItem::setUuid(pUuid);
setData(UBGraphicsItemData::ItemUuid, QVariant(pUuid)); //store item uuid inside the QGraphicsItem to fast operations with Items on the scene
}
void UBGraphicsSvgItem::clearSource()
{
QString fileName = UBPersistenceManager::imageDirectory + "/" + uuid().toString() + ".svg";
QString diskPath = UBApplication::boardController->selectedDocument()->persistencePath() + "/" + fileName;
UBFileSystemUtils::deleteFile(diskPath);
}

@ -70,6 +70,8 @@ class UBGraphicsSvgItem: public QGraphicsSvgItem, public UBItem, public UBGraphi
virtual void setUuid(const QUuid &pUuid);
virtual void clearSource();
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
@ -80,8 +82,6 @@ class UBGraphicsSvgItem: public QGraphicsSvgItem, public UBItem, public UBGraphi
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
// UBGraphicsItemDelegate* mDelegate;
QByteArray mFileData;
};

@ -25,18 +25,18 @@
#define UBGRAPHICSTEXTITEMUNDOCOMMAND_H_
#include <QtGui>
#include "UBAbstractUndoCommand.h"
#include "UBUndoCommand.h"
#include "UBGraphicsTextItem.h"
class UBGraphicsTextItemUndoCommand : public UBAbstractUndoCommand
class UBGraphicsTextItemUndoCommand : public UBUndoCommand
{
public:
UBGraphicsTextItemUndoCommand(UBGraphicsTextItem *textItem);
virtual ~UBGraphicsTextItemUndoCommand();
virtual UndoType getType() { return undotype_GRAPHICTEXTITEM; };
virtual int getType() const { return UBUndoType::undotype_GRAPHICTEXTITEM; };
protected:
virtual void undo();

@ -149,6 +149,7 @@ QUrl UBGraphicsWidgetItem::widgetUrl()
{
return mWidgetUrl;
}
QString UBGraphicsWidgetItem::mainHtmlFileName()
{
return mMainHtmlFileName;
@ -272,7 +273,8 @@ bool UBGraphicsWidgetItem::isDropableData(const QMimeData *data) const
return mUniboardAPI->isDropableData(data);
}
QUrl UBGraphicsWidgetItem::getOwnFolder() const {
QUrl UBGraphicsWidgetItem::getOwnFolder() const
{
return ownFolder;
}

@ -69,6 +69,7 @@ class UBGraphicsWidgetItem : public QGraphicsWebView, public UBItem, public UBRe
QUrl mainHtml();
void loadMainHtml();
QUrl widgetUrl();
void widgetUrl(QUrl url) { mWidgetUrl = url; }
QString mainHtmlFileName();
bool canBeContent();
@ -130,7 +131,7 @@ class UBGraphicsWidgetItem : public QGraphicsWebView, public UBItem, public UBRe
type_WIN = 1, // 0001
type_MAC = 2, // 0010
type_UNIX = 4, // 0100
type_ALL = 7, // 0111
type_ALL = 7 // 0111
};
bool mFirstReleaseAfterMove;

@ -25,18 +25,18 @@
#define UBPageSizeUndoCommand_H_
#include <QtGui>
#include "UBAbstractUndoCommand.h"
#include "UBUndoCommand.h"
class UBGraphicsScene;
class UBPageSizeUndoCommand : public UBAbstractUndoCommand
class UBPageSizeUndoCommand : public UBUndoCommand
{
public:
UBPageSizeUndoCommand(UBGraphicsScene* pScene, const QSize& previousSize, const QSize& newSize);
virtual ~UBPageSizeUndoCommand();
virtual UndoType getType() { return undotype_PAGESIZE; };
virtual int getType() { return UBUndoType::undotype_PAGESIZE; };
protected:
virtual void undo();

@ -21,30 +21,17 @@
#include "UBAbstractUndoCommand.h"
#include "UBUndoCommand.h"
#include "core/memcheck.h"
UBAbstractUndoCommand::UBAbstractUndoCommand()
UBUndoCommand::UBUndoCommand(QUndoCommand* parent):QUndoCommand(parent)
{
// NOOP
}
UBAbstractUndoCommand::~UBAbstractUndoCommand()
UBUndoCommand::~UBUndoCommand()
{
// NOOP
}
void UBAbstractUndoCommand::undo()
{
// NOOP
}
void UBAbstractUndoCommand::redo()
{
// NOOP
}
//void UBAbstractUndoCommand::UndoType getType(UndoType type);

@ -25,30 +25,16 @@
#define UBABSTRACTUNDOCOMMAND_H_
#include <QtGui>
#include <core/UB.h>
class UBAbstractUndoCommand : public QUndoCommand
class UBUndoCommand : 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,
undotype_GRAPHICSGROUPITEM = 6
};
virtual UndoType getType() const { return undotype_UNKNOWN; }
protected:
virtual void undo();
virtual void redo();
UBUndoCommand(QUndoCommand *parent = 0);
~UBUndoCommand();
virtual int getType() const { return UBUndoType::undotype_UNKNOWN; }
};

@ -14,7 +14,6 @@ HEADERS += src/domain/UBGraphicsScene.h \
src/domain/UBResizableGraphicsItem.h \
src/domain/UBGraphicsStroke.h \
src/domain/UBGraphicsMediaItem.h \
src/domain/UBAbstractUndoCommand.h \
src/domain/UBGraphicsGroupContainerItem.h \
src/domain/UBGraphicsGroupContainerItemDelegate.h \
src/domain/UBGraphicsStrokesGroup.h \
@ -24,7 +23,8 @@ HEADERS += src/domain/UBGraphicsScene.h \
src/domain/UBGraphicsDelegateFrame.h \
src/domain/UBGraphicsWidgetItemDelegate.h \
src/domain/UBGraphicsMediaItemDelegate.h \
src/domain/UBSelectionFrame.h
src/domain/UBSelectionFrame.h \
src/domain/UBUndoCommand.h
SOURCES += src/domain/UBGraphicsScene.cpp \
src/domain/UBGraphicsItemUndoCommand.cpp \
@ -42,7 +42,6 @@ SOURCES += src/domain/UBGraphicsScene.cpp \
src/domain/UBResizableGraphicsItem.cpp \
src/domain/UBGraphicsStroke.cpp \
src/domain/UBGraphicsMediaItem.cpp \
src/domain/UBAbstractUndoCommand.cpp \
src/domain/UBGraphicsGroupContainerItem.cpp \
src/domain/UBGraphicsGroupContainerItemDelegate.cpp \
src/domain/UBGraphicsStrokesGroup.cpp \
@ -52,4 +51,5 @@ SOURCES += src/domain/UBGraphicsScene.cpp \
src/domain/UBGraphicsMediaItemDelegate.cpp \
src/domain/UBGraphicsDelegateFrame.cpp \
src/domain/UBGraphicsWidgetItemDelegate.cpp \
src/domain/UBSelectionFrame.cpp
src/domain/UBSelectionFrame.cpp \
src/domain/UBUndoCommand.cpp

@ -66,17 +66,17 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient)
if(!UBPlatformUtils::hasVirtualKeyboard())
{
groupActions();
groupActions();
}
else
{
// VirtualKeyboard action is not in group
// So, groupping all buttons, except last
mButtonGroup = new QButtonGroup(this);
for(int i=0; i < mButtons.size()-1; i++)
{
mButtonGroup->addButton(mButtons[i], i);
}
// VirtualKeyboard action is not in group
// So, groupping all buttons, except last
mButtonGroup = new QButtonGroup(this);
for(int i=0; i < mButtons.size()-1; i++)
{
mButtonGroup->addButton(mButtons[i], i);
}
connect(mButtonGroup, SIGNAL(buttonClicked(int)), this, SIGNAL(buttonGroupClicked(int)));
}
@ -93,23 +93,28 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient)
void UBStylusPalette::initPosition()
{
if(!UBSettings::settings()->appToolBarOrientationVertical->get().toBool())
{
QWidget* pParentW = parentWidget();
if(NULL != pParentW)
{
mCustomPosition = true;
QPoint pos;
int parentWidth = pParentW->width();
int parentHeight = pParentW->height();
int posX = (parentWidth / 2) - (width() / 2);
int posY = parentHeight - border() - height();
pos.setX(posX);
pos.setY(posY);
moveInsideParent(pos);
}
QWidget* pParentW = parentWidget();
if(!pParentW) return ;
mCustomPosition = true;
QPoint pos;
int parentWidth = pParentW->width();
int parentHeight = pParentW->height();
if(UBSettings::settings()->appToolBarOrientationVertical->get().toBool()){
int posX = border();
int posY = (parentHeight / 2) - (height() / 2);
pos.setX(posX);
pos.setY(posY);
}
else {
int posX = (parentWidth / 2) - (width() / 2);
int posY = parentHeight - border() - height();
pos.setX(posX);
pos.setY(posY);
}
moveInsideParent(pos);
}
UBStylusPalette::~UBStylusPalette()

Loading…
Cancel
Save