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
fc15dfe4
Commit
fc15dfe4
authored
Jul 04, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exported all the logic for page actions on UBDocumentController
parent
8eebc632
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
30 deletions
+43
-30
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+26
-0
UBDocumentController.h
src/document/UBDocumentController.h
+5
-0
UBThumbnailWidget.cpp
src/gui/UBThumbnailWidget.cpp
+12
-30
No files found.
src/document/UBDocumentController.cpp
View file @
fc15dfe4
...
...
@@ -1645,3 +1645,29 @@ int UBDocumentController::getSelectedItemIndex()
}
else
return
-
1
;
}
bool
UBDocumentController
::
pageCanBeMovedUp
(
int
page
)
{
if
(
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
->
get
().
toBool
())
return
page
>=
2
;
else
return
page
>=
1
;
}
bool
UBDocumentController
::
pageCanBeMovedDown
(
int
page
)
{
if
(
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
->
get
().
toBool
())
return
page
!=
0
&&
page
<
mCurrentDocument
->
pageCount
()
-
1
;
else
return
page
<
mCurrentDocument
->
pageCount
()
-
1
;
}
bool
UBDocumentController
::
pageCanBeDuplicated
(
int
page
)
{
return
page
!=
0
;
}
bool
UBDocumentController
::
pageCanBeDeleted
(
int
page
)
{
return
page
!=
0
;
}
src/document/UBDocumentController.h
View file @
fc15dfe4
...
...
@@ -51,6 +51,11 @@ class UBDocumentController : public QObject
void
deletePages
(
QList
<
QGraphicsItem
*>
itemsToDelete
);
int
getSelectedItemIndex
();
bool
pageCanBeMovedUp
(
int
page
);
bool
pageCanBeMovedDown
(
int
page
);
bool
pageCanBeDuplicated
(
int
page
);
bool
pageCanBeDeleted
(
int
page
);
signals
:
void
refreshThumbnails
();
void
exportDone
();
...
...
src/gui/UBThumbnailWidget.cpp
View file @
fc15dfe4
...
...
@@ -823,40 +823,22 @@ void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *even
void
UBSceneThumbnailNavigPixmap
::
updateButtonsState
()
{
bCanDelete
=
false
;
bCanDelete
=
false
;
bCanMoveUp
=
false
;
bCanMoveDown
=
false
;
bCanDuplicate
=
true
;
UBDocumentProxy
*
p
=
proxy
();
if
(
NULL
!=
p
&&
0
<=
UBApplication
::
boardController
->
pageFromSceneIndex
(
sceneIndex
()))
{
int
iNbPages
=
p
->
pageCount
();
if
(
1
<
iNbPages
)
{
bCanDelete
=
true
;
if
(
sceneIndex
()
>
0
)
{
bCanMoveUp
=
true
;
}
if
(
sceneIndex
()
!=
iNbPages
-
1
)
{
bCanMoveDown
=
true
;
}
}
bCanDuplicate
=
false
;
if
(
proxy
()){
int
pageIndex
=
UBApplication
::
boardController
->
pageFromSceneIndex
(
sceneIndex
());
UBDocumentController
*
documentController
=
UBApplication
::
documentController
;
bCanDelete
=
documentController
->
pageCanBeDeleted
(
pageIndex
);
bCanMoveUp
=
documentController
->
pageCanBeMovedUp
(
pageIndex
);
bCanMoveDown
=
documentController
->
pageCanBeMovedDown
(
pageIndex
);
bCanDuplicate
=
documentController
->
pageCanBeDuplicated
(
pageIndex
);
}
if
(
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
&&
sceneIndex
()
<=
1
)
bCanMoveUp
=
false
;
if
(
UBSettings
::
settings
()
->
teacherGuidePageZeroActivated
&&
sceneIndex
()
==
0
){
bCanDelete
=
false
;
bCanDuplicate
=
false
;
bCanMoveUp
=
false
;
bCanMoveDown
=
false
;
}
if
(
bCanDelete
||
bCanMoveUp
||
bCanMoveDown
)
if
(
bCanDelete
||
bCanMoveUp
||
bCanMoveDown
||
bCanDuplicate
)
bButtonsVisible
=
true
;
}
...
...
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