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
mainwindow.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright 2015 Haye Hinrichsen, Christoph Wick
3  *
4  * This file is part of Entropy Piano Tuner.
5  *
6  * Entropy Piano Tuner is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * Entropy Piano Tuner is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * Entropy Piano Tuner. If not, see http://www.gnu.org/licenses/.
18  *****************************************************************************/
19 
20 #ifndef MAINWINDOW_H
21 #define MAINWINDOW_H
22 
23 #include <QMainWindow>
24 #include <QUrl>
25 #include <QToolButton>
26 #include <memory>
27 #include "../core/system/prerequisites.h"
28 #include "../core/config.h"
29 #include "../core/core.h"
30 #include "../core/messages/messagelistener.h"
31 #include "../core/adapters/modeselectoradapter.h"
32 #include "projectmanagerforqt.h"
34 #include "signalanalyzergroupbox.h"
35 #include "volumecontrolgroupbox.h"
37 #include "versioncheck.h"
38 
40 
41 namespace Ui {
42 class MainWindow;
43 }
44 
49 class MainWindow : public QMainWindow,
50  public MessageListener,
51  public ModeSelectorAdapter,
52  public FileChangesCallback
53 {
54  Q_OBJECT
55 
56 public:
62  explicit MainWindow(QWidget *parent = nullptr);
63 
69  virtual ~MainWindow();
70 
76  void init(Core *core);
77 
83  void start();
84 
90  Core *getCore() {return mCore;}
91 
92 protected:
99  void closeEvent ( QCloseEvent * event ) override;
100 
106  void handleMessage(MessagePtr m) override;
107 
113  void changesInFileUpdated(bool b) override final;
114 
115 private:
121  void updateNoteName(int key);
122 
128  void updateFrequency(const Key *key);
129 
136  void updateWindowTitle();
137 
142  void updateVolumeBar();
143 private:
146  const QString mIconPostfix;
147 
150 
152  Ui::MainWindow *ui;
153 
156 
159 
162 
165 
167 
168  QToolBar *mFileToolBar;
169 
172 
173 signals:
174  void modeChanged(OperationMode mode);
175 
176 public slots:
183  void onOpenSoundControl();
185 
190  void onResetNoiseLevel();
191 
197  void onToggleMicroMute(bool checked);
198 
204  void onToggleSpeakerMute(bool checked);
205 
210  void onFileNew();
211 
216  void onFileSave();
217 
222  void onFileSaveAs();
223 
228  void onFileOpen();
229 
234  void onFileShare();
235 
240  void onEditPianoDataSheet();
241 
246  void onResetRecording();
247 
252  void onOptions();
253 
255  void onOpenPlots();
256 
261  void onTutorial();
262 
267  void onManual();
268 
273  void onAbout();
274 
279  void onViewLog();
280 
285  void onModeIdle(bool);
286 
291  void onModeRecord(bool);
292 
297  void onModeCalculate(bool);
298 
303  void onModeTune(bool);
304 
309  void onSelectNextMode();
310 
315  void onSelectPreviousMode();
316 
321  void onToggleFullscreen();
322 
328 
330  void onExport();
331 
332 
333 private slots:
334  void onVersionUpdate(VersionInformation information);
335 };
336 
337 #endif // MAINWINDOW_H
std::shared_ptr< Message > MessagePtr
Global type of a shared message pointer.
Definition: message.h:98
void changesInFileUpdated(bool b) overridefinal
Called if changed in file are made to update the window title.
Definition: mainwindow.cpp:497
void updateVolumeBar()
This will update the positions of the labels in the volume bar.
Definition: mainwindow.cpp:525
void updateWindowTitle()
Update the window title.
Definition: mainwindow.cpp:521
QToolBar * mFileToolBar
Definition: mainwindow.h:168
void onOptions()
Slot to open the options.
Definition: mainwindow.cpp:617
OperationMode
Operation mode of the tuner.
Definition: prerequisites.h:66
Core * getCore()
Getter function for the core.
Definition: mainwindow.h:90
void updateFrequency(const Key *key)
Update the frequency label.
Definition: mainwindow.cpp:509
void onOpenPlots()
Slot to open the mathematical plots dialog.
Definition: mainwindow.cpp:622
void onOpenSoundControl()
Slot to open the sound control.
Definition: mainwindow.cpp:529
void onFileSaveAs()
Slot to save the current file as a new file.
Definition: mainwindow.cpp:593
void onResetRecording()
Slot to reset the recording.
Definition: mainwindow.cpp:611
virtual ~MainWindow()
Destructor.
Definition: mainwindow.cpp:299
void onSelectNextMode()
Slot to select the next mode.
Definition: mainwindow.cpp:726
void onManual()
Slot to open the manual.
Definition: mainwindow.cpp:687
The ModeSelectorAdapter class.
Class describing a single piano key.
Definition: key.h:45
void onViewLog()
Slot to open the log viewer.
Definition: mainwindow.cpp:697
CalculationProgressGroup * mCalculationProgressGroup
Pointer to the CalculationProgressGroup.
Definition: mainwindow.h:155
void onModeTune(bool)
Slot to switch to tuning mode.
Definition: mainwindow.cpp:720
void onAbout()
Slot to open the about dialog.
Definition: mainwindow.cpp:691
void updateNoteName(int key)
Update the note name.
Definition: mainwindow.cpp:501
void onFileSave()
Slot to save the current file.
Definition: mainwindow.cpp:589
QToolButton * mModeToolButtons[OperationMode::MODE_COUNT]
Tool buttons for all modes.
Definition: mainwindow.h:171
The count of modes.
Definition: prerequisites.h:73
void onExport()
Slot to open the export dialog.
Definition: mainwindow.cpp:752
void onSelectPreviousMode()
Slot to select the previous mode.
Definition: mainwindow.cpp:731
Visible QGroupBox to handle the calculation.
void start()
Starts the main window.
Definition: mainwindow.cpp:324
Ui::MainWindow * ui
Ui of the Mainwindow.
Definition: mainwindow.h:152
The ProjectManagerChangesInFileUpdatedCallback class.
Core * mCore
Pointer to the Core.
Definition: mainwindow.h:149
void onTutorial()
Definition: mainwindow.cpp:627
MainWindow(QWidget *parent=nullptr)
Constructor.
Definition: mainwindow.cpp:66
void modeChanged(OperationMode mode)
KeyboardGraphicsView * mKeyboardGraphicsView
Definition: mainwindow.h:166
void onToggleFullscreen()
Slot to toggle full screen of the MainWindow.
Definition: mainwindow.cpp:736
const QString mIconPostfix
Definition: mainwindow.h:146
void onFileShare()
Slot to store the current file.
Definition: mainwindow.cpp:601
void onModeCalculate(bool)
Slot to switch to calculation mode.
Definition: mainwindow.cpp:714
CORE : Class managing the core.
Definition: core.h:45
void onFileOpen()
Slot to open a new file.
Definition: mainwindow.cpp:597
void onToggleSpeakerMute(bool checked)
Toggle the mute button.
Definition: mainwindow.cpp:581
bool isSoundControlSupported()
Definition: mainwindow.cpp:559
VolumeControlGroupBox * mVolumeControlGroup
Pointer to the VolumeControlGroupBox.
Definition: mainwindow.h:164
void onToggleTuningIndictator()
Slot to toggle between the two tuning indicator modes.
Definition: mainwindow.cpp:745
void onVersionUpdate(VersionInformation information)
Definition: mainwindow.cpp:756
Viewer for the keyboard.
void onToggleMicroMute(bool checked)
Toggle the mute button.
Definition: mainwindow.cpp:577
void onModeIdle(bool)
Slot to switch to idle mode.
Definition: mainwindow.cpp:702
SignalAnalyzerGroupBox * mSignalAnalyzerGroup
Pointer to the SignalAnalyzerGroupBox.
Definition: mainwindow.h:158
void init(Core *core)
Initialised the window using the given Core.
Definition: mainwindow.cpp:304
void onFileNew()
Slot called for creating a new file.
Definition: mainwindow.cpp:585
void onEditPianoDataSheet()
Slot to edit the current piano data sheet.
Definition: mainwindow.cpp:607
void onModeRecord(bool)
Slot to switch to recording mode.
Definition: mainwindow.cpp:708
The main window.
Definition: mainwindow.h:49
TuningIndicatorGroupBox * mTuningIndicatorGroup
Pointer to the TuningIndicatorGroupBox.
Definition: mainwindow.h:161
void handleMessage(MessagePtr m) override
Message handling.
Definition: mainwindow.cpp:358
void onResetNoiseLevel()
Slot to reset the noise level.
Definition: mainwindow.cpp:573
void closeEvent(QCloseEvent *event) override
Reimplementation of the close event.
Definition: mainwindow.cpp:337