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)
default:
style = QGC_MAINWINDOW_STYLE_DARK;
case QGC_MAINWINDOW_STYLE_DARK:
styleFileName = ":files/styles/style-dark.css";
darkStyleFileName = ":files/styles/style-dark.css";
break;
case QGC_MAINWINDOW_STYLE_LIGHT:
styleFileName = ":files/styles/style-light.css";
......
......@@ -17,9 +17,6 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
{
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
QList<ProtocolInterface*> protocols = LinkManager::instance()->getProtocols();
foreach (ProtocolInterface* protocol, protocols) {
......@@ -53,7 +50,8 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
MainWindow::QGC_MAINWINDOW_STYLE style = (MainWindow::QGC_MAINWINDOW_STYLE)MainWindow::instance()->getStyle();
ui->styleChooser->setCurrentIndex(style);
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
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(deleteLater()));
......@@ -128,18 +126,7 @@ bool QGCSettingsWidget::updateStyle()
}
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.
updateStyle();
}
\ No newline at end of file
......@@ -6,12 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>535</width>
<height>427</height>
<width>392</width>
<height>313</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -73,75 +73,142 @@
</widget>
</item>
<item>
<widget class="QFrame" name="styleFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Style</string>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<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">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Use:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="styleChooser">
<item>
<property name="text">
<string>Dark (for indoor use)</string>
</property>
</item>
<item>
<property name="text">
<string>Light (for outdoor use)</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QComboBox" name="styleChooser">
<layout class="QHBoxLayout" name="DarkStyleLayout">
<item>
<property name="text">
<string>Dark (for indoor use)</string>
</property>
<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">
<string>Dark:</string>
</property>
</widget>
</item>
<item>
<property name="text">
<string>Light (for outdoor use)</string>
</property>
<widget class="QLineEdit" name="darkStyleFile"/>
</item>
<item>
<property name="text">
<string>Custom dark (for indoor use)</string>
</property>
<widget class="QPushButton" name="darkStyleCustomButton">
<property name="text">
<string>Custom</string>
</property>
</widget>
</item>
<item>
<property name="text">
<string>Custom light (for outdoor use)</string>
</property>
<widget class="QPushButton" name="darkStyleDefaultButton">
<property name="text">
<string>Default</string>
</property>
</widget>
</item>
</widget>
</layout>
</item>
<item>
<widget class="QFrame" name="customStyleFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item>
<widget class="QPushButton" name="customStyleFileButton">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
</layout>
</widget>
<layout class="QHBoxLayout" name="LightStyleLayout">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Light:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lightStyleFile"/>
</item>
<item>
<widget class="QPushButton" name="lightStyleCustomButton">
<property name="text">
<string>Custom</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="lightStyleDefaultButton">
<property name="text">
<string>Default</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</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>
</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