This repository was archived by the owner on Jan 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathmainwindow.h
More file actions
153 lines (132 loc) · 3.87 KB
/
mainwindow.h
File metadata and controls
153 lines (132 loc) · 3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
Copyright 2013 Jared Wiltshire
This file is part of VAG Blocks.
VAG Blocks is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
VAG Blocks is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with VAG Blocks. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QPushButton>
#include <QSpinBox>
#include <QLabel>
#include <QLCDNumber>
#include <QVBoxLayout>
#include <QSignalMapper>
#include <QElapsedTimer>
#include <QSettings>
#include "kwp2000.h"
#include "clicklineedit.h"
#include "about.h"
#include "settings.h"
#include "qwt_plot.h"
#include "qwt_plot_curve.h"
#include "qwt_legend.h"
#include "qwt_legend_item.h"
#include "qwt_plot_grid.h"
const QString colorList[] = {
"red", "green", "blue", "orange",
"turquoise", "yellow", "fuchsia", "olive",
"maroon", "lightpink", "greenyellow", "tan",
"darkblue", "orangered", "grey", "teal"
};
typedef struct {
QPushButton* pushButton;
QSpinBox* spinBox;
QLabel* blockTitle;
QLabel* desc[4];
QLabel* subDesc[4];
clickLineEdit* lineEdit[4];
int blockNum;
double rate;
} blockWidgets;
typedef struct {
QwtPlotCurve* curve;
QVector<double>* data;
} curveAndData;
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
friend class settings;
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
serialSettingsDialog* serSettings;
about* aboutDialog;
settings* settingsDialog;
kwp2000 kwp;
blockWidgets blockDisplays[4];
QSignalMapper mapButtons;
QSignalMapper mapValueClick;
QElapsedTimer perfTimer[4];
QList<double> avgList;
QSettings* appSettings;
bool serialConfigured;
bool showLogDock;
bool showModuleDock;
bool showInfoDock;
bool showPlotDock;
int logLevel;
QStringList logBuffer;
void setupBlockArray(QVBoxLayout *in);
int getBlockRow(int blockNum);
void clearRow(int row, bool clearNum = true);
void closeEvent(QCloseEvent *event);
void hideEvent(QHideEvent *event);
void changeEvent(QEvent *event);
void saveSettings();
void restoreSettings();
void saveDocks();
void restoreDocks();
void flushLogBuffer();
int storedRow;
int storedCol;
bool currentlyLogging;
void setupPlot();
QTimer plotTimer;
QVector<curveAndData> curves;
QVector<double> timeAxis;
private slots:
void plotUpdate();
void log(const QString &txt, int logLevel = stdLog);
void newBlockData(int blockNum);
void connectToSerial();
void openCloseBlock(int row);
void spinChanged(int blockNum);
void on_actionSerial_port_settings_triggered();
void channelOpen(bool status);
void blockOpen(int i);
void blockClosed(int i);
void on_actionReset_docks_triggered();
void selectNewModule(int pos);
void on_pushButton_openModule_clicked();
void on_lineEdit_moduleNum_textChanged(const QString &arg1);
void elmInitialised(bool ok);
void portOpened(bool open);
void portClosed();
void startLogging(bool start);
void labelsLoaded(bool ok);
void moduleInfoReceived(QStringList info);
void ecuInfoReceived(QStringList info);
void clearUI();
void refreshModules(bool quickInit = false);
void displayInfo(int i);
void sampleFormatChanged();
void showCurve(QwtPlotItem *item, bool on);
void loggingStarted();
void updateSettings();
};
#endif // MAINWINDOW_H