mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Theme sets are now repopulated when there were new downloads or updates using GuiThemeDownloader
This commit is contained in:
parent
4fcd956156
commit
1953d42f92
|
@ -9,6 +9,7 @@
|
|||
#include "guis/GuiThemeDownloader.h"
|
||||
|
||||
#include "EmulationStation.h"
|
||||
#include "ThemeData.h"
|
||||
#include "components/MenuComponent.h"
|
||||
#include "resources/ResourceManager.h"
|
||||
|
||||
|
@ -25,6 +26,7 @@ GuiThemeDownloader::GuiThemeDownloader()
|
|||
, mFetching {false}
|
||||
, mLatestThemesList {false}
|
||||
, mAttemptedFetch {false}
|
||||
, mHasThemeUpdates {false}
|
||||
, mFullscreenViewing {false}
|
||||
, mFullscreenViewerIndex {0}
|
||||
{
|
||||
|
@ -173,6 +175,11 @@ GuiThemeDownloader::~GuiThemeDownloader()
|
|||
mFetchThread.join();
|
||||
|
||||
git_libgit2_shutdown();
|
||||
|
||||
if (mHasThemeUpdates) {
|
||||
LOG(LogInfo) << "GuiThemeDownloader: There are updates, repopulating theme sets";
|
||||
ThemeData::populateThemeSets();
|
||||
}
|
||||
}
|
||||
|
||||
bool GuiThemeDownloader::fetchRepository(const std::string& repositoryName,
|
||||
|
@ -240,6 +247,8 @@ bool GuiThemeDownloader::fetchRepository(const std::string& repositoryName,
|
|||
git_reference_free(oldTargetRef);
|
||||
}
|
||||
git_buf_dispose(&buffer);
|
||||
if (repositoryName != "themes-list")
|
||||
mHasThemeUpdates = true;
|
||||
}
|
||||
|
||||
errorCode = git_revparse_single(&object, repository, "FETCH_HEAD");
|
||||
|
@ -266,6 +275,8 @@ bool GuiThemeDownloader::fetchRepository(const std::string& repositoryName,
|
|||
errorCode = git_revparse_single(&objectHead, repository, "HEAD");
|
||||
errorCode = git_reset(repository, objectHead, GIT_RESET_HARD, nullptr);
|
||||
git_object_free(objectHead);
|
||||
if (repositoryName != "themes-list")
|
||||
mHasThemeUpdates = true;
|
||||
}
|
||||
else {
|
||||
LOG(LogWarning) << "Repository \"" << repositoryName
|
||||
|
@ -282,6 +293,8 @@ bool GuiThemeDownloader::fetchRepository(const std::string& repositoryName,
|
|||
LOG(LogInfo) << "Repository \"" << repositoryName
|
||||
<< "\" contains local changes, performing hard reset";
|
||||
resetRepository(repository);
|
||||
if (repositoryName != "themes-list")
|
||||
mHasThemeUpdates = true;
|
||||
}
|
||||
|
||||
if (mergeAnalysis & GIT_MERGE_ANALYSIS_UP_TO_DATE) {
|
||||
|
@ -344,8 +357,10 @@ bool GuiThemeDownloader::fetchRepository(const std::string& repositoryName,
|
|||
return true;
|
||||
}
|
||||
|
||||
if (repositoryName != "themes-list")
|
||||
if (repositoryName != "themes-list") {
|
||||
mMessage = "THEME HAS BEEN UPDATED";
|
||||
mHasThemeUpdates = true;
|
||||
}
|
||||
|
||||
mPromise.set_value(true);
|
||||
return false;
|
||||
|
@ -1087,6 +1102,9 @@ bool GuiThemeDownloader::cloneRepository(const std::string& repositoryName, cons
|
|||
return true;
|
||||
}
|
||||
|
||||
if (repositoryName != "themes-list")
|
||||
mHasThemeUpdates = true;
|
||||
|
||||
mLatestThemesList = true;
|
||||
mPromise.set_value(true);
|
||||
return false;
|
||||
|
|
|
@ -136,6 +136,7 @@ private:
|
|||
std::atomic<bool> mFetching;
|
||||
std::atomic<bool> mLatestThemesList;
|
||||
bool mAttemptedFetch;
|
||||
bool mHasThemeUpdates;
|
||||
static inline std::atomic<float> mReceivedObjectsProgress {0.0f};
|
||||
static inline std::atomic<float> mResolveDeltaProgress {0.0f};
|
||||
std::vector<ThemeEntry> mThemeSets;
|
||||
|
|
|
@ -768,8 +768,7 @@ const ThemeData::ThemeElement* ThemeData::getElement(const std::string& view,
|
|||
|
||||
void ThemeData::populateThemeSets()
|
||||
{
|
||||
assert(sThemeSets.empty());
|
||||
|
||||
sThemeSets.clear();
|
||||
LOG(LogInfo) << "Checking for available theme sets...";
|
||||
|
||||
// Check for themes first under the home directory, then under the data installation
|
||||
|
|
Loading…
Reference in a new issue