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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3849 - (show annotations) (download) (as text)
Thu Jan 7 16:18:02 2021 UTC (3 years, 3 months ago) by capela
File MIME type: text/x-c++hdr
File size: 5409 byte(s)
- Use <cmath> instead of <math.h> et al.
1 // qsamplerMainForm.h
2 //
3 /****************************************************************************
4 Copyright (C) 2004-2021, rncbc aka Rui Nuno Capela. All rights reserved.
5 Copyright (C) 2007-2019 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 QMdiSubWindow;
32 class QSocketNotifier;
33 class QSpinBox;
34 class QSlider;
35 class QLabel;
36
37 namespace QSampler {
38
39 class Workspace;
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 = nullptr);
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 QColor& rgb);
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 channelsArrangeAuto();
80 void contextMenuEvent(QContextMenuEvent *pEvent);
81 void sessionDirty();
82
83 static MainForm *getInstance();
84
85 public slots:
86
87 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
113 void stabilizeForm();
114
115 protected slots:
116
117 void updateRecentFilesMenu();
118
119 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 void autoReconnectClient();
127
128 void handle_sigusr1();
129 void handle_sigterm();
130
131 // Channel strip activation/selection.
132 void activateStrip(QMdiSubWindow *pMdiSubWindow);
133
134 // Channel toolbar orientation change.
135 void channelsToolbarOrientation(Qt::Orientation orientation);
136
137 protected:
138
139 void addChannelStrip();
140 void removeChannelStrip();
141
142 bool queryClose();
143 void closeEvent(QCloseEvent* pCloseEvent);
144 void dragEnterEvent(QDragEnterEvent *pDragEnterEvent);
145 void dropEvent(QDropEvent *pDropEvent);
146 void customEvent(QEvent *pCustomEvent);
147 bool newSession();
148 bool openSession();
149 bool saveSession(bool bPrompt);
150 bool closeSession(bool bForce);
151 bool loadSessionFile(const QString& sFilename);
152 bool saveSessionFile(const QString& sFilename);
153 void updateSession();
154 void updateRecentFiles(const QString& sFilename);
155 void updateInstrumentNames();
156 void updateDisplayFont();
157 void updateDisplayEffect();
158 void updateMaxVolume();
159 void updateMessagesFont();
160 void updateMessagesLimit();
161 void updateMessagesCapture();
162 void updateViewMidiDeviceStatusMenu();
163 void updateAllChannelStrips(bool bRemoveDeadStrips);
164
165 void startSchedule(int iStartDelay);
166 void stopSchedule();
167 void startServer();
168 void stopServer(bool bInteractive = false);
169 bool startClient(bool bReconnectOnly = false);
170 void stopClient();
171 void startAutoReconnectClient();
172
173 private:
174
175 Ui::qsamplerMainForm m_ui;
176
177 Options *m_pOptions;
178 Messages *m_pMessages;
179 Workspace *m_pWorkspace;
180 QSocketNotifier *m_pSigusr1Notifier;
181 QSocketNotifier *m_pSigtermNotifier;
182 QString m_sFilename;
183 int m_iUntitled;
184 int m_iDirtySetup;
185 int m_iDirtyCount;
186 lscp_client_t *m_pClient;
187 QProcess *m_pServer;
188 bool m_bForceServerStop;
189 int m_iStartDelay;
190 int m_iTimerDelay;
191 int m_iTimerSlot;
192 QLabel *m_statusItem[5];
193 QList<ChannelStrip *> m_changedStrips;
194 InstrumentListForm *m_pInstrumentListForm;
195 DeviceForm *m_pDeviceForm;
196 static MainForm *g_pMainForm;
197 QSlider *m_pVolumeSlider;
198 QSpinBox *m_pVolumeSpinBox;
199 int m_iVolumeChanging;
200 };
201
202 } // namespace QSampler
203
204 #endif // __qsamplerMainForm_h
205
206
207 // end of qsamplerMainForm.h

  ViewVC Help
Powered by ViewVC