author | waspe <waspe> | 2003-12-16 15:08:22 (UTC) |
---|---|---|
committer | waspe <waspe> | 2003-12-16 15:08:22 (UTC) |
commit | 248572b8b51e47921a429ed8047945ca4c8bd4aa (patch) (unidiff) | |
tree | 3882b3f31be3f541878706ec9df3e2d2d1902b52 | |
parent | bc156981d7ca6987e1353a68caa61620f928b65d (diff) | |
download | opie-248572b8b51e47921a429ed8047945ca4c8bd4aa.zip opie-248572b8b51e47921a429ed8047945ca4c8bd4aa.tar.gz opie-248572b8b51e47921a429ed8047945ca4c8bd4aa.tar.bz2 |
changed default values to something usefull again
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiterdata.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/multimedia/tonleiter/tonleiterdata.cpp b/noncore/multimedia/tonleiter/tonleiterdata.cpp index bf7b32c..33b3c49 100644 --- a/noncore/multimedia/tonleiter/tonleiterdata.cpp +++ b/noncore/multimedia/tonleiter/tonleiterdata.cpp | |||
@@ -1,130 +1,130 @@ | |||
1 | #include "tonleiterdata.h" | 1 | #include "tonleiterdata.h" |
2 | 2 | ||
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | 4 | ||
5 | using namespace Data; | 5 | using namespace Data; |
6 | 6 | ||
7 | 7 | ||
8 | TonleiterData::TonleiterData(QObject* parent) | 8 | TonleiterData::TonleiterData(QObject* parent) |
9 | :QObject(parent) | 9 | :QObject(parent) |
10 | { | 10 | { |
11 | drawnames=true; | 11 | drawnames=true; |
12 | loadData(); | 12 | loadData(); |
13 | } | 13 | } |
14 | //**************************************************************************** | 14 | //**************************************************************************** |
15 | TonleiterData::~TonleiterData() | 15 | TonleiterData::~TonleiterData() |
16 | { | 16 | { |
17 | saveData(); | 17 | saveData(); |
18 | } | 18 | } |
19 | //**************************************************************************** | 19 | //**************************************************************************** |
20 | void TonleiterData::setCurrentInstrumetID(int id) | 20 | void TonleiterData::setCurrentInstrumetID(int id) |
21 | { | 21 | { |
22 | if(id>=0 && id<noOfInstruments()) | 22 | if(id>=0 && id<noOfInstruments()) |
23 | { | 23 | { |
24 | currentInstrumentID=id; | 24 | currentInstrumentID=id; |
25 | emit dataChange(); | 25 | emit dataChange(); |
26 | } | 26 | } |
27 | } | 27 | } |
28 | //**************************************************************************** | 28 | //**************************************************************************** |
29 | void TonleiterData::setCurrentScaleID(int id) | 29 | void TonleiterData::setCurrentScaleID(int id) |
30 | { | 30 | { |
31 | if(id>=0 && id<noOfScales()) | 31 | if(id>=0 && id<noOfScales()) |
32 | { | 32 | { |
33 | currentScaleID=id; | 33 | currentScaleID=id; |
34 | emit dataChange(); | 34 | emit dataChange(); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | //**************************************************************************** | 37 | //**************************************************************************** |
38 | void TonleiterData::setCurrentNote(int id) | 38 | void TonleiterData::setCurrentNote(int id) |
39 | { | 39 | { |
40 | if(id>=0 && id<12) | 40 | if(id>=0 && id<12) |
41 | { | 41 | { |
42 | currentNote=id; | 42 | currentNote=id; |
43 | emit dataChange(); | 43 | emit dataChange(); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | //**************************************************************************** | 46 | //**************************************************************************** |
47 | void TonleiterData::setDrawNames(bool dn) | 47 | void TonleiterData::setDrawNames(bool dn) |
48 | { | 48 | { |
49 | drawnames=dn; | 49 | drawnames=dn; |
50 | emit dataChange(); | 50 | emit dataChange(); |
51 | } | 51 | } |
52 | //**************************************************************************** | 52 | //**************************************************************************** |
53 | void TonleiterData::loadData() | 53 | void TonleiterData::loadData() |
54 | { | 54 | { |
55 | Config load("Tonleiter"); | 55 | Config load("Tonleiter"); |
56 | if(!load.isValid()) | 56 | if(!load.isValid()) |
57 | { | 57 | { |
58 | //write some default values | 58 | //write some default values |
59 | load.setGroup("General"); | 59 | load.setGroup("General"); |
60 | load.writeEntry("currentInstrumentID",1); | 60 | load.writeEntry("currentInstrumentID",1); |
61 | load.writeEntry("currentNote",0); | 61 | load.writeEntry("currentNote",3); |
62 | load.writeEntry("currentScaleID",1); | 62 | load.writeEntry("currentScaleID",0); |
63 | load.writeEntry("drawnames",1); | 63 | load.writeEntry("drawnames",1); |
64 | load.setGroup("Instrument"); | 64 | load.setGroup("Instrument"); |
65 | load.writeEntry("Inst0","Thumb6;26;11;16;21;26;31;36;"); | 65 | load.writeEntry("Inst0","Thumb6;26;14;19;24;29;34;39;"); |
66 | load.writeEntry("Inst1","Bass 4;12;16;21;26;31;"); | 66 | load.writeEntry("Inst1","Bass 4;12;19;24;29;34;"); |
67 | load.writeEntry("noOfInstruments",2); | 67 | load.writeEntry("noOfInstruments",2); |
68 | load.setGroup("Scale"); | 68 | load.setGroup("Scale"); |
69 | load.writeEntry("Scale0","ionian;0;2;4;5;7;9;11;"); | 69 | load.writeEntry("Scale0","ionian;0;2;4;5;7;9;11;"); |
70 | load.writeEntry("Scale1","aeolian;0;2;3;5;7;8;10;"); | 70 | load.writeEntry("Scale1","aeolian;0;2;3;5;7;8;10;"); |
71 | load.writeEntry("Scale2","dorian;0;2;3;5;7;9;10;"); | 71 | load.writeEntry("Scale2","dorian;0;2;3;5;7;9;10;"); |
72 | load.writeEntry("Scale3","phrygian;0;1;3;5;7;8;10;"); | 72 | load.writeEntry("Scale3","phrygian;0;1;3;5;7;8;10;"); |
73 | load.writeEntry("Scale4","lydian;0;2;4;6;7;9;11;"); | 73 | load.writeEntry("Scale4","lydian;0;2;4;6;7;9;11;"); |
74 | load.writeEntry("Scale5","mixolydian;0;2;4;5;7;9;10;"); | 74 | load.writeEntry("Scale5","mixolydian;0;2;4;5;7;9;10;"); |
75 | load.writeEntry("noOfScales",6); | 75 | load.writeEntry("noOfScales",6); |
76 | 76 | ||
77 | } | 77 | } |
78 | 78 | ||
79 | load.setGroup("General"); | 79 | load.setGroup("General"); |
80 | currentNote=load.readNumEntry("currentNote"); | 80 | currentNote=load.readNumEntry("currentNote"); |
81 | drawnames=load.readBoolEntry("drawnames"); | 81 | drawnames=load.readBoolEntry("drawnames"); |
82 | currentInstrumentID=load.readNumEntry("currentInstrumentID"); | 82 | currentInstrumentID=load.readNumEntry("currentInstrumentID"); |
83 | currentScaleID=load.readNumEntry("currentScaleID"); | 83 | currentScaleID=load.readNumEntry("currentScaleID"); |
84 | 84 | ||
85 | load.setGroup("Instrument"); | 85 | load.setGroup("Instrument"); |
86 | int noOfInstr=load.readNumEntry("noOfInstruments",0); | 86 | int noOfInstr=load.readNumEntry("noOfInstruments",0); |
87 | for(int i=0;i<noOfInstr;i++) | 87 | for(int i=0;i<noOfInstr;i++) |
88 | { | 88 | { |
89 | QStringList instlist=load.readListEntry("Inst"+QString::number(i),';'); | 89 | QStringList instlist=load.readListEntry("Inst"+QString::number(i),';'); |
90 | QValueList<int> strings; | 90 | QValueList<int> strings; |
91 | for(int st=2;st<(int)instlist.count();st++) | 91 | for(int st=2;st<(int)instlist.count();st++) |
92 | strings.append(instlist[st].toInt()); | 92 | strings.append(instlist[st].toInt()); |
93 | instruments.append(Instrument(instlist[0],instlist[1].toInt(),strings)); | 93 | instruments.append(Instrument(instlist[0],instlist[1].toInt(),strings)); |
94 | } | 94 | } |
95 | 95 | ||
96 | load.setGroup("Scale"); | 96 | load.setGroup("Scale"); |
97 | int scaleno=load.readNumEntry("noOfScales",0); | 97 | int scaleno=load.readNumEntry("noOfScales",0); |
98 | for(int s=0;s<scaleno;s++) | 98 | for(int s=0;s<scaleno;s++) |
99 | { | 99 | { |
100 | QStringList scalelist=load.readListEntry("Scale"+QString::number(s),';'); | 100 | QStringList scalelist=load.readListEntry("Scale"+QString::number(s),';'); |
101 | QValueList<int> halftones; | 101 | QValueList<int> halftones; |
102 | for(int ht=1;ht<(int)scalelist.count();ht++) | 102 | for(int ht=1;ht<(int)scalelist.count();ht++) |
103 | halftones.append(scalelist[ht].toInt()); | 103 | halftones.append(scalelist[ht].toInt()); |
104 | scales.append(Scale(scalelist[0],halftones)); | 104 | scales.append(Scale(scalelist[0],halftones)); |
105 | } | 105 | } |
106 | 106 | ||
107 | } | 107 | } |
108 | //**************************************************************************** | 108 | //**************************************************************************** |
109 | void TonleiterData::saveData() | 109 | void TonleiterData::saveData() |
110 | { | 110 | { |
111 | Config save("Tonleiter"); | 111 | Config save("Tonleiter"); |
112 | save.setGroup("General"); | 112 | save.setGroup("General"); |
113 | save.writeEntry("currentNote",currentNote); | 113 | save.writeEntry("currentNote",currentNote); |
114 | save.writeEntry("drawnames",drawnames); | 114 | save.writeEntry("drawnames",drawnames); |
115 | save.writeEntry("currentInstrumentID",currentInstrumentID); | 115 | save.writeEntry("currentInstrumentID",currentInstrumentID); |
116 | save.writeEntry("currentScaleID",currentScaleID); | 116 | save.writeEntry("currentScaleID",currentScaleID); |
117 | 117 | ||
118 | save.setGroup("Instrument"); | 118 | save.setGroup("Instrument"); |
119 | save.writeEntry("noOfInstruments",noOfInstruments()); | 119 | save.writeEntry("noOfInstruments",noOfInstruments()); |
120 | for(int i=0;i<noOfInstruments();i++) | 120 | for(int i=0;i<noOfInstruments();i++) |
121 | { | 121 | { |
122 | QStringList instlist; | 122 | QStringList instlist; |
123 | Instrument inst=getInstrument(i); | 123 | Instrument inst=getInstrument(i); |
124 | instlist.append(inst.instName()); | 124 | instlist.append(inst.instName()); |
125 | instlist.append(QString::number(inst.noOfFrets())); | 125 | instlist.append(QString::number(inst.noOfFrets())); |
126 | for(int st=0;st<inst.noOfStrings();st++) | 126 | for(int st=0;st<inst.noOfStrings();st++) |
127 | instlist.append(QString::number(inst.string(st))); | 127 | instlist.append(QString::number(inst.string(st))); |
128 | save.writeEntry("Inst"+QString::number(i),instlist,';'); | 128 | save.writeEntry("Inst"+QString::number(i),instlist,';'); |
129 | } | 129 | } |
130 | 130 | ||