1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
//=========================================================
// MusE
// Linux Music Editor
// $Id: splitter.cpp,v 1.1.1.1 2003/10/29 10:06:31 wschweer Exp $
// (C) Copyright 1999 Werner Schweer (ws@seh.de)
//=========================================================
#include "splitter.h"
#include "xml.h"
#include <qstringlist.h>
//---------------------------------------------------------
// Splitter
//---------------------------------------------------------
Splitter::Splitter(Qt::Orientation o, QWidget* parent, const char* name)
: QSplitter(o, parent, name)
{
setOpaqueResize(true);
}
//---------------------------------------------------------
// saveConfiguration
//---------------------------------------------------------
void Splitter::writeStatus(int level, Xml& xml)
{
QValueList<int> vl = sizes();
xml.nput(level++, "<%s>", name());
QValueListIterator<int> ivl = vl.begin();
for (; ivl != vl.end(); ++ivl) {
xml.nput("%d ", *ivl);
}
xml.nput("</%s>\n", name());
}
//---------------------------------------------------------
// loadConfiguration
//---------------------------------------------------------
void Splitter::readStatus(Xml& xml)
{
QValueList<int> vl;
for (;;) {
Xml::Token token = xml.parse();
const QString& tag = xml.s1();
switch (token) {
case Xml::Error:
case Xml::End:
return;
case Xml::TagStart:
xml.unknown("Splitter");
break;
case Xml::Text:
{
QStringList sl = QStringList::split(' ', tag);
for (QStringList::Iterator it = sl.begin(); it != sl.end(); ++it) {
int val = (*it).toInt();
vl.append(val);
}
}
break;
case Xml::TagEnd:
if (tag == name()) {
setSizes(vl);
return;
}
default:
break;
}
}
}
|