-rw-r--r-- | noncore/multimedia/tonleiter/editinst.cpp | 14 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/editinst.h | 23 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/editscale.cpp | 14 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/editscale.h | 23 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/fretboard.cpp | 20 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/fretboard.h | 80 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/mainwidget.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/mainwidget.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/menuwidget.cpp | 23 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/menuwidget.h | 37 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiter.pro | 4 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiterdata.cpp | 67 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiterdata.h | 73 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiterdatahelper.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiterdatahelper.h | 86 |
15 files changed, 284 insertions, 194 deletions
diff --git a/noncore/multimedia/tonleiter/editinst.cpp b/noncore/multimedia/tonleiter/editinst.cpp new file mode 100644 index 0000000..1eba4dc --- a/dev/null +++ b/noncore/multimedia/tonleiter/editinst.cpp | |||
@@ -0,0 +1,14 @@ | |||
1 | #include "editinst.h" | ||
2 | |||
3 | Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name) | ||
4 | :QDialog(parent,name,true,0),data(data) | ||
5 | { | ||
6 | setCaption("Tonleiter::"+tr("Instrument")); | ||
7 | showMaximized(); | ||
8 | } | ||
9 | //**************************************************************************** | ||
10 | Menu::InstEditDialog::~InstEditDialog() | ||
11 | { | ||
12 | } | ||
13 | //**************************************************************************** | ||
14 | //**************************************************************************** | ||
diff --git a/noncore/multimedia/tonleiter/editinst.h b/noncore/multimedia/tonleiter/editinst.h new file mode 100644 index 0000000..e7eba15 --- a/dev/null +++ b/noncore/multimedia/tonleiter/editinst.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef TONLEITER_EDIT_INSTRUMENT_DIALOG_H | ||
2 | #define TONLEITER_EDIT_INSTRUMENT_DIALOG_H | ||
3 | |||
4 | #include <qdialog.h> | ||
5 | |||
6 | #include "tonleiterdata.h" | ||
7 | |||
8 | using namespace Data; | ||
9 | |||
10 | namespace Menu | ||
11 | { | ||
12 | class InstEditDialog : public QDialog | ||
13 | { | ||
14 | Q_OBJECT | ||
15 | private: | ||
16 | TonleiterData* data; | ||
17 | public: | ||
18 | InstEditDialog(TonleiterData* data,QWidget* parent,const char* name="InstEditDialog"); | ||
19 | ~InstEditDialog(); | ||
20 | }; | ||
21 | }; | ||
22 | |||
23 | #endif //TONLEITER_EDIT_INSTRUMENT_DIALOG_H | ||
diff --git a/noncore/multimedia/tonleiter/editscale.cpp b/noncore/multimedia/tonleiter/editscale.cpp new file mode 100644 index 0000000..593a150 --- a/dev/null +++ b/noncore/multimedia/tonleiter/editscale.cpp | |||
@@ -0,0 +1,14 @@ | |||
1 | #include "editscale.h" | ||
2 | |||
3 | Menu::ScaleEditDialog::ScaleEditDialog(TonleiterData* data,QWidget* parent,const char* name) | ||
4 | :QDialog(parent,name,true,0),data(data) | ||
5 | { | ||
6 | setCaption("Tonleiter::"+tr("Scale")); | ||
7 | showMaximized(); | ||
8 | } | ||
9 | //**************************************************************************** | ||
10 | Menu::ScaleEditDialog::~ScaleEditDialog() | ||
11 | { | ||
12 | } | ||
13 | //**************************************************************************** | ||
14 | //**************************************************************************** | ||
diff --git a/noncore/multimedia/tonleiter/editscale.h b/noncore/multimedia/tonleiter/editscale.h new file mode 100644 index 0000000..0e5eb1c --- a/dev/null +++ b/noncore/multimedia/tonleiter/editscale.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef TONLEITER_EDIT_SCALE_DIALOG_H | ||
2 | #define TONLEITER_EDIT_SCALE_DIALOG_H | ||
3 | |||
4 | #include <qdialog.h> | ||
5 | |||
6 | #include "tonleiterdata.h" | ||
7 | |||
8 | using namespace Data; | ||
9 | |||
10 | namespace Menu | ||
11 | { | ||
12 | class ScaleEditDialog : public QDialog | ||
13 | { | ||
14 | Q_OBJECT | ||
15 | private: | ||
16 | TonleiterData* data; | ||
17 | public: | ||
18 | ScaleEditDialog(TonleiterData* data,QWidget* parent,const char* name="ScaleEditDialog"); | ||
19 | ~ScaleEditDialog(); | ||
20 | }; | ||
21 | }; | ||
22 | |||
23 | #endif //TONLEITER_EDIT_SCALE_DIALOG_H | ||
diff --git a/noncore/multimedia/tonleiter/fretboard.cpp b/noncore/multimedia/tonleiter/fretboard.cpp index 57806be..7936c83 100644 --- a/noncore/multimedia/tonleiter/fretboard.cpp +++ b/noncore/multimedia/tonleiter/fretboard.cpp | |||
@@ -4,3 +4,3 @@ | |||
4 | 4 | ||
5 | FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags f) | 5 | Graph::FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags f) |
6 | :QWidget(parent,name,f),data(data) | 6 | :QWidget(parent,name,f),data(data) |
@@ -14,3 +14,3 @@ FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags | |||
14 | //**************************************************************************** | 14 | //**************************************************************************** |
15 | FretBoard::~FretBoard() | 15 | Graph::FretBoard::~FretBoard() |
16 | { | 16 | { |
@@ -18,3 +18,3 @@ FretBoard::~FretBoard() | |||
18 | //**************************************************************************** | 18 | //**************************************************************************** |
19 | void FretBoard::dataChange() | 19 | void Graph::FretBoard::dataChange() |
20 | { | 20 | { |
@@ -23,3 +23,3 @@ void FretBoard::dataChange() | |||
23 | //**************************************************************************** | 23 | //**************************************************************************** |
24 | void FretBoard::paintEvent(QPaintEvent* pe) | 24 | void Graph::FretBoard::paintEvent(QPaintEvent* pe) |
25 | { | 25 | { |
@@ -50,3 +50,3 @@ void FretBoard::paintEvent(QPaintEvent* pe) | |||
50 | //**************************************************************************** | 50 | //**************************************************************************** |
51 | void FretBoard::resizeEvent(QResizeEvent* re) | 51 | void Graph::FretBoard::resizeEvent(QResizeEvent* re) |
52 | { | 52 | { |
@@ -55,3 +55,3 @@ void FretBoard::resizeEvent(QResizeEvent* re) | |||
55 | //**************************************************************************** | 55 | //**************************************************************************** |
56 | void FretBoard::paintBoard(QPainter* p) | 56 | void Graph::FretBoard::paintBoard(QPainter* p) |
57 | { | 57 | { |
@@ -65,5 +65,5 @@ void FretBoard::paintBoard(QPainter* p) | |||
65 | //**************************************************************************** | 65 | //**************************************************************************** |
66 | void FretBoard::paintFrets(QPainter* p) | 66 | void Graph::FretBoard::paintFrets(QPainter* p) |
67 | { | 67 | { |
68 | //draw frets | 68 | //draw frets |
69 | p->setPen(fretpen); | 69 | p->setPen(fretpen); |
@@ -101,3 +101,3 @@ void FretBoard::paintFrets(QPainter* p) | |||
101 | //**************************************************************************** | 101 | //**************************************************************************** |
102 | void FretBoard::paintStrings(QPainter* p) | 102 | void Graph::FretBoard::paintStrings(QPainter* p) |
103 | { | 103 | { |
@@ -118,3 +118,3 @@ void FretBoard::paintStrings(QPainter* p) | |||
118 | //**************************************************************************** | 118 | //**************************************************************************** |
119 | void FretBoard::paintScale(QPainter* p) | 119 | void Graph::FretBoard::paintScale(QPainter* p) |
120 | { | 120 | { |
diff --git a/noncore/multimedia/tonleiter/fretboard.h b/noncore/multimedia/tonleiter/fretboard.h index eb509b0..458c733 100644 --- a/noncore/multimedia/tonleiter/fretboard.h +++ b/noncore/multimedia/tonleiter/fretboard.h | |||
@@ -11,42 +11,44 @@ | |||
11 | 11 | ||
12 | class FretBoard : public QWidget | 12 | using namespace Data; |
13 | |||
14 | namespace Graph | ||
13 | { | 15 | { |
14 | Q_OBJECT | 16 | class FretBoard : public QWidget |
15 | private: | 17 | { |
16 | TonleiterData* data; | 18 | Q_OBJECT |
17 | 19 | private: | |
18 | QPen fretpen; | 20 | TonleiterData* data; |
19 | QBrush markerbrush; | 21 | |
20 | QPen stringpen; | 22 | QPen fretpen; |
21 | 23 | QBrush markerbrush; | |
22 | Instrument inst; | 24 | QPen stringpen; |
23 | 25 | ||
24 | int xmargin; | 26 | Instrument inst; |
25 | int xmin; | 27 | |
26 | int xmax; | 28 | int xmargin; |
27 | int xwidth; | 29 | int xmin; |
28 | 30 | int xmax; | |
29 | int ymargin; | 31 | int xwidth; |
30 | int ymin; | 32 | |
31 | int ymax; | 33 | int ymargin; |
32 | int yheight; | 34 | int ymin; |
33 | 35 | int ymax; | |
34 | double fretdist; | 36 | int yheight; |
35 | double stringdist; | 37 | |
36 | 38 | double fretdist; | |
37 | public: | 39 | double stringdist; |
38 | FretBoard(TonleiterData* data,QWidget* parent,const char* name="FretBoard",WFlags f=0); | 40 | |
39 | virtual ~FretBoard(); | 41 | public: |
40 | private slots: | 42 | FretBoard(TonleiterData* data,QWidget* parent,const char* name="FretBoard",WFlags f=0); |
41 | void dataChange(); | 43 | virtual ~FretBoard(); |
42 | private: | 44 | private slots: |
43 | void paintEvent(QPaintEvent* pe); | 45 | void dataChange(); |
44 | void resizeEvent(QResizeEvent* re); | 46 | private: |
45 | //void mousePressEvent(QMouseEvent* mpe); | 47 | void paintEvent(QPaintEvent* pe); |
46 | //void mouseMoveEvent(QMouseEvent* mme); | 48 | void resizeEvent(QResizeEvent* re); |
47 | //void mouseReleaseEvent(QMouseEvent* mre); | 49 | void paintBoard(QPainter* p); |
48 | void paintBoard(QPainter* p); | 50 | void paintFrets(QPainter* p); |
49 | void paintFrets(QPainter* p); | 51 | void paintStrings(QPainter* p); |
50 | void paintStrings(QPainter* p); | 52 | void paintScale(QPainter* p); |
51 | void paintScale(QPainter* p); | 53 | }; |
52 | }; | 54 | }; |
diff --git a/noncore/multimedia/tonleiter/mainwidget.cpp b/noncore/multimedia/tonleiter/mainwidget.cpp index 0a20b9e..f09207b 100644 --- a/noncore/multimedia/tonleiter/mainwidget.cpp +++ b/noncore/multimedia/tonleiter/mainwidget.cpp | |||
@@ -9,3 +9,3 @@ MainWidget::MainWidget(QWidget* parent,const char* name,WFlags f) | |||
9 | setCaption("Tonleiter"); | 9 | setCaption("Tonleiter"); |
10 | data=new TonleiterData(this); | 10 | data=new Data::TonleiterData(this); |
11 | 11 | ||
@@ -15,6 +15,6 @@ MainWidget::MainWidget(QWidget* parent,const char* name,WFlags f) | |||
15 | 15 | ||
16 | menuwidget=new MenuWidget(data,mainwidget); | 16 | menuwidget=new Menu::MenuWidget(data,mainwidget); |
17 | mainlayout->addWidget(menuwidget); | 17 | mainlayout->addWidget(menuwidget); |
18 | 18 | ||
19 | fretboard=new FretBoard(data,mainwidget); | 19 | fretboard=new Graph::FretBoard(data,mainwidget); |
20 | mainlayout->addWidget(fretboard); | 20 | mainlayout->addWidget(fretboard); |
diff --git a/noncore/multimedia/tonleiter/mainwidget.h b/noncore/multimedia/tonleiter/mainwidget.h index 71b5ba9..9bb593c 100644 --- a/noncore/multimedia/tonleiter/mainwidget.h +++ b/noncore/multimedia/tonleiter/mainwidget.h | |||
@@ -13,5 +13,5 @@ class MainWidget : public QMainWindow | |||
13 | private: | 13 | private: |
14 | TonleiterData* data; | 14 | Data::TonleiterData* data; |
15 | MenuWidget* menuwidget; | 15 | Menu::MenuWidget* menuwidget; |
16 | FretBoard* fretboard; | 16 | Graph::FretBoard* fretboard; |
17 | public: | 17 | public: |
diff --git a/noncore/multimedia/tonleiter/menuwidget.cpp b/noncore/multimedia/tonleiter/menuwidget.cpp index 3dfa09d..1e3742c 100644 --- a/noncore/multimedia/tonleiter/menuwidget.cpp +++ b/noncore/multimedia/tonleiter/menuwidget.cpp | |||
@@ -5,3 +5,6 @@ | |||
5 | 5 | ||
6 | MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* name,WFlags f) | 6 | #include "editinst.h" |
7 | #include "editscale.h" | ||
8 | |||
9 | Menu::MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* name,WFlags f) | ||
7 | :QWidget(parent,name,f),data(data) | 10 | :QWidget(parent,name,f),data(data) |
@@ -16,2 +19,3 @@ MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* name,WFla | |||
16 | editInst=new QPushButton(tr("Edit"),this,"editInst"); | 19 | editInst=new QPushButton(tr("Edit"),this,"editInst"); |
20 | connect(editInst,SIGNAL(pressed()),this,SLOT(editInstPressed())); | ||
17 | layout->addWidget(editInst,0,2); | 21 | layout->addWidget(editInst,0,2); |
@@ -37,2 +41,3 @@ MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* name,WFla | |||
37 | editScale=new QPushButton(tr("Edit"),this,"editScale"); | 41 | editScale=new QPushButton(tr("Edit"),this,"editScale"); |
42 | connect(editScale,SIGNAL(pressed()),this,SLOT(editScalePressed())); | ||
38 | layout->addWidget(editScale,2,2); | 43 | layout->addWidget(editScale,2,2); |
@@ -43,7 +48,19 @@ MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* name,WFla | |||
43 | //**************************************************************************** | 48 | //**************************************************************************** |
44 | MenuWidget::~MenuWidget() | 49 | Menu::MenuWidget::~MenuWidget() |
50 | { | ||
51 | } | ||
52 | //**************************************************************************** | ||
53 | void Menu::MenuWidget::editInstPressed() | ||
54 | { | ||
55 | InstEditDialog* instdialog=new InstEditDialog(data,this); | ||
56 | instdialog->exec(); | ||
57 | } | ||
58 | //**************************************************************************** | ||
59 | void Menu::MenuWidget::editScalePressed() | ||
45 | { | 60 | { |
61 | ScaleEditDialog* scaledialog=new ScaleEditDialog(data,this); | ||
62 | scaledialog->exec(); | ||
46 | } | 63 | } |
47 | //**************************************************************************** | 64 | //**************************************************************************** |
48 | void MenuWidget::updateBoxes() | 65 | void Menu::MenuWidget::updateBoxes() |
49 | { | 66 | { |
diff --git a/noncore/multimedia/tonleiter/menuwidget.h b/noncore/multimedia/tonleiter/menuwidget.h index 2635f8a..044a3e6 100644 --- a/noncore/multimedia/tonleiter/menuwidget.h +++ b/noncore/multimedia/tonleiter/menuwidget.h | |||
@@ -11,18 +11,25 @@ | |||
11 | 11 | ||
12 | class MenuWidget : public QWidget | 12 | using namespace Data; |
13 | namespace Menu | ||
13 | { | 14 | { |
14 | Q_OBJECT | 15 | class MenuWidget : public QWidget |
15 | private: | 16 | { |
16 | TonleiterData* data; | 17 | Q_OBJECT |
17 | QComboBox* boxInst; | 18 | private: |
18 | QPushButton* editInst; | 19 | TonleiterData* data; |
19 | QComboBox* boxNote; | 20 | QComboBox* boxInst; |
20 | QCheckBox* noteCheck; | 21 | QPushButton* editInst; |
21 | QComboBox* boxScale; | 22 | QComboBox* boxNote; |
22 | QPushButton* editScale; | 23 | QCheckBox* noteCheck; |
23 | public: | 24 | QComboBox* boxScale; |
24 | MenuWidget(TonleiterData* data,QWidget* parent,const char* name="MenuWidget",WFlags f=0); | 25 | QPushButton* editScale; |
25 | ~MenuWidget(); | 26 | public: |
26 | public slots: | 27 | MenuWidget(TonleiterData* data,QWidget* parent,const char* name="MenuWidget",WFlags f=0); |
27 | void updateBoxes(); | 28 | ~MenuWidget(); |
29 | private slots: | ||
30 | void editInstPressed(); | ||
31 | void editScalePressed(); | ||
32 | public slots: | ||
33 | void updateBoxes(); | ||
34 | }; | ||
28 | }; | 35 | }; |
diff --git a/noncore/multimedia/tonleiter/tonleiter.pro b/noncore/multimedia/tonleiter/tonleiter.pro index bf19c3a..2b0a798 100644 --- a/noncore/multimedia/tonleiter/tonleiter.pro +++ b/noncore/multimedia/tonleiter/tonleiter.pro | |||
@@ -3,4 +3,4 @@ TEMPLATE = app | |||
3 | CONFIG = qt warn_on release | 3 | CONFIG = qt warn_on release |
4 | HEADERS = mainwidget.h tonleiterdata.h tonleiterdatahelper.h fretboard.h menuwidget.h | 4 | HEADERS = mainwidget.h tonleiterdata.h tonleiterdatahelper.h fretboard.h menuwidget.h editinst.h editscale.h |
5 | SOURCES = mainwidget.cpp tonleiterdata.cpp tonleiterdatahelper.cpp fretboard.cpp menuwidget.cpp main.cpp | 5 | SOURCES = mainwidget.cpp tonleiterdata.cpp tonleiterdatahelper.cpp fretboard.cpp menuwidget.cpp main.cpp editinst.cpp editscale.cpp |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
diff --git a/noncore/multimedia/tonleiter/tonleiterdata.cpp b/noncore/multimedia/tonleiter/tonleiterdata.cpp index e1ecb5a..946d4e3 100644 --- a/noncore/multimedia/tonleiter/tonleiterdata.cpp +++ b/noncore/multimedia/tonleiter/tonleiterdata.cpp | |||
@@ -4,2 +4,5 @@ | |||
4 | 4 | ||
5 | using namespace Data; | ||
6 | |||
7 | |||
5 | TonleiterData::TonleiterData(QObject* parent) | 8 | TonleiterData::TonleiterData(QObject* parent) |
@@ -51,46 +54,26 @@ void TonleiterData::loadData() | |||
51 | { | 54 | { |
52 | /* | 55 | Config load("Tonleiter"); |
53 | QValueList<int> strings1; | 56 | if(!load.isValid()) |
54 | strings1.append(Note::getNoteFromName("B",0)); | 57 | { |
55 | strings1.append(Note::getNoteFromName("E",1)); | 58 | //write some default values |
56 | strings1.append(Note::getNoteFromName("A",1)); | 59 | load.setGroup("General"); |
57 | strings1.append(Note::getNoteFromName("D",2)); | 60 | load.writeEntry("currentInstrumentID",1); |
58 | strings1.append(Note::getNoteFromName("G",2)); | 61 | load.writeEntry("currentNote",0); |
59 | strings1.append(Note::getNoteFromName("C",3)); | 62 | load.writeEntry("currentScaleID",1); |
60 | instruments.append(Instrument("Thumb6",26,strings1)); | 63 | load.writeEntry("drawnames",1); |
61 | 64 | load.setGroup("Instrument"); | |
62 | QValueList<int> strings2; | 65 | load.writeEntry("Inst0","Thumb6;26;11;16;21;26;31;36;"); |
63 | strings2.append(Note::getNoteFromName("E",1)); | 66 | load.writeEntry("Inst1","Bass 4;12;16;21;26;31;"); |
64 | strings2.append(Note::getNoteFromName("A",1)); | 67 | load.writeEntry("noOfInstruments",2); |
65 | strings2.append(Note::getNoteFromName("D",2)); | 68 | load.setGroup("Scale"); |
66 | strings2.append(Note::getNoteFromName("G",2)); | 69 | load.writeEntry("Scale0","ionian;0;2;4;5;7;9;11;"); |
67 | instruments.append(Instrument("Bass 4",12,strings2)); | 70 | load.writeEntry("Scale1","aeolian;0;2;3;5;7;8;10;"); |
68 | 71 | load.writeEntry("Scale2","dorian;0;2;3;5;7;9;10;"); | |
69 | currentInstrumentID=1; | 72 | load.writeEntry("Scale3","phrygian;0;1;3;5;7;8;10;"); |
70 | 73 | load.writeEntry("Scale4","lydian;0;2;4;6;7;9;11;"); | |
71 | QValueList<int> scale1; | 74 | load.writeEntry("Scale5","mixolyd.;0;2;4;5;7;9;10;"); |
72 | scale1.append(0); | 75 | load.writeEntry("noOfScales",6); |
73 | scale1.append(2); | ||
74 | scale1.append(3); | ||
75 | scale1.append(5); | ||
76 | scale1.append(7); | ||
77 | scale1.append(8); | ||
78 | scale1.append(10); | ||
79 | scales.append(Scale("Minor",scale1)); | ||
80 | |||
81 | QValueList<int> scale2; | ||
82 | scale2.append(0); | ||
83 | scale2.append(2); | ||
84 | scale2.append(4); | ||
85 | scale2.append(5); | ||
86 | scale2.append(7); | ||
87 | scale2.append(9); | ||
88 | scale2.append(10); | ||
89 | scales.append(Scale("Major",scale2)); | ||
90 | 76 | ||
91 | currentScaleID=0; | 77 | } |
92 | 78 | ||
93 | currentNote=Note::getNoteFromName("A",0); | ||
94 | */ | ||
95 | Config load("Tonleiter"); | ||
96 | load.setGroup("General"); | 79 | load.setGroup("General"); |
diff --git a/noncore/multimedia/tonleiter/tonleiterdata.h b/noncore/multimedia/tonleiter/tonleiterdata.h index a5e6884..71d05fd 100644 --- a/noncore/multimedia/tonleiter/tonleiterdata.h +++ b/noncore/multimedia/tonleiter/tonleiterdata.h | |||
@@ -7,38 +7,41 @@ | |||
7 | 7 | ||
8 | class TonleiterData : public QObject | 8 | namespace Data |
9 | { | 9 | { |
10 | Q_OBJECT | 10 | class TonleiterData : public QObject |
11 | private: | 11 | { |
12 | QValueList<Instrument> instruments; | 12 | Q_OBJECT |
13 | int currentInstrumentID; | 13 | private: |
14 | 14 | QValueList<Instrument> instruments; | |
15 | QValueList<Scale> scales; | 15 | int currentInstrumentID; |
16 | int currentScaleID; | 16 | |
17 | 17 | QValueList<Scale> scales; | |
18 | int currentNote; | 18 | int currentScaleID; |
19 | bool drawnames; | 19 | |
20 | public: | 20 | int currentNote; |
21 | TonleiterData(QObject* parent); | 21 | bool drawnames; |
22 | ~TonleiterData(); | 22 | public: |
23 | signals: | 23 | TonleiterData(QObject* parent); |
24 | void dataChange(); | 24 | ~TonleiterData(); |
25 | public slots: | 25 | signals: |
26 | void setCurrentInstrumetID(int id); | 26 | void dataChange(); |
27 | void setCurrentScaleID(int id); | 27 | public slots: |
28 | void setCurrentNote(int id); | 28 | void setCurrentInstrumetID(int id); |
29 | void setDrawNames(bool dn); | 29 | void setCurrentScaleID(int id); |
30 | private: | 30 | void setCurrentNote(int id); |
31 | void loadData(); | 31 | void setDrawNames(bool dn); |
32 | void saveData(); | 32 | private: |
33 | public: | 33 | void loadData(); |
34 | int noOfInstruments(); | 34 | void saveData(); |
35 | Instrument getInstrument(int id); | 35 | public: |
36 | int getCurrentInstrumentID(); | 36 | int noOfInstruments(); |
37 | 37 | Instrument getInstrument(int id); | |
38 | int noOfScales(); | 38 | int getCurrentInstrumentID(); |
39 | Scale getScale(int id); | 39 | |
40 | int getCurrentScaleID(); | 40 | int noOfScales(); |
41 | 41 | Scale getScale(int id); | |
42 | int getCurrentBaseNote(); | 42 | int getCurrentScaleID(); |
43 | bool isDrawNames(); | 43 | |
44 | int getCurrentBaseNote(); | ||
45 | bool isDrawNames(); | ||
46 | }; | ||
44 | }; | 47 | }; |
diff --git a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp index c52e0da..5714cea 100644 --- a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp +++ b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp | |||
@@ -2,2 +2,4 @@ | |||
2 | 2 | ||
3 | using namespace Data; | ||
4 | |||
3 | int Note::getOctaveOfNote(int note) | 5 | int Note::getOctaveOfNote(int note) |
diff --git a/noncore/multimedia/tonleiter/tonleiterdatahelper.h b/noncore/multimedia/tonleiter/tonleiterdatahelper.h index 94895ea..b79162a 100644 --- a/noncore/multimedia/tonleiter/tonleiterdatahelper.h +++ b/noncore/multimedia/tonleiter/tonleiterdatahelper.h | |||
@@ -6,47 +6,49 @@ | |||
6 | 6 | ||
7 | namespace Note | 7 | namespace Data |
8 | { | 8 | { |
9 | const QString notenames[]={"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"}; | 9 | namespace Note |
10 | 10 | { | |
11 | int getOctaveOfNote(int note); | 11 | const QString notenames[]={"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"}; |
12 | QString getNameOfNote(int note); | 12 | |
13 | int getNoteFromName(QString name,int octave); | 13 | int getOctaveOfNote(int note); |
14 | int octaveOfBaseNote(int base,int note); | 14 | QString getNameOfNote(int note); |
15 | }; | 15 | int getNoteFromName(QString name,int octave); |
16 | 16 | int octaveOfBaseNote(int base,int note); | |
17 | class Instrument | 17 | }; |
18 | { | 18 | |
19 | private: | 19 | class Instrument |
20 | QString name; | 20 | { |
21 | int frets; | 21 | private: |
22 | QValueList<int> strings; | 22 | QString name; |
23 | public: | 23 | int frets; |
24 | Instrument(); | 24 | QValueList<int> strings; |
25 | Instrument(QString name,int frets,QValueList<int> strings); | 25 | public: |
26 | ~Instrument(); | 26 | Instrument(); |
27 | public: | 27 | Instrument(QString name,int frets,QValueList<int> strings); |
28 | int noOfStrings(); | 28 | ~Instrument(); |
29 | int noOfFrets(); | 29 | public: |
30 | QString instName(); | 30 | int noOfStrings(); |
31 | int string(int id); | 31 | int noOfFrets(); |
32 | int noOfOctaves(); | 32 | QString instName(); |
33 | int string(int id); | ||
34 | int noOfOctaves(); | ||
35 | }; | ||
36 | |||
37 | class Scale | ||
38 | { | ||
39 | private: | ||
40 | QValueList<int> halftones; | ||
41 | QString name; | ||
42 | public: | ||
43 | Scale(); | ||
44 | Scale(QString name,QValueList<int> halftones); | ||
45 | ~Scale(); | ||
46 | public: | ||
47 | int noOfHaltones(); | ||
48 | int getHalfTone(int id); | ||
49 | QString scaleName(); | ||
50 | bool noteInScale(int base,int note); | ||
51 | }; | ||
33 | }; | 52 | }; |
34 | 53 | ||
35 | class Scale | ||
36 | { | ||
37 | private: | ||
38 | QValueList<int> halftones; | ||
39 | QString name; | ||
40 | public: | ||
41 | Scale(); | ||
42 | Scale(QString name,QValueList<int> halftones); | ||
43 | ~Scale(); | ||
44 | public: | ||
45 | int noOfHaltones(); | ||
46 | int getHalfTone(int id); | ||
47 | QString scaleName(); | ||
48 | bool noteInScale(int base,int note); | ||
49 | }; | ||
50 | |||
51 | |||
52 | #endif //TONLEITER_DATA_HELPER_H | 54 | #endif //TONLEITER_DATA_HELPER_H |