mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 07:05:39 +00:00
Added a first run dialog to GuiThemeDownloader
This commit is contained in:
parent
c1fa6c4aff
commit
82fd96580e
|
@ -24,6 +24,7 @@ GuiThemeDownloader::GuiThemeDownloader()
|
||||||
, mRepositoryError {RepositoryError::NO_REPO_ERROR}
|
, mRepositoryError {RepositoryError::NO_REPO_ERROR}
|
||||||
, mFetching {false}
|
, mFetching {false}
|
||||||
, mLatestThemesList {false}
|
, mLatestThemesList {false}
|
||||||
|
, mAttemptedFetch {false}
|
||||||
, mFullscreenViewing {false}
|
, mFullscreenViewing {false}
|
||||||
, mFullscreenViewerIndex {0}
|
, mFullscreenViewerIndex {0}
|
||||||
{
|
{
|
||||||
|
@ -164,7 +165,6 @@ GuiThemeDownloader::GuiThemeDownloader()
|
||||||
mFuture = mPromise.get_future();
|
mFuture = mPromise.get_future();
|
||||||
|
|
||||||
mThemeDirectory = Utils::FileSystem::getHomePath() + "/.emulationstation/themes/";
|
mThemeDirectory = Utils::FileSystem::getHomePath() + "/.emulationstation/themes/";
|
||||||
fetchThemesList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiThemeDownloader::~GuiThemeDownloader()
|
GuiThemeDownloader::~GuiThemeDownloader()
|
||||||
|
@ -752,6 +752,13 @@ void GuiThemeDownloader::setupFullscreenViewer()
|
||||||
|
|
||||||
void GuiThemeDownloader::update(int deltaTime)
|
void GuiThemeDownloader::update(int deltaTime)
|
||||||
{
|
{
|
||||||
|
if (!mAttemptedFetch) {
|
||||||
|
// We need to run this here instead of from the constructor so that GuiMsgBox will be
|
||||||
|
// on top of the GUI stack if it needs to be displayed.
|
||||||
|
mAttemptedFetch = true;
|
||||||
|
fetchThemesList();
|
||||||
|
}
|
||||||
|
|
||||||
if (mFuture.valid()) {
|
if (mFuture.valid()) {
|
||||||
// Only wait one millisecond as this update() function runs very frequently.
|
// Only wait one millisecond as this update() function runs very frequently.
|
||||||
if (mFuture.wait_for(std::chrono::milliseconds(1)) == std::future_status::ready) {
|
if (mFuture.wait_for(std::chrono::milliseconds(1)) == std::future_status::ready) {
|
||||||
|
@ -912,7 +919,7 @@ bool GuiThemeDownloader::input(InputConfig* config, Input input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config->isMappedTo("b", input) && input.value) {
|
if (config->isMappedTo("b", input) && input.value && !mFetching) {
|
||||||
delete this;
|
delete this;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -980,11 +987,33 @@ bool GuiThemeDownloader::fetchThemesList()
|
||||||
mStatusText = "UPDATING THEMES LIST";
|
mStatusText = "UPDATING THEMES LIST";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG(LogInfo) << "GuiThemeDownloader: Creating initial themes list repository clone";
|
mWindow->pushGui(new GuiMsgBox(
|
||||||
mFetchThread = std::thread(&GuiThemeDownloader::cloneRepository, this, repositoryName, url);
|
getHelpStyle(),
|
||||||
mStatusType = StatusType::STATUS_DOWNLOADING;
|
"IT SEEMS AS IF YOU'RE USING THE THEME DOWNLOADER FOR THE FIRST TIME. "
|
||||||
mStatusText = "DOWNLOADING THEMES LIST";
|
"AS SUCH THE THEMES LIST REPOSITORY WILL BE DOWNLOADED WHICH WILL TAKE A LITTLE "
|
||||||
return false;
|
"WHILE. SUBSEQUENT RUNS WILL HOWEVER BE MUCH FASTER AS ONLY UPDATED FILES WILL "
|
||||||
|
"BE FETCHED. THE SAME IS TRUE FOR ANY THEMES YOU DOWNLOAD. NOTE THAT YOU CAN'T "
|
||||||
|
"ABORT AN ONGOING DOWNLOAD AS THAT COULD LEAD TO DATA CORRUPTION.",
|
||||||
|
"PROCEED",
|
||||||
|
[this, repositoryName, url] {
|
||||||
|
LOG(LogInfo) << "GuiThemeDownloader: Creating initial themes list repository clone";
|
||||||
|
mFetchThread =
|
||||||
|
std::thread(&GuiThemeDownloader::cloneRepository, this, repositoryName, url);
|
||||||
|
mStatusType = StatusType::STATUS_DOWNLOADING;
|
||||||
|
mStatusText = "DOWNLOADING THEMES LIST";
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
"ABORT",
|
||||||
|
[&] {
|
||||||
|
delete this;
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
"", nullptr, true, true,
|
||||||
|
(mRenderer->getIsVerticalOrientation() ?
|
||||||
|
0.85f :
|
||||||
|
0.54f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||||
|
|
||||||
|
std::string teststring;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -135,6 +135,7 @@ private:
|
||||||
std::future<bool> mFuture;
|
std::future<bool> mFuture;
|
||||||
std::atomic<bool> mFetching;
|
std::atomic<bool> mFetching;
|
||||||
std::atomic<bool> mLatestThemesList;
|
std::atomic<bool> mLatestThemesList;
|
||||||
|
bool mAttemptedFetch;
|
||||||
static inline std::atomic<float> mReceivedObjectsProgress {0.0f};
|
static inline std::atomic<float> mReceivedObjectsProgress {0.0f};
|
||||||
static inline std::atomic<float> mResolveDeltaProgress {0.0f};
|
static inline std::atomic<float> mResolveDeltaProgress {0.0f};
|
||||||
std::vector<ThemeEntry> mThemeSets;
|
std::vector<ThemeEntry> mThemeSets;
|
||||||
|
|
Loading…
Reference in a new issue