Commit a97c4405 authored by lm's avatar lm

Added settings dialog for QGroundControl, holds for now only MAVLink preferences

parent e4dfd0ee
...@@ -356,3 +356,38 @@ QProgressBar::chunk#speedBar { ...@@ -356,3 +356,38 @@ QProgressBar::chunk#speedBar {
QProgressBar::chunk#thrustBar { QProgressBar::chunk#thrustBar {
background-color: orange; background-color: orange;
} }
QDialog {
border: 1px solid #62676B;
border-radius: 2px;
}
QTabWidget::pane { /* The tab widget frame */
border: 1px solid #62676B;
border-radius: 2px;
position: absolute;
top: -0.5em;
}
QTabWidget::tab-bar {
alignment: center;
}
/* Style the tab using the tab sub-control. Note that
it reads QTabBar _not_ QTabWidget */
QTabBar::tab {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #090909, stop: 1 #353535);
border: 2px solid #62676B;
border-radius: 4px;
min-width: 8ex;
padding: 2px;
}
QTabBar::tab:selected, QTabBar::tab:hover {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #090909, stop: 1 #353535);
border: 2px solid #379AC3;
}
QTabBar::tab:selected {
border: 2px solid #379AC3;
}
...@@ -62,6 +62,9 @@ public: ...@@ -62,6 +62,9 @@ public:
/** @brief Get a list of all links */ /** @brief Get a list of all links */
const QList<LinkInterface*> getLinks(); const QList<LinkInterface*> getLinks();
/** @brief Get a list of all protocols */
const QList<ProtocolInterface*> getProtocols() { return protocolLinks.uniqueKeys(); }
public slots: public slots:
void add(LinkInterface* link); void add(LinkInterface* link);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "GAudioOutput.h" #include "GAudioOutput.h"
#include "QGCToolWidget.h" #include "QGCToolWidget.h"
#include "QGCMAVLinkLogPlayer.h" #include "QGCMAVLinkLogPlayer.h"
#include "QGCSettingsWidget.h"
#ifdef QGC_OSG_ENABLED #ifdef QGC_OSG_ENABLED
#include "Q3DWidgetFactory.h" #include "Q3DWidgetFactory.h"
...@@ -261,7 +262,8 @@ QString MainWindow::getWindowStateKey() ...@@ -261,7 +262,8 @@ QString MainWindow::getWindowStateKey()
QString MainWindow::getWindowGeometryKey() QString MainWindow::getWindowGeometryKey()
{ {
return QString::number(currentView)+"_geometry"; //return QString::number(currentView)+"_geometry";
return "_geometry";
} }
void MainWindow::buildCustomWidget() void MainWindow::buildCustomWidget()
...@@ -1344,8 +1346,12 @@ void MainWindow::connectCommonActions() ...@@ -1344,8 +1346,12 @@ void MainWindow::connectCommonActions()
// unless it is actually used // unless it is actually used
// so no ressources spend on this. // so no ressources spend on this.
ui.actionJoystickSettings->setVisible(true); ui.actionJoystickSettings->setVisible(true);
// Joystick configuration
// Configuration
// Joystick
connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure())); connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure()));
// Application Settings
connect(ui.actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));
} }
void MainWindow::connectPxActions() void MainWindow::connectPxActions()
...@@ -1414,6 +1420,12 @@ void MainWindow::configure() ...@@ -1414,6 +1420,12 @@ void MainWindow::configure()
joystickWidget->show(); joystickWidget->show();
} }
void MainWindow::showSettings()
{
QGCSettingsWidget* settings = new QGCSettingsWidget(this);
settings->show();
}
void MainWindow::addLink() void MainWindow::addLink()
{ {
SerialLink* link = new SerialLink(); SerialLink* link = new SerialLink();
......
...@@ -101,6 +101,9 @@ public slots: ...@@ -101,6 +101,9 @@ public slots:
/** @brief Shows an info message as popup or as widget */ /** @brief Shows an info message as popup or as widget */
void showInfoMessage(const QString& title, const QString& message); void showInfoMessage(const QString& title, const QString& message);
/** @brief Show the application settings */
void showSettings();
/** @brief Add a communication link */
void addLink(); void addLink();
void addLink(LinkInterface* link); void addLink(LinkInterface* link);
void configure(); void configure();
......
...@@ -60,17 +60,17 @@ ...@@ -60,17 +60,17 @@
</property> </property>
<widget class="QMenu" name="menuPreferences"> <widget class="QMenu" name="menuPreferences">
<property name="title"> <property name="title">
<string>Preferences</string> <string>Display</string>
</property> </property>
<addaction name="actionSelectStylesheet"/> <addaction name="actionSelectStylesheet"/>
<addaction name="actionReloadStylesheet"/> <addaction name="actionReloadStylesheet"/>
<addaction name="actionSettings"/>
</widget> </widget>
<addaction name="actionJoystick_Settings"/> <addaction name="actionJoystick_Settings"/>
<addaction name="actionSimulate"/> <addaction name="actionSimulate"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionMuteAudioOutput"/> <addaction name="actionMuteAudioOutput"/>
<addaction name="actionJoystickSettings"/> <addaction name="actionJoystickSettings"/>
<addaction name="actionSettings"/>
<addaction name="menuPreferences"/> <addaction name="menuPreferences"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionExit"/> <addaction name="actionExit"/>
......
#include "QGCSettingsWidget.h" #include "QGCSettingsWidget.h"
#include "ui_QGCSettingsWidget.h" #include "ui_QGCSettingsWidget.h"
QGCSettingsWidget::QGCSettingsWidget(QWidget *parent) : #include "LinkManager.h"
QDialog(parent), #include "MAVLinkProtocol.h"
#include "MAVLinkSettingsWidget.h"
//, Qt::WindowFlags flags
QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
QDialog(parent, flags),
ui(new Ui::QGCSettingsWidget) ui(new Ui::QGCSettingsWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
// Add all protocols
QList<ProtocolInterface*> protocols = LinkManager::instance()->getProtocols();
foreach (ProtocolInterface* protocol, protocols)
{
MAVLinkProtocol* mavlink = dynamic_cast<MAVLinkProtocol*>(protocol);
if (mavlink)
{
MAVLinkSettingsWidget* msettings = new MAVLinkSettingsWidget(mavlink, this);
ui->tabWidget->addTab(msettings, "MAVLink");
}
}
this->window()->setWindowTitle(tr("QGroundControl Settings"));
// Close / destroy
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(deleteLater()));
} }
QGCSettingsWidget::~QGCSettingsWidget() QGCSettingsWidget::~QGCSettingsWidget()
......
...@@ -12,7 +12,7 @@ class QGCSettingsWidget : public QDialog ...@@ -12,7 +12,7 @@ class QGCSettingsWidget : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit QGCSettingsWidget(QWidget *parent = 0); QGCSettingsWidget(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Sheet);
~QGCSettingsWidget(); ~QGCSettingsWidget();
private: private:
......
...@@ -6,42 +6,28 @@ ...@@ -6,42 +6,28 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>467</width> <width>535</width>
<height>294</height> <height>427</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>240</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Close</set>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30</x>
<y>20</y>
<width>401</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>QGroundControl Settings - Work in Progress, no Settings yet</string>
</property> </property>
</widget> </widget>
</item>
</layout>
</widget> </widget>
<resources/> <resources/>
<connections> <connections>
......
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