-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathveikkconfig.h
87 lines (72 loc) · 2.28 KB
/
veikkconfig.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
/**
* This MainWindow class adds functionality to the basic UI in Ui::MainWindow
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "veikkparms.h"
#include <QMainWindow>
#include <QGraphicsView>
#include <QDoubleSpinBox>
#include <QLineEdit>
#include <QScreen>
#include <QCheckBox>
#include <QComboBox>
// TODO: remove
#include <QDebug>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow() override;
private:
Ui::MainWindow *ui;
QScreen *screen;
// configuration data; current is synced with UI, restoreParms is the last
// saved configuration
VeikkParms currentParms{}, restoreParms{};
QString curParmPath;
// relevant elements
QTabWidget *tabWidget;
QGraphicsView *pressureCurveView, *screenMapView;
// control elements
QDoubleSpinBox *pressureCoefSpinboxes[4];
QSpinBox *screenMapXSpinBox, *screenMapYSpinBox,
*screenMapWidthSpinBox, *screenMapHeightSpinBox,
*screenMapSpinboxes[4];
QLineEdit *screenWidthLineEdit, *screenHeightLineEdit;
QCheckBox *screenDefaultMap;
QComboBox *screenOrientation, *pressureMapDefaults;
QStatusBar *statusbar;
// handlers
void showEvent(QShowEvent *evt) override;
void resizeEvent(QResizeEvent *evt) override;
// composite parameter value getters
void getPressureCoefs(qint16 *coefs);
QRect getScreenMapParms();
// update statusbar
void updateStatus();
public slots:
void screenSizeChanged(QRect newScreenSize);
void tabChanged(int curTab);
void updatePressureForm(qint16 *newCoefs);
void updatePressureCoefs();
void updateScreenMapForm(QRect newScreenMap);
void updateScreenMapParms();
void setDefaultScreenMap(int checkState);
void setComboBoxDefaultPressure();
void resetScreenChanges();
void resetPressureChanges();
void loadParmsFromSysconfig();
void updateUiFromParms();
void launchDialog(QString text, bool isModal);
void loadParmsFromConfigFile();
void saveConfigToFile(bool saveAs);
void applyConfig(int parms);
signals:
void updatePressureCurve(qint16 *newCoefs);
void updateScreenMapRect(QRect newScreenMap);
};
#endif // MAINWINDOW_H