xref: /OK3568_Linux_fs/app/forlinx/forlinx_qt/terminal/mainwindow.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 MAINWINDOW_H
36*4882a593Smuzhiyun #define MAINWINDOW_H
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun #include <QtCore/QtGlobal>
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun #include <QMainWindow>
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun #include <QtSerialPort/QSerialPort>
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun QT_BEGIN_NAMESPACE
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun class QLabel;
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun namespace Ui {
49*4882a593Smuzhiyun class MainWindow;
50*4882a593Smuzhiyun }
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun QT_END_NAMESPACE
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun class Console;
55*4882a593Smuzhiyun class SettingsDialog;
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun class MainWindow : public QMainWindow
58*4882a593Smuzhiyun {
59*4882a593Smuzhiyun     Q_OBJECT
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun public:
62*4882a593Smuzhiyun     explicit MainWindow(QWidget *parent = 0);
63*4882a593Smuzhiyun     ~MainWindow();
64*4882a593Smuzhiyun public slots:
65*4882a593Smuzhiyun     bool eventFilter(QObject *,QEvent *);
66*4882a593Smuzhiyun private slots:
67*4882a593Smuzhiyun     void openSerialPort();
68*4882a593Smuzhiyun     void closeSerialPort();
69*4882a593Smuzhiyun     void about();
70*4882a593Smuzhiyun     void writeData(const QByteArray &data);
71*4882a593Smuzhiyun     void readData();
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun     void handleError(QSerialPort::SerialPortError error);
74*4882a593Smuzhiyun 
75*4882a593Smuzhiyun private:
76*4882a593Smuzhiyun     void initActionsConnections();
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun private:
79*4882a593Smuzhiyun     void showStatusMessage(const QString &message);
80*4882a593Smuzhiyun 
81*4882a593Smuzhiyun     Ui::MainWindow *ui;
82*4882a593Smuzhiyun     QLabel *status;
83*4882a593Smuzhiyun     Console *console;
84*4882a593Smuzhiyun     SettingsDialog *settings;
85*4882a593Smuzhiyun     QSerialPort *serial;
86*4882a593Smuzhiyun };
87*4882a593Smuzhiyun 
88*4882a593Smuzhiyun #endif // MAINWINDOW_H
89