aboutsummaryrefslogtreecommitdiff
path: root/src/qt/utilitydialog.cpp
diff options
context:
space:
mode:
authorRoy Badami <roy@gnomon.org.uk>2014-07-07 22:06:21 +0100
committerRoy Badami <roy@gnomon.org.uk>2014-07-07 22:06:21 +0100
commit96df327834af3b55918adfac9b3f65adfc960b3a (patch)
tree8bd199df46ea6f39f7094c0e7db2185b4d3f5d6d /src/qt/utilitydialog.cpp
parent2e4fee2ac4824570c1340a8f8fe2aed4580de879 (diff)
parent1fedd65fcf9ac04b70f0fa8cf6caa9629857d586 (diff)
downloadbitcoin-96df327834af3b55918adfac9b3f65adfc960b3a.tar.xz
Merge remote-tracking branch 'upstream/master'
Conflicts: src/qt/overviewpage.cpp src/qt/transactiondesc.cpp
Diffstat (limited to 'src/qt/utilitydialog.cpp')
-rw-r--r--src/qt/utilitydialog.cpp117
1 files changed, 54 insertions, 63 deletions
diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp
index 01b710e876..5fb0da145d 100644
--- a/src/qt/utilitydialog.cpp
+++ b/src/qt/utilitydialog.cpp
@@ -4,7 +4,6 @@
#include "utilitydialog.h"
-#include "ui_aboutdialog.h"
#include "ui_helpmessagedialog.h"
#include "bitcoingui.h"
@@ -16,72 +15,64 @@
#include "util.h"
#include <QLabel>
+#include <QRegExp>
#include <QVBoxLayout>
-/** "About" dialog box */
-AboutDialog::AboutDialog(QWidget *parent) :
+/** "Help message" or "About" dialog box */
+HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
QDialog(parent),
- ui(new Ui::AboutDialog)
+ ui(new Ui::HelpMessageDialog)
{
ui->setupUi(this);
+ GUIUtil::restoreWindowGeometry("nHelpMessageDialogWindow", this->size(), this);
- // Set current copyright year
- ui->copyrightLabel->setText(tr("Copyright") + QString(" &copy; 2009-%1 ").arg(COPYRIGHT_YEAR) + tr("The Bitcoin Core developers"));
-}
-
-void AboutDialog::setModel(ClientModel *model)
-{
- if(model)
- {
- QString version = model->formatFullVersion();
- /* On x86 add a bit specifier to the version so that users can distinguish between
- * 32 and 64 bit builds. On other architectures, 32/64 bit may be more ambigious.
- */
+ QString version = tr("Bitcoin Core") + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion());
+ /* On x86 add a bit specifier to the version so that users can distinguish between
+ * 32 and 64 bit builds. On other architectures, 32/64 bit may be more ambigious.
+ */
#if defined(__x86_64__)
- version += " " + tr("(%1-bit)").arg(64);
+ version += " " + tr("(%1-bit)").arg(64);
#elif defined(__i386__ )
- version += " " + tr("(%1-bit)").arg(32);
+ version += " " + tr("(%1-bit)").arg(32);
#endif
- ui->versionLabel->setText(version);
- }
-}
-
-AboutDialog::~AboutDialog()
-{
- delete ui;
-}
-
-void AboutDialog::on_buttonBox_accepted()
-{
- close();
-}
-
-/** "Help message" dialog box */
-HelpMessageDialog::HelpMessageDialog(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::HelpMessageDialog)
-{
- ui->setupUi(this);
- GUIUtil::restoreWindowGeometry("nHelpMessageDialogWindow", this->size(), this);
-
- header = tr("Bitcoin Core") + " " + tr("version") + " " +
- QString::fromStdString(FormatFullVersion()) + "\n\n" +
- tr("Usage:") + "\n" +
- " bitcoin-qt [" + tr("command-line options") + "] " + "\n";
-
- coreOptions = QString::fromStdString(HelpMessage(HMM_BITCOIN_QT));
-
- uiOptions = tr("UI options") + ":\n" +
- " -choosedatadir " + tr("Choose data directory on startup (default: 0)") + "\n" +
- " -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" +
- " -min " + tr("Start minimized") + "\n" +
- " -rootcertificates=<file> " + tr("Set SSL root certificates for payment request (default: -system-)") + "\n" +
- " -splash " + tr("Show splash screen on startup (default: 1)");
- ui->helpMessageLabel->setFont(GUIUtil::bitcoinAddressFont());
-
- // Set help message text
- ui->helpMessageLabel->setText(header + "\n" + coreOptions + "\n" + uiOptions);
+ if (about)
+ {
+ setWindowTitle(tr("About Bitcoin Core"));
+
+ /// HTML-format the license message from the core
+ QString licenseInfo = QString::fromStdString(LicenseInfo());
+ QString licenseInfoHTML = licenseInfo;
+ // Make URLs clickable
+ QRegExp uri("<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2);
+ uri.setMinimal(true); // use non-greedy matching
+ licenseInfoHTML.replace(uri, "<a href=\"\\1\">\\1</a>");
+ // Replace newlines with HTML breaks
+ licenseInfoHTML.replace("\n\n", "<br><br>");
+
+ ui->helpMessageLabel->setTextFormat(Qt::RichText);
+ ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+ text = version + "\n" + licenseInfo;
+ ui->helpMessageLabel->setText(version + "<br><br>" + licenseInfoHTML);
+ ui->helpMessageLabel->setWordWrap(true);
+ } else {
+ setWindowTitle(tr("Command-line options"));
+ QString header = tr("Usage:") + "\n" +
+ " bitcoin-qt [" + tr("command-line options") + "] " + "\n";
+
+ QString coreOptions = QString::fromStdString(HelpMessage(HMM_BITCOIN_QT));
+
+ QString uiOptions = tr("UI options") + ":\n" +
+ " -choosedatadir " + tr("Choose data directory on startup (default: 0)") + "\n" +
+ " -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" +
+ " -min " + tr("Start minimized") + "\n" +
+ " -rootcertificates=<file> " + tr("Set SSL root certificates for payment request (default: -system-)") + "\n" +
+ " -splash " + tr("Show splash screen on startup (default: 1)");
+
+ ui->helpMessageLabel->setFont(GUIUtil::bitcoinAddressFont());
+ text = version + "\n" + header + "\n" + coreOptions + "\n" + uiOptions;
+ ui->helpMessageLabel->setText(text);
+ }
}
HelpMessageDialog::~HelpMessageDialog()
@@ -93,18 +84,17 @@ HelpMessageDialog::~HelpMessageDialog()
void HelpMessageDialog::printToConsole()
{
// On other operating systems, the expected action is to print the message to the console.
- QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions + "\n";
- fprintf(stdout, "%s", strUsage.toStdString().c_str());
+ fprintf(stdout, "%s\n", qPrintable(text));
}
void HelpMessageDialog::showOrPrint()
{
#if defined(WIN32)
- // On Windows, show a message box, as there is no stderr/stdout in windowed applications
- exec();
+ // On Windows, show a message box, as there is no stderr/stdout in windowed applications
+ exec();
#else
- // On other operating systems, print help text to console
- printToConsole();
+ // On other operating systems, print help text to console
+ printToConsole();
#endif
}
@@ -127,6 +117,7 @@ void ShutdownWindow::showShutdownWindow(BitcoinGUI *window)
tr("Bitcoin Core is shutting down...") + "<br /><br />" +
tr("Do not shut down the computer until this window disappears.")));
shutdownWindow->setLayout(layout);
+ shutdownWindow->setWindowTitle(window->windowTitle());
// Center shutdown window at where main window was
const QPoint global = window->mapToGlobal(window->rect().center());