/[svn]/qsampler/trunk/src/qsamplerMainForm.h
ViewVC logotype

Contents of /qsampler/trunk/src/qsamplerMainForm.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2112 - (show annotations) (download) (as text)
Wed Jul 21 18:33:25 2010 UTC (13 years, 9 months ago) by capela
File MIME type: text/x-c++hdr
File size: 5008 byte(s)
- Moving from old deprecated Qt3'ish custom event post handling
  into regular asynchronous signal/slot strategy. (EXPERIMENTAL)

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

  ViewVC Help
Powered by ViewVC