diff --git a/MultiMC.cpp b/MultiMC.cpp index 5956501f9..3644a6ada 100644 --- a/MultiMC.cpp +++ b/MultiMC.cpp @@ -27,7 +27,6 @@ #include "logic/java/JavaUtils.h" #include "logic/updater/UpdateChecker.h" -#include "logic/updater/NotificationChecker.h" #include "logic/tools/JProfiler.h" #include "logic/tools/JVisualVM.h" @@ -194,9 +193,6 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar // initialize the updater m_updateChecker.reset(new UpdateChecker()); - // initialize the notification checker - m_notificationChecker.reset(new NotificationChecker()); - m_translationChecker.reset(new TranslationDownloader()); // and instances diff --git a/MultiMC.h b/MultiMC.h index 0f8b9577f..59ff32d29 100644 --- a/MultiMC.h +++ b/MultiMC.h @@ -19,7 +19,6 @@ class ForgeVersionList; class LiteLoaderVersionList; class JavaVersionList; class UpdateChecker; -class NotificationChecker; class BaseProfilerFactory; class BaseDetachedToolFactory; class TranslationDownloader; @@ -95,11 +94,6 @@ public: return m_updateChecker; } - std::shared_ptr notificationChecker() - { - return m_notificationChecker; - } - std::shared_ptr lwjgllist(); std::shared_ptr forgelist(); @@ -184,7 +178,6 @@ private: std::shared_ptr m_settings; std::shared_ptr m_instances; std::shared_ptr m_updateChecker; - std::shared_ptr m_notificationChecker; std::shared_ptr m_accounts; std::shared_ptr m_icons; std::shared_ptr m_qnam; diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index 27b8563b8..3bffb8626 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -622,8 +622,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi auto updater = MMC->updateChecker(); updater->checkForUpdate(false); } - - connect(MMC->notificationChecker().get(), + m_notificationChecker.reset(new NotificationChecker()); + connect(m_notificationChecker.get(), &NotificationChecker::notificationCheckFinished, this, &MainWindow::notificationsChanged); } @@ -956,7 +956,7 @@ QString intListToString(const QList &list) void MainWindow::notificationsChanged() { QList entries = - MMC->notificationChecker()->notificationEntries(); + m_notificationChecker->notificationEntries(); QList shownNotifications = stringToIntList(MMC->settings()->get("ShownNotifications").toString()); for (auto it = entries.begin(); it != entries.end(); ++it) diff --git a/gui/MainWindow.h b/gui/MainWindow.h index 4e8e8f356..875c2f864 100644 --- a/gui/MainWindow.h +++ b/gui/MainWindow.h @@ -25,6 +25,7 @@ #include "logic/net/NetJob.h" class NewsChecker; +class NotificationChecker; class QToolButton; class LabeledToolButton; class QLabel; @@ -200,6 +201,7 @@ private: std::shared_ptr m_globalSettingsProvider; std::shared_ptr m_newsChecker; + std::shared_ptr m_notificationChecker; InstancePtr m_selectedInstance; QString m_currentInstIcon;