Skip to content

Commit 834e14e

Browse files
author
Philip Kaufmann
committed
[Qt] coin-control features GUI cleanup 2
- remove monospace labels from sendcoinsdialog also - use a validated line edit for the change address - add a tooltip to change address switch - ensure we have a valid change address in CoinControlDialog::coinControl->destChange or just CNoDestination() - some small ui file changes
1 parent 9ab7a06 commit 834e14e

File tree

2 files changed

+39
-59
lines changed

2 files changed

+39
-59
lines changed

src/qt/forms/sendcoinsdialog.ui

Lines changed: 24 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
</property>
4040
<layout class="QVBoxLayout" name="verticalLayoutCoinControl2">
4141
<property name="spacing">
42-
<number>-1</number>
42+
<number>0</number>
4343
</property>
4444
<property name="leftMargin">
4545
<number>0</number>
@@ -173,7 +173,16 @@
173173
<string notr="true"/>
174174
</property>
175175
<layout class="QHBoxLayout" name="horizontalLayoutCoinControl5">
176-
<property name="margin">
176+
<property name="leftMargin">
177+
<number>0</number>
178+
</property>
179+
<property name="topMargin">
180+
<number>0</number>
181+
</property>
182+
<property name="rightMargin">
183+
<number>0</number>
184+
</property>
185+
<property name="bottomMargin">
177186
<number>0</number>
178187
</property>
179188
<item>
@@ -219,12 +228,6 @@
219228
</item>
220229
<item row="0" column="1">
221230
<widget class="QLabel" name="labelCoinControlQuantity">
222-
<property name="font">
223-
<font>
224-
<family>Monospace</family>
225-
<pointsize>10</pointsize>
226-
</font>
227-
</property>
228231
<property name="cursor">
229232
<cursorShape>IBeamCursor</cursorShape>
230233
</property>
@@ -254,12 +257,6 @@
254257
</item>
255258
<item row="1" column="1">
256259
<widget class="QLabel" name="labelCoinControlBytes">
257-
<property name="font">
258-
<font>
259-
<family>Monospace</family>
260-
<pointsize>10</pointsize>
261-
</font>
262-
</property>
263260
<property name="cursor">
264261
<cursorShape>IBeamCursor</cursorShape>
265262
</property>
@@ -308,12 +305,6 @@
308305
</item>
309306
<item row="0" column="1">
310307
<widget class="QLabel" name="labelCoinControlAmount">
311-
<property name="font">
312-
<font>
313-
<family>Monospace</family>
314-
<pointsize>10</pointsize>
315-
</font>
316-
</property>
317308
<property name="cursor">
318309
<cursorShape>IBeamCursor</cursorShape>
319310
</property>
@@ -340,12 +331,6 @@
340331
</item>
341332
<item row="1" column="1">
342333
<widget class="QLabel" name="labelCoinControlPriority">
343-
<property name="font">
344-
<font>
345-
<family>Monospace</family>
346-
<pointsize>10</pointsize>
347-
</font>
348-
</property>
349334
<property name="cursor">
350335
<cursorShape>IBeamCursor</cursorShape>
351336
</property>
@@ -394,12 +379,6 @@
394379
</item>
395380
<item row="0" column="1">
396381
<widget class="QLabel" name="labelCoinControlFee">
397-
<property name="font">
398-
<font>
399-
<family>Monospace</family>
400-
<pointsize>10</pointsize>
401-
</font>
402-
</property>
403382
<property name="cursor">
404383
<cursorShape>IBeamCursor</cursorShape>
405384
</property>
@@ -426,12 +405,6 @@
426405
</item>
427406
<item row="1" column="1">
428407
<widget class="QLabel" name="labelCoinControlLowOutput">
429-
<property name="font">
430-
<font>
431-
<family>Monospace</family>
432-
<pointsize>10</pointsize>
433-
</font>
434-
</property>
435408
<property name="cursor">
436409
<cursorShape>IBeamCursor</cursorShape>
437410
</property>
@@ -480,12 +453,6 @@
480453
</item>
481454
<item row="0" column="1">
482455
<widget class="QLabel" name="labelCoinControlAfterFee">
483-
<property name="font">
484-
<font>
485-
<family>Monospace</family>
486-
<pointsize>10</pointsize>
487-
</font>
488-
</property>
489456
<property name="cursor">
490457
<cursorShape>IBeamCursor</cursorShape>
491458
</property>
@@ -512,12 +479,6 @@
512479
</item>
513480
<item row="1" column="1">
514481
<widget class="QLabel" name="labelCoinControlChange">
515-
<property name="font">
516-
<font>
517-
<family>Monospace</family>
518-
<pointsize>10</pointsize>
519-
</font>
520-
</property>
521482
<property name="cursor">
522483
<cursorShape>IBeamCursor</cursorShape>
523484
</property>
@@ -555,13 +516,16 @@
555516
</property>
556517
<item>
557518
<widget class="QCheckBox" name="checkBoxCoinControlChange">
519+
<property name="toolTip">
520+
<string>If this is activated, but the change address is empty or invalid, change will be sent to a newly generated address.</string>
521+
</property>
558522
<property name="text">
559-
<string>custom change address</string>
523+
<string>Custom change address</string>
560524
</property>
561525
</widget>
562526
</item>
563527
<item>
564-
<widget class="QLineEdit" name="lineEditCoinControlChange">
528+
<widget class="QValidatedLineEdit" name="lineEditCoinControlChange">
565529
<property name="enabled">
566530
<bool>false</bool>
567531
</property>
@@ -626,7 +590,7 @@
626590
<x>0</x>
627591
<y>0</y>
628592
<width>830</width>
629-
<height>165</height>
593+
<height>178</height>
630594
</rect>
631595
</property>
632596
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
@@ -778,6 +742,13 @@
778742
</item>
779743
</layout>
780744
</widget>
745+
<customwidgets>
746+
<customwidget>
747+
<class>QValidatedLineEdit</class>
748+
<extends>QLineEdit</extends>
749+
<header>qvalidatedlineedit.h</header>
750+
</customwidget>
751+
</customwidgets>
781752
<resources>
782753
<include location="../bitcoin.qrc"/>
783754
</resources>

src/qt/sendcoinsdialog.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -529,16 +529,17 @@ void SendCoinsDialog::coinControlButtonClicked()
529529
// Coin Control: checkbox custom change address
530530
void SendCoinsDialog::coinControlChangeChecked(int state)
531531
{
532-
if (model)
532+
if (state == Qt::Unchecked)
533533
{
534-
if (state == Qt::Checked)
535-
CoinControlDialog::coinControl->destChange = CBitcoinAddress(ui->lineEditCoinControlChange->text().toStdString()).Get();
536-
else
537-
CoinControlDialog::coinControl->destChange = CNoDestination();
534+
CoinControlDialog::coinControl->destChange = CNoDestination();
535+
ui->lineEditCoinControlChange->setValid(true);
536+
ui->labelCoinControlChangeLabel->clear();
538537
}
538+
else
539+
// use this to re-validate an already entered address
540+
coinControlChangeEdited(ui->lineEditCoinControlChange->text());
539541

540542
ui->lineEditCoinControlChange->setEnabled((state == Qt::Checked));
541-
ui->labelCoinControlChangeLabel->setVisible((state == Qt::Checked));
542543
}
543544

544545
// Coin Control: custom change address changed
@@ -554,6 +555,10 @@ void SendCoinsDialog::coinControlChangeEdited(const QString & text)
554555
ui->labelCoinControlChangeLabel->setText("");
555556
else if (!CBitcoinAddress(text.toStdString()).IsValid())
556557
{
558+
// invalid change address
559+
CoinControlDialog::coinControl->destChange = CNoDestination();
560+
561+
ui->lineEditCoinControlChange->setValid(false);
557562
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}");
558563
ui->labelCoinControlChangeLabel->setText(tr("Warning: Invalid Bitcoin address"));
559564
}
@@ -571,6 +576,10 @@ void SendCoinsDialog::coinControlChangeEdited(const QString & text)
571576
ui->labelCoinControlChangeLabel->setText(tr("(no label)"));
572577
else
573578
{
579+
// unknown change address
580+
CoinControlDialog::coinControl->destChange = CNoDestination();
581+
582+
ui->lineEditCoinControlChange->setValid(false);
574583
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}");
575584
ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address"));
576585
}

0 commit comments

Comments
 (0)