Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Valentin Platzgummer
qgroundcontrol
Commits
ec18ee40
Commit
ec18ee40
authored
May 01, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New titlebar widgets to give dock windows titles when not in advanced mode
parent
2a794534
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
7 deletions
+73
-7
MainWindow.cc
src/ui/MainWindow.cc
+47
-4
MainWindow.h
src/ui/MainWindow.h
+9
-0
QGCSettingsWidget.cc
src/ui/QGCSettingsWidget.cc
+4
-0
QGCSettingsWidget.ui
src/ui/QGCSettingsWidget.ui
+13
-3
No files found.
src/ui/MainWindow.cc
View file @
ec18ee40
...
@@ -104,6 +104,7 @@ MainWindow::MainWindow(QWidget *parent):
...
@@ -104,6 +104,7 @@ MainWindow::MainWindow(QWidget *parent):
lowPowerMode
(
false
)
lowPowerMode
(
false
)
{
{
hide
();
hide
();
dockWidgetTitleBarEnabled
=
true
;
isAdvancedMode
=
false
;
isAdvancedMode
=
false
;
emit
initStatusChanged
(
"Loading UI Settings.."
);
emit
initStatusChanged
(
"Loading UI Settings.."
);
loadSettings
();
loadSettings
();
...
@@ -606,12 +607,24 @@ void MainWindow::createDockWidget(QWidget *parent,QWidget *child,QString title,Q
...
@@ -606,12 +607,24 @@ void MainWindow::createDockWidget(QWidget *parent,QWidget *child,QString title,Q
QDockWidget
*
widget
=
new
QDockWidget
(
title
,
this
);
QDockWidget
*
widget
=
new
QDockWidget
(
title
,
this
);
if
(
!
isAdvancedMode
)
if
(
!
isAdvancedMode
)
{
{
dockToTitleBarMap
[
widget
]
=
widget
->
titleBarWidget
();
if
(
dockWidgetTitleBarEnabled
)
widget
->
setTitleBarWidget
(
new
QWidget
(
this
));
{
dockToTitleBarMap
[
widget
]
=
widget
->
titleBarWidget
();
QLabel
*
label
=
new
QLabel
(
this
);
label
->
setText
(
title
);
widget
->
setTitleBarWidget
(
label
);
}
else
{
dockToTitleBarMap
[
widget
]
=
widget
->
titleBarWidget
();
widget
->
setTitleBarWidget
(
new
QWidget
(
this
));
}
}
}
else
else
{
{
dockToTitleBarMap
[
widget
]
=
new
QWidget
(
this
);
QLabel
*
label
=
new
QLabel
(
this
);
label
->
setText
(
title
);
dockToTitleBarMap
[
widget
]
=
label
;
}
}
widget
->
setObjectName
(
objectname
);
widget
->
setObjectName
(
objectname
);
widget
->
setWidget
(
child
);
widget
->
setWidget
(
child
);
...
@@ -903,7 +916,9 @@ void MainWindow::loadSettings()
...
@@ -903,7 +916,9 @@ void MainWindow::loadSettings()
autoReconnect
=
settings
.
value
(
"AUTO_RECONNECT"
,
autoReconnect
).
toBool
();
autoReconnect
=
settings
.
value
(
"AUTO_RECONNECT"
,
autoReconnect
).
toBool
();
currentStyle
=
(
QGC_MAINWINDOW_STYLE
)
settings
.
value
(
"CURRENT_STYLE"
,
currentStyle
).
toInt
();
currentStyle
=
(
QGC_MAINWINDOW_STYLE
)
settings
.
value
(
"CURRENT_STYLE"
,
currentStyle
).
toInt
();
lowPowerMode
=
settings
.
value
(
"LOW_POWER_MODE"
,
lowPowerMode
).
toBool
();
lowPowerMode
=
settings
.
value
(
"LOW_POWER_MODE"
,
lowPowerMode
).
toBool
();
dockWidgetTitleBarEnabled
=
settings
.
value
(
"DOCK_WIDGET_TITLEBARS"
,
dockWidgetTitleBarEnabled
).
toBool
();
settings
.
endGroup
();
settings
.
endGroup
();
enableDockWidgetTitleBars
(
dockWidgetTitleBarEnabled
);
}
}
void
MainWindow
::
storeSettings
()
void
MainWindow
::
storeSettings
()
...
@@ -990,6 +1005,35 @@ void MainWindow::saveScreen()
...
@@ -990,6 +1005,35 @@ void MainWindow::saveScreen()
window
.
save
(
screenFileName
,
format
.
toAscii
());
window
.
save
(
screenFileName
,
format
.
toAscii
());
}
}
}
}
void
MainWindow
::
enableDockWidgetTitleBars
(
bool
enabled
)
{
if
(
!
isAdvancedMode
)
{
dockWidgetTitleBarEnabled
=
enabled
;
QSettings
settings
;
settings
.
beginGroup
(
"QGC_MAINWINDOW"
);
settings
.
setValue
(
"DOCK_WIDGET_TITLEBARS"
,
dockWidgetTitleBarEnabled
);
settings
.
endGroup
();
settings
.
sync
();
if
(
enabled
)
{
for
(
QMap
<
QDockWidget
*
,
QWidget
*>::
const_iterator
i
=
dockToTitleBarMap
.
constBegin
();
i
!=
dockToTitleBarMap
.
constEnd
();
i
++
)
{
QLabel
*
label
=
new
QLabel
(
this
);
label
->
setText
(
i
.
value
()
->
windowTitle
());
i
.
key
()
->
setTitleBarWidget
(
label
);
label
->
setEnabled
(
false
);
}
}
else
{
for
(
QMap
<
QDockWidget
*
,
QWidget
*>::
const_iterator
i
=
dockToTitleBarMap
.
constBegin
();
i
!=
dockToTitleBarMap
.
constEnd
();
i
++
)
{
i
.
key
()
->
setTitleBarWidget
(
0
);
}
}
}
}
void
MainWindow
::
enableAutoReconnect
(
bool
enabled
)
void
MainWindow
::
enableAutoReconnect
(
bool
enabled
)
{
{
...
@@ -1745,7 +1789,6 @@ void MainWindow::setAdvancedMode()
...
@@ -1745,7 +1789,6 @@ void MainWindow::setAdvancedMode()
QWidget
*
widget
=
i
.
key
()
->
titleBarWidget
();
QWidget
*
widget
=
i
.
key
()
->
titleBarWidget
();
i
.
key
()
->
setTitleBarWidget
(
i
.
value
());
i
.
key
()
->
setTitleBarWidget
(
i
.
value
());
dockToTitleBarMap
[
i
.
key
()]
=
widget
;
dockToTitleBarMap
[
i
.
key
()]
=
widget
;
}
}
}
}
}
}
...
...
src/ui/MainWindow.h
View file @
ec18ee40
...
@@ -119,6 +119,12 @@ public:
...
@@ -119,6 +119,12 @@ public:
return
autoReconnect
;
return
autoReconnect
;
}
}
/** @brief Get title bar mode setting */
bool
dockWidgetTitleBarsEnabled
()
{
return
dockWidgetTitleBarEnabled
;
}
/** @brief Get low power mode setting */
/** @brief Get low power mode setting */
bool
lowPowerModeEnabled
()
bool
lowPowerModeEnabled
()
{
{
...
@@ -186,6 +192,8 @@ public slots:
...
@@ -186,6 +192,8 @@ public slots:
void
reloadStylesheet
();
void
reloadStylesheet
();
/** @brief Let the user select the CSS style sheet */
/** @brief Let the user select the CSS style sheet */
void
selectStylesheet
();
void
selectStylesheet
();
/** @breif Enable title bars on dock widgets when no in advanced mode */
void
enableDockWidgetTitleBars
(
bool
enabled
);
/** @brief Automatically reconnect last link */
/** @brief Automatically reconnect last link */
void
enableAutoReconnect
(
bool
enabled
);
void
enableAutoReconnect
(
bool
enabled
);
/** @brief Save power by reducing update rates */
/** @brief Save power by reducing update rates */
...
@@ -436,6 +444,7 @@ private:
...
@@ -436,6 +444,7 @@ private:
QMap
<
QDockWidget
*
,
QWidget
*>
dockToTitleBarMap
;
QMap
<
QDockWidget
*
,
QWidget
*>
dockToTitleBarMap
;
QMap
<
VIEW_SECTIONS
,
QMap
<
QString
,
QWidget
*>
>
centralWidgetToDockWidgetsMap
;
QMap
<
VIEW_SECTIONS
,
QMap
<
QString
,
QWidget
*>
>
centralWidgetToDockWidgetsMap
;
bool
isAdvancedMode
;
bool
isAdvancedMode
;
bool
dockWidgetTitleBarEnabled
;
Ui
::
MainWindow
ui
;
Ui
::
MainWindow
ui
;
QString
getWindowStateKey
();
QString
getWindowStateKey
();
...
...
src/ui/QGCSettingsWidget.cc
View file @
ec18ee40
...
@@ -42,6 +42,10 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
...
@@ -42,6 +42,10 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
ui
->
lowPowerCheckBox
->
setChecked
(
MainWindow
::
instance
()
->
lowPowerModeEnabled
());
ui
->
lowPowerCheckBox
->
setChecked
(
MainWindow
::
instance
()
->
lowPowerModeEnabled
());
connect
(
ui
->
lowPowerCheckBox
,
SIGNAL
(
clicked
(
bool
)),
MainWindow
::
instance
(),
SLOT
(
enableLowPowerMode
(
bool
)));
connect
(
ui
->
lowPowerCheckBox
,
SIGNAL
(
clicked
(
bool
)),
MainWindow
::
instance
(),
SLOT
(
enableLowPowerMode
(
bool
)));
//Dock widget title bars
ui
->
titleBarCheckBox
->
setChecked
(
MainWindow
::
instance
()
->
dockWidgetTitleBarsEnabled
());
ui
->
titleBarCheckBox
,
SIGNAL
(
clicked
(
bool
)),
MainWindow
::
instance
(),
SLOT
(
enableDockWidgetTitleBars
(
bool
));
// Style
// Style
MainWindow
::
QGC_MAINWINDOW_STYLE
style
=
(
MainWindow
::
QGC_MAINWINDOW_STYLE
)
MainWindow
::
instance
()
->
getStyle
();
MainWindow
::
QGC_MAINWINDOW_STYLE
style
=
(
MainWindow
::
QGC_MAINWINDOW_STYLE
)
MainWindow
::
instance
()
->
getStyle
();
switch
(
style
)
{
switch
(
style
)
{
...
...
src/ui/QGCSettingsWidget.ui
View file @
ec18ee40
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
3
"
column=
"0"
>
<item
row=
"
4
"
column=
"0"
>
<widget
class=
"QRadioButton"
name=
"nativeStyle"
>
<widget
class=
"QRadioButton"
name=
"nativeStyle"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Use native platform look and feel (Windows/Linux/Mac OS)
</string>
<string>
Use native platform look and feel (Windows/Linux/Mac OS)
</string>
...
@@ -56,14 +56,14 @@
...
@@ -56,14 +56,14 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
4
"
column=
"0"
>
<item
row=
"
5
"
column=
"0"
>
<widget
class=
"QRadioButton"
name=
"indoorStyle"
>
<widget
class=
"QRadioButton"
name=
"indoorStyle"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Use indoor mission style (black background)
</string>
<string>
Use indoor mission style (black background)
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
5
"
column=
"0"
>
<item
row=
"
6
"
column=
"0"
>
<widget
class=
"QRadioButton"
name=
"outdoorStyle"
>
<widget
class=
"QRadioButton"
name=
"outdoorStyle"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Use outdoor mission style (light background)
</string>
<string>
Use outdoor mission style (light background)
</string>
...
@@ -80,6 +80,16 @@
...
@@ -80,6 +80,16 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"3"
column=
"0"
>
<widget
class=
"QCheckBox"
name=
"titleBarCheckBox"
>
<property
name=
"text"
>
<string>
Show Docked Widget title bars when NOT in advanced Mode.
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
</widget>
</item>
</layout>
</layout>
</widget>
</widget>
</widget>
</widget>
...
...
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