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
febb286c
Commit
febb286c
authored
Nov 08, 2011
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed cache issue
parent
f1176986
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
36 deletions
+62
-36
UBCachePropertiesWidget.cpp
src/gui/UBCachePropertiesWidget.cpp
+62
-36
No files found.
src/gui/UBCachePropertiesWidget.cpp
View file @
febb286c
...
...
@@ -6,6 +6,7 @@
#include "UBCachePropertiesWidget.h"
#include "core/UBApplication.h"
#include "core/UBApplicationController.h"
#include "board/UBBoardController.h"
#include "domain/UBGraphicsScene.h"
...
...
@@ -91,7 +92,7 @@ UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *na
mpSizeLabel
=
new
QLabel
(
tr
(
"Size:"
),
mpProperties
);
mpSizeSlider
=
new
QSlider
(
Qt
::
Horizontal
,
mpProperties
);
mpSizeSlider
->
setMinimumHeight
(
20
);
mpSizeSlider
->
setMinimum
(
0
);
mpSizeSlider
->
setMinimum
(
5
0
);
mpSizeSlider
->
setMaximum
(
MAX_SHAPE_WIDTH
);
mpSizeLayout
->
addWidget
(
mpSizeLabel
,
0
);
mpSizeLayout
->
addWidget
(
mpSizeSlider
,
1
);
...
...
@@ -204,16 +205,21 @@ UBCachePropertiesWidget::~UBCachePropertiesWidget()
void
UBCachePropertiesWidget
::
onCloseClicked
()
{
// Remove the current cache from the list
mCaches
.
remove
(
mCaches
.
indexOf
(
mpCurrentCache
));
if
(
!
mCaches
.
empty
())
{
// Remove the current cache from the list
mCaches
.
remove
(
mCaches
.
indexOf
(
mpCurrentCache
));
// Remove the cache from the board
UBApplication
::
boardController
->
activeScene
()
->
removeItem
(
mpCurrentCache
);
mpCurrentCache
=
NULL
;
// Remove the cache from the board
UBApplication
::
boardController
->
activeScene
()
->
removeItem
(
mpCurrentCache
);
mpCurrentCache
=
NULL
;
if
(
mCaches
.
empty
())
{
emit
cacheListEmpty
();
if
(
mCaches
.
empty
())
{
emit
cacheListEmpty
();
}
emit
hideTab
(
name
());
}
}
...
...
@@ -269,40 +275,59 @@ void UBCachePropertiesWidget::updateShapeButtons()
void
UBCachePropertiesWidget
::
updateCurrentCache
()
{
// Get the current page cache
QList
<
QGraphicsItem
*>
items
=
UBApplication
::
boardController
->
activeScene
()
->
items
();
foreach
(
QGraphicsItem
*
it
,
items
)
bool
isBoardMode
=
false
;
// this widget can work only on Board mode
if
(
UBApplication
::
applicationController
!=
NULL
)
{
if
(
"Cache"
==
it
->
data
(
Qt
::
UserRole
).
toString
())
{
setEnabled
(
true
);
emit
showTab
(
name
());
mpCurrentCache
=
dynamic_cast
<
UBGraphicsCache
*>
(
it
);
if
((
NULL
!=
mpCurrentCache
)
&&
(
!
mCaches
.
contains
(
mpCurrentCache
)))
{
mCaches
.
append
(
mpCurrentCache
);
}
// if app controller is available, and current mode is Board, and no show desktop, than all ok, just process
if
(
UBApplication
::
applicationController
->
displayMode
()
==
UBApplicationController
::
Board
&&
!
UBApplication
::
applicationController
->
isShowingDesktop
())
isBoardMode
=
true
;
}
// if app controller == null, than we do not know what mode now, so just process
else
isBoardMode
=
true
;
// Update the values of the cache properties
mpSizeSlider
->
setValue
(
mpCurrentCache
->
shapeWidth
());
updateCacheColor
(
mpCurrentCache
->
maskColor
());
switch
(
mpCurrentCache
->
maskshape
())
if
(
isBoardMode
)
{
// Get the current page cache
QList
<
QGraphicsItem
*>
items
=
UBApplication
::
boardController
->
activeScene
()
->
items
();
foreach
(
QGraphicsItem
*
it
,
items
)
{
if
(
"Cache"
==
it
->
data
(
Qt
::
UserRole
).
toString
())
{
case
eMaskShape_Circle
:
mpCircleButton
->
setChecked
(
true
);
mpSquareButton
->
setChecked
(
false
);
break
;
case
eMaskShap_Rectangle
:
mpCircleButton
->
setChecked
(
false
);
mpSquareButton
->
setChecked
(
true
);
break
;
setEnabled
(
true
);
emit
showTab
(
name
());
mpCurrentCache
=
dynamic_cast
<
UBGraphicsCache
*>
(
it
);
if
((
NULL
!=
mpCurrentCache
)
&&
(
!
mCaches
.
contains
(
mpCurrentCache
)))
{
mCaches
.
append
(
mpCurrentCache
);
}
// Update the values of the cache properties
mpSizeSlider
->
setValue
(
mpCurrentCache
->
shapeWidth
());
updateCacheColor
(
mpCurrentCache
->
maskColor
());
switch
(
mpCurrentCache
->
maskshape
())
{
case
eMaskShape_Circle
:
mpCircleButton
->
setChecked
(
true
);
mpSquareButton
->
setChecked
(
false
);
break
;
case
eMaskShap_Rectangle
:
mpCircleButton
->
setChecked
(
false
);
mpSquareButton
->
setChecked
(
true
);
break
;
}
return
;
}
return
;
}
}
// If we fall here, that means that this page has no cache
// If we fall here, that means:
// 1 - that this page has no cache
// 2 - we are not in Board mode
// 3 - we are in Board mode, but show desktop (as really - Desktop mode)
emit
hideTab
(
name
());
mpCurrentCache
=
NULL
;
setDisabled
(
true
);
...
...
@@ -320,3 +345,4 @@ void UBCachePropertiesWidget::onCacheEnabled()
{
emit
showTab
(
name
());
}
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