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
e812ebb9
Commit
e812ebb9
authored
Aug 16, 2011
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented dock palette tab position related to the toolbar position
parent
2e649556
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
551 additions
and
478 deletions
+551
-478
UBPreferencesController.cpp
src/core/UBPreferencesController.cpp
+1
-0
UBDockPalette.cpp
src/gui/UBDockPalette.cpp
+68
-12
UBDockPalette.h
src/gui/UBDockPalette.h
+16
-0
UBLibNavigatorWidget.cpp
src/gui/UBLibNavigatorWidget.cpp
+1
-0
UBLibPalette.cpp
src/gui/UBLibPalette.cpp
+1
-1
UBLibPathViewer.cpp
src/gui/UBLibPathViewer.cpp
+463
-463
UBNavigatorPalette.cpp
src/gui/UBNavigatorPalette.cpp
+1
-2
No files found.
src/core/UBPreferencesController.cpp
View file @
e812ebb9
...
...
@@ -451,6 +451,7 @@ void UBPreferencesController::toolbarPositionChanged(bool checked)
UBSettings
*
settings
=
UBSettings
::
settings
();
settings
->
appToolBarPositionedAtTop
->
set
(
mPreferencesUI
->
toolbarAtTopRadioButton
->
isChecked
());
}
void
UBPreferencesController
::
toolbarOrientationVertical
(
bool
checked
)
...
...
src/gui/UBDockPalette.cpp
View file @
e812ebb9
...
...
@@ -19,9 +19,27 @@
#include "UBDockPalette.h"
#include "core/UBSettings.h"
#include "frameworks/UBPlatformUtils.h"
#include "core/UBApplication.h"
#include "core/UBPreferencesController.h"
#include "core/memcheck.h"
/*
Note to myself: I will have to modify this implementation when we will
have to support mulitple tab. At this moment, a UBDockPalette
will be only the palette that manages the tabs. This
palette will maintain a list of tabs with icons and will
contain a QStackedWidget that will be contains the different
widget contents.
A click on a tab that is not related to the current widget
will show the related widget in the palette.
A click on a tab that is related to the current widget will
collapse the palette.
If the palette is collapsed, a click on any tab will expand it
and show the tab related widget.
*/
/**
* \brief The constructor
*/
...
...
@@ -34,11 +52,12 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
,
mResized
(
false
)
,
mCollapseWidth
(
150
)
,
mLastWidth
(
-
1
)
,
mHTab
(
0
)
{
setObjectName
(
name
);
// We let 2 pixels in order to keep a small border for the resizing
setMinimumWidth
(
border
()
+
2
);
setMinimumWidth
(
2
*
border
()
+
2
);
if
(
parent
)
{
...
...
@@ -61,6 +80,10 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
// This is the only way to set the background as transparent!
setStyleSheet
(
"QWidget {background-color: transparent}"
);
// Set the position of the tab
onToolbarPosUpdated
();
connect
(
UBSettings
::
settings
()
->
appToolBarPositionedAtTop
,
SIGNAL
(
changed
(
QVariant
)),
this
,
SLOT
(
onToolbarPosUpdated
()));
}
/**
...
...
@@ -206,9 +229,9 @@ void UBDockPalette::mouseReleaseEvent(QMouseEvent *event)
if
(
eUBDockOrientation_Left
==
mOrientation
)
{
if
(
mMousePressPos
.
x
()
>=
width
()
-
2
*
border
()
&&
mMousePressPos
.
y
()
>=
border
()
&&
mMousePressPos
.
y
()
>=
mHTab
&&
mMousePressPos
.
x
()
<=
width
()
&&
mMousePressPos
.
y
()
<=
border
()
+
TABSIZE
)
mMousePressPos
.
y
()
<=
mHTab
+
TABSIZE
)
{
tabClicked
();
}
...
...
@@ -217,8 +240,8 @@ void UBDockPalette::mouseReleaseEvent(QMouseEvent *event)
{
if
(
mMousePressPos
.
x
()
>=
0
&&
mMousePressPos
.
x
()
<=
2
*
border
()
&&
mMousePressPos
.
y
()
>=
border
()
&&
mMousePressPos
.
y
()
<=
border
()
+
TABSIZE
)
mMousePressPos
.
y
()
>=
mHTab
&&
mMousePressPos
.
y
()
<=
mHTab
+
TABSIZE
)
{
tabClicked
();
}
...
...
@@ -291,23 +314,32 @@ void UBDockPalette::paintEvent(QPaintEvent *event)
painter
.
setPen
(
Qt
::
NoPen
);
painter
.
setBrush
(
mBackgroundBrush
);
if
(
eUBDockTabOrientation_Up
==
mTabsOrientation
)
{
mHTab
=
border
();
}
else
{
mHTab
=
height
()
-
border
()
-
TABSIZE
;
}
if
(
mOrientation
==
eUBDockOrientation_Left
)
{
QPainterPath
path
;
path
.
setFillRule
(
Qt
::
WindingFill
);
path
.
addRect
(
0.0
,
0.0
,
width
()
-
border
(),
height
());
path
.
addRoundedRect
(
width
()
-
2
*
border
(),
border
(),
2
*
border
(),
TABSIZE
,
radius
(),
radius
());
path
.
addRect
(
0.0
,
0.0
,
width
()
-
2
*
border
(),
height
());
path
.
addRoundedRect
(
width
()
-
4
*
border
(),
mHTab
,
4
*
border
(),
TABSIZE
,
radius
(),
radius
());
painter
.
drawPath
(
path
);
painter
.
drawPixmap
(
width
()
-
border
()
+
1
,
border
()
+
1
,
border
()
-
4
,
TABSIZE
-
2
,
mIcon
);
painter
.
drawPixmap
(
width
()
-
border
()
+
1
,
mHTab
+
1
,
border
()
-
4
,
TABSIZE
-
2
,
mIcon
);
}
else
if
(
mOrientation
==
eUBDockOrientation_Right
)
{
QPainterPath
path
;
path
.
setFillRule
(
Qt
::
WindingFill
);
path
.
addRect
(
border
(),
0.0
,
width
()
-
border
(),
height
());
path
.
addRoundedRect
(
0.0
,
border
(),
2
*
border
(),
TABSIZE
,
radius
(),
radius
());
path
.
addRect
(
2
*
border
(),
0.0
,
width
()
-
2
*
border
(),
height
());
path
.
addRoundedRect
(
0.0
,
mHTab
,
4
*
border
(),
TABSIZE
,
radius
(),
radius
());
painter
.
drawPath
(
path
);
painter
.
drawPixmap
(
2
,
border
()
+
1
,
border
()
-
3
,
TABSIZE
-
2
,
mIcon
);
painter
.
drawPixmap
(
2
,
mHTab
+
1
,
border
()
-
3
,
TABSIZE
-
2
,
mIcon
);
}
else
{
...
...
@@ -372,7 +404,7 @@ void UBDockPalette::tabClicked()
{
// The palette must be collapsed
mLastWidth
=
width
();
resize
(
border
(),
height
());
resize
(
2
*
border
(),
height
());
}
else
{
...
...
@@ -381,3 +413,27 @@ void UBDockPalette::tabClicked()
mLastWidth
=
-
1
;
}
}
void
UBDockPalette
::
setTabsOrientation
(
eUBDockTabOrientation
orientation
)
{
mTabsOrientation
=
orientation
;
}
void
UBDockPalette
::
onToolbarPosUpdated
()
{
// Get the position of the tab
if
(
UBSettings
::
settings
()
->
appToolBarPositionedAtTop
->
get
().
toBool
())
{
setTabsOrientation
(
eUBDockTabOrientation_Up
);
}
else
{
setTabsOrientation
(
eUBDockTabOrientation_Down
);
}
update
();
}
int
UBDockPalette
::
customMargin
()
{
return
5
;
}
src/gui/UBDockPalette.h
View file @
e812ebb9
...
...
@@ -39,14 +39,22 @@ typedef enum
eUBDockOrientation_Bottom
/** [to be implemented]Bottom dock */
}
eUBDockOrientation
;
typedef
enum
{
eUBDockTabOrientation_Up
,
/** Up tabs */
eUBDockTabOrientation_Down
/** Down tabs */
}
eUBDockTabOrientation
;
class
UBDockPalette
:
public
QWidget
{
Q_OBJECT
public
:
UBDockPalette
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBDockPalette"
);
~
UBDockPalette
();
eUBDockOrientation
orientation
();
void
setOrientation
(
eUBDockOrientation
orientation
);
void
setTabsOrientation
(
eUBDockTabOrientation
orientation
);
virtual
void
mouseMoveEvent
(
QMouseEvent
*
event
);
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
...
...
@@ -60,6 +68,7 @@ public:
protected
:
virtual
int
border
();
virtual
int
radius
();
virtual
int
customMargin
();
virtual
void
updateMaxWidth
();
virtual
void
resizeEvent
(
QResizeEvent
*
event
);
virtual
int
collapseWidth
();
...
...
@@ -86,6 +95,13 @@ protected:
QPoint
mMousePressPos
;
/** The palette icon */
QPixmap
mIcon
;
/** The tab orientation */
eUBDockTabOrientation
mTabsOrientation
;
/** The h position of the tab */
int
mHTab
;
private
slots
:
void
onToolbarPosUpdated
();
private
:
void
tabClicked
();
...
...
src/gui/UBLibNavigatorWidget.cpp
View file @
e812ebb9
...
...
@@ -39,6 +39,7 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
UBLibPalette
*
pLibPalette
=
dynamic_cast
<
UBLibPalette
*>
(
parentWidget
());
mLayout
=
new
QVBoxLayout
(
this
);
// mLayout->setContentsMargins(20, 5, 5, 5);
setLayout
(
mLayout
);
mPathViewer
=
new
UBLibPathViewer
(
this
);
...
...
src/gui/UBLibPalette.cpp
View file @
e812ebb9
...
...
@@ -40,7 +40,7 @@ UBLibPalette::UBLibPalette(QWidget *parent, const char *name):UBDockPalette(pare
mLastWidth
=
300
;
mLayout
=
new
QVBoxLayout
(
this
);
mLayout
->
set
Margin
(
3
);
mLayout
->
set
ContentsMargins
(
20
,
customMargin
(),
customMargin
(),
customMargin
()
);
setLayout
(
mLayout
);
// Build the GUI
...
...
src/gui/UBLibPathViewer.cpp
View file @
e812ebb9
This diff is collapsed.
Click to expand it.
src/gui/UBNavigatorPalette.cpp
View file @
e812ebb9
...
...
@@ -35,11 +35,10 @@ UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name):UBDock
mIcon
=
QPixmap
(
":images/paletteNavigator.png"
);
resize
(
UBSettings
::
settings
()
->
navigPaletteWidth
->
get
().
toInt
(),
height
());
mLastWidth
=
300
;
setContentsMargins
(
0
,
0
,
border
(),
0
);
// Build the gui
mLayout
=
new
QVBoxLayout
(
this
);
mLayout
->
set
Margin
(
3
);
mLayout
->
set
ContentsMargins
(
customMargin
(),
customMargin
(),
2
*
border
()
+
customMargin
(),
customMargin
()
);
setLayout
(
mLayout
);
mNavigator
=
new
UBDocumentNavigator
(
this
);
...
...
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