Roomba App  1.0
mainwindow.hh
Go to the documentation of this file.
1 
15 #ifndef MAINWINDOW_HH
16 #define MAINWINDOW_HH
17 
18 #include <QGroupBox>
19 #include <QMainWindow>
20 #include <QProgressBar>
21 #include <QSerialPort>
22 #include <QTimer>
23 #include <QTranslator>
24 
25 #include "communication.hh"
26 #include "frameThread.hh"
27 #include "joystick.hh"
28 #include "parser.hh"
29 
30 QT_BEGIN_NAMESPACE
31 namespace Ui
32 {
33 class MainWindow;
34 }
35 QT_END_NAMESPACE
36 
40 class MainWindow : public QMainWindow
41 {
42  Q_OBJECT
43 
44  public:
49  MainWindow(QWidget* parent = nullptr);
50 
56  ~MainWindow();
57 
58  protected:
66  void closeEvent(QCloseEvent* event) override;
67 
68  private slots:
73 
78 
83 
91  void connectSerialDevice(const QString& actionName);
92 
98  void serialTimeout();
99 
104  void showErrorMessage(const QString& message);
105 
110  void addMessageToLogs(const QString& message);
111 
120  void addValueSpeedL(const QString& message);
121 
130  void addValueSpeedR(const QString& message);
131 
140  void addValueGSpeedL(const QString& message);
141 
150  void addValueGSpeedR(const QString& message);
151 
160  void addValueAccelerationL(const QString& message);
161 
170  void addValueAccelerationR(const QString& message);
171 
180  void addValueBattery(const int message);
181 
186  void setSerialStatus(const QString& message);
187 
191  void setObstacleCloseStatus();
192 
197 
202 
207 
208  private:
216  void addDropShadow(QGroupBox* group, int xOffset, int yOffset, int radius);
217 
218  Ui::MainWindow* ui;
220  QTimer _serialTimer;
223  QTranslator _translator;
224 };
225 
226 #endif /* MAINWINDOW_HH */
The class connecting main application and serial port.
Thread wrapper class for communicating with the serial device on a separate thread.
Definition: frameThread.hh:27
The class connecting all modules through the UI interface.
Definition: mainwindow.hh:41
void showErrorMessage(const QString &message)
Show error message as status bar message.
Definition: mainwindow.cpp:175
void closeEvent(QCloseEvent *event) override
Closing event function.
Definition: mainwindow.cpp:94
void on_actionDisconnect_triggered()
Slot triggered when the disconnecting signal was emitted.
Definition: mainwindow.cpp:108
FrameThread * _frameThread
Handle for communicating on different thread.
Definition: mainwindow.hh:221
void on_actionClose_triggered()
Slot triggered when the closing signal was emitted.
Definition: mainwindow.cpp:101
void setObstacleCloseStatus()
Set the close distance status with the obstacle on the motor information widget.
Definition: mainwindow.cpp:235
Communication * _communication
Communication handle.
Definition: mainwindow.hh:219
Ui::MainWindow * ui
Pointer to all UI widgets.
Definition: mainwindow.hh:218
void addValueGSpeedL(const QString &message)
Set the value of the left motor given speed.
Definition: mainwindow.cpp:200
void addValueSpeedR(const QString &message)
Set the value of the right motor speed.
Definition: mainwindow.cpp:210
void resetObstacleCloseStatus()
Set the normal distance status with the obstacle on the motor information widget.
Definition: mainwindow.cpp:241
void setSerialStatus(const QString &message)
Set the connection status with the serial port on the status bar.
Definition: mainwindow.cpp:230
void addMessageToLogs(const QString &message)
Add a message to the logs widget.
Definition: mainwindow.cpp:180
Parser * _parser
Serial data processor.
Definition: mainwindow.hh:222
void addValueSpeedL(const QString &message)
Set the value of the left motor speed.
Definition: mainwindow.cpp:195
void on_actionEnglish_US_triggered()
Change UI language to English (US).
Definition: mainwindow.cpp:256
MainWindow(QWidget *parent=nullptr)
Construct a new MainWindow object.
Definition: mainwindow.cpp:29
void addValueBattery(const int message)
Set the battery voltage value.
Definition: mainwindow.cpp:225
QTranslator _translator
Handle to translator object.
Definition: mainwindow.hh:223
void addDropShadow(QGroupBox *group, int xOffset, int yOffset, int radius)
Add drop shadow under given GroupBox widget.
Definition: mainwindow.cpp:187
void serialTimeout()
Update information read from the serial port.
Definition: mainwindow.cpp:154
void addValueAccelerationR(const QString &message)
Set the value of the right motor acceleration.
Definition: mainwindow.cpp:220
void on_actionPolish_triggered()
Change UI language to Polish.
Definition: mainwindow.cpp:247
QTimer _serialTimer
Serial data updating timer.
Definition: mainwindow.hh:220
void on_actionSearch_triggered()
Slot triggered when the searching signal was emitted.
Definition: mainwindow.cpp:114
~MainWindow()
Destroy the MainWindow object.
Definition: mainwindow.cpp:89
void connectSerialDevice(const QString &actionName)
Connect to the serial device.
Definition: mainwindow.cpp:136
void addValueAccelerationL(const QString &message)
Set the value of the left motor acceleration.
Definition: mainwindow.cpp:205
void addValueGSpeedR(const QString &message)
Set the value of the right motor given speed.
Definition: mainwindow.cpp:215
Parsing class for a processing data from the serial port frame.
Definition: parser.hh:29
Communication class declaration.
FrameThread class declaration.
The Joystick class declaration.
Definition: mainwindow.hh:32
Parser class declaration.