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() != CHATTERINO_VERSION)
{
auto box = new QMessageBox(QMessageBox::Information, "Chatterino 2",
"Show changelog?",
QMessageBox::Yes | QMessageBox::No);
auto box = new QMessageBox(
QMessageBox::Information, Version::instance().fullVersion(),
"Show changelog?", QMessageBox::Yes | QMessageBox::No);
box->setAttribute(Qt::WA_DeleteOnClose);
if (box->exec() == QMessageBox::Yes)
{

View file

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

View file

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

View file

@ -4,6 +4,7 @@
#include "common/Common.hpp"
#include "common/NetworkRequest.hpp"
#include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "util/Clipboard.hpp"
@ -81,7 +82,7 @@ BasicLoginWidget::BasicLoginWidget()
this->ui_.loginButton.setText("Log in (Opens in browser)");
this->ui_.pasteCodeButton.setText("Paste login info");
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.hide();
this->ui_.unableToOpenBrowserHelper.setText(

View file

@ -2,6 +2,7 @@
#include "Application.hpp"
#include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "singletons/WindowManager.hpp"
#include "util/StreamLink.hpp"
#include "widgets/Window.hpp"
@ -35,7 +36,8 @@ void QualityPopup::showDialog(const QString &channelURL, QStringList 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->show();

View file

@ -2,6 +2,7 @@
#include "Application.hpp"
#include "common/Args.hpp"
#include "common/Version.hpp"
#include "controllers/commands/CommandController.hpp"
#include "controllers/hotkeys/HotkeyController.hpp"
#include "singletons/Settings.hpp"
@ -34,7 +35,7 @@ SettingsDialog::SettingsDialog(QWidget *parent)
parent)
{
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
this->setWindowFlags(this->windowFlags() &
~Qt::WindowContextHelpButtonHint);

View file

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

View file

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