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