xref: /OK3568_Linux_fs/app/forlinx/flapp/src/plugins/terminal/settingsdialog.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /****************************************************************************
2*4882a593Smuzhiyun **
3*4882a593Smuzhiyun ** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
4*4882a593Smuzhiyun ** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
5*4882a593Smuzhiyun ** Contact: http://www.qt.io/licensing/
6*4882a593Smuzhiyun **
7*4882a593Smuzhiyun ** This file is part of the QtSerialPort module of the Qt Toolkit.
8*4882a593Smuzhiyun **
9*4882a593Smuzhiyun ** $QT_BEGIN_LICENSE:LGPL21$
10*4882a593Smuzhiyun ** Commercial License Usage
11*4882a593Smuzhiyun ** Licensees holding valid commercial Qt licenses may use this file in
12*4882a593Smuzhiyun ** accordance with the commercial license agreement provided with the
13*4882a593Smuzhiyun ** Software or, alternatively, in accordance with the terms contained in
14*4882a593Smuzhiyun ** a written agreement between you and The Qt Company. For licensing terms
15*4882a593Smuzhiyun ** and conditions see http://www.qt.io/terms-conditions. For further
16*4882a593Smuzhiyun ** information use the contact form at http://www.qt.io/contact-us.
17*4882a593Smuzhiyun **
18*4882a593Smuzhiyun ** GNU Lesser General Public License Usage
19*4882a593Smuzhiyun ** Alternatively, this file may be used under the terms of the GNU Lesser
20*4882a593Smuzhiyun ** General Public License version 2.1 or version 3 as published by the Free
21*4882a593Smuzhiyun ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
22*4882a593Smuzhiyun ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
23*4882a593Smuzhiyun ** following information to ensure the GNU Lesser General Public License
24*4882a593Smuzhiyun ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
25*4882a593Smuzhiyun ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
26*4882a593Smuzhiyun **
27*4882a593Smuzhiyun ** As a special exception, The Qt Company gives you certain additional
28*4882a593Smuzhiyun ** rights. These rights are described in The Qt Company LGPL Exception
29*4882a593Smuzhiyun ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
30*4882a593Smuzhiyun **
31*4882a593Smuzhiyun ** $QT_END_LICENSE$
32*4882a593Smuzhiyun **
33*4882a593Smuzhiyun ****************************************************************************/
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #ifndef SETTINGSDIALOG_H
36*4882a593Smuzhiyun #define SETTINGSDIALOG_H
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun #include <QDialog>
39*4882a593Smuzhiyun #include <QtSerialPort/QSerialPort>
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun QT_USE_NAMESPACE
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun QT_BEGIN_NAMESPACE
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun namespace Ui {
46*4882a593Smuzhiyun class SettingsDialog;
47*4882a593Smuzhiyun }
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun class QIntValidator;
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun QT_END_NAMESPACE
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun class SettingsDialog : public QDialog
54*4882a593Smuzhiyun {
55*4882a593Smuzhiyun     Q_OBJECT
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun public:
58*4882a593Smuzhiyun     struct Settings {
59*4882a593Smuzhiyun         QString name;
60*4882a593Smuzhiyun         qint32 baudRate;
61*4882a593Smuzhiyun         QString stringBaudRate;
62*4882a593Smuzhiyun         QSerialPort::DataBits dataBits;
63*4882a593Smuzhiyun         QString stringDataBits;
64*4882a593Smuzhiyun         QSerialPort::Parity parity;
65*4882a593Smuzhiyun         QString stringParity;
66*4882a593Smuzhiyun         QSerialPort::StopBits stopBits;
67*4882a593Smuzhiyun         QString stringStopBits;
68*4882a593Smuzhiyun         QSerialPort::FlowControl flowControl;
69*4882a593Smuzhiyun         QString stringFlowControl;
70*4882a593Smuzhiyun         bool localEchoEnabled;
71*4882a593Smuzhiyun     };
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun     explicit SettingsDialog(QWidget *parent = 0);
74*4882a593Smuzhiyun     ~SettingsDialog();
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun     Settings settings() const;
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun private slots:
79*4882a593Smuzhiyun     void showPortInfo(int idx);
80*4882a593Smuzhiyun     void apply();
81*4882a593Smuzhiyun     void checkCustomBaudRatePolicy(int idx);
82*4882a593Smuzhiyun     void checkCustomDevicePathPolicy(int idx);
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun private:
85*4882a593Smuzhiyun     void fillPortsParameters();
86*4882a593Smuzhiyun     void fillPortsInfo();
87*4882a593Smuzhiyun     void updateSettings();
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun private:
90*4882a593Smuzhiyun     Ui::SettingsDialog *ui;
91*4882a593Smuzhiyun     Settings currentSettings;
92*4882a593Smuzhiyun     QIntValidator *intValidator;
93*4882a593Smuzhiyun };
94*4882a593Smuzhiyun 
95*4882a593Smuzhiyun #endif // SETTINGSDIALOG_H
96