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
17d8d095
Commit
17d8d095
authored
Jul 31, 2018
by
Clément Fauconnier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed sortOrder style + resized splitter sizes
parent
34d5b3b5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
53 deletions
+96
-53
OpenBoard.qrc
resources/OpenBoard.qrc
+2
-0
documents.ui
resources/forms/documents.ui
+78
-22
asc.png
resources/images/asc.png
+0
-0
desc.png
resources/images/desc.png
+0
-0
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+15
-27
UBDocumentController.h
src/document/UBDocumentController.h
+1
-4
No files found.
resources/OpenBoard.qrc
View file @
17d8d095
...
...
@@ -362,5 +362,7 @@
<file>images/backgroundPalette/resetDefaultGridSize.svg</file>
<file>images/collapse-all.png</file>
<file>images/expand-all.png</file>
<file>images/asc.png</file>
<file>images/desc.png</file>
</qresource>
</RCC>
resources/forms/documents.ui
View file @
17d8d095
...
...
@@ -62,34 +62,32 @@
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<item>
<widget
class=
"QComboBox"
name=
"sortOrder"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Fixed"
>
<horstretch>
2
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<item>
<property
name=
"text"
>
<string>
Ascending order
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Descending order
</string>
</property>
</item>
</widget>
</item>
<property
name=
"sizeConstraint"
>
<enum>
QLayout::SetMinimumSize
</enum>
</property>
<item>
<widget
class=
"QComboBox"
name=
"sortKind"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"
Preferred
"
vsizetype=
"Fixed"
>
<sizepolicy
hsizetype=
"
Minimum
"
vsizetype=
"Fixed"
>
<horstretch>
4
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
200
</width>
<height>
16777215
</height>
</size>
</property>
<property
name=
"styleSheet"
>
<string
notr=
"true"
/>
</property>
<property
name=
"sizeAdjustPolicy"
>
<enum>
QComboBox::AdjustToMinimumContentsLength
</enum>
</property>
<property
name=
"minimumContentsLength"
>
<number>
0
</number>
</property>
<item>
<property
name=
"text"
>
<string>
Creation date
</string>
...
...
@@ -107,6 +105,62 @@
</item>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeType"
>
<enum>
QSizePolicy::Fixed
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
10
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QToolButton"
name=
"sortOrder"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Fixed"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"toolTip"
>
<string>
Sort Order
</string>
</property>
<property
name=
"styleSheet"
>
<string
notr=
"true"
>
QToolButton { border-style:none; border-width: 0px;margin-left:2px;margin-right:2px}
</string>
</property>
<property
name=
"text"
>
<string
notr=
"true"
/>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../OpenBoard.qrc"
>
<normaloff>
:/images/asc.png
</normaloff>
<normalon>
:/images/desc.png
</normalon>
:/images/asc.png
</iconset>
</property>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
...
...
@@ -302,6 +356,8 @@
<header>
document/UBDocumentController.h
</header>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include
location=
"../OpenBoard.qrc"
/>
</resources>
<connections/>
</ui>
resources/images/asc.png
0 → 100644
View file @
17d8d095
309 Bytes
resources/images/desc.png
0 → 100644
View file @
17d8d095
301 Bytes
src/document/UBDocumentController.cpp
View file @
17d8d095
...
...
@@ -1643,8 +1643,6 @@ UBDocumentController::UBDocumentController(UBMainWindow* mainWindow)
setupToolbar
();
connect
(
this
,
SIGNAL
(
exportDone
()),
mMainWindow
,
SLOT
(
onExportDone
()));
connect
(
this
,
SIGNAL
(
documentThumbnailsUpdated
(
UBDocumentContainer
*
)),
this
,
SLOT
(
refreshDocumentThumbnailsView
(
UBDocumentContainer
*
)));
mUserHasChangedSortOrder
=
false
;
}
UBDocumentController
::~
UBDocumentController
()
...
...
@@ -1980,13 +1978,16 @@ void UBDocumentController::setupViews()
mSortFilterProxyModel
->
setSourceModel
(
model
);
// sort documents according to preferences
int
sortKind
=
UBSettings
::
settings
()
->
documentSortKind
->
get
().
toInt
();
int
sortOrder
=
UBSettings
::
settings
()
->
documentSortOrder
->
get
().
toInt
();
mUserHasChangedSortOrder
=
true
;
int
sortOrder
=
UBSettings
::
settings
()
->
documentSortOrder
->
get
().
toInt
();
sortDocuments
(
sortKind
,
sortOrder
);
// update icon and button
mDocumentUI
->
sortKind
->
setCurrentIndex
(
sortKind
);
mDocumentUI
->
sortOrder
->
setCurrentIndex
(
sortOrder
);
if
(
sortOrder
==
UBDocumentController
::
DESC
)
mDocumentUI
->
sortOrder
->
setChecked
(
true
);
mDocumentUI
->
documentTreeView
->
setModel
(
mSortFilterProxyModel
);
...
...
@@ -2002,15 +2003,15 @@ void UBDocumentController::setupViews()
//set sizes (left and right sides of the splitter) for the splitter here because it cannot be done in the form editor.
const
int
leftSplitterSize
=
100
;
const
int
rightSplitterSize
=
9
00
;
const
int
rightSplitterSize
=
12
00
;
QList
<
int
>
splitterSizes
=
{
leftSplitterSize
,
rightSplitterSize
};
mDocumentUI
->
splitter
->
setSizes
(
splitterSizes
);
mDocumentUI
->
documentTreeView
->
hideColumn
(
1
);
//
mDocumentUI->documentTreeView->hideColumn(1);
mDocumentUI
->
documentTreeView
->
hideColumn
(
2
);
connect
(
mDocumentUI
->
sortKind
,
SIGNAL
(
activated
(
int
)),
this
,
SLOT
(
onSortKindChanged
(
int
)));
connect
(
mDocumentUI
->
sortOrder
,
SIGNAL
(
activated
(
int
)),
this
,
SLOT
(
onSortOrderChanged
(
int
)));
connect
(
mDocumentUI
->
sortOrder
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
onSortOrderChanged
(
bool
)));
connect
(
mDocumentUI
->
documentTreeView
->
itemDelegate
(),
SIGNAL
(
closeEditor
(
QWidget
*
,
QAbstractItemDelegate
::
EndEditHint
)
),
mDocumentUI
->
documentTreeView
,
SLOT
(
adjustSize
()));
connect
(
mDocumentUI
->
documentTreeView
->
selectionModel
(),
SIGNAL
(
selectionChanged
(
QItemSelection
,
QItemSelection
)),
this
,
SLOT
(
TreeViewSelectionChanged
(
QItemSelection
,
QItemSelection
)));
...
...
@@ -2046,20 +2047,8 @@ void UBDocumentController::setupViews()
void
UBDocumentController
::
sortDocuments
(
int
kind
,
int
order
)
{
Qt
::
SortOrder
sortOrder
=
Qt
::
AscendingOrder
;
//if the user hasn't change the sort
//set order to its default value according to
//the kind of sort
if
(
!
mUserHasChangedSortOrder
){
if
(
kind
==
UBDocumentController
::
CreationDate
||
kind
==
UBDocumentController
::
UpdateDate
){
sortOrder
=
Qt
::
DescendingOrder
;
mDocumentUI
->
sortOrder
->
setCurrentIndex
(
1
);
}
else
{
mDocumentUI
->
sortOrder
->
setCurrentIndex
(
0
);
}
}
else
if
(
order
==
UBDocumentController
::
DESC
){
if
(
order
==
UBDocumentController
::
DESC
)
sortOrder
=
Qt
::
DescendingOrder
;
}
if
(
kind
==
UBDocumentController
::
CreationDate
){
mSortFilterProxyModel
->
setSortRole
(
UBDocumentTreeModel
::
CreationDate
);
...
...
@@ -2073,22 +2062,21 @@ void UBDocumentController::sortDocuments(int kind, int order)
}
}
void
UBDocumentController
::
onSortOrderChanged
(
int
index
)
void
UBDocumentController
::
onSortOrderChanged
(
bool
order
)
{
int
kindIndex
=
mDocumentUI
->
sortKind
->
currentIndex
();
int
orderIndex
=
order
?
UBDocumentController
::
DESC
:
UBDocumentController
::
ASC
;
mUserHasChangedSortOrder
=
true
;
sortDocuments
(
kindIndex
,
index
);
sortDocuments
(
kindIndex
,
orderIndex
);
}
void
UBDocumentController
::
onSortKindChanged
(
int
index
)
{
int
orderIndex
=
mDocumentUI
->
sortOrder
->
currentIndex
()
;
int
orderIndex
=
mDocumentUI
->
sortOrder
->
isChecked
()
?
UBDocumentController
::
DESC
:
UBDocumentController
::
ASC
;
sortDocuments
(
index
,
orderIndex
);
}
//N/C - NNE - 20140403 : END
QWidget
*
UBDocumentController
::
controlView
()
{
...
...
src/document/UBDocumentController.h
View file @
17d8d095
...
...
@@ -445,7 +445,7 @@ class UBDocumentController : public UBDocumentContainer
//N/C - NNE - 20140403
void
onSortKindChanged
(
int
index
);
void
onSortOrderChanged
(
int
index
);
void
onSortOrderChanged
(
bool
order
);
void
collapseAll
();
void
expandAll
();
...
...
@@ -488,9 +488,6 @@ protected:
UBSortFilterProxyModel
*
mSortFilterProxyModel
;
//N/C - NNE - 20140407
bool
mUserHasChangedSortOrder
;
public
slots
:
void
TreeViewSelectionChanged
(
const
QModelIndex
&
current
,
const
QModelIndex
&
previous
);
void
TreeViewSelectionChanged
(
const
QItemSelection
&
selected
,
const
QItemSelection
&
deselected
);
...
...
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