Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
c39ba64f
Commit
c39ba64f
authored
Jul 28, 2013
by
Didier Clerc
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'OEFUniboard' of github.com:stayonshadow/PrivateBoard into OEFUniboard
parents
150dc953
d6768f35
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
243 additions
and
138 deletions
+243
-138
UBImportAdaptor.cpp
src/adaptors/UBImportAdaptor.cpp
+0
-24
UBBoardController.cpp
src/board/UBBoardController.cpp
+15
-8
UBBoardController.h
src/board/UBBoardController.h
+1
-1
UB.h
src/core/UB.h
+9
-0
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+72
-3
UBPersistenceManager.h
src/core/UBPersistenceManager.h
+1
-1
UBGraphicsItemGroupUndoCommand.cpp
src/domain/UBGraphicsItemGroupUndoCommand.cpp
+4
-3
UBGraphicsItemGroupUndoCommand.h
src/domain/UBGraphicsItemGroupUndoCommand.h
+3
-3
UBGraphicsItemTransformUndoCommand.cpp
src/domain/UBGraphicsItemTransformUndoCommand.cpp
+1
-1
UBGraphicsItemTransformUndoCommand.h
src/domain/UBGraphicsItemTransformUndoCommand.h
+3
-3
UBGraphicsItemUndoCommand.cpp
src/domain/UBGraphicsItemUndoCommand.cpp
+4
-6
UBGraphicsItemUndoCommand.h
src/domain/UBGraphicsItemUndoCommand.h
+3
-3
UBGraphicsMediaItem.h
src/domain/UBGraphicsMediaItem.h
+2
-0
UBGraphicsPixmapItem.cpp
src/domain/UBGraphicsPixmapItem.cpp
+15
-0
UBGraphicsPixmapItem.h
src/domain/UBGraphicsPixmapItem.h
+1
-1
UBGraphicsProxyWidget.cpp
src/domain/UBGraphicsProxyWidget.cpp
+7
-2
UBGraphicsProxyWidget.h
src/domain/UBGraphicsProxyWidget.h
+0
-1
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+32
-4
UBGraphicsSvgItem.cpp
src/domain/UBGraphicsSvgItem.cpp
+15
-0
UBGraphicsSvgItem.h
src/domain/UBGraphicsSvgItem.h
+2
-2
UBGraphicsTextItemUndoCommand.h
src/domain/UBGraphicsTextItemUndoCommand.h
+3
-3
UBGraphicsWidgetItem.cpp
src/domain/UBGraphicsWidgetItem.cpp
+3
-1
UBGraphicsWidgetItem.h
src/domain/UBGraphicsWidgetItem.h
+2
-1
UBPageSizeUndoCommand.h
src/domain/UBPageSizeUndoCommand.h
+3
-3
UBUndoCommand.cpp
src/domain/UBUndoCommand.cpp
+3
-16
UBUndoCommand.h
src/domain/UBUndoCommand.h
+6
-20
domain.pri
src/domain/domain.pri
+4
-4
UBStylusPalette.cpp
src/gui/UBStylusPalette.cpp
+29
-24
No files found.
src/adaptors/UBImportAdaptor.cpp
View file @
c39ba64f
...
...
@@ -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;
}
*/
\ No newline at end of file
src/board/UBBoardController.cpp
View file @
c39ba64f
...
...
@@ -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
::
fi
tUniqI
ems
(
const
QUndoCommand
*
parent
,
QSet
<
QGraphicsItem
*>
&
itms
)
void
UBBoardController
::
fi
ndUniquesIt
ems
(
const
QUndoCommand
*
parent
,
QSet
<
QGraphicsItem
*>
&
itms
)
{
if
(
parent
->
childCount
())
{
for
(
int
i
=
0
;
i
<
parent
->
childCount
();
i
++
)
{
fi
tUniqI
ems
(
parent
->
child
(
i
),
itms
);
fi
ndUniquesIt
ems
(
parent
->
child
(
i
),
itms
);
}
}
...
...
@@ -1564,11 +1571,11 @@ void UBBoardController::fitUniqIems(const QUndoCommand *parent, QSet<QGraphicsIt
return
;
}
const
UB
AbstractUndoCommand
*
abstractCmd
=
static_cast
<
const
UBAbstract
UndoCommand
*>
(
parent
);
if
(
abstractCmd
->
getType
()
!=
UBAbstractUndoCommand
::
undotype_GRAPHICITEM
)
const
UB
UndoCommand
*
undoCmd
=
static_cast
<
const
UB
UndoCommand
*>
(
parent
);
if
(
undoCmd
->
getType
()
!=
UBUndoType
::
undotype_GRAPHICITEM
)
return
;
const
UBGraphicsItemUndoCommand
*
cmd
=
stat
ic_cast
<
const
UBGraphicsItemUndoCommand
*>
(
parent
);
const
UBGraphicsItemUndoCommand
*
cmd
=
dynam
ic_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
++
)
{
fi
tUniqI
ems
(
UBApplication
::
undoStack
->
command
(
i
),
uniqueItems
);
fi
ndUniquesIt
ems
(
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
()
->
addGraphicsWidg
te
ToDocument
(
selectedDocument
(),
pUrl
.
toLocalFile
(),
uuid
,
destPath
))
if
(
!
UBPersistenceManager
::
persistenceManager
()
->
addGraphicsWidg
et
ToDocument
(
selectedDocument
(),
pUrl
.
toLocalFile
(),
uuid
,
destPath
))
return
NULL
;
QUrl
newUrl
=
QUrl
::
fromLocalFile
(
destPath
);
...
...
src/board/UBBoardController.h
View file @
c39ba64f
...
...
@@ -160,7 +160,7 @@ class UBBoardController : public UBDocumentContainer
void
notifyPageChanged
();
void
displayMetaData
(
QMap
<
QString
,
QString
>
metadatas
);
void
fi
tUniqI
ems
(
const
QUndoCommand
*
parent
,
QSet
<
QGraphicsItem
*>
&
itms
);
void
fi
ndUniquesIt
ems
(
const
QUndoCommand
*
parent
,
QSet
<
QGraphicsItem
*>
&
itms
);
void
ClearUndoStack
();
void
setActiveDocumentScene
(
UBDocumentProxy
*
pDocumentProxy
,
int
pSceneIndex
=
0
,
bool
forceReload
=
false
);
...
...
src/core/UB.h
View file @
c39ba64f
...
...
@@ -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_ */
src/core/UBPersistenceManager.cpp
View file @
c39ba64f
...
...
@@ -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
());
Q
File
::
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
::
addGraphicsWidg
te
ToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
bool
UBPersistenceManager
::
addGraphicsWidg
et
ToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
path
,
QUuid
objectUuid
,
QString
&
destinationPath
)
...
...
src/core/UBPersistenceManager.h
View file @
c39ba64f
...
...
@@ -103,7 +103,7 @@ class UBPersistenceManager : public QObject
virtual
bool
isEmpty
(
UBDocumentProxy
*
pDocumentProxy
);
virtual
void
purgeEmptyDocuments
();
bool
addGraphicsWidg
te
ToDocument
(
UBDocumentProxy
*
mDocumentProxy
,
QString
path
,
QUuid
objectUuid
,
QString
&
destinationPath
);
bool
addGraphicsWidg
et
ToDocument
(
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
:
...
...
src/domain/UBGraphicsItemGroupUndoCommand.cpp
View file @
c39ba64f
...
...
@@ -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
())
{
...
...
src/domain/UBGraphicsItemGroupUndoCommand.h
View file @
c39ba64f
...
...
@@ -25,18 +25,18 @@
#define UBGRAPHICSITEMGROUPUNDOCOMMAND_H
#include <QList>
#include "UB
Abstract
UndoCommand.h"
#include "UBUndoCommand.h"
class
UBGraphicsScene
;
class
UBGraphicsGroupContainerItem
;
class
UBGraphicsItemGroupUndoCommand
:
public
UB
Abstract
UndoCommand
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
();
...
...
src/domain/UBGraphicsItemTransformUndoCommand.cpp
View file @
c39ba64f
...
...
@@ -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
;
...
...
src/domain/UBGraphicsItemTransformUndoCommand.h
View file @
c39ba64f
...
...
@@ -27,10 +27,10 @@
#include <QtGui>
#include "UBResizableGraphicsItem.h"
#include "UB
Abstract
UndoCommand.h"
#include "UBUndoCommand.h"
class
UBGraphicsItemTransformUndoCommand
:
public
UB
Abstract
UndoCommand
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
();
...
...
src/domain/UBGraphicsItemUndoCommand.cpp
View file @
c39ba64f
...
...
@@ -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
)
...
...
src/domain/UBGraphicsItemUndoCommand.h
View file @
c39ba64f
...
...
@@ -25,14 +25,14 @@
#define UBGRAPHICSITEMUNDOCOMMAND_H_
#include <QtGui>
#include "UB
Abstract
UndoCommand.h"
#include "UBUndoCommand.h"
#include "UBGraphicsGroupContainerItem.h"
class
UBGraphicsScene
;
class
UBGraphicsItemUndoCommand
:
public
UB
Abstract
UndoCommand
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
();
...
...
src/domain/UBGraphicsMediaItem.h
View file @
c39ba64f
...
...
@@ -57,6 +57,8 @@ public:
return
mMediaFileUrl
;
}
virtual
void
mediaFileUrl
(
QUrl
url
){
mMediaFileUrl
=
url
;}
Phonon
::
MediaObject
*
mediaObject
()
const
{
return
mMediaObject
;
...
...
src/domain/UBGraphicsPixmapItem.cpp
View file @
c39ba64f
...
...
@@ -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
);
}
src/domain/UBGraphicsPixmapItem.h
View file @
c39ba64f
...
...
@@ -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
);
...
...
src/domain/UBGraphicsProxyWidget.cpp
View file @
c39ba64f
...
...
@@ -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
());
}
src/domain/UBGraphicsProxyWidget.h
View file @
c39ba64f
...
...
@@ -44,7 +44,6 @@ class UBGraphicsProxyWidget: public QGraphicsProxyWidget, public UBItem, public
virtual
UBGraphicsScene
*
scene
();
virtual
void
clearSource
(){;}
virtual
void
setUuid
(
const
QUuid
&
pUuid
);
protected
:
...
...
src/domain/UBGraphicsScene.cpp
View file @
c39ba64f
...
...
@@ -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
;
}
}
...
...
src/domain/UBGraphicsSvgItem.cpp
View file @
c39ba64f
...
...
@@ -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
);
}
src/domain/UBGraphicsSvgItem.h
View file @
c39ba64f
...
...
@@ -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
;
};
...
...
src/domain/UBGraphicsTextItemUndoCommand.h
View file @
c39ba64f
...
...
@@ -25,18 +25,18 @@
#define UBGRAPHICSTEXTITEMUNDOCOMMAND_H_
#include <QtGui>
#include "UB
Abstract
UndoCommand.h"
#include "UBUndoCommand.h"
#include "UBGraphicsTextItem.h"
class
UBGraphicsTextItemUndoCommand
:
public
UB
Abstract
UndoCommand
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
();
...
...
src/domain/UBGraphicsWidgetItem.cpp
View file @
c39ba64f
...
...
@@ -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
;
}
...
...
src/domain/UBGraphicsWidgetItem.h
View file @
c39ba64f
...
...
@@ -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
;
...
...
src/domain/UBPageSizeUndoCommand.h
View file @
c39ba64f
...
...
@@ -25,18 +25,18 @@
#define UBPageSizeUndoCommand_H_
#include <QtGui>
#include "UB
Abstract
UndoCommand.h"
#include "UBUndoCommand.h"
class
UBGraphicsScene
;
class
UBPageSizeUndoCommand
:
public
UB
Abstract
UndoCommand
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
();
...
...
src/domain/UB
Abstract
UndoCommand.cpp
→
src/domain/UBUndoCommand.cpp
View file @
c39ba64f
...
...
@@ -21,30 +21,17 @@
#include "UB
Abstract
UndoCommand.h"
#include "UBUndoCommand.h"
#include "core/memcheck.h"
UB
AbstractUndoCommand
::
UBAbstractUndoCommand
(
)
UB
UndoCommand
::
UBUndoCommand
(
QUndoCommand
*
parent
)
:
QUndoCommand
(
parent
)
{
// NOOP
}
UB
AbstractUndoCommand
::~
UBAbstract
UndoCommand
()
UB
UndoCommand
::~
UB
UndoCommand
()
{
// NOOP
}
void
UBAbstractUndoCommand
::
undo
()
{
// NOOP
}
void
UBAbstractUndoCommand
::
redo
()
{
// NOOP
}
//void UBAbstractUndoCommand::UndoType getType(UndoType type);
src/domain/UB
Abstract
UndoCommand.h
→
src/domain/UBUndoCommand.h
View file @
c39ba64f
...
...
@@ -25,30 +25,16 @@
#define UBABSTRACTUNDOCOMMAND_H_
#include <QtGui>
#include <core/UB.h>
class
UB
Abstract
UndoCommand
:
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
;
}
};
...
...
src/domain/domain.pri
View file @
c39ba64f
...
...
@@ -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
src/gui/UBStylusPalette.cpp
View file @
c39ba64f
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment