summaryrefslogtreecommitdiff
authorwaspe <waspe>2003-11-17 20:34:17 (UTC)
committer waspe <waspe>2003-11-17 20:34:17 (UTC)
commitfef70b95241f814328678e422bc9b9027e142386 (patch) (unidiff)
tree1baa88dbb52451253040d0d4ecc90d96d18aeb5d
parentede1a10411dd859c6473aadbc7fa54bf2419380d (diff)
downloadopie-fef70b95241f814328678e422bc9b9027e142386.zip
opie-fef70b95241f814328678e422bc9b9027e142386.tar.gz
opie-fef70b95241f814328678e422bc9b9027e142386.tar.bz2
load and save added -> data needs still be edited in conf file
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/tonleiter/tonleiterdata.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/noncore/multimedia/tonleiter/tonleiterdata.cpp b/noncore/multimedia/tonleiter/tonleiterdata.cpp
index 8a9fdca..e1ecb5a 100644
--- a/noncore/multimedia/tonleiter/tonleiterdata.cpp
+++ b/noncore/multimedia/tonleiter/tonleiterdata.cpp
@@ -1,5 +1,7 @@
1#include "tonleiterdata.h" 1#include "tonleiterdata.h"
2 2
3#include <qpe/config.h>
4
3TonleiterData::TonleiterData(QObject* parent) 5TonleiterData::TonleiterData(QObject* parent)
4:QObject(parent) 6:QObject(parent)
5{ 7{
@@ -47,6 +49,7 @@ void TonleiterData::setDrawNames(bool dn)
47//**************************************************************************** 49//****************************************************************************
48void TonleiterData::loadData() 50void TonleiterData::loadData()
49{ 51{
52/*
50 QValueList<int> strings1; 53 QValueList<int> strings1;
51 strings1.append(Note::getNoteFromName("B",0)); 54 strings1.append(Note::getNoteFromName("B",0));
52 strings1.append(Note::getNoteFromName("E",1)); 55 strings1.append(Note::getNoteFromName("E",1));
@@ -88,10 +91,71 @@ void TonleiterData::loadData()
88 currentScaleID=0; 91 currentScaleID=0;
89 92
90 currentNote=Note::getNoteFromName("A",0); 93 currentNote=Note::getNoteFromName("A",0);
94*/
95 Config load("Tonleiter");
96 load.setGroup("General");
97 currentNote=load.readNumEntry("currentNote");
98 drawnames=load.readBoolEntry("drawnames");
99 currentInstrumentID=load.readNumEntry("currentInstrumentID");
100 currentScaleID=load.readNumEntry("currentScaleID");
101
102 load.setGroup("Instrument");
103 int noOfInstr=load.readNumEntry("noOfInstruments",0);
104 for(int i=0;i<noOfInstr;i++)
105 {
106 QStringList instlist=load.readListEntry("Inst"+QString::number(i),';');
107 QValueList<int> strings;
108 for(int st=2;st<(int)instlist.count();st++)
109 strings.append(instlist[st].toInt());
110 instruments.append(Instrument(instlist[0],instlist[1].toInt(),strings));
111 }
112
113 load.setGroup("Scale");
114 int scaleno=load.readNumEntry("noOfScales",0);
115 for(int s=0;s<scaleno;s++)
116 {
117 QStringList scalelist=load.readListEntry("Scale"+QString::number(s),';');
118 QValueList<int> halftones;
119 for(int ht=1;ht<(int)scalelist.count();ht++)
120 halftones.append(scalelist[ht].toInt());
121 scales.append(Scale(scalelist[0],halftones));
122 }
123
91} 124}
92//**************************************************************************** 125//****************************************************************************
93void TonleiterData::saveData() 126void TonleiterData::saveData()
94{ 127{
128 Config save("Tonleiter");
129 save.setGroup("General");
130 save.writeEntry("currentNote",currentNote);
131 save.writeEntry("drawnames",drawnames);
132 save.writeEntry("currentInstrumentID",currentInstrumentID);
133 save.writeEntry("currentScaleID",currentScaleID);
134
135 save.setGroup("Instrument");
136 save.writeEntry("noOfInstruments",noOfInstruments());
137 for(int i=0;i<noOfInstruments();i++)
138 {
139 QStringList instlist;
140 Instrument inst=getInstrument(i);
141 instlist.append(inst.instName());
142 instlist.append(QString::number(inst.noOfFrets()));
143 for(int st=0;st<inst.noOfStrings();st++)
144 instlist.append(QString::number(inst.string(st)));
145 save.writeEntry("Inst"+QString::number(i),instlist,';');
146 }
147
148 save.setGroup("Scale");
149 save.writeEntry("noOfScales",noOfScales());
150 for(int s=0;s<noOfScales();s++)
151 {
152 QStringList scalelist;
153 Scale scale=getScale(s);
154 scalelist.append(scale.scaleName());
155 for(int ht=0;ht<scale.noOfHaltones();ht++)
156 scalelist.append(QString::number(scale.getHalfTone(ht)));
157 save.writeEntry("Scale"+QString::number(s),scalelist,';');
158 }
95} 159}
96//**************************************************************************** 160//****************************************************************************
97int TonleiterData::noOfInstruments() 161int TonleiterData::noOfInstruments()