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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2387 - (show annotations) (download) (as text)
Sat Dec 29 00:21:11 2012 UTC (11 years, 3 months ago) by capela
File MIME type: text/x-c++hdr
File size: 5037 byte(s)
* Preparations for Qt5 migration. (TESTING)
1 // qsamplerMainForm.h
2 //
3 /****************************************************************************
4 Copyright (C) 2004-2012, 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 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& s);
68 void appendMessagesColor(const QString& s, const QString& c);
69 void appendMessagesText(const QString& s);
70 void appendMessagesError(const QString& s);
71 void appendMessagesClient(const QString& s);
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 protected:
130
131 bool queryClose();
132 void closeEvent(QCloseEvent* pCloseEvent);
133 void dragEnterEvent(QDragEnterEvent *pDragEnterEvent);
134 void dropEvent(QDropEvent *pDropEvent);
135 void customEvent(QEvent* pCustomEvent);
136 bool newSession();
137 bool openSession();
138 bool saveSession(bool bPrompt);
139 bool closeSession(bool bForce);
140 bool loadSessionFile(const QString& sFilename);
141 bool saveSessionFile(const QString& sFilename);
142 void updateSession();
143 void updateRecentFiles(const QString& sFilename);
144 void updateInstrumentNames();
145 void updateDisplayFont();
146 void updateDisplayEffect();
147 void updateMaxVolume();
148 void updateMessagesFont();
149 void updateMessagesLimit();
150 void updateMessagesCapture();
151 void updateViewMidiDeviceStatusMenu();
152 void updateAllChannelStrips(bool bRemoveDeadStrips);
153 void startSchedule(int iStartDelay);
154 void stopSchedule();
155 void startServer();
156 void stopServer(bool bInteractive = false);
157 bool startClient();
158 void stopClient();
159
160 private:
161
162 Ui::qsamplerMainForm m_ui;
163
164 Options *m_pOptions;
165 Messages *m_pMessages;
166 QMdiArea *m_pWorkspace;
167 QSocketNotifier *m_pUsr1Notifier;
168 QString m_sFilename;
169 int m_iUntitled;
170 int m_iDirtyCount;
171 lscp_client_t *m_pClient;
172 QProcess *m_pServer;
173 bool bForceServerStop;
174 int m_iStartDelay;
175 int m_iTimerDelay;
176 int m_iTimerSlot;
177 QLabel *m_statusItem[5];
178 QList<ChannelStrip *> m_changedStrips;
179 InstrumentListForm *m_pInstrumentListForm;
180 DeviceForm *m_pDeviceForm;
181 static MainForm *g_pMainForm;
182 QSlider *m_pVolumeSlider;
183 QSpinBox *m_pVolumeSpinBox;
184 int m_iVolumeChanging;
185 };
186
187 } // namespace QSampler
188
189 #endif // __qsamplerMainForm_h
190
191
192 // end of qsamplerMainForm.h

  ViewVC Help
Powered by ViewVC