-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeasure.h
67 lines (53 loc) · 1.5 KB
/
measure.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
#include <QWidget>
#include <QString>
#include <QJsonObject>
#include <QDebug>
#include "imeasure.h"
namespace Ui {
class Measure;
}
class Measure : public QWidget, public IMeasure
{
Q_OBJECT
Q_INTERFACES(IMeasure)
public:
explicit Measure(QWidget *parent = nullptr);
explicit Measure(QJsonObject jsonObject, QWidget *parent = nullptr);
~Measure();
// Getters
int getBpm();
int getRepetitions();
int getTimeSignature();
int getNumerator();
int getNumeratorIndex();
int getDenominator();
int getDenominatorIndex();
QString getTitle();
// Setters
void setBpm(int bpm);
void setRepetitions(int repetitions);
void setTimeSignatureIndex(int numeratorIndex, int denominatorIndex);
void setTitle(QString title);
// JSON
QJsonObject getJsonObject();
void loadFromJson(QJsonObject jsonObject);
signals:
void notifyMoveUp(IMeasure *measure);
void notifyMoveDown(IMeasure *measure);
void notifyDelete(IMeasure *measure);
private slots:
void on_btn_moveUp_clicked();
void on_btn_moveDown_clicked();
void on_btn_delete_clicked();
private:
Ui::Measure *ui;
// Time signatures
const int DEFAULT_TIME_SIGNATURE = 4;
// JSON keys
const char* JSON_KEY_TITLE = "measure_title";
const char* JSON_KEY_BPM = "beats_per_minute";
const char* JSON_KEY_REPEATS = "number_of_repeats";
const char* JSON_KEY_NUMERATOR = "numerator";
const char* JSON_KEY_DENOMINATOR = "denominator";
};