mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-15 22:32:37 -03:00
68692d33c6
ac7ccd67d7
scripted-diff: Remove unused "What's This" button in dialogs on Windows (Hennadii Stepanov)b6951483ec
qt: Add flags to prevent a "What's This" button on Windows OS (Hennadii Stepanov) Pull request description: Fix #74. From [Qt docs](https://doc.qt.io/qt-5/qdialog.html#QDialog): > The widget flags _f_ are passed on to the `QWidget` constructor. If, for example, you don't want a **What's This** button in the title bar of the dialog, pass `Qt::WindowTitleHint | Qt::WindowSystemMenuHint` in _f_. Screenshot on Windows 10 (2004): - master (3ba25e3bdd
) ![Screenshot from 2020-09-07 16-55-42](https://user-images.githubusercontent.com/32963518/92402384-20dc6a00-f138-11ea-9dcb-3e0f6373ff22.png) - this PR (e322fe7e19ac504272d14b9b4f9b28b13df888ed) ![Screenshot from 2020-09-07 18-31-16](https://user-images.githubusercontent.com/32963518/92402509-5aad7080-f138-11ea-8b63-9bbbf8b9b9e1.png) ACKs for top commit: Bosch-0: tACKac7ccd67d7
Tested on Windows 10.0.18363 Build 18363. promag: Code review ACKac7ccd67d7
but with some suggestions. jonasschnelli: utACKac7ccd67d7
Tree-SHA512: f6750a17b7203106cb4db5870becba1cef6a505d4edcc710ba131338bd3aae051510627e62c9bcb8345a7f497c614709e11aeb8f6ae3ea85967bbce2a8c69e64
108 lines
2.9 KiB
C++
108 lines
2.9 KiB
C++
// Copyright (c) 2011-2020 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <qt/receiverequestdialog.h>
|
|
#include <qt/forms/ui_receiverequestdialog.h>
|
|
|
|
#include <qt/bitcoinunits.h>
|
|
#include <qt/guiutil.h>
|
|
#include <qt/optionsmodel.h>
|
|
#include <qt/qrimagewidget.h>
|
|
#include <qt/walletmodel.h>
|
|
|
|
#include <QDialog>
|
|
#include <QString>
|
|
|
|
#if defined(HAVE_CONFIG_H)
|
|
#include <config/bitcoin-config.h> /* for USE_QRCODE */
|
|
#endif
|
|
|
|
ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) :
|
|
QDialog(parent, GUIUtil::dialog_flags),
|
|
ui(new Ui::ReceiveRequestDialog),
|
|
model(nullptr)
|
|
{
|
|
ui->setupUi(this);
|
|
GUIUtil::handleCloseWindowShortcut(this);
|
|
}
|
|
|
|
ReceiveRequestDialog::~ReceiveRequestDialog()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void ReceiveRequestDialog::setModel(WalletModel *_model)
|
|
{
|
|
this->model = _model;
|
|
|
|
if (_model)
|
|
connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &ReceiveRequestDialog::updateDisplayUnit);
|
|
|
|
// update the display unit if necessary
|
|
update();
|
|
}
|
|
|
|
void ReceiveRequestDialog::setInfo(const SendCoinsRecipient &_info)
|
|
{
|
|
this->info = _info;
|
|
setWindowTitle(tr("Request payment to %1").arg(info.label.isEmpty() ? info.address : info.label));
|
|
QString uri = GUIUtil::formatBitcoinURI(info);
|
|
|
|
#ifdef USE_QRCODE
|
|
if (ui->qr_code->setQR(uri, info.address)) {
|
|
connect(ui->btnSaveAs, &QPushButton::clicked, ui->qr_code, &QRImageWidget::saveImage);
|
|
} else {
|
|
ui->btnSaveAs->setEnabled(false);
|
|
}
|
|
#else
|
|
ui->btnSaveAs->hide();
|
|
ui->qr_code->hide();
|
|
#endif
|
|
|
|
ui->uri_content->setText("<a href=\"" + uri + "\">" + GUIUtil::HtmlEscape(uri) + "</a>");
|
|
ui->address_content->setText(info.address);
|
|
|
|
if (!info.amount) {
|
|
ui->amount_tag->hide();
|
|
ui->amount_content->hide();
|
|
} // Amount is set in updateDisplayUnit() slot.
|
|
updateDisplayUnit();
|
|
|
|
if (!info.label.isEmpty()) {
|
|
ui->label_content->setText(info.label);
|
|
} else {
|
|
ui->label_tag->hide();
|
|
ui->label_content->hide();
|
|
}
|
|
|
|
if (!info.message.isEmpty()) {
|
|
ui->message_content->setText(info.message);
|
|
} else {
|
|
ui->message_tag->hide();
|
|
ui->message_content->hide();
|
|
}
|
|
|
|
if (!model->getWalletName().isEmpty()) {
|
|
ui->wallet_content->setText(model->getWalletName());
|
|
} else {
|
|
ui->wallet_tag->hide();
|
|
ui->wallet_content->hide();
|
|
}
|
|
}
|
|
|
|
void ReceiveRequestDialog::updateDisplayUnit()
|
|
{
|
|
if (!model) return;
|
|
ui->amount_content->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), info.amount));
|
|
}
|
|
|
|
void ReceiveRequestDialog::on_btnCopyURI_clicked()
|
|
{
|
|
GUIUtil::setClipboard(GUIUtil::formatBitcoinURI(info));
|
|
}
|
|
|
|
void ReceiveRequestDialog::on_btnCopyAddress_clicked()
|
|
{
|
|
GUIUtil::setClipboard(info.address);
|
|
}
|