Remove news toolbar
This commit is contained in:
parent
1b98be00f6
commit
b8f9d18e26
@ -173,7 +173,7 @@ endif()
|
|||||||
##################################### Set Application options #####################################
|
##################################### Set Application options #####################################
|
||||||
|
|
||||||
######## Set URLs ########
|
######## 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_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")
|
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")
|
||||||
|
|
||||||
|
@ -86,7 +86,6 @@
|
|||||||
#include <minecraft/auth/AccountList.h>
|
#include <minecraft/auth/AccountList.h>
|
||||||
#include <net/ApiDownload.h>
|
#include <net/ApiDownload.h>
|
||||||
#include <net/NetJob.h>
|
#include <net/NetJob.h>
|
||||||
#include <news/NewsChecker.h>
|
|
||||||
#include <tools/BaseProfiler.h>
|
#include <tools/BaseProfiler.h>
|
||||||
#include <updater/ExternalUpdater.h>
|
#include <updater/ExternalUpdater.h>
|
||||||
#include "InstanceWindow.h"
|
#include "InstanceWindow.h"
|
||||||
@ -100,7 +99,6 @@
|
|||||||
#include "ui/dialogs/IconPickerDialog.h"
|
#include "ui/dialogs/IconPickerDialog.h"
|
||||||
#include "ui/dialogs/ImportResourceDialog.h"
|
#include "ui/dialogs/ImportResourceDialog.h"
|
||||||
#include "ui/dialogs/NewInstanceDialog.h"
|
#include "ui/dialogs/NewInstanceDialog.h"
|
||||||
#include "ui/dialogs/NewsDialog.h"
|
|
||||||
#include "ui/dialogs/ProgressDialog.h"
|
#include "ui/dialogs/ProgressDialog.h"
|
||||||
#include "ui/instanceview/InstanceDelegate.h"
|
#include "ui/instanceview/InstanceDelegate.h"
|
||||||
#include "ui/instanceview/InstanceProxyModel.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->setVisibilityState(instanceToolbarSetting->get().toByteArray());
|
||||||
|
|
||||||
ui->instanceToolBar->addContextMenuAction(ui->newsToolBar->toggleViewAction());
|
|
||||||
ui->instanceToolBar->addContextMenuAction(ui->instanceToolBar->toggleViewAction());
|
ui->instanceToolBar->addContextMenuAction(ui->instanceToolBar->toggleViewAction());
|
||||||
ui->instanceToolBar->addContextMenuAction(ui->actionLockToolbars);
|
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
|
// add the toolbar toggles to the view menu
|
||||||
ui->viewMenu->addAction(ui->instanceToolBar->toggleViewAction());
|
ui->viewMenu->addAction(ui->instanceToolBar->toggleViewAction());
|
||||||
ui->viewMenu->addAction(ui->newsToolBar->toggleViewAction());
|
|
||||||
|
|
||||||
updateThemeMenu();
|
updateThemeMenu();
|
||||||
updateMainToolBar();
|
updateMainToolBar();
|
||||||
@ -266,21 +262,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
connect(secretEventFilter, &KonamiCode::triggered, this, &MainWindow::konamiTriggered);
|
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
|
// Create the instance list widget
|
||||||
{
|
{
|
||||||
view = new InstanceView(ui->centralWidget);
|
view = new InstanceView(ui->centralWidget);
|
||||||
@ -371,12 +352,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
// TODO: refresh accounts here?
|
// TODO: refresh accounts here?
|
||||||
// auto accounts = APPLICATION->accounts();
|
// auto accounts = APPLICATION->accounts();
|
||||||
|
|
||||||
// load the news
|
|
||||||
{
|
|
||||||
m_newsChecker->reloadNews();
|
|
||||||
updateNewsLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (APPLICATION->updaterEnabled()) {
|
if (APPLICATION->updaterEnabled()) {
|
||||||
bool updatesAllowed = APPLICATION->updatesAreAllowed();
|
bool updatesAllowed = APPLICATION->updatesAreAllowed();
|
||||||
updatesAllowedChanged(updatesAllowed);
|
updatesAllowedChanged(updatesAllowed);
|
||||||
@ -459,7 +434,6 @@ void MainWindow::lockToolbars(bool state)
|
|||||||
{
|
{
|
||||||
ui->mainToolBar->setMovable(!state);
|
ui->mainToolBar->setMovable(!state);
|
||||||
ui->instanceToolBar->setMovable(!state);
|
ui->instanceToolBar->setMovable(!state);
|
||||||
ui->newsToolBar->setMovable(!state);
|
|
||||||
APPLICATION->settings()->set("ToolbarsLocked", state);
|
APPLICATION->settings()->set("ToolbarsLocked", state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,14 +447,12 @@ void MainWindow::konamiTriggered()
|
|||||||
ui->mainToolBar->setStyleSheet("");
|
ui->mainToolBar->setStyleSheet("");
|
||||||
ui->instanceToolBar->setStyleSheet("");
|
ui->instanceToolBar->setStyleSheet("");
|
||||||
ui->centralWidget->setStyleSheet("");
|
ui->centralWidget->setStyleSheet("");
|
||||||
ui->newsToolBar->setStyleSheet("");
|
|
||||||
ui->statusBar->setStyleSheet("");
|
ui->statusBar->setStyleSheet("");
|
||||||
qDebug() << "Super Secret Mode DEACTIVATED!";
|
qDebug() << "Super Secret Mode DEACTIVATED!";
|
||||||
} else {
|
} else {
|
||||||
ui->mainToolBar->setStyleSheet(stylesheet);
|
ui->mainToolBar->setStyleSheet(stylesheet);
|
||||||
ui->instanceToolBar->setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1," + gradient);
|
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->centralWidget->setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1," + gradient);
|
||||||
ui->newsToolBar->setStyleSheet(stylesheet);
|
|
||||||
ui->statusBar->setStyleSheet(stylesheet);
|
ui->statusBar->setStyleSheet(stylesheet);
|
||||||
qDebug() << "Super Secret Mode ACTIVATED!";
|
qDebug() << "Super Secret Mode ACTIVATED!";
|
||||||
}
|
}
|
||||||
@ -759,26 +731,6 @@ bool MainWindow::eventFilter(QObject* obj, QEvent* ev)
|
|||||||
return QMainWindow::eventFilter(obj, 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<NewsEntryPtr> 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<int> stringToIntList(const QString& string)
|
QList<int> stringToIntList(const QString& string)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
#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("")));
|
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)
|
void MainWindow::onCatChanged(int)
|
||||||
{
|
{
|
||||||
setCatBackground(APPLICATION->settings()->get("TheCat").toBool());
|
setCatBackground(APPLICATION->settings()->get("TheCat").toBool());
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
#include "net/NetJob.h"
|
#include "net/NetJob.h"
|
||||||
|
|
||||||
class LaunchController;
|
class LaunchController;
|
||||||
class NewsChecker;
|
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
class InstanceProxyModel;
|
class InstanceProxyModel;
|
||||||
class LabeledToolButton;
|
class LabeledToolButton;
|
||||||
@ -140,10 +139,6 @@ class MainWindow : public QMainWindow {
|
|||||||
|
|
||||||
void on_actionOpenWiki_triggered();
|
void on_actionOpenWiki_triggered();
|
||||||
|
|
||||||
void on_actionMoreNews_triggered();
|
|
||||||
|
|
||||||
void newsButtonClicked();
|
|
||||||
|
|
||||||
void on_actionLaunchInstance_triggered();
|
void on_actionLaunchInstance_triggered();
|
||||||
|
|
||||||
void on_actionKillInstance_triggered();
|
void on_actionKillInstance_triggered();
|
||||||
@ -199,8 +194,6 @@ class MainWindow : public QMainWindow {
|
|||||||
|
|
||||||
void repopulateAccountsMenu();
|
void repopulateAccountsMenu();
|
||||||
|
|
||||||
void updateNewsLabel();
|
|
||||||
|
|
||||||
void konamiTriggered();
|
void konamiTriggered();
|
||||||
|
|
||||||
void globalSettingsClosed();
|
void globalSettingsClosed();
|
||||||
@ -233,7 +226,6 @@ class MainWindow : public QMainWindow {
|
|||||||
// these are managed by Qt's memory management model!
|
// these are managed by Qt's memory management model!
|
||||||
InstanceView* view = nullptr;
|
InstanceView* view = nullptr;
|
||||||
InstanceProxyModel* proxymodel = nullptr;
|
InstanceProxyModel* proxymodel = nullptr;
|
||||||
QToolButton* newsLabel = nullptr;
|
|
||||||
QLabel* m_statusLeft = nullptr;
|
QLabel* m_statusLeft = nullptr;
|
||||||
QLabel* m_statusCenter = nullptr;
|
QLabel* m_statusCenter = nullptr;
|
||||||
LabeledToolButton* changeIconButton = nullptr;
|
LabeledToolButton* changeIconButton = nullptr;
|
||||||
@ -243,8 +235,6 @@ class MainWindow : public QMainWindow {
|
|||||||
|
|
||||||
std::shared_ptr<Setting> instanceToolbarSetting = nullptr;
|
std::shared_ptr<Setting> instanceToolbarSetting = nullptr;
|
||||||
|
|
||||||
unique_qobject_ptr<NewsChecker> m_newsChecker;
|
|
||||||
|
|
||||||
InstancePtr m_selectedInstance;
|
InstancePtr m_selectedInstance;
|
||||||
QString m_currentInstIcon;
|
QString m_currentInstIcon;
|
||||||
|
|
||||||
|
@ -59,33 +59,6 @@
|
|||||||
<addaction name="actionCAT"/>
|
<addaction name="actionCAT"/>
|
||||||
<addaction name="actionAccountsButton"/>
|
<addaction name="actionAccountsButton"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="newsToolBar">
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>News Toolbar</string>
|
|
||||||
</property>
|
|
||||||
<property name="allowedAreas">
|
|
||||||
<set>Qt::BottomToolBarArea|Qt::TopToolBarArea</set>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
|
||||||
</property>
|
|
||||||
<property name="floatable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<attribute name="toolBarArea">
|
|
||||||
<enum>BottomToolBarArea</enum>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="toolBarBreak">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
<addaction name="actionMoreNews"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="WideBar" name="instanceToolBar">
|
<widget class="WideBar" name="instanceToolBar">
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Instance Toolbar</string>
|
<string>Instance Toolbar</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user