Line data Source code
1 : #include <QStringList>
2 :
3 : #include "dbe/SchemaSettings.hpp"
4 : #include "dbe/SchemaStyle.hpp"
5 :
6 : #include "ui_SchemaSettings.h"
7 :
8 : using namespace dbse;
9 :
10 0 : SchemaSettings::SchemaSettings(QWidget* parent)
11 0 : : QDialog(parent), m_ui(new Ui::SchemaSettings)
12 : {
13 0 : m_ui->setupUi(this);
14 0 : setObjectName("Settings");
15 :
16 0 : SchemaStyle::load();
17 :
18 0 : for (auto group : QStringList{"default", "active_file", "inherited",
19 0 : "highlight", "readonly", "error", "note", "line"}) {
20 0 : m_ui->color_list->addItem(group+" Foreground");
21 0 : m_ui->color_list->addItem(group+" Background");
22 0 : }
23 0 : for (auto group : QStringList{"default", "highlight", "abstract", "note",
24 0 : "line"}) {
25 0 : m_ui->font_list->addItem(group);
26 0 : }
27 :
28 0 : connect (m_ui->color_list, SIGNAL(itemActivated(QListWidgetItem*)),
29 : this, SLOT(set_color(QListWidgetItem*)));
30 0 : connect (m_ui->font_list, SIGNAL(itemActivated(QListWidgetItem*)),
31 : this, SLOT(set_font(QListWidgetItem*)));
32 :
33 0 : }
34 :
35 0 : void SchemaSettings::set_color(QListWidgetItem* item) {
36 0 : QStringList text = item->text().toLower().split(" ");
37 0 : SchemaStyle::set_color(text.at(1), text.at(0));
38 0 : emit settings_updated();
39 0 : }
40 0 : void SchemaSettings::set_font(QListWidgetItem* item) {
41 0 : SchemaStyle::set_font(item->text());
42 0 : emit settings_updated();
43 0 : }
|