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 {
QProgressBar::chunk#thrustBar {
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:
/** @brief Get a list of all links */
const QList<LinkInterface*> getLinks();
/** @brief Get a list of all protocols */
const QList<ProtocolInterface*> getProtocols() { return protocolLinks.uniqueKeys(); }
public slots:
void add(LinkInterface* link);
......
......@@ -28,6 +28,7 @@
#include "GAudioOutput.h"
#include "QGCToolWidget.h"
#include "QGCMAVLinkLogPlayer.h"
#include "QGCSettingsWidget.h"
#ifdef QGC_OSG_ENABLED
#include "Q3DWidgetFactory.h"
......@@ -261,7 +262,8 @@ QString MainWindow::getWindowStateKey()
QString MainWindow::getWindowGeometryKey()
{
return QString::number(currentView)+"_geometry";
//return QString::number(currentView)+"_geometry";
return "_geometry";
}
void MainWindow::buildCustomWidget()
......@@ -1344,8 +1346,12 @@ void MainWindow::connectCommonActions()
// unless it is actually used
// so no ressources spend on this.
ui.actionJoystickSettings->setVisible(true);
// Joystick configuration
// Configuration
// Joystick
connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure()));
// Application Settings
connect(ui.actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));
}
void MainWindow::connectPxActions()
......@@ -1414,6 +1420,12 @@ void MainWindow::configure()
joystickWidget->show();
}
void MainWindow::showSettings()
{
QGCSettingsWidget* settings = new QGCSettingsWidget(this);
settings->show();
}
void MainWindow::addLink()
{
SerialLink* link = new SerialLink();
......
......@@ -101,6 +101,9 @@ public slots:
/** @brief Shows an info message as popup or as widget */
void showInfoMessage(const QString& title, const QString& message);
/** @brief Show the application settings */
void showSettings();
/** @brief Add a communication link */
void addLink();
void addLink(LinkInterface* link);
void configure();
......
......@@ -60,17 +60,17 @@
</property>
<widget class="QMenu" name="menuPreferences">
<property name="title">
<string>Preferences</string>
<string>Display</string>
</property>
<addaction name="actionSelectStylesheet"/>
<addaction name="actionReloadStylesheet"/>
<addaction name="actionSettings"/>
</widget>
<addaction name="actionJoystick_Settings"/>
<addaction name="actionSimulate"/>
<addaction name="separator"/>
<addaction name="actionMuteAudioOutput"/>
<addaction name="actionJoystickSettings"/>
<addaction name="actionSettings"/>
<addaction name="menuPreferences"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
......
#include "QGCSettingsWidget.h"
#include "ui_QGCSettingsWidget.h"
QGCSettingsWidget::QGCSettingsWidget(QWidget *parent) :
QDialog(parent),
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
#include "MAVLinkSettingsWidget.h"
//, Qt::WindowFlags flags
QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
QDialog(parent, flags),
ui(new Ui::QGCSettingsWidget)
{
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()
......
......@@ -12,7 +12,7 @@ class QGCSettingsWidget : public QDialog
Q_OBJECT
public:
explicit QGCSettingsWidget(QWidget *parent = 0);
QGCSettingsWidget(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Sheet);
~QGCSettingsWidget();
private:
......
......@@ -6,42 +6,28 @@
<rect>
<x>0</x>
<y>0</y>
<width>467</width>
<height>294</height>
<width>535</width>
<height>427</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<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">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</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>
</widget>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<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