Merge pull request #3285

d3207b6 [Qt] coin-control features GUI cleanup 3 (Philip Kaufmann)
834e14e [Qt] coin-control features GUI cleanup 2 (Philip Kaufmann)
This commit is contained in:
Wladimir J. van der Laan 2013-12-03 17:26:39 +01:00
commit f15bd3c96f
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
4 changed files with 147 additions and 101 deletions

View File

@ -590,7 +590,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
l4->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAfterFee)); // After Fee
l5->setText(((nBytes > 0) ? "~" : "") + QString::number(nBytes)); // Bytes
l6->setText(sPriorityLabel); // Priority
l7->setText((fLowOutput ? (fDust ? tr("DUST") : tr("yes")) : tr("no"))); // Low Output / Dust
l7->setText((fLowOutput ? (fDust ? tr("Dust") : tr("yes")) : tr("no"))); // Low Output / Dust
l8->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nChange)); // Change
// turn labels "red"
@ -600,10 +600,25 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
l8->setStyleSheet((nChange > 0 && nChange < CENT) ? "color:red;" : ""); // Change < 0.01BTC
// tool tips
l5->setToolTip(tr("This label turns red, if the transaction size is bigger than 1000 bytes.\n\n This means a fee of at least %1 per kb is required.\n\n Can vary +/- 1 Byte per input.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)));
l6->setToolTip(tr("Transactions with higher priority get more likely into a block.\n\nThis label turns red, if the priority is smaller than \"medium\".\n\n This means a fee of at least %1 per kb is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)));
l7->setToolTip(tr("This label turns red, if any recipient receives an amount smaller than %1.\n\n This means a fee of at least %2 is required. \n\n Amounts below 0.546 times the minimum relay fee are shown as DUST.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)).arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)));
l8->setToolTip(tr("This label turns red, if the change is smaller than %1.\n\n This means a fee of at least %2 is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)).arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)));
QString toolTip1 = tr("This label turns red, if the transaction size is greater than 1000 bytes.") + "<br /><br />";
toolTip1 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)) + "<br /><br />";
toolTip1 += tr("Can vary +/- 1 byte per input.");
QString toolTip2 = tr("Transactions with higher priority are more likely to get included into a block.") + "<br /><br />";
toolTip2 += tr("This label turns red, if the priority is smaller than \"medium\"") + "<br /><br />";
toolTip2 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee));
QString toolTip3 = tr("This label turns red, if any recipient receives an amount smaller than %1.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)) + "<br /><br />";
toolTip3 += tr("This means a fee of at least %1 is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)) + "<br /><br />";
toolTip3 += tr("Amounts below 0.546 times the minimum relay fee are shown as dust.");
QString toolTip4 = tr("This label turns red, if the change is smaller than %1.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)) + "<br /><br />";
toolTip4 += tr("This means a fee of at least %1 is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee));
l5->setToolTip(toolTip1);
l6->setToolTip(toolTip2);
l7->setToolTip(toolTip3);
l8->setToolTip(toolTip4);
dialog->findChild<QLabel *>("labelCoinControlBytesText") ->setToolTip(l5->toolTip());
dialog->findChild<QLabel *>("labelCoinControlPriorityText") ->setToolTip(l6->toolTip());
dialog->findChild<QLabel *>("labelCoinControlLowOutputText")->setToolTip(l7->toolTip());

View File

@ -38,8 +38,11 @@
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelCoinControlQuantityText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Quantity:</string>
@ -64,8 +67,11 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelCoinControlBytesText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Bytes:</string>
@ -106,8 +112,11 @@
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelCoinControlAmountText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Amount:</string>
@ -132,8 +141,11 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelCoinControlPriorityText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Priority:</string>
@ -148,6 +160,9 @@
<property name="contextMenuPolicy">
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="text">
<string notr="true">medium</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
@ -171,8 +186,11 @@
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelCoinControlFeeText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Fee:</string>
@ -200,8 +218,11 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Low Output:</string>
@ -220,7 +241,7 @@
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="text">
<string>no</string>
<string notr="true">no</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
@ -245,8 +266,11 @@
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelCoinControlAfterFeeText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>After Fee:</string>
@ -274,8 +298,11 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Change:</string>
@ -377,7 +404,7 @@
<item>
<widget class="QLabel" name="labelLocked">
<property name="text">
<string>(1 locked)</string>
<string notr="true">(1 locked)</string>
</property>
</widget>
</item>

View File

@ -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>
@ -206,8 +215,11 @@
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelCoinControlQuantityText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Quantity:</string>
@ -219,12 +231,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>
@ -244,8 +250,11 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelCoinControlBytesText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Bytes:</string>
@ -254,12 +263,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>
@ -295,8 +298,11 @@
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelCoinControlAmountText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Amount:</string>
@ -308,12 +314,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>
@ -330,8 +330,11 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelCoinControlPriorityText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Priority:</string>
@ -340,12 +343,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>
@ -353,7 +350,7 @@
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="text">
<string>medium</string>
<string notr="true">medium</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
@ -381,8 +378,11 @@
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelCoinControlFeeText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Fee:</string>
@ -394,12 +394,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>
@ -416,8 +410,11 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelCoinControlLowOutputText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Low Output:</string>
@ -426,12 +423,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>
@ -439,7 +430,7 @@
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="text">
<string>no</string>
<string notr="true">no</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
@ -467,8 +458,11 @@
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelCoinControlAfterFeeText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>After Fee:</string>
@ -480,12 +474,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>
@ -502,8 +490,11 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelCoinControlChangeText">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Change:</string>
@ -512,12 +503,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 +540,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 +614,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">
@ -729,7 +717,7 @@
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>123.456 BTC</string>
<string notr="true">123.456 BTC</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
@ -778,6 +766,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QValidatedLineEdit</class>
<extends>QLineEdit</extends>
<header>qvalidatedlineedit.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../bitcoin.qrc"/>
</resources>

View File

@ -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"));
}