Commit 966f438a authored by lm's avatar lm

Re-enabled settings and state of the art tool widgets

parent 05dc22fc
......@@ -38,6 +38,10 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
ui->reconnectCheckBox->setChecked(MainWindow::instance()->autoReconnectEnabled());
connect(ui->reconnectCheckBox, SIGNAL(clicked(bool)), MainWindow::instance(), SLOT(enableAutoReconnect(bool)));
// Low power mode
ui->lowPowerCheckBox->setChecked(MainWindow::instance()->lowPowerModeEnabled());
connect(ui->lowPowerCheckBox, SIGNAL(clicked(bool)), MainWindow::instance(), SLOT(enableLowPowerMode(bool)));
// Style
MainWindow::QGC_MAINWINDOW_STYLE style = (MainWindow::QGC_MAINWINDOW_STYLE)MainWindow::instance()->getStyle();
switch (style) {
......
......@@ -46,7 +46,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QRadioButton" name="nativeStyle">
<property name="text">
<string>Use native platform look and feel (Windows/Linux/Mac OS)</string>
......@@ -56,20 +56,30 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QRadioButton" name="indoorStyle">
<property name="text">
<string>Use indoor mission style (black background)</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QRadioButton" name="outdoorStyle">
<property name="text">
<string>Use outdoor mission style (light background)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="lowPowerCheckBox">
<property name="toolTip">
<string>Lowers all update rates to save battery power</string>
</property>
<property name="text">
<string>Enable low power mode</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
......
......@@ -174,6 +174,24 @@ void QGCToolWidget::contextMenuEvent (QContextMenuEvent* event)
menu.exec(event->globalPos());
}
void QGCToolWidget::hideEvent(QHideEvent* event)
{
// Store settings
storeWidgetsToSettings();
QWidget::hideEvent(event);
}
/**
* The widgets current view and the applied dock widget area.
* Both values are only stored internally and allow an external
* widget to configure it accordingly
*/
void QGCToolWidget::setViewVisibilityAndDockWidgetArea(int view, bool visible, Qt::DockWidgetArea area)
{
viewVisible.insert(view, visible);
dockWidgetArea.insert(view, area);
}
void QGCToolWidget::createActions()
{
addParamAction = new QAction(tr("New &Parameter Slider"), this);
......
......@@ -29,6 +29,9 @@ public:
/** @brief All instances of this class */
static QMap<QString, QGCToolWidget*>* instances();
int isVisible(int view) { return viewVisible.value(view, false); }
Qt::DockWidgetArea getDockWidgetArea(int view) { return dockWidgetArea.value(view, Qt::BottomDockWidgetArea); }
public slots:
void addUAS(UASInterface* uas);
/** @brief Delete this widget */
......@@ -39,6 +42,8 @@ public slots:
void importWidget(const QString& fileName);
/** @brief Store all widgets of this type to QSettings */
static void storeWidgetsToSettings();
/** @brief Store the view id and dock widget area */
void setViewVisibilityAndDockWidgetArea(int view, bool visible, Qt::DockWidgetArea area);
signals:
void titleChanged(QString);
......@@ -53,7 +58,9 @@ protected:
QAction* importAction;
QVBoxLayout* toolLayout;
UAS* mav;
QAction* mainMenuAction;
QAction* mainMenuAction; ///< Main menu action
QMap<int, Qt::DockWidgetArea> dockWidgetArea; ///< Dock widget area desired by this widget
QMap<int, bool> viewVisible; ///< Visibility in one view
void contextMenuEvent(QContextMenuEvent* event);
void createActions();
......@@ -62,6 +69,8 @@ protected:
/** @brief Add an existing tool widget */
void addToolWidget(QGCToolWidgetItem* widget);
void hideEvent(QHideEvent* event);
protected slots:
void addParam();
/** @deprecated */
......
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