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
6bbecff5
Commit
6bbecff5
authored
Jan 27, 2012
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http://188.165.53.52/jira/browse/SANKORE-329
Visibility of palette based on children elements
parent
aa6a893a
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
100 additions
and
63 deletions
+100
-63
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+12
-44
UBCachePropertiesWidget.h
src/gui/UBCachePropertiesWidget.h
+5
-0
UBDockDownloadWidget.h
src/gui/UBDockDownloadWidget.h
+6
-0
UBDockPalette.cpp
src/gui/UBDockPalette.cpp
+34
-1
UBDockPalette.h
src/gui/UBDockPalette.h
+15
-2
UBDockPaletteWidget.cpp
src/gui/UBDockPaletteWidget.cpp
+1
-7
UBDockPaletteWidget.h
src/gui/UBDockPaletteWidget.h
+2
-3
UBLeftPalette.cpp
src/gui/UBLeftPalette.cpp
+2
-1
UBLibWidget.h
src/gui/UBLibWidget.h
+6
-0
UBNavigatorPalette.cpp
src/gui/UBNavigatorPalette.cpp
+5
-4
UBPageNavigationWidget.h
src/gui/UBPageNavigationWidget.h
+5
-0
UBRightPalette.cpp
src/gui/UBRightPalette.cpp
+2
-1
UBTeacherBarWidget.h
src/gui/UBTeacherBarWidget.h
+5
-0
No files found.
src/board/UBBoardPaletteManager.cpp
View file @
6bbecff5
...
...
@@ -173,24 +173,18 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
// Create the widgets for the dock palettes
mpPageNavigWidget
=
new
UBPageNavigationWidget
();
mpPageNavigWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpPageNavigWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
mpLibWidget
=
new
UBLibWidget
();
mpLibWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
mpLibWidget
->
registerMode
(
eUBDockPaletteWidget_DESKTOP
);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpLibWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
mpCachePropWidget
=
new
UBCachePropertiesWidget
();
mpCachePropWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpCachePropWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
mpTeacherBarWidget
=
new
UBTeacherBarWidget
();
mpTeacherBarWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpTeacherBarWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
mpDownloadWidget
=
new
UBDockDownloadWidget
();
mpDownloadWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
// Add the dock palettes
mLeftPalette
=
new
UBLeftPalette
(
mContainer
);
...
...
@@ -689,38 +683,10 @@ void UBBoardPaletteManager::addItem(const QUrl& pUrl)
}
void
UBBoardPaletteManager
::
processPalettersWidget
(
UBDockPalette
*
paletter
,
eUBDockPaletteWidgetMode
mode
)
{
//-------------------------------//
// get full right palette widgets list, parse it, show all widgets for BOARD mode, and hide all other
QVector
<
UBDockPaletteWidget
*>
widgetsList
=
paletter
->
GetWidgetsList
();
for
(
int
i
=
0
;
i
<
widgetsList
.
size
();
i
++
)
{
UBDockPaletteWidget
*
pNextWidget
=
widgetsList
.
at
(
i
);
if
(
pNextWidget
!=
NULL
)
{
if
(
pNextWidget
->
GetRegisteredModes
().
contains
(
mode
)
)
{
paletter
->
addTab
(
pNextWidget
);
}
else
{
paletter
->
removeTab
(
pNextWidget
->
name
());
}
}
}
//-------------------------------//
if
(
widgetsList
.
size
()
>
0
)
paletter
->
showTabWidget
(
0
);
paletter
->
update
();
}
void
UBBoardPaletteManager
::
changeMode
(
eUBDockPaletteWidgetMode
newMode
,
bool
isInit
)
{
processPalettersWidget
(
mRightPalette
,
newMode
);
processPalettersWidget
(
mLeftPalette
,
newMode
);
bool
rightPaletteVisible
=
mRightPalette
->
switchMode
(
newMode
);
bool
leftPaletteVisible
=
mLeftPalette
->
switchMode
(
newMode
);
switch
(
newMode
)
{
...
...
@@ -741,10 +707,11 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
mKeyboardPalette
->
setParent
(
UBApplication
::
boardController
->
controlContainer
());
}
mLeftPalette
->
setVisible
(
tru
e
);
mRightPalette
->
setVisible
(
tru
e
);
mLeftPalette
->
setVisible
(
leftPaletteVisibl
e
);
mRightPalette
->
setVisible
(
rightPaletteVisibl
e
);
#ifdef Q_WS_WIN
mRightPalette
->
setAdditionalVOffset
(
0
);
if
(
rightPaletteVisible
)
mRightPalette
->
setAdditionalVOffset
(
0
);
#endif
if
(
!
isInit
)
...
...
@@ -773,10 +740,11 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
mKeyboardPalette
->
setParent
((
QWidget
*
)
UBApplication
::
applicationController
->
uninotesController
()
->
drawingView
());
}
mLeftPalette
->
setVisible
(
fals
e
);
mRightPalette
->
setVisible
(
tru
e
);
mLeftPalette
->
setVisible
(
leftPaletteVisibl
e
);
mRightPalette
->
setVisible
(
rightPaletteVisibl
e
);
#ifdef Q_WS_WIN
mRightPalette
->
setAdditionalVOffset
(
30
);
if
(
rightPaletteVisible
)
mRightPalette
->
setAdditionalVOffset
(
30
);
#endif
if
(
!
isInit
)
...
...
@@ -805,8 +773,8 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
default
:
{
mLeftPalette
->
setVisible
(
fals
e
);
mRightPalette
->
setVisible
(
fals
e
);
mLeftPalette
->
setVisible
(
leftPaletteVisibl
e
);
mRightPalette
->
setVisible
(
rightPaletteVisibl
e
);
mLeftPalette
->
setParent
(
0
);
mRightPalette
->
assignParent
(
0
);
if
(
UBPlatformUtils
::
hasVirtualKeyboard
()
&&
mKeyboardPalette
!=
NULL
)
...
...
src/gui/UBCachePropertiesWidget.h
View file @
6bbecff5
...
...
@@ -21,6 +21,11 @@ public:
UBCachePropertiesWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBCachePropertiesWidget"
);
~
UBCachePropertiesWidget
();
bool
visibleInMode
(
eUBDockPaletteWidgetMode
mode
)
{
return
mode
==
eUBDockPaletteWidget_BOARD
;
}
public
slots
:
void
updateCurrentCache
();
...
...
src/gui/UBDockDownloadWidget.h
View file @
6bbecff5
...
...
@@ -28,6 +28,12 @@ public:
UBDockDownloadWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBDockDownloadWidget"
);
~
UBDockDownloadWidget
();
bool
visibleInMode
(
eUBDockPaletteWidgetMode
mode
)
{
return
mode
==
eUBDockPaletteWidget_BOARD
;
}
private
:
QVBoxLayout
*
mpLayout
;
UBDownloadWidget
*
mpDLWidget
;
...
...
src/gui/UBDockPalette.cpp
View file @
6bbecff5
...
...
@@ -28,7 +28,7 @@
/**
* \brief The constructor
*/
UBDockPalette
::
UBDockPalette
(
QWidget
*
parent
,
const
char
*
name
)
UBDockPalette
::
UBDockPalette
(
eUBDockPaletteType
paletteType
,
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
,
Qt
::
FramelessWindowHint
|
Qt
::
X11BypassWindowManagerHint
)
,
mOrientation
(
eUBDockOrientation_Left
)
,
mPreferredWidth
(
100
)
...
...
@@ -41,6 +41,7 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
,
mpStackWidget
(
NULL
)
,
mpLayout
(
NULL
)
,
mCurrentTab
(
0
)
,
mPaletteType
(
paletteType
)
,
mTabPalette
(
new
UBTabDockPalete
(
this
,
parent
))
{
setObjectName
(
name
);
...
...
@@ -729,6 +730,38 @@ void UBDockPalette::setVisible(bool visible)
mTabPalette
->
setVisible
(
visible
);
}
bool
UBDockPalette
::
switchMode
(
eUBDockPaletteWidgetMode
mode
)
{
bool
hasVisibleElements
=
false
;
//-------------------------------//
// get full right palette widgets list, parse it, show all widgets for BOARD mode, and hide all other
for
(
int
i
=
0
;
i
<
mRegisteredWidgets
.
size
();
i
++
)
{
UBDockPaletteWidget
*
pNextWidget
=
mRegisteredWidgets
.
at
(
i
);
if
(
pNextWidget
!=
NULL
)
{
if
(
pNextWidget
->
visibleInMode
(
mode
)
)
{
addTab
(
pNextWidget
);
hasVisibleElements
=
true
;
}
else
{
removeTab
(
pNextWidget
->
name
());
}
}
}
//-------------------------------//
if
(
mRegisteredWidgets
.
size
()
>
0
)
showTabWidget
(
0
);
update
();
return
hasVisibleElements
;
}
UBTabDockPalete
::
UBTabDockPalete
(
UBDockPalette
*
dockPalette
,
QWidget
*
parent
)
:
QWidget
(
parent
)
,
dock
(
dockPalette
)
...
...
src/gui/UBDockPalette.h
View file @
6bbecff5
...
...
@@ -75,13 +75,22 @@ private:
bool
mFlotable
;
};
typedef
enum
{
eUBDockPaletteType_LEFT
,
eUBDockPaletteType_RIGHT
,
eUBDockPaletteType_NAVIGATOR
,
}
eUBDockPaletteType
;
class
UBDockPalette
:
public
QWidget
{
Q_OBJECT
friend
class
UBTabDockPalete
;
public
:
UBDockPalette
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBDockPalette"
);
UBDockPalette
(
eUBDockPaletteType
paletteType
,
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBDockPalette"
);
~
UBDockPalette
();
eUBDockOrientation
orientation
();
...
...
@@ -107,6 +116,8 @@ public:
void
connectSignals
();
bool
switchMode
(
eUBDockPaletteWidgetMode
mode
);
QVector
<
UBDockPaletteWidget
*>
GetWidgetsList
()
{
return
mRegisteredWidgets
;
}
public
:
...
...
@@ -115,6 +126,8 @@ public:
int
getAdditionalVOffset
()
const
{
return
mTabPalette
->
mVerticalOffset
;}
void
setAdditionalVOffset
(
int
newOffset
)
{
mTabPalette
->
mVerticalOffset
=
newOffset
;}
eUBDockPaletteType
paletteType
(){
return
mPaletteType
;}
public
slots
:
void
onShowTabWidget
(
const
QString
&
widgetName
);
void
onHideTabWidget
(
const
QString
&
widgetName
);
...
...
@@ -178,7 +191,7 @@ private:
private
:
UBTabDockPalete
*
mTabPalette
;
eUBDockPaletteType
mPaletteType
;
};
#endif // UBDOCKPALETTE_H
src/gui/UBDockPaletteWidget.cpp
View file @
6bbecff5
...
...
@@ -27,15 +27,9 @@ QString UBDockPaletteWidget::name()
return
mName
;
}
void
UBDockPaletteWidget
::
registerMode
(
eUBDockPaletteWidgetMode
mode
)
{
if
(
!
mRegisteredModes
.
contains
(
mode
))
mRegisteredModes
.
append
(
mode
);
}
void
UBDockPaletteWidget
::
slot_changeMode
(
eUBDockPaletteWidgetMode
newMode
)
{
this
->
setVisible
(
mRegisteredModes
.
contains
(
newMode
));
this
->
setVisible
(
this
->
visibleInMode
(
newMode
));
}
src/gui/UBDockPaletteWidget.h
View file @
6bbecff5
...
...
@@ -25,9 +25,8 @@ public:
QPixmap
iconToLeft
();
QString
name
();
v
oid
registerMode
(
eUBDockPaletteWidgetMode
mode
)
;
v
irtual
bool
visibleInMode
(
eUBDockPaletteWidgetMode
mode
)
=
NULL
;
QVector
<
eUBDockPaletteWidgetMode
>
GetRegisteredModes
()
{
return
mRegisteredModes
;
}
bool
visibleState
(){
return
mVisibleState
;}
void
setVisibleState
(
bool
state
){
mVisibleState
=
state
;}
...
...
@@ -45,7 +44,7 @@ protected:
QString
mName
;
/* The current widget available mode list */
QVector
<
eUBDockPaletteWidgetMode
>
mRegisteredModes
;
//
QVector<eUBDockPaletteWidgetMode> mRegisteredModes;
bool
mVisibleState
;
};
...
...
src/gui/UBLeftPalette.cpp
View file @
6bbecff5
...
...
@@ -20,7 +20,8 @@
/**
* \brief The constructor
*/
UBLeftPalette
::
UBLeftPalette
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPalette
(
parent
)
UBLeftPalette
::
UBLeftPalette
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPalette
(
eUBDockPaletteType_LEFT
,
parent
)
{
setObjectName
(
name
);
setOrientation
(
eUBDockOrientation_Left
);
...
...
src/gui/UBLibWidget.h
View file @
6bbecff5
...
...
@@ -48,6 +48,12 @@ public:
UBLibNavigatorWidget
*
libNavigator
()
{
return
mNavigator
;}
UBLibPathViewer
*
pathViewer
()
{
return
mpPathViewer
;}
bool
visibleInMode
(
eUBDockPaletteWidgetMode
mode
)
{
return
mode
==
eUBDockPaletteWidget_BOARD
||
mode
==
eUBDockPaletteWidget_DESKTOP
;
}
signals
:
void
resized
();
void
showLibElemProperties
();
...
...
src/gui/UBNavigatorPalette.cpp
View file @
6bbecff5
...
...
@@ -23,12 +23,13 @@
* @param parent as the parent widget
* @param name as the object name
*/
UBNavigatorPalette
::
UBNavigatorPalette
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPalette
(
parent
,
name
)
UBNavigatorPalette
::
UBNavigatorPalette
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPalette
(
eUBDockPaletteType_NAVIGATOR
,
parent
,
name
)
,
mNavigator
(
NULL
)
,
mLayout
(
NULL
)
,
mHLayout
(
NULL
)
,
mPageNbr
(
NULL
)
,
mClock
(
NULL
)
,
mHLayout
(
NULL
)
,
mPageNbr
(
NULL
)
,
mClock
(
NULL
)
{
setOrientation
(
eUBDockOrientation_Left
);
setMaximumWidth
(
300
);
...
...
src/gui/UBPageNavigationWidget.h
View file @
6bbecff5
...
...
@@ -36,6 +36,11 @@ public:
void
setDocument
(
UBDocumentProxy
*
document
);
void
refresh
();
bool
visibleInMode
(
eUBDockPaletteWidgetMode
mode
)
{
return
mode
==
eUBDockPaletteWidget_BOARD
;
}
signals
:
void
resizeRequest
(
QResizeEvent
*
event
);
...
...
src/gui/UBRightPalette.cpp
View file @
6bbecff5
...
...
@@ -22,7 +22,8 @@
/**
* \brief The constructor
*/
UBRightPalette
::
UBRightPalette
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPalette
(
parent
)
UBRightPalette
::
UBRightPalette
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPalette
(
eUBDockPaletteType_RIGHT
,
parent
)
{
setObjectName
(
name
);
setOrientation
(
eUBDockOrientation_Right
);
...
...
src/gui/UBTeacherBarWidget.h
View file @
6bbecff5
...
...
@@ -46,6 +46,11 @@ public:
UBTeacherBarWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTeacherBarWidget"
);
~
UBTeacherBarWidget
();
bool
visibleInMode
(
eUBDockPaletteWidgetMode
mode
)
{
return
mode
==
eUBDockPaletteWidget_BOARD
;
}
public
slots
:
void
saveContent
();
void
loadContent
();
...
...
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