Merge bitcoin-core/gui#758: Update Node window title with the chain type

9d37886a3b gui: Update Node window title with chain type (pablomartin4btc)

Pull request description:

  It fixes #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](https://github.com/bitcoin-core/gui/issues/78#issuecomment-695755972) on this while discussing network switching.

ACKs for top commit:
  MarnixCroes:
    tACK 9d37886a3b
  hernanmarino:
    tACK 9d37886a3b
  BrandonOdiwuor:
    tested ACK 9d37886a3b
  alfonsoromanz:
    Tested ACK 9d37886a3b
  kristapsk:
    ACK 9d37886a3b
  hebasto:
    ACK 9d37886a3b, tested on Ubuntu 23.10.

Tree-SHA512: 8c34c4586bd59b1c522662e8aa0726dccc8f12e020f7a6a1af5200a29e5817e1c51e0f467c7923041fc41535ea093c3e0dd787befbbcc84d6b9f7ff0d969db04
This commit is contained in:
Hennadii Stepanov 2024-02-12 13:04:56 +00:00
commit e3c17112dd
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F
2 changed files with 14 additions and 0 deletions

View File

@ -581,6 +581,8 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
clear();
GUIUtil::handleCloseWindowShortcut(this);
updateWindowTitle();
}
RPCConsole::~RPCConsole()
@ -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);
}

View File

@ -189,6 +189,8 @@ private:
return time_at_event.count() ? GUIUtil::formatDurationStr(time_now - time_at_event) : tr("Never");
}
void updateWindowTitle();
private Q_SLOTS:
void updateAlerts(const QString& warnings);
};