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
41c50a2c
Commit
41c50a2c
authored
Sep 18, 2018
by
Clément Fauconnier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new document and new folder editable at creation + expand path if needed
parent
3a4843f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
14 deletions
+18
-14
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+2
-2
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+13
-9
UBDocumentController.h
src/document/UBDocumentController.h
+3
-3
No files found.
src/core/UBPersistenceManager.cpp
View file @
41c50a2c
...
...
@@ -532,8 +532,8 @@ void UBPersistenceManager::deleteDocument(UBDocumentProxy* pDocumentProxy)
emit
documentWillBeDeleted
(
pDocumentProxy
);
Q_ASSERT
(
QFileInfo
(
pDocumentProxy
->
persistencePath
()).
exists
());
UBFileSystemUtils
::
deleteDir
(
pDocumentProxy
->
persistencePath
());
if
(
QFileInfo
(
pDocumentProxy
->
persistencePath
()).
exists
())
UBFileSystemUtils
::
deleteDir
(
pDocumentProxy
->
persistencePath
());
mSceneCache
.
removeAllScenes
(
pDocumentProxy
);
...
...
src/document/UBDocumentController.cpp
View file @
41c50a2c
...
...
@@ -1109,14 +1109,14 @@ void UBDocumentTreeModel::addNewDocument(UBDocumentProxy *pProxyData, const QMod
mNewDocuments
<<
pProxyData
;
}
void
UBDocumentTreeModel
::
addCatalog
(
const
QString
&
pName
,
const
QModelIndex
&
pParent
)
QModelIndex
UBDocumentTreeModel
::
addCatalog
(
const
QString
&
pName
,
const
QModelIndex
&
pParent
)
{
if
(
pName
.
isEmpty
()
||
!
pParent
.
isValid
())
{
return
;
return
QModelIndex
()
;
}
UBDocumentTreeNode
*
catalogNode
=
new
UBDocumentTreeNode
(
UBDocumentTreeNode
::
Catalog
,
pName
);
addNode
(
catalogNode
,
pParent
);
return
addNode
(
catalogNode
,
pParent
);
}
void
UBDocumentTreeModel
::
setNewName
(
const
QModelIndex
&
index
,
const
QString
&
newName
)
...
...
@@ -1272,7 +1272,7 @@ UBDocumentTreeView::UBDocumentTreeView(QWidget *parent) : QTreeView(parent)
setRootIsDecorated
(
true
);
}
void
UBDocumentTreeView
::
setSelectedAndExpanded
(
const
QModelIndex
&
pIndex
,
bool
pExpand
)
void
UBDocumentTreeView
::
setSelectedAndExpanded
(
const
QModelIndex
&
pIndex
,
bool
pExpand
,
bool
pEdit
)
{
if
(
!
pIndex
.
isValid
())
{
return
;
...
...
@@ -1287,7 +1287,7 @@ void UBDocumentTreeView::setSelectedAndExpanded(const QModelIndex &pIndex, bool
?
QItemSelectionModel
::
Select
:
QItemSelectionModel
::
Deselect
;
selectionModel
()
->
select
(
proxy
->
mapFromSource
(
indexCurrentDoc
),
QItemSelectionModel
::
Rows
|
sel
);
selectionModel
()
->
select
(
proxy
->
mapFromSource
(
indexCurrentDoc
),
QItemSelectionModel
::
Rows
|
sel
);
setCurrentIndex
(
pExpand
?
indexCurrentDoc
...
...
@@ -1299,6 +1299,9 @@ void UBDocumentTreeView::setSelectedAndExpanded(const QModelIndex &pIndex, bool
}
scrollTo
(
proxy
->
mapFromSource
(
pIndex
),
QAbstractItemView
::
PositionAtCenter
);
if
(
pEdit
)
edit
(
proxy
->
mapFromSource
(
pIndex
));
}
void
UBDocumentTreeView
::
onModelIndexChanged
(
const
QModelIndex
&
pNewIndex
,
const
QModelIndex
&
pOldIndex
)
...
...
@@ -1660,14 +1663,14 @@ void UBDocumentController::createNewDocument()
:
docModel
->
virtualDirForIndex
(
selectedIndex
);
UBDocumentProxy
*
document
=
pManager
->
createDocument
(
groupName
);
selectDocument
(
document
);
selectDocument
(
document
,
true
,
false
,
true
);
if
(
document
)
pManager
->
mDocumentTreeStructureModel
->
markDocumentAsNew
(
document
);
}
}
void
UBDocumentController
::
selectDocument
(
UBDocumentProxy
*
proxy
,
bool
setAsCurrentDocument
,
const
bool
onImport
)
void
UBDocumentController
::
selectDocument
(
UBDocumentProxy
*
proxy
,
bool
setAsCurrentDocument
,
const
bool
onImport
,
const
bool
editMode
)
{
if
(
proxy
==
NULL
)
{
...
...
@@ -1678,7 +1681,7 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr
if
(
setAsCurrentDocument
)
{
UBPersistenceManager
::
persistenceManager
()
->
mDocumentTreeStructureModel
->
setCurrentDocument
(
proxy
);
QModelIndex
indexCurrentDoc
=
UBPersistenceManager
::
persistenceManager
()
->
mDocumentTreeStructureModel
->
indexForProxy
(
proxy
);
mDocumentUI
->
documentTreeView
->
setSelectedAndExpanded
(
indexCurrentDoc
,
true
);
mDocumentUI
->
documentTreeView
->
setSelectedAndExpanded
(
indexCurrentDoc
,
true
,
editMode
);
if
(
proxy
!=
mBoardController
->
selectedDocument
())
// only if wanted Document is different from document actually on Board, // ALTI/AOU - 20140217
{
...
...
@@ -1705,7 +1708,8 @@ void UBDocumentController::createNewDocumentGroup()
QString
newFolderName
=
docModel
->
adjustNameForParentIndex
(
tr
(
"New Folder"
),
parentIndex
);
docModel
->
addCatalog
(
newFolderName
,
parentIndex
);
QModelIndex
newIndex
=
docModel
->
addCatalog
(
newFolderName
,
parentIndex
);
mDocumentUI
->
documentTreeView
->
setSelectedAndExpanded
(
newIndex
,
true
,
true
);
}
...
...
src/document/UBDocumentController.h
View file @
41c50a2c
...
...
@@ -208,7 +208,7 @@ public:
UBDocumentProxy
*
proxyData
(
const
QModelIndex
&
index
)
const
{
return
nodeFromIndex
(
index
)
->
proxyData
();}
void
addDocument
(
UBDocumentProxy
*
pProxyData
,
const
QModelIndex
&
pParent
=
QModelIndex
());
void
addNewDocument
(
UBDocumentProxy
*
pProxyData
,
const
QModelIndex
&
pParent
=
QModelIndex
());
void
addCatalog
(
const
QString
&
pName
,
const
QModelIndex
&
pParent
);
QModelIndex
addCatalog
(
const
QString
&
pName
,
const
QModelIndex
&
pParent
);
QList
<
UBDocumentProxy
*>
newDocuments
()
{
return
mNewDocuments
;}
void
markDocumentAsNew
(
UBDocumentProxy
*
pDoc
)
{
if
(
indexForProxy
(
pDoc
).
isValid
())
mNewDocuments
<<
pDoc
;}
void
setNewName
(
const
QModelIndex
&
index
,
const
QString
&
newName
);
...
...
@@ -286,7 +286,7 @@ public:
QModelIndexList
mapIndexesToSource
(
const
QModelIndexList
&
indexes
);
public
slots
:
void
setSelectedAndExpanded
(
const
QModelIndex
&
pIndex
,
bool
pExpand
=
true
);
void
setSelectedAndExpanded
(
const
QModelIndex
&
pIndex
,
bool
pExpand
=
true
,
bool
pEdit
=
false
);
void
onModelIndexChanged
(
const
QModelIndex
&
pNewIndex
,
const
QModelIndex
&
pOldIndex
);
void
hSliderRangeChanged
(
int
min
,
int
max
);
...
...
@@ -429,7 +429,7 @@ class UBDocumentController : public UBDocumentContainer
void
duplicateSelectedItem
();
void
importFile
();
void
moveSceneToIndex
(
UBDocumentProxy
*
proxy
,
int
source
,
int
target
);
void
selectDocument
(
UBDocumentProxy
*
proxy
,
bool
setAsCurrentDocument
=
true
,
const
bool
onImport
=
false
);
void
selectDocument
(
UBDocumentProxy
*
proxy
,
bool
setAsCurrentDocument
=
true
,
const
bool
onImport
=
false
,
const
bool
editMode
=
false
);
void
show
();
void
hide
();
void
showMessage
(
const
QString
&
message
,
bool
showSpinningWheel
=
false
);
...
...
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