Skip to content

Commit 0011c78

Browse files
gui: Update about logo icon to denote chain type
Adding the networkStyle parameter to the HelpMessageDialog creator on utilitydialog, updating all calls where its instance is being created from bitcoingui.cpp. In the object itself, use this new parameter object to build the about window title and set the icon of the about logo widget.
1 parent 8fa10ed commit 0011c78

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

src/qt/bitcoin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2011-2022 The Bitcoin Core developers
1+
// Copyright (c) 2011-present The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -583,7 +583,7 @@ int GuiMain(int argc, char* argv[])
583583
// Show help message immediately after parsing command-line options (for "-lang") and setting locale,
584584
// but before showing splash screen.
585585
if (HelpRequested(gArgs) || gArgs.GetBoolArg("-version", false)) {
586-
HelpMessageDialog help(nullptr, gArgs.GetBoolArg("-version", false));
586+
HelpMessageDialog help(/*parent=*/nullptr, /*about=*/gArgs.GetBoolArg("-version", false));
587587
help.showOrPrint();
588588
return EXIT_SUCCESS;
589589
}

src/qt/bitcoingui.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2011-2022 The Bitcoin Core developers
1+
// Copyright (c) 2011-present The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -105,7 +105,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
105105
updateWindowTitle();
106106

107107
rpcConsole = new RPCConsole(node, _platformStyle, nullptr);
108-
helpMessageDialog = new HelpMessageDialog(this, false);
108+
helpMessageDialog = new HelpMessageDialog(/*parent=*/this, /*about=*/false, /*network_style=*/m_network_style);
109109
#ifdef ENABLE_WALLET
110110
if(enableWallet)
111111
{
@@ -936,7 +936,7 @@ void BitcoinGUI::aboutClicked()
936936
if(!clientModel)
937937
return;
938938

939-
auto dlg = new HelpMessageDialog(this, /*about=*/true);
939+
auto dlg = new HelpMessageDialog(/*parent=*/this, /*about=*/true, /*network_style=*/m_network_style);
940940
GUIUtil::ShowModalDialogAsynchronously(dlg);
941941
}
942942

src/qt/utilitydialog.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2011-2022 The Bitcoin Core developers
1+
// Copyright (c) 2011-present The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -10,6 +10,8 @@
1010

1111
#include <qt/guiutil.h>
1212

13+
#include <qt/networkstyle.h>
14+
1315
#include <clientversion.h>
1416
#include <common/args.h>
1517
#include <init.h>
@@ -27,7 +29,7 @@
2729
#include <QVBoxLayout>
2830

2931
/** "Help message" or "About" dialog box */
30-
HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
32+
HelpMessageDialog::HelpMessageDialog(QWidget* parent, bool about, const NetworkStyle* network_style) :
3133
QDialog(parent, GUIUtil::dialog_flags),
3234
ui(new Ui::HelpMessageDialog)
3335
{
@@ -37,8 +39,8 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
3739

3840
if (about)
3941
{
40-
setWindowTitle(tr("About %1").arg(CLIENT_NAME));
41-
42+
this->setAboutWindowTitle(network_style);
43+
this->setChainTypeIconOnAboutLogo(network_style);
4244
std::string licenseInfo = LicenseInfo();
4345
/// HTML-format the license message from the core
4446
QString licenseInfoHTML = QString::fromStdString(LicenseInfo());
@@ -137,6 +139,21 @@ void HelpMessageDialog::on_okButton_accepted()
137139
close();
138140
}
139141

142+
void HelpMessageDialog::setAboutWindowTitle(const NetworkStyle* network_style)
143+
{
144+
QString aboutTitle = tr("About %1").arg(CLIENT_NAME);
145+
if (network_style && Params().GetChainType() != ChainType::MAIN) {
146+
aboutTitle.append(" " + network_style->getTitleAddText());
147+
}
148+
setWindowTitle(aboutTitle);
149+
}
150+
151+
void HelpMessageDialog::setChainTypeIconOnAboutLogo(const NetworkStyle* network_style)
152+
{
153+
const QSize requiredSize(1024, 1024);
154+
if (network_style) ui->aboutLogo->setPixmap(network_style->getAppIcon().pixmap(requiredSize));
155+
}
156+
140157

141158
/** "Shutdown" window */
142159
ShutdownWindow::ShutdownWindow(QWidget *parent, Qt::WindowFlags f):

src/qt/utilitydialog.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2011-2020 The Bitcoin Core developers
1+
// Copyright (c) 2011-present The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -8,6 +8,8 @@
88
#include <QDialog>
99
#include <QWidget>
1010

11+
class NetworkStyle;
12+
1113
QT_BEGIN_NAMESPACE
1214
class QMainWindow;
1315
QT_END_NAMESPACE
@@ -22,7 +24,7 @@ class HelpMessageDialog : public QDialog
2224
Q_OBJECT
2325

2426
public:
25-
explicit HelpMessageDialog(QWidget *parent, bool about);
27+
explicit HelpMessageDialog(QWidget* parent, bool about, const NetworkStyle* network_style = nullptr);
2628
~HelpMessageDialog();
2729

2830
void printToConsole();
@@ -31,6 +33,8 @@ class HelpMessageDialog : public QDialog
3133
private:
3234
Ui::HelpMessageDialog *ui;
3335
QString text;
36+
void setAboutWindowTitle(const NetworkStyle* network_style = nullptr);
37+
void setChainTypeIconOnAboutLogo(const NetworkStyle* network_style = nullptr);
3438

3539
private Q_SLOTS:
3640
void on_okButton_accepted();

0 commit comments

Comments
 (0)