Commit ec3047af authored by Gus Grubba's avatar Gus Grubba

Merge pull request #2374 from dogmaphobic/commSettings

Removing old comm link settings.
parents 90222306 6a1fe19d
......@@ -193,11 +193,6 @@ FORMS += \
src/ui/MainWindow.ui \
src/QGCQmlWidgetHolder.ui \
DebugBuild {
FORMS += \
src/ui/MockLinkConfiguration.ui \
}
!iOSBuild {
FORMS += \
src/ui/SerialSettings.ui \
......@@ -208,21 +203,16 @@ FORMS += \
src/ui/uas/QGCUnconnectedInfoWidget.ui \
src/ui/uas/UASMessageView.ui \
src/ui/Linechart.ui \
src/ui/LogReplayLinkConfigurationWidget.ui \
src/ui/MultiVehicleDockWidget.ui \
src/ui/MAVLinkSettingsWidget.ui \
src/ui/QGCCommConfiguration.ui \
src/ui/QGCDataPlot2D.ui \
src/ui/QGCHilConfiguration.ui \
src/ui/QGCHilFlightGearConfiguration.ui \
src/ui/QGCHilJSBSimConfiguration.ui \
src/ui/QGCHilXPlaneConfiguration.ui \
src/ui/QGCLinkConfiguration.ui \
src/ui/QGCMapRCToParamDialog.ui \
src/ui/QGCMAVLinkInspector.ui \
src/ui/QGCMAVLinkLogPlayer.ui \
src/ui/QGCTCPLinkConfiguration.ui \
src/ui/QGCUDPLinkConfiguration.ui \
src/ui/QGCTabbedInfoView.ui \
src/ui/QGCUASFileView.ui \
src/ui/QGCUASFileViewMulti.ui \
......@@ -287,7 +277,6 @@ HEADERS += \
src/comm/MockLink.h \
src/comm/MockLinkFileServer.h \
src/comm/MockLinkMissionItemHandler.h \
src/ui/MockLinkConfiguration.h \
}
WindowsBuild {
......@@ -325,17 +314,12 @@ HEADERS += \
src/ui/linechart/LinechartWidget.h \
src/ui/linechart/Scrollbar.h \
src/ui/linechart/ScrollZoomer.h \
src/ui/LogReplayLinkConfigurationWidget.h \
src/ui/MainWindow.h \
src/ui/MAVLinkDecoder.h \
src/ui/MAVLinkSettingsWidget.h \
src/ui/MultiVehicleDockWidget.h \
src/ui/QGCCommConfiguration.h \
src/ui/QGCLinkConfiguration.h \
src/ui/QGCMAVLinkLogPlayer.h \
src/ui/QGCMapRCToParamDialog.h \
src/ui/QGCTCPLinkConfiguration.h \
src/ui/QGCUDPLinkConfiguration.h \
src/ui/SettingsDialog.h \
src/ui/uas/UASMessageView.h \
src/ui/uas/QGCUnconnectedInfoWidget.h \
......@@ -409,7 +393,6 @@ SOURCES += \
src/comm/MockLink.cc \
src/comm/MockLinkFileServer.cc \
src/comm/MockLinkMissionItemHandler.cc \
src/ui/MockLinkConfiguration.cc \
}
!iOSBuild {
......@@ -430,16 +413,11 @@ SOURCES += \
src/uas/FileManager.cc \
src/ui/uas/QGCUnconnectedInfoWidget.cc \
src/ui/SettingsDialog.cc \
src/ui/QGCTCPLinkConfiguration.cc \
src/ui/QGCUDPLinkConfiguration.cc \
src/ui/MAVLinkDecoder.cc \
src/ui/MAVLinkSettingsWidget.cc \
src/ui/QGCCommConfiguration.cc \
src/ui/QGCLinkConfiguration.cc \
src/ui/QGCMapRCToParamDialog.cpp \
src/comm/LogReplayLink.cc \
src/QGCFileDialog.cc \
src/ui/LogReplayLinkConfigurationWidget.cc \
src/ui/QGCMAVLinkLogPlayer.cc \
src/comm/QGCFlightGearLink.cc \
src/comm/QGCJSBSimLink.cc \
......
......@@ -168,6 +168,12 @@ void QGroundControlQmlGlobal::setIsVersionCheckEnabled(bool enable)
emit isVersionCheckEnabledChanged(enable);
}
void QGroundControlQmlGlobal::setMavlinkSystemID(int id)
{
qgcApp()->toolbox()->mavlinkProtocol()->setSystemId(id);
emit mavlinkSystemIDChanged(id);
}
void QGroundControlQmlGlobal::setVirtualTabletJoystick(bool enabled)
{
if (_virtualTabletJoystick != enabled) {
......
......@@ -64,10 +64,13 @@ public:
Q_PROPERTY(bool isAudioMuted READ isAudioMuted WRITE setIsAudioMuted NOTIFY isAudioMutedChanged)
Q_PROPERTY(bool isSaveLogPrompt READ isSaveLogPrompt WRITE setIsSaveLogPrompt NOTIFY isSaveLogPromptChanged)
Q_PROPERTY(bool isSaveLogPromptNotArmed READ isSaveLogPromptNotArmed WRITE setIsSaveLogPromptNotArmed NOTIFY isSaveLogPromptNotArmedChanged)
Q_PROPERTY(bool virtualTabletJoystick READ virtualTabletJoystick WRITE setVirtualTabletJoystick NOTIFY virtualTabletJoystickChanged)
// MavLink Protocol
Q_PROPERTY(bool isHeartBeatEnabled READ isHeartBeatEnabled WRITE setIsHeartBeatEnabled NOTIFY isHeartBeatEnabledChanged)
Q_PROPERTY(bool isMultiplexingEnabled READ isMultiplexingEnabled WRITE setIsMultiplexingEnabled NOTIFY isMultiplexingEnabledChanged)
Q_PROPERTY(bool isVersionCheckEnabled READ isVersionCheckEnabled WRITE setIsVersionCheckEnabled NOTIFY isVersionCheckEnabledChanged)
Q_PROPERTY(bool virtualTabletJoystick READ virtualTabletJoystick WRITE setVirtualTabletJoystick NOTIFY virtualTabletJoystickChanged)
Q_PROPERTY(int mavlinkSystemID READ mavlinkSystemID WRITE setMavlinkSystemID NOTIFY mavlinkSystemIDChanged)
Q_INVOKABLE void saveGlobalSetting (const QString& key, const QString& value);
Q_INVOKABLE QString loadGlobalSetting (const QString& key, const QString& defaultValue);
......@@ -99,10 +102,12 @@ public:
bool isAudioMuted () { return qgcApp()->toolbox()->audioOutput()->isMuted(); }
bool isSaveLogPrompt () { return qgcApp()->promptFlightDataSave(); }
bool isSaveLogPromptNotArmed () { return qgcApp()->promptFlightDataSaveNotArmed(); }
bool virtualTabletJoystick () { return _virtualTabletJoystick; }
bool isHeartBeatEnabled () { return qgcApp()->toolbox()->mavlinkProtocol()->heartbeatsEnabled(); }
bool isMultiplexingEnabled () { return qgcApp()->toolbox()->mavlinkProtocol()->multiplexingEnabled(); }
bool isVersionCheckEnabled () { return qgcApp()->toolbox()->mavlinkProtocol()->versionCheckEnabled(); }
bool virtualTabletJoystick () { return _virtualTabletJoystick; }
int mavlinkSystemID () { return qgcApp()->toolbox()->mavlinkProtocol()->getSystemId(); }
//-- TODO: Make this into an actual preference.
bool isAdvancedMode () { return false; }
......@@ -111,20 +116,23 @@ public:
void setIsAudioMuted (bool muted);
void setIsSaveLogPrompt (bool prompt);
void setIsSaveLogPromptNotArmed (bool prompt);
void setVirtualTabletJoystick (bool enabled);
void setIsHeartBeatEnabled (bool enable);
void setIsMultiplexingEnabled (bool enable);
void setIsVersionCheckEnabled (bool enable);
void setVirtualTabletJoystick (bool enabled);
void setMavlinkSystemID (int id);
signals:
void isDarkStyleChanged (bool dark);
void isAudioMutedChanged (bool muted);
void isSaveLogPromptChanged (bool prompt);
void isSaveLogPromptNotArmedChanged (bool prompt);
void virtualTabletJoystickChanged (bool enabled);
void isHeartBeatEnabledChanged (bool enabled);
void isMultiplexingEnabledChanged (bool enabled);
void isVersionCheckEnabledChanged (bool enabled);
void virtualTabletJoystickChanged (bool enabled);
void mavlinkSystemIDChanged (int id);
private:
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#include "LogReplayLinkConfigurationWidget.h"
#include "QGCFileDialog.h"
#include "QGCApplication.h"
LogReplayLinkConfigurationWidget::LogReplayLinkConfigurationWidget(LogReplayLinkConfiguration *config, QWidget *parent, Qt::WindowFlags flags) :
QWidget(parent, flags)
{
_ui.setupUi(this);
Q_ASSERT(config != NULL);
_config = config;
_ui.logFilename->setText(_config->logFilename());
connect(_ui.selectLogFileButton, &QPushButton::clicked, this, &LogReplayLinkConfigurationWidget::_selectLogFile);
}
void LogReplayLinkConfigurationWidget::_selectLogFile(bool checked)
{
Q_UNUSED(checked);
QString logFile = QGCFileDialog::getOpenFileName(this,
"Select log file to replay",
qgcApp()->mavlinkLogFilesLocation(),
"MAVLink Log Files (*.mavlink);;All Files (*)");
if (!logFile.isEmpty()) {
_ui.logFilename->setText(logFile);
_config->setLogFilename(logFile);
}
}
\ No newline at end of file
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef _LogReplayLinkConfigurationWidget_H_
#define _LogReplayLinkConfigurationWidget_H_
#include <QWidget>
#include "LogReplayLink.h"
#include "ui_LogReplayLinkConfigurationWidget.h"
class LogReplayLinkConfigurationWidget : public QWidget
{
Q_OBJECT
public:
LogReplayLinkConfigurationWidget(LogReplayLinkConfiguration* config, QWidget *parent = 0, Qt::WindowFlags flags = Qt::Sheet);
private slots:
void _selectLogFile(bool checked);
private:
Ui::LogReplayLinkConfigurationWidget _ui;
LogReplayLinkConfiguration* _config;
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LogReplayLinkConfigurationWidget</class>
<widget class="QWidget" name="LogReplayLinkConfigurationWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>325</width>
<height>347</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Log File:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="logFilename">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="selectLogFileButton">
<property name="text">
<string>Select Log File</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
<action name="actionDelete">
<property name="text">
<string>Delete</string>
</property>
<property name="toolTip">
<string>Delete this link</string>
</property>
<property name="statusTip">
<string>Delete this link</string>
</property>
<property name="whatsThis">
<string>Link delete button</string>
</property>
</action>
<action name="actionConnect">
<property name="text">
<string>Connect</string>
</property>
<property name="toolTip">
<string>Connect this link</string>
</property>
<property name="statusTip">
<string>Connect this link</string>
</property>
<property name="whatsThis">
<string>Connect this link</string>
</property>
</action>
<action name="actionClose">
<property name="text">
<string>Close</string>
</property>
<property name="toolTip">
<string>Close the configuration window</string>
</property>
<property name="statusTip">
<string>Close the configuration window</string>
</property>
<property name="whatsThis">
<string>Close the configuration window</string>
</property>
</action>
</widget>
<resources/>
<connections>
<connection>
<sender>actionClose</sender>
<signal>triggered()</signal>
<receiver>LogReplayLinkConfigurationWidget</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>224</x>
<y>195</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -536,9 +536,6 @@ void MainWindow::configureWindowName()
**/
void MainWindow::connectCommonActions()
{
// Connect actions from ui
connect(_ui.actionAdd_Link, SIGNAL(triggered()), this, SLOT(manageLinks()));
// Audio output
_ui.actionMuteAudioOutput->setChecked(qgcApp()->toolbox()->audioOutput()->isMuted());
connect(qgcApp()->toolbox()->audioOutput(), SIGNAL(mutedChanged(bool)), _ui.actionMuteAudioOutput, SLOT(setChecked(bool)));
......@@ -581,13 +578,6 @@ void MainWindow::showSettings()
SettingsDialog settings(this);
settings.exec();
}
void MainWindow::manageLinks()
{
SettingsDialog settings(this, SettingsDialog::ShowCommLinks);
settings.exec();
}
#endif
void MainWindow::_vehicleAdded(Vehicle* vehicle)
......
......@@ -104,7 +104,6 @@ public:
public slots:
#ifndef __mobile__
void showSettings();
void manageLinks();
#endif
/** @brief Save power by reducing update rates */
......
......@@ -60,7 +60,6 @@
</property>
<addaction name="separator"/>
<addaction name="actionMuteAudioOutput"/>
<addaction name="actionAdd_Link"/>
<addaction name="actionSettings"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#include "MockLinkConfiguration.h"
#include "ui_MockLinkConfiguration.h"
MockLinkConfiguration::MockLinkConfiguration(MockConfiguration *config, QWidget *parent)
: QWidget(parent)
, _ui(new Ui::MockLinkConfiguration)
, _config(config)
{
_ui->setupUi(this);
switch (config->firmwareType()) {
case MAV_AUTOPILOT_PX4:
_ui->px4Radio->setChecked(true);
break;
case MAV_AUTOPILOT_ARDUPILOTMEGA:
_ui->apmRadio->setChecked(true);
break;
default:
_ui->genericRadio->setChecked(true);
break;
}
switch (config->vehicleType()) {
case MAV_TYPE_FIXED_WING:
_ui->apmArduPlaneRadio->setChecked(true);
break;
default:
_ui->apmArduCopterRadio->setChecked(true);
break;
}
_ui->sendStatusTextCheckBox->setChecked(config->sendStatusText());
connect(_ui->px4Radio, &QRadioButton::clicked, this, &MockLinkConfiguration::_px4RadioClicked);
connect(_ui->apmRadio, &QRadioButton::clicked, this, &MockLinkConfiguration::_apmRadioClicked);
connect(_ui->genericRadio, &QRadioButton::clicked, this, &MockLinkConfiguration::_genericRadioClicked);
connect(_ui->apmArduCopterRadio, &QRadioButton::clicked, this, &MockLinkConfiguration::_apmArduCopterRadioClicked);
connect(_ui->apmArduPlaneRadio, &QRadioButton::clicked, this, &MockLinkConfiguration::_apmArduPlaneRadioClicked);
connect(_ui->genericRadio, &QRadioButton::clicked, this, &MockLinkConfiguration::_genericRadioClicked);
connect(_ui->sendStatusTextCheckBox, &QCheckBox::clicked, this, &MockLinkConfiguration::_sendStatusTextClicked);
}
MockLinkConfiguration::~MockLinkConfiguration()
{
delete _ui;
}
void MockLinkConfiguration::_px4RadioClicked(bool checked)
{
if (checked) {
_config->setFirmwareType(MAV_AUTOPILOT_PX4);
}
}
void MockLinkConfiguration::_apmRadioClicked(bool checked)
{
if (checked) {
_config->setFirmwareType(MAV_AUTOPILOT_ARDUPILOTMEGA);
}
}
void MockLinkConfiguration::_genericRadioClicked(bool checked)
{
if (checked) {
_config->setFirmwareType(MAV_AUTOPILOT_GENERIC);
}
}
void MockLinkConfiguration::_apmArduCopterRadioClicked(bool checked)
{
if (checked) {
_config->setVehicleType(MAV_TYPE_QUADROTOR);
}
}
void MockLinkConfiguration::_apmArduPlaneRadioClicked(bool checked)
{
if (checked) {
_config->setVehicleType(MAV_TYPE_FIXED_WING);
}
}
void MockLinkConfiguration::_sendStatusTextClicked(bool checked)
{
_config->setSendStatusText(checked);
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef MockLinkConfiguration_H
#define MockLinkConfiguration_H
#include <QWidget>
#include "MockLink.h"
namespace Ui
{
class MockLinkConfiguration;
}
class MockLinkConfiguration : public QWidget
{
Q_OBJECT
public:
explicit MockLinkConfiguration(MockConfiguration *config, QWidget *parent = 0);
~MockLinkConfiguration();
private slots:
void _px4RadioClicked(bool checked);
void _apmRadioClicked(bool checked);
void _genericRadioClicked(bool checked);
void _apmArduCopterRadioClicked(bool checked);
void _apmArduPlaneRadioClicked(bool checked);
void _sendStatusTextClicked(bool checked);
private:
Ui::MockLinkConfiguration* _ui;
MockConfiguration* _config;
};
#endif // MockLinkConfiguration_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MockLinkConfiguration</class>
<widget class="QWidget" name="MockLinkConfiguration">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>238</width>
<height>188</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="px4Radio">
<property name="text">
<string>PX4 Firmware</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="apmRadio">
<property name="text">
<string>APM Firmware</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="genericRadio">
<property name="text">
<string>Generic Firmware</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="sendStatusTextCheckBox">
<property name="text">
<string>Send status text + voice</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>APM vehicle type</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="apmArduCopterRadio">
<property name="text">
<string>ArduCopter</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="apmArduPlaneRadio">
<property name="text">
<string>ArduPlane</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Comm Link Configuration
* @author Gus Grubba <mavlink@grubba.com>
*
*/
#include <QPushButton>
#ifndef __ios__
#include "SerialLink.h"
#include "SerialConfigurationWindow.h"
#endif
#include "QGCUDPLinkConfiguration.h"
#include "QGCTCPLinkConfiguration.h"
#ifdef QT_DEBUG
#include "MockLinkConfiguration.h"
#endif
#ifndef __mobile__
#include "LogReplayLinkConfigurationWidget.h"
#endif
#include "QGCCommConfiguration.h"
#include "ui_QGCCommConfiguration.h"
QGCCommConfiguration::QGCCommConfiguration(QWidget *parent, LinkConfiguration *config) :
QDialog(parent),
_ui(new Ui::QGCCommConfiguration)
{
_ui->setupUi(this);
// Add link types
_config = config;
_ui->typeCombo->addItem(tr("Select Type"), LinkConfiguration::TypeLast);
#ifndef __ios__
_ui->typeCombo->addItem(tr("Serial"), LinkConfiguration::TypeSerial);
#endif
_ui->typeCombo->addItem(tr("UDP"), LinkConfiguration::TypeUdp);
_ui->typeCombo->addItem(tr("TCP"), LinkConfiguration::TypeTcp);
#ifndef __mobile__
_ui->typeCombo->addItem(tr("Log replay"), LinkConfiguration::TypeLogReplay);
#endif
#ifdef QT_DEBUG
_ui->typeCombo->addItem(tr("Mock"), LinkConfiguration::TypeMock);
#endif
#if 0
#ifdef QGC_RTLAB_ENABLED
_ui->typeCombo->addItem(tr("Opal-RT Link"), LinkConfiguration::TypeOpal);
#endif
#ifdef QGC_XBEE_ENABLED
_ui->typeCombo->addItem(tr("Xbee API"), LinkConfiguration::TypeXbee);
#endif
#endif
_ui->typeCombo->setEditable(false);
if(config && !config->name().isEmpty()) {
_ui->nameEdit->setText(config->name());
} else {
_ui->nameEdit->setText(tr("Unnamed"));
}
if(!config) {
setWindowTitle(tr("Add New Communication Link"));
} else {
setWindowTitle(tr("Edit Communication Link"));
_loadTypeConfigWidget(config->type());
_ui->typeCombo->setEnabled(false);
}
_updateUI();
}
QGCCommConfiguration::~QGCCommConfiguration()
{
delete _ui;
}
void QGCCommConfiguration::on_typeCombo_currentIndexChanged(int index)
{
int type = _ui->typeCombo->itemData(index).toInt();
_changeLinkType(type);
}
void QGCCommConfiguration::_changeLinkType(int type)
{
//-- Do we need to change anything?
if(type == LinkConfiguration::TypeLast || (_config && _config->type() == type)) {
return;
}
// Switching connection type. Delete old config.
delete _config;
// Create new config instance
QString name = _ui->nameEdit->text();
if(name.isEmpty()) {
name = tr("Untitled");
_ui->nameEdit->setText(name);
}
_config = LinkConfiguration::createSettings(type, name);
Q_ASSERT(_config != NULL);
_loadTypeConfigWidget(type);
_updateUI();
}
void QGCCommConfiguration::_loadTypeConfigWidget(int type)
{
Q_ASSERT(_config != NULL);
switch(type) {
#ifndef __ios__
case LinkConfiguration::TypeSerial: {
QWidget* conf = new SerialConfigurationWindow((SerialConfiguration*)_config, this);
_ui->linkScrollArea->setWidget(conf);
_ui->linkGroupBox->setTitle(tr("Serial Link"));
_ui->typeCombo->setCurrentIndex(_ui->typeCombo->findData(LinkConfiguration::TypeSerial));
}
break;
#endif
case LinkConfiguration::TypeUdp: {
QWidget* conf = new QGCUDPLinkConfiguration((UDPConfiguration*)_config, this);
_ui->linkScrollArea->setWidget(conf);
_ui->linkGroupBox->setTitle(tr("UDP Link"));
_ui->typeCombo->setCurrentIndex(_ui->typeCombo->findData(LinkConfiguration::TypeUdp));
}
break;
case LinkConfiguration::TypeTcp: {
QWidget* conf = new QGCTCPLinkConfiguration((TCPConfiguration*)_config, this);
_ui->linkScrollArea->setWidget(conf);
_ui->linkGroupBox->setTitle(tr("TCP Link"));
_ui->typeCombo->setCurrentIndex(_ui->typeCombo->findData(LinkConfiguration::TypeTcp));
}
break;
#ifndef __mobile__
case LinkConfiguration::TypeLogReplay: {
QWidget* conf = new LogReplayLinkConfigurationWidget((LogReplayLinkConfiguration*)_config, this);
_ui->linkScrollArea->setWidget(conf);
_ui->linkGroupBox->setTitle("Log Replay");
_ui->typeCombo->setCurrentIndex(_ui->typeCombo->findData(LinkConfiguration::TypeLogReplay));
}
break;
#endif
#ifdef QT_DEBUG
case LinkConfiguration::TypeMock: {
QWidget* conf = new MockLinkConfiguration((MockConfiguration*)_config, this);
_ui->linkScrollArea->setWidget(conf);
_ui->linkGroupBox->setTitle(tr("Mock Link"));
_ui->typeCombo->setCurrentIndex(_ui->typeCombo->findData(LinkConfiguration::TypeMock));
}
break;
#endif
// Cannot be the case, but in case it gets here, we cannot continue.
default:
reject();
break;
}
// Remove "Select Type" once something is selected
int idx = _ui->typeCombo->findData(LinkConfiguration::TypeLast);
if(idx >= 0) {
_ui->typeCombo->removeItem(idx);
}
}
void QGCCommConfiguration::_updateUI()
{
bool enableOK = false;
if(_config) {
if(!_ui->nameEdit->text().isEmpty()) {
enableOK = true;
}
}
QPushButton* ok = _ui->buttonBox->button(QDialogButtonBox::Ok);
Q_ASSERT(ok != NULL);
ok->setEnabled(enableOK);
}
void QGCCommConfiguration::on_buttonBox_accepted()
{
if(_config) {
_config->setName(_ui->nameEdit->text());
}
accept();
}
void QGCCommConfiguration::on_buttonBox_rejected()
{
reject();
}
void QGCCommConfiguration::on_nameEdit_textEdited(const QString &arg1)
{
Q_UNUSED(arg1);
_updateUI();
if(_config) {
_config->setDynamic(false);
}
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Comm Link Configuration
* @author Gus Grubba <mavlink@grubba.com>
*
*/
#ifndef QGCCOMMCONFIGURATION_H
#define QGCCOMMCONFIGURATION_H
#include <QWidget>
#include <QDialog>
#include "LinkConfiguration.h"
namespace Ui {
class QGCCommConfiguration;
}
class QGCCommConfiguration : public QDialog
{
Q_OBJECT
public:
explicit QGCCommConfiguration(QWidget *parent, LinkConfiguration* config = 0);
~QGCCommConfiguration();
enum {
QGC_LINK_SERIAL,
QGC_LINK_UDP,
QGC_LINK_TCP,
QGC_LINK_SIMULATION,
QGC_LINK_FORWARDING,
#ifdef QT_DEBUG
QGC_LINK_MOCK,
#endif
#ifdef QGC_XBEE_ENABLED
QGC_LINK_XBEE,
#endif
#ifdef QGC_RTLAB_ENABLED
QGC_LINK_OPAL
#endif
};
LinkConfiguration* getConfig() { return _config; }
private slots:
void on_typeCombo_currentIndexChanged(int index);
void on_buttonBox_accepted();
void on_buttonBox_rejected();
void on_nameEdit_textEdited(const QString &arg1);
private:
void _changeLinkType(int type);
void _loadTypeConfigWidget(int type);
void _updateUI();
Ui::QGCCommConfiguration* _ui;
LinkConfiguration* _config;
};
#endif // QGCCOMMCONFIGURATION_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCCommConfiguration</class>
<widget class="QWidget" name="QGCCommConfiguration">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>450</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>450</width>
<height>450</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>600</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="nameLabel">
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Link Name:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="nameEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="typeLabel_3">
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Link Type:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="typeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="linkGroupBox">
<property name="title">
<string>Link</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="linkScrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>418</width>
<height>304</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
This diff is collapsed.
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of QGCLinkConfiguration
* @author Gus Grubba <mavlink@grubba.com>
*/
#ifndef QGCLINKCONFIGURATION_H
#define QGCLINKCONFIGURATION_H
#include <QWidget>
#include <QListView>
#include "LinkManager.h"
namespace Ui {
class QGCLinkConfiguration;
}
class LinkViewModel;
class QGCLinkConfiguration : public QWidget
{
Q_OBJECT
public:
explicit QGCLinkConfiguration(QWidget *parent = 0);
~QGCLinkConfiguration();
private slots:
void on_delLinkButton_clicked();
void on_editLinkButton_clicked();
void on_addLinkButton_clicked();
void on_linkView_doubleClicked(const QModelIndex &index);
void on_linkView_clicked(const QModelIndex &index);
void on_connectLinkButton_clicked();
private:
void _editLink(int row);
void _fixUnnamed(LinkConfiguration* config);
void _updateButtons();
Ui::QGCLinkConfiguration* _ui;
LinkViewModel* _viewModel;
};
class LinkViewModel : public QAbstractListModel
{
public:
LinkViewModel(QObject *parent = 0);
int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
LinkConfiguration* getConfiguration(int row);
void beginChange() { beginResetModel(); }
void endChange() { endResetModel(); }
};
#endif // QGCLINKCONFIGURATION_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCLinkConfiguration</class>
<widget class="QWidget" name="QGCLinkConfiguration">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>391</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListView" name="linkView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="delLinkButton">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="editLinkButton">
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addLinkButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="connectLinkButton">
<property name="text">
<string>Connect</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of QGCTCPLinkConfiguration
* @author Gus Grubba <mavlink@grubba.com>
*/
#include <QInputDialog>
#include "QGCTCPLinkConfiguration.h"
#include "ui_QGCTCPLinkConfiguration.h"
QGCTCPLinkConfiguration::QGCTCPLinkConfiguration(TCPConfiguration *config, QWidget *parent)
: QWidget(parent)
, _ui(new Ui::QGCTCPLinkConfiguration)
, _config(config)
{
Q_ASSERT(_config != NULL);
_ui->setupUi(this);
quint16 port = config->port();
_ui->portSpinBox->setValue(port);
QString addr = config->address().toString();
_ui->hostAddressLineEdit->setText(addr);
}
QGCTCPLinkConfiguration::~QGCTCPLinkConfiguration()
{
delete _ui;
}
void QGCTCPLinkConfiguration::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
_ui->retranslateUi(this);
break;
default:
break;
}
}
void QGCTCPLinkConfiguration::on_portSpinBox_valueChanged(int arg1)
{
_config->setPort(arg1);
}
void QGCTCPLinkConfiguration::on_hostAddressLineEdit_textChanged(const QString &arg1)
{
QHostAddress add(arg1);
_config->setAddress(add);
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of QGCTCPLinkConfiguration
* @author Gus Grubba <mavlink@grubba.com>
*/
#ifndef QGCTCPLINKCONFIGURATION_H
#define QGCTCPLINKCONFIGURATION_H
#include <QWidget>
#include "TCPLink.h"
namespace Ui
{
class QGCTCPLinkConfiguration;
}
class QGCTCPLinkConfiguration : public QWidget
{
Q_OBJECT
public:
explicit QGCTCPLinkConfiguration(TCPConfiguration *config, QWidget *parent = 0);
~QGCTCPLinkConfiguration();
protected:
void changeEvent(QEvent *e);
private slots:
void on_portSpinBox_valueChanged(int arg1);
void on_hostAddressLineEdit_textChanged(const QString &arg1);
private:
Ui::QGCTCPLinkConfiguration* _ui;
TCPConfiguration* _config;
};
#endif // QGCTCPLINKCONFIGURATION_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCTCPLinkConfiguration</class>
<widget class="QWidget" name="QGCTCPLinkConfiguration">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::FieldsStayAtSizeHint</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="portLabel">
<property name="text">
<string>TCP Port</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="portSpinBox">
<property name="minimum">
<number>1024</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>3000</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Host Address</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="hostAddressLineEdit">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of QGCUDPLinkConfiguration
* @author Gus Grubba <mavlink@grubba.com>
*/
#include <QInputDialog>
#include "QGCUDPLinkConfiguration.h"
#include "ui_QGCUDPLinkConfiguration.h"
QGCUDPLinkConfiguration::QGCUDPLinkConfiguration(UDPConfiguration *config, QWidget *parent)
: QWidget(parent)
, _inConstructor(true)
, _ui(new Ui::QGCUDPLinkConfiguration)
{
_config = config;
_ui->setupUi(this);
_viewModel = new UPDViewModel;
_ui->listView->setModel(_viewModel);
_ui->removeHost->setEnabled(false);
_ui->editHost->setEnabled(false);
_ui->portNumber->setRange(1024, 65535);
_ui->portNumber->setValue(_config->localPort());
_reloadList();
_inConstructor = false;
}
QGCUDPLinkConfiguration::~QGCUDPLinkConfiguration()
{
delete _ui;
}
void QGCUDPLinkConfiguration::_reloadList()
{
QString host;
int port;
if(_config->firstHost(host, port)) {
_viewModel->beginChange();
_viewModel->hosts.clear();
do {
_viewModel->hosts.append(QString("%1:%2").arg(host, QString::number(port)));
} while (_config->nextHost(host, port));
_viewModel->endChange();
}
}
void QGCUDPLinkConfiguration::_editHost(int row)
{
if(row < _viewModel->hosts.count()) {
bool ok;
QString oldName = _viewModel->hosts.at(row);
QString hostName = QInputDialog::getText(
this, tr("Edit a MAVLink host target"),
tr("Host (hostname:port): "), QLineEdit::Normal, oldName, &ok);
if (ok && !hostName.isEmpty()) {
_viewModel->beginChange();
_viewModel->hosts.replace(row, hostName);
_viewModel->endChange();
_config->removeHost(oldName);
_config->addHost(hostName);
}
}
}
void QGCUDPLinkConfiguration::on_portNumber_valueChanged(int arg1)
{
if(!_inConstructor) {
_config->setLocalPort(arg1);
_config->setDynamic(false);
}
}
void QGCUDPLinkConfiguration::on_listView_clicked(const QModelIndex &index)
{
bool enabled = index.row() < _viewModel->hosts.count();
_ui->removeHost->setEnabled(enabled);
_ui->editHost->setEnabled(enabled);
}
void QGCUDPLinkConfiguration::on_listView_doubleClicked(const QModelIndex &index)
{
_editHost(index.row());
}
void QGCUDPLinkConfiguration::on_addHost_clicked()
{
bool ok;
QString hostName = QInputDialog::getText(
this, tr("Add a host target to MAVLink"),
tr("Host (hostname:port): "),
QLineEdit::Normal, QString("localhost:%1").arg(QGC_UDP_TARGET_PORT), &ok);
if (ok && !hostName.isEmpty()) {
_config->addHost(hostName);
_reloadList();
}
}
void QGCUDPLinkConfiguration::on_removeHost_clicked()
{
QModelIndex index = _ui->listView->currentIndex();
if(index.row() < _viewModel->hosts.count()) {
QString oldName = _viewModel->hosts.at(index.row());
_viewModel->hosts.removeAt(index.row());
_config->removeHost(oldName);
_reloadList();
}
}
void QGCUDPLinkConfiguration::on_editHost_clicked()
{
QModelIndex index = _ui->listView->currentIndex();
_editHost(index.row());
}
UPDViewModel::UPDViewModel(QObject *parent) : QAbstractListModel(parent)
{
Q_UNUSED(parent);
}
int UPDViewModel::rowCount( const QModelIndex & parent) const
{
Q_UNUSED(parent);
return hosts.count();
}
QVariant UPDViewModel::data( const QModelIndex & index, int role) const
{
if (role == Qt::DisplayRole && index.row() < hosts.count()) {
return hosts.at(index.row());
}
return QVariant();
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of QGCUDPLinkConfiguration
* @author Gus Grubba <mavlink@grubba.com>
*/
#ifndef QGCUDPLINKCONFIGURATION_H
#define QGCUDPLINKCONFIGURATION_H
#include <QWidget>
#include <QListView>
#include "UDPLink.h"
namespace Ui {
class QGCUDPLinkConfiguration;
}
class UPDViewModel;
class QGCUDPLinkConfiguration : public QWidget
{
Q_OBJECT
public:
explicit QGCUDPLinkConfiguration(UDPConfiguration* config, QWidget *parent = 0);
~QGCUDPLinkConfiguration();
private slots:
void on_addHost_clicked();
void on_removeHost_clicked();
void on_editHost_clicked();
void on_listView_clicked(const QModelIndex &index);
void on_listView_doubleClicked(const QModelIndex &index);
void on_portNumber_valueChanged(int arg1);
private:
void _reloadList();
void _editHost(int row);
bool _inConstructor;
Ui::QGCUDPLinkConfiguration* _ui;
UDPConfiguration* _config;
UPDViewModel* _viewModel;
};
class UPDViewModel : public QAbstractListModel
{
public:
UPDViewModel(QObject *parent = 0);
int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
void beginChange() { beginResetModel(); }
void endChange() { endResetModel(); }
QStringList hosts;
};
#endif // QGCUDPLINKCONFIGURATION_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCUDPLinkConfiguration</class>
<widget class="QWidget" name="QGCUDPLinkConfiguration">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>314</width>
<height>285</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Listening Port:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="portNumber">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</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>
</layout>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Target Hosts</string>
</property>
</widget>
</item>
<item>
<widget class="QListView" name="listView"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="addHost">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeHost">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="editHost">
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -31,7 +31,6 @@
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
#include "MAVLinkSettingsWidget.h"
#include "QGCLinkConfiguration.h"
#include "GAudioOutput.h"
#include "QGCApplication.h"
#include "QGCFileDialog.h"
......@@ -53,11 +52,8 @@ SettingsDialog::SettingsDialog(QWidget *parent, int showTab, Qt::WindowFlags fla
position.moveCenter(QApplication::desktop()->availableGeometry(screen).center());
move(position.topLeft());
QGCLinkConfiguration* pLinkConf = new QGCLinkConfiguration(this);
MAVLinkSettingsWidget* pMavsettings = new MAVLinkSettingsWidget(qgcApp()->toolbox()->mavlinkProtocol(), this);
// Add the link settings pane
_ui->tabWidget->addTab(pLinkConf, "Comm Links");
// Add the MAVLink settings pane
_ui->tabWidget->addTab(pMavsettings, "MAVLink");
......@@ -68,14 +64,9 @@ SettingsDialog::SettingsDialog(QWidget *parent, int showTab, Qt::WindowFlags fla
// Connect signals
connect(_ui->browseSavedFilesLocation, &QPushButton::clicked, this, &SettingsDialog::_selectSavedFilesDirectory);
connect(_ui->buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::_validateBeforeClose);
switch (showTab) {
case ShowCommLinks:
_ui->tabWidget->setCurrentWidget(pLinkConf);
break;
case ShowMavlink:
_ui->tabWidget->setCurrentWidget(pMavsettings);
break;
if (showTab == ShowMavlink) {
_ui->tabWidget->setCurrentWidget(pMavsettings);
}
}
......
......@@ -43,7 +43,6 @@ public:
enum {
ShowDefault,
ShowCommLinks,
ShowControllers,
ShowMavlink
};
......
......@@ -75,6 +75,7 @@ Item {
}
}
Row {
visible: !ScreenTools.isiOS
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: "Address:"
......
......@@ -74,7 +74,7 @@ Rectangle {
anchors.margins: ScreenTools.defaultFontPixelWidth
spacing: ScreenTools.defaultFontPixelHeight / 2
QGCLabel {
text: "Comm Link Settings (WIP)"
text: "Comm Link Settings"
font.pixelSize: ScreenTools.mediumFontPixelSize
}
Rectangle {
......
......@@ -67,6 +67,25 @@ Rectangle {
color: qgcPal.button
}
//-----------------------------------------------------------------
//-- System ID
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: "Ground Station MavLink System ID:"
anchors.verticalCenter: parent.verticalCenter
}
QGCTextField {
id: sysidField
text: QGroundControl.mavlinkSystemID.toString()
width: ScreenTools.defaultFontPixelWidth * 6
inputMethodHints: Qt.ImhFormattedNumbersOnly
anchors.verticalCenter: parent.verticalCenter
onEditingFinished: {
QGroundControl.mavlinkSystemID = parseInt(sysidField.text)
}
}
}
//-----------------------------------------------------------------
//-- Mavlink Heartbeats
QGCCheckBox {
text: "Emit heartbeat"
......
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