Entropy Piano Tuner
1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
|
The main application singleton class. More...
#include <tunerapplication.h>
Public Slots | |
bool | openFile (QString filePath, bool cached) |
Open the given file. More... | |
Public Member Functions | |
TunerApplication (int &argc, char **argv) | |
Constructor for the application. More... | |
virtual | ~TunerApplication () |
Destructor of the application. More... | |
void | init () |
Function to initialise the application. More... | |
void | exit () |
Function called upon exitting the application. More... | |
void | start () |
Function to start the MainWindow and the Core. More... | |
void | stop () |
Function to stop the MainWindow and the Core. More... | |
void | playStartupSound () |
Function to play the startup sound. More... | |
Core * | getCore () |
Getter function for the core. More... | |
Static Public Member Functions | |
static TunerApplication & | getSingleton () |
Getter for the singleton instance. More... | |
static TunerApplication * | getSingletonPtr () |
Getter for the singleton instance. More... | |
static void | setApplicationExitState (int errorcode=EXIT_SUCCESS) |
This is sets the exit code if the app would be terminated now. More... | |
Static Public Attributes | |
static TunerApplication * | mSingleton |
The one and only instance. More... | |
Protected Member Functions | |
bool | event (QEvent *e) |
Handling of general events. More... | |
void | timerEvent (QTimerEvent *event) |
Called when the internal timer was shot. More... | |
bool | notify (QObject *receiver, QEvent *event) |
Reimplemented to catch exceptions. More... | |
Private Slots | |
void | onApplicationStateChanged (Qt::ApplicationState state) |
Depending on the application state the core will be started or stopped. More... | |
void | onAboutToQuit () |
Private Member Functions | |
void | initCore () |
Initialising of the core. More... | |
void | exitCore () |
Exit from the core. More... | |
void | startCore () |
Start the core. More... | |
void | stopCore () |
Stop the core. More... | |
Private Attributes | |
int | mLastExitCode |
last exit code to detect if the application crashed More... | |
int | mMessageHandlerTimerId |
Id of the timer that progresses the MessageHandler. More... | |
QString | mStartupFile |
Absolute path to the startup file or an empty string. More... | |
std::shared_ptr< Core > | mCore |
Shared pointer of the Core. More... | |
std::shared_ptr< MainWindow > | mMainWindow |
Shared pointer of the MainWindow. More... | |
AudioRecorderForQt | mAudioRecorder |
Instance of the Qt audio recorder. More... | |
AudioPlayerForQt | mAudioPlayer |
Instance of the Qt audio player. More... | |
The main application singleton class.
This class handles the initialisation of the MainWindow and the Core. It also stores the instances of the platform dependent audio player and recorder. Moreover this class will progress the messages in MessageHandler.
Definition at line 37 of file tunerapplication.h.
|
explicit |
Constructor for the application.
argc | : Number of arguments |
argv | : Array of the arguments |
The constructor will create the MainWindow and the Core without initializing them. It will also call the platform dependent function to disable the screen saver.
Definition at line 43 of file tunerapplication.cpp.
|
virtual |
Destructor of the application.
The destructor makes sure that all components are exitted and enables the screen saver.
Definition at line 69 of file tunerapplication.cpp.
|
protected |
Handling of general events.
e | : The QEvent |
On MacOS X this function will listen to QEvent::FileOpen to open a startup file.
Definition at line 217 of file tunerapplication.cpp.
void TunerApplication::exit | ( | ) |
Function called upon exitting the application.
This will stop and exit the core.
Definition at line 139 of file tunerapplication.cpp.
|
private |
Exit from the core.
Definition at line 267 of file tunerapplication.cpp.
|
inline |
Getter function for the core.
Definition at line 125 of file tunerapplication.h.
|
static |
Getter for the singleton instance.
Definition at line 79 of file tunerapplication.cpp.
|
static |
Getter for the singleton instance.
Definition at line 84 of file tunerapplication.cpp.
void TunerApplication::init | ( | ) |
Function to initialise the application.
This will initialize the MainWindow and show it. Secondly the Core will be initialized.
Definition at line 94 of file tunerapplication.cpp.
|
private |
Initialising of the core.
Definition at line 252 of file tunerapplication.cpp.
|
protected |
Reimplemented to catch exceptions.
receiver | : The receiving QObject. |
event | : The QEvent |
Definition at line 232 of file tunerapplication.cpp.
|
privateslot |
|
privateslot |
Depending on the application state the core will be started or stopped.
state | : The Qt::ApplicationState |
When minimized the core will stop. On mobile devices the core will already stop if the application is in inavtive state.
Definition at line 296 of file tunerapplication.cpp.
|
slot |
Open the given file.
filePath | : The absolute file path |
cached | : Is the file stored in cache |
Definition at line 207 of file tunerapplication.cpp.
void TunerApplication::playStartupSound | ( | ) |
Function to play the startup sound.
Definition at line 172 of file tunerapplication.cpp.
|
static |
This is sets the exit code if the app would be terminated now.
If it is expected that the app may exit in the future, usually at the end of the program all this with EXIT_SUCCESS. If it is not expected that the app exits call this using EXIT_FAILURE This is used to detect whether the app crashed
Definition at line 88 of file tunerapplication.cpp.
void TunerApplication::start | ( | ) |
Function to start the MainWindow and the Core.
Definition at line 146 of file tunerapplication.cpp.
|
private |
Start the core.
Definition at line 274 of file tunerapplication.cpp.
void TunerApplication::stop | ( | ) |
Function to stop the MainWindow and the Core.
Definition at line 167 of file tunerapplication.cpp.
|
private |
Stop the core.
Definition at line 284 of file tunerapplication.cpp.
|
protected |
Called when the internal timer was shot.
event | : The QTimerEvent |
This function will progress the messages in MessageHandler.
Definition at line 227 of file tunerapplication.cpp.
|
private |
Instance of the Qt audio player.
Definition at line 223 of file tunerapplication.h.
|
private |
Instance of the Qt audio recorder.
Definition at line 220 of file tunerapplication.h.
|
private |
Shared pointer of the Core.
Definition at line 214 of file tunerapplication.h.
|
private |
last exit code to detect if the application crashed
Definition at line 205 of file tunerapplication.h.
|
private |
Shared pointer of the MainWindow.
Definition at line 217 of file tunerapplication.h.
|
private |
Id of the timer that progresses the MessageHandler.
Definition at line 208 of file tunerapplication.h.
|
static |
The one and only instance.
Definition at line 42 of file tunerapplication.h.
|
private |
Absolute path to the startup file or an empty string.
Definition at line 211 of file tunerapplication.h.