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
74d21a64
Commit
74d21a64
authored
Feb 06, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added proper support for loading / updating different stylesheets
parent
39aa9ccc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
48 deletions
+46
-48
style-outdoor.css
images/style-outdoor.css
+10
-17
MainWindow.cc
src/ui/MainWindow.cc
+15
-15
MainWindow.h
src/ui/MainWindow.h
+3
-0
MainWindow.ui
src/ui/MainWindow.ui
+18
-16
No files found.
images/style-outdoor.css
View file @
74d21a64
...
...
@@ -49,7 +49,7 @@ border: 1px solid #111111;
}
QCheckBox
::indicator:checked
{
background-color
:
#
222222
;
background-color
:
#
333333
;
}
QCheckBox
::indicator:checked:hover
{
...
...
@@ -92,12 +92,14 @@ border: 1px solid #111111;
/* titlebar-close-icon: url(close.png);
titlebar-normal-icon: url(undock.png);*/
}
QDockWidget
::title
{
text-align
:
left
;
/* align the text to the left */
background
:
lightgray
;
padding-left
:
5px
;
}
text-align
:
left
;
background
:
#EEEEEE
;
color
:
#111111
;
padding-left
:
5px
;
height
:
10px
;
border-bottom
:
1px
solid
#222222
;
}
QDockWidget
::close-button
,
QDockWidget
::float-button
{
border
:
1px
solid
transparent
;
...
...
@@ -120,15 +122,6 @@ QDockWidget::close-button, QDockWidget::float-button {
color
:
#EEEEEE
;
}
QDockWidget
::title
{
text-align
:
left
;
background
:
#121214
;
color
:
#4A4A4F
;
padding-left
:
5px
;
height
:
10px
;
border-bottom
:
1px
solid
#222222
;
}
QSeparator
{
color
:
#EEEEEE
;
}
...
...
@@ -184,7 +177,7 @@ QPushButton {
border-radius
:
5px
;
padding-left
:
10px
;
padding-right
:
10px
;
background-color
:
qlineargradient
(
x1
:
0
,
y1
:
0
,
x2
:
0
,
y2
:
1
,
stop
:
0
#
232228
,
stop
:
1
#02020
8
);
background-color
:
qlineargradient
(
x1
:
0
,
y1
:
0
,
x2
:
0
,
y2
:
1
,
stop
:
0
#
C3C2C8
,
stop
:
1
#82828
8
);
}
QPushButton
:checked
{
...
...
@@ -202,7 +195,7 @@ QToolButton {
max-height
:
18px
;
border
:
2px
solid
#4A4A4F
;
border-radius
:
5px
;
background-color
:
qlineargradient
(
x1
:
0
,
y1
:
0
,
x2
:
0
,
y2
:
1
,
stop
:
0
#
232228
,
stop
:
1
#02020
8
);
background-color
:
qlineargradient
(
x1
:
0
,
y1
:
0
,
x2
:
0
,
y2
:
1
,
stop
:
0
#
C3C2C8
,
stop
:
1
#82828
8
);
}
QToolButton
:checked
{
...
...
src/ui/MainWindow.cc
View file @
74d21a64
...
...
@@ -66,7 +66,8 @@ MainWindow::MainWindow(QWidget *parent):
toolsMenuActions
(),
currentView
(
VIEW_UNCONNECTED
),
aboutToCloseFlag
(
false
),
changingViewsFlag
(
false
)
changingViewsFlag
(
false
),
styleFileName
(
QCoreApplication
::
applicationDirPath
()
+
"/style-indoor.css"
)
{
if
(
!
settings
.
contains
(
"CURRENT_VIEW"
))
{
...
...
@@ -1163,20 +1164,12 @@ void MainWindow::saveScreen()
}
}
/**
* Reload the style sheet from disk. The function tries to load "qgroundcontrol.css" from the application
* directory (which by default does not exist). If it fails, it will load the bundled default CSS
* from memory.
* To customize the application, just create a qgroundcontrol.css file in the application directory
*/
void
MainWindow
::
reloadStylesheet
()
void
MainWindow
::
selectStylesheet
()
{
QString
fileName
=
QCoreApplication
::
applicationDirPath
()
+
"/style-indoor.css"
;
// Let user select style sheet
fileName
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Specify stylesheet"
),
f
ileName
,
tr
(
"CSS Stylesheet (*.css);;"
));
styleFileName
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Specify stylesheet"
),
styleF
ileName
,
tr
(
"CSS Stylesheet (*.css);;"
));
if
(
!
f
ileName
.
endsWith
(
".css"
))
if
(
!
styleF
ileName
.
endsWith
(
".css"
))
{
QMessageBox
msgBox
;
msgBox
.
setIcon
(
QMessageBox
::
Information
);
...
...
@@ -1189,7 +1182,13 @@ void MainWindow::reloadStylesheet()
}
// Load style sheet
QFile
*
styleSheet
=
new
QFile
(
fileName
);
reloadStylesheet
();
}
void
MainWindow
::
reloadStylesheet
()
{
// Load style sheet
QFile
*
styleSheet
=
new
QFile
(
styleFileName
);
if
(
!
styleSheet
->
exists
())
{
styleSheet
=
new
QFile
(
":/images/style-mission.css"
);
...
...
@@ -1205,7 +1204,7 @@ void MainWindow::reloadStylesheet()
QMessageBox
msgBox
;
msgBox
.
setIcon
(
QMessageBox
::
Information
);
msgBox
.
setText
(
tr
(
"QGroundControl did lot load a new style"
));
msgBox
.
setInformativeText
(
tr
(
"Stylesheet file %1 was not readable"
).
arg
(
f
ileName
));
msgBox
.
setInformativeText
(
tr
(
"Stylesheet file %1 was not readable"
).
arg
(
styleF
ileName
));
msgBox
.
setStandardButtons
(
QMessageBox
::
Ok
);
msgBox
.
setDefaultButton
(
QMessageBox
::
Ok
);
msgBox
.
exec
();
...
...
@@ -1315,7 +1314,8 @@ void MainWindow::connectCommonActions()
connect
(
ui
.
actionUnconnectedView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadUnconnectedView
()));
connect
(
ui
.
actionMavlinkView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadMAVLinkView
()));
connect
(
ui
.
actionReloadStyle
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
reloadStylesheet
()));
connect
(
ui
.
actionReloadStylesheet
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
reloadStylesheet
()));
connect
(
ui
.
actionSelectStylesheet
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
selectStylesheet
()));
// Help Actions
connect
(
ui
.
actionOnline_Documentation
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showHelp
()));
...
...
src/ui/MainWindow.h
View file @
74d21a64
...
...
@@ -137,6 +137,8 @@ public slots:
/** @brief Reload the CSS style sheet */
void
reloadStylesheet
();
/** @brief Let the user select the CSS style sheet */
void
selectStylesheet
();
/** @brief Add a custom tool widget */
void
createCustomWidget
();
...
...
@@ -411,6 +413,7 @@ protected:
LogCompressor
*
comp
;
QString
screenFileName
;
QTimer
*
videoTimer
;
QString
styleFileName
;
private:
Ui
::
MainWindow
ui
;
...
...
src/ui/MainWindow.ui
View file @
74d21a64
...
...
@@ -58,13 +58,19 @@
<property
name=
"title"
>
<string>
File
</string>
</property>
<widget
class=
"QMenu"
name=
"menuPreferences"
>
<property
name=
"title"
>
<string>
Preferences
</string>
</property>
<addaction
name=
"actionSelectStylesheet"
/>
<addaction
name=
"actionReloadStylesheet"
/>
</widget>
<addaction
name=
"actionJoystick_Settings"
/>
<addaction
name=
"actionSimulate"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"actionMuteAudioOutput"
/>
<addaction
name=
"actionJoystickSettings"
/>
<addaction
name=
"actionPreferences"
/>
<addaction
name=
"actionReloadStyle"
/>
<addaction
name=
"menuPreferences"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"actionExit"
/>
</widget>
...
...
@@ -338,13 +344,13 @@
<string>
Meta+M
</string>
</property>
</action>
<action
name=
"action
ReloadStyle
"
>
<action
name=
"action
SelectStylesheet
"
>
<property
name=
"icon"
>
<iconset
resource=
"../../mavground.qrc"
>
<normaloff>
:/images/categories/applications-internet.svg
</normaloff>
:/images/categories/applications-internet.svg
</iconset>
</property>
<property
name=
"text"
>
<string>
Load
Stylesheet
</string>
<string>
Select
Stylesheet
</string>
</property>
</action>
<action
name=
"actionPilotsView"
>
...
...
@@ -387,18 +393,6 @@
<string>
Mute Audio Output
</string>
</property>
</action>
<action
name=
"actionPreferences"
>
<property
name=
"icon"
>
<iconset
resource=
"../../mavground.qrc"
>
<normaloff>
:/images/categories/preferences-system.svg
</normaloff>
:/images/categories/preferences-system.svg
</iconset>
</property>
<property
name=
"text"
>
<string>
Preferences
</string>
</property>
<property
name=
"toolTip"
>
<string>
QGroundControl global settings
</string>
</property>
</action>
<action
name=
"actionUnconnectedView"
>
<property
name=
"checkable"
>
<bool>
true
</bool>
...
...
@@ -429,6 +423,14 @@
<string>
Shutdown the onboard computer - works not during flight
</string>
</property>
</action>
<action
name=
"actionReloadStylesheet"
>
<property
name=
"text"
>
<string>
Reload Stylesheet
</string>
</property>
<property
name=
"shortcut"
>
<string>
Meta+R
</string>
</property>
</action>
</widget>
<layoutdefault
spacing=
"6"
margin=
"11"
/>
<resources>
...
...
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