author | waspe <waspe> | 2003-11-17 20:34:17 (UTC) |
---|---|---|
committer | waspe <waspe> | 2003-11-17 20:34:17 (UTC) |
commit | fef70b95241f814328678e422bc9b9027e142386 (patch) (side-by-side diff) | |
tree | 1baa88dbb52451253040d0d4ecc90d96d18aeb5d | |
parent | ede1a10411dd859c6473aadbc7fa54bf2419380d (diff) | |
download | opie-fef70b95241f814328678e422bc9b9027e142386.zip opie-fef70b95241f814328678e422bc9b9027e142386.tar.gz opie-fef70b95241f814328678e422bc9b9027e142386.tar.bz2 |
load and save added -> data needs still be edited in conf file
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiterdata.cpp | 64 |
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 @@ #include "tonleiterdata.h" +#include <qpe/config.h> + TonleiterData::TonleiterData(QObject* parent) :QObject(parent) { @@ -47,6 +49,7 @@ void TonleiterData::setDrawNames(bool dn) //**************************************************************************** void TonleiterData::loadData() { +/* QValueList<int> strings1; strings1.append(Note::getNoteFromName("B",0)); strings1.append(Note::getNoteFromName("E",1)); @@ -88,10 +91,71 @@ void TonleiterData::loadData() currentScaleID=0; currentNote=Note::getNoteFromName("A",0); +*/ + Config load("Tonleiter"); + load.setGroup("General"); + currentNote=load.readNumEntry("currentNote"); + drawnames=load.readBoolEntry("drawnames"); + currentInstrumentID=load.readNumEntry("currentInstrumentID"); + currentScaleID=load.readNumEntry("currentScaleID"); + + load.setGroup("Instrument"); + int noOfInstr=load.readNumEntry("noOfInstruments",0); + for(int i=0;i<noOfInstr;i++) + { + QStringList instlist=load.readListEntry("Inst"+QString::number(i),';'); + QValueList<int> strings; + for(int st=2;st<(int)instlist.count();st++) + strings.append(instlist[st].toInt()); + instruments.append(Instrument(instlist[0],instlist[1].toInt(),strings)); + } + + load.setGroup("Scale"); + int scaleno=load.readNumEntry("noOfScales",0); + for(int s=0;s<scaleno;s++) + { + QStringList scalelist=load.readListEntry("Scale"+QString::number(s),';'); + QValueList<int> halftones; + for(int ht=1;ht<(int)scalelist.count();ht++) + halftones.append(scalelist[ht].toInt()); + scales.append(Scale(scalelist[0],halftones)); + } + } //**************************************************************************** void TonleiterData::saveData() { + Config save("Tonleiter"); + save.setGroup("General"); + save.writeEntry("currentNote",currentNote); + save.writeEntry("drawnames",drawnames); + save.writeEntry("currentInstrumentID",currentInstrumentID); + save.writeEntry("currentScaleID",currentScaleID); + + save.setGroup("Instrument"); + save.writeEntry("noOfInstruments",noOfInstruments()); + for(int i=0;i<noOfInstruments();i++) + { + QStringList instlist; + Instrument inst=getInstrument(i); + instlist.append(inst.instName()); + instlist.append(QString::number(inst.noOfFrets())); + for(int st=0;st<inst.noOfStrings();st++) + instlist.append(QString::number(inst.string(st))); + save.writeEntry("Inst"+QString::number(i),instlist,';'); + } + + save.setGroup("Scale"); + save.writeEntry("noOfScales",noOfScales()); + for(int s=0;s<noOfScales();s++) + { + QStringList scalelist; + Scale scale=getScale(s); + scalelist.append(scale.scaleName()); + for(int ht=0;ht<scale.noOfHaltones();ht++) + scalelist.append(QString::number(scale.getHalfTone(ht))); + save.writeEntry("Scale"+QString::number(s),scalelist,';'); + } } //**************************************************************************** int TonleiterData::noOfInstruments() |