Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / ground / gcs / src / plugins / ipconnection / ipconnectionoptionspage.cpp
blob47558cd6d023d94efa61d2f045fa0a0059b78130
1 /**
2 ******************************************************************************
4 * @file ipconnectionoptionspage.cpp
5 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
6 * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
7 * @addtogroup GCSPlugins GCS Plugins
8 * @{
9 * @addtogroup IPConnPlugin IP Telemetry Plugin
10 * @{
11 * @brief IP Connection Plugin implements telemetry over TCP/IP and UDP/IP
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #include "ipconnectionoptionspage.h"
31 #include "ui_ipconnectionoptionspage.h"
33 #include "ipconnectionconfiguration.h"
35 IPConnectionOptionsPage::IPConnectionOptionsPage(IPConnectionConfiguration *config, QObject *parent) :
36 IOptionsPage(parent), m_page(0), m_config(config)
39 IPConnectionOptionsPage::~IPConnectionOptionsPage()
42 QWidget *IPConnectionOptionsPage::createPage(QWidget *parent)
44 m_page = new Ui::IPconnectionOptionsPage();
45 QWidget *w = new QWidget(parent);
46 m_page->setupUi(w);
48 m_page->Port->setValue(m_config->port());
49 m_page->HostName->setText(m_config->hostName());
50 m_page->UseTCP->setChecked(m_config->useTCP() ? true : false);
51 m_page->UseUDP->setChecked(m_config->useTCP() ? false : true);
53 return w;
56 void IPConnectionOptionsPage::apply()
58 m_config->setPort(m_page->Port->value());
59 m_config->setHostName(m_page->HostName->text());
60 m_config->setUseTCP(m_page->UseTCP->isChecked() ? 1 : 0);
62 // FIXME this signal is too low level (and duplicated all over the place)
63 // FIXME this signal will trigger (amongst other things) the saving of the configuration !
64 emit availableDevChanged();
67 void IPConnectionOptionsPage::finish()
69 delete m_page;