File: cfgcategory.h

package info (click to toggle)
sqlitestudio 3.4.21%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 54,880 kB
  • sloc: ansic: 406,208; cpp: 123,872; yacc: 2,692; tcl: 497; sh: 462; xml: 426; makefile: 19
file content (55 lines) | stat: -rw-r--r-- 1,238 bytes parent folder | download
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
#ifndef CFGCATEGORY_H
#define CFGCATEGORY_H

#include "coreSQLiteStudio_global.h"
#include <QVariant>
#include <QHash>
#include <QString>
#include <QObject>

class CfgEntry;
class CfgMain;

class API_EXPORT CfgCategory : public QObject
{
    Q_OBJECT

    friend class CfgEntry;

    public:
        CfgCategory(const CfgCategory& other);
        CfgCategory(const QString& name, const QString& title);

        CfgEntry* getEntryByName(const QString &name);
        QString toString() const;
        operator QString() const;
        QHash<QString,CfgEntry*>& getEntries();
        void translateTitle();
        void reset();
        void savepoint(bool transaction = false);
        void restore();
        void release();
        void commit();
        void rollback();
        void begin();
        QString getTitle() const;
        CfgMain* getMain() const;
        operator CfgCategory*();

    private:
        QString name;
        QString title;
        CfgMain* cfgParent = nullptr;
        bool persistable = true;
        QHash<QString,CfgEntry*> childs;

    private slots:
        void handleEntryChanged();

    signals:
        void changed(CfgEntry* entry);
};

Q_DECLARE_METATYPE(CfgCategory*)

#endif // CFGCATEGORY_H