hydrogen 1.2.6
HydrogenApp Class Reference

#include <HydrogenApp.h>

Inheritance diagram for HydrogenApp:
EventListener Object< HydrogenApp > Base

Public Types

enum  SetPropertyFlag {
  SetX = 1 << 0 , SetY = 1 << 1 , SetWidth = 1 << 2 , SetHeight = 1 << 3 ,
  SetVisible = 1 << 4 , SetAll = SetX + SetY + SetWidth + SetHeight + SetVisible , SetDefault = SetAll
}
 

Public Slots

void changePreferences (H2Core::Preferences::Changes changes)
 Propagates a change in the Preferences through the GUI.
 
void currentTabChanged (int)
 
void onEventQueueTimer ()
 Function called every QUEUE_TIMER_PERIOD millisecond to pop all Events from the EventQueue and invoke the corresponding functions.
 
void onPreferencesChanged (H2Core::Preferences::Changes changes)
 

Signals

void preferencesChanged (H2Core::Preferences::Changes changes)
 Propagates a change in the Preferences through the GUI.
 

Public Member Functions

 HydrogenApp (MainForm *pMainForm)
 
virtual ~HydrogenApp ()
 
void addEventListener (EventListener *pListener)
 
InfoBaraddInfoBar ()
 
void cleanupTemporaryFiles ()
 Removes temporary files that were created for undo'ing things.
 
void closeFXProperties ()
 
AudioEngineInfoFormgetAudioEngineInfoForm ()
 
std::shared_ptr< CommonStringsgetCommonStrings ()
 
DirectorgetDirector ()
 
InstrumentRackgetInstrumentRack ()
 
MainFormgetMainForm ()
 
MixergetMixer ()
 
PatternEditorPanelgetPatternEditorPanel ()
 
PlayerControlgetPlayerControl ()
 
PlaylistDialoggetPlayListDialog ()
 
SampleEditorgetSampleEditor ()
 
SongEditorPanelgetSongEditorPanel ()
 
H2Core::WindowProperties getWindowProperties (QWidget *pWindow)
 
bool hideKeyboardCursor ()
 
void removeEventListener (EventListener *pListener)
 
void setHideKeyboardCursor (bool bHidden)
 
void setWindowProperties (QWidget *pWindow, H2Core::WindowProperties &prop, unsigned flags=SetAll)
 
void showAudioEngineInfoForm ()
 
void showDirector ()
 
void showFilesystemInfoForm ()
 
void showInstrumentPanel (bool)
 
void showMixer (bool bShow)
 
void showPlaylistDialog ()
 
void showPreferencesDialog ()
 
void showSampleEditor (QString name, int mSelectedComponemt, int mSelectedLayer)
 
void showStatusBarMessage (const QString &sMessage, const QString &sCaller="")
 
void updateMixerCheckbox ()
 
void updateWindowTitle ()
 
- Public Member Functions inherited from EventListener
virtual ~EventListener ()
 
virtual void actionModeChangeEvent (int nValue)
 
virtual void bbtChangedEvent ()
 
virtual void driverChangedEvent ()
 
virtual void errorEvent (int nErrorCode)
 
virtual void gridCellToggledEvent ()
 
virtual void instrumentParametersChangedEvent (int nInstrumentNumber)
 
virtual void jacksessionEvent (int nValue)
 
virtual void jackTimebaseStateChangedEvent (int nValue)
 
virtual void jackTransportActivationEvent ()
 
virtual void loopModeActivationEvent ()
 
virtual void metronomeEvent (int nValue)
 
virtual void midiActivityEvent ()
 
virtual void midiMapChangedEvent ()
 
virtual void nextPatternsChangedEvent ()
 
virtual void nextShotEvent ()
 
virtual void noteOnEvent (int nInstrument)
 
virtual void patternEditorLockedEvent ()
 
virtual void patternModifiedEvent ()
 
virtual void playbackTrackChangedEvent ()
 
virtual void playingPatternsChangedEvent ()
 
virtual void playlistLoadSongEvent (int nIndex)
 
virtual void progressEvent (int nValue)
 
virtual void quitEvent (int nValue)
 
virtual void relocationEvent ()
 
virtual void selectedInstrumentChangedEvent ()
 
virtual void selectedPatternChangedEvent ()
 
virtual void songModeActivationEvent ()
 
virtual void songSizeChangedEvent ()
 
virtual void soundLibraryChangedEvent ()
 
virtual void stackedModeActivationEvent (int nValue)
 
virtual void stateChangedEvent (H2Core::AudioEngine::State state)
 
virtual void tempoChangedEvent (int nValue)
 
virtual void timelineActivationEvent ()
 
virtual void timelineUpdateEvent (int nValue)
 
virtual void undoRedoActionEvent (int nValue)
 
- Public Member Functions inherited from Object< HydrogenApp >
 Object ()
 
 Object (const Object< HydrogenApp > &other)
 
- Public Member Functions inherited from Base
 Base ()
 
 Base (const Base &other)
 
virtual const char * class_name () const
 
void logBacktrace () const
 Print the current stack at point into the debug log.
 
void Print (bool bShort=true) const
 Prints content of toQString() via DEBUGLOG.
 
virtual QString toQString (const QString &sPrefix="", bool bShort=true) const
 Formatted string version for debugging purposes.
 

Static Public Member Functions

static bool checkDrumkitLicense (std::shared_ptr< H2Core::Drumkit > pDrumkit)
 
static HydrogenAppget_instance ()
 Returns the instance of HydrogenApp class.
 
static bool openSong (QString sFilename)
 
static bool openSong (std::shared_ptr< H2Core::Song > pSong)
 
static bool recoverEmptySong ()
 Specialized version of openSong( QString sFilename ) trying to open the autosave file corresponding to current empty song.
 
- Static Public Member Functions inherited from Base
static const char * _class_name ()
 return the class name
 
static QString base_clock (const QString &sMsg)
 Measures the current time and stores it in __last_clock.
 
static QString base_clock_in (const QString &sMsg)
 
static int bootstrap (Logger *logger, bool count=false)
 must be called before any Object instantiation !
 
static bool count_active ()
 
static int getAliveObjectCount ()
 
static object_map_t getObjectMap ()
 
static Loggerlogger ()
 return the logger instance
 
static int objects_count ()
 
static void printObjectMapDiff (object_map_t map)
 Creates the difference between a snapshot of the object map and its current state and prints it to std::cout.
 
static void set_count (bool flag)
 enable/disable class instances counting
 
static void write_objects_map_to (std::ostream &out, object_map_t *map=nullptr)
 output the full objects map to a given ostream
 
static void write_objects_map_to_cerr ()
 output objects map to stderr
 

Data Fields

QUndoStack * m_pUndoStack
 

Private Slots

void propagatePreferences ()
 

Private Member Functions

virtual void drumkitLoadedEvent () override
 
void engineError (uint nErrorCode)
 
void setupSinglePanedInterface ()
 
virtual void songModifiedEvent () override
 
void updateEventListeners ()
 
virtual void updatePreferencesEvent (int nValue) override
 Handles the loading and saving of the H2Core::Preferences from the core part of H2Core::Hydrogen.
 
virtual void updateSongEvent (int nValue) override
 Refreshes and updates the GUI after the Song was changed in the core part of Hydrogen.
 
virtual void XRunEvent () override
 

Private Attributes

bool m_bHideKeyboardCursor
 
H2Core::Preferences::Changes m_bufferedChanges
 
std::vector< EventListener * > m_eventListeners
 
std::set< EventListener * > m_eventListenersToAdd
 
std::set< EventListener * > m_eventListenersToRemove
 
int m_nPreferencesUpdateTimeout
 
AudioEngineInfoFormm_pAudioEngineInfoForm
 
std::shared_ptr< CommonStringsm_pCommonStrings
 
Directorm_pDirector
 
QTimer * m_pEventQueueTimer
 
FilesystemInfoFormm_pFilesystemInfoForm
 
InstrumentRackm_pInstrumentRack
 
MainFormm_pMainForm
 
QScrollArea * m_pMainScrollArea
 Used for accessibility reasons to show scroll bars in case Hydrogen has to be shrunk below its minimum size - magnified using the Qt scale factor so its efficitive size is below the minimum one.
 
QVBoxLayout * m_pMainVBox
 
Mixerm_pMixer
 
PatternEditorPanelm_pPatternEditorPanel
 
PlayerControlm_pPlayerControl
 
PlaylistDialogm_pPlaylistDialog
 
QTimer * m_pPreferencesUpdateTimer
 
SampleEditorm_pSampleEditor
 
SongEditorPanelm_pSongEditorPanel
 
QSplitter * m_pSplitter
 
QTabWidget * m_pTab
 

Static Private Attributes

static HydrogenAppm_pInstance = nullptr
 HydrogenApp instance.
 

Additional Inherited Members

- Static Public Attributes inherited from Base
static QString sPrintIndention = " "
 String used to format the debugging string output of some core classes.
 
- Protected Member Functions inherited from Object< HydrogenApp >
 ~Object ()
 
- Protected Member Functions inherited from Base
 ~Base ()
 
- Static Protected Member Functions inherited from Base
static void registerClass (const char *name, const atomic_obj_cpt_t *counters)
 
- Static Protected Attributes inherited from Base
static bool __count = false
 should we count class instances
 
static timeval __last_clock = { 0, 0 }
 
static Logger__logger = nullptr
 
static bool bLogColors = true
 

Detailed Description

Definition at line 76 of file HydrogenApp.h.

Member Enumeration Documentation

◆ SetPropertyFlag

Enumerator
SetX 
SetY 
SetWidth 
SetHeight 
SetVisible 
SetAll 
SetDefault 

Definition at line 145 of file HydrogenApp.h.

Constructor & Destructor Documentation

◆ HydrogenApp()

HydrogenApp ( MainForm * pMainForm)

Definition at line 71 of file HydrogenApp.cpp.

◆ ~HydrogenApp()

~HydrogenApp ( )
virtual

Definition at line 200 of file HydrogenApp.cpp.

Member Function Documentation

◆ addEventListener()

void addEventListener ( EventListener * pListener)

Definition at line 981 of file HydrogenApp.cpp.

◆ addInfoBar()

InfoBar * addInfoBar ( )

Definition at line 375 of file HydrogenApp.cpp.

◆ changePreferences

void changePreferences ( H2Core::Preferences::Changes changes)
slot

Propagates a change in the Preferences through the GUI.

Triggered by the PreferencesDialog upon a change of the underlying options in the Preferences class.

Definition at line 1164 of file HydrogenApp.cpp.

◆ checkDrumkitLicense()

bool checkDrumkitLicense ( std::shared_ptr< H2Core::Drumkit > pDrumkit)
static

Definition at line 1182 of file HydrogenApp.cpp.

◆ cleanupTemporaryFiles()

void cleanupTemporaryFiles ( )

Removes temporary files that were created for undo'ing things.

Definition at line 1044 of file HydrogenApp.cpp.

◆ closeFXProperties()

void closeFXProperties ( )

Definition at line 388 of file HydrogenApp.cpp.

◆ currentTabChanged

void currentTabChanged ( int index)
slot

Definition at line 383 of file HydrogenApp.cpp.

◆ drumkitLoadedEvent()

void drumkitLoadedEvent ( )
overrideprivatevirtual

Reimplemented from EventListener.

Definition at line 717 of file HydrogenApp.cpp.

◆ engineError()

void engineError ( uint nErrorCode)
private

◆ get_instance()

HydrogenApp * get_instance ( )
inlinestatic

Returns the instance of HydrogenApp class.

Return an HydrogenApp m_pInstance.

Definition at line 275 of file HydrogenApp.h.

◆ getAudioEngineInfoForm()

AudioEngineInfoForm * getAudioEngineInfoForm ( )
inline

Definition at line 294 of file HydrogenApp.h.

◆ getCommonStrings()

std::shared_ptr< CommonStrings > getCommonStrings ( )
inline

Definition at line 329 of file HydrogenApp.h.

◆ getDirector()

Director * getDirector ( )
inline

Definition at line 304 of file HydrogenApp.h.

◆ getInstrumentRack()

InstrumentRack * getInstrumentRack ( )
inline

Definition at line 324 of file HydrogenApp.h.

◆ getMainForm()

MainForm * getMainForm ( )
inline

Definition at line 284 of file HydrogenApp.h.

◆ getMixer()

Mixer * getMixer ( )
inline

Definition at line 279 of file HydrogenApp.h.

◆ getPatternEditorPanel()

PatternEditorPanel * getPatternEditorPanel ( )
inline

Definition at line 314 of file HydrogenApp.h.

◆ getPlayerControl()

PlayerControl * getPlayerControl ( )
inline

Definition at line 319 of file HydrogenApp.h.

◆ getPlayListDialog()

PlaylistDialog * getPlayListDialog ( )
inline

Definition at line 299 of file HydrogenApp.h.

◆ getSampleEditor()

SampleEditor * getSampleEditor ( )
inline

Definition at line 309 of file HydrogenApp.h.

◆ getSongEditorPanel()

SongEditorPanel * getSongEditorPanel ( )
inline

Definition at line 289 of file HydrogenApp.h.

◆ getWindowProperties()

WindowProperties getWindowProperties ( QWidget * pWindow)

Definition at line 187 of file HydrogenApp.cpp.

◆ hideKeyboardCursor()

bool hideKeyboardCursor ( )
inline

Definition at line 334 of file HydrogenApp.h.

◆ onEventQueueTimer

void onEventQueueTimer ( )
slot

Function called every QUEUE_TIMER_PERIOD millisecond to pop all Events from the EventQueue and invoke the corresponding functions.

In addition, all MIDI notes in H2Core::EventQueue::m_addMidiNoteVector will converted into actions via SE_addNoteAction() and deleted from the former array.

Definition at line 728 of file HydrogenApp.cpp.

◆ onPreferencesChanged

void onPreferencesChanged ( H2Core::Preferences::Changes changes)
slot

Definition at line 1304 of file HydrogenApp.cpp.

◆ openSong() [1/2]

bool openSong ( QString sFilename)
static
Parameters
sFilenameAbsolute or relative path used to load the next H2Core::Song.
Returns
bool true on success

Definition at line 397 of file HydrogenApp.cpp.

◆ openSong() [2/2]

bool openSong ( std::shared_ptr< H2Core::Song > pSong)
static

Definition at line 467 of file HydrogenApp.cpp.

◆ preferencesChanged

void preferencesChanged ( H2Core::Preferences::Changes changes)
signal

Propagates a change in the Preferences through the GUI.

Triggered by the PreferencesDialog upon a change of the underlying options in the Preferences class.

Parameters
changesOr-able options indicating which part of the Preferences did change.

◆ propagatePreferences

void propagatePreferences ( )
privateslot

Definition at line 1177 of file HydrogenApp.cpp.

◆ recoverEmptySong()

bool recoverEmptySong ( )
static

Specialized version of openSong( QString sFilename ) trying to open the autosave file corresponding to current empty song.

This will be used if the last set in Hydrogen was an empty one. If the user either decided to discard the changes or Hydrogen was terminated untimely, this function allows to restore all changes that would have been lost otherwise.

Definition at line 484 of file HydrogenApp.cpp.

◆ removeEventListener()

void removeEventListener ( EventListener * pListener)

Definition at line 1001 of file HydrogenApp.cpp.

◆ setHideKeyboardCursor()

void setHideKeyboardCursor ( bool bHidden)
inline

Definition at line 339 of file HydrogenApp.h.

◆ setupSinglePanedInterface()

void setupSinglePanedInterface ( )
private

Definition at line 241 of file HydrogenApp.cpp.

◆ setWindowProperties()

void setWindowProperties ( QWidget * pWindow,
H2Core::WindowProperties & prop,
unsigned flags = SetAll )

Definition at line 138 of file HydrogenApp.cpp.

◆ showAudioEngineInfoForm()

void showAudioEngineInfoForm ( )

Definition at line 667 of file HydrogenApp.cpp.

◆ showDirector()

void showDirector ( )

Definition at line 690 of file HydrogenApp.cpp.

◆ showFilesystemInfoForm()

void showFilesystemInfoForm ( )

Definition at line 673 of file HydrogenApp.cpp.

◆ showInstrumentPanel()

void showInstrumentPanel ( bool show)

Definition at line 572 of file HydrogenApp.cpp.

◆ showMixer()

void showMixer ( bool bShow)

Definition at line 554 of file HydrogenApp.cpp.

◆ showPlaylistDialog()

void showPlaylistDialog ( )

Definition at line 679 of file HydrogenApp.cpp.

◆ showPreferencesDialog()

void showPreferencesDialog ( )

Definition at line 592 of file HydrogenApp.cpp.

◆ showSampleEditor()

void showSampleEditor ( QString name,
int mSelectedComponemt,
int mSelectedLayer )

Definition at line 701 of file HydrogenApp.cpp.

◆ showStatusBarMessage()

void showStatusBarMessage ( const QString & sMessage,
const QString & sCaller = "" )

Definition at line 601 of file HydrogenApp.cpp.

◆ songModifiedEvent()

void songModifiedEvent ( )
overrideprivatevirtual

Reimplemented from EventListener.

Definition at line 723 of file HydrogenApp.cpp.

◆ updateEventListeners()

void updateEventListeners ( )
private

Definition at line 1020 of file HydrogenApp.cpp.

◆ updateMixerCheckbox()

void updateMixerCheckbox ( )

◆ updatePreferencesEvent()

void updatePreferencesEvent ( int nValue)
overrideprivatevirtual

Handles the loading and saving of the H2Core::Preferences from the core part of H2Core::Hydrogen.

If nValue is 0 - the H2Core::Preferences got saved - it triggers the display of a message in the status bar. If, on the other hand, nValue is 1 and the configuration file has been reloaded, it gets a fresh version of H2Core::Preferences and updates all widgets and setting to reflect the changes in the configuration.

Parameters
nValueIf 0, Preferences was save. If 1, it was loaded.

Reimplemented from EventListener.

Definition at line 1049 of file HydrogenApp.cpp.

◆ updateSongEvent()

void updateSongEvent ( int nValue)
overrideprivatevirtual

Refreshes and updates the GUI after the Song was changed in the core part of Hydrogen.

When using session management or changing the Song using an OSC message, this command will get core and GUI in sync again.

Parameters
nValueIf 0, update the GUI to represent the new song. If 1, a message in the status bar will be displayed notifying the user about the saving of the current Song. If 2, notifies the user that the current song is opened in read-only mode.

Reimplemented from EventListener.

Definition at line 1130 of file HydrogenApp.cpp.

◆ updateWindowTitle()

void updateWindowTitle ( )

Definition at line 617 of file HydrogenApp.cpp.

◆ XRunEvent()

void XRunEvent ( )
overrideprivatevirtual

Reimplemented from EventListener.

Definition at line 608 of file HydrogenApp.cpp.

Field Documentation

◆ m_bHideKeyboardCursor

bool m_bHideKeyboardCursor
private

Definition at line 228 of file HydrogenApp.h.

◆ m_bufferedChanges

H2Core::Preferences::Changes m_bufferedChanges
private

Definition at line 231 of file HydrogenApp.h.

◆ m_eventListeners

std::vector<EventListener*> m_eventListeners
private

Definition at line 220 of file HydrogenApp.h.

◆ m_eventListenersToAdd

std::set<EventListener*> m_eventListenersToAdd
private

Definition at line 221 of file HydrogenApp.h.

◆ m_eventListenersToRemove

std::set<EventListener*> m_eventListenersToRemove
private

Definition at line 222 of file HydrogenApp.h.

◆ m_nPreferencesUpdateTimeout

int m_nPreferencesUpdateTimeout
private

Definition at line 230 of file HydrogenApp.h.

◆ m_pAudioEngineInfoForm

AudioEngineInfoForm* m_pAudioEngineInfoForm
private

Definition at line 211 of file HydrogenApp.h.

◆ m_pCommonStrings

std::shared_ptr<CommonStrings> m_pCommonStrings
private

Definition at line 226 of file HydrogenApp.h.

◆ m_pDirector

Director* m_pDirector
private

Definition at line 218 of file HydrogenApp.h.

◆ m_pEventQueueTimer

QTimer* m_pEventQueueTimer
private

Definition at line 219 of file HydrogenApp.h.

◆ m_pFilesystemInfoForm

FilesystemInfoForm* m_pFilesystemInfoForm
private

Definition at line 212 of file HydrogenApp.h.

◆ m_pInstance

HydrogenApp * m_pInstance = nullptr
staticprivate

HydrogenApp instance.

Definition at line 198 of file HydrogenApp.h.

◆ m_pInstrumentRack

InstrumentRack* m_pInstrumentRack
private

Definition at line 214 of file HydrogenApp.h.

◆ m_pMainForm

MainForm* m_pMainForm
private

Definition at line 208 of file HydrogenApp.h.

◆ m_pMainScrollArea

QScrollArea* m_pMainScrollArea
private

Used for accessibility reasons to show scroll bars in case Hydrogen has to be shrunk below its minimum size - magnified using the Qt scale factor so its efficitive size is below the minimum one.

Definition at line 207 of file HydrogenApp.h.

◆ m_pMainVBox

QVBoxLayout* m_pMainVBox
private

Definition at line 225 of file HydrogenApp.h.

◆ m_pMixer

Mixer* m_pMixer
private

Definition at line 209 of file HydrogenApp.h.

◆ m_pPatternEditorPanel

PatternEditorPanel* m_pPatternEditorPanel
private

Definition at line 210 of file HydrogenApp.h.

◆ m_pPlayerControl

PlayerControl* m_pPlayerControl
private

Definition at line 215 of file HydrogenApp.h.

◆ m_pPlaylistDialog

PlaylistDialog* m_pPlaylistDialog
private

Definition at line 216 of file HydrogenApp.h.

◆ m_pPreferencesUpdateTimer

QTimer* m_pPreferencesUpdateTimer
private

Definition at line 229 of file HydrogenApp.h.

◆ m_pSampleEditor

SampleEditor* m_pSampleEditor
private

Definition at line 217 of file HydrogenApp.h.

◆ m_pSongEditorPanel

SongEditorPanel* m_pSongEditorPanel
private

Definition at line 213 of file HydrogenApp.h.

◆ m_pSplitter

QSplitter* m_pSplitter
private

Definition at line 224 of file HydrogenApp.h.

◆ m_pTab

QTabWidget* m_pTab
private

Definition at line 223 of file HydrogenApp.h.

◆ m_pUndoStack

QUndoStack* m_pUndoStack

Definition at line 131 of file HydrogenApp.h.