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
fa65eafe
Commit
fa65eafe
authored
11 years ago
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugs of persistance of unwanted media on disk. First step fixed the undo manager
parent
000f1a9c
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
53 additions
and
72 deletions
+53
-72
UBBoardController.cpp
src/board/UBBoardController.cpp
+6
-6
UBBoardController.h
src/board/UBBoardController.h
+1
-1
UB.h
src/core/UB.h
+9
-0
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
UBGraphicsTextItemUndoCommand.h
src/domain/UBGraphicsTextItemUndoCommand.h
+3
-3
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
No files found.
src/board/UBBoardController.cpp
View file @
fa65eafe
...
...
@@ -1550,11 +1550,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
);
}
}
...
...
@@ -1563,11 +1563,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.
...
...
@@ -1593,7 +1593,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.
...
...
This diff is collapsed.
Click to expand it.
src/board/UBBoardController.h
View file @
fa65eafe
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
src/core/UB.h
View file @
fa65eafe
...
...
@@ -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_ */
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsItemGroupUndoCommand.cpp
View file @
fa65eafe
...
...
@@ -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
())
{
...
...
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsItemGroupUndoCommand.h
View file @
fa65eafe
...
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsItemTransformUndoCommand.cpp
View file @
fa65eafe
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsItemTransformUndoCommand.h
View file @
fa65eafe
...
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsItemUndoCommand.cpp
View file @
fa65eafe
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsItemUndoCommand.h
View file @
fa65eafe
...
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsTextItemUndoCommand.h
View file @
fa65eafe
...
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
src/domain/UBPageSizeUndoCommand.h
View file @
fa65eafe
...
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
src/domain/UB
Abstract
UndoCommand.cpp
→
src/domain/UBUndoCommand.cpp
View file @
fa65eafe
...
...
@@ -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);
This diff is collapsed.
Click to expand it.
src/domain/UB
Abstract
UndoCommand.h
→
src/domain/UBUndoCommand.h
View file @
fa65eafe
...
...
@@ -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
;
}
};
...
...
This diff is collapsed.
Click to expand it.
src/domain/domain.pri
View file @
fa65eafe
...
...
@@ -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
This diff is collapsed.
Click to expand it.
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