Skip to content

Commit

Permalink
Merge bitcoin-core/gui#758: Update Node window title with the chain type
Browse files Browse the repository at this point in the history
9d37886 gui: Update Node window title with chain type (pablomartin4btc)

Pull request description:

  It fixes bitcoin#544.

  Enhance the Node window title by appending the chain type to it, except for the `mainnet`, mirroring the behavior in the main window.

  ![image](https://github.com/bitcoin-core/gui/assets/110166421/6b81675c-6e53-411f-9ea7-921e74cd2359)

  There was also some [interest](bitcoin-core/gui#78 (comment)) on this while discussing network switching.

ACKs for top commit:
  MarnixCroes:
    tACK 9d37886
  hernanmarino:
    tACK 9d37886
  BrandonOdiwuor:
    tested ACK 9d37886
  alfonsoromanz:
    Tested ACK bitcoin-core/gui@9d37886
  kristapsk:
    ACK 9d37886
  hebasto:
    ACK 9d37886, tested on Ubuntu 23.10.

Tree-SHA512: 8c34c4586bd59b1c522662e8aa0726dccc8f12e020f7a6a1af5200a29e5817e1c51e0f467c7923041fc41535ea093c3e0dd787befbbcc84d6b9f7ff0d969db04
  • Loading branch information
hebasto committed Feb 12, 2024
2 parents 2afbacc + 9d37886 commit e3c1711
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,8 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
clear();

GUIUtil::handleCloseWindowShortcut(this);

updateWindowTitle();
}

RPCConsole::~RPCConsole()
Expand Down Expand Up @@ -1387,3 +1389,13 @@ void RPCConsole::updateAlerts(const QString& warnings)
this->ui->label_alerts->setVisible(!warnings.isEmpty());
this->ui->label_alerts->setText(warnings);
}

void RPCConsole::updateWindowTitle()
{
const ChainType chain = Params().GetChainType();
if (chain == ChainType::MAIN) return;

const QString chainType = QString::fromStdString(Params().GetChainTypeString());
const QString title = tr("Node window - [%1]").arg(chainType);
this->setWindowTitle(title);
}
2 changes: 2 additions & 0 deletions src/qt/rpcconsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ public Q_SLOTS:
return time_at_event.count() ? GUIUtil::formatDurationStr(time_now - time_at_event) : tr("Never");
}

void updateWindowTitle();

private Q_SLOTS:
void updateAlerts(const QString& warnings);
};
Expand Down

0 comments on commit e3c1711

Please sign in to comment.