Eradicate hardcoded names from various window names

This commit is contained in:
Mm2PL 2023-05-10 22:33:39 +02:00
parent 1f0aa808a5
commit 8f43e08ce7
No known key found for this signature in database
GPG key ID: 94AC9B80EFA15ED9
8 changed files with 40 additions and 27 deletions

View file

@ -110,9 +110,9 @@ void Application::initialize(Settings &settings, Paths &paths)
getSettings()->currentVersion.getValue() != "" && getSettings()->currentVersion.getValue() != "" &&
getSettings()->currentVersion.getValue() != CHATTERINO_VERSION) getSettings()->currentVersion.getValue() != CHATTERINO_VERSION)
{ {
auto box = new QMessageBox(QMessageBox::Information, "Chatterino 2", auto box = new QMessageBox(
"Show changelog?", QMessageBox::Information, Version::instance().fullVersion(),
QMessageBox::Yes | QMessageBox::No); "Show changelog?", QMessageBox::Yes | QMessageBox::No);
box->setAttribute(Qt::WA_DeleteOnClose); box->setAttribute(Qt::WA_DeleteOnClose);
if (box->exec() == QMessageBox::Yes) if (box->exec() == QMessageBox::Yes)
{ {

View file

@ -81,17 +81,19 @@ void Updates::installUpdates()
assert(false); assert(false);
return; return;
} }
auto windowName =
QString("%1 - Update").arg(Version::instance().fullVersion());
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
QMessageBox *box = new QMessageBox( QMessageBox *box = new QMessageBox(
QMessageBox::Information, "Chatterino Update", QMessageBox::Information, windowName,
"A link will open in your browser. Download and install to update."); "A link will open in your browser. Download and install to update.");
box->setAttribute(Qt::WA_DeleteOnClose); box->setAttribute(Qt::WA_DeleteOnClose);
box->exec(); box->exec();
QDesktopServices::openUrl(this->updateExe_); QDesktopServices::openUrl(this->updateExe_);
#elif defined Q_OS_LINUX #elif defined Q_OS_LINUX
QMessageBox *box = QMessageBox *box =
new QMessageBox(QMessageBox::Information, "Chatterino Update", new QMessageBox(QMessageBox::Information, windowName,
"Automatic updates are currently not available on " "Automatic updates are currently not available on "
"linux. Please redownload the app to update."); "linux. Please redownload the app to update.");
box->setAttribute(Qt::WA_DeleteOnClose); box->setAttribute(Qt::WA_DeleteOnClose);
@ -101,7 +103,7 @@ void Updates::installUpdates()
if (getPaths()->isPortable()) if (getPaths()->isPortable())
{ {
QMessageBox *box = QMessageBox *box =
new QMessageBox(QMessageBox::Information, "Chatterino Update", new QMessageBox(QMessageBox::Information, windowName,
"Chatterino is downloading the update " "Chatterino is downloading the update "
"in the background and will run the " "in the background and will run the "
"updater once it is finished."); "updater once it is finished.");
@ -110,23 +112,23 @@ void Updates::installUpdates()
NetworkRequest(this->updatePortable_) NetworkRequest(this->updatePortable_)
.timeout(600000) .timeout(600000)
.onError([this](NetworkResult) { .onError([this, windowName](NetworkResult) {
this->setStatus_(DownloadFailed); this->setStatus_(DownloadFailed);
postToThread([] { postToThread([] {
QMessageBox *box = new QMessageBox( QMessageBox *box = new QMessageBox(
QMessageBox::Information, "Chatterino Update", QMessageBox::Information, windowName,
"Failed while trying to download the update."); "Failed while trying to download the update.");
box->setAttribute(Qt::WA_DeleteOnClose); box->setAttribute(Qt::WA_DeleteOnClose);
box->show(); box->show();
box->raise(); box->raise();
}); });
}) })
.onSuccess([this](auto result) -> Outcome { .onSuccess([this, windowName](auto result) -> Outcome {
if (result.status() != 200) if (result.status() != 200)
{ {
auto *box = new QMessageBox( auto *box = new QMessageBox(
QMessageBox::Information, "Chatterino Update", QMessageBox::Information, windowName,
QStringLiteral("The update couldn't be downloaded " QStringLiteral("The update couldn't be downloaded "
"(HTTP status %1).") "(HTTP status %1).")
.arg(result.status())); .arg(result.status()));
@ -164,7 +166,7 @@ void Updates::installUpdates()
else else
{ {
QMessageBox *box = QMessageBox *box =
new QMessageBox(QMessageBox::Information, "Chatterino Update", new QMessageBox(QMessageBox::Information, windowName,
"Chatterino is downloading the update " "Chatterino is downloading the update "
"in the background and will run the " "in the background and will run the "
"updater once it is finished."); "updater once it is finished.");
@ -173,21 +175,21 @@ void Updates::installUpdates()
NetworkRequest(this->updateExe_) NetworkRequest(this->updateExe_)
.timeout(600000) .timeout(600000)
.onError([this](NetworkResult) { .onError([this, windowName](NetworkResult) {
this->setStatus_(DownloadFailed); this->setStatus_(DownloadFailed);
QMessageBox *box = new QMessageBox( QMessageBox *box = new QMessageBox(
QMessageBox::Information, "Chatterino Update", QMessageBox::Information, windowName,
"Failed to download the update. \n\nTry manually " "Failed to download the update. \n\nTry manually "
"downloading the update."); "downloading the update.");
box->setAttribute(Qt::WA_DeleteOnClose); box->setAttribute(Qt::WA_DeleteOnClose);
box->exec(); box->exec();
}) })
.onSuccess([this](auto result) -> Outcome { .onSuccess([this, windowName](auto result) -> Outcome {
if (result.status() != 200) if (result.status() != 200)
{ {
auto *box = new QMessageBox( auto *box = new QMessageBox(
QMessageBox::Information, "Chatterino Update", QMessageBox::Information, windowName,
QStringLiteral("The update couldn't be downloaded " QStringLiteral("The update couldn't be downloaded "
"(HTTP status %1).") "(HTTP status %1).")
.arg(result.status())); .arg(result.status()));
@ -207,7 +209,7 @@ void Updates::installUpdates()
{ {
this->setStatus_(WriteFileFailed); this->setStatus_(WriteFileFailed);
QMessageBox *box = new QMessageBox( QMessageBox *box = new QMessageBox(
QMessageBox::Information, "Chatterino Update", QMessageBox::Information, windowName,
"Failed to save the update file. This could be due to " "Failed to save the update file. This could be due to "
"window settings or antivirus software.\n\nTry " "window settings or antivirus software.\n\nTry "
"manually " "manually "
@ -228,7 +230,7 @@ void Updates::installUpdates()
else else
{ {
QMessageBox *box = new QMessageBox( QMessageBox *box = new QMessageBox(
QMessageBox::Information, "Chatterino Update", QMessageBox::Information, windowName,
"Failed to execute update binary. This could be due to " "Failed to execute update binary. This could be due to "
"window " "window "
"settings or antivirus software.\n\nTry manually " "settings or antivirus software.\n\nTry manually "

View file

@ -3,6 +3,7 @@
#include "Application.hpp" #include "Application.hpp"
#include "common/Args.hpp" #include "common/Args.hpp"
#include "common/QLogging.hpp" #include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "debug/AssertInGuiThread.hpp" #include "debug/AssertInGuiThread.hpp"
#include "messages/MessageElement.hpp" #include "messages/MessageElement.hpp"
#include "providers/irc/Irc2.hpp" #include "providers/irc/Irc2.hpp"
@ -57,7 +58,9 @@ void WindowManager::showSettingsDialog(QWidget *parent,
{ {
if (getArgs().dontSaveSettings) if (getArgs().dontSaveSettings)
{ {
QMessageBox::critical(parent, "Chatterino - Editing Settings Forbidden", QMessageBox::critical(
parent,
Version::instance().fullVersion() + " - Editing Settings Forbidden",
"Settings cannot be edited when running with\n" "Settings cannot be edited when running with\n"
"commandline arguments such as '-c'."); "commandline arguments such as '-c'.");
} }

View file

@ -4,6 +4,7 @@
#include "common/Common.hpp" #include "common/Common.hpp"
#include "common/NetworkRequest.hpp" #include "common/NetworkRequest.hpp"
#include "common/QLogging.hpp" #include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchAccount.hpp"
#include "util/Clipboard.hpp" #include "util/Clipboard.hpp"
@ -81,7 +82,7 @@ BasicLoginWidget::BasicLoginWidget()
this->ui_.loginButton.setText("Log in (Opens in browser)"); this->ui_.loginButton.setText("Log in (Opens in browser)");
this->ui_.pasteCodeButton.setText("Paste login info"); this->ui_.pasteCodeButton.setText("Paste login info");
this->ui_.unableToOpenBrowserHelper.setWindowTitle( this->ui_.unableToOpenBrowserHelper.setWindowTitle(
"Chatterino - unable to open in browser"); Version::instance().fullVersion() + " - unable to open in browser");
this->ui_.unableToOpenBrowserHelper.setWordWrap(true); this->ui_.unableToOpenBrowserHelper.setWordWrap(true);
this->ui_.unableToOpenBrowserHelper.hide(); this->ui_.unableToOpenBrowserHelper.hide();
this->ui_.unableToOpenBrowserHelper.setText( this->ui_.unableToOpenBrowserHelper.setText(

View file

@ -2,6 +2,7 @@
#include "Application.hpp" #include "Application.hpp"
#include "common/QLogging.hpp" #include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "util/StreamLink.hpp" #include "util/StreamLink.hpp"
#include "widgets/Window.hpp" #include "widgets/Window.hpp"
@ -35,7 +36,8 @@ void QualityPopup::showDialog(const QString &channelURL, QStringList options)
{ {
QualityPopup *instance = new QualityPopup(channelURL, options); QualityPopup *instance = new QualityPopup(channelURL, options);
instance->window()->setWindowTitle("Chatterino - select stream quality"); instance->window()->setWindowTitle(Version::instance().fullVersion() +
"- select stream quality");
instance->setAttribute(Qt::WA_DeleteOnClose, true); instance->setAttribute(Qt::WA_DeleteOnClose, true);
instance->show(); instance->show();

View file

@ -2,6 +2,7 @@
#include "Application.hpp" #include "Application.hpp"
#include "common/Args.hpp" #include "common/Args.hpp"
#include "common/Version.hpp"
#include "controllers/commands/CommandController.hpp" #include "controllers/commands/CommandController.hpp"
#include "controllers/hotkeys/HotkeyController.hpp" #include "controllers/hotkeys/HotkeyController.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
@ -34,7 +35,7 @@ SettingsDialog::SettingsDialog(QWidget *parent)
parent) parent)
{ {
this->setObjectName("SettingsDialog"); this->setObjectName("SettingsDialog");
this->setWindowTitle("Chatterino Settings"); this->setWindowTitle(Version::instance().fullVersion() + " - Settings");
// Disable the ? button in the titlebar until we decide to use it // Disable the ? button in the titlebar until we decide to use it
this->setWindowFlags(this->windowFlags() & this->setWindowFlags(this->windowFlags() &
~Qt::WindowContextHelpButtonHint); ~Qt::WindowContextHelpButtonHint);

View file

@ -230,7 +230,8 @@ void AboutPage::addLicense(QFormLayout *form, const QString &name,
auto window = new BasePopup({BaseWindow::Flags::EnableCustomFrame, auto window = new BasePopup({BaseWindow::Flags::EnableCustomFrame,
BaseWindow::DisableLayoutSave}, BaseWindow::DisableLayoutSave},
parent); parent);
window->setWindowTitle("Chatterino - License for " + name); window->setWindowTitle(Version::instance().fullVersion() +
" - License for " + name);
window->setAttribute(Qt::WA_DeleteOnClose); window->setAttribute(Qt::WA_DeleteOnClose);
auto layout = new QVBoxLayout(); auto layout = new QVBoxLayout();
auto *edit = new QTextEdit; auto *edit = new QTextEdit;

View file

@ -5,6 +5,7 @@
#include "common/NetworkRequest.hpp" #include "common/NetworkRequest.hpp"
#include "common/NetworkResult.hpp" #include "common/NetworkResult.hpp"
#include "common/QLogging.hpp" #include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "controllers/commands/CommandController.hpp" #include "controllers/commands/CommandController.hpp"
#include "controllers/hotkeys/HotkeyController.hpp" #include "controllers/hotkeys/HotkeyController.hpp"
@ -194,7 +195,8 @@ namespace {
{ {
auto window = auto window =
new BasePopup(BaseWindow::Flags::EnableCustomFrame, parent); new BasePopup(BaseWindow::Flags::EnableCustomFrame, parent);
window->setWindowTitle("Chatterino - " + title); window->setWindowTitle(Version::instance().fullVersion() + " - " +
title);
window->setAttribute(Qt::WA_DeleteOnClose); window->setAttribute(Qt::WA_DeleteOnClose);
auto layout = new QVBoxLayout(); auto layout = new QVBoxLayout();
layout->addWidget(new QLabel(description)); layout->addWidget(new QLabel(description));
@ -375,7 +377,7 @@ Split::Split(QWidget *parent)
if (getSettings()->askOnImageUpload.getValue()) if (getSettings()->askOnImageUpload.getValue())
{ {
QMessageBox msgBox(this->window()); QMessageBox msgBox(this->window());
msgBox.setWindowTitle("Chatterino"); msgBox.setWindowTitle(Version::instance().fullVersion());
msgBox.setText("Image upload"); msgBox.setText("Image upload");
msgBox.setInformativeText( msgBox.setInformativeText(
"You are uploading an image to a 3rd party service not in " "You are uploading an image to a 3rd party service not in "
@ -445,7 +447,8 @@ void Split::addShortcuts()
[](std::vector<QString>) -> QString { [](std::vector<QString>) -> QString {
auto *popup = new DebugPopup; auto *popup = new DebugPopup;
popup->setAttribute(Qt::WA_DeleteOnClose); popup->setAttribute(Qt::WA_DeleteOnClose);
popup->setWindowTitle("Chatterino - Debug popup"); popup->setWindowTitle(Version::instance().fullVersion() +
" - Debug popup");
popup->show(); popup->show();
return ""; return "";
}}, }},