Theme Editor: Replaced line edits for key names with combo boxes
[kugel-rb.git] / utils / themeeditor / configdocument.h
blob8493c7a138b3ff59004bf58089b17b0d9cf44972
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 Robert Bieber
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef CONFIGDOCUMENT_H
23 #define CONFIGDOCUMENT_H
25 #include <QHBoxLayout>
26 #include <QLineEdit>
27 #include <QComboBox>
28 #include <QPushButton>
29 #include <QWidget>
30 #include <QLabel>
31 #include <QMap>
33 #include "tabcontent.h"
35 namespace Ui {
36 class ConfigDocument;
39 class ConfigDocument : public TabContent {
40 Q_OBJECT
41 public:
42 ConfigDocument(QMap<QString, QString>& settings, QString file,
43 QWidget *parent = 0);
44 virtual ~ConfigDocument();
46 TabType type() const{ return TabContent::Config; }
47 QString file() const{ return filePath; }
48 QString title() const;
50 QString toPlainText() const;
52 void save();
53 void saveAs();
55 bool requestClose();
57 protected:
58 void changeEvent(QEvent *e);
60 signals:
61 void configFileChanged(QString);
63 private slots:
64 void deleteClicked();
65 void addClicked();
66 void textChanged();
69 private:
70 Ui::ConfigDocument *ui;
71 QList<QHBoxLayout*> containers;
72 QList<QComboBox*> keys;
73 QList<QLineEdit*> values;
74 QList<QPushButton*> deleteButtons;
75 QList<QLabel*> labels;
77 QStringList primaryKeys;
78 QStringList secondaryKeys;
80 QString filePath;
81 QString saved;
83 void addRow(QString key, QString value);
86 #endif // CONFIGDOCUMENT_H