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
recordingstatusgraphicsview.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 RECORDINGSTATUSGRAPHICSVIEW_H
21 #define RECORDINGSTATUSGRAPHICSVIEW_H
22 
23 #include <QGraphicsView>
24 #include <QGraphicsScene>
25 #include <QGraphicsEllipseItem>
26 #include <QGraphicsRectItem>
27 #include <QTimer>
28 #include "../core/messages/messagelistener.h"
29 
37 class RecordingStatusGraphicsView : public QGraphicsView, protected MessageListener
38 {
39  Q_OBJECT
40 
42  static const QRectF SCENE_RECT;
43 
44 public:
50  RecordingStatusGraphicsView(QWidget *parent);
51 
57 
58  virtual QSize minimumSizeHint() const override final {return QSize(20, 20);}
59 
60 protected:
61  virtual QSize sizeHint() const override final;
66  void showEvent(QShowEvent *event) override;
67 
73  void resizeEvent(QResizeEvent *event) override;
74 
82  void handleMessage(MessagePtr m) override final;
83 private:
84 
91  void setItemVisible(const std::vector<QGraphicsItem*> &items, bool visible);
92 
93 private slots:
98  void onProcess();
99 
100 private:
102  QGraphicsScene mScene;
103 
105  std::vector<QGraphicsItem* > mRecordItems;
106 
108  std::vector<QGraphicsItem* > mPauseItems;
109 
111  std::vector<QGraphicsItem* > mProgressItems;
112 
115 };
116 
117 #endif // RECORDINGSTATUSGRAPHICSVIEW_H
RecordingStatusGraphicsView(QWidget *parent)
Default constructor.
std::shared_ptr< Message > MessagePtr
Global type of a shared message pointer.
Definition: message.h:98
virtual ~RecordingStatusGraphicsView()
Emptry virtual destructor.
void handleMessage(MessagePtr m) overridefinal
Message handling.
virtual QSize minimumSizeHint() const overridefinal
static const QRectF SCENE_RECT
The scene rect of the QGraphicsScene.
QGraphicsScene mScene
The graphics scene.
void onProcess()
Called by the timer to rotate the blue circle.
std::vector< QGraphicsItem * > mPauseItems
Items that are used to draw the pause state.
QTimer mProgressTimer
Timer to shoot a onProgress() at a fixed time intervall.
The QGraphicsView that will display the current recording status.
void showEvent(QShowEvent *event) override
Reimplemented show event that will fit the SCENE_RECT into the view.
void setItemVisible(const std::vector< QGraphicsItem * > &items, bool visible)
Function to show or hide a group of items.
void resizeEvent(QResizeEvent *event) override
Reimplemented resize event that will fit the SCENE_RECT into the view.
std::vector< QGraphicsItem * > mRecordItems
Items that are used to draw the recording state.
std::vector< QGraphicsItem * > mProgressItems
Items that are used to draw the analysing state.
virtual QSize sizeHint() const overridefinal