-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.h
More file actions
98 lines (86 loc) · 2.1 KB
/
MainWindow.h
File metadata and controls
98 lines (86 loc) · 2.1 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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QDockWidget>
#include <QMap>
#include <QBasicTimer>
class QTranslator;
namespace CirSim {
class Circuit;
class Pin;
class Net;
}
class EditorWidget;
class OscilloscopeWidget;
typedef struct
{
CirSim::Pin *pin;
QString label;
} CurrentProbe;
typedef struct
{
CirSim::Net *net;
QString label;
} VoltageProbe;
class MainWindow : public QMainWindow
{
Q_OBJECT
friend class EditorWidget;
protected:
class OscDockWidget : public QDockWidget
{
protected:
OscilloscopeWidget *m_oscilloscope;
public:
OscDockWidget(MainWindow *parent);
OscilloscopeWidget *oscilloscope();
protected:
void mousePressEvent(QMouseEvent *event) override;
};
protected:
double m_time;
double m_tickTime;
qint64 m_frameTime;
double m_playbackSpeed;
int m_maxIterations;
double m_maxAcceptableError;
int m_iterateLevel;
CirSim::Circuit *m_circuit;
QList<CurrentProbe> m_currentProbes;
QList<VoltageProbe> m_voltageProbes;
EditorWidget *m_editor;
OscDockWidget *m_oscilloscopeDock;
QDockWidget *m_inspectorDock;
private:
qint64 m_realTime;
QBasicTimer *m_timer;
bool m_hasFilePath;
QString m_filePath;
QString m_language;
QTranslator *m_translator;
QAction *m_inspectorAction, *m_oscilloscopeAction;
QMap<QString, QAction *> m_languageActions;
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
void setInspector(QWidget *inspector);
bool isSimulating();
QByteArray serialize();
void deserialize(const QByteArray &bytes);
protected:
void contextMenuEvent(QContextMenuEvent *event) override;
void timerEvent(QTimerEvent *event) override;
public slots:
void startSimulation();
void stopSimulation();
void newFile();
void saveFile();
void saveAsFile();
void openFile();
protected slots:
void openExample(const QString &name, const QString &path);
void setLanguage(const QString &language);
void loadSettings();
void saveSettings();
};
#endif // MAINWINDOW_H