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
9649798b
Commit
9649798b
authored
Nov 18, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove support for user style file
parent
662c5b61
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
149 deletions
+1
-149
QGCSettingsWidget.cc
src/ui/QGCSettingsWidget.cc
+1
-106
QGCSettingsWidget.h
src/ui/QGCSettingsWidget.h
+0
-3
QGCSettingsWidget.ui
src/ui/QGCSettingsWidget.ui
+0
-40
No files found.
src/ui/QGCSettingsWidget.cc
View file @
9649798b
...
...
@@ -72,20 +72,9 @@ QGCSettingsWidget::QGCSettingsWidget(JoystickInput *joystick, QWidget *parent, Q
// Intialize the style UI to the proper values obtained from the MainWindow.
MainWindow
::
QGC_MAINWINDOW_STYLE
style
=
mainWindow
->
getStyle
();
ui
->
styleChooser
->
setCurrentIndex
(
style
);
if
(
style
==
MainWindow
::
QGC_MAINWINDOW_STYLE_DARK
)
{
ui
->
styleSheetFile
->
setText
(
mainWindow
->
getDarkStyleSheet
());
}
else
{
ui
->
styleSheetFile
->
setText
(
mainWindow
->
getLightStyleSheet
());
}
// And then connect all the signals for the UI for changing styles.
connect
(
ui
->
styleChooser
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
styleChanged
(
int
)));
connect
(
ui
->
styleCustomButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
selectStylesheet
()));
connect
(
ui
->
styleDefaultButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setDefaultStyle
()));
connect
(
ui
->
styleSheetFile
,
SIGNAL
(
editingFinished
()),
this
,
SLOT
(
lineEditFinished
()));
// Close / destroy
connect
(
ui
->
buttonBox
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
deleteLater
()));
...
...
@@ -96,103 +85,9 @@ QGCSettingsWidget::~QGCSettingsWidget()
delete
ui
;
}
void
QGCSettingsWidget
::
selectStylesheet
()
{
// Let user select style sheet. The root directory for the file picker is the user's home directory if they haven't loaded a custom style.
// Otherwise it defaults to the directory of that custom file.
QString
findDir
;
QString
oldStylesheet
(
ui
->
styleSheetFile
->
text
());
QFile
styleSheet
(
oldStylesheet
);
if
(
styleSheet
.
exists
()
&&
oldStylesheet
[
0
]
!=
':'
)
{
findDir
=
styleSheet
.
fileName
();
}
else
{
findDir
=
QDir
::
homePath
();
}
// Prompt the user to select a new style sheet. Do nothing if they cancel.
QString
newStyleFileName
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Specify stylesheet"
),
findDir
,
tr
(
"CSS Stylesheet (*.css);;"
));
if
(
newStyleFileName
.
isNull
())
{
return
;
}
// Load the new style sheet if a valid one was selected, notifying the user
// of an error if necessary.
QFile
newStyleFile
(
newStyleFileName
);
if
(
!
newStyleFile
.
exists
()
||
!
updateStyle
(
newStyleFileName
))
{
QMessageBox
msgBox
;
msgBox
.
setIcon
(
QMessageBox
::
Information
);
msgBox
.
setText
(
tr
(
"QGroundControl did not load a new style"
));
msgBox
.
setInformativeText
(
tr
(
"Stylesheet file %1 was not readable"
).
arg
(
newStyleFileName
));
msgBox
.
setStandardButtons
(
QMessageBox
::
Ok
);
msgBox
.
setDefaultButton
(
QMessageBox
::
Ok
);
msgBox
.
exec
();
}
// And update the UI as needed.
else
{
ui
->
styleSheetFile
->
setText
(
newStyleFileName
);
}
}
bool
QGCSettingsWidget
::
updateStyle
(
QString
style
)
{
switch
(
ui
->
styleChooser
->
currentIndex
())
{
case
0
:
return
mainWindow
->
loadStyle
(
MainWindow
::
QGC_MAINWINDOW_STYLE_DARK
,
style
);
case
1
:
return
mainWindow
->
loadStyle
(
MainWindow
::
QGC_MAINWINDOW_STYLE_LIGHT
,
style
);
default:
return
false
;
}
}
void
QGCSettingsWidget
::
lineEditFinished
()
{
QString
newStyleFileName
(
ui
->
styleSheetFile
->
text
());
QFile
newStyleFile
(
newStyleFileName
);
if
(
!
newStyleFile
.
exists
()
||
!
updateStyle
(
newStyleFileName
))
{
QMessageBox
msgBox
;
msgBox
.
setIcon
(
QMessageBox
::
Information
);
msgBox
.
setText
(
tr
(
"QGroundControl did not load a new style"
));
msgBox
.
setInformativeText
(
tr
(
"Stylesheet file %1 was not readable"
).
arg
(
newStyleFileName
));
msgBox
.
setStandardButtons
(
QMessageBox
::
Ok
);
msgBox
.
setDefaultButton
(
QMessageBox
::
Ok
);
msgBox
.
exec
();
}
}
void
QGCSettingsWidget
::
styleChanged
(
int
index
)
{
if
(
index
==
1
)
{
ui
->
styleSheetFile
->
setText
(
mainWindow
->
getLightStyleSheet
());
mainWindow
->
loadStyle
(
MainWindow
::
QGC_MAINWINDOW_STYLE_LIGHT
,
mainWindow
->
getLightStyleSheet
());
}
else
{
ui
->
styleSheetFile
->
setText
(
mainWindow
->
getDarkStyleSheet
());
mainWindow
->
loadStyle
(
MainWindow
::
QGC_MAINWINDOW_STYLE_DARK
,
mainWindow
->
getDarkStyleSheet
());
}
}
void
QGCSettingsWidget
::
setDefaultStyle
()
{
if
(
ui
->
styleChooser
->
currentIndex
()
==
1
)
{
ui
->
styleSheetFile
->
setText
(
MainWindow
::
defaultLightStyle
);
mainWindow
->
loadStyle
(
MainWindow
::
QGC_MAINWINDOW_STYLE_LIGHT
,
MainWindow
::
defaultLightStyle
);
}
else
{
ui
->
styleSheetFile
->
setText
(
MainWindow
::
defaultDarkStyle
);
mainWindow
->
loadStyle
(
MainWindow
::
QGC_MAINWINDOW_STYLE_DARK
,
MainWindow
::
defaultDarkStyle
);
}
mainWindow
->
loadStyle
((
index
==
1
)
?
MainWindow
::
QGC_MAINWINDOW_STYLE_LIGHT
:
MainWindow
::
QGC_MAINWINDOW_STYLE_DARK
);
}
void
QGCSettingsWidget
::
selectCustomMode
(
int
mode
)
...
...
src/ui/QGCSettingsWidget.h
View file @
9649798b
...
...
@@ -19,9 +19,6 @@ public:
public
slots
:
void
styleChanged
(
int
index
);
void
lineEditFinished
();
void
setDefaultStyle
();
void
selectStylesheet
();
void
selectCustomMode
(
int
mode
);
private
slots
:
...
...
src/ui/QGCSettingsWidget.ui
View file @
9649798b
...
...
@@ -108,46 +108,6 @@
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"DarkStyleLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Minimum"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"text"
>
<string>
Stylesheet:
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"styleSheetFile"
/>
</item>
<item>
<widget
class=
"QPushButton"
name=
"styleCustomButton"
>
<property
name=
"text"
>
<string>
Custom
</string>
</property>
<property
name=
"autoDefault"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"styleDefaultButton"
>
<property
name=
"text"
>
<string>
Default
</string>
</property>
<property
name=
"autoDefault"
>
<bool>
false
</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
...
...
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