-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathmainwindow.h
163 lines (137 loc) · 5.02 KB
/
mainwindow.h
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
154
155
156
157
158
159
160
161
162
163
/*
Original copyright 2018 Benjamin Vedder [email protected] and the VESC Tool project ( https://github.com/vedderb/vesc_tool )
Now forked to:
Danny Bokma [email protected]
This file is part of BMS Tool.
DieBieMS Tool 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.
DieBieMS Tool 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QLabel>
#include <QTimer>
#include <QProcess>
#include <QSettings>
#include <QMessageBox>
#include <QDebug>
#include <QFileDialog>
#include <QListWidgetItem>
#include <cmath>
#include <QEventLoop>
#include <QDesktopServices>
#include <QLoggingCategory>
#include "bmsinterface.h"
#include "ui_mainwindow.h"
#include "parametereditor.h"
#include "utility.h"
#include "widgets/pagelistitem.h"
#include "widgets/helpdialog.h"
#include "widgets/paramdialog.h"
#include "pages/pagewelcome.h"
#include "pages/pageconnection.h"
#include "pages/pagedataanalysis.h"
#include "pages/pagertdata.h"
#include "pages/pageterminal.h"
#include "pages/pagefirmware.h"
#include "pages/pagedebugprint.h"
#include "pages/pagemastersettings.h"
#include "pages/pagemastergeneral.h"
#include "pages/pagemasterswitch.h"
#include "pages/pagemastercell.h"
#include "pages/pagemasterdisplay.h"
#include "pages/pageslavesettings.h"
#include "pages/pageslavegeneral.h"
#include "pages/pageslaveswitch.h"
#include "pages/pageslaveio.h"
#include "pages/pageslavefan.h"
#include "pages/pagesettings.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void timerSlot();
void showStatusInfo(QString info, bool isGood);
void showMessageDialog(const QString &title, const QString &msg, bool isGood, bool richText);
void serialPortNotWritable(const QString &port);
void bmsconfUpdated();
void bmsConfigCheckResult(QStringList paramsNotSet);
void on_actionReconnect_triggered();
void on_actionDisconnect_triggered();
void on_actionReboot_triggered();
void on_actionReadBMScconf_triggered();
void on_actionReadBMScconfDefault_triggered();
void on_actionWriteBMScconf_triggered();
void on_actionSaveBMSConfXml_triggered();
void on_actionLoadBMSConfXml_triggered();
void on_actionExit_triggered();
void on_actionAbout_triggered();
void on_actionLibrariesUsed_triggered();
void on_pageList_currentRowChanged(int currentRow);
void on_actionParameterEditorBMScconf_triggered();
void on_actionParameterEditorInfo_triggered();
void on_actionSaveBMSConfigurationHeader_triggered();
void on_actionSaveBMSConfigurationHeaderWrap_triggered();
void on_actionTerminalPrintFaults_triggered();
void on_actionTerminalShowHelp_triggered();
void on_actionTerminalClear_triggered();
void on_actionTerminalPrintThreads_triggered();
void on_actionCanFwd_toggled(bool arg1);
void on_actionSafetyInformation_triggered();
void on_actionWarrantyStatement_triggered();
void on_actionDieBieMSToolChangelog_triggered();
void on_actionFirmwareChangelog_triggered();
void on_actionLicense_triggered();
void on_actionStoreBMScconf_triggered();
private:
Ui::MainWindow *ui;
QSettings mSettings;
QString mVersion;
BMSInterface *mDieBieMS;
QTimer *mTimer;
QLabel *mStatusLabel;
int mStatusInfoTime;
bool mKeyLeft;
bool mKeyRight;
bool mMcConfRead;
PageWelcome *mPageWelcome;
PageConnection *mPageConnection;
PageDataAnalysis *mPageDataAnalysis;
PageRtData *mPageRtData;
PageTerminal *mPageTerminal;
PageFirmware *mPageFirmware;
PageDebugPrint *mPageDebugPrint;
PageMasterSettings *mPageMasterSettings;
PageMasterGeneral *mPageMasterGeneral;
PageMasterSwitch *mPageMasterSwitch;
PageMasterCell *mPageMasterCell;
PageMasterDisplay *mPageMasterDisplay;
PageSlaveSettings *mSlaveSettings;
PageSlaveGeneral *mPageSlaveGeneral;
PageSlaveSwitch *mPageSlaveSwitch;
PageSlaveIO *mPageSlaveIO;
PageSlaveFAN *mPageSlaveFANs;
PageSettings *mPageSettings;
void addPageItem(QString name, QString icon = "", QString groupIcon = "", bool bold = false, bool indented = false);
void saveParamFileDialog(QString conf, bool wrapIfdef);
void showPage(const QString &name);
void reloadPages();
void checkUdev();
bool waitProcess(QProcess &process, bool block = true, int timeoutMs = 300000);
QString runCmd(QString cmd, QStringList args);
};
#endif // MAINWINDOW_H