1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-22 20:47:45 +00:00

Add a unified news option

This commit is contained in:
Joshua Goins 2023-07-31 18:59:42 -04:00
parent 160b96229e
commit 79483c1303
3 changed files with 11 additions and 33 deletions

View file

@ -12,10 +12,7 @@ SPDX-License-Identifier: CC0-1.0
<entry name="CloseWhenLaunched" type="bool">
<default>true</default>
</entry>
<entry name="ShowNewsBanners" type="bool">
<default>true</default>
</entry>
<entry name="ShowNewsList" type="bool">
<entry name="ShowNews" type="bool">
<default>true</default>
</entry>
<entry name="AutoLogin" type="string">

View file

@ -59,8 +59,7 @@ class LauncherCore : public QObject
Q_PROPERTY(ProfileManager *profileManager READ profileManager CONSTANT)
Q_PROPERTY(AccountManager *accountManager READ accountManager CONSTANT)
Q_PROPERTY(bool closeWhenLaunched READ closeWhenLaunched WRITE setCloseWhenLaunched NOTIFY closeWhenLaunchedChanged)
Q_PROPERTY(bool showNewsBanners READ showNewsBanners WRITE setShowNewsBanners NOTIFY showNewsBannersChanged)
Q_PROPERTY(bool showNewsList READ showNewsList WRITE setShowNewsList NOTIFY showNewsListChanged)
Q_PROPERTY(bool showNews READ showNews WRITE setShowNews NOTIFY showNewsChanged)
Q_PROPERTY(Headline *headline READ headline NOTIFY newsChanged)
public:
@ -115,11 +114,8 @@ public:
bool closeWhenLaunched() const;
void setCloseWhenLaunched(bool value);
bool showNewsBanners() const;
void setShowNewsBanners(bool value);
bool showNewsList() const;
void setShowNewsList(bool value);
bool showNews() const;
void setShowNews(bool value);
int defaultProfileIndex = 0;
@ -147,8 +143,7 @@ signals:
void successfulLaunch();
void gameClosed();
void closeWhenLaunchedChanged();
void showNewsBannersChanged();
void showNewsListChanged();
void showNewsChanged();
void loginError(QString message);
void stageChanged(QString message);
void stageIndeterminate();

View file

@ -416,31 +416,17 @@ void LauncherCore::setCloseWhenLaunched(const bool value)
}
}
bool LauncherCore::showNewsBanners() const
bool LauncherCore::showNews() const
{
return Config::showNewsBanners();
return Config::showNews();
}
void LauncherCore::setShowNewsBanners(const bool value)
void LauncherCore::setShowNews(const bool value)
{
if (value != Config::showNewsBanners()) {
Config::setShowNewsBanners(value);
if (value != Config::showNews()) {
Config::setShowNews(value);
Config::self()->save();
Q_EMIT showNewsBannersChanged();
}
}
bool LauncherCore::showNewsList() const
{
return Config::showNewsList();
}
void LauncherCore::setShowNewsList(const bool value)
{
if (value != Config::showNewsList()) {
Config::setShowNewsList(value);
Config::self()->save();
Q_EMIT showNewsListChanged();
Q_EMIT showNewsChanged();
}
}