1 |
// qsamplerMainForm.h |
// qsamplerMainForm.h |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2019, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, Christian Schoenebeck |
Copyright (C) 2007,2008,2015 Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
25 |
|
|
26 |
#include "ui_qsamplerMainForm.h" |
#include "ui_qsamplerMainForm.h" |
27 |
|
|
28 |
#include "qsamplerMessages.h" |
#include <lscp/client.h> |
|
#include "qsamplerChannelStrip.h" |
|
|
#include "qsamplerInstrumentListForm.h" |
|
|
#include "qsamplerDeviceForm.h" |
|
29 |
|
|
|
class QWorkspace; |
|
30 |
class QProcess; |
class QProcess; |
31 |
|
class QMdiSubWindow; |
32 |
|
class QSocketNotifier; |
33 |
|
class QSpinBox; |
34 |
|
class QSlider; |
35 |
|
class QLabel; |
36 |
|
|
37 |
namespace QSampler { |
namespace QSampler { |
38 |
|
|
39 |
|
class Workspace; |
40 |
|
class Options; |
41 |
|
class Messages; |
42 |
|
class Channel; |
43 |
|
class ChannelStrip; |
44 |
class DeviceForm; |
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 |
|
|
|
class MainForm : public QMainWindow { |
|
|
Q_OBJECT |
|
55 |
public: |
public: |
56 |
MainForm(QWidget* parent = 0); |
|
57 |
~MainForm(); |
MainForm(QWidget *pParent = nullptr); |
58 |
void setup(qsamplerOptions* pOptions); |
~MainForm(); |
59 |
void contextMenuEvent(QContextMenuEvent *pEvent); |
|
60 |
qsamplerOptions* options(); |
void setup(Options *pOptions); |
61 |
lscp_client_t* client(); |
|
62 |
QString sessionName(const QString& sFilename); |
Options *options() const; |
63 |
void appendMessages(const QString& s); |
lscp_client_t *client() const; |
64 |
void appendMessagesColor(const QString& s, const QString& c); |
|
65 |
void appendMessagesText(const QString& s); |
QString sessionName(const QString& sFilename); |
66 |
void appendMessagesError(const QString& s); |
|
67 |
void appendMessagesClient(const QString& s); |
void appendMessages(const QString& sText); |
68 |
ChannelStrip* createChannelStrip(qsamplerChannel *pChannel); |
void appendMessagesColor(const QString& sText, const QString& sColor); |
69 |
ChannelStrip* activeChannelStrip(); |
void appendMessagesText(const QString& sText); |
70 |
ChannelStrip* channelStripAt(int iChannel); |
void appendMessagesError(const QString& sText); |
71 |
ChannelStrip* channelStrip(int iChannelID); |
void appendMessagesClient(const QString& sText); |
72 |
static MainForm* getInstance(); |
|
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: |
public slots: |
86 |
void sessionDirty(); |
|
87 |
void stabilizeForm(); |
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: |
protected slots: |
116 |
|
|
117 |
void updateRecentFilesMenu(); |
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 |
|
|
127 |
|
void handle_sigusr1(); |
128 |
|
void handle_sigterm(); |
129 |
|
|
130 |
|
// Channel strip activation/selection. |
131 |
|
void activateStrip(QMdiSubWindow *pMdiSubWindow); |
132 |
|
|
133 |
|
// Channel toolbar orientation change. |
134 |
|
void channelsToolbarOrientation(Qt::Orientation orientation); |
135 |
|
|
136 |
protected: |
protected: |
137 |
bool queryClose(); |
|
138 |
void closeEvent(QCloseEvent* pCloseEvent); |
void addChannelStrip(); |
139 |
void dragEnterEvent(QDragEnterEvent *pDragEnterEvent); |
void removeChannelStrip(); |
140 |
void dropEvent(QDropEvent *pDropEvent); |
|
141 |
void customEvent(QEvent* pCustomEvent); |
bool queryClose(); |
142 |
bool newSession(); |
void closeEvent(QCloseEvent* pCloseEvent); |
143 |
bool openSession(); |
void dragEnterEvent(QDragEnterEvent *pDragEnterEvent); |
144 |
bool saveSession(bool bPrompt); |
void dropEvent(QDropEvent *pDropEvent); |
145 |
bool closeSession(bool bForce); |
void customEvent(QEvent *pCustomEvent); |
146 |
bool loadSessionFile(const QString& sFilename); |
bool newSession(); |
147 |
bool saveSessionFile(const QString& sFilename); |
bool openSession(); |
148 |
void updateSession(); |
bool saveSession(bool bPrompt); |
149 |
void updateRecentFiles(const QString& sFilename); |
bool closeSession(bool bForce); |
150 |
void updateInstrumentNames(); |
bool loadSessionFile(const QString& sFilename); |
151 |
void updateDisplayFont(); |
bool saveSessionFile(const QString& sFilename); |
152 |
void updateDisplayEffect(); |
void updateSession(); |
153 |
void updateMaxVolume(); |
void updateRecentFiles(const QString& sFilename); |
154 |
void updateMessagesFont(); |
void updateInstrumentNames(); |
155 |
void updateMessagesLimit(); |
void updateDisplayFont(); |
156 |
void updateMessagesCapture(); |
void updateDisplayEffect(); |
157 |
void startSchedule(int iStartDelay); |
void updateMaxVolume(); |
158 |
void stopSchedule(); |
void updateMessagesFont(); |
159 |
void startServer(); |
void updateMessagesLimit(); |
160 |
void stopServer(); |
void updateMessagesCapture(); |
161 |
bool startClient(); |
void updateViewMidiDeviceStatusMenu(); |
162 |
void stopClient(); |
void updateAllChannelStrips(bool bRemoveDeadStrips); |
163 |
|
|
164 |
|
void startSchedule(int iStartDelay); |
165 |
|
void stopSchedule(); |
166 |
|
void startServer(); |
167 |
|
void stopServer(bool bInteractive = false); |
168 |
|
bool startClient(); |
169 |
|
void stopClient(); |
170 |
|
|
171 |
private: |
private: |
|
Ui::qsamplerMainForm ui; |
|
172 |
|
|
173 |
qsamplerOptions *m_pOptions; |
Ui::qsamplerMainForm m_ui; |
174 |
qsamplerMessages *m_pMessages; |
|
175 |
QWorkspace *m_pWorkspace; |
Options *m_pOptions; |
176 |
QString m_sFilename; |
Messages *m_pMessages; |
177 |
int m_iUntitled; |
Workspace *m_pWorkspace; |
178 |
int m_iDirtyCount; |
QSocketNotifier *m_pSigusr1Notifier; |
179 |
lscp_client_t *m_pClient; |
QSocketNotifier *m_pSigtermNotifier; |
180 |
QProcess *m_pServer; |
QString m_sFilename; |
181 |
int m_iStartDelay; |
int m_iUntitled; |
182 |
int m_iTimerDelay; |
int m_iDirtySetup; |
183 |
int m_iTimerSlot; |
int m_iDirtyCount; |
184 |
QLabel *m_statusItem[5]; |
lscp_client_t *m_pClient; |
185 |
QList<ChannelStrip *> m_changedStrips; |
QProcess *m_pServer; |
186 |
InstrumentListForm *m_pInstrumentListForm; |
bool m_bForceServerStop; |
187 |
DeviceForm *m_pDeviceForm; |
int m_iStartDelay; |
188 |
static MainForm *g_pMainForm; |
int m_iTimerDelay; |
189 |
QSlider *m_pVolumeSlider; |
int m_iTimerSlot; |
190 |
QSpinBox *m_pVolumeSpinBox; |
QLabel *m_statusItem[5]; |
191 |
int m_iVolumeChanging; |
QList<ChannelStrip *> m_changedStrips; |
192 |
|
InstrumentListForm *m_pInstrumentListForm; |
193 |
private slots: |
DeviceForm *m_pDeviceForm; |
194 |
void fileNew(); |
static MainForm *g_pMainForm; |
195 |
void fileOpen(); |
QSlider *m_pVolumeSlider; |
196 |
void fileOpenRecent(); |
QSpinBox *m_pVolumeSpinBox; |
197 |
void fileSave(); |
int m_iVolumeChanging; |
|
void fileSaveAs(); |
|
|
void fileReset(); |
|
|
void fileRestart(); |
|
|
void fileExit(); |
|
|
void editAddChannel(); |
|
|
void editRemoveChannel(); |
|
|
void editSetupChannel(); |
|
|
void editEditChannel(); |
|
|
void editResetChannel(); |
|
|
void editResetAllChannels(); |
|
|
void viewMenubar(bool bOn); |
|
|
void viewToolbar(bool bOn); |
|
|
void viewStatusbar(bool bOn); |
|
|
void viewMessages(bool bOn); |
|
|
void viewInstruments(); |
|
|
void viewDevices(); |
|
|
void viewOptions(); |
|
|
void channelsArrange(); |
|
|
void channelsAutoArrange(bool bOn); |
|
|
void helpAboutQt(); |
|
|
void helpAbout(); |
|
|
void volumeChanged(int iVolume); |
|
|
void channelStripChanged(ChannelStrip *pChannelStrip); |
|
|
void channelsMenuAboutToShow(); |
|
|
void channelsMenuActivated(); |
|
|
void timerSlot(); |
|
|
void readServerStdout(); |
|
|
void processServerExit(); |
|
198 |
}; |
}; |
199 |
|
|
200 |
} // namespace QSampler |
} // namespace QSampler |