Add Description to UniStorev2 List.

This commit is contained in:
StackZ
2020-07-15 23:38:48 +02:00
parent dcb7bd66ee
commit 2f0c07df6e
3 changed files with 20 additions and 19 deletions
+2
View File
@@ -35,6 +35,7 @@
struct UniStoreV2Struct { struct UniStoreV2Struct {
std::string title; std::string title;
std::string author; std::string author;
std::string description;
std::string version; std::string version;
std::string category; std::string category;
std::string console; std::string console;
@@ -59,6 +60,7 @@ public:
std::string returnTitle(const int index); std::string returnTitle(const int index);
std::string returnAuthor(const int index); std::string returnAuthor(const int index);
std::string returnDescription(const int index);
int returnIconIndex(const int index); int returnIconIndex(const int index);
int returnJSONIndex(const int index); int returnJSONIndex(const int index);
int getSize(); int getSize();
+4 -3
View File
@@ -201,9 +201,10 @@ void UniStoreV2::DrawList(void) const {
GFX::DrawSprite(sprites_updateStore_idx, this->StoreBoxesList[i].x+340, this->StoreBoxesList[i].y+30); GFX::DrawSprite(sprites_updateStore_idx, this->StoreBoxesList[i].x+340, this->StoreBoxesList[i].y+30);
} }
// Display Author & App name. // Display Title, Author and Description.
Gui::DrawString(this->StoreBoxesList[i].x+55, this->StoreBoxesList[i].y+12, 0.45f, this->returnTextColor(), this->sortedStore->returnTitle(i + (this->storePageList * STORE_ENTRIES_LIST)), 300); Gui::DrawString(this->StoreBoxesList[i].x+55, this->StoreBoxesList[i].y+5, 0.45f, this->returnTextColor(), this->sortedStore->returnTitle(i + (this->storePageList * STORE_ENTRIES_LIST)), 300);
Gui::DrawString(this->StoreBoxesList[i].x+55, this->StoreBoxesList[i].y+28, 0.45f, this->returnTextColor(), this->sortedStore->returnAuthor(i + (this->storePageList * STORE_ENTRIES_LIST)), 300); Gui::DrawString(this->StoreBoxesList[i].x+55, this->StoreBoxesList[i].y+18, 0.45f, this->returnTextColor(), this->sortedStore->returnAuthor(i + (this->storePageList * STORE_ENTRIES_LIST)), 300);
Gui::DrawString(this->StoreBoxesList[i].x+55, this->StoreBoxesList[i].y+32, 0.45f, this->returnTextColor(), this->sortedStore->returnDescription(i + (this->storePageList * STORE_ENTRIES_LIST)), 300);
} }
} }
+14 -16
View File
@@ -106,7 +106,7 @@ void Store::writeToFile(int index) {
// Here we get the data of the UniStore! // Here we get the data of the UniStore!
UniStoreV2Struct Store::getData(const int index) { UniStoreV2Struct Store::getData(const int index) {
UniStoreV2Struct temp = {"", "", "", "", "" ,"", -1, 0, false}; UniStoreV2Struct temp = {"", "", "", "", "", "" ,"", -1, 0, false};
if (index > (int)this->storeJson["storeContent"].size()) return temp; // Empty. if (index > (int)this->storeJson["storeContent"].size()) return temp; // Empty.
@@ -121,6 +121,11 @@ UniStoreV2Struct Store::getData(const int index) {
temp.author = this->storeJson["storeContent"][index]["info"]["author"]; temp.author = this->storeJson["storeContent"][index]["info"]["author"];
} }
// Description.
if (this->storeJson["storeContent"][index]["info"].contains("description")) {
temp.description = this->storeJson["storeContent"][index]["info"]["description"];
}
// Version. // Version.
if (this->storeJson["storeContent"][index]["info"].contains("version")) { if (this->storeJson["storeContent"][index]["info"].contains("version")) {
temp.version = this->storeJson["storeContent"][index]["info"]["version"]; temp.version = this->storeJson["storeContent"][index]["info"]["version"];
@@ -247,25 +252,13 @@ void Store::sorting(bool Ascending, SortType sorttype) {
this->sorttype = sorttype; this->sorttype = sorttype;
switch(this->sorttype) { switch(this->sorttype) {
case SortType::TITLE: case SortType::TITLE:
if (Ascending) { Ascending ? std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareTitleAscending) : std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareAuthorAscending);
std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareTitleAscending);
} else {
std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareTitleDescending);
}
break; break;
case SortType::AUTHOR: case SortType::AUTHOR:
if (Ascending) { Ascending ? std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareTitleAscending) : std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareAuthorDescending);
std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareAuthorAscending);
} else {
std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareAuthorDescending);
}
break; break;
case SortType::LAST_UPDATED: case SortType::LAST_UPDATED:
if (Ascending) { Ascending ? std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareUpdateAscending) : std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareUpdateDescending);
std::sort(this->sortedStore.begin(), sortedStore.end(), compareUpdateAscending);
} else {
std::sort(this->sortedStore.begin(), sortedStore.end(), compareUpdateDescending);
}
break; break;
} }
} }
@@ -281,6 +274,11 @@ std::string Store::returnAuthor(const int index) {
return this->sortedStore[index].author; return this->sortedStore[index].author;
} }
std::string Store::returnDescription(const int index) {
if (index > (int)this->sortedStore.size()) return "?"; // Out of scope.
return this->sortedStore[index].description;
}
int Store::returnIconIndex(const int index) { int Store::returnIconIndex(const int index) {
if (index > (int)this->sortedStore.size()) return -1; // Out of scope. if (index > (int)this->sortedStore.size()) return -1; // Out of scope.
return this->sortedStore[index].icon_index; return this->sortedStore[index].icon_index;