| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
1 |
#include "preferencesdialog.h" |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
2 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
3 |
#include <QVBoxLayout> |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
4 |
#include <QHBoxLayout> |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
5 |
#include <QLabel> |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
6 |
#include <QComboBox> |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
7 |
#include <QCheckBox> |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
8 |
#include <QPushButton> |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
9 |
#include <QGroupBox> |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
10 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
11 |
PreferencesDialog::PreferencesDialog(QWidget *parent) |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
12 |
: QDialog(parent) |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
13 |
{ |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
14 |
setWindowTitle("Preferences"); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
15 |
setModal(true); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
16 |
setMinimumWidth(400); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
17 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
18 |
QVBoxLayout *mainLayout = new QVBoxLayout(this); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
19 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
20 |
QGroupBox *imageGroup = new QGroupBox("Image Viewer", this); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
21 |
QVBoxLayout *groupLayout = new QVBoxLayout(imageGroup); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
22 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
23 |
QHBoxLayout *bgColorLayout = new QHBoxLayout; |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
24 |
QLabel *bgColorLabel = new QLabel("Background Color:"); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
25 |
m_backgroundColorCombo = new QComboBox; |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
26 |
m_backgroundColorCombo->addItem("Black", "black"); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
27 |
m_backgroundColorCombo->addItem("White", "white"); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
28 |
m_backgroundColorCombo->addItem("Dark Gray", "darkgray"); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
29 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
30 |
bgColorLayout->addWidget(bgColorLabel); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
31 |
bgColorLayout->addWidget(m_backgroundColorCombo); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
32 |
bgColorLayout->addStretch(); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
33 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
34 |
groupLayout->addLayout(bgColorLayout); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
35 |
mainLayout->addWidget(imageGroup); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
36 |
|
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
37 |
QGroupBox *layoutGroup = new QGroupBox("Layout", this); |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
38 |
QVBoxLayout *layoutGroupLayout = new QVBoxLayout(layoutGroup); |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
39 |
m_lockDockingCheck = new QCheckBox("Lock docking (prevent accidental moves)"); |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
40 |
layoutGroupLayout->addWidget(m_lockDockingCheck); |
| 7370f1c0 |
Poul Sander |
2026-03-01 15:15 |
41 |
|
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
42 |
m_resetLayoutCheck = new QCheckBox("Reset layout to default when closing the menu"); |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
43 |
layoutGroupLayout->addWidget(m_resetLayoutCheck); |
| 7370f1c0 |
Poul Sander |
2026-03-01 15:15 |
44 |
|
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
45 |
mainLayout->addWidget(layoutGroup); |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
46 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
47 |
mainLayout->addStretch(); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
48 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
49 |
QHBoxLayout *buttonLayout = new QHBoxLayout; |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
50 |
QPushButton *okButton = new QPushButton("OK"); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
51 |
QPushButton *cancelButton = new QPushButton("Cancel"); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
52 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
53 |
buttonLayout->addStretch(); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
54 |
buttonLayout->addWidget(okButton); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
55 |
buttonLayout->addWidget(cancelButton); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
56 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
57 |
mainLayout->addLayout(buttonLayout); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
58 |
|
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
59 |
connect(okButton, &QPushButton::clicked, this, [this]() { |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
60 |
if (m_resetLayoutCheck->isChecked()) |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
61 |
emit resetLayoutRequested(); |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
62 |
accept(); |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
63 |
}); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
64 |
connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
65 |
} |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
66 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
67 |
QString PreferencesDialog::getBackgroundColor() const |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
68 |
{ |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
69 |
return m_backgroundColorCombo->currentData().toString(); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
70 |
} |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
71 |
|
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
72 |
void PreferencesDialog::setBackgroundColor(const QString &color) |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
73 |
{ |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
74 |
int index = m_backgroundColorCombo->findData(color); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
75 |
if (index >= 0) |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
76 |
m_backgroundColorCombo->setCurrentIndex(index); |
| 10d6e6f8 |
Poul Sander |
2026-02-24 18:40 |
77 |
} |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
78 |
|
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
79 |
bool PreferencesDialog::getLockDocking() const |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
80 |
{ |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
81 |
return m_lockDockingCheck->isChecked(); |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
82 |
} |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
83 |
|
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
84 |
void PreferencesDialog::setLockDocking(bool lock) |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
85 |
{ |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
86 |
m_lockDockingCheck->setChecked(lock); |
| 4ae57f60 |
Poul Sander |
2026-02-25 21:35 |
87 |
} |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
88 |
|
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
89 |
bool PreferencesDialog::getResetLayout() const |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
90 |
{ |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
91 |
return m_resetLayoutCheck->isChecked(); |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
92 |
} |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
93 |
|
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
94 |
void PreferencesDialog::setResetLayout(bool reset) |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
95 |
{ |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
96 |
m_resetLayoutCheck->setChecked(reset); |
| d1aa6cbe |
Poul Sander |
2026-03-02 16:57 |
97 |
} |
|
|
1970-01-01 00:00 |
98 |
|