Entropy Piano Tuner
1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
|
Project manager adapter class. More...
#include <projectmanageradapter.h>
Classes | |
struct | FileDialogResult |
Public Types | |
enum | Results { R_CANCELED, R_YES, R_NO, R_ACCEPTED } |
Enumeration of the possible outcomes of a typical mouse button. More... | |
Public Member Functions | |
ProjectManagerAdapter () | |
Constructor. More... | |
virtual | ~ProjectManagerAdapter () |
Empty destructor. More... | |
void | init (Core *core) |
Initialize the project management adapter. More... | |
void | setCallback (FileChangesCallback *cb) |
Set a callback function for file changes. More... | |
bool | hasChangesInFile () const |
const std::string & | getCurrentFilePath () const |
Results | onNewFile () |
New-file menu response. More... | |
Results | onSaveFile () |
Results | onSaveFileAs () |
Results | onOpenFile () |
bool | onQuit () |
Results | onEditFile () |
Results | onShare () |
Results | onExport () |
Results | saveFile (const std::string &path, piano::FileType type) |
Results | openFile (const std::string &path, bool cached=false) |
Protected Member Functions | |
virtual Results | editFile ()=0 |
edit a project file More... | |
virtual Results | askForSaving ()=0 |
asks the user whether to save the current project file More... | |
virtual FileDialogResult | getSavePath (int fileType)=0 |
get a path were to save the file More... | |
virtual FileDialogResult | getOpenPath (int fileType)=0 |
get a path to a file to open More... | |
virtual Results | share ()=0 |
shares the current file with the actual device More... | |
virtual void | fillNew (Piano &piano)=0 |
function to fill the piano data with the current new settings More... | |
virtual void | showOpenError ()=0 |
Show a message box that an error occurred during the open process. More... | |
virtual void | showSaveError ()=0 |
Show a message box that an error occurred during the save process. More... | |
virtual void | handleMessage (MessagePtr m) override |
message listener callback More... | |
void | setChangesInFile (bool b) |
change the state of mChangesInFile and notify the listener More... | |
Protected Attributes | |
Core * | mCore |
the core More... | |
PianoFile | mPianoFile |
the piano file More... | |
Private Member Functions | |
Results | checkForNoChanges () |
Private Attributes | |
bool | mChangesInFile |
stores whether there are unsaved changes in the current file More... | |
FileChangesCallback * | mCallback = nullptr |
callback if mChangesInFileChanged More... | |
std::string | mCurrentFilePath |
current file path More... | |
Project manager adapter class.
This class provides the interface between the core and the GUI for project management, i.e. loading and saving ept files, and keeping track of possible changes.
Definition at line 55 of file projectmanageradapter.h.
Enumeration of the possible outcomes of a typical mouse button.
Enumerator | |
---|---|
R_CANCELED | |
R_YES | |
R_NO | |
R_ACCEPTED |
Definition at line 59 of file projectmanageradapter.h.
ProjectManagerAdapter::ProjectManagerAdapter | ( | ) |
Constructor.
Definition at line 48 of file projectmanageradapter.cpp.
|
inlinevirtual |
Empty destructor.
Definition at line 80 of file projectmanageradapter.h.
|
protectedpure virtual |
asks the user whether to save the current project file
Implemented in ProjectManagerForQt.
|
private |
|
protectedpure virtual |
|
protectedpure virtual |
function to fill the piano data with the current new settings
Implemented in ProjectManagerForQt.
|
inline |
Definition at line 87 of file projectmanageradapter.h.
|
protectedpure virtual |
|
protectedpure virtual |
|
overrideprotectedvirtual |
message listener callback
Implements MessageListener.
Definition at line 287 of file projectmanageradapter.cpp.
|
inline |
Definition at line 85 of file projectmanageradapter.h.
void ProjectManagerAdapter::init | ( | Core * | core | ) |
Initialize the project management adapter.
core | : Pointer to the core instance. |
Definition at line 64 of file projectmanageradapter.cpp.
ProjectManagerAdapter::Results ProjectManagerAdapter::onEditFile | ( | ) |
ProjectManagerAdapter::Results ProjectManagerAdapter::onExport | ( | ) |
ProjectManagerAdapter::Results ProjectManagerAdapter::onNewFile | ( | ) |
New-file menu response.
Definition at line 109 of file projectmanageradapter.cpp.
ProjectManagerAdapter::Results ProjectManagerAdapter::onOpenFile | ( | ) |
bool ProjectManagerAdapter::onQuit | ( | ) |
ProjectManagerAdapter::Results ProjectManagerAdapter::onSaveFile | ( | ) |
ProjectManagerAdapter::Results ProjectManagerAdapter::onSaveFileAs | ( | ) |
ProjectManagerAdapter::Results ProjectManagerAdapter::onShare | ( | ) |
ProjectManagerAdapter::Results ProjectManagerAdapter::openFile | ( | const std::string & | path, |
bool | cached = false |
||
) |
ProjectManagerAdapter::Results ProjectManagerAdapter::saveFile | ( | const std::string & | path, |
piano::FileType | type | ||
) |
void ProjectManagerAdapter::setCallback | ( | FileChangesCallback * | cb | ) |
Set a callback function for file changes.
Like most applications, the entropy piano tuner goes into a state of 'having unsaved changes' as soon as a data element of the current project has been changed. Usually this is indicated in the GUI, e.g. by a little star after the file name in the title bar of the window. In order to inform the GUI about changes, we have to define a suitable callback function.
cb | : Pointer to the callback function |
Definition at line 91 of file projectmanageradapter.cpp.
|
protected |
change the state of mChangesInFile and notify the listener
Definition at line 300 of file projectmanageradapter.cpp.
|
protectedpure virtual |
shares the current file with the actual device
Implemented in ProjectManagerForQt.
|
protectedpure virtual |
Show a message box that an error occurred during the open process.
Implemented in ProjectManagerForQt.
|
protectedpure virtual |
Show a message box that an error occurred during the save process.
Implemented in ProjectManagerForQt.
|
private |
callback if mChangesInFileChanged
Definition at line 157 of file projectmanageradapter.h.
|
private |
stores whether there are unsaved changes in the current file
Definition at line 154 of file projectmanageradapter.h.
|
protected |
the core
Definition at line 147 of file projectmanageradapter.h.
|
private |
current file path
Definition at line 160 of file projectmanageradapter.h.
|
protected |
the piano file
Definition at line 150 of file projectmanageradapter.h.