Commit a4201a09 authored by Bryant's avatar Bryant

Revised the UI for styling QGC again. I think it's a little clearer now.

parent 2a0f669b
...@@ -1228,7 +1228,7 @@ bool MainWindow::loadStyle(QGC_MAINWINDOW_STYLE style, QString cssFile) ...@@ -1228,7 +1228,7 @@ bool MainWindow::loadStyle(QGC_MAINWINDOW_STYLE style, QString cssFile)
default: default:
style = QGC_MAINWINDOW_STYLE_DARK; style = QGC_MAINWINDOW_STYLE_DARK;
case QGC_MAINWINDOW_STYLE_DARK: case QGC_MAINWINDOW_STYLE_DARK:
styleFileName = ":files/styles/style-dark.css"; darkStyleFileName = ":files/styles/style-dark.css";
break; break;
case QGC_MAINWINDOW_STYLE_LIGHT: case QGC_MAINWINDOW_STYLE_LIGHT:
styleFileName = ":files/styles/style-light.css"; styleFileName = ":files/styles/style-light.css";
......
...@@ -17,9 +17,6 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) : ...@@ -17,9 +17,6 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
{ {
ui->setupUi(this); ui->setupUi(this);
// Set the frame holding the options for the custom style frame to hidden by default
ui->customStyleFrame->setVisible(false);
// Add all protocols // Add all protocols
QList<ProtocolInterface*> protocols = LinkManager::instance()->getProtocols(); QList<ProtocolInterface*> protocols = LinkManager::instance()->getProtocols();
foreach (ProtocolInterface* protocol, protocols) { foreach (ProtocolInterface* protocol, protocols) {
...@@ -53,7 +50,8 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) : ...@@ -53,7 +50,8 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
MainWindow::QGC_MAINWINDOW_STYLE style = (MainWindow::QGC_MAINWINDOW_STYLE)MainWindow::instance()->getStyle(); MainWindow::QGC_MAINWINDOW_STYLE style = (MainWindow::QGC_MAINWINDOW_STYLE)MainWindow::instance()->getStyle();
ui->styleChooser->setCurrentIndex(style); ui->styleChooser->setCurrentIndex(style);
connect(ui->styleChooser, SIGNAL(currentIndexChanged(int)), this, SLOT(styleChanged(int))); connect(ui->styleChooser, SIGNAL(currentIndexChanged(int)), this, SLOT(styleChanged(int)));
connect(ui->customStyleFileButton, SIGNAL(clicked()), this, SLOT(selectStylesheet())); connect(ui->darkStyleCustomButton, SIGNAL(clicked()), this, SLOT(selectStylesheet()));
connect(ui->lightStyleCustomButton, SIGNAL(clicked()), this, SLOT(selectStylesheet()));
// Close / destroy // Close / destroy
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(deleteLater())); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(deleteLater()));
...@@ -129,17 +127,6 @@ bool QGCSettingsWidget::updateStyle() ...@@ -129,17 +127,6 @@ bool QGCSettingsWidget::updateStyle()
void QGCSettingsWidget::styleChanged(int index) void QGCSettingsWidget::styleChanged(int index)
{ {
// If a custom style is selected, enable the advanced view for the custom stylesheet. Otherwise,
// make sure it's hidden.
if (index == 2 || index == 3)
{
ui->customStyleFrame->setVisible(true);
}
else
{
ui->customStyleFrame->setVisible(false);
}
// And trigger a style update. // And trigger a style update.
updateStyle(); updateStyle();
} }
\ No newline at end of file
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>535</width> <width>392</width>
<height>427</height> <height>313</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
...@@ -73,20 +73,42 @@ ...@@ -73,20 +73,42 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QFrame" name="styleFrame"> <widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Style</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="frameShape"> <property name="text">
<enum>QFrame::Box</enum> <string>Use:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
<property name="frameShadow"> <property name="sizeHint" stdset="0">
<enum>QFrame::Sunken</enum> <size>
<width>40</width>
<height>20</height>
</size>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> </spacer>
</item>
<item> <item>
<widget class="QComboBox" name="styleChooser"> <widget class="QComboBox" name="styleChooser">
<item> <item>
...@@ -99,49 +121,94 @@ ...@@ -99,49 +121,94 @@
<string>Light (for outdoor use)</string> <string>Light (for outdoor use)</string>
</property> </property>
</item> </item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="DarkStyleLayout">
<item> <item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>Custom dark (for indoor use)</string> <string>Dark:</string>
</property> </property>
</widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="darkStyleFile"/>
</item>
<item>
<widget class="QPushButton" name="darkStyleCustomButton">
<property name="text"> <property name="text">
<string>Custom light (for outdoor use)</string> <string>Custom</string>
</property> </property>
</widget>
</item> </item>
<item>
<widget class="QPushButton" name="darkStyleDefaultButton">
<property name="text">
<string>Default</string>
</property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="LightStyleLayout">
<item> <item>
<widget class="QFrame" name="customStyleFrame"> <widget class="QLabel" name="label_3">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="frameShape"> <property name="text">
<enum>QFrame::NoFrame</enum> <string>Light:</string>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> </widget>
</item>
<item> <item>
<widget class="QLineEdit" name="lineEdit"/> <widget class="QLineEdit" name="lightStyleFile"/>
</item> </item>
<item> <item>
<widget class="QPushButton" name="customStyleFileButton"> <widget class="QPushButton" name="lightStyleCustomButton">
<property name="text"> <property name="text">
<string>Select</string> <string>Custom</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item>
<widget class="QPushButton" name="lightStyleDefaultButton">
<property name="text">
<string>Default</string>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
</item> </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment