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
e6b64d6e
Commit
e6b64d6e
authored
Mar 10, 2014
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'SEM' of github.com:OpenEducationFoundation/OpenBoard into SEM
parents
297eca66
832ebaac
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
889 additions
and
710 deletions
+889
-710
OpenBoard.pro
OpenBoard.pro
+1
-1
OpenBoard.css
resources/etc/OpenBoard.css
+383
-377
documents.ui
resources/forms/documents.ui
+196
-180
mainWindow.ui
resources/forms/mainWindow.ui
+1
-1
UBSceneCache.cpp
src/core/UBSceneCache.cpp
+1
-1
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+174
-122
UBDocumentController.h
src/document/UBDocumentController.h
+10
-0
UBDocumentProxy.cpp
src/document/UBDocumentProxy.cpp
+1
-1
UBDocumentTreeWidget.cpp
src/gui/UBDocumentTreeWidget.cpp
+111
-26
UBDocumentTreeWidget.h
src/gui/UBDocumentTreeWidget.h
+11
-1
No files found.
OpenBoard.pro
View file @
e6b64d6e
...
@@ -11,7 +11,7 @@ CONFIG += debug_and_release \
...
@@ -11,7 +11,7 @@ CONFIG += debug_and_release \
VERSION_MAJ
=
1
VERSION_MAJ
=
1
VERSION_MIN
=
03
VERSION_MIN
=
03
VERSION_TYPE
=
a
#
a
=
alpha
,
b
=
beta
,
rc
=
release
candidate
,
r
=
release
,
other
=>
error
VERSION_TYPE
=
a
#
a
=
alpha
,
b
=
beta
,
rc
=
release
candidate
,
r
=
release
,
other
=>
error
VERSION_PATCH
=
0
0
VERSION_PATCH
=
0
1
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"
,
""
)
...
...
resources/etc/OpenBoard.css
View file @
e6b64d6e
This diff is collapsed.
Click to expand it.
resources/forms/documents.ui
View file @
e6b64d6e
This diff is collapsed.
Click to expand it.
resources/forms/mainWindow.ui
View file @
e6b64d6e
...
@@ -148,7 +148,7 @@
...
@@ -148,7 +148,7 @@
<attribute
name=
"toolBarBreak"
>
<attribute
name=
"toolBarBreak"
>
<bool>
true
</bool>
<bool>
true
</bool>
</attribute>
</attribute>
<addaction
name=
"action
DocumentTools
"
/>
<addaction
name=
"action
VirtualKeyboard
"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"actionNewDocument"
/>
<addaction
name=
"actionNewDocument"
/>
<addaction
name=
"actionNewFolder"
/>
<addaction
name=
"actionNewFolder"
/>
...
...
src/core/UBSceneCache.cpp
View file @
e6b64d6e
...
@@ -128,7 +128,7 @@ void UBSceneCache::removeScene(UBDocumentProxy* proxy, int pageIndex)
...
@@ -128,7 +128,7 @@ void UBSceneCache::removeScene(UBDocumentProxy* proxy, int pageIndex)
{
{
UBGraphicsScene
*
scene
=
value
(
proxy
,
pageIndex
);
UBGraphicsScene
*
scene
=
value
(
proxy
,
pageIndex
);
if
(
scene
&&
scene
->
views
().
size
()
==
0
)
if
(
scene
&&
!
scene
->
isActive
()
)
{
{
UBSceneCacheID
key
(
proxy
,
pageIndex
);
UBSceneCacheID
key
(
proxy
,
pageIndex
);
int
count
=
QHash
<
UBSceneCacheID
,
UBGraphicsScene
*>::
remove
(
key
);
int
count
=
QHash
<
UBSceneCacheID
,
UBGraphicsScene
*>::
remove
(
key
);
...
...
src/document/UBDocumentController.cpp
View file @
e6b64d6e
This diff is collapsed.
Click to expand it.
src/document/UBDocumentController.h
View file @
e6b64d6e
...
@@ -66,6 +66,8 @@ class UBDocumentController : public UBDocumentContainer
...
@@ -66,6 +66,8 @@ class UBDocumentController : public UBDocumentContainer
QString
documentTrashGroupName
(){
return
mDocumentTrashGroupName
;}
QString
documentTrashGroupName
(){
return
mDocumentTrashGroupName
;}
QString
defaultDocumentGroupName
(){
return
mDefaultDocumentGroupName
;}
QString
defaultDocumentGroupName
(){
return
mDefaultDocumentGroupName
;}
void
treeGroupItemRenamed
(
QString
&
oldPath
,
QString
&
newPath
);
signals
:
signals
:
void
exportDone
();
void
exportDone
();
...
@@ -128,6 +130,14 @@ class UBDocumentController : public UBDocumentContainer
...
@@ -128,6 +130,14 @@ class UBDocumentController : public UBDocumentContainer
QString
mDocumentTrashGroupName
;
QString
mDocumentTrashGroupName
;
QString
mDefaultDocumentGroupName
;
QString
mDefaultDocumentGroupName
;
UBDocumentGroupTreeItem
*
getCommonGroupItem
(
QString
&
path
);
QMap
<
QString
,
UBDocumentGroupTreeItem
*>
mMapOfPaths
;
UBDocumentGroupTreeItem
*
getParentTreeItem
(
QString
&
documentGroup
);
QList
<
UBDocumentProxyTreeItem
*>
getProxies
(
QTreeWidgetItem
*
groupItem
);
QList
<
UBDocumentGroupTreeItem
*>
getGroupTreeItem
(
QTreeWidgetItem
*
groupItem
);
private
slots
:
private
slots
:
void
documentZoomSliderValueChanged
(
int
value
);
void
documentZoomSliderValueChanged
(
int
value
);
void
loadDocumentProxies
();
void
loadDocumentProxies
();
...
...
src/document/UBDocumentProxy.cpp
View file @
e6b64d6e
...
@@ -56,7 +56,7 @@ void UBDocumentProxy::init()
...
@@ -56,7 +56,7 @@ void UBDocumentProxy::init()
setMetaData
(
UBSettings
::
documentGroupName
,
""
);
setMetaData
(
UBSettings
::
documentGroupName
,
""
);
QDateTime
now
=
QDateTime
::
currentDateTime
();
QDateTime
now
=
QDateTime
::
currentDateTime
();
setMetaData
(
UBSettings
::
documentName
,
now
.
toString
(
Qt
::
SystemLocaleShort
Date
));
setMetaData
(
UBSettings
::
documentName
,
now
.
toString
(
Qt
::
ISO
Date
));
setUuid
(
QUuid
::
createUuid
());
setUuid
(
QUuid
::
createUuid
());
...
...
src/gui/UBDocumentTreeWidget.cpp
View file @
e6b64d6e
...
@@ -22,10 +22,10 @@
...
@@ -22,10 +22,10 @@
* along with OpenBoard. If not, see <http://www.gnu.org/licenses/>.
* along with OpenBoard. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include "UBDocumentTreeWidget.h"
#include "UBDocumentTreeWidget.h"
#include "document/UBDocumentProxy.h"
#include "document/UBDocumentProxy.h"
//#include "document/UBDocumentContainer.h"
#include "core/UBSettings.h"
#include "core/UBSettings.h"
#include "core/UBApplication.h"
#include "core/UBApplication.h"
...
@@ -33,6 +33,9 @@
...
@@ -33,6 +33,9 @@
#include "core/UBMimeData.h"
#include "core/UBMimeData.h"
#include "core/UBApplicationController.h"
#include "core/UBApplicationController.h"
#include "core/UBDocumentManager.h"
#include "core/UBDocumentManager.h"
#include "gui/UBMainWindow.h"
#include "document/UBDocumentController.h"
#include "document/UBDocumentController.h"
#include "adaptors/UBThumbnailAdaptor.h"
#include "adaptors/UBThumbnailAdaptor.h"
...
@@ -41,22 +44,23 @@
...
@@ -41,22 +44,23 @@
#include "core/memcheck.h"
#include "core/memcheck.h"
#include <QTimer>
UBDocumentTreeWidget
::
UBDocumentTreeWidget
(
QWidget
*
parent
)
UBDocumentTreeWidget
::
UBDocumentTreeWidget
(
QWidget
*
parent
)
:
QTreeWidget
(
parent
)
:
QTreeWidget
(
parent
)
,
mSelectedProxyTi
(
0
)
,
mSelectedProxyTi
(
0
)
,
mDropTargetProxyTi
(
0
)
,
mDropTargetProxyTi
(
0
)
,
mLastItemCompletePath
(
""
)
{
{
setDragDropMode
(
QAbstractItemView
::
InternalMove
);
setDragDropMode
(
QAbstractItemView
::
InternalMove
);
setAutoScroll
(
true
);
setAutoScroll
(
true
);
mScrollTimer
=
new
QTimer
(
this
);
mScrollTimer
=
new
QTimer
(
this
);
connect
(
UBDocumentManager
::
documentManager
(),
SIGNAL
(
documentUpdated
(
UBDocumentProxy
*
))
connect
(
UBDocumentManager
::
documentManager
(),
SIGNAL
(
documentUpdated
(
UBDocumentProxy
*
)),
this
,
SLOT
(
documentUpdated
(
UBDocumentProxy
*
)));
,
this
,
SLOT
(
documentUpdated
(
UBDocumentProxy
*
)));
connect
(
this
,
SIGNAL
(
itemChanged
(
QTreeWidgetItem
*
,
int
))
connect
(
this
,
SIGNAL
(
itemChanged
(
QTreeWidgetItem
*
,
int
))
,
this
,
SLOT
(
itemChangedValidation
(
QTreeWidgetItem
*
,
int
)));
,
this
,
SLOT
(
itemChangedValidation
(
QTreeWidgetItem
*
,
int
)));
connect
(
mScrollTimer
,
SIGNAL
(
timeout
())
,
this
,
SLOT
(
autoScroll
()));
connect
(
mScrollTimer
,
SIGNAL
(
timeout
())
connect
(
this
,
SIGNAL
(
itemPressed
(
QTreeWidgetItem
*
,
int
)),
this
,
SLOT
(
onItemPressed
(
QTreeWidgetItem
*
,
int
)));
,
this
,
SLOT
(
autoScroll
()));
}
}
...
@@ -66,30 +70,89 @@ UBDocumentTreeWidget::~UBDocumentTreeWidget()
...
@@ -66,30 +70,89 @@ UBDocumentTreeWidget::~UBDocumentTreeWidget()
}
}
void
UBDocumentTreeWidget
::
onItemPressed
(
QTreeWidgetItem
*
item
,
int
column
)
{
Q_UNUSED
(
column
)
UBDocumentGroupTreeItem
*
group
=
dynamic_cast
<
UBDocumentGroupTreeItem
*>
(
item
);
if
(
group
){
mLastItemCompletePath
=
group
->
buildEntirePath
();
mLastItemName
=
group
->
groupName
();
}
}
void
UBDocumentTreeWidget
::
itemChangedValidation
(
QTreeWidgetItem
*
item
,
int
column
)
void
UBDocumentTreeWidget
::
itemChangedValidation
(
QTreeWidgetItem
*
item
,
int
column
)
{
{
if
(
column
==
0
)
QString
emptyNameWarningTitle
=
tr
(
"Empty name"
);
QString
emptyNameWarningText
=
tr
(
"The name should not be empty. Please enter a valid name."
);
QString
alreadyExistsNameWarningTitle
=
tr
(
"Name already used"
);
QString
alreadyExistsNameWarningText
=
tr
(
"The actual name is in conflict with and existing. Please choose another one."
);
UBDocumentProxyTreeItem
*
treeItem
=
dynamic_cast
<
UBDocumentProxyTreeItem
*>
(
item
);
if
(
treeItem
)
{
{
UBDocumentGroupTreeItem
*
group
=
dynamic_cast
<
UBDocumentGroupTreeItem
*>
(
item
);
QString
name
=
treeItem
->
text
(
column
);
if
(
name
.
isEmpty
()){
mFailedValidationForTreeItem
=
item
;
mFailedValidationItemColumn
=
column
;
UBApplication
::
mainWindow
->
warning
(
emptyNameWarningTitle
,
emptyNameWarningText
);
QTimer
::
singleShot
(
100
,
this
,
SLOT
(
validationFailed
()));
return
;
}
}
if
(
group
)
{
QString
name
=
group
->
text
(
0
);
for
(
int
i
=
0
;
i
<
topLevelItemCount
();
i
++
)
UBDocumentGroupTreeItem
*
group
=
dynamic_cast
<
UBDocumentGroupTreeItem
*>
(
item
);
{
if
(
group
)
QTreeWidgetItem
*
someTopLevelItem
=
topLevelItem
(
i
);
{
QString
name
=
group
->
text
(
column
);
if
(
name
.
isEmpty
()){
mFailedValidationForTreeItem
=
item
;
mFailedValidationItemColumn
=
column
;
UBApplication
::
mainWindow
->
warning
(
emptyNameWarningTitle
,
emptyNameWarningText
);
QTimer
::
singleShot
(
100
,
this
,
SLOT
(
validationFailed
()));
return
;
}
if
(
someTopLevelItem
!=
group
&&
if
(
group
->
parent
()){
someTopLevelItem
->
text
(
0
)
==
name
)
for
(
int
i
=
0
;
i
<
group
->
parent
()
->
childCount
();
i
++
)
{
{
group
->
setText
(
0
,
tr
(
"%1 (copy)"
).
arg
(
name
));
QTreeWidgetItem
*
childAtPosition
=
group
->
parent
()
->
child
(
i
);
if
(
childAtPosition
!=
item
&&
childAtPosition
->
text
(
column
)
==
name
){
UBApplication
::
mainWindow
->
warning
(
alreadyExistsNameWarningTitle
,
alreadyExistsNameWarningText
);
mFailedValidationForTreeItem
=
item
;
mFailedValidationItemColumn
=
column
;
QTimer
::
singleShot
(
100
,
this
,
SLOT
(
validationFailed
()));
return
;
}
}
}
}
}
}
else
{
// We are looking at the top level items;
for
(
int
i
=
0
;
i
<
topLevelItemCount
();
i
+=
1
){
if
(
topLevelItem
(
i
)
!=
item
&&
dynamic_cast
<
UBDocumentGroupTreeItem
*>
(
topLevelItem
(
i
))
->
groupName
()
==
group
->
groupName
()){
UBApplication
::
mainWindow
->
warning
(
tr
(
"Name already in use"
),
tr
(
"Please choose another name for the directory. The chosed name is already used."
));
mFailedValidationForTreeItem
=
item
;
mFailedValidationItemColumn
=
column
;
QTimer
::
singleShot
(
100
,
this
,
SLOT
(
validationFailed
()));
return
;
}
}
}
QString
newPath
=
group
->
buildEntirePath
();
group
->
updateChildrenPath
(
column
,
mLastItemCompletePath
,
newPath
);
UBApplication
::
documentController
->
treeGroupItemRenamed
(
mLastItemCompletePath
,
newPath
);
}
}
}
}
void
UBDocumentTreeWidget
::
validationFailed
()
{
editItem
(
mFailedValidationForTreeItem
,
mFailedValidationItemColumn
);
}
Qt
::
DropActions
UBDocumentTreeWidget
::
supportedDropActions
()
const
Qt
::
DropActions
UBDocumentTreeWidget
::
supportedDropActions
()
const
{
{
...
@@ -208,11 +271,6 @@ void UBDocumentTreeWidget::dragMoveEvent(QDragMoveEvent *event)
...
@@ -208,11 +271,6 @@ void UBDocumentTreeWidget::dragMoveEvent(QDragMoveEvent *event)
void
UBDocumentTreeWidget
::
focusInEvent
(
QFocusEvent
*
event
)
void
UBDocumentTreeWidget
::
focusInEvent
(
QFocusEvent
*
event
)
{
{
Q_UNUSED
(
event
);
// Tolik
//itemSelectionChanged();
QTreeWidget
::
focusInEvent
(
event
);
QTreeWidget
::
focusInEvent
(
event
);
}
}
...
@@ -275,7 +333,6 @@ void UBDocumentTreeWidget::dropEvent(QDropEvent *event)
...
@@ -275,7 +333,6 @@ void UBDocumentTreeWidget::dropEvent(QDropEvent *event)
if
(
groupItem
->
isTrashFolder
())
if
(
groupItem
->
isTrashFolder
())
mSelectedProxyTi
->
setFlags
(
mSelectedProxyTi
->
flags
()
^
Qt
::
ItemIsEditable
);
mSelectedProxyTi
->
setFlags
(
mSelectedProxyTi
->
flags
()
^
Qt
::
ItemIsEditable
);
//clearSelection();
expandItem
(
groupItem
);
expandItem
(
groupItem
);
scrollToItem
(
mSelectedProxyTi
);
scrollToItem
(
mSelectedProxyTi
);
...
@@ -320,7 +377,6 @@ void UBDocumentTreeWidget::dropEvent(QDropEvent *event)
...
@@ -320,7 +377,6 @@ void UBDocumentTreeWidget::dropEvent(QDropEvent *event)
if
(
scene
)
if
(
scene
)
{
{
UBGraphicsScene
*
sceneClone
=
scene
->
sceneDeepCopy
();
UBGraphicsScene
*
sceneClone
=
scene
->
sceneDeepCopy
();
// UBGraphicsScene* sceneClone = scene;
UBDocumentProxy
*
targetDocProxy
=
targetProxyTreeItem
->
proxy
();
UBDocumentProxy
*
targetDocProxy
=
targetProxyTreeItem
->
proxy
();
...
@@ -453,6 +509,35 @@ QString UBDocumentGroupTreeItem::groupName() const
...
@@ -453,6 +509,35 @@ QString UBDocumentGroupTreeItem::groupName() const
return
text
(
0
);
return
text
(
0
);
}
}
QString
UBDocumentGroupTreeItem
::
buildEntirePath
()
{
QString
result
(
groupName
());
UBDocumentGroupTreeItem
*
item
=
this
;
while
(
item
->
parent
()){
item
=
dynamic_cast
<
UBDocumentGroupTreeItem
*>
(
item
->
parent
());
result
=
item
->
groupName
()
+
"/"
+
result
;
}
return
result
;
}
void
UBDocumentGroupTreeItem
::
updateChildrenPath
(
int
column
,
QString
&
previousText
,
const
QString
&
text
)
{
for
(
int
i
=
0
;
i
<
childCount
();
i
+=
1
){
UBDocumentGroupTreeItem
*
groupTreeItem
=
dynamic_cast
<
UBDocumentGroupTreeItem
*>
(
child
(
i
));
if
(
groupTreeItem
)
groupTreeItem
->
updateChildrenPath
(
column
,
previousText
,
text
);
else
{
UBDocumentProxyTreeItem
*
docProxyItem
=
dynamic_cast
<
UBDocumentProxyTreeItem
*>
(
child
(
i
));
QString
groupName
=
docProxyItem
->
proxy
()
->
metaData
(
UBSettings
::
documentGroupName
).
toString
();
groupName
=
groupName
.
remove
(
0
,
previousText
.
length
());
groupName
=
text
+
groupName
;
docProxyItem
->
proxy
()
->
setMetaData
(
UBSettings
::
documentGroupName
,
groupName
);
UBPersistenceManager
::
persistenceManager
()
->
persistDocumentMetadata
(
docProxyItem
->
proxy
());
}
}
}
bool
UBDocumentGroupTreeItem
::
isTrashFolder
()
const
bool
UBDocumentGroupTreeItem
::
isTrashFolder
()
const
{
{
...
...
src/gui/UBDocumentTreeWidget.h
View file @
e6b64d6e
...
@@ -54,8 +54,9 @@ class UBDocumentTreeWidget : public QTreeWidget
...
@@ -54,8 +54,9 @@ class UBDocumentTreeWidget : public QTreeWidget
void
documentUpdated
(
UBDocumentProxy
*
pDocument
);
void
documentUpdated
(
UBDocumentProxy
*
pDocument
);
void
itemChangedValidation
(
QTreeWidgetItem
*
item
,
int
column
);
void
itemChangedValidation
(
QTreeWidgetItem
*
item
,
int
column
);
void
onItemPressed
(
QTreeWidgetItem
*
item
,
int
column
);
void
autoScroll
();
void
autoScroll
();
void
validationFailed
();
private
:
private
:
UBDocumentProxyTreeItem
*
mSelectedProxyTi
;
UBDocumentProxyTreeItem
*
mSelectedProxyTi
;
...
@@ -63,6 +64,10 @@ class UBDocumentTreeWidget : public QTreeWidget
...
@@ -63,6 +64,10 @@ class UBDocumentTreeWidget : public QTreeWidget
QBrush
mBackground
;
QBrush
mBackground
;
QTimer
*
mScrollTimer
;
QTimer
*
mScrollTimer
;
int
mScrollMagnitude
;
int
mScrollMagnitude
;
QTreeWidgetItem
*
mFailedValidationForTreeItem
;
int
mFailedValidationItemColumn
;
QString
mLastItemCompletePath
;
QString
mLastItemName
;
};
};
...
@@ -93,6 +98,11 @@ class UBDocumentGroupTreeItem : public QTreeWidgetItem
...
@@ -93,6 +98,11 @@ class UBDocumentGroupTreeItem : public QTreeWidgetItem
bool
isTrashFolder
()
const
;
bool
isTrashFolder
()
const
;
bool
isDefaultFolder
()
const
;
bool
isDefaultFolder
()
const
;
QString
buildEntirePath
();
void
updateChildrenPath
(
int
column
,
QString
&
previousText
,
const
QString
&
text
);
};
};
#endif
/* UBDOCUMENTTREEWIDGET_H_ */
#endif
/* UBDOCUMENTTREEWIDGET_H_ */
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