Skip to content

Commit 28cd645

Browse files
committed
gui: add external signer path to options dialog
1 parent 2b45cf0 commit 28cd645

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

src/qt/forms/optionsdialog.ui

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,36 @@
242242
</property>
243243
</spacer>
244244
</item>
245+
<item>
246+
<widget class="QGroupBox" name="groupBoxHww">
247+
<property name="title">
248+
<string>External Signer (e.g. hardware wallet)</string>
249+
</property>
250+
<layout class="QVBoxLayout" name="verticalLayoutHww">
251+
<item>
252+
<layout class="QHBoxLayout" name="horizontalLayoutHww">
253+
<item>
254+
<widget class="QLabel" name="externalSignerPathLabel">
255+
<property name="text">
256+
<string>&amp;External signer script path</string>
257+
</property>
258+
<property name="buddy">
259+
<cstring>externalSignerPath</cstring>
260+
</property>
261+
</widget>
262+
</item>
263+
<item>
264+
<widget class="QLineEdit" name="externalSignerPath">
265+
<property name="toolTip">
266+
<string>Full path to a Bitcoin Core compatible script (e.g. C:\Downloads\hwi.exe or /Users/you/Downloads/hwi.py). Beware: malware can steal your coins!</string>
267+
</property>
268+
</widget>
269+
</item>
270+
</layout>
271+
</item>
272+
</layout>
273+
</widget>
274+
</item>
245275
</layout>
246276
</widget>
247277
<widget class="QWidget" name="tabNetwork">

src/qt/optionsdialog.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ void OptionsDialog::setModel(OptionsModel *_model)
199199
connect(ui->prune, &QCheckBox::clicked, this, &OptionsDialog::togglePruneWarning);
200200
connect(ui->pruneSize, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning);
201201
connect(ui->databaseCache, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning);
202+
connect(ui->externalSignerPath, &QLineEdit::textChanged, [this]{ showRestartWarning(); });
202203
connect(ui->threadsScriptVerif, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning);
203204
/* Wallet */
204205
connect(ui->spendZeroConfChange, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning);
@@ -233,6 +234,7 @@ void OptionsDialog::setMapper()
233234
/* Wallet */
234235
mapper->addMapping(ui->spendZeroConfChange, OptionsModel::SpendZeroConfChange);
235236
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
237+
mapper->addMapping(ui->externalSignerPath, OptionsModel::ExternalSignerPath);
236238

237239
/* Network */
238240
mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP);

src/qt/optionsmodel.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ void OptionsModel::Init(bool resetSettings)
116116
settings.setValue("bSpendZeroConfChange", true);
117117
if (!gArgs.SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool()))
118118
addOverriddenOption("-spendzeroconfchange");
119+
120+
if (!settings.contains("strExternalSignerPath"))
121+
settings.setValue("strExternalSignerPath", "");
122+
123+
if (!gArgs.SoftSetArg("-signer", settings.value("strExternalSignerPath").toString().toStdString())) {
124+
addOverriddenOption("-signer");
125+
}
119126
#endif
120127

121128
// Network
@@ -325,6 +332,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
325332
#ifdef ENABLE_WALLET
326333
case SpendZeroConfChange:
327334
return settings.value("bSpendZeroConfChange");
335+
case ExternalSignerPath:
336+
return settings.value("strExternalSignerPath");
328337
#endif
329338
case DisplayUnit:
330339
return nDisplayUnit;
@@ -444,6 +453,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
444453
setRestartRequired(true);
445454
}
446455
break;
456+
case ExternalSignerPath:
457+
if (settings.value("strExternalSignerPath") != value.toString()) {
458+
settings.setValue("strExternalSignerPath", value.toString());
459+
setRestartRequired(true);
460+
}
461+
break;
447462
#endif
448463
case DisplayUnit:
449464
setDisplayUnit(value);

src/qt/optionsmodel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class OptionsModel : public QAbstractListModel
6565
Prune, // bool
6666
PruneSize, // int
6767
DatabaseCache, // int
68+
ExternalSignerPath, // QString
6869
SpendZeroConfChange, // bool
6970
Listen, // bool
7071
OptionIDRowCount,

0 commit comments

Comments
 (0)