~ben-kietzman/ubuntu/quantal/mountmanager/fix-for-598070

« back to all changes in this revision

Viewing changes to sources/core/diskoptionsparser.h

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2008-08-20 10:22:14 UTC
  • Revision ID: james.westby@ubuntu.com-20080820102214-fv93myu0ncb1503r
Tags: upstream-0.2.4
ImportĀ upstreamĀ versionĀ 0.2.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//MountManager - the program for easy mounting of storage devices in Linux
 
2
//Copyright (C) 2007-2008 Tikhonov Sergey
 
3
//
 
4
//This file is part of MountManager Core
 
5
//
 
6
//This program is free software; you can redistribute it and/or
 
7
//modify it under the terms of the GNU General Public License
 
8
//as published by the Free Software Foundation; either version 2
 
9
//of the License, or (at your option) any later version.
 
10
//
 
11
//This program is distributed in the hope that it will be useful,
 
12
//but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
//GNU General Public License for more details.
 
15
//
 
16
//You should have received a copy of the GNU General Public License
 
17
//along with this program; if not, write to the Free Software
 
18
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
19
#ifndef DISKMOUNTOPTIOcNS_H
 
20
#define DISKMOUNTOPTIONS_H
 
21
 
 
22
#include <QXmlDefaultHandler>
 
23
#include <QXmlParseException>
 
24
#include <QStringList>
 
25
 
 
26
struct Value {
 
27
        QString text;
 
28
        bool isDefault;
 
29
        // If option is check box
 
30
        bool isChecked;
 
31
};
 
32
 
 
33
struct Option {
 
34
        QString optionTitle;
 
35
        QString optionType;
 
36
        QList<Value *> optionValues;
 
37
        QStringList optionComboBoxItems;
 
38
        QString optionDocMark;
 
39
        QString optionDefaultValue;
 
40
        QString maximumValue;
 
41
        bool isExpertOption;
 
42
};
 
43
 
 
44
class DiskOptionsParser : public QXmlDefaultHandler
 
45
{
 
46
        private:
 
47
                QList<Option *> optionsList;
 
48
 
 
49
                Option *currentOption;
 
50
                bool expertNow;
 
51
                QString tempText;
 
52
                bool isValuesNow;
 
53
                bool valid;
 
54
                bool isComboBoxItemsNow;
 
55
                bool areThereComboBoxItems;
 
56
                bool isAcceptComboBoxItems;
 
57
                QString comboBoxItemsLocale;
 
58
                QString optionTitleLocale;
 
59
                QString variantStatus;
 
60
                
 
61
                QString lang;
 
62
 
 
63
                void init();
 
64
 
 
65
                bool startElement(const QString&, const QString&, const QString&, const QXmlAttributes&);
 
66
                bool characters(const QString& str);
 
67
                bool endElement(const QString&, const QString&, const QString&);
 
68
                bool fatalError(const QXmlParseException&);
 
69
        public:
 
70
                DiskOptionsParser(QString lang = QString());
 
71
                ~DiskOptionsParser();
 
72
 
 
73
                bool isValid();
 
74
                QList<Option *> options();
 
75
 
 
76
                void setLanguage(const QString& lang);
 
77
 
 
78
                QString& language();
 
79
                const QString& language() const;
 
80
};
 
81
 
 
82
#endif