diff --git a/include/utils/store.hpp b/include/utils/store.hpp index 02eb215..b95a41d 100644 --- a/include/utils/store.hpp +++ b/include/utils/store.hpp @@ -35,6 +35,7 @@ struct UniStoreV2Struct { std::string title; std::string author; + std::string description; std::string version; std::string category; std::string console; @@ -59,6 +60,7 @@ public: std::string returnTitle(const int index); std::string returnAuthor(const int index); + std::string returnDescription(const int index); int returnIconIndex(const int index); int returnJSONIndex(const int index); int getSize(); diff --git a/source/screens/unistore_v2.cpp b/source/screens/unistore_v2.cpp index b1304ec..ef5a540 100644 --- a/source/screens/unistore_v2.cpp +++ b/source/screens/unistore_v2.cpp @@ -201,9 +201,10 @@ void UniStoreV2::DrawList(void) const { GFX::DrawSprite(sprites_updateStore_idx, this->StoreBoxesList[i].x+340, this->StoreBoxesList[i].y+30); } - // Display Author & App name. - 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+28, 0.45f, this->returnTextColor(), this->sortedStore->returnAuthor(i + (this->storePageList * STORE_ENTRIES_LIST)), 300); + // Display Title, Author and Description. + 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+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); } } diff --git a/source/utils/store.cpp b/source/utils/store.cpp index 558164c..ac3f6e0 100644 --- a/source/utils/store.cpp +++ b/source/utils/store.cpp @@ -106,7 +106,7 @@ void Store::writeToFile(int index) { // Here we get the data of the UniStore! 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. @@ -121,6 +121,11 @@ UniStoreV2Struct Store::getData(const int index) { 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. if (this->storeJson["storeContent"][index]["info"].contains("version")) { temp.version = this->storeJson["storeContent"][index]["info"]["version"]; @@ -247,25 +252,13 @@ void Store::sorting(bool Ascending, SortType sorttype) { this->sorttype = sorttype; switch(this->sorttype) { case SortType::TITLE: - if (Ascending) { - std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareTitleAscending); - } else { - std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareTitleDescending); - } + Ascending ? std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareTitleAscending) : std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareAuthorAscending); break; case SortType::AUTHOR: - if (Ascending) { - std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareAuthorAscending); - } else { - std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareAuthorDescending); - } + Ascending ? std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareTitleAscending) : std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareAuthorDescending); break; case SortType::LAST_UPDATED: - if (Ascending) { - std::sort(this->sortedStore.begin(), sortedStore.end(), compareUpdateAscending); - } else { - std::sort(this->sortedStore.begin(), sortedStore.end(), compareUpdateDescending); - } + Ascending ? std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareUpdateAscending) : std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareUpdateDescending); break; } } @@ -281,6 +274,11 @@ std::string Store::returnAuthor(const int index) { 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) { if (index > (int)this->sortedStore.size()) return -1; // Out of scope. return this->sortedStore[index].icon_index;