12 : QDialog(parent)
13 ,
m_ui(
new Ui::SchemaSettings)
14{
16 setObjectName("Settings");
17
19
20 for (auto entry : QStringList{ "default/normal unhighlighted text",
21 "active_file/items associated with the active file",
22 "inherited/properties inherited from a parent class",
23 "highlight/highlighted class",
24 "readonly/items from a readonly file",
25 "error/error messages",
26 "note/notes on class diagrams",
27 "line/lines showing inheritance or relationships between classes" }) {
28 auto list = entry.split("/");
29 auto group = list.at(0);
32 for (auto fb : QStringList{ "Foreground", "Background" }) {
33 auto item = new QListWidgetItem(group + " " + fb);
34 item->setForeground(fg_colour);
35 item->setBackground(bg_colour);
36 if (list.size() > 1) {
37 item->setToolTip(fb + " color for " + list.at(1));
38 }
39 m_ui->color_list->addItem(item);
40 }
41 }
42
43 for (auto entry : QStringList{ "default/normal unhighlighted text",
44 "highlight/highlighted class",
45 "abstract/abstract base class",
46 "note/notes on class diagrams",
47 "line/lines showing inheritance or relationships between classes" }) {
48 auto list = entry.split("/");
49 auto group = list.at(0);
50 auto item = new QListWidgetItem(group + " font");
52 if (list.size() > 1) {
53 item->setToolTip("Font for " + list.at(1));
54 }
55 m_ui->font_list->addItem(item);
56 }
57
58 connect(
m_ui->color_list, SIGNAL(itemActivated(QListWidgetItem*)),
this, SLOT(
set_color(QListWidgetItem*)));
59 connect(
m_ui->font_list, SIGNAL(itemActivated(QListWidgetItem*)),
this, SLOT(
set_font(QListWidgetItem*)));
60
61 QSettings settings;
62 settings.beginGroup("view defaults");
63 m_ui->abstract_button->setChecked(settings.value(
"highlight_abstract",
false).toBool());
64 connect(
m_ui->abstract_button, SIGNAL(stateChanged(
int)),
this, SLOT(
toggle_abstract(
int)));
65 m_ui->active_button->setChecked(settings.value(
"highlight_active",
false).toBool());
66 connect(
m_ui->active_button, SIGNAL(stateChanged(
int)),
this, SLOT(
toggle_active(
int)));
67 m_ui->inherited_button->setChecked(settings.value(
"show_inherited",
false).toBool());
69 m_ui->default_value_button->setChecked(settings.value(
"show_default",
false).toBool());
70 connect(
m_ui->default_value_button, SIGNAL(stateChanged(
int)),
this, SLOT(
toggle_default(
int)));
71 settings.endGroup();
72
73 settings.beginGroup("MainWindow");
74 m_ui->save_settings->setChecked(settings.value(
"saveLayout",
false).toBool());
75 connect(
m_ui->save_settings, SIGNAL(stateChanged(
int)),
this, SLOT(
toggle_save(
int)));
76 settings.endGroup();
77}
void toggle_abstract(int)
void toggle_inherited(int)
void set_color(QListWidgetItem *)
void set_font(QListWidgetItem *)
Ui::SchemaSettings * m_ui
static QColor get_color(const QString &item, const QString &group)
static QFont get_font(const QString &group)