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
98e4abb7
Commit
98e4abb7
authored
Mar 27, 2014
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed document mode
parent
422ab4c5
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
138 additions
and
333 deletions
+138
-333
OpenBoard.css
resources/etc/OpenBoard.css
+0
-6
documents.ui
resources/forms/documents.ui
+7
-23
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+114
-174
UBDocumentController.h
src/document/UBDocumentController.h
+0
-10
UBDocumentProxy.cpp
src/document/UBDocumentProxy.cpp
+1
-1
UBDocumentTreeWidget.cpp
src/gui/UBDocumentTreeWidget.cpp
+16
-108
UBDocumentTreeWidget.h
src/gui/UBDocumentTreeWidget.h
+0
-11
No files found.
resources/etc/OpenBoard.css
View file @
98e4abb7
...
@@ -380,9 +380,3 @@ QLineEdit#ubWebBrowserLineEdit
...
@@ -380,9 +380,3 @@ QLineEdit#ubWebBrowserLineEdit
padding
:
2
2px
;
padding
:
2
2px
;
background
:
white
;
background
:
white
;
}
}
QSplitter
{
background-color
:
#b3b3b3
;
width
:
15px
;
resources/forms/documents.ui
View file @
98e4abb7
...
@@ -40,15 +40,8 @@
...
@@ -40,15 +40,8 @@
<property
name=
"lineWidth"
>
<property
name=
"lineWidth"
>
<number>
0
</number>
<number>
0
</number>
</property>
</property>
<layout
class=
"Q
VBoxLayout"
name=
"verticalLayout_4
"
>
<layout
class=
"Q
HBoxLayout"
name=
"horizontalLayout
"
>
<item>
<item>
<widget
class=
"QSplitter"
name=
"splitter"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"childrenCollapsible"
>
<bool>
false
</bool>
</property>
<widget
class=
"QFrame"
name=
"topLeftFrame"
>
<widget
class=
"QFrame"
name=
"topLeftFrame"
>
<property
name=
"sizePolicy"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Fixed"
vsizetype=
"Preferred"
>
<sizepolicy
hsizetype=
"Fixed"
vsizetype=
"Preferred"
>
...
@@ -72,17 +65,11 @@
...
@@ -72,17 +65,11 @@
<item>
<item>
<widget
class=
"UBDocumentTreeWidget"
name=
"documentTreeWidget"
>
<widget
class=
"UBDocumentTreeWidget"
name=
"documentTreeWidget"
>
<property
name=
"sizePolicy"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding
"
vsizetype=
"Expanding"
>
<sizepolicy
hsizetype=
"Maximum
"
vsizetype=
"Expanding"
>
<horstretch>
0
</horstretch>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</sizepolicy>
</property>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"styleSheet"
>
<property
name=
"styleSheet"
>
<string
notr=
"true"
/>
<string
notr=
"true"
/>
</property>
</property>
...
@@ -116,6 +103,8 @@
...
@@ -116,6 +103,8 @@
</item>
</item>
</layout>
</layout>
</widget>
</widget>
</item>
<item>
<widget
class=
"QWidget"
name=
"topRightFrame"
native=
"true"
>
<widget
class=
"QWidget"
name=
"topRightFrame"
native=
"true"
>
<property
name=
"styleSheet"
>
<property
name=
"styleSheet"
>
<string
notr=
"true"
/>
<string
notr=
"true"
/>
...
@@ -126,12 +115,6 @@
...
@@ -126,12 +115,6 @@
</property>
</property>
<item>
<item>
<widget
class=
"UBDocumentThumbnailWidget"
name=
"thumbnailWidget"
>
<widget
class=
"UBDocumentThumbnailWidget"
name=
"thumbnailWidget"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"contextMenuPolicy"
>
<property
name=
"contextMenuPolicy"
>
<enum>
Qt::NoContextMenu
</enum>
<enum>
Qt::NoContextMenu
</enum>
</property>
</property>
...
@@ -241,7 +224,6 @@
...
@@ -241,7 +224,6 @@
</item>
</item>
</layout>
</layout>
</widget>
</widget>
</widget>
</item>
</item>
</layout>
</layout>
</widget>
</widget>
...
@@ -261,6 +243,8 @@
...
@@ -261,6 +243,8 @@
<header>
gui/UBDocumentTreeWidget.h
</header>
<header>
gui/UBDocumentTreeWidget.h
</header>
</customwidget>
</customwidget>
</customwidgets>
</customwidgets>
<resources/>
<resources>
<include
location=
"../OpenBoard.qrc"
/>
</resources>
<connections/>
<connections/>
</ui>
</ui>
src/document/UBDocumentController.cpp
View file @
98e4abb7
This diff is collapsed.
Click to expand it.
src/document/UBDocumentController.h
View file @
98e4abb7
...
@@ -66,8 +66,6 @@ class UBDocumentController : public UBDocumentContainer
...
@@ -66,8 +66,6 @@ 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
();
...
@@ -130,14 +128,6 @@ class UBDocumentController : public UBDocumentContainer
...
@@ -130,14 +128,6 @@ 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 @
98e4abb7
...
@@ -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
::
ISO
Date
));
setMetaData
(
UBSettings
::
documentName
,
now
.
toString
(
Qt
::
SystemLocaleShort
Date
));
setUuid
(
QUuid
::
createUuid
());
setUuid
(
QUuid
::
createUuid
());
...
...
src/gui/UBDocumentTreeWidget.cpp
View file @
98e4abb7
...
@@ -33,9 +33,6 @@
...
@@ -33,9 +33,6 @@
#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"
...
@@ -44,23 +41,22 @@
...
@@ -44,23 +41,22 @@
#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
*
)),
this
,
SLOT
(
documentUpdated
(
UBDocumentProxy
*
)));
connect
(
UBDocumentManager
::
documentManager
(),
SIGNAL
(
documentUpdated
(
UBDocumentProxy
*
))
,
this
,
SLOT
(
documentUpdated
(
UBDocumentProxy
*
)));
connect
(
this
,
SIGNAL
(
itemChanged
(
QTreeWidgetItem
*
,
int
))
,
this
,
SLOT
(
itemChangedValidation
(
QTreeWidgetItem
*
,
int
)));
connect
(
this
,
SIGNAL
(
itemChanged
(
QTreeWidgetItem
*
,
int
))
connect
(
mScrollTimer
,
SIGNAL
(
timeout
())
,
this
,
SLOT
(
autoScroll
()));
,
this
,
SLOT
(
itemChangedValidation
(
QTreeWidgetItem
*
,
int
)));
connect
(
this
,
SIGNAL
(
itemPressed
(
QTreeWidgetItem
*
,
int
)),
this
,
SLOT
(
onItemPressed
(
QTreeWidgetItem
*
,
int
)));
connect
(
mScrollTimer
,
SIGNAL
(
timeout
())
,
this
,
SLOT
(
autoScroll
()));
}
}
...
@@ -69,89 +65,31 @@ UBDocumentTreeWidget::~UBDocumentTreeWidget()
...
@@ -69,89 +65,31 @@ UBDocumentTreeWidget::~UBDocumentTreeWidget()
// NOOP
// NOOP
}
}
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
)
{
{
QString
emptyNameWarningTitle
=
tr
(
"Empty name"
);
if
(
column
==
0
)
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
)
{
{
QString
name
=
treeItem
->
text
(
column
);
if
(
name
.
isEmpty
()){
mFailedValidationForTreeItem
=
item
;
mFailedValidationItemColumn
=
column
;
UBApplication
::
mainWindow
->
warning
(
emptyNameWarningTitle
,
emptyNameWarningText
);
QTimer
::
singleShot
(
100
,
this
,
SLOT
(
validationFailed
()));
return
;
}
}
UBDocumentGroupTreeItem
*
group
=
dynamic_cast
<
UBDocumentGroupTreeItem
*>
(
item
);
UBDocumentGroupTreeItem
*
group
=
dynamic_cast
<
UBDocumentGroupTreeItem
*>
(
item
);
if
(
group
)
if
(
group
)
{
{
QString
name
=
group
->
text
(
column
);
QString
name
=
group
->
text
(
0
);
if
(
name
.
isEmpty
()){
mFailedValidationForTreeItem
=
item
;
mFailedValidationItemColumn
=
column
;
UBApplication
::
mainWindow
->
warning
(
emptyNameWarningTitle
,
emptyNameWarningText
);
QTimer
::
singleShot
(
100
,
this
,
SLOT
(
validationFailed
()));
return
;
}
if
(
group
->
parent
()){
for
(
int
i
=
0
;
i
<
topLevelItemCount
();
i
++
)
for
(
int
i
=
0
;
i
<
group
->
parent
()
->
childCount
();
i
++
)
{
{
QTreeWidgetItem
*
childAtPosition
=
group
->
parent
()
->
child
(
i
);
QTreeWidgetItem
*
someTopLevelItem
=
topLevelItem
(
i
);
if
(
childAtPosition
!=
item
&&
childAtPosition
->
text
(
column
)
==
name
){
if
(
someTopLevelItem
!=
group
&&
UBApplication
::
mainWindow
->
warning
(
alreadyExistsNameWarningTitle
,
alreadyExistsNameWarningText
);
someTopLevelItem
->
text
(
0
)
==
name
)
mFailedValidationForTreeItem
=
item
;
{
mFailedValidationItemColumn
=
column
;
group
->
setText
(
0
,
tr
(
"%1 (copy)"
).
arg
(
name
));
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
...
@@ -509,36 +447,6 @@ QString UBDocumentGroupTreeItem::groupName() const
...
@@ -509,36 +447,6 @@ 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
{
{
return
(
0
==
(
flags
()
&
Qt
::
ItemIsEditable
))
&&
UBApplication
::
app
()
->
documentController
&&
(
groupName
()
==
UBApplication
::
app
()
->
documentController
->
documentTrashGroupName
());
return
(
0
==
(
flags
()
&
Qt
::
ItemIsEditable
))
&&
UBApplication
::
app
()
->
documentController
&&
(
groupName
()
==
UBApplication
::
app
()
->
documentController
->
documentTrashGroupName
());
...
...
src/gui/UBDocumentTreeWidget.h
View file @
98e4abb7
...
@@ -54,9 +54,7 @@ class UBDocumentTreeWidget : public QTreeWidget
...
@@ -54,9 +54,7 @@ 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
;
...
@@ -64,10 +62,6 @@ class UBDocumentTreeWidget : public QTreeWidget
...
@@ -64,10 +62,6 @@ class UBDocumentTreeWidget : public QTreeWidget
QBrush
mBackground
;
QBrush
mBackground
;
QTimer
*
mScrollTimer
;
QTimer
*
mScrollTimer
;
int
mScrollMagnitude
;
int
mScrollMagnitude
;
QTreeWidgetItem
*
mFailedValidationForTreeItem
;
int
mFailedValidationItemColumn
;
QString
mLastItemCompletePath
;
QString
mLastItemName
;
};
};
...
@@ -98,11 +92,6 @@ class UBDocumentGroupTreeItem : public QTreeWidgetItem
...
@@ -98,11 +92,6 @@ 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