1 |
// qsamplerMainForm.h |
2 |
// |
3 |
/**************************************************************************** |
4 |
Copyright (C) 2004-2015, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007,2008,2015 Christian Schoenebeck |
6 |
|
7 |
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 |
#include "ui_qsamplerMainForm.h" |
27 |
|
28 |
#include <lscp/client.h> |
29 |
|
30 |
class QProcess; |
31 |
class QMdiArea; |
32 |
class QMdiSubWindow; |
33 |
class QSocketNotifier; |
34 |
class QSpinBox; |
35 |
class QSlider; |
36 |
class QLabel; |
37 |
|
38 |
namespace QSampler { |
39 |
|
40 |
class Options; |
41 |
class Messages; |
42 |
class Channel; |
43 |
class ChannelStrip; |
44 |
class DeviceForm; |
45 |
class InstrumentListForm; |
46 |
|
47 |
//------------------------------------------------------------------------- |
48 |
// QSampler::MainForm -- Main window form implementation. |
49 |
// |
50 |
|
51 |
class MainForm : public QMainWindow |
52 |
{ |
53 |
Q_OBJECT |
54 |
|
55 |
public: |
56 |
|
57 |
MainForm(QWidget *pParent = NULL); |
58 |
~MainForm(); |
59 |
|
60 |
void setup(Options* pOptions); |
61 |
|
62 |
Options* options() const; |
63 |
lscp_client_t* client() const; |
64 |
|
65 |
QString sessionName(const QString& sFilename); |
66 |
|
67 |
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 |
|
73 |
ChannelStrip *createChannelStrip(Channel *pChannel); |
74 |
void destroyChannelStrip(ChannelStrip *pChannelStrip); |
75 |
ChannelStrip *activeChannelStrip(); |
76 |
ChannelStrip *channelStripAt(int iChannel); |
77 |
ChannelStrip *channelStrip(int iChannelID); |
78 |
|
79 |
void contextMenuEvent(QContextMenuEvent *pEvent); |
80 |
|
81 |
static MainForm* getInstance(); |
82 |
|
83 |
public slots: |
84 |
|
85 |
void fileNew(); |
86 |
void fileOpen(); |
87 |
void fileOpenRecent(); |
88 |
void fileSave(); |
89 |
void fileSaveAs(); |
90 |
void fileReset(); |
91 |
void fileRestart(); |
92 |
void fileExit(); |
93 |
void editAddChannel(); |
94 |
void editRemoveChannel(); |
95 |
void editSetupChannel(); |
96 |
void editEditChannel(); |
97 |
void editResetChannel(); |
98 |
void editResetAllChannels(); |
99 |
void viewMenubar(bool bOn); |
100 |
void viewToolbar(bool bOn); |
101 |
void viewStatusbar(bool bOn); |
102 |
void viewMessages(bool bOn); |
103 |
void viewInstruments(); |
104 |
void viewDevices(); |
105 |
void viewOptions(); |
106 |
void channelsArrange(); |
107 |
void channelsAutoArrange(bool bOn); |
108 |
void helpAboutQt(); |
109 |
void helpAbout(); |
110 |
void volumeChanged(int iVolume); |
111 |
void channelStripChanged(ChannelStrip *pChannelStrip); |
112 |
void channelsMenuAboutToShow(); |
113 |
void channelsMenuActivated(); |
114 |
void timerSlot(); |
115 |
void readServerStdout(); |
116 |
void processServerExit(); |
117 |
void sessionDirty(); |
118 |
void stabilizeForm(); |
119 |
|
120 |
void handle_sigusr1(); |
121 |
|
122 |
protected slots: |
123 |
|
124 |
void updateRecentFilesMenu(); |
125 |
|
126 |
// Channel strip activation/selection. |
127 |
void activateStrip(QMdiSubWindow *pMdiSubWindow); |
128 |
|
129 |
// Channel toolbar orientation change. |
130 |
void channelsToolbarOrientation(Qt::Orientation orientation); |
131 |
|
132 |
protected: |
133 |
|
134 |
bool queryClose(); |
135 |
void closeEvent(QCloseEvent* pCloseEvent); |
136 |
void dragEnterEvent(QDragEnterEvent *pDragEnterEvent); |
137 |
void dropEvent(QDropEvent *pDropEvent); |
138 |
void customEvent(QEvent* pCustomEvent); |
139 |
bool newSession(); |
140 |
bool openSession(); |
141 |
bool saveSession(bool bPrompt); |
142 |
bool closeSession(bool bForce); |
143 |
bool loadSessionFile(const QString& sFilename); |
144 |
bool saveSessionFile(const QString& sFilename); |
145 |
void updateSession(); |
146 |
void updateRecentFiles(const QString& sFilename); |
147 |
void updateInstrumentNames(); |
148 |
void updateDisplayFont(); |
149 |
void updateDisplayEffect(); |
150 |
void updateMaxVolume(); |
151 |
void updateMessagesFont(); |
152 |
void updateMessagesLimit(); |
153 |
void updateMessagesCapture(); |
154 |
void updateViewMidiDeviceStatusMenu(); |
155 |
void updateAllChannelStrips(bool bRemoveDeadStrips); |
156 |
void startSchedule(int iStartDelay); |
157 |
void stopSchedule(); |
158 |
void startServer(); |
159 |
void stopServer(bool bInteractive = false); |
160 |
bool startClient(); |
161 |
void stopClient(); |
162 |
|
163 |
private: |
164 |
|
165 |
Ui::qsamplerMainForm m_ui; |
166 |
|
167 |
Options *m_pOptions; |
168 |
Messages *m_pMessages; |
169 |
QMdiArea *m_pWorkspace; |
170 |
QSocketNotifier *m_pUsr1Notifier; |
171 |
QString m_sFilename; |
172 |
int m_iUntitled; |
173 |
int m_iDirtyCount; |
174 |
lscp_client_t *m_pClient; |
175 |
QProcess *m_pServer; |
176 |
bool bForceServerStop; |
177 |
int m_iStartDelay; |
178 |
int m_iTimerDelay; |
179 |
int m_iTimerSlot; |
180 |
QLabel *m_statusItem[5]; |
181 |
QList<ChannelStrip *> m_changedStrips; |
182 |
InstrumentListForm *m_pInstrumentListForm; |
183 |
DeviceForm *m_pDeviceForm; |
184 |
static MainForm *g_pMainForm; |
185 |
QSlider *m_pVolumeSlider; |
186 |
QSpinBox *m_pVolumeSpinBox; |
187 |
int m_iVolumeChanging; |
188 |
}; |
189 |
|
190 |
} // namespace QSampler |
191 |
|
192 |
#endif // __qsamplerMainForm_h |
193 |
|
194 |
|
195 |
// end of qsamplerMainForm.h |