summaryrefslogtreecommitdiff
path: root/utils/themeeditor/configdocument.h
blob: 2f4c2501a195293e01105894e215fefa0f9ae724 (plain)
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
#ifndef CONFIGDOCUMENT_H
#define CONFIGDOCUMENT_H

#include <QHBoxLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QWidget>
#include <QMap>

#include "tabcontent.h"

namespace Ui {
    class ConfigDocument;
}

class ConfigDocument : public TabContent {
    Q_OBJECT
public:
    ConfigDocument(QMap<QString, QString>& settings, QString file,
                   QWidget *parent = 0);
    virtual ~ConfigDocument();

    TabType type() const{ return TabContent::Config; }
    QString file() const{ return filePath; }
    QString title() const;

    QString toPlainText() const;

    void save();
    void saveAs();

    bool requestClose();

protected:
    void changeEvent(QEvent *e);

private:
    Ui::ConfigDocument *ui;
    QList<QHBoxLayout*> containers;
    QList<QLineEdit*> keys;
    QList<QLineEdit*> values;
    QList<QPushButton*> deleteButtons;

    QString filePath;
    QString saved;

    void addRow(QString key, QString value);

private slots:
    void deleteClicked();
    void addClicked();
};

#endif // CONFIGDOCUMENT_H