From da70122d9c46c6281c06fe1dedc558c13077f64f Mon Sep 17 00:00:00 2001 From: swirl Date: Sun, 20 Feb 2022 19:23:08 -0500 Subject: remove notifications --- launcher/ui/MainWindow.cpp | 31 ----------- launcher/ui/MainWindow.h | 4 -- launcher/ui/dialogs/NotificationDialog.cpp | 86 ------------------------------ launcher/ui/dialogs/NotificationDialog.h | 44 --------------- launcher/ui/dialogs/NotificationDialog.ui | 85 ----------------------------- launcher/ui/pages/global/LauncherPage.cpp | 5 -- launcher/ui/pages/global/LauncherPage.ui | 22 +------- 7 files changed, 1 insertion(+), 276 deletions(-) delete mode 100644 launcher/ui/dialogs/NotificationDialog.cpp delete mode 100644 launcher/ui/dialogs/NotificationDialog.h delete mode 100644 launcher/ui/dialogs/NotificationDialog.ui (limited to 'launcher/ui') diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index ad7227cc..a3da64e4 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -59,7 +59,6 @@ #include #include #include -#include #include #include #include @@ -82,7 +81,6 @@ #include "ui/dialogs/CopyInstanceDialog.h" #include "ui/dialogs/UpdateDialog.h" #include "ui/dialogs/EditAccountDialog.h" -#include "ui/dialogs/NotificationDialog.h" #include "ui/dialogs/ExportInstanceDialog.h" #include "UpdateController.h" @@ -835,17 +833,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow } } - { - auto checker = new NotificationChecker(); - checker->setNotificationsUrl(QUrl(BuildConfig.NOTIFICATION_URL)); - checker->setApplicationChannel(BuildConfig.VERSION_CHANNEL); - checker->setApplicationPlatform(BuildConfig.BUILD_PLATFORM); - checker->setApplicationFullVersion(BuildConfig.FULL_VERSION_STR); - m_notificationChecker.reset(checker); - connect(m_notificationChecker.get(), &NotificationChecker::notificationCheckFinished, this, &MainWindow::notificationsChanged); - checker->checkForNotifications(); - } - setSelectedInstanceById(APPLICATION->settings()->get("SelectedInstance").toString()); // removing this looks stupid @@ -1257,24 +1244,6 @@ QString intListToString(const QList &list) } return slist.join(','); } -void MainWindow::notificationsChanged() -{ - QList entries = m_notificationChecker->notificationEntries(); - QList shownNotifications = stringToIntList(APPLICATION->settings()->get("ShownNotifications").toString()); - for (auto it = entries.begin(); it != entries.end(); ++it) - { - NotificationChecker::NotificationEntry entry = *it; - if (!shownNotifications.contains(entry.id)) - { - NotificationDialog dialog(entry, this); - if (dialog.exec() == NotificationDialog::DontShowAgain) - { - shownNotifications.append(entry.id); - } - } - } - APPLICATION->settings()->set("ShownNotifications", intListToString(shownNotifications)); -} void MainWindow::downloadUpdates(GoUpdate::Status status) { diff --git a/launcher/ui/MainWindow.h b/launcher/ui/MainWindow.h index f6940ab0..fd65620e 100644 --- a/launcher/ui/MainWindow.h +++ b/launcher/ui/MainWindow.h @@ -28,7 +28,6 @@ class LaunchController; class NewsChecker; -class NotificationChecker; class QToolButton; class InstanceProxyModel; class LabeledToolButton; @@ -166,8 +165,6 @@ private slots: void updateNotAvailable(); - void notificationsChanged(); - void defaultAccountChanged(); void changeActiveAccount(); @@ -213,7 +210,6 @@ private: KonamiCode * secretEventFilter = nullptr; unique_qobject_ptr m_newsChecker; - unique_qobject_ptr m_notificationChecker; InstancePtr m_selectedInstance; QString m_currentInstIcon; diff --git a/launcher/ui/dialogs/NotificationDialog.cpp b/launcher/ui/dialogs/NotificationDialog.cpp deleted file mode 100644 index f2a35ae2..00000000 --- a/launcher/ui/dialogs/NotificationDialog.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "NotificationDialog.h" -#include "ui_NotificationDialog.h" - -#include -#include - -NotificationDialog::NotificationDialog(const NotificationChecker::NotificationEntry &entry, QWidget *parent) : - QDialog(parent, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::CustomizeWindowHint), - ui(new Ui::NotificationDialog) -{ - ui->setupUi(this); - - QStyle::StandardPixmap icon; - switch (entry.type) - { - case NotificationChecker::NotificationEntry::Critical: - icon = QStyle::SP_MessageBoxCritical; - break; - case NotificationChecker::NotificationEntry::Warning: - icon = QStyle::SP_MessageBoxWarning; - break; - default: - case NotificationChecker::NotificationEntry::Information: - icon = QStyle::SP_MessageBoxInformation; - break; - } - ui->iconLabel->setPixmap(style()->standardPixmap(icon, 0, this)); - ui->messageLabel->setText(entry.message); - - m_dontShowAgainText = tr("Don't show again"); - m_closeText = tr("Close"); - - ui->dontShowAgainBtn->setText(m_dontShowAgainText + QString(" (%1)").arg(m_dontShowAgainTime)); - ui->closeBtn->setText(m_closeText + QString(" (%1)").arg(m_closeTime)); - - startTimer(1000); -} - -NotificationDialog::~NotificationDialog() -{ - delete ui; -} - -void NotificationDialog::timerEvent(QTimerEvent *event) -{ - if (m_dontShowAgainTime > 0) - { - m_dontShowAgainTime--; - if (m_dontShowAgainTime == 0) - { - ui->dontShowAgainBtn->setText(m_dontShowAgainText); - ui->dontShowAgainBtn->setEnabled(true); - } - else - { - ui->dontShowAgainBtn->setText(m_dontShowAgainText + QString(" (%1)").arg(m_dontShowAgainTime)); - } - } - if (m_closeTime > 0) - { - m_closeTime--; - if (m_closeTime == 0) - { - ui->closeBtn->setText(m_closeText); - ui->closeBtn->setEnabled(true); - } - else - { - ui->closeBtn->setText(m_closeText + QString(" (%1)").arg(m_closeTime)); - } - } - - if (m_closeTime == 0 && m_dontShowAgainTime == 0) - { - killTimer(event->timerId()); - } -} - -void NotificationDialog::on_dontShowAgainBtn_clicked() -{ - done(DontShowAgain); -} -void NotificationDialog::on_closeBtn_clicked() -{ - done(Normal); -} diff --git a/launcher/ui/dialogs/NotificationDialog.h b/launcher/ui/dialogs/NotificationDialog.h deleted file mode 100644 index e1cbb9fa..00000000 --- a/launcher/ui/dialogs/NotificationDialog.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef NOTIFICATIONDIALOG_H -#define NOTIFICATIONDIALOG_H - -#include - -#include "notifications/NotificationChecker.h" - -namespace Ui { -class NotificationDialog; -} - -class NotificationDialog : public QDialog -{ - Q_OBJECT - -public: - explicit NotificationDialog(const NotificationChecker::NotificationEntry &entry, QWidget *parent = 0); - ~NotificationDialog(); - - enum ExitCode - { - Normal, - DontShowAgain - }; - -protected: - void timerEvent(QTimerEvent *event); - -private: - Ui::NotificationDialog *ui; - - int m_dontShowAgainTime = 10; - int m_closeTime = 5; - - QString m_dontShowAgainText; - QString m_closeText; - -private -slots: - void on_dontShowAgainBtn_clicked(); - void on_closeBtn_clicked(); -}; - -#endif // NOTIFICATIONDIALOG_H diff --git a/launcher/ui/dialogs/NotificationDialog.ui b/launcher/ui/dialogs/NotificationDialog.ui deleted file mode 100644 index 3e6c22bc..00000000 --- a/launcher/ui/dialogs/NotificationDialog.ui +++ /dev/null @@ -1,85 +0,0 @@ - - - NotificationDialog - - - - 0 - 0 - 320 - 240 - - - - Notification - - - - - - - - TextLabel - - - - - - - TextLabel - - - true - - - true - - - Qt::TextBrowserInteraction - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - false - - - Don't show again - - - - - - - false - - - Close - - - - - - - - - - diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp index 0ffe8050..9e1d761b 100644 --- a/launcher/ui/pages/global/LauncherPage.cpp +++ b/launcher/ui/pages/global/LauncherPage.cpp @@ -234,11 +234,6 @@ void LauncherPage::applySettings() { auto s = APPLICATION->settings(); - if (ui->resetNotificationsBtn->isChecked()) - { - s->set("ShownNotifications", QString()); - } - // Updates s->set("AutoUpdate", ui->autoUpdateCheckBox->isChecked()); s->set("UpdateChannel", m_currentUpdateChannel); diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index 47fed873..3722072d 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -38,7 +38,7 @@ QTabWidget::Rounded - 0 + 1 @@ -184,25 +184,6 @@ User Interface - - - - Launcher notifications - - - - - - Reset hidden notifications - - - true - - - - - - @@ -499,7 +480,6 @@ modsDirBrowseBtn iconsDirTextBox iconsDirBrowseBtn - resetNotificationsBtn sortLastLaunchedBtn sortByNameBtn themeComboBox -- cgit From 6d1f9d4d02cef93e92ebf0ba46a1c1296da50673 Mon Sep 17 00:00:00 2001 From: swirl Date: Mon, 21 Feb 2022 12:44:34 -0500 Subject: fix --- launcher/ui/pages/global/LauncherPage.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'launcher/ui') diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index 3722072d..6f68d0dd 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -38,7 +38,7 @@ QTabWidget::Rounded - 1 + 0 -- cgit