-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
mainwindow.h
180 lines (150 loc) · 5.4 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QFileDialog>
#include <QPrinter>
#include "speakerdialog.h"
#include "searchdialog.h"
#include "listdialog.h"
#include "bandpassdialog.h"
#include "speaker.h"
#include "sealedbox.h"
#include "portedbox.h"
#include "bandpassbox.h"
#include "plot.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
QUndoStack* getCommandStack() {
return this->commandStack;
};
void changeSpeakerNumber(int number);
void changeVendor(const QString &vendor, const Speaker& oldspeaker);
void changeModel(const QString &model);
void changeSealedVolume(double val);
void changePortedVolume(double val);
void changePortedResFreq(double val);
void changePortedPortNumber(unsigned int val);
void changePortedPortDiam(double val);
void changePortedSlotPortActivation(bool checked);
void changePortedSlotWidth(double val);
void changeBPSealedVolume(double val);
void changeBPPortedVolume(double val);
void changeBPPortedResFreq(double val);
void changeBPPortedPortNumber(double val);
void changeBPPortedPortDiam(double val);
void changeBPPortedSlotPortActivation(bool checked);
void changeBPPortedSlotWidth(double val);
void exportPlot(const QString& outfileName, int tabindex);
void exportScad3D(const QString& outfileName, int tabindex);
void exportScad2D(const QString& outfileName, int tabindex);
void exportScad(const QString &scad, const QString& outfileName, int tabindex);
signals:
void currentSpeakerChanged(Speaker spk);
void currentSealedBoxChanged(SealedBox box);
void currentPortedBoxChanged(PortedBox box);
void currentBandPassBoxChanged(BandPassBox box);
public slots:
void onProjectSave();
void onProjectExport();
void onProjectImport();
void onOpenRecentActionTriggered();
void onProjectQuit();
void onSpeakerNew();
void onSpeakerRemove();
void onSpeakerModify();
void onSpeakerInserted(Speaker spk);
void onSpeakerCancelled();
void onEditOptimize();
void onSpeakerSearch();
void onProjectPrint();
void onUndo();
void onRedo();
void onAboutAbout();
void onSearchRequested(const QString& param, double min, double max);
void onSearchCancelled();
void onSpeakerItemSelected(QString title, const Speaker &speaker);
void onSpeakerItemCancelled();
void onCurrentTabChanged(int tab);
void onNumberSpinChanged(int number);
void onVendorChanged(QString vendor);
void onModelChanged(QString model);
void onCurrentSpeakerChanged(const Speaker& spk);
void onCurrentSealedBoxChanged(const SealedBox& box);
void onCurrentPortedBoxChanged(const PortedBox& box);
void onCurrentBandPassBoxChanged(const BandPassBox& box);
void onSealedVolumeDoubleSpinChanged(double val);
void onPortedVolumeDoubleSpinChanged(double val);
void onPortedResonanceDoubleSpinChanged(double val);
void onPortedPortsNumberSpinChanged(int val);
void onPortedPortDiameterDoubleSpinChanged(double val);
void onPortedSlotWidthDoubleSpinChanged(double val);
void onPortedSlotPortActivated(bool checked);
void onBandPassSealedVolumeDoubleSpinChanged(double val);
void onBandPassPortedVolumeDoubleSpinChanged(double val);
void onBandPassPortedResonanceDoubleSpinChanged(double val);
void onBandPassPortNumSpinChanged(int val);
void onBandPassPortDiameterDoubleSpinChanged(double val);
void onBandPassSlotWidthDoubleSpinChanged(double val);
void onBandPassSlotPortActivated(bool checked);
void onAlignModerate_Inf();
void onAlignLegendre();
void onAlignBessel();
void onAlignBullock();
void onAlignKeele_Hoge();
void onBandpassAlignment();
void onBandpassOptimizeRequested(double s, double pa);
void onBandpassOptimizeCancelled();
void onCurvePlot();
void on3DScadExport();
void on2DScadExport();
protected:
QString strippedName(const QString& fullFileName);
void updateRecentFileActions();
void setRecentFile(const QString& fileName, bool ok);
bool loadFile(const QString& fileName);
void linkMenus();
void linkTabs();
void linkInternals();
void unlinkMenus();
void unlinkTabs();
void unlinkInternals();
bool print(QPrinter* printer);
void syncUiFromCurrentSpeaker(const Speaker &spk);
void syncUiFromCurrentSealedBox(const SealedBox& box);
void syncUiFromCurrentPortedBox(const PortedBox& box);
void syncUiFromCurrentBandPassBox(const BandPassBox& box);
void setActivateActions(QList<QAction *> actions, bool enable);
void setCurrentSpeaker(const Speaker& spk);
private:
static QString getHome();
Ui::MainWindow *ui;
bool projectSaved;
bool isModifying;
SpeakerDialog *spkDialog;
QFileDialog *fileDialog;
SearchDialog *searchDialog;
ListDialog *listDialog;
BandpassDialog *bandpassDialog;
Speaker oldSpeaker;
Speaker currentSpeaker;
int currentSpeakerNumber;
SealedBox currentSealedBox;
PortedBox currentPortedBox;
BandPassBox currentBandPassBox;
int currentTabIndex;
Plot *sealedPlot;
Plot *portedPlot;
Plot *bandpassPlot;
const Speaker *notInDbSpeaker;
QUndoStack *commandStack;
enum { MaxRecentFiles = 5 };
QAction *recentFileActs[MaxRecentFiles];
};
#endif // MAINWINDOW_H