From eede78daf7fe765f319fd3517404f72b9668e4ba Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Thu, 23 Mar 2023 21:51:29 +0100 Subject: [PATCH] Added logic for handling local theme repository changes to GuiThemeDownloader --- es-app/src/guis/GuiThemeDownloader.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/es-app/src/guis/GuiThemeDownloader.cpp b/es-app/src/guis/GuiThemeDownloader.cpp index 240538986..af6862fcb 100644 --- a/es-app/src/guis/GuiThemeDownloader.cpp +++ b/es-app/src/guis/GuiThemeDownloader.cpp @@ -305,8 +305,8 @@ bool GuiThemeDownloader::fetchRepository(std::pair rep if (statusEntryCount != 0) { if (allowReset) { - LOG(LogWarning) << "Repository \"" << mRepositoryName - << "\" contains local changes, performing hard reset"; + LOG(LogInfo) << "Repository \"" << mRepositoryName + << "\" contains local changes, performing hard reset"; git_object* objectHead {nullptr}; errorCode = git_revparse_single(&objectHead, repository, "HEAD"); errorCode = git_reset(repository, objectHead, GIT_RESET_HARD, nullptr); @@ -515,7 +515,7 @@ void GuiThemeDownloader::populateGUI() std::promise().swap(mPromise); mFuture = mPromise.get_future(); mFetchThread = std::thread(&GuiThemeDownloader::fetchRepository, this, - std::make_pair(theme.reponame, theme.url), true); + std::make_pair(theme.reponame, theme.url), false); }); mList->addRow(row); } @@ -557,6 +557,25 @@ void GuiThemeDownloader::update(int deltaTime) 0.75f : 0.45f * (1.778f / mRenderer->getScreenAspectRatio())))); } + else if (mRepositoryError == RepositoryError::HAS_LOCAL_CHANGES) { + mWindow->pushGui(new GuiMsgBox( + getHelpStyle(), + "THEME REPOSITORY \"" + mRepositoryName + + "\" CONTAINS LOCAL CHANGES. PROCEED TO OVERWRITE YOUR CHANGES " + "OR ABORT TO SKIP ALL UPDATES FOR THIS THEME", + "PROCEED", + [this] { + std::promise().swap(mPromise); + mFuture = mPromise.get_future(); + mFetchThread = + std::thread(&GuiThemeDownloader::fetchRepository, this, + std::make_pair(mRepositoryName, mUrl), true); + }, + "ABORT", [] { return; }, "", nullptr, true, true, + (mRenderer->getIsVerticalOrientation() ? + 0.75f : + 0.45f * (1.778f / mRenderer->getScreenAspectRatio())))); + } else { std::string errorMessage {"ERROR: "}; errorMessage.append(Utils::String::toUpper(mErrorMessage));