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

Only fetch the news once

This commit is contained in:
Joshua Goins 2022-03-13 19:49:28 -04:00
parent 30d2791810
commit 703f66a8d6

View file

@ -202,25 +202,8 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
reloadControls(); reloadControls();
getHeadline(core, [this](Headline headline) { getHeadline(core, [&](Headline headline) {
this->headline = headline; this->headline = headline;
reloadControls();
});
}
ProfileSettings LauncherWindow::currentProfile() const {
return core.getProfile(profileSelect->currentIndex());
}
ProfileSettings& LauncherWindow::currentProfile() {
return core.getProfile(profileSelect->currentIndex());
}
void LauncherWindow::reloadControls() {
if(currentlyReloadingControls)
return;
currentlyReloadingControls = true;
if(!headline.banner.empty()) { if(!headline.banner.empty()) {
auto request = QNetworkRequest(headline.banner[0].bannerImage); auto request = QNetworkRequest(headline.banner[0].bannerImage);
@ -267,6 +250,22 @@ void LauncherWindow::reloadControls() {
newsListView->insertTopLevelItems(0, QList<QTreeWidgetItem*>({newsItem, pinnedItem, topicsItem})); newsListView->insertTopLevelItems(0, QList<QTreeWidgetItem*>({newsItem, pinnedItem, topicsItem}));
} }
});
}
ProfileSettings LauncherWindow::currentProfile() const {
return core.getProfile(profileSelect->currentIndex());
}
ProfileSettings& LauncherWindow::currentProfile() {
return core.getProfile(profileSelect->currentIndex());
}
void LauncherWindow::reloadControls() {
if(currentlyReloadingControls)
return;
currentlyReloadingControls = true;
const int oldIndex = profileSelect->currentIndex(); const int oldIndex = profileSelect->currentIndex();