hydrogen 1.2.3
MainForm.h
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 * Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5 *
6 * http://www.hydrogen-music.org
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see https://www.gnu.org/licenses
20 *
21 */
22
23#ifndef MAINFORM_H
24#define MAINFORM_H
25
26#include <QtGui>
27#include <QtWidgets>
28
29#include <map>
30#include <unistd.h>
31
32#include "EventListener.h"
34
35#include <core/config.h>
36#include <core/Object.h>
38
39class HydrogenApp;
40class QUndoView;
41
45
46class MainForm : public QMainWindow, protected WidgetWithScalableFont<8, 10, 12>, public EventListener, public H2Core::Object<MainForm>
47{
49 Q_OBJECT
50
51 public:
52 QApplication* m_pQApp;
53
54 MainForm( QApplication * pQApplication, QString sSongFilename );
55 ~MainForm();
56
57 virtual void errorEvent( int nErrorCode ) override;
58 virtual void jacksessionEvent( int nValue) override;
59 virtual void playlistLoadSongEvent(int nIndex) override;
60 virtual void updateSongEvent( int nValue ) override;
61 virtual void quitEvent( int ) override;
62
79 virtual void updatePreferencesEvent( int nValue ) override;
80 virtual void undoRedoActionEvent( int nEvent ) override;
81 static void usr1SignalHandler(int unused);
82
83public slots:
85 void showUserManual();
86
99 void action_file_new();
100
114 void action_file_open();
123 void action_file_save( const QString& sNewFilename );
124 void action_file_save();
125
137 void action_file_save_as();
139 void action_file_export_pattern_as( int nPatternRow = -1 );
140 bool action_file_exit();
141
142 void action_file_export();
146
147 void action_help_about();
148 void action_report_bug();
149 void action_donate();
150
159
160 void functionDeleteInstrument( int nInstrument );
161
163 void action_banks_open();
164
175
177 void update_instrument_checkbox( bool show );
182
187
188
194
195
196 void closeEvent( QCloseEvent* ev ) override;
197
199 void onRestartAccelEvent();
200 void onBPMPlusAccelEvent();
202
203 void action_file_open_recent( QAction *pAction );
204 void showDevelWarning();
205 void onLashPollTimer();
206
207 void openUndoStack();
208 void action_undo();
209 void action_redo();
210
213
214 void handleSigUsr1();
217 void closeAll();
222 void savePreferences();
223 void checkMidiSetup();
224 void checkMissingSamples();
225
226 // Interface for screen grabs
227 void setMainWindowSize( int w, int h ) {
228 setFixedSize( w, h );
229 }
231
232
233 private slots:
234 void onAutoSaveTimer();
236 void onFixMidiSetup();
237 void onFixMissingSamples();
238
239 protected:
240 // Returns true if handled, false if aborted.
242
243 private:
244 void editDrumkitProperties( bool bDrumkitNameLocked );
246
248
249 static int sigusr1Fd[2];
250 QSocketNotifier *snUsr1;
251
264
271
272 QUndoView * m_pUndoView;
273
274 void startAutosaveTimer();
276
278 void createMenuBar();
279
281
282 bool eventFilter( QObject *o, QEvent *e ) override;
283
284 std::map<int,int> keycodeInstrumentMap;
285 void initKeyInstMap();
286
287 QString getAutoSaveFilename();
288 #ifdef H2CORE_HAVE_LASH
289 QTimer *lashPollTimer;
290 #endif
291
294
296
309 void startPlaybackAtCursor( QObject* pObject );
310
319
320 void openSongWithDialog( const QString& sWindowTitle, const QString& sPath, bool bIsDemo );
321 bool prepareSongOpening();
322
327};
328
329#endif
#define H2_OBJECT(name)
Definition Object.h:224
Changes
Bitwise or-able options showing which part of the Preferences were altered using the PreferencesDialo...
debug only
Definition MainForm.h:47
void startPlaybackAtCursor(QObject *pObject)
Relocates to current position of the cursor and starts playback if the transport isn't rolling yet.
QMenu * m_pDrumkitsMenu
Definition MainForm.h:313
void onBPMMinusAccelEvent()
void action_file_save_as()
Project > Save As / Export from Session handling function.
Definition MainForm.cpp:664
QAction * m_pRecentFileAction4
Definition MainForm.h:270
void update_instrument_checkbox(bool show)
virtual void errorEvent(int nErrorCode) override
bool handleSelectNextPrevSongOnPlaylist(int step)
void handleSigUsr1()
void action_window_showTimeline()
void action_debug_logLevel_warn()
void action_file_export_lilypond()
void showUserManual()
Definition MainForm.cpp:885
void action_debug_logLevel_debug()
void showDevelWarning()
void action_window_showPatternEditor()
QAction * m_pViewTimelineAction
Definition MainForm.h:259
QMenu * m_pInputModeMenu
Definition MainForm.h:253
void action_file_export_pattern_as(int nPatternRow=-1)
Definition MainForm.cpp:920
void closeAll()
Wrapper around savePreferences() and quit() method of m_pQApp.
void action_debug_logLevel_error()
bool eventFilter(QObject *o, QEvent *e) override
QAction * m_pRecentFileAction0
Definition MainForm.h:266
void savePreferences()
Stores the current state of the GUI (position, width, height, and visibility of the widgets) in the H...
void onFixMissingSamples()
QMenu * m_pRecentFilesMenu
Definition MainForm.h:265
void action_window_showAutomationArea()
void action_debug_showFilesystemInfo()
void updateRecentUsedSongList()
void action_file_open()
Project > Open / Import into Session handling function.
Definition MainForm.cpp:983
void action_window_showSongEditor()
Shows the song editor.
QAction * m_pViewPlaybackTrackAction
Definition MainForm.h:260
std::map< int, int > keycodeInstrumentMap
Definition MainForm.h:284
QMenu * m_pUndoMenu
Definition MainForm.h:312
void action_instruments_importLibrary()
void action_file_open_recent(QAction *pAction)
void action_banks_properties()
void onRestartAccelEvent()
void action_report_bug()
Definition MainForm.cpp:879
void checkMissingSamples()
void action_debug_printObjects()
print the object map
void action_window_showPlaylistDialog()
void action_file_save()
Definition MainForm.cpp:796
HydrogenApp * h2app
Definition MainForm.h:247
QString getAutoSaveFilename()
void action_inputMode_instrument()
Definition MainForm.cpp:854
void update_automation_checkbox()
QAction * m_pViewPlaylistEditorAction
Definition MainForm.h:254
void action_file_export()
QAction * m_pRecentFileAction1
Definition MainForm.h:267
void action_instruments_addInstrument()
void createMenuBar()
Create the menubar.
Definition MainForm.cpp:268
QMenu * m_pInfoMenu
Definition MainForm.h:318
void onFixMidiSetup()
virtual void updatePreferencesEvent(int nValue) override
Handles the loading and saving of the H2Core::Preferences from the core part of H2Core::Hydrogen.
MainForm(QApplication *pQApplication, QString sSongFilename)
Definition MainForm.cpp:90
void update_mixer_checkbox()
virtual void quitEvent(int) override
void onPlayStopAccelEvent()
bool action_file_exit()
return true if the app needs to be closed.
Definition MainForm.cpp:593
void action_file_new()
Project > New handling function.
Definition MainForm.cpp:605
void onPreferencesChanged(H2Core::Preferences::Changes changes)
void closeEvent(QCloseEvent *ev) override
Window close event.
void action_help_about()
Definition MainForm.cpp:874
virtual void updateSongEvent(int nValue) override
void action_debug_logLevel_none()
void onLashPollTimer()
Definition MainForm.cpp:497
QAction * m_pDrumkitAction
Definition MainForm.h:263
virtual void undoRedoActionEvent(int nEvent) override
void action_donate()
Definition MainForm.cpp:578
void action_instruments_exportLibrary()
bool prepareSongOpening()
QSocketNotifier * snUsr1
Definition MainForm.h:250
QApplication * m_pQApp
Definition MainForm.h:52
static int sigusr1Fd[2]
Definition MainForm.h:249
virtual void jacksessionEvent(int nValue) override
QAction * m_pInstrumentAction
Definition MainForm.h:262
void action_instruments_onlineImportLibrary()
void startAutosaveTimer()
debug only
Definition MainForm.cpp:481
void update_playback_track_group()
void openSongWithDialog(const QString &sWindowTitle, const QString &sPath, bool bIsDemo)
void action_undo()
QMenu * m_pInstrumentsMenu
Definition MainForm.h:314
void action_instruments_saveAsLibrary()
QAction * m_pRecentFileAction3
Definition MainForm.h:269
void update_director_checkbox()
void checkMidiSetup()
QAction * m_pViewMixerAction
Definition MainForm.h:256
void functionDeleteInstrument(int nInstrument)
QMenu * m_pDebugMenu
Definition MainForm.h:317
void action_instruments_clearAll()
void openUndoStack()
void action_window_showMixer()
QMenu * m_pViewMenu
Definition MainForm.h:315
QMenu * m_pOptionsMenu
Definition MainForm.h:316
QUndoView * m_pUndoView
Definition MainForm.h:272
void action_instruments_saveLibrary()
void setMainWindowSize(int w, int h)
Definition MainForm.h:227
void onAutoSaveTimer()
InfoBar * m_pMidiSetupInfoBar
Definition MainForm.h:292
QString m_sPreviousAutoSaveFilename
Since the filename of the current song does change whenever the users uses "Save As" multiple autosav...
Definition MainForm.h:326
void update_playlist_checkbox()
void onPlaylistDisplayTimer()
QMenu * m_pLogLevelMenu
Definition MainForm.h:252
void action_banks_open()
void action_window_showInstrumentRack()
void action_instruments_addComponent()
void action_inputMode_drumkit()
Definition MainForm.cpp:864
QAction * m_pViewDirectorAction
Definition MainForm.h:255
void checkNecessaryDirectories()
void action_file_openDemo()
QAction * m_pViewAutomationPathAction
Definition MainForm.h:258
void showPreferencesDialog()
void editDrumkitProperties(bool bDrumkitNameLocked)
InfoBar * m_pMissingSamplesInfoBar
Definition MainForm.h:293
bool handleUnsavedChanges()
void action_window_toggleFullscreen()
void action_debug_openLogfile()
void action_file_export_midi()
void action_file_openPattern()
void action_redo()
QAction * m_pViewMixerInstrumentRackAction
Definition MainForm.h:257
void action_debug_showAudioEngineInfo()
void action_window_showPlaybackTrack()
void action_window_show_DirectorWidget()
virtual void playlistLoadSongEvent(int nIndex) override
void onBPMPlusAccelEvent()
QAction * m_pRecentFileAction2
Definition MainForm.h:268
static void usr1SignalHandler(int unused)
void action_file_songProperties()
QActionGroup * m_pViewPlaybackTrackActionGroup
Definition MainForm.h:261
void initKeyInstMap()
QMenu * m_pFileMenu
Definition MainForm.h:311
QTimer m_AutosaveTimer
Definition MainForm.h:275
void action_debug_logLevel_info()
Widget is affected by the "Font size" settings in the PreferencesDialog.