1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright 2005-2019 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#include "ConfigWidget.h"
QMap<int, ConfigWidgetNew> *ConfigRegistrar::c_qmNew;
ConfigRegistrar::ConfigRegistrar(int priority, ConfigWidgetNew n) {
if (! c_qmNew)
c_qmNew = new QMap<int, ConfigWidgetNew>();
iPriority = priority;
c_qmNew->insert(priority,n);
}
ConfigRegistrar::~ConfigRegistrar() {
c_qmNew->remove(iPriority);
if (c_qmNew->isEmpty()) {
delete c_qmNew;
c_qmNew = NULL;
}
}
ConfigWidget::ConfigWidget(Settings &st) : s(st) {
}
QIcon ConfigWidget::icon() const {
return qApp->windowIcon();
}
void ConfigWidget::accept() const {
}
void ConfigWidget::loadSlider(QSlider *slider, int v) {
if (v != slider->value()) {
slider->setValue(v);
} else {
connect(this, SIGNAL(intSignal(int)), slider, SIGNAL(valueChanged(int)));
emit intSignal(v);
disconnect(SIGNAL(intSignal(int)));
}
}
void ConfigWidget::loadCheckBox(QAbstractButton *c, bool v) {
if (v != c->isChecked()) {
c->setChecked(v);
} else {
connect(this, SIGNAL(intSignal(int)), c, SIGNAL(stateChanged(int)));
emit intSignal(v ? 1 : 0);
disconnect(SIGNAL(intSignal(int)));
}
}
void ConfigWidget::loadComboBox(QComboBox *c, int v) {
if (c->currentIndex() != v) {
c->setCurrentIndex(v);
} else {
connect(this, SIGNAL(intSignal(int)), c, SIGNAL(currentIndexChanged(int)));
emit intSignal(v);
disconnect(SIGNAL(intSignal(int)));
}
}
|