Merge pull request #2991 from Diapolo/translation_fixes

Bitcoin-Qt: translation fixes in sendcoins
This commit is contained in:
Wladimir J. van der Laan 2013-10-01 08:18:48 -07:00
commit b63ae2a534
4 changed files with 61 additions and 66 deletions

View File

@ -10,19 +10,13 @@
<height>150</height> <height>150</height>
</rect> </rect>
</property> </property>
<property name="windowTitle">
<string>StackedWidget</string>
</property>
<property name="autoFillBackground"> <property name="autoFillBackground">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QFrame" name="SendCoinsInsecure"> <widget class="QFrame" name="SendCoinsInsecure">
<property name="windowTitle">
<string>Form</string>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
@ -34,7 +28,7 @@
<number>12</number> <number>12</number>
</property> </property>
<item row="5" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="amountLabel">
<property name="text"> <property name="text">
<string>A&amp;mount:</string> <string>A&amp;mount:</string>
</property> </property>
@ -47,7 +41,7 @@
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="payToLabel">
<property name="text"> <property name="text">
<string>Pay &amp;To:</string> <string>Pay &amp;To:</string>
</property> </property>
@ -63,7 +57,7 @@
<widget class="BitcoinAmountField" name="payAmount"/> <widget class="BitcoinAmountField" name="payAmount"/>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="labellLabel">
<property name="text"> <property name="text">
<string>&amp;Label:</string> <string>&amp;Label:</string>
</property> </property>
@ -592,9 +586,6 @@
</disabled> </disabled>
</palette> </palette>
</property> </property>
<property name="windowTitle">
<string>SecureSend</string>
</property>
<property name="autoFillBackground"> <property name="autoFillBackground">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -609,7 +600,7 @@
<number>12</number> <number>12</number>
</property> </property>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_s4"> <widget class="QLabel" name="memoLabel_s">
<property name="text"> <property name="text">
<string>Memo:</string> <string>Memo:</string>
</property> </property>
@ -622,7 +613,7 @@
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label_s1"> <widget class="QLabel" name="amountLabel_s">
<property name="text"> <property name="text">
<string>A&amp;mount:</string> <string>A&amp;mount:</string>
</property> </property>
@ -635,7 +626,7 @@
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_s2"> <widget class="QLabel" name="payToLabel_s">
<property name="text"> <property name="text">
<string>Pay &amp;To:</string> <string>Pay &amp;To:</string>
</property> </property>
@ -667,14 +658,17 @@
</property> </property>
<item> <item>
<widget class="QLabel" name="payTo_s"> <widget class="QLabel" name="payTo_s">
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="2"> <item row="4" column="2">
<widget class="QLabel" name="memo_s"> <widget class="QLabel" name="memoTextLabel_s">
<property name="text"> <property name="textFormat">
<string>message from merchant</string> <enum>Qt::PlainText</enum>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -94,27 +94,33 @@ void SendCoinsDialog::on_sendButton_clicked()
QStringList formatted; QStringList formatted;
foreach(const SendCoinsRecipient &rcp, recipients) foreach(const SendCoinsRecipient &rcp, recipients)
{ {
QString amount = BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount); // generate bold amount string
QString amount = "<b>" + BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount);
amount.append("</b>");
// generate monospace address string
QString address = "<span style='font-family: monospace;'>" + rcp.address;
address.append("</span>");
QString recipientElement;
if (rcp.authenticatedMerchant.isEmpty()) if (rcp.authenticatedMerchant.isEmpty())
{ {
QString recipientElement = QString("<b>%1</b> ").arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount)); if(rcp.label.length() > 0) // label with address
recipientElement.append(tr("to"));
if(rcp.label.length() > 0)
{ {
recipientElement.append(QString(" %1 <span style='font-size:8px;'>%2</span><br />").arg(GUIUtil::HtmlEscape(rcp.label), rcp.address)); // add address with label recipientElement = tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.label));
recipientElement.append(QString(" (%1)").arg(address));
} }
else else // just address
{ {
recipientElement.append(QString(" %1<br />").arg(rcp.address)); // add address WITHOUT label recipientElement = tr("%1 to %2").arg(amount, address);
} }
formatted.append(recipientElement);
} }
else else // just merchant
{ {
QString merchant = GUIUtil::HtmlEscape(rcp.authenticatedMerchant); recipientElement = tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.authenticatedMerchant));
formatted.append(tr("<b>%1</b> to %2").arg(amount, merchant));
} }
formatted.append(recipientElement);
} }
fNewRecipientAllowed = false; fNewRecipientAllowed = false;
@ -132,42 +138,38 @@ void SendCoinsDialog::on_sendButton_clicked()
WalletModelTransaction currentTransaction(recipients); WalletModelTransaction currentTransaction(recipients);
WalletModel::SendCoinsReturn prepareStatus = model->prepareTransaction(currentTransaction); WalletModel::SendCoinsReturn prepareStatus = model->prepareTransaction(currentTransaction);
QString strSendCoins = tr("Send Coins");
switch(prepareStatus.status) switch(prepareStatus.status)
{ {
case WalletModel::InvalidAddress: case WalletModel::InvalidAddress:
QMessageBox::warning(this, tr("Send Coins"), QMessageBox::warning(this, strSendCoins,
tr("The recipient address is not valid, please recheck."), tr("The recipient address is not valid, please recheck."));
QMessageBox::Ok, QMessageBox::Ok);
break; break;
case WalletModel::InvalidAmount: case WalletModel::InvalidAmount:
QMessageBox::warning(this, tr("Send Coins"), QMessageBox::warning(this, strSendCoins,
tr("The amount to pay must be larger than 0."), tr("The amount to pay must be larger than 0."));
QMessageBox::Ok, QMessageBox::Ok);
break; break;
case WalletModel::AmountExceedsBalance: case WalletModel::AmountExceedsBalance:
QMessageBox::warning(this, tr("Send Coins"), QMessageBox::warning(this, strSendCoins,
tr("The amount exceeds your balance."), tr("The amount exceeds your balance."));
QMessageBox::Ok, QMessageBox::Ok);
break; break;
case WalletModel::AmountWithFeeExceedsBalance: case WalletModel::AmountWithFeeExceedsBalance:
QMessageBox::warning(this, tr("Send Coins"), QMessageBox::warning(this, strSendCoins,
tr("The total exceeds your balance when the %1 transaction fee is included."). tr("The total exceeds your balance when the %1 transaction fee is included.").
arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), currentTransaction.getTransactionFee())), arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), currentTransaction.getTransactionFee())));
QMessageBox::Ok, QMessageBox::Ok);
break; break;
case WalletModel::DuplicateAddress: case WalletModel::DuplicateAddress:
QMessageBox::warning(this, tr("Send Coins"), QMessageBox::warning(this, strSendCoins,
tr("Duplicate address found, can only send to each address once per send operation."), tr("Duplicate address found, can only send to each address once per send operation."));
QMessageBox::Ok, QMessageBox::Ok);
break; break;
case WalletModel::TransactionCreationFailed: case WalletModel::TransactionCreationFailed:
QMessageBox::warning(this, tr("Send Coins"), QMessageBox::warning(this, strSendCoins,
tr("Error: Transaction creation failed!"), tr("Error: Transaction creation failed!"));
QMessageBox::Ok, QMessageBox::Ok);
break; break;
case WalletModel::Aborted: // User aborted, nothing to do
case WalletModel::OK:
case WalletModel::TransactionCommitFailed: case WalletModel::TransactionCommitFailed:
case WalletModel::OK:
case WalletModel::Aborted: // User aborted, nothing to do
default:
break; break;
} }
@ -197,7 +199,7 @@ void SendCoinsDialog::on_sendButton_clicked()
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm send coins"), QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm send coins"),
questionString.arg(formatted.join("<br />")), questionString.arg(formatted.join("<br />")),
QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Cancel); QMessageBox::Cancel);
if(retval != QMessageBox::Yes) if(retval != QMessageBox::Yes)
@ -211,15 +213,13 @@ void SendCoinsDialog::on_sendButton_clicked()
switch(sendstatus.status) switch(sendstatus.status)
{ {
case WalletModel::TransactionCommitFailed: case WalletModel::TransactionCommitFailed:
QMessageBox::warning(this, tr("Send Coins"), QMessageBox::warning(this, strSendCoins,
tr("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."), tr("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."));
QMessageBox::Ok, QMessageBox::Ok);
break;
case WalletModel::Aborted: // User aborted, nothing to do
break; break;
case WalletModel::OK: case WalletModel::OK:
accept(); accept();
break; break;
case WalletModel::Aborted: // User aborted, nothing to do
default: default:
break; break;
} }
@ -351,13 +351,14 @@ void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv)
bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv) bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv)
{ {
QString strSendCoins = tr("Send Coins");
if (!rv.authenticatedMerchant.isEmpty()) { if (!rv.authenticatedMerchant.isEmpty()) {
// Expired payment request? // Expired payment request?
const payments::PaymentDetails& details = rv.paymentRequest.getDetails(); const payments::PaymentDetails& details = rv.paymentRequest.getDetails();
if (details.has_expires() && (int64)details.expires() < GetTime()) if (details.has_expires() && (int64)details.expires() < GetTime())
{ {
QMessageBox::warning(this, tr("Send Coins"), QMessageBox::warning(this, strSendCoins,
tr("Payment request expired")); tr("Payment request expired"));
return false; return false;
} }
} }
@ -365,8 +366,8 @@ bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv)
CBitcoinAddress address(rv.address.toStdString()); CBitcoinAddress address(rv.address.toStdString());
if (!address.IsValid()) { if (!address.IsValid()) {
QString strAddress(address.ToString().c_str()); QString strAddress(address.ToString().c_str());
QMessageBox::warning(this, tr("Send Coins"), QMessageBox::warning(this, strSendCoins,
tr("Invalid payment address %1").arg(strAddress)); tr("Invalid payment address %1").arg(strAddress));
return false; return false;
} }
} }

View File

@ -106,8 +106,8 @@ bool SendCoinsEntry::validate()
if (!recipient.authenticatedMerchant.isEmpty()) if (!recipient.authenticatedMerchant.isEmpty())
return retval; return retval;
if(!ui->payTo->hasAcceptableInput() || if (!ui->payTo->hasAcceptableInput() ||
(model && !model->validateAddress(ui->payTo->text()))) (model && !model->validateAddress(ui->payTo->text())))
{ {
ui->payTo->setValid(false); ui->payTo->setValid(false);
retval = false; retval = false;
@ -163,8 +163,7 @@ void SendCoinsEntry::setValue(const SendCoinsRecipient &value)
const payments::PaymentDetails& details = value.paymentRequest.getDetails(); const payments::PaymentDetails& details = value.paymentRequest.getDetails();
ui->payTo_s->setText(value.authenticatedMerchant); ui->payTo_s->setText(value.authenticatedMerchant);
ui->memo_s->setTextFormat(Qt::PlainText); ui->memoTextLabel_s->setText(QString::fromStdString(details.memo()));
ui->memo_s->setText(QString::fromStdString(details.memo()));
ui->payAmount_s->setValue(value.amount); ui->payAmount_s->setValue(value.amount);
setCurrentWidget(ui->SendCoinsSecure); setCurrentWidget(ui->SendCoinsSecure);
} }

View File

@ -33,7 +33,8 @@ public:
void setValue(const SendCoinsRecipient &value); void setValue(const SendCoinsRecipient &value);
void setAddress(const QString &address); void setAddress(const QString &address);
/** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907). /** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases
* (issue https://bugreports.qt-project.org/browse/QTBUG-10907).
*/ */
QWidget *setupTabChain(QWidget *prev); QWidget *setupTabChain(QWidget *prev);