Commit 69d3ebb7 authored by Bryant's avatar Bryant

Moved joystick settings into the main settings page.

No major functionality changes.
parent 7cfc2708
......@@ -7,7 +7,7 @@
#include <QDesktopWidget>
JoystickWidget::JoystickWidget(JoystickInput* joystick, QWidget *parent) :
QDialog(parent),
QWidget(parent),
joystick(joystick),
m_ui(new Ui::JoystickWidget)
{
......
......@@ -31,7 +31,7 @@ This file is part of the PIXHAWK project
#ifndef JOYSTICKWIDGET_H
#define JOYSTICKWIDGET_H
#include <QDialog>
#include <QWidget>
#include <QLabel>
#include <QMap>
#include "JoystickInput.h"
......@@ -44,7 +44,7 @@ namespace Ui
class JoystickWidget;
}
class JoystickWidget : public QDialog
class JoystickWidget : public QWidget
{
Q_OBJECT
Q_DISABLE_COPY(JoystickWidget)
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>JoystickWidget</class>
<widget class="QDialog" name="JoystickWidget">
<widget class="QWidget" name="JoystickWidget">
<property name="geometry">
<rect>
<x>0</x>
......@@ -30,7 +30,7 @@
<number>8</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>8</number>
......@@ -174,53 +174,8 @@
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="dialogButtonsBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>dialogButtonsBox</sender>
<signal>accepted()</signal>
<receiver>JoystickWidget</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>263</x>
<y>438</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>
......@@ -279,7 +279,6 @@ void MainWindow::init()
// Connect user interface devices
emit initStatusChanged(tr("Initializing joystick interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
joystickWidget = NULL;
joystick = new JoystickInput();
#ifdef QGC_MOUSE_ENABLED_WIN
......@@ -1329,9 +1328,6 @@ void MainWindow::connectCommonActions()
// so no ressources spend on this.
ui.actionJoystickSettings->setVisible(true);
// Configuration
// Joystick
connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure()));
// Application Settings
connect(ui.actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));
......@@ -1380,22 +1376,9 @@ void MainWindow::showRoadMap()
}
}
void MainWindow::configure()
{
if (!joystickWidget)
{
if (!joystick->isRunning())
{
joystick->start();
}
joystickWidget = new JoystickWidget(joystick, this);
}
joystickWidget->show();
}
void MainWindow::showSettings()
{
QGCSettingsWidget* settings = new QGCSettingsWidget(this);
QGCSettingsWidget* settings = new QGCSettingsWidget(joystick, this);
settings->show();
}
......
......@@ -81,7 +81,6 @@ class QSplashScreen;
class QGCStatusBar;
class Linecharts;
class QGCDataPlot2D;
class JoystickWidget;
class MenuActionHelper;
class QGCUASFileViewMulti;
......@@ -202,7 +201,6 @@ public slots:
LinkInterface* addLink();
void addLink(LinkInterface* link);
bool configLink(LinkInterface *link);
void configure();
/** @brief Simulate a link */
void simulateLink(bool simulate);
/** @brief Set the currently controlled UAS */
......@@ -459,10 +457,7 @@ protected:
QPointer<QGCUASFileViewMulti> fileWidget;
// Popup widgets
JoystickWidget* joystickWidget;
JoystickInput* joystick;
JoystickInput* joystick; ///< The joystick manager for QGC
#ifdef QGC_MOUSE_ENABLED_WIN
/** @brief 3d Mouse support (WIN only) */
......
......@@ -62,7 +62,6 @@
<addaction name="actionSimulate"/>
<addaction name="separator"/>
<addaction name="actionMuteAudioOutput"/>
<addaction name="actionJoystickSettings"/>
<addaction name="actionSettings"/>
<addaction name="actionAdvanced_Mode"/>
<addaction name="separator"/>
......
......@@ -5,14 +5,13 @@
#include "MainWindow.h"
#include "ui_QGCSettingsWidget.h"
#include "JoystickWidget.h"
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
#include "MAVLinkSettingsWidget.h"
#include "GAudioOutput.h"
//, Qt::WindowFlags flags
QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
QGCSettingsWidget::QGCSettingsWidget(JoystickInput *joystick, QWidget *parent, Qt::WindowFlags flags) :
QDialog(parent, flags),
mainWindow((MainWindow*)parent),
ui(new Ui::QGCSettingsWidget)
......@@ -24,6 +23,9 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
position.moveCenter(QApplication::desktop()->availableGeometry().center());
move(position.topLeft());
// Add the joystick settings pane
ui->tabWidget->addTab(new JoystickWidget(joystick, this), "Controllers");
// Add all protocols
QList<ProtocolInterface*> protocols = LinkManager::instance()->getProtocols();
foreach (ProtocolInterface* protocol, protocols) {
......
......@@ -14,7 +14,7 @@ class QGCSettingsWidget : public QDialog
Q_OBJECT
public:
QGCSettingsWidget(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Sheet);
QGCSettingsWidget(JoystickInput *joystick, QWidget *parent = 0, Qt::WindowFlags flags = Qt::Sheet);
~QGCSettingsWidget();
public slots:
......
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