File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,10 @@ ColumnLayout {
13
13
Layout .fillWidth : true
14
14
header: qsTr (" Enable listening" )
15
15
description: qsTr (" Allows incoming connections" )
16
- actionItem: OptionSwitch {}
16
+ actionItem: OptionSwitch {
17
+ checked: optionsModel .listen
18
+ onToggled: optionsModel .listen = checked
19
+ }
17
20
}
18
21
Setting {
19
22
Layout .fillWidth : true
Original file line number Diff line number Diff line change @@ -21,6 +21,15 @@ OptionsQmlModel::OptionsQmlModel(interfaces::Node& node)
21
21
m_prune_size_gb = m_prune ? PruneMiBtoGB (prune_value) : DEFAULT_PRUNE_TARGET_GB;
22
22
}
23
23
24
+ void OptionsQmlModel::setListen (bool new_listen)
25
+ {
26
+ if (new_listen != m_listen) {
27
+ m_listen = new_listen;
28
+ m_node.updateRwSetting (" listen" , new_listen);
29
+ Q_EMIT listenChanged (new_listen);
30
+ }
31
+ }
32
+
24
33
void OptionsQmlModel::setPrune (bool new_prune)
25
34
{
26
35
if (new_prune != m_prune) {
Original file line number Diff line number Diff line change @@ -17,25 +17,30 @@ class Node;
17
17
class OptionsQmlModel : public QObject
18
18
{
19
19
Q_OBJECT
20
+ Q_PROPERTY (bool listen READ listen WRITE setListen NOTIFY listenChanged)
20
21
Q_PROPERTY (bool prune READ prune WRITE setPrune NOTIFY pruneChanged)
21
22
Q_PROPERTY (int pruneSizeGB READ pruneSizeGB WRITE setPruneSizeGB NOTIFY pruneSizeGBChanged)
22
23
23
24
public:
24
25
explicit OptionsQmlModel (interfaces::Node& node);
25
26
27
+ bool listen () const { return m_listen; }
28
+ void setListen (bool new_listen);
26
29
bool prune () const { return m_prune; }
27
30
void setPrune (bool new_prune);
28
31
int pruneSizeGB () const { return m_prune_size_gb; }
29
32
void setPruneSizeGB (int new_prune_size);
30
33
31
34
Q_SIGNALS:
35
+ void listenChanged (bool new_listen);
32
36
void pruneChanged (bool new_prune);
33
37
void pruneSizeGBChanged (int new_prune_size_gb);
34
38
35
39
private:
36
40
interfaces::Node& m_node;
37
41
38
42
// Properties that are exposed to QML.
43
+ bool m_listen;
39
44
bool m_prune;
40
45
int m_prune_size_gb;
41
46
You can’t perform that action at this time.
0 commit comments