dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
serialpluginoptionspage.cpp
Go to the documentation of this file.
1 
13 /*
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.
18 *
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.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, see <http://www.gnu.org/licenses/>
26 */
27 
30 #include "ui_serialpluginoptions.h"
32 
34  : IOptionsPage(parent)
35  , m_config(config)
36 {
37 }
38 
39 // creates options page widget (uses the UI file)
40 QWidget *SerialPluginOptionsPage::createPage(QWidget *parent)
41 {
42 
43  Q_UNUSED(parent);
44  options_page = new Ui::SerialPluginOptionsPage();
45  // main widget
46  QWidget *optionsPageWidget = new QWidget;
47  // main layout
48  options_page->setupUi(optionsPageWidget);
49  QStringList allowedSpeeds;
50  allowedSpeeds << "1200"
51 #ifdef Q_OS_UNIX
52  << "1800" // POSIX ONLY
53 #endif
54  << "2400"
55  << "4800"
56  << "9600"
57 #ifdef Q_OS_WIN
58  << "14400" // WINDOWS ONLY
59 #endif
60  << "19200"
61  << "38400"
62 #ifdef Q_OS_WIN
63  << "56000" // WINDOWS ONLY
64 #endif
65  << "57600"
66 #ifdef Q_OS_UNIX
67  << "76800" // POSIX ONLY
68 #endif
69  << "115200"
70 #ifdef Q_OS_WIN
71  << "128000" // WINDOWS ONLY
72  << "230400" // WINDOWS ONLY
73  << "256000" // WINDOWS ONLY
74  << "460800" // WINDOWS ONLY
75  << "921600" // WINDOWS ONLY
76 #endif
77  ;
78 
79  options_page->cb_speed->addItems(allowedSpeeds);
80  options_page->cb_speed->setCurrentIndex(options_page->cb_speed->findText(m_config->speed()));
81  options_page->reconnectCB->setChecked(m_config->reconnect());
82  return optionsPageWidget;
83 }
84 
92 {
93  m_config->setSpeed(options_page->cb_speed->currentText());
94  m_config->setReconnect(options_page->reconnectCB->isChecked());
95  m_config->savesettings();
96 }
97 
99 {
100  delete options_page;
101 }
QWidget * createPage(QWidget *parent)
SerialPluginOptionsPage(SerialPluginConfiguration *config, QObject *parent=nullptr)