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
b94ec807
Commit
b94ec807
authored
Sep 17, 2018
by
Clément Fauconnier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed a bunch of issues related to new document mode
parent
1432af69
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
18 deletions
+53
-18
UBBoardController.cpp
src/board/UBBoardController.cpp
+4
-0
UBBoardController.h
src/board/UBBoardController.h
+1
-0
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+44
-16
UBDocumentController.h
src/document/UBDocumentController.h
+1
-1
UBStringUtils.cpp
src/frameworks/UBStringUtils.cpp
+3
-1
No files found.
src/board/UBBoardController.cpp
View file @
b94ec807
...
...
@@ -1840,6 +1840,10 @@ int UBBoardController::activeSceneIndex() const
return
mActiveSceneIndex
;
}
void
UBBoardController
::
setActiveSceneIndex
(
int
i
)
{
mActiveSceneIndex
=
i
;
}
void
UBBoardController
::
documentSceneChanged
(
UBDocumentProxy
*
pDocumentProxy
,
int
pIndex
)
{
...
...
src/board/UBBoardController.h
View file @
b94ec807
...
...
@@ -79,6 +79,7 @@ class UBBoardController : public UBDocumentContainer
UBGraphicsScene
*
activeScene
()
const
;
int
activeSceneIndex
()
const
;
void
setActiveSceneIndex
(
int
i
);
QSize
displayViewport
();
QSize
controlViewport
();
QRectF
controlGeometry
();
...
...
src/document/UBDocumentController.cpp
View file @
b94ec807
...
...
@@ -456,9 +456,9 @@ QVariant UBDocumentTreeModel::data(const QModelIndex &index, int role) const
QDateTime
d
;
if
(
index
.
column
()
==
1
){
d
=
proxy
->
metaData
(
UBSettings
::
documentDate
).
toDateTim
e
();
d
=
proxy
->
documentDat
e
();
}
else
if
(
index
.
column
()
==
2
){
d
=
proxy
->
metaData
(
UBSettings
::
documentUpdatedAt
).
toDateTim
e
();
d
=
proxy
->
lastUpdat
e
();
}
displayText
=
d
.
toString
(
"dd/MM/yyyy hh:mm"
);
...
...
@@ -1571,15 +1571,13 @@ void UBDocumentTreeItemDelegate::processChangedText(const QString &str) const
bool
UBDocumentTreeItemDelegate
::
validateString
(
const
QString
&
str
)
const
{
return
QRegExp
(
"[^
\\
/
\\
:
\\
?
\\
*
\\
|
\\
<
\\
>
\\\"
]{1,}"
).
exactMatch
(
str
)
&&
!
mExistingFileNames
.
contains
(
str
);
return
!
mExistingFileNames
.
contains
(
str
);
}
QWidget
*
UBDocumentTreeItemDelegate
::
createEditor
(
QWidget
*
parent
,
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
{
Q_UNUSED
(
option
);
//N/C - NNE - 20140407 : Add the test for the index column.
if
(
index
.
column
()
==
0
){
mExistingFileNames
.
clear
();
...
...
@@ -2055,9 +2053,13 @@ void UBDocumentController::sortDocuments(int kind, int order)
if
(
kind
==
UBDocumentController
::
CreationDate
){
mSortFilterProxyModel
->
setSortRole
(
UBDocumentTreeModel
::
CreationDate
);
mSortFilterProxyModel
->
sort
(
1
,
sortOrder
);
mDocumentUI
->
documentTreeView
->
showColumn
(
1
);
mDocumentUI
->
documentTreeView
->
hideColumn
(
2
);
}
else
if
(
kind
==
UBDocumentController
::
UpdateDate
){
mSortFilterProxyModel
->
setSortRole
(
UBDocumentTreeModel
::
UpdateDate
);
mSortFilterProxyModel
->
sort
(
2
,
sortOrder
);
mDocumentUI
->
documentTreeView
->
hideColumn
(
1
);
mDocumentUI
->
documentTreeView
->
showColumn
(
2
);
}
else
{
mSortFilterProxyModel
->
setSortRole
(
Qt
::
DisplayRole
);
mSortFilterProxyModel
->
sort
(
0
,
sortOrder
);
...
...
@@ -2550,9 +2552,16 @@ void UBDocumentController::importFile()
QApplication
::
processEvents
();
QFile
selectedFile
(
filePath
);
QString
groupName
=
UBPersistenceManager
::
myDocumentsName
;
UBDocumentTreeModel
*
docModel
=
UBPersistenceManager
::
persistenceManager
()
->
mDocumentTreeStructureModel
;
groupName
=
""
;
QModelIndex
selectedIndex
=
firstSelectedTreeIndex
();
QString
groupName
=
""
;
if
(
selectedIndex
.
isValid
())
{
groupName
=
docModel
->
isCatalog
(
selectedIndex
)
?
docModel
->
virtualPathForIndex
(
selectedIndex
)
:
docModel
->
virtualDirForIndex
(
selectedIndex
);
}
showMessage
(
tr
(
"Importing file %1..."
).
arg
(
fileInfo
.
baseName
()),
true
);
...
...
@@ -2800,9 +2809,8 @@ void UBDocumentController::addToDocument()
void
UBDocumentController
::
renameSelectedItem
()
{
QModelIndex
selectedIndex
=
firstSelectedTreeIndex
();
if
(
selectedIndex
.
isValid
())
{
mDocumentUI
->
documentTreeView
->
edit
(
selectedIndex
);
if
(
mDocumentUI
->
documentTreeView
->
currentIndex
().
isValid
())
{
mDocumentUI
->
documentTreeView
->
edit
(
mDocumentUI
->
documentTreeView
->
currentIndex
());
}
}
...
...
@@ -3159,6 +3167,11 @@ void UBDocumentController::deletePages(QList<QGraphicsItem *> itemsToDelete)
foreach
(
int
i
,
sceneIndexes
)
minIndex
=
qMin
(
i
,
minIndex
);
if
(
mBoardController
->
activeSceneIndex
()
>
minIndex
)
{
mBoardController
->
setActiveSceneIndex
(
minIndex
);
}
mDocumentUI
->
thumbnailWidget
->
selectItemAt
(
minIndex
);
mBoardController
->
setActiveDocumentScene
(
minIndex
);
...
...
@@ -3214,8 +3227,9 @@ UBDocumentController::deletionTypeForSelection(LastSelectedElementType pTypeSele
,
const
QModelIndex
&
selectedIndex
,
UBDocumentTreeModel
*
docModel
)
const
{
if
(
pTypeSelection
==
Page
)
{
if
(
!
firstSceneSelected
())
{
if
(
!
first
AndOnly
SceneSelected
())
{
return
DeletePage
;
}
}
else
if
(
docModel
->
isConstant
(
selectedIndex
))
{
...
...
@@ -3234,17 +3248,31 @@ UBDocumentController::deletionTypeForSelection(LastSelectedElementType pTypeSele
return
NoDeletion
;
}
bool
UBDocumentController
::
firstSceneSelected
()
const
bool
UBDocumentController
::
first
AndOnly
SceneSelected
()
const
{
bool
firstSceneSelected
=
false
;
QList
<
QGraphicsItem
*>
selection
=
mDocumentUI
->
thumbnailWidget
->
selectedItems
();
for
(
int
i
=
0
;
i
<
selection
.
count
()
&&
!
firstSceneSelected
;
i
+=
1
){
if
(
dynamic_cast
<
UBSceneThumbnailPixmap
*>
(
selection
.
at
(
i
))
->
sceneIndex
()
==
0
){
firstSceneSelected
=
true
;
for
(
int
i
=
0
;
i
<
selection
.
count
()
&&
!
firstSceneSelected
;
i
+=
1
)
{
UBSceneThumbnailPixmap
*
p
=
dynamic_cast
<
UBSceneThumbnailPixmap
*>
(
selection
.
at
(
i
));
if
(
p
)
{
int
pageCount
=
p
->
proxy
()
->
pageCount
();
if
(
pageCount
>
1
)
//not the only scene
{
return
false
;
}
else
{
if
(
p
->
sceneIndex
()
==
0
)
{
return
true
;
//the first and only scene
}
}
}
}
return
f
irstSceneSelected
;
return
f
alse
;
}
void
UBDocumentController
::
refreshDocumentThumbnailsView
(
UBDocumentContainer
*
)
...
...
src/document/UBDocumentController.h
View file @
b94ec807
...
...
@@ -386,7 +386,7 @@ class UBDocumentController : public UBDocumentContainer
inline
DeletionType
deletionTypeForSelection
(
LastSelectedElementType
pTypeSelection
,
const
QModelIndex
&
selectedIndex
,
UBDocumentTreeModel
*
docModel
)
const
;
bool
firstSceneSelected
()
const
;
bool
first
AndOnly
SceneSelected
()
const
;
QWidget
*
mainWidget
()
const
{
return
mDocumentWidget
;}
//issue 1629 - NNE - 20131212
...
...
src/frameworks/UBStringUtils.cpp
View file @
b94ec807
...
...
@@ -122,7 +122,9 @@ QString UBStringUtils::toUtcIsoDateTime(const QDateTime& dateTime)
QDateTime
UBStringUtils
::
fromUtcIsoDate
(
const
QString
&
dateString
)
{
return
QDateTime
::
fromString
(
dateString
,
Qt
::
ISODate
).
toLocalTime
();
QDateTime
date
=
QDateTime
::
fromString
(
dateString
,
Qt
::
ISODate
);
date
.
setTimeSpec
(
Qt
::
UTC
);
return
date
.
toLocalTime
();
}
...
...
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