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
104dfcd5
Commit
104dfcd5
authored
Sep 08, 2011
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolved a small issue on the cache widget management
parent
71b6a9d0
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
108 additions
and
44 deletions
+108
-44
UBBoardController.cpp
src/board/UBBoardController.cpp
+3
-1
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+1
-0
UBCachePropertiesWidget.cpp
src/gui/UBCachePropertiesWidget.cpp
+8
-4
UBCachePropertiesWidget.h
src/gui/UBCachePropertiesWidget.h
+1
-0
UBDockPalette.cpp
src/gui/UBDockPalette.cpp
+43
-0
UBDockPalette.h
src/gui/UBDockPalette.h
+9
-1
UBDockPaletteWidget.h
src/gui/UBDockPaletteWidget.h
+5
-0
UBRightPalette.cpp
src/gui/UBRightPalette.cpp
+36
-36
UBRightPalette.h
src/gui/UBRightPalette.h
+2
-2
No files found.
src/board/UBBoardController.cpp
View file @
104dfcd5
...
...
@@ -484,7 +484,6 @@ void UBBoardController::addScene(UBDocumentProxy* proxy, int sceneIndex, bool re
if
(
scene
)
{
addScene
(
scene
,
replaceActiveIfEmpty
);
emit
pageChanged
();
}
}
...
...
@@ -1159,7 +1158,10 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
mPaletteManager
->
leftPalette
()
->
pageNavigator
()
->
setDocument
(
pDocumentProxy
);
if
(
sceneChange
)
{
emit
activeSceneChanged
();
emit
pageChanged
();
}
}
...
...
src/domain/UBGraphicsScene.cpp
View file @
104dfcd5
...
...
@@ -1644,6 +1644,7 @@ void UBGraphicsScene::addCache()
cache
->
setVisible
(
true
);
cache
->
setSelected
(
true
);
UBApplication
::
boardController
->
notifyCache
(
true
);
UBApplication
::
boardController
->
notifyPageChanged
();
}
void
UBGraphicsScene
::
addMask
()
...
...
src/gui/UBCachePropertiesWidget.cpp
View file @
104dfcd5
...
...
@@ -108,9 +108,6 @@ UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *na
// Fill the empty space
mpPropertiesLayout
->
addStretch
(
1
);
// Get the infos from the current cache
// ...
// Connect signals / slots
connect
(
mpCloseButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onCloseClicked
()));
connect
(
mpColor
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onColorClicked
()));
...
...
@@ -118,6 +115,7 @@ UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *na
connect
(
mpSquareButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
updateShapeButtons
()));
connect
(
mpSizeSlider
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
onSizeChanged
(
int
)));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
pageChanged
()),
this
,
SLOT
(
updateCurrentCache
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
cacheEnabled
()),
this
,
SLOT
(
onCacheEnabled
()));
}
UBCachePropertiesWidget
::~
UBCachePropertiesWidget
()
...
...
@@ -277,8 +275,8 @@ void UBCachePropertiesWidget::updateCurrentCache()
{
if
(
"Cache"
==
it
->
data
(
Qt
::
UserRole
).
toString
())
{
qDebug
()
<<
">>> Setting cache parameters"
;
setEnabled
(
true
);
emit
showTab
(
name
());
mpCurrentCache
=
dynamic_cast
<
UBGraphicsCache
*>
(
it
);
if
((
NULL
!=
mpCurrentCache
)
&&
(
!
mCaches
.
contains
(
mpCurrentCache
)))
{
...
...
@@ -305,6 +303,7 @@ void UBCachePropertiesWidget::updateCurrentCache()
}
// If we fall here, that means that this page has no cache
emit
hideTab
(
name
());
mpCurrentCache
=
NULL
;
setDisabled
(
true
);
}
...
...
@@ -316,3 +315,8 @@ void UBCachePropertiesWidget::onSizeChanged(int newSize)
mpCurrentCache
->
setShapeWidth
(
newSize
);
}
}
void
UBCachePropertiesWidget
::
onCacheEnabled
()
{
emit
showTab
(
name
());
}
src/gui/UBCachePropertiesWidget.h
View file @
104dfcd5
...
...
@@ -33,6 +33,7 @@ private slots:
void
onColorClicked
();
void
updateShapeButtons
();
void
onSizeChanged
(
int
newSize
);
void
onCacheEnabled
();
private
:
QVBoxLayout
*
mpLayout
;
...
...
src/gui/UBDockPalette.cpp
View file @
104dfcd5
...
...
@@ -517,8 +517,10 @@ void UBDockPalette::addTabWidget(UBDockPaletteWidget *widget)
{
if
(
!
mTabWidgets
.
contains
(
widget
))
{
widget
->
setVisible
(
true
);
mTabWidgets
.
append
(
widget
);
mpStackWidget
->
addWidget
(
widget
);
mpStackWidget
->
setCurrentWidget
(
widget
);
update
();
}
}
...
...
@@ -532,6 +534,7 @@ void UBDockPalette::removeTab(const QString &widgetName)
{
mpStackWidget
->
removeWidget
(
pCrntWidget
);
mTabWidgets
.
remove
(
i
);
pCrntWidget
->
hide
();
update
();
break
;
}
...
...
@@ -547,3 +550,43 @@ int UBDockPalette::tabSpacing()
{
return
2
;
}
// This method is used to show the tab widget
void
UBDockPalette
::
onShowTabWidget
(
const
QString
&
widgetName
)
{
for
(
int
i
=
0
;
i
<
mRegisteredWidgets
.
size
();
i
++
)
{
UBDockPaletteWidget
*
pCrntWidget
=
mRegisteredWidgets
.
at
(
i
);
if
(
NULL
!=
pCrntWidget
&&
(
pCrntWidget
->
name
()
==
widgetName
))
{
addTabWidget
(
pCrntWidget
);
break
;
}
}
}
// This method is used to hide the tab widget
void
UBDockPalette
::
onHideTabWidget
(
const
QString
&
widgetName
)
{
removeTab
(
widgetName
);
}
void
UBDockPalette
::
connectSignals
()
{
for
(
int
i
=
0
;
i
<
mRegisteredWidgets
.
size
();
i
++
)
{
connect
(
mRegisteredWidgets
.
at
(
i
),
SIGNAL
(
showTab
(
QString
)),
this
,
SLOT
(
onShowTabWidget
(
QString
)));
connect
(
mRegisteredWidgets
.
at
(
i
),
SIGNAL
(
hideTab
(
QString
)),
this
,
SLOT
(
onHideTabWidget
(
QString
)));
}
}
void
UBDockPalette
::
registerWidget
(
UBDockPaletteWidget
*
widget
)
{
if
(
!
mRegisteredWidgets
.
contains
(
widget
))
{
mRegisteredWidgets
.
append
(
widget
);
// By default, the widget is hidden
widget
->
hide
();
}
}
src/gui/UBDockPalette.h
View file @
104dfcd5
...
...
@@ -71,10 +71,16 @@ public:
virtual
void
leaveEvent
(
QEvent
*
);
void
setBackgroundBrush
(
const
QBrush
&
brush
);
void
registerWidget
(
UBDockPaletteWidget
*
widget
);
public
slots
:
void
onShowTabWidget
(
const
QString
&
widgetName
);
void
onHideTabWidget
(
const
QString
&
widgetName
);
protected
:
void
addTabWidget
(
UBDockPaletteWidget
*
widget
);
void
removeTab
(
const
QString
&
widgetName
);
void
connectSignals
();
virtual
int
border
();
virtual
int
radius
();
...
...
@@ -118,8 +124,10 @@ protected:
QVBoxLayout
*
mpLayout
;
/** The current tab index */
int
mCurrentTab
;
/** The tab widgets */
/** The
visible
tab widgets */
QVector
<
UBDockPaletteWidget
*>
mTabWidgets
;
/** The current widget */
QVector
<
UBDockPaletteWidget
*>
mRegisteredWidgets
;
private
slots
:
void
onToolbarPosUpdated
();
...
...
src/gui/UBDockPaletteWidget.h
View file @
104dfcd5
...
...
@@ -7,6 +7,7 @@
class
UBDockPaletteWidget
:
public
QWidget
{
Q_OBJECT
public
:
UBDockPaletteWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBDockPaletteWidget"
);
~
UBDockPaletteWidget
();
...
...
@@ -15,6 +16,10 @@ public:
QPixmap
iconToLeft
();
QString
name
();
signals
:
void
hideTab
(
const
QString
&
widgetName
);
void
showTab
(
const
QString
&
widgetName
);
protected
:
QPixmap
mIconToRight
;
// arrow like this: >
QPixmap
mIconToLeft
;
// arrow like this: <
...
...
src/gui/UBRightPalette.cpp
View file @
104dfcd5
...
...
@@ -28,16 +28,16 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name):UBDockPalette(
resize
(
UBSettings
::
settings
()
->
libPaletteWidth
->
get
().
toInt
(),
parentWidget
()
->
height
());
mpLayout
->
setContentsMargins
(
2
*
border
()
+
customMargin
(),
customMargin
(),
customMargin
(),
customMargin
());
//
Add the tab
widgets
//
Create and register the
widgets
mpLibWidget
=
new
UBLibWidget
(
this
);
addTabWidget
(
mpLibWidget
);
mpCachePropWidget
=
new
UBCachePropertiesWidget
(
this
);
mpCachePropWidget
->
hide
();
registerWidget
(
mpLibWidget
);
registerWidget
(
mpCachePropWidget
);
// Connect signals/slots
connect
(
UBApplication
::
boardController
,
SIGNAL
(
cacheEnabled
()),
this
,
SLOT
(
onCacheEnabled
()));
connect
(
mpCachePropWidget
,
SIGNAL
(
cacheListEmpty
()),
this
,
SLOT
(
onCacheDisabled
()));
// Add the visible widgets
addTabWidget
(
mpLibWidget
);
connectSignals
();
}
UBRightPalette
::~
UBRightPalette
()
...
...
@@ -85,32 +85,32 @@ void UBRightPalette::updateMaxWidth()
setMinimumHeight
(
parentWidget
()
->
height
());
}
void
UBRightPalette
::
onCacheEnabled
()
{
if
(
mpCachePropWidget
->
isHidden
())
{
mpCachePropWidget
->
setVisible
(
true
);
// Add the cache tab
addTabWidget
(
mpCachePropWidget
);
}
// Set the cache of the current page as the active one for the properties widget
mpCachePropWidget
->
updateCurrentCache
();
// Show the cache properties widget
for
(
int
i
=
0
;
i
<
mTabWidgets
.
size
();
i
++
)
{
if
((
NULL
!=
mTabWidgets
.
at
(
i
))
&&
(
"CachePropWidget"
==
mTabWidgets
.
at
(
i
)
->
name
()))
{
showTabWidget
(
i
);
break
;
}
}
}
void
UBRightPalette
::
onCacheDisabled
()
{
removeTab
(
mpCachePropWidget
->
name
());
mpCachePropWidget
->
hide
();
}
//
void UBRightPalette::onCacheEnabled()
//
{
//
if(mpCachePropWidget->isHidden())
//
{
//
mpCachePropWidget->setVisible(true);
//
// Add the cache tab
//
addTabWidget(mpCachePropWidget);
//
}
//
// Set the cache of the current page as the active one for the properties widget
//
mpCachePropWidget->updateCurrentCache();
//
// Show the cache properties widget
//
for(int i = 0; i < mTabWidgets.size(); i++)
//
{
//
if((NULL != mTabWidgets.at(i)) && ("CachePropWidget" == mTabWidgets.at(i)->name()))
//
{
//
showTabWidget(i);
//
break;
//
}
//
}
//
}
//
void UBRightPalette::onCacheDisabled()
//
{
//
removeTab(mpCachePropWidget->name());
//
mpCachePropWidget->hide();
//
}
src/gui/UBRightPalette.h
View file @
104dfcd5
...
...
@@ -37,8 +37,8 @@ protected:
void
resizeEvent
(
QResizeEvent
*
event
);
private
slots
:
void
onCacheEnabled
();
void
onCacheDisabled
();
//
void onCacheEnabled();
//
void onCacheDisabled();
private
:
UBLibWidget
*
mpLibWidget
;
...
...
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