Skip to content

Commit 577d500

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 dcfbf3c commit 577d500

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

src/qt/bitcoingui.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
103103
updateWindowTitle();
104104

105105
rpcConsole = new RPCConsole(node, _platformStyle, nullptr);
106-
helpMessageDialog = new HelpMessageDialog(this, false);
106+
helpMessageDialog = new HelpMessageDialog(this, false, m_network_style);
107107
#ifdef ENABLE_WALLET
108108
if(enableWallet)
109109
{
@@ -920,7 +920,7 @@ void BitcoinGUI::aboutClicked()
920920
if(!clientModel)
921921
return;
922922

923-
auto dlg = new HelpMessageDialog(this, /*about=*/true);
923+
auto dlg = new HelpMessageDialog(this, /*about=*/true, m_network_style);
924924
GUIUtil::ShowModalDialogAsynchronously(dlg);
925925
}
926926

src/qt/utilitydialog.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#include <qt/guiutil.h>
1414

15+
#include <qt/networkstyle.h>
16+
1517
#include <clientversion.h>
1618
#include <common/args.h>
1719
#include <init.h>
@@ -29,18 +31,17 @@
2931
#include <QVBoxLayout>
3032

3133
/** "Help message" or "About" dialog box */
32-
HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
33-
QDialog(parent, GUIUtil::dialog_flags),
34-
ui(new Ui::HelpMessageDialog)
34+
HelpMessageDialog::HelpMessageDialog(QWidget* parent, bool about, const NetworkStyle* networkStyle) : QDialog(parent, GUIUtil::dialog_flags),
35+
ui(new Ui::HelpMessageDialog)
3536
{
3637
ui->setupUi(this);
3738

3839
QString version = QString{PACKAGE_NAME} + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion());
3940

4041
if (about)
4142
{
42-
setWindowTitle(tr("About %1").arg(PACKAGE_NAME));
43-
43+
this->setAboutWindowTitle(networkStyle);
44+
this->setChainTypeIconOnAboutLogo(networkStyle);
4445
std::string licenseInfo = LicenseInfo();
4546
/// HTML-format the license message from the core
4647
QString licenseInfoHTML = QString::fromStdString(LicenseInfo());
@@ -135,6 +136,19 @@ void HelpMessageDialog::on_okButton_accepted()
135136
close();
136137
}
137138

139+
void HelpMessageDialog::setAboutWindowTitle(const NetworkStyle* networkStyle)
140+
{
141+
QString aboutTitle = tr("About %1").arg(PACKAGE_NAME);
142+
if ((networkStyle) && (Params().GetChainType() != ChainType::MAIN)) aboutTitle.append(" " + networkStyle->getTitleAddText());
143+
setWindowTitle(aboutTitle);
144+
}
145+
146+
void HelpMessageDialog::setChainTypeIconOnAboutLogo(const NetworkStyle* networkStyle)
147+
{
148+
const QSize requiredSize(1024, 1024);
149+
if (networkStyle) ui->aboutLogo->setPixmap(networkStyle->getAppIcon().pixmap(requiredSize));
150+
}
151+
138152

139153
/** "Shutdown" window */
140154
ShutdownWindow::ShutdownWindow(QWidget *parent, Qt::WindowFlags f):

src/qt/utilitydialog.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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* networkStyle = 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* networkStyle = nullptr);
37+
void setChainTypeIconOnAboutLogo(const NetworkStyle* networkStyle = nullptr);
3438

3539
private Q_SLOTS:
3640
void on_okButton_accepted();

0 commit comments

Comments
 (0)