diff --git a/CMakeLists.txt b/CMakeLists.txt index cf8e4df08..18ca28d11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,7 +173,7 @@ endif() ##################################### Set Application options ##################################### ######## Set URLs ######## -set(Launcher_NEWS_RSS_URL "https://prismlauncher.org/feed/feed.xml" CACHE STRING "URL to fetch Prism Launcher's news RSS feed from.") +set(Launcher_NEWS_RSS_URL "" CACHE STRING "URL to fetch Prism Launcher's news RSS feed from.") set(Launcher_NEWS_OPEN_URL "https://prismlauncher.org/news" CACHE STRING "URL that gets opened when the user clicks 'More News'") set(Launcher_HELP_URL "https://prismlauncher.org/wiki/help-pages/%1" CACHE STRING "URL (with arg %1 to be substituted with page-id) that gets opened when the user requests help") diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 5748a788c..6610e197b 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -86,7 +86,6 @@ #include #include #include -#include #include #include #include "InstanceWindow.h" @@ -100,7 +99,6 @@ #include "ui/dialogs/IconPickerDialog.h" #include "ui/dialogs/ImportResourceDialog.h" #include "ui/dialogs/NewInstanceDialog.h" -#include "ui/dialogs/NewsDialog.h" #include "ui/dialogs/ProgressDialog.h" #include "ui/instanceview/InstanceDelegate.h" #include "ui/instanceview/InstanceProxyModel.h" @@ -184,7 +182,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi ui->instanceToolBar->setVisibilityState(instanceToolbarSetting->get().toByteArray()); - ui->instanceToolBar->addContextMenuAction(ui->newsToolBar->toggleViewAction()); ui->instanceToolBar->addContextMenuAction(ui->instanceToolBar->toggleViewAction()); ui->instanceToolBar->addContextMenuAction(ui->actionLockToolbars); } @@ -238,7 +235,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi // add the toolbar toggles to the view menu ui->viewMenu->addAction(ui->instanceToolBar->toggleViewAction()); - ui->viewMenu->addAction(ui->newsToolBar->toggleViewAction()); updateThemeMenu(); updateMainToolBar(); @@ -266,21 +262,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi connect(secretEventFilter, &KonamiCode::triggered, this, &MainWindow::konamiTriggered); } - // Add the news label to the news toolbar. - { - m_newsChecker.reset(new NewsChecker(APPLICATION->network(), BuildConfig.NEWS_RSS_URL)); - newsLabel = new QToolButton(); - newsLabel->setIcon(APPLICATION->getThemedIcon("news")); - newsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - newsLabel->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - newsLabel->setFocusPolicy(Qt::NoFocus); - ui->newsToolBar->insertWidget(ui->actionMoreNews, newsLabel); - - QObject::connect(newsLabel, &QAbstractButton::clicked, this, &MainWindow::newsButtonClicked); - QObject::connect(m_newsChecker.get(), &NewsChecker::newsLoaded, this, &MainWindow::updateNewsLabel); - updateNewsLabel(); - } - // Create the instance list widget { view = new InstanceView(ui->centralWidget); @@ -371,12 +352,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi // TODO: refresh accounts here? // auto accounts = APPLICATION->accounts(); - // load the news - { - m_newsChecker->reloadNews(); - updateNewsLabel(); - } - if (APPLICATION->updaterEnabled()) { bool updatesAllowed = APPLICATION->updatesAreAllowed(); updatesAllowedChanged(updatesAllowed); @@ -459,7 +434,6 @@ void MainWindow::lockToolbars(bool state) { ui->mainToolBar->setMovable(!state); ui->instanceToolBar->setMovable(!state); - ui->newsToolBar->setMovable(!state); APPLICATION->settings()->set("ToolbarsLocked", state); } @@ -473,14 +447,12 @@ void MainWindow::konamiTriggered() ui->mainToolBar->setStyleSheet(""); ui->instanceToolBar->setStyleSheet(""); ui->centralWidget->setStyleSheet(""); - ui->newsToolBar->setStyleSheet(""); ui->statusBar->setStyleSheet(""); qDebug() << "Super Secret Mode DEACTIVATED!"; } else { ui->mainToolBar->setStyleSheet(stylesheet); ui->instanceToolBar->setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1," + gradient); ui->centralWidget->setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1," + gradient); - ui->newsToolBar->setStyleSheet(stylesheet); ui->statusBar->setStyleSheet(stylesheet); qDebug() << "Super Secret Mode ACTIVATED!"; } @@ -759,26 +731,6 @@ bool MainWindow::eventFilter(QObject* obj, QEvent* ev) return QMainWindow::eventFilter(obj, ev); } -void MainWindow::updateNewsLabel() -{ - if (m_newsChecker->isLoadingNews()) { - newsLabel->setText(tr("Loading news...")); - newsLabel->setEnabled(false); - ui->actionMoreNews->setVisible(false); - } else { - QList entries = m_newsChecker->getNewsEntries(); - if (entries.length() > 0) { - newsLabel->setText(entries[0]->title); - newsLabel->setEnabled(true); - ui->actionMoreNews->setVisible(true); - } else { - newsLabel->setText(tr("No news available.")); - newsLabel->setEnabled(false); - ui->actionMoreNews->setVisible(false); - } - } -} - QList stringToIntList(const QString& string) { #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) @@ -1315,21 +1267,6 @@ void MainWindow::on_actionOpenWiki_triggered() DesktopServices::openUrl(QUrl(BuildConfig.HELP_URL.arg(""))); } -void MainWindow::on_actionMoreNews_triggered() -{ - auto entries = m_newsChecker->getNewsEntries(); - NewsDialog news_dialog(entries, this); - news_dialog.exec(); -} - -void MainWindow::newsButtonClicked() -{ - auto entries = m_newsChecker->getNewsEntries(); - NewsDialog news_dialog(entries, this); - news_dialog.toggleArticleList(); - news_dialog.exec(); -} - void MainWindow::onCatChanged(int) { setCatBackground(APPLICATION->settings()->get("TheCat").toBool()); diff --git a/launcher/ui/MainWindow.h b/launcher/ui/MainWindow.h index d2e154643..21c16a74b 100644 --- a/launcher/ui/MainWindow.h +++ b/launcher/ui/MainWindow.h @@ -51,7 +51,6 @@ #include "net/NetJob.h" class LaunchController; -class NewsChecker; class QToolButton; class InstanceProxyModel; class LabeledToolButton; @@ -140,10 +139,6 @@ class MainWindow : public QMainWindow { void on_actionOpenWiki_triggered(); - void on_actionMoreNews_triggered(); - - void newsButtonClicked(); - void on_actionLaunchInstance_triggered(); void on_actionKillInstance_triggered(); @@ -199,8 +194,6 @@ class MainWindow : public QMainWindow { void repopulateAccountsMenu(); - void updateNewsLabel(); - void konamiTriggered(); void globalSettingsClosed(); @@ -233,7 +226,6 @@ class MainWindow : public QMainWindow { // these are managed by Qt's memory management model! InstanceView* view = nullptr; InstanceProxyModel* proxymodel = nullptr; - QToolButton* newsLabel = nullptr; QLabel* m_statusLeft = nullptr; QLabel* m_statusCenter = nullptr; LabeledToolButton* changeIconButton = nullptr; @@ -243,8 +235,6 @@ class MainWindow : public QMainWindow { std::shared_ptr instanceToolbarSetting = nullptr; - unique_qobject_ptr m_newsChecker; - InstancePtr m_selectedInstance; QString m_currentInstIcon; diff --git a/launcher/ui/MainWindow.ui b/launcher/ui/MainWindow.ui index 1ee3a5632..722befb9e 100644 --- a/launcher/ui/MainWindow.ui +++ b/launcher/ui/MainWindow.ui @@ -59,33 +59,6 @@ - - - News Toolbar - - - Qt::BottomToolBarArea|Qt::TopToolBarArea - - - - 16 - 16 - - - - Qt::ToolButtonTextBesideIcon - - - false - - - BottomToolBarArea - - - false - - - Instance Toolbar