mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Add queue system with background downloading and much more (#73)
* Do not build here until it is merged. * WIP: Queue System. Right now crashes randomly for whatever reason.. * Animate queue spinner more slowly * Use LightLocks to prevent crashing in the queue (I hope it's fixed at least) * Build nightlies in queue-system * Use version.h for version and specify 7 digits * Remove unneeded $(CURDIR) I put that these for testing, but it's not needed * Multiple Changes, see desc for more. 1.) Theme Implementation. 2.) Show Battery + Time. 3.) Some more work on Queue-System (might still be broke). 4.) Update Copyright to 2021. 5.) Add `%FIRM%` to regex. 6.) Mass Add to Queue. 7.) Search with AND / OR filter. * Gaaah, not again... * Remove DoNothing, some LightLock changes, etc aka Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience. * See desc for more. - Current Queue Entry can now be canceled. - Fix installed list. - Display Download Speed. - BYE BYE Queue LightLock! * Various adjustments to the queue menu - Make cancel button slightly smaller - Right align "Steps: ..." text - Remove "Current Operation:" text - Change KB/MB/GB to KiB/MiB/GiB - Lots of little positioning tweaks - Fix bug where you could get stuck in the prompt - Make spinny thing have a ! when action is needed - Make extracting file increment at the start instead of the end - Delete dumb VS Code file and gitignore it * Change to hollow full charge plugged in icon * Fix the settings positions a bit * Fix custom font download not having prompt Also tweak the text positions, I forgot to change them Co-authored-by: StackZ <47382115+SuperSaiyajinStackZ@users.noreply.github.com>
This commit is contained in:
+45
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
* Copyright (C) 2019-2021 Universal-Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "json.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum favoriteMarks {
|
||||
STAR = 1 << 0,
|
||||
@@ -46,15 +47,58 @@ public:
|
||||
std::string GetUpdated(const std::string &unistoreName, const std::string &entry) const;
|
||||
int GetMarks(const std::string &unistoreName, const std::string &entry) const;
|
||||
bool UpdateAvailable(const std::string &unistoreName, const std::string &entry, const std::string &updated) const;
|
||||
std::vector<std::string> GetInstalled(const std::string &unistoreName, const std::string &entry) const;
|
||||
|
||||
void SetUpdated(const std::string &unistoreName, const std::string &entry, const std::string &updated) {
|
||||
if (this->metadataJson.is_discarded()) return;
|
||||
this->metadataJson[unistoreName][entry]["updated"] = updated;
|
||||
};
|
||||
|
||||
void SetMarks(const std::string &unistoreName, const std::string &entry, int marks) {
|
||||
if (this->metadataJson.is_discarded()) return;
|
||||
this->metadataJson[unistoreName][entry]["marks"] = marks;
|
||||
};
|
||||
|
||||
/* TODO: Handle this better. */
|
||||
void SetInstalled(const std::string &unistoreName, const std::string &entry, const std::string &name) {
|
||||
if (this->metadataJson.is_discarded()) return;
|
||||
|
||||
const std::vector<std::string> installs = this->GetInstalled(unistoreName, entry);
|
||||
bool write = true;
|
||||
|
||||
if (!installs.empty()) {
|
||||
write = !installs.empty();
|
||||
|
||||
for (int i = 0; i < (int)installs.size(); i++) {
|
||||
if (installs[i] == name) {
|
||||
write = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (write) this->metadataJson[unistoreName][entry]["installed"] += name;
|
||||
}
|
||||
|
||||
/* Remove installed state from a download list entry. */
|
||||
void RemoveInstalled(const std::string &unistoreName, const std::string &entry, const std::string &name) {
|
||||
if (this->metadataJson.is_discarded()) return;
|
||||
|
||||
const std::vector<std::string> installs = this->GetInstalled(unistoreName, entry);
|
||||
int idx = -1;
|
||||
|
||||
if (!installs.empty()) {
|
||||
for (int i = 0; i < (int)installs.size(); i++) {
|
||||
if (installs[i] == name) {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (idx != -1) this->metadataJson[unistoreName][entry]["installed"].erase(idx);
|
||||
}
|
||||
|
||||
void ImportMetadata();
|
||||
void SaveCall();
|
||||
private:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
* Copyright (C) 2019-2021 Universal-Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
std::string GetUniStoreTitle() const;
|
||||
std::string GetUniStoreAuthor() const;
|
||||
|
||||
/* Get Information of the UniStore Entries. */
|
||||
/* Get Information of the UniStore entries. */
|
||||
std::string GetTitleEntry(int index) const;
|
||||
std::string GetAuthorEntry(int index) const;
|
||||
std::string GetDescriptionEntry(int index) const;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
* Copyright (C) 2019-2021 Universal-Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
* Copyright (C) 2019-2021 Universal-Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -27,7 +27,7 @@
|
||||
#ifndef _UNIVERSAL_UPDATER_STORE_UTILS_HPP
|
||||
#define _UNIVERSAL_UPDATER_STORE_UTILS_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include "meta.hpp"
|
||||
#include "store.hpp"
|
||||
#include "storeEntry.hpp"
|
||||
#include <vector>
|
||||
@@ -39,33 +39,41 @@ enum class SortType : uint8_t {
|
||||
};
|
||||
|
||||
namespace StoreUtils {
|
||||
extern std::unique_ptr<Meta> meta;
|
||||
extern std::unique_ptr<Store> store;
|
||||
extern std::vector<std::unique_ptr<StoreEntry>> entries;
|
||||
|
||||
/* Grid. */
|
||||
void DrawGrid(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
void GridLogic(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay);
|
||||
void DrawGrid();
|
||||
void GridLogic(int ¤tMode, int &lastMode, bool &fetch, int &smallDelay);
|
||||
|
||||
/* Top List. */
|
||||
void DrawList(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
void ListLogic(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay);
|
||||
void DrawList();
|
||||
void ListLogic(int ¤tMode, int &lastMode, bool &fetch, int &smallDelay);
|
||||
|
||||
/* Entry Info. */
|
||||
void DrawEntryInfo(const std::unique_ptr<Store> &store, const std::unique_ptr<StoreEntry> &entry);
|
||||
void DrawEntryInfo(const std::unique_ptr<StoreEntry> &entry);
|
||||
void EntryHandle(bool &showMark, bool &fetch, bool &sFetch, int &mode, const std::unique_ptr<StoreEntry> &entry);
|
||||
|
||||
/* Side Menu. */
|
||||
void DrawSideMenu(int currentMenu);
|
||||
void SideMenuHandle(int ¤tMenu, bool &fetch, int &lastMenu);
|
||||
|
||||
/* Download Entries. */
|
||||
void DrawDownList(const std::unique_ptr<Store> &store, const std::vector<std::string> &entries, bool fetch, const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &sizes);
|
||||
void DownloadHandle(const std::unique_ptr<Store> &store, const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &entries, int ¤tMenu, std::unique_ptr<Meta> &meta, const int &lastMode, int &smallDelay);
|
||||
/* Download entries. */
|
||||
void DrawDownList(const std::vector<std::string> &entries, bool fetch, const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &sizes, const std::vector<bool> &installs);
|
||||
void DownloadHandle(const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &entries, int ¤tMenu, const int &lastMode, int &smallDelay, std::vector<bool> &installs);
|
||||
|
||||
/* Queue System. */
|
||||
void DrawQueueMenu(const int queueIndex);
|
||||
void QueueMenuHandle(int &queueIndex, int &storeMode);
|
||||
|
||||
/* Search + Favorite Menu. */
|
||||
void DrawSearchMenu(const std::vector<bool> &searchIncludes, const std::string &searchResult, int marks, bool updateFilter);
|
||||
void SearchHandle(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::vector<bool> &searchIncludes, std::unique_ptr<Meta> &meta, std::string &searchResult, int &marks, bool &updateFilter, bool ascending, SortType sorttype);
|
||||
void DrawSearchMenu(const std::vector<bool> &searchIncludes, const std::string &searchResult, int marks, bool updateFilter, bool isAND);
|
||||
void SearchHandle(std::vector<bool> &searchIncludes, std::string &searchResult, int &marks, bool &updateFilter, bool ascending, SortType sorttype, bool &isAND);
|
||||
|
||||
/* Mark Menu. */
|
||||
void DisplayMarkBox(int marks);
|
||||
void MarkHandle(std::unique_ptr<StoreEntry> &entry, const std::unique_ptr<Store> &store, bool &showMark, std::unique_ptr<Meta> &meta);
|
||||
void MarkHandle(std::unique_ptr<StoreEntry> &entry, bool &showMark);
|
||||
|
||||
/* Credits. */
|
||||
void DrawCredits();
|
||||
@@ -76,14 +84,14 @@ namespace StoreUtils {
|
||||
|
||||
/* Settings. */
|
||||
void DrawSettings(int page, int selection, int sPos);
|
||||
void SettingsHandle(int &page, bool &dspSettings, int &storeMode, int &selection, std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &meta, int &sPos);
|
||||
void SettingsHandle(int &page, bool &dspSettings, int &storeMode, int &selection, int &sPos);
|
||||
|
||||
/* Sorting. */
|
||||
void DrawSorting(bool asc, SortType st);
|
||||
void SortHandle(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, bool &asc, SortType &st);
|
||||
void SortHandle(bool &asc, SortType &st);
|
||||
|
||||
/* Release Notes. */
|
||||
void DrawReleaseNotes(const int &scrollIndex, const std::unique_ptr<StoreEntry> &entry, const std::unique_ptr<Store> &store);
|
||||
void DrawReleaseNotes(const int &scrollIndex, const std::unique_ptr<StoreEntry> &entry);
|
||||
void ReleaseNotesLogic(int &scrollIndex, int &storeMode);
|
||||
|
||||
bool compareTitleDescending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
@@ -95,13 +103,18 @@ namespace StoreUtils {
|
||||
bool compareUpdateDescending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
bool compareUpdateAscending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
|
||||
|
||||
void SortEntries(bool Ascending, SortType sorttype, std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
void SortEntries(bool Ascending, SortType sorttype);
|
||||
|
||||
void search(std::vector<std::unique_ptr<StoreEntry>> &entries, const std::string &query, bool title, bool author, bool category, bool console, int selectedMarks, bool updateAvl);
|
||||
void search(const std::string &query, bool title, bool author, bool category, bool console, int selectedMarks, bool updateAvl, bool isAND);
|
||||
|
||||
void FilterUpdateAvailable(std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
void FilterUpdateAvailable();
|
||||
|
||||
void ResetAll(const std::unique_ptr<Store> &store, const std::unique_ptr<Meta> &meta, std::vector<std::unique_ptr<StoreEntry>> &entries);
|
||||
void ResetAll();
|
||||
|
||||
void RefreshUpdateAVL();
|
||||
|
||||
void AddToQueue(int index, const std::string &entry, const std::string &entryName, const std::string &lUpdated);
|
||||
void AddAllToQueue();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user