~ubuntu-branches/ubuntu/oneiric/muse/oneiric

« back to all changes in this revision

Viewing changes to widgets/splitter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2002-04-23 17:28:23 UTC
  • Revision ID: james.westby@ubuntu.com-20020423172823-w8yplzr81a759xa3
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

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