-
Notifications
You must be signed in to change notification settings - Fork 18
/
viper_window.h
executable file
·215 lines (176 loc) · 5.36 KB
/
viper_window.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*
* This program 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.
This program 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 <https://www.gnu.org/licenses/>.
*
* ThePBone <tim.schneeberger(at)outlook.de> (c) 2020
*/
#ifndef VIPERWINDOW_H
#define VIPERWINDOW_H
#include <QFrame>
#include <QMainWindow>
#include <QSystemTrayIcon>
#include <QTranslator>
#include "misc/common.h"
#ifndef VIPER_PLUGINMODE
#include "visualization/audiostreamengine.h"
#include "visualization/spectrograph.h"
#endif
#ifndef VIPER_PLUGINMODE
#include "config/dbusproxy.h"
#endif
//Minimum required version of gst-plugin-viperfx
#define MINIMUM_PLUGIN_VERSION "2.0.0"
using namespace std;
namespace Ui {
class ViperWindow;
}
class AppConfigWrapper;
class ConfigContainer;
class OverlayMsgProxy;
class SettingsDlg;
class ConvolverDlg;
class PresetDlg;
class LogDlg;
class StyleHelper;
class ViperWindow : public QWidget
{
Q_OBJECT
enum class Context;
public:
Ui::ViperWindow *ui;
#ifndef VIPER_PLUGINMODE
explicit ViperWindow(QString exepath = "",
bool statupInTray = false,
bool allowMultipleInst = false,
QWidget *parent = nullptr);
#else
Q_INVOKABLE explicit ViperWindow(QString working_dir,
QWidget *parent = nullptr);
#endif
~ViperWindow();
void LoadPresetFile(const QString&);
void SavePresetFile(const QString&);
AppConfigWrapper* getACWrapper();
void SetEQ(const QVector<float>& data);
void SetIRS(const QString& irs,bool apply);
void setVisible(bool visible) override;
void setPopupButtonEnabled(bool b);
QMenu* buildAvailableActions();
QMenu *buildDefaultActions();
void LoadConfig(Context ctx = Context::Application);
ConfigContainer* conf;
#ifndef VIPER_PLUGINMODE
QMenu *getTrayContextMenu();
void updateTrayMenu(QMenu *menu);
void setTrayVisible(bool visible);
QString GetExecutablePath();
void LaunchFirstRunSetup();
#endif
SettingsDlg *settings_dlg;
void loadConfigFromContainer(ConfigContainer c);
#ifdef VIPER_PLUGINMODE
QString getLegacyPath();
#endif
signals:
void popupButtonPressed();
protected:
void closeEvent(QCloseEvent *event) override;
public slots:
void Reset();
void ColmPresetSelectionUpdated();
void ApplyConfig(bool restart=true);
#ifndef VIPER_PLUGINMODE
void Restart();
void RestartSpectrum();
void raiseWindow();
void iconActivated(QSystemTrayIcon::ActivationReason reason);
#endif
private slots:
void DisableFX();
void OnUpdate(bool = true);
void OnRelease();
void ResetEQ();
void EqPresetSelectionUpdated();
void DynsysPresetSelectionUpdated();
void UpdateUnitLabel(int,QObject*alt=nullptr);
void UpdateAllUnitLabels();
void LoadExternalFile();
void SaveExternalFile();
void OpenLog();
void DialogHandler();
void UpdateEqStringFromWidget();
void UpdateDynsysStringFromWidget();
void UpdateColmStringFromWidget();
#ifndef VIPER_PLUGINMODE
void RefreshSpectrumParameters();
void updateTrayPresetList();
#endif
signals:
void changesApplied();
protected:
private:
AppConfigWrapper* m_appwrapper;
StyleHelper* m_stylehelper;
#ifndef VIPER_PLUGINMODE
DBusProxy* m_dbus;
#endif
ConvolverDlg *conv_dlg;
PresetDlg *preset_dlg;
LogDlg *log_dlg;
#ifndef VIPER_PLUGINMODE
QString m_exepath;
bool m_startupInTraySwitch;
QSystemTrayIcon *trayIcon;
QMenu *trayIconMenu;
QAction *quitAction;
QAction *tray_disableAction;
QMenu *tray_presetMenu;
QMenu *tray_convMenu;
OverlayMsgProxy *msg_launchfail;
OverlayMsgProxy *msg_versionmismatch;
QAction *spectrum;
QScopedPointer<QFrame> analysisLayout;
Spectrograph* m_spectrograph;
AudioStreamEngine* m_audioengine;
#endif
OverlayMsgProxy *msg_notrunning;
bool settingsdlg_enabled=true;
bool presetdlg_enabled=true;
bool logdlg_enabled=true;
bool lockapply = false;
QString activeirs = "";
#ifndef VIPER_PLUGINMODE
void InitializeSpectrum();
void ToggleSpectrum(bool on,bool ctrl_visibility);
void SetSpectrumVisibility(bool v);
void createTrayIcon();
void initGlobalTrayActions();
void updateTrayConvolverList();
void CheckDBusVersion();
void RunDiagnosticChecks();
#endif
void ShowDBusError();
void UpdateTooltipLabelUnit(QObject* sender,const QString& text,bool);
void ConnectActions();
QVariantMap readConfig(const QString& path = "");
enum class Context{
DBus,
Application
};
static void replaceTab(QTabWidget* tab, int index, QWidget *page, QString title = ""){
if(title.isEmpty()) title = tab->tabText(index);
auto toDelete = tab->widget(index);
tab->removeTab(index);
toDelete->deleteLater();
tab->insertTab(index, page, title);
}
};
#endif // VIPERWINDOW_H