Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add the ability to open wikis in the browser #77

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/store/store.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Store {
std::vector<std::string> GetConsoleEntry(int index) const;
std::string GetLastUpdatedEntry(int index) const;
std::string GetLicenseEntry(int index) const;
std::string GetWikiEntry(int index) const;
C2D_Image GetIconEntry(int index) const;
std::string GetFileSizes(int index, const std::string &entry) const;
std::string GetFileTypes(int index, const std::string &entry) const;
Expand Down
3 changes: 2 additions & 1 deletion include/store/storeEntry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class StoreEntry {
std::string GetConsole() const { return this->Console; };
std::string GetLastUpdated() const { return this->LastUpdated; };
std::string GetLicense() const { return this->License; };
std::string GetWiki() const { return this->Wiki; };
int GetMarks() const { return this->Marks; };

C2D_Image GetIcon() const { return this->Icon; };
Expand All @@ -67,7 +68,7 @@ class StoreEntry {
};

private:
std::string Title, Author, Description, Category, Version, Console, LastUpdated, License, MarkString, ReleaseNotes;
std::string Title, Author, Description, Category, Version, Console, LastUpdated, License, MarkString, ReleaseNotes, Wiki;
C2D_Image Icon;
int SheetIndex, EntryIndex, Marks;
std::vector<std::string> FullCategory, FullConsole, Sizes, Types, Screenshots, ScreenshotNames;
Expand Down
6 changes: 6 additions & 0 deletions source/menu/entryInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ void StoreUtils::EntryHandle(bool &showMark, bool &fetch, bool &sFetch, int &mod
mode = 7;
}
}

if (hDown & KEY_SELECT && entry->GetWiki() != "") {
GSPGPU_ReleaseRight();
APT_PrepareToStartSystemApplet(APPID_WEB);
APT_StartSystemApplet(APPID_WEB, entry->GetWiki().c_str(), entry->GetWiki().size(), 0);
}
}

/* Quit UU. */
Expand Down
16 changes: 16 additions & 0 deletions source/store/store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,22 @@ std::string Store::GetLicenseEntry(int index) const {
return Lang::get("NO_LICENSE");
}

/*
Return the Wiki of an index.

int index: The index.
*/
std::string Store::GetWikiEntry(int index) const {
if (!this->valid) return "";
if (index > (int)this->storeJson["storeContent"].size() - 1) return ""; // Empty.

if (this->storeJson["storeContent"][index]["info"].contains("wiki") && this->storeJson["storeContent"][index]["info"]["wiki"].is_string()) {
return this->storeJson["storeContent"][index]["info"]["wiki"];
}

return "";
}

/*
Return a C2D_Image of an index.

Expand Down
1 change: 1 addition & 0 deletions source/store/storeEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ StoreEntry::StoreEntry(const std::unique_ptr<Store> &store, const std::unique_pt
this->Console = StringUtils::FetchStringsFromVector(store->GetConsoleEntry(index));
this->LastUpdated = store->GetLastUpdatedEntry(index);
this->License = store->GetLicenseEntry(index);
this->Wiki = store->GetWikiEntry(index);
this->MarkString = StringUtils::GetMarkString(meta->GetMarks(store->GetUniStoreTitle(), this->Title));

this->Icon = store->GetIconEntry(index);
Expand Down