Skip to content

Commit 3bc5c97

Browse files
committed
qml: add and wire par (script threads) settings to OptionsModel backend
1 parent 217a5cf commit 3bc5c97

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/qml/components/DeveloperOptions.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ ColumnLayout {
3939
header: qsTr("Script verification threads")
4040
actionItem: ValueInput {
4141
parentState: parSetting.state
42-
description: ("0")
42+
description: optionsModel.scriptThreads
43+
onEditingFinished: optionsModel.scriptThreads = parseInt(text)
4344
}
4445
onClicked: loadedItem.forceActiveFocus()
4546
}

src/qml/options_model.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <univalue.h>
1212
#include <util/settings.h>
1313
#include <util/system.h>
14+
#include <validation.h>
1415

1516
#include <cassert>
1617

@@ -22,6 +23,8 @@ OptionsQmlModel::OptionsQmlModel(interfaces::Node& node)
2223
int64_t prune_value{SettingToInt(m_node.getPersistentSetting("prune"), 0)};
2324
m_prune = (prune_value > 1);
2425
m_prune_size_gb = m_prune ? PruneMiBtoGB(prune_value) : DEFAULT_PRUNE_TARGET_GB;
26+
27+
m_script_threads = SettingToInt(m_node.getPersistentSetting("par"), DEFAULT_SCRIPTCHECK_THREADS);
2528
}
2629

2730
void OptionsQmlModel::setDbcacheSizeMiB(int new_dbcache_size_mib)
@@ -69,6 +72,15 @@ void OptionsQmlModel::setPruneSizeGB(int new_prune_size_gb)
6972
}
7073
}
7174

75+
void OptionsQmlModel::setScriptThreads(int new_script_threads)
76+
{
77+
if (new_script_threads != m_script_threads) {
78+
m_script_threads = new_script_threads;
79+
m_node.updateRwSetting("par", new_script_threads);
80+
Q_EMIT scriptThreadsChanged(new_script_threads);
81+
}
82+
}
83+
7284
void OptionsQmlModel::setServer(bool new_server)
7385
{
7486
if (new_server != m_server) {

src/qml/options_model.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class OptionsQmlModel : public QObject
2222
Q_PROPERTY(bool natpmp READ natpmp WRITE setNatpmp NOTIFY natpmpChanged)
2323
Q_PROPERTY(bool prune READ prune WRITE setPrune NOTIFY pruneChanged)
2424
Q_PROPERTY(int pruneSizeGB READ pruneSizeGB WRITE setPruneSizeGB NOTIFY pruneSizeGBChanged)
25+
Q_PROPERTY(int scriptThreads READ scriptThreads WRITE setScriptThreads NOTIFY scriptThreadsChanged)
2526
Q_PROPERTY(bool server READ server WRITE setServer NOTIFY serverChanged)
2627
Q_PROPERTY(bool upnp READ upnp WRITE setUpnp NOTIFY upnpChanged)
2728

@@ -38,6 +39,8 @@ class OptionsQmlModel : public QObject
3839
void setPrune(bool new_prune);
3940
int pruneSizeGB() const { return m_prune_size_gb; }
4041
void setPruneSizeGB(int new_prune_size);
42+
int scriptThreads() const { return m_script_threads; }
43+
void setScriptThreads(int new_script_threads);
4144
bool server() const { return m_server; }
4245
void setServer(bool new_server);
4346
bool upnp() const { return m_upnp; }
@@ -49,6 +52,7 @@ class OptionsQmlModel : public QObject
4952
void natpmpChanged(bool new_natpmp);
5053
void pruneChanged(bool new_prune);
5154
void pruneSizeGBChanged(int new_prune_size_gb);
55+
void scriptThreadsChanged(int new_script_threads);
5256
void serverChanged(bool new_server);
5357
void upnpChanged(bool new_upnp);
5458

@@ -61,6 +65,7 @@ class OptionsQmlModel : public QObject
6165
bool m_natpmp;
6266
bool m_prune;
6367
int m_prune_size_gb;
68+
int m_script_threads;
6469
bool m_server;
6570
bool m_upnp;
6671

0 commit comments

Comments
 (0)