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
120a417b
Commit
120a417b
authored
Nov 18, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove support for user style file
Also fixed bug in loadStyle
parent
9649798b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
58 deletions
+18
-58
MainWindow.cc
src/ui/MainWindow.cc
+16
-41
MainWindow.h
src/ui/MainWindow.h
+2
-17
No files found.
src/ui/MainWindow.cc
View file @
120a417b
...
...
@@ -121,8 +121,6 @@ MainWindow::MainWindow(QWidget *parent):
changingViewsFlag
(
false
),
mavlink
(
new
MAVLinkProtocol
()),
centerStackActionGroup
(
new
QActionGroup
(
this
)),
darkStyleFileName
(
defaultDarkStyle
),
lightStyleFileName
(
defaultLightStyle
),
autoReconnect
(
false
),
simulationLink
(
NULL
),
lowPowerMode
(
false
),
...
...
@@ -141,14 +139,7 @@ void MainWindow::init()
emit
initStatusChanged
(
tr
(
"Loading style"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
qApp
->
setStyle
(
"plastique"
);
if
(
currentStyle
==
QGC_MAINWINDOW_STYLE_LIGHT
)
{
loadStyle
(
currentStyle
,
lightStyleFileName
);
}
else
{
loadStyle
(
currentStyle
,
darkStyleFileName
);
}
loadStyle
(
currentStyle
);
if
(
settings
.
contains
(
"ADVANCED_MODE"
))
{
...
...
@@ -961,8 +952,6 @@ void MainWindow::loadSettings()
settings
.
beginGroup
(
"QGC_MAINWINDOW"
);
autoReconnect
=
settings
.
value
(
"AUTO_RECONNECT"
,
autoReconnect
).
toBool
();
currentStyle
=
(
QGC_MAINWINDOW_STYLE
)
settings
.
value
(
"CURRENT_STYLE"
,
currentStyle
).
toInt
();
darkStyleFileName
=
settings
.
value
(
"DARK_STYLE_FILENAME"
,
darkStyleFileName
).
toString
();
lightStyleFileName
=
settings
.
value
(
"LIGHT_STYLE_FILENAME"
,
lightStyleFileName
).
toString
();
lowPowerMode
=
settings
.
value
(
"LOW_POWER_MODE"
,
lowPowerMode
).
toBool
();
bool
dockWidgetTitleBarEnabled
=
settings
.
value
(
"DOCK_WIDGET_TITLEBARS"
,
menuActionHelper
->
dockWidgetTitleBarsEnabled
()).
toBool
();
settings
.
endGroup
();
...
...
@@ -975,8 +964,6 @@ void MainWindow::storeSettings()
settings
.
beginGroup
(
"QGC_MAINWINDOW"
);
settings
.
setValue
(
"AUTO_RECONNECT"
,
autoReconnect
);
settings
.
setValue
(
"CURRENT_STYLE"
,
currentStyle
);
settings
.
setValue
(
"DARK_STYLE_FILENAME"
,
darkStyleFileName
);
settings
.
setValue
(
"LIGHT_STYLE_FILENAME"
,
lightStyleFileName
);
settings
.
endGroup
();
if
(
!
aboutToCloseFlag
&&
isVisible
())
{
...
...
@@ -1065,11 +1052,11 @@ void MainWindow::enableAutoReconnect(bool enabled)
autoReconnect
=
enabled
;
}
bool
MainWindow
::
loadStyle
(
QGC_MAINWINDOW_STYLE
style
,
QString
cssFile
)
bool
MainWindow
::
loadStyle
(
QGC_MAINWINDOW_STYLE
style
)
{
qDebug
()
<<
"LOAD STYLE"
<<
style
;
bool
success
=
true
;
QString
styles
;
static
const
char
*
masterCssFile
=
":/files/styles/style-dark.css"
;
// Signal to the user that the app will pause to apply a new stylesheet
qApp
->
setOverrideCursor
(
Qt
::
WaitCursor
);
...
...
@@ -1079,43 +1066,31 @@ bool MainWindow::loadStyle(QGC_MAINWINDOW_STYLE style, QString cssFile)
// The dark style sheet is the master. Any other selected style sheet just overrides
// the colors of the master sheet.
QFile
masterStyleSheet
(
masterCssFi
le
);
QFile
masterStyleSheet
(
defaultDarkSty
le
);
if
(
masterStyleSheet
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
styles
=
masterStyleSheet
.
readAll
();
}
else
{
qDebug
()
<<
"Unable to load master style sheet"
;
qDebug
()
<<
"Unable to load master
dark
style sheet"
;
success
=
false
;
}
if
(
success
&&
cssFile
!=
masterCssFile
)
{
// Load the slave user specified stylesheet.
QFile
styleSheet
(
cssFile
);
if
(
styleSheet
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
if
(
success
&&
style
==
QGC_MAINWINDOW_STYLE_LIGHT
)
{
qDebug
()
<<
"LOADING LIGHT"
;
// Load the slave light stylesheet.
QFile
styleSheet
(
defaultLightStyle
);
if
(
styleSheet
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
styles
+=
styleSheet
.
readAll
();
qApp
->
setStyleSheet
(
styles
);
// And save the new stylesheet path.
if
(
currentStyle
==
QGC_MAINWINDOW_STYLE_LIGHT
)
{
lightStyleFileName
=
cssFile
;
}
else
{
darkStyleFileName
=
cssFile
;
}
// And trigger any changes to other UI elements that are watching for
// theme changes.
emit
styleChanged
(
style
);
}
else
{
qDebug
()
<<
"Unable to load slave
style sheet:"
<<
cssFile
;
qDebug
()
<<
"Unable to load slave
light sheet:"
;
success
=
false
;
}
}
if
(
!
styles
.
isEmpty
())
{
qApp
->
setStyleSheet
(
styles
);
emit
styleChanged
(
style
);
}
// Finally restore the cursor before returning.
qApp
->
restoreOverrideCursor
();
...
...
src/ui/MainWindow.h
View file @
120a417b
...
...
@@ -142,17 +142,6 @@ public:
return
currentStyle
;
}
/** @brief Get current light visual stylesheet */
QString
getLightStyleSheet
()
const
{
return
lightStyleFileName
;
}
/** @brief Get current dark visual stylesheet */
QString
getDarkStyleSheet
()
const
{
return
darkStyleFileName
;
}
/** @brief Get auto link reconnect setting */
bool
autoReconnectEnabled
()
const
{
...
...
@@ -249,10 +238,8 @@ public slots:
/** @brief Save power by reducing update rates */
void
enableLowPowerMode
(
bool
enabled
)
{
lowPowerMode
=
enabled
;
}
/** @brief Load a specific style.
* If it's a custom style, load the file indicated by the cssFile path.
*/
bool
loadStyle
(
QGC_MAINWINDOW_STYLE
style
,
QString
cssFile
);
/** @brief Load the specified style. */
bool
loadStyle
(
QGC_MAINWINDOW_STYLE
style
);
/** @brief Add a custom tool widget */
void
createCustomWidget
();
...
...
@@ -481,8 +468,6 @@ protected:
LogCompressor
*
comp
;
QString
screenFileName
;
QTimer
*
videoTimer
;
QString
darkStyleFileName
;
QString
lightStyleFileName
;
bool
autoReconnect
;
MAVLinkSimulationLink
*
simulationLink
;
Qt
::
WindowStates
windowStateVal
;
...
...
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