diff options
Diffstat (limited to 'muse2/muse/widgets/gatetime.cpp')
-rw-r--r-- | muse2/muse/widgets/gatetime.cpp | 69 |
1 files changed, 63 insertions, 6 deletions
diff --git a/muse2/muse/widgets/gatetime.cpp b/muse2/muse/widgets/gatetime.cpp index f1804c35..9448ab1c 100644 --- a/muse2/muse/widgets/gatetime.cpp +++ b/muse2/muse/widgets/gatetime.cpp @@ -10,6 +10,7 @@ #include "gatetime.h" +#include "xml.h" #include "song.h" //--------------------------------------------------------- @@ -26,6 +27,8 @@ GateTime::GateTime(QWidget* parent) rangeGroup->addButton(loopButton, 2); rangeGroup->addButton(sloopButton, 3); rangeGroup->setExclusive(true); + + pullValues(); } //--------------------------------------------------------- @@ -34,18 +37,72 @@ GateTime::GateTime(QWidget* parent) void GateTime::accept() { - _range = rangeGroup->checkedId(); - _rateVal = rate->value(); - _offsetVal = offset->value(); + pullValues(); QDialog::accept(); } //--------------------------------------------------------- -// setRange +// pullValues //--------------------------------------------------------- -void GateTime::setRange(int id) +void GateTime::pullValues() { - rangeGroup->button(id)->setChecked(true); + range = rangeGroup->checkedId(); + rateVal = rate->value(); + offsetVal = offset->value(); } +//--------------------------------------------------------- +// exec +//--------------------------------------------------------- + +int GateTime::exec() + { + rangeGroup->button(range)->setChecked(true); + rate->setValue(rateVal); + offset->setValue(offsetVal); + + return QDialog::exec(); + } + + +void GateTime::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "rate") + rateVal=xml.parseInt(); + else if (tag == "offset") + offsetVal=xml.parseInt(); + else + xml.unknown("ModLen"); + break; + + case Xml::TagEnd: + if (tag == "mod_len") + return; + + default: + break; + } + } +} + +void GateTime::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "mod_len"); + xml.intTag(level, "range", range); + xml.intTag(level, "offset", offsetVal); + xml.intTag(level, "rate", rateVal); + xml.tag(level, "/mod_len"); +} |