Entropy Piano Tuner  1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ProjectManagerForQt Class Reference

Implementation of the ProjectManagerAdapter in Qt. More...

#include <projectmanagerforqt.h>

+ Inheritance diagram for ProjectManagerForQt:
+ Collaboration diagram for ProjectManagerForQt:

Public Member Functions

 ProjectManagerForQt (MainWindow *mainwindow)
 Default constructor. More...
 
virtual ~ProjectManagerForQt ()
 Empty virtual destructor. More...
 
virtual Results editFile () overridefinal
 Opens the EditPianoSheetDialog to edit the piano data sheet. More...
 
virtual Results askForSaving () overridefinal
 Displays a standard message box if the user wants to save the changes made. More...
 
virtual FileDialogResult getSavePath (int fileType) overridefinal
 Opens a QFileDialog to get a path to save the file to. More...
 
virtual FileDialogResult getOpenPath (int fileType) overridefinal
 Opens a QFileDialog to get a path to open a file. More...
 
virtual Results share () overridefinal
 Handle the share button. More...
 
virtual void showOpenError () overridefinal
 Shows an error message if an error during open occured. More...
 
virtual void showSaveError () overridefinal
 Shows an error message if an error during saving occured. More...
 
- Public Member Functions inherited from ProjectManagerAdapter
 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)
 
- Public Member Functions inherited from MessageListener
 MessageListener (bool defaultActivation=true)
 
virtual ~MessageListener ()
 
bool isMessageListenerActive () const
 
void activateMessageListener ()
 
void deactivateMessageListener ()
 

Protected Member Functions

virtual void fillNew (Piano &piano) overridefinal
 Fills the given Piano with default values and texts. More...
 
QString getCurrentPath () const
 Function to get the current path for the file dialog. More...
 
void setCurrentPath (QString path)
 Function to set the current path for the file dialog. More...
 
QString getFileFilters (int fileTypes, bool addAll) const
 
- Protected Member Functions inherited from ProjectManagerAdapter
virtual void handleMessage (MessagePtr m) override
 message listener callback More...
 
void setChangesInFile (bool b)
 change the state of mChangesInFile and notify the listener More...
 

Private Attributes

MainWindowmMainWindow
 The main window. More...
 

Additional Inherited Members

- Public Types inherited from ProjectManagerAdapter
enum  Results { R_CANCELED, R_YES, R_NO, R_ACCEPTED }
 Enumeration of the possible outcomes of a typical mouse button. More...
 
- Protected Attributes inherited from ProjectManagerAdapter
CoremCore
 the core More...
 
PianoFile mPianoFile
 the piano file More...
 

Detailed Description

Implementation of the ProjectManagerAdapter in Qt.

The class will use a QFileDialog to open and close files. It will open the EditPianoSheetDialog to edit the piano data sheet.

Definition at line 35 of file projectmanagerforqt.h.

Constructor & Destructor Documentation

ProjectManagerForQt::ProjectManagerForQt ( MainWindow mainwindow)

Default constructor.

Parameters
mainwindow: Pointer to the MainWindow

Definition at line 39 of file projectmanagerforqt.cpp.

ProjectManagerForQt::~ProjectManagerForQt ( )
virtual

Empty virtual destructor.

Definition at line 45 of file projectmanagerforqt.cpp.

Member Function Documentation

ProjectManagerForQt::Results ProjectManagerForQt::askForSaving ( )
finaloverridevirtual

Displays a standard message box if the user wants to save the changes made.

Returns
Decision of the user

Implements ProjectManagerAdapter.

Definition at line 62 of file projectmanagerforqt.cpp.

ProjectManagerForQt::Results ProjectManagerForQt::editFile ( )
finaloverridevirtual

Opens the EditPianoSheetDialog to edit the piano data sheet.

Returns
Returns whether the user accepted the changes he made.

Implements ProjectManagerAdapter.

Definition at line 51 of file projectmanagerforqt.cpp.

+ Here is the call graph for this function:

void ProjectManagerForQt::fillNew ( Piano piano)
finaloverrideprotectedvirtual

Fills the given Piano with default values and texts.

Parameters
piano: The piano where to store the data to

Implements ProjectManagerAdapter.

Definition at line 146 of file projectmanagerforqt.cpp.

+ Here is the call graph for this function:

QString ProjectManagerForQt::getCurrentPath ( ) const
protected

Function to get the current path for the file dialog.

Returns
The last used path or QStandardPaths::DocumentsLocation

Definition at line 167 of file projectmanagerforqt.cpp.

QString ProjectManagerForQt::getFileFilters ( int  fileTypes,
bool  addAll 
) const
protected

Definition at line 178 of file projectmanagerforqt.cpp.

ProjectManagerForQt::FileDialogResult ProjectManagerForQt::getOpenPath ( int  fileType)
finaloverridevirtual

Opens a QFileDialog to get a path to open a file.

Returns
Absolute file path or an empty string if the user cancelled

Implements ProjectManagerAdapter.

Definition at line 104 of file projectmanagerforqt.cpp.

+ Here is the call graph for this function:

ProjectManagerForQt::FileDialogResult ProjectManagerForQt::getSavePath ( int  fileType)
finaloverridevirtual

Opens a QFileDialog to get a path to save the file to.

Returns
Absolute file path or an empty string if the user cancelled

Implements ProjectManagerAdapter.

Definition at line 79 of file projectmanagerforqt.cpp.

+ Here is the call graph for this function:

void ProjectManagerForQt::setCurrentPath ( QString  path)
protected

Function to set the current path for the file dialog.

Parameters
pathThe absolute file path

Definition at line 172 of file projectmanagerforqt.cpp.

ProjectManagerForQt::Results ProjectManagerForQt::share ( )
finaloverridevirtual

Handle the share button.

Returns
Decision of the user.

It will call a native java method on android for sharing.

Implements ProjectManagerAdapter.

Definition at line 124 of file projectmanagerforqt.cpp.

+ Here is the call graph for this function:

void ProjectManagerForQt::showOpenError ( )
finaloverridevirtual

Shows an error message if an error during open occured.

Implements ProjectManagerAdapter.

Definition at line 159 of file projectmanagerforqt.cpp.

void ProjectManagerForQt::showSaveError ( )
finaloverridevirtual

Shows an error message if an error during saving occured.

Implements ProjectManagerAdapter.

Definition at line 163 of file projectmanagerforqt.cpp.

Member Data Documentation

MainWindow* ProjectManagerForQt::mMainWindow
private

The main window.

Definition at line 125 of file projectmanagerforqt.h.


The documentation for this class was generated from the following files: