diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2013-11-20 15:49:34 +0100 |
---|---|---|
committer | Philip Kaufmann <phil.kaufmann@t-online.de> | 2013-12-02 13:32:46 +0100 |
commit | 834e14e57f3c163bc898e6a89ce467d850ee4ea2 (patch) | |
tree | 12992c842598e6571d0202cd50a2efa38fa58232 /src | |
parent | 9ab7a0609ee920b1095235bc7460c9c0b60acf29 (diff) |
[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
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/forms/sendcoinsdialog.ui | 77 | ||||
-rw-r--r-- | src/qt/sendcoinsdialog.cpp | 21 |
2 files changed, 39 insertions, 59 deletions
diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 790d5d6c39..ad4aa52900 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -39,7 +39,7 @@ </property> <layout class="QVBoxLayout" name="verticalLayoutCoinControl2"> <property name="spacing"> - <number>-1</number> + <number>0</number> </property> <property name="leftMargin"> <number>0</number> @@ -173,7 +173,16 @@ <string notr="true"/> </property> <layout class="QHBoxLayout" name="horizontalLayoutCoinControl5"> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> @@ -219,12 +228,6 @@ </item> <item row="0" column="1"> <widget class="QLabel" name="labelCoinControlQuantity"> - <property name="font"> - <font> - <family>Monospace</family> - <pointsize>10</pointsize> - </font> - </property> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> </property> @@ -254,12 +257,6 @@ </item> <item row="1" column="1"> <widget class="QLabel" name="labelCoinControlBytes"> - <property name="font"> - <font> - <family>Monospace</family> - <pointsize>10</pointsize> - </font> - </property> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> </property> @@ -308,12 +305,6 @@ </item> <item row="0" column="1"> <widget class="QLabel" name="labelCoinControlAmount"> - <property name="font"> - <font> - <family>Monospace</family> - <pointsize>10</pointsize> - </font> - </property> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> </property> @@ -340,12 +331,6 @@ </item> <item row="1" column="1"> <widget class="QLabel" name="labelCoinControlPriority"> - <property name="font"> - <font> - <family>Monospace</family> - <pointsize>10</pointsize> - </font> - </property> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> </property> @@ -394,12 +379,6 @@ </item> <item row="0" column="1"> <widget class="QLabel" name="labelCoinControlFee"> - <property name="font"> - <font> - <family>Monospace</family> - <pointsize>10</pointsize> - </font> - </property> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> </property> @@ -426,12 +405,6 @@ </item> <item row="1" column="1"> <widget class="QLabel" name="labelCoinControlLowOutput"> - <property name="font"> - <font> - <family>Monospace</family> - <pointsize>10</pointsize> - </font> - </property> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> </property> @@ -480,12 +453,6 @@ </item> <item row="0" column="1"> <widget class="QLabel" name="labelCoinControlAfterFee"> - <property name="font"> - <font> - <family>Monospace</family> - <pointsize>10</pointsize> - </font> - </property> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> </property> @@ -512,12 +479,6 @@ </item> <item row="1" column="1"> <widget class="QLabel" name="labelCoinControlChange"> - <property name="font"> - <font> - <family>Monospace</family> - <pointsize>10</pointsize> - </font> - </property> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> </property> @@ -555,13 +516,16 @@ </property> <item> <widget class="QCheckBox" name="checkBoxCoinControlChange"> + <property name="toolTip"> + <string>If this is activated, but the change address is empty or invalid, change will be sent to a newly generated address.</string> + </property> <property name="text"> - <string>custom change address</string> + <string>Custom change address</string> </property> </widget> </item> <item> - <widget class="QLineEdit" name="lineEditCoinControlChange"> + <widget class="QValidatedLineEdit" name="lineEditCoinControlChange"> <property name="enabled"> <bool>false</bool> </property> @@ -626,7 +590,7 @@ <x>0</x> <y>0</y> <width>830</width> - <height>165</height> + <height>178</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1"> @@ -778,6 +742,13 @@ </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>QValidatedLineEdit</class> + <extends>QLineEdit</extends> + <header>qvalidatedlineedit.h</header> + </customwidget> + </customwidgets> <resources> <include location="../bitcoin.qrc"/> </resources> diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 6c3535b2fb..73cfa27c83 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -529,16 +529,17 @@ void SendCoinsDialog::coinControlButtonClicked() // Coin Control: checkbox custom change address void SendCoinsDialog::coinControlChangeChecked(int state) { - if (model) + if (state == Qt::Unchecked) { - if (state == Qt::Checked) - CoinControlDialog::coinControl->destChange = CBitcoinAddress(ui->lineEditCoinControlChange->text().toStdString()).Get(); - else - CoinControlDialog::coinControl->destChange = CNoDestination(); + CoinControlDialog::coinControl->destChange = CNoDestination(); + ui->lineEditCoinControlChange->setValid(true); + ui->labelCoinControlChangeLabel->clear(); } + else + // use this to re-validate an already entered address + coinControlChangeEdited(ui->lineEditCoinControlChange->text()); ui->lineEditCoinControlChange->setEnabled((state == Qt::Checked)); - ui->labelCoinControlChangeLabel->setVisible((state == Qt::Checked)); } // Coin Control: custom change address changed @@ -554,6 +555,10 @@ void SendCoinsDialog::coinControlChangeEdited(const QString & text) ui->labelCoinControlChangeLabel->setText(""); else if (!CBitcoinAddress(text.toStdString()).IsValid()) { + // invalid change address + CoinControlDialog::coinControl->destChange = CNoDestination(); + + ui->lineEditCoinControlChange->setValid(false); ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}"); ui->labelCoinControlChangeLabel->setText(tr("Warning: Invalid Bitcoin address")); } @@ -571,6 +576,10 @@ void SendCoinsDialog::coinControlChangeEdited(const QString & text) ui->labelCoinControlChangeLabel->setText(tr("(no label)")); else { + // unknown change address + CoinControlDialog::coinControl->destChange = CNoDestination(); + + ui->lineEditCoinControlChange->setValid(false); ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}"); ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address")); } |