2011-02-20 00:04:38 +01:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file configgadgetwidget.cpp
|
|
|
|
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @addtogroup GCSPlugins GCS Plugins
|
|
|
|
* @{
|
|
|
|
* @addtogroup ConfigPlugin Config Plugin
|
|
|
|
* @{
|
|
|
|
* @brief The Configuration Gadget used to update settings in the firmware
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program 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.
|
|
|
|
*
|
|
|
|
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
2011-03-28 20:43:15 +02:00
|
|
|
|
2011-02-20 00:04:38 +01:00
|
|
|
#include "configgadgetwidget.h"
|
|
|
|
|
2012-03-29 06:54:11 +02:00
|
|
|
#include "configvehicletypewidget.h"
|
2011-03-28 20:43:15 +02:00
|
|
|
#include "configccattitudewidget.h"
|
2011-03-28 17:39:22 +02:00
|
|
|
#include "configinputwidget.h"
|
|
|
|
#include "configoutputwidget.h"
|
2011-03-28 20:43:15 +02:00
|
|
|
#include "configstabilizationwidget.h"
|
2011-08-10 05:52:02 +02:00
|
|
|
#include "configcamerastabilizationwidget.h"
|
2012-01-08 19:10:20 +01:00
|
|
|
#include "configtxpidwidget.h"
|
2013-02-26 07:37:14 +01:00
|
|
|
#include "configrevohwwidget.h"
|
2011-07-19 15:50:42 +02:00
|
|
|
#include "config_cc_hw_widget.h"
|
2012-04-18 02:40:24 +02:00
|
|
|
#include "configpipxtremewidget.h"
|
2012-05-05 18:40:44 +02:00
|
|
|
#include "configrevowidget.h"
|
2011-03-29 22:32:09 +02:00
|
|
|
#include "defaultattitudewidget.h"
|
2011-07-19 15:50:42 +02:00
|
|
|
#include "defaulthwsettingswidget.h"
|
2011-03-28 23:15:44 +02:00
|
|
|
#include "uavobjectutilmanager.h"
|
2011-02-20 00:04:38 +01:00
|
|
|
|
2013-12-11 22:22:28 +01:00
|
|
|
#include <uavtalk/telemetrymanager.h>
|
|
|
|
|
2011-02-20 00:04:38 +01:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QStringList>
|
2013-09-15 23:06:25 +02:00
|
|
|
#include <QWidget>
|
|
|
|
#include <QTextEdit>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QPushButton>
|
2011-02-20 00:04:38 +01:00
|
|
|
|
|
|
|
ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
|
|
|
|
{
|
|
|
|
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
|
|
|
2011-08-03 10:03:49 +02:00
|
|
|
ftw = new MyTabbedStackWidget(this, true, true);
|
2011-02-20 00:04:38 +01:00
|
|
|
ftw->setIconSize(64);
|
|
|
|
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout;
|
2011-08-03 10:03:49 +02:00
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
2011-02-20 00:04:38 +01:00
|
|
|
layout->addWidget(ftw);
|
|
|
|
setLayout(layout);
|
|
|
|
|
|
|
|
// *********************
|
|
|
|
QWidget *qwd;
|
|
|
|
|
2012-10-05 08:16:26 +02:00
|
|
|
QIcon *icon = new QIcon();
|
|
|
|
icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
2012-10-05 14:30:37 +02:00
|
|
|
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2013-05-05 12:45:35 +02:00
|
|
|
qwd = new DefaultHwSettingsWidget(this);
|
2012-10-05 08:16:26 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, *icon, QString("Hardware"));
|
|
|
|
|
|
|
|
icon = new QIcon();
|
|
|
|
icon->addFile(":/configgadget/images/vehicle_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
2012-10-05 14:30:37 +02:00
|
|
|
icon->addFile(":/configgadget/images/vehicle_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2013-05-05 12:45:35 +02:00
|
|
|
qwd = new ConfigVehicleTypeWidget(this);
|
2012-10-05 08:16:26 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::aircraft, qwd, *icon, QString("Vehicle"));
|
2011-02-20 00:04:38 +01:00
|
|
|
|
2012-10-05 08:16:26 +02:00
|
|
|
icon = new QIcon();
|
|
|
|
icon->addFile(":/configgadget/images/input_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
2012-10-05 14:30:37 +02:00
|
|
|
icon->addFile(":/configgadget/images/input_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2013-05-05 12:45:35 +02:00
|
|
|
qwd = new ConfigInputWidget(this);
|
2012-10-05 08:16:26 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::input, qwd, *icon, QString("Input"));
|
2011-03-28 17:39:22 +02:00
|
|
|
|
2012-10-05 08:16:26 +02:00
|
|
|
icon = new QIcon();
|
|
|
|
icon->addFile(":/configgadget/images/output_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
2012-10-05 14:30:37 +02:00
|
|
|
icon->addFile(":/configgadget/images/output_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2013-05-05 12:45:35 +02:00
|
|
|
qwd = new ConfigOutputWidget(this);
|
2012-10-05 08:16:26 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::output, qwd, *icon, QString("Output"));
|
2011-02-20 00:04:38 +01:00
|
|
|
|
2012-10-05 16:24:56 +02:00
|
|
|
icon = new QIcon();
|
|
|
|
icon->addFile(":/configgadget/images/ins_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
|
|
|
icon->addFile(":/configgadget/images/ins_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2013-05-05 12:45:35 +02:00
|
|
|
qwd = new DefaultAttitudeWidget(this);
|
2013-05-01 18:18:30 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::sensors, qwd, *icon, QString("Attitude"));
|
2011-02-20 00:04:38 +01:00
|
|
|
|
2012-10-05 18:16:04 +02:00
|
|
|
icon = new QIcon();
|
|
|
|
icon->addFile(":/configgadget/images/stabilization_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
|
|
|
icon->addFile(":/configgadget/images/stabilization_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2013-05-05 12:45:35 +02:00
|
|
|
qwd = new ConfigStabilizationWidget(this);
|
2012-10-05 18:16:04 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::stabilization, qwd, *icon, QString("Stabilization"));
|
2011-03-25 13:16:49 +01:00
|
|
|
|
2012-10-06 10:42:57 +02:00
|
|
|
icon = new QIcon();
|
|
|
|
icon->addFile(":/configgadget/images/camstab_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
|
|
|
icon->addFile(":/configgadget/images/camstab_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2013-05-05 12:45:35 +02:00
|
|
|
qwd = new ConfigCameraStabilizationWidget(this);
|
2013-05-12 11:27:12 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::camerastabilization, qwd, *icon, QString("Gimbal"));
|
2011-02-22 23:03:32 +01:00
|
|
|
|
2012-10-06 10:42:57 +02:00
|
|
|
icon = new QIcon();
|
|
|
|
icon->addFile(":/configgadget/images/txpid_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
|
|
|
icon->addFile(":/configgadget/images/txpid_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2013-05-05 12:45:35 +02:00
|
|
|
qwd = new ConfigTxPIDWidget(this);
|
2012-10-06 10:42:57 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::txpid, qwd, *icon, QString("TxPID"));
|
2011-03-28 20:43:15 +02:00
|
|
|
|
2012-10-05 16:24:56 +02:00
|
|
|
ftw->setCurrentIndex(ConfigGadgetWidget::hardware);
|
2011-02-20 00:04:38 +01:00
|
|
|
// *********************
|
|
|
|
// Listen to autopilot connection events
|
|
|
|
|
|
|
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
2013-05-05 12:45:35 +02:00
|
|
|
TelemetryManager *telMngr = pm->getObject<TelemetryManager>();
|
2011-02-20 00:04:38 +01:00
|
|
|
connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
|
2011-06-07 16:56:16 +02:00
|
|
|
connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
|
2011-02-20 00:04:38 +01:00
|
|
|
|
2011-03-31 22:48:43 +02:00
|
|
|
// And check whether by any chance we are not already connected
|
2012-10-06 10:42:57 +02:00
|
|
|
if (telMngr->isConnected()) {
|
2013-05-05 12:45:35 +02:00
|
|
|
onAutopilotConnect();
|
2012-10-06 10:42:57 +02:00
|
|
|
}
|
2011-03-31 22:48:43 +02:00
|
|
|
|
2011-05-17 06:54:23 +02:00
|
|
|
help = 0;
|
2013-05-05 12:45:35 +02:00
|
|
|
connect(ftw, SIGNAL(currentAboutToShow(int, bool *)), this, SLOT(tabAboutToChange(int, bool *)));
|
2011-08-02 18:06:17 +02:00
|
|
|
|
2012-06-06 04:34:42 +02:00
|
|
|
// Connect to the PipXStatus object updates
|
|
|
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
2013-05-05 12:45:35 +02:00
|
|
|
oplinkStatusObj = dynamic_cast<UAVDataObject *>(objManager->getObject("OPLinkStatus"));
|
|
|
|
if (oplinkStatusObj != NULL) {
|
|
|
|
connect(oplinkStatusObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateOPLinkStatus(UAVObject *)));
|
2012-06-06 04:34:42 +02:00
|
|
|
} else {
|
2013-05-05 12:45:35 +02:00
|
|
|
qDebug() << "Error: Object is unknown (OPLinkStatus).";
|
2012-06-06 04:34:42 +02:00
|
|
|
}
|
|
|
|
|
2012-10-20 20:48:22 +02:00
|
|
|
// Create the timer that is used to timeout the connection to the OPLink.
|
2013-05-05 12:45:35 +02:00
|
|
|
oplinkTimeout = new QTimer(this);
|
2012-10-22 01:49:58 +02:00
|
|
|
connect(oplinkTimeout, SIGNAL(timeout()), this, SLOT(onOPLinkDisconnect()));
|
2012-10-20 20:48:22 +02:00
|
|
|
oplinkConnected = false;
|
2011-02-20 00:04:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ConfigGadgetWidget::~ConfigGadgetWidget()
|
|
|
|
{
|
2011-02-22 23:03:32 +01:00
|
|
|
// TODO: properly delete all the tabs in ftw before exiting
|
2011-02-20 00:04:38 +01:00
|
|
|
}
|
|
|
|
|
2012-08-03 18:31:47 +02:00
|
|
|
void ConfigGadgetWidget::startInputWizard()
|
|
|
|
{
|
|
|
|
ftw->setCurrentIndex(ConfigGadgetWidget::input);
|
2013-05-05 12:45:35 +02:00
|
|
|
ConfigInputWidget *inputWidget = dynamic_cast<ConfigInputWidget *>(ftw->getWidget(ConfigGadgetWidget::input));
|
2012-08-03 18:31:47 +02:00
|
|
|
Q_ASSERT(inputWidget);
|
|
|
|
inputWidget->startInputWizard();
|
|
|
|
}
|
|
|
|
|
2011-02-20 00:04:38 +01:00
|
|
|
void ConfigGadgetWidget::resizeEvent(QResizeEvent *event)
|
|
|
|
{
|
|
|
|
QWidget::resizeEvent(event);
|
|
|
|
}
|
|
|
|
|
2013-05-05 12:45:35 +02:00
|
|
|
void ConfigGadgetWidget::onAutopilotDisconnect()
|
|
|
|
{
|
2013-04-29 18:44:54 +02:00
|
|
|
int selectedIndex = ftw->currentIndex();
|
2012-10-06 10:42:57 +02:00
|
|
|
|
2012-10-05 16:24:56 +02:00
|
|
|
QIcon *icon = new QIcon();
|
2013-05-05 12:45:35 +02:00
|
|
|
|
2012-10-05 16:24:56 +02:00
|
|
|
icon->addFile(":/configgadget/images/ins_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
|
|
|
icon->addFile(":/configgadget/images/ins_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2012-10-06 10:42:57 +02:00
|
|
|
QWidget *qwd = new DefaultAttitudeWidget(this);
|
2013-02-26 07:37:14 +01:00
|
|
|
ftw->removeTab(ConfigGadgetWidget::sensors);
|
2013-05-01 18:18:30 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::sensors, qwd, *icon, QString("Attitude"));
|
2012-10-05 08:16:26 +02:00
|
|
|
|
2012-10-05 16:24:56 +02:00
|
|
|
icon = new QIcon();
|
2012-10-05 08:16:26 +02:00
|
|
|
icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
2012-10-05 14:30:37 +02:00
|
|
|
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2013-05-05 12:45:35 +02:00
|
|
|
qwd = new DefaultHwSettingsWidget(this);
|
2013-02-26 07:37:14 +01:00
|
|
|
ftw->removeTab(ConfigGadgetWidget::hardware);
|
2012-10-05 08:16:26 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, *icon, QString("Hardware"));
|
2013-02-26 07:37:14 +01:00
|
|
|
|
2013-04-29 18:44:54 +02:00
|
|
|
ftw->setCurrentIndex(selectedIndex);
|
2011-08-17 13:43:08 +02:00
|
|
|
|
2011-06-07 16:56:16 +02:00
|
|
|
emit autopilotDisconnected();
|
|
|
|
}
|
|
|
|
|
2013-05-05 12:45:35 +02:00
|
|
|
void ConfigGadgetWidget::onAutopilotConnect()
|
|
|
|
{
|
|
|
|
qDebug() << "ConfigGadgetWidget onAutopilotConnect";
|
2011-03-28 23:15:44 +02:00
|
|
|
// First of all, check what Board type we are talking to, and
|
|
|
|
// if necessary, remove/add tabs in the config gadget:
|
|
|
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
2013-05-19 16:37:30 +02:00
|
|
|
UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>();
|
2011-03-28 23:15:44 +02:00
|
|
|
if (utilMngr) {
|
2013-04-29 18:44:54 +02:00
|
|
|
int selectedIndex = ftw->currentIndex();
|
2011-03-28 23:15:44 +02:00
|
|
|
int board = utilMngr->getBoardModel();
|
|
|
|
if ((board & 0xff00) == 1024) {
|
|
|
|
// CopterControl family
|
2012-10-06 10:42:57 +02:00
|
|
|
|
2013-05-05 12:45:35 +02:00
|
|
|
QIcon *icon = new QIcon();
|
2012-10-05 16:24:56 +02:00
|
|
|
icon->addFile(":/configgadget/images/ins_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
|
|
|
icon->addFile(":/configgadget/images/ins_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2011-03-28 23:15:44 +02:00
|
|
|
QWidget *qwd = new ConfigCCAttitudeWidget(this);
|
2013-02-26 07:37:14 +01:00
|
|
|
ftw->removeTab(ConfigGadgetWidget::sensors);
|
2013-05-01 18:18:30 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::sensors, qwd, *icon, QString("Attitude"));
|
2012-10-06 10:42:57 +02:00
|
|
|
|
2012-10-05 16:24:56 +02:00
|
|
|
icon = new QIcon();
|
2012-10-05 08:16:26 +02:00
|
|
|
icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
2012-10-05 14:30:37 +02:00
|
|
|
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2013-05-05 12:45:35 +02:00
|
|
|
qwd = new ConfigCCHWWidget(this);
|
2013-02-26 07:37:14 +01:00
|
|
|
ftw->removeTab(ConfigGadgetWidget::hardware);
|
2012-10-05 16:24:56 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, *icon, QString("Hardware"));
|
2012-05-05 18:40:44 +02:00
|
|
|
} else if ((board & 0xff00) == 0x0900) {
|
2013-02-26 07:37:14 +01:00
|
|
|
// Revolution family
|
2012-10-06 10:42:57 +02:00
|
|
|
|
2013-05-05 12:45:35 +02:00
|
|
|
QIcon *icon = new QIcon();
|
2012-10-05 16:24:56 +02:00
|
|
|
icon->addFile(":/configgadget/images/ins_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
|
|
|
icon->addFile(":/configgadget/images/ins_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2012-10-06 10:42:57 +02:00
|
|
|
QWidget *qwd = new ConfigRevoWidget(this);
|
2013-02-26 07:37:14 +01:00
|
|
|
ftw->removeTab(ConfigGadgetWidget::sensors);
|
2013-05-01 18:18:30 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::sensors, qwd, *icon, QString("Attitude"));
|
2012-10-06 10:42:57 +02:00
|
|
|
|
2012-10-05 16:24:56 +02:00
|
|
|
icon = new QIcon();
|
2012-10-05 08:16:26 +02:00
|
|
|
icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
2013-02-28 08:13:21 +01:00
|
|
|
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2013-05-05 12:45:35 +02:00
|
|
|
qwd = new ConfigRevoHWWidget(this);
|
2013-02-26 07:37:14 +01:00
|
|
|
ftw->removeTab(ConfigGadgetWidget::hardware);
|
2012-10-05 08:16:26 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, *icon, QString("Hardware"));
|
2012-10-06 10:42:57 +02:00
|
|
|
} else {
|
2013-05-05 12:45:35 +02:00
|
|
|
// Unknown board
|
2012-10-17 07:56:36 +02:00
|
|
|
qDebug() << "Unknown board " << board;
|
2011-03-28 23:15:44 +02:00
|
|
|
}
|
2013-05-05 12:45:35 +02:00
|
|
|
ftw->setCurrentIndex(selectedIndex);
|
2011-03-28 23:15:44 +02:00
|
|
|
}
|
2013-05-04 00:13:15 +02:00
|
|
|
|
2011-02-20 00:04:38 +01:00
|
|
|
emit autopilotConnected();
|
|
|
|
}
|
|
|
|
|
2013-05-05 12:45:35 +02:00
|
|
|
void ConfigGadgetWidget::tabAboutToChange(int i, bool *proceed)
|
2011-08-02 18:06:17 +02:00
|
|
|
{
|
2011-09-11 18:14:09 +02:00
|
|
|
Q_UNUSED(i);
|
2012-10-06 10:42:57 +02:00
|
|
|
*proceed = true;
|
2013-05-05 12:45:35 +02:00
|
|
|
ConfigTaskWidget *wid = qobject_cast<ConfigTaskWidget *>(ftw->currentWidget());
|
|
|
|
if (!wid) {
|
2011-08-02 18:06:17 +02:00
|
|
|
return;
|
2012-10-06 10:42:57 +02:00
|
|
|
}
|
2013-05-05 12:45:35 +02:00
|
|
|
if (wid->isDirty()) {
|
|
|
|
int ans = QMessageBox::warning(this, tr("Unsaved changes"), tr("The tab you are leaving has unsaved changes,"
|
2014-01-28 22:13:41 +01:00
|
|
|
"if you proceed they will be lost.\n"
|
2013-05-05 12:45:35 +02:00
|
|
|
"Do you still want to proceed?"), QMessageBox::Yes, QMessageBox::No);
|
|
|
|
if (ans == QMessageBox::No) {
|
|
|
|
*proceed = false;
|
2012-10-06 10:42:57 +02:00
|
|
|
} else {
|
2011-08-02 18:06:17 +02:00
|
|
|
wid->setDirty(false);
|
2012-10-06 10:42:57 +02:00
|
|
|
}
|
2011-08-02 18:06:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-06 04:34:42 +02:00
|
|
|
/*!
|
2013-05-05 12:45:35 +02:00
|
|
|
\brief Called by updates to @OPLinkStatus
|
|
|
|
*/
|
2012-10-20 20:48:22 +02:00
|
|
|
void ConfigGadgetWidget::updateOPLinkStatus(UAVObject *)
|
2012-06-06 04:34:42 +02:00
|
|
|
{
|
2012-08-20 04:17:37 +02:00
|
|
|
// Restart the disconnection timer.
|
2012-10-20 20:48:22 +02:00
|
|
|
oplinkTimeout->start(5000);
|
2013-05-05 12:45:35 +02:00
|
|
|
if (!oplinkConnected) {
|
2012-10-20 20:48:22 +02:00
|
|
|
qDebug() << "ConfigGadgetWidget onOPLinkConnect";
|
2012-10-14 16:46:28 +02:00
|
|
|
|
|
|
|
QIcon *icon = new QIcon();
|
2012-10-17 08:00:31 +02:00
|
|
|
icon->addFile(":/configgadget/images/pipx-normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
|
|
|
icon->addFile(":/configgadget/images/pipx-selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
2012-10-14 16:46:28 +02:00
|
|
|
|
2012-08-20 04:17:37 +02:00
|
|
|
QWidget *qwd = new ConfigPipXtremeWidget(this);
|
2012-10-20 20:48:22 +02:00
|
|
|
ftw->insertTab(ConfigGadgetWidget::oplink, qwd, *icon, QString("OPLink"));
|
|
|
|
oplinkConnected = true;
|
2012-08-20 04:17:37 +02:00
|
|
|
}
|
2012-06-06 04:34:42 +02:00
|
|
|
}
|
2011-05-17 06:54:23 +02:00
|
|
|
|
2013-05-05 12:45:35 +02:00
|
|
|
void ConfigGadgetWidget::onOPLinkDisconnect()
|
|
|
|
{
|
|
|
|
qDebug() << "ConfigGadgetWidget onOPLinkDisconnect";
|
|
|
|
oplinkTimeout->stop();
|
|
|
|
ftw->removeTab(ConfigGadgetWidget::oplink);
|
|
|
|
oplinkConnected = false;
|
2012-06-06 04:34:42 +02:00
|
|
|
}
|