DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
dbe
src
internal
Preferences.cpp
Go to the documentation of this file.
1
#include <QColorDialog>
2
#include <QSettings>
3
#include <QStringList>
4
5
#include "
dbe/Preferences.hpp
"
6
#include "
dbe/StyleUtility.hpp
"
7
8
#include "ui_Preferences.h"
9
10
namespace
dbe
{
11
12
Preferences::Preferences
(QWidget* parent)
13
: QDialog(parent),
m_ui
(new
Ui
::
Preferences
)
14
{
15
m_ui
->setupUi(
this
);
16
setObjectName(
"Preferences"
);
17
18
QSettings settings;
19
auto
item =
new
QListWidgetItem(
"Attribute Foreground"
);
20
item->setToolTip(
"Foreground colour for attributes"
);
21
item->setForeground(settings.value(
"attribute/foreground"
).value<QColor>());
22
m_ui
->attribute_list->addItem(item);
23
24
item =
new
QListWidgetItem(
"Attribute Background"
);
25
item->setToolTip(
"Normal background colour for attributes"
);
26
item->setBackground(settings.value(
"attribute/background"
).value<QColor>());
27
m_ui
->attribute_list->addItem(item);
28
29
item =
new
QListWidgetItem(
"Attribute Default-Background"
);
30
item->setToolTip(
"Background colour for attributes set to their default value"
);
31
item->setBackground(settings.value(
"attribute/default-background"
).value<QColor>());
32
m_ui
->attribute_list->addItem(item);
33
34
item =
new
QListWidgetItem(
"Relationship Foreground"
);
35
item->setToolTip(
"Foreground colour for relationships"
);
36
item->setForeground(settings.value(
"relationship/foreground"
).value<QColor>());
37
m_ui
->relationship_list->addItem(item);
38
39
item =
new
QListWidgetItem(
"Relationship Background"
);
40
item->setToolTip(
"background colour for relationships"
);
41
item->setBackground(settings.value(
"relationship/background"
).value<QColor>());
42
m_ui
->relationship_list->addItem(item);
43
44
item =
new
QListWidgetItem(
"Readonly Foreground"
);
45
item->setToolTip(
"Foreground text colour for readonly items"
);
46
item->setForeground(settings.value(
"readonly/foreground"
).value<QColor>());
47
m_ui
->read_only_list->addItem(item);
48
49
item =
new
QListWidgetItem(
"Readonly Background"
);
50
item->setToolTip(
"Background text colour for readonly items"
);
51
item->setBackground(settings.value(
"readonly/background"
).value<QColor>());
52
m_ui
->read_only_list->addItem(item);
53
54
connect (
m_ui
->attribute_list, SIGNAL(itemActivated(QListWidgetItem*)),
55
this
, SLOT(
set_color
(QListWidgetItem*)));
56
connect (
m_ui
->relationship_list, SIGNAL(itemActivated(QListWidgetItem*)),
57
this
, SLOT(
set_color
(QListWidgetItem*)));
58
connect (
m_ui
->read_only_list, SIGNAL(itemActivated(QListWidgetItem*)),
59
this
, SLOT(
set_color
(QListWidgetItem*)));
60
61
}
62
63
void
Preferences::set_color
(QListWidgetItem* item) {
64
QSettings settings;
65
QStringList text = item->text().toLower().split(
" "
);
66
settings.beginGroup(text.at(0));
67
68
auto
color = settings.value(text.at(1)).value<QColor>();
69
auto
title = QString(
"Select color for "
) + item->text();
70
color = QColorDialog::getColor(color,
nullptr
, title);
71
72
if
(color.isValid()) {
73
settings.setValue(text.at(1), color);
74
StyleUtility::InitColorManagement
();
75
}
76
}
77
}
// namespace dbe
Preferences.hpp
StyleUtility.hpp
dbe::Preferences::m_ui
Ui::Preferences * m_ui
Definition
Preferences.hpp:29
dbe::Preferences::Preferences
Preferences(QWidget *parent=0)
Definition
Preferences.cpp:12
dbe::Preferences::set_color
void set_color(QListWidgetItem *)
Definition
Preferences.cpp:63
dbe::StyleUtility::InitColorManagement
static void InitColorManagement()
Definition
StyleUtility.cpp:31
Ui
Definition
SchemaSettings.hpp:10
dbe
Include QT Headers.
Definition
BatchChangeWidget.hpp:18
Generated on
for DUNE-DAQ by
1.17.0