1 |
capela |
1464 |
// qsamplerMainForm.h |
2 |
|
|
// |
3 |
|
|
/**************************************************************************** |
4 |
capela |
3508 |
Copyright (C) 2004-2019, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
capela |
2718 |
Copyright (C) 2007,2008,2015 Christian Schoenebeck |
6 |
schoenebeck |
1461 |
|
7 |
capela |
1464 |
This program is free software; you can redistribute it and/or |
8 |
|
|
modify it under the terms of the GNU General Public License |
9 |
|
|
as published by the Free Software Foundation; either version 2 |
10 |
|
|
of the License, or (at your option) any later version. |
11 |
|
|
|
12 |
|
|
This program is distributed in the hope that it will be useful, |
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
GNU General Public License for more details. |
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License along |
18 |
|
|
with this program; if not, write to the Free Software Foundation, Inc., |
19 |
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
|
|
|
21 |
|
|
*****************************************************************************/ |
22 |
|
|
|
23 |
|
|
#ifndef __qsamplerMainForm_h |
24 |
|
|
#define __qsamplerMainForm_h |
25 |
|
|
|
26 |
schoenebeck |
1461 |
#include "ui_qsamplerMainForm.h" |
27 |
|
|
|
28 |
capela |
1513 |
#include <lscp/client.h> |
29 |
schoenebeck |
1461 |
|
30 |
capela |
1513 |
class QProcess; |
31 |
capela |
2387 |
class QMdiSubWindow; |
32 |
capela |
2112 |
class QSocketNotifier; |
33 |
capela |
1513 |
class QSpinBox; |
34 |
|
|
class QSlider; |
35 |
|
|
class QLabel; |
36 |
capela |
1499 |
|
37 |
schoenebeck |
1461 |
namespace QSampler { |
38 |
|
|
|
39 |
capela |
2979 |
class Workspace; |
40 |
capela |
1558 |
class Options; |
41 |
|
|
class Messages; |
42 |
|
|
class Channel; |
43 |
capela |
1513 |
class ChannelStrip; |
44 |
schoenebeck |
1461 |
class DeviceForm; |
45 |
capela |
1513 |
class InstrumentListForm; |
46 |
schoenebeck |
1461 |
|
47 |
capela |
1558 |
//------------------------------------------------------------------------- |
48 |
|
|
// QSampler::MainForm -- Main window form implementation. |
49 |
|
|
// |
50 |
capela |
1513 |
|
51 |
capela |
1509 |
class MainForm : public QMainWindow |
52 |
|
|
{ |
53 |
|
|
Q_OBJECT |
54 |
|
|
|
55 |
schoenebeck |
1461 |
public: |
56 |
|
|
|
57 |
capela |
3555 |
MainForm(QWidget *pParent = nullptr); |
58 |
capela |
1509 |
~MainForm(); |
59 |
|
|
|
60 |
capela |
2979 |
void setup(Options *pOptions); |
61 |
capela |
1509 |
|
62 |
capela |
2979 |
Options *options() const; |
63 |
|
|
lscp_client_t *client() const; |
64 |
capela |
1509 |
|
65 |
|
|
QString sessionName(const QString& sFilename); |
66 |
|
|
|
67 |
capela |
2722 |
void appendMessages(const QString& sText); |
68 |
|
|
void appendMessagesColor(const QString& sText, const QString& sColor); |
69 |
|
|
void appendMessagesText(const QString& sText); |
70 |
|
|
void appendMessagesError(const QString& sText); |
71 |
|
|
void appendMessagesClient(const QString& sText); |
72 |
capela |
1509 |
|
73 |
capela |
2387 |
ChannelStrip *createChannelStrip(Channel *pChannel); |
74 |
|
|
void destroyChannelStrip(ChannelStrip *pChannelStrip); |
75 |
|
|
ChannelStrip *activeChannelStrip(); |
76 |
|
|
ChannelStrip *channelStripAt(int iChannel); |
77 |
|
|
ChannelStrip *channelStrip(int iChannelID); |
78 |
capela |
1509 |
|
79 |
capela |
2979 |
void channelsArrangeAuto(); |
80 |
capela |
1509 |
void contextMenuEvent(QContextMenuEvent *pEvent); |
81 |
capela |
2979 |
void sessionDirty(); |
82 |
capela |
1509 |
|
83 |
capela |
2979 |
static MainForm *getInstance(); |
84 |
capela |
1509 |
|
85 |
schoenebeck |
1461 |
public slots: |
86 |
|
|
|
87 |
capela |
1509 |
void fileNew(); |
88 |
|
|
void fileOpen(); |
89 |
|
|
void fileOpenRecent(); |
90 |
|
|
void fileSave(); |
91 |
|
|
void fileSaveAs(); |
92 |
|
|
void fileReset(); |
93 |
|
|
void fileRestart(); |
94 |
|
|
void fileExit(); |
95 |
|
|
void editAddChannel(); |
96 |
|
|
void editRemoveChannel(); |
97 |
|
|
void editSetupChannel(); |
98 |
|
|
void editEditChannel(); |
99 |
|
|
void editResetChannel(); |
100 |
|
|
void editResetAllChannels(); |
101 |
|
|
void viewMenubar(bool bOn); |
102 |
|
|
void viewToolbar(bool bOn); |
103 |
|
|
void viewStatusbar(bool bOn); |
104 |
|
|
void viewMessages(bool bOn); |
105 |
|
|
void viewInstruments(); |
106 |
|
|
void viewDevices(); |
107 |
|
|
void viewOptions(); |
108 |
|
|
void channelsArrange(); |
109 |
|
|
void channelsAutoArrange(bool bOn); |
110 |
|
|
void helpAboutQt(); |
111 |
|
|
void helpAbout(); |
112 |
capela |
2979 |
|
113 |
|
|
void stabilizeForm(); |
114 |
|
|
|
115 |
|
|
protected slots: |
116 |
|
|
|
117 |
|
|
void updateRecentFilesMenu(); |
118 |
|
|
|
119 |
capela |
1509 |
void volumeChanged(int iVolume); |
120 |
|
|
void channelStripChanged(ChannelStrip *pChannelStrip); |
121 |
|
|
void channelsMenuAboutToShow(); |
122 |
|
|
void channelsMenuActivated(); |
123 |
|
|
void timerSlot(); |
124 |
|
|
void readServerStdout(); |
125 |
|
|
void processServerExit(); |
126 |
|
|
|
127 |
capela |
2112 |
void handle_sigusr1(); |
128 |
capela |
3508 |
void handle_sigterm(); |
129 |
capela |
2112 |
|
130 |
capela |
1514 |
// Channel strip activation/selection. |
131 |
capela |
2387 |
void activateStrip(QMdiSubWindow *pMdiSubWindow); |
132 |
capela |
1514 |
|
133 |
capela |
2681 |
// Channel toolbar orientation change. |
134 |
|
|
void channelsToolbarOrientation(Qt::Orientation orientation); |
135 |
|
|
|
136 |
schoenebeck |
1461 |
protected: |
137 |
|
|
|
138 |
capela |
2978 |
void addChannelStrip(); |
139 |
|
|
void removeChannelStrip(); |
140 |
|
|
|
141 |
capela |
1509 |
bool queryClose(); |
142 |
|
|
void closeEvent(QCloseEvent* pCloseEvent); |
143 |
|
|
void dragEnterEvent(QDragEnterEvent *pDragEnterEvent); |
144 |
|
|
void dropEvent(QDropEvent *pDropEvent); |
145 |
capela |
2978 |
void customEvent(QEvent *pCustomEvent); |
146 |
capela |
1509 |
bool newSession(); |
147 |
|
|
bool openSession(); |
148 |
|
|
bool saveSession(bool bPrompt); |
149 |
|
|
bool closeSession(bool bForce); |
150 |
|
|
bool loadSessionFile(const QString& sFilename); |
151 |
|
|
bool saveSessionFile(const QString& sFilename); |
152 |
|
|
void updateSession(); |
153 |
|
|
void updateRecentFiles(const QString& sFilename); |
154 |
|
|
void updateInstrumentNames(); |
155 |
|
|
void updateDisplayFont(); |
156 |
|
|
void updateDisplayEffect(); |
157 |
|
|
void updateMaxVolume(); |
158 |
|
|
void updateMessagesFont(); |
159 |
|
|
void updateMessagesLimit(); |
160 |
|
|
void updateMessagesCapture(); |
161 |
schoenebeck |
1698 |
void updateViewMidiDeviceStatusMenu(); |
162 |
schoenebeck |
1702 |
void updateAllChannelStrips(bool bRemoveDeadStrips); |
163 |
capela |
2979 |
|
164 |
capela |
1509 |
void startSchedule(int iStartDelay); |
165 |
|
|
void stopSchedule(); |
166 |
|
|
void startServer(); |
167 |
schoenebeck |
1626 |
void stopServer(bool bInteractive = false); |
168 |
capela |
1509 |
bool startClient(); |
169 |
|
|
void stopClient(); |
170 |
|
|
|
171 |
schoenebeck |
1461 |
private: |
172 |
|
|
|
173 |
capela |
1509 |
Ui::qsamplerMainForm m_ui; |
174 |
schoenebeck |
1461 |
|
175 |
capela |
1558 |
Options *m_pOptions; |
176 |
|
|
Messages *m_pMessages; |
177 |
capela |
2979 |
Workspace *m_pWorkspace; |
178 |
capela |
3508 |
QSocketNotifier *m_pSigusr1Notifier; |
179 |
|
|
QSocketNotifier *m_pSigtermNotifier; |
180 |
capela |
1509 |
QString m_sFilename; |
181 |
|
|
int m_iUntitled; |
182 |
capela |
2978 |
int m_iDirtySetup; |
183 |
capela |
1509 |
int m_iDirtyCount; |
184 |
|
|
lscp_client_t *m_pClient; |
185 |
|
|
QProcess *m_pServer; |
186 |
capela |
3128 |
bool m_bForceServerStop; |
187 |
capela |
1509 |
int m_iStartDelay; |
188 |
|
|
int m_iTimerDelay; |
189 |
|
|
int m_iTimerSlot; |
190 |
|
|
QLabel *m_statusItem[5]; |
191 |
|
|
QList<ChannelStrip *> m_changedStrips; |
192 |
|
|
InstrumentListForm *m_pInstrumentListForm; |
193 |
|
|
DeviceForm *m_pDeviceForm; |
194 |
|
|
static MainForm *g_pMainForm; |
195 |
|
|
QSlider *m_pVolumeSlider; |
196 |
|
|
QSpinBox *m_pVolumeSpinBox; |
197 |
|
|
int m_iVolumeChanging; |
198 |
schoenebeck |
1461 |
}; |
199 |
|
|
|
200 |
|
|
} // namespace QSampler |
201 |
|
|
|
202 |
capela |
1464 |
#endif // __qsamplerMainForm_h |
203 |
|
|
|
204 |
|
|
|
205 |
capela |
1465 |
// end of qsamplerMainForm.h |