Browse Source

[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
0.10
Philip Kaufmann 11 years ago
parent
commit
834e14e57f
  1. 77
      src/qt/forms/sendcoinsdialog.ui
  2. 21
      src/qt/sendcoinsdialog.cpp

77
src/qt/forms/sendcoinsdialog.ui

@ -39,7 +39,7 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayoutCoinControl2"> <layout class="QVBoxLayout" name="verticalLayoutCoinControl2">
<property name="spacing"> <property name="spacing">
<number>-1</number> <number>0</number>
</property> </property>
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
@ -173,7 +173,16 @@
<string notr="true"/> <string notr="true"/>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayoutCoinControl5"> <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> <number>0</number>
</property> </property>
<item> <item>
@ -219,12 +228,6 @@
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="labelCoinControlQuantity"> <widget class="QLabel" name="labelCoinControlQuantity">
<property name="font">
<font>
<family>Monospace</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -254,12 +257,6 @@
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLabel" name="labelCoinControlBytes"> <widget class="QLabel" name="labelCoinControlBytes">
<property name="font">
<font>
<family>Monospace</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -308,12 +305,6 @@
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="labelCoinControlAmount"> <widget class="QLabel" name="labelCoinControlAmount">
<property name="font">
<font>
<family>Monospace</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -340,12 +331,6 @@
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLabel" name="labelCoinControlPriority"> <widget class="QLabel" name="labelCoinControlPriority">
<property name="font">
<font>
<family>Monospace</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -394,12 +379,6 @@
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="labelCoinControlFee"> <widget class="QLabel" name="labelCoinControlFee">
<property name="font">
<font>
<family>Monospace</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -426,12 +405,6 @@
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLabel" name="labelCoinControlLowOutput"> <widget class="QLabel" name="labelCoinControlLowOutput">
<property name="font">
<font>
<family>Monospace</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -480,12 +453,6 @@
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="labelCoinControlAfterFee"> <widget class="QLabel" name="labelCoinControlAfterFee">
<property name="font">
<font>
<family>Monospace</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -512,12 +479,6 @@
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLabel" name="labelCoinControlChange"> <widget class="QLabel" name="labelCoinControlChange">
<property name="font">
<font>
<family>Monospace</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -555,13 +516,16 @@
</property> </property>
<item> <item>
<widget class="QCheckBox" name="checkBoxCoinControlChange"> <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"> <property name="text">
<string>custom change address</string> <string>Custom change address</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="lineEditCoinControlChange"> <widget class="QValidatedLineEdit" name="lineEditCoinControlChange">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -626,7 +590,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>830</width> <width>830</width>
<height>165</height> <height>178</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1"> <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
@ -778,6 +742,13 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>QValidatedLineEdit</class>
<extends>QLineEdit</extends>
<header>qvalidatedlineedit.h</header>
</customwidget>
</customwidgets>
<resources> <resources>
<include location="../bitcoin.qrc"/> <include location="../bitcoin.qrc"/>
</resources> </resources>

21
src/qt/sendcoinsdialog.cpp

@ -529,16 +529,17 @@ void SendCoinsDialog::coinControlButtonClicked()
// Coin Control: checkbox custom change address // Coin Control: checkbox custom change address
void SendCoinsDialog::coinControlChangeChecked(int state) void SendCoinsDialog::coinControlChangeChecked(int state)
{ {
if (model) if (state == Qt::Unchecked)
{ {
if (state == Qt::Checked) CoinControlDialog::coinControl->destChange = CNoDestination();
CoinControlDialog::coinControl->destChange = CBitcoinAddress(ui->lineEditCoinControlChange->text().toStdString()).Get(); ui->lineEditCoinControlChange->setValid(true);
else ui->labelCoinControlChangeLabel->clear();
CoinControlDialog::coinControl->destChange = CNoDestination();
} }
else
// use this to re-validate an already entered address
coinControlChangeEdited(ui->lineEditCoinControlChange->text());
ui->lineEditCoinControlChange->setEnabled((state == Qt::Checked)); ui->lineEditCoinControlChange->setEnabled((state == Qt::Checked));
ui->labelCoinControlChangeLabel->setVisible((state == Qt::Checked));
} }
// Coin Control: custom change address changed // Coin Control: custom change address changed
@ -554,6 +555,10 @@ void SendCoinsDialog::coinControlChangeEdited(const QString & text)
ui->labelCoinControlChangeLabel->setText(""); ui->labelCoinControlChangeLabel->setText("");
else if (!CBitcoinAddress(text.toStdString()).IsValid()) 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->setStyleSheet("QLabel{color:red;}");
ui->labelCoinControlChangeLabel->setText(tr("Warning: Invalid Bitcoin address")); ui->labelCoinControlChangeLabel->setText(tr("Warning: Invalid Bitcoin address"));
} }
@ -571,6 +576,10 @@ void SendCoinsDialog::coinControlChangeEdited(const QString & text)
ui->labelCoinControlChangeLabel->setText(tr("(no label)")); ui->labelCoinControlChangeLabel->setText(tr("(no label)"));
else else
{ {
// unknown change address
CoinControlDialog::coinControl->destChange = CNoDestination();
ui->lineEditCoinControlChange->setValid(false);
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}"); ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}");
ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address")); ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address"));
} }

Loading…
Cancel
Save