mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
Refactored the helpsystem code and added support for using an arbitrary amount of helpsystem elements
This commit is contained in:
parent
65286ec027
commit
0de961cd33
|
@ -70,11 +70,10 @@ bool MediaViewer::startMediaViewer(FileData* game)
|
|||
ViewController::getInstance()->pauseViewVideos();
|
||||
Window::getInstance()->stopInfoPopup();
|
||||
|
||||
HelpStyle style;
|
||||
style.font = Font::get(FONT_SIZE_MINI);
|
||||
style.origin = {0.5f, 0.5f};
|
||||
style.iconColor = 0xAAAAAAFF;
|
||||
style.textColor = 0xAAAAAAFF;
|
||||
mHelp = std::make_unique<HelpComponent>(Font::get(FONT_SIZE_MINI));
|
||||
mHelp->setStyleOrigin(glm::vec2 {0.5, 0.5f});
|
||||
mHelp->setStyleTextColor(0xAAAAAAFF);
|
||||
mHelp->setStyleIconColor(0xAAAAAAFF);
|
||||
|
||||
mEntryCount = std::to_string(mImages.size() + (mVideo == nullptr ? 0 : 1));
|
||||
|
||||
|
@ -85,17 +84,16 @@ bool MediaViewer::startMediaViewer(FileData* game)
|
|||
|
||||
if (mHelpInfoPosition == HelpInfoPosition::TOP) {
|
||||
mMediaType->setPosition(mRenderer->getScreenWidth() * 0.01f, mFrameHeight / 2.0f);
|
||||
style.position = glm::vec2 {mRenderer->getScreenWidth() / 2.0f, mFrameHeight / 2.0f};
|
||||
mHelp->setStylePosition(
|
||||
glm::vec2 {mRenderer->getScreenWidth() / 2.0f, mFrameHeight / 2.0f});
|
||||
}
|
||||
else if (mHelpInfoPosition == HelpInfoPosition::BOTTOM) {
|
||||
mMediaType->setPosition(mRenderer->getScreenWidth() * 0.01f,
|
||||
mRenderer->getScreenHeight() - (mFrameHeight / 2.0f));
|
||||
style.position = glm::vec2 {mRenderer->getScreenWidth() / 2.0f,
|
||||
mRenderer->getScreenHeight() - (mFrameHeight / 2.0f)};
|
||||
mHelp->setStylePosition(glm::vec2 {mRenderer->getScreenWidth() / 2.0f,
|
||||
mRenderer->getScreenHeight() - (mFrameHeight / 2.0f)});
|
||||
}
|
||||
|
||||
mHelp = std::make_unique<HelpComponent>();
|
||||
mHelp->setStyle(style);
|
||||
mHelp->setPrompts(getHelpPrompts());
|
||||
|
||||
return true;
|
||||
|
|
|
@ -176,11 +176,10 @@ bool PDFViewer::startPDFViewer(FileData* game)
|
|||
else
|
||||
mFrameHeight = Font::get(FONT_SIZE_MINI)->getLetterHeight() * 1.9f;
|
||||
|
||||
HelpStyle style;
|
||||
style.font = Font::get(FONT_SIZE_MINI);
|
||||
style.origin = {0.5f, 0.5f};
|
||||
style.iconColor = 0xAAAAAAFF;
|
||||
style.textColor = 0xAAAAAAFF;
|
||||
mHelp = std::make_unique<HelpComponent>(Font::get(FONT_SIZE_MINI));
|
||||
mHelp->setStyleOrigin(glm::vec2 {0.5, 0.5f});
|
||||
mHelp->setStyleTextColor(0xAAAAAAFF);
|
||||
mHelp->setStyleIconColor(0xAAAAAAFF);
|
||||
|
||||
mEntryCount = std::to_string(mPages.size());
|
||||
|
||||
|
@ -191,17 +190,16 @@ bool PDFViewer::startPDFViewer(FileData* game)
|
|||
|
||||
if (mHelpInfoPosition == HelpInfoPosition::TOP) {
|
||||
mEntryNumText->setPosition(mRenderer->getScreenWidth() * 0.01f, mFrameHeight / 2.0f);
|
||||
style.position = glm::vec2 {mRenderer->getScreenWidth() / 2.0f, mFrameHeight / 2.0f};
|
||||
mHelp->setStylePosition(
|
||||
glm::vec2 {mRenderer->getScreenWidth() / 2.0f, mFrameHeight / 2.0f});
|
||||
}
|
||||
else if (mHelpInfoPosition == HelpInfoPosition::BOTTOM) {
|
||||
mEntryNumText->setPosition(mRenderer->getScreenWidth() * 0.01f,
|
||||
mRenderer->getScreenHeight() - (mFrameHeight / 2.0f));
|
||||
style.position = glm::vec2 {mRenderer->getScreenWidth() / 2.0f,
|
||||
mRenderer->getScreenHeight() - (mFrameHeight / 2.0f)};
|
||||
mHelp->setStylePosition(glm::vec2 {mRenderer->getScreenWidth() / 2.0f,
|
||||
mRenderer->getScreenHeight() - (mFrameHeight / 2.0f)});
|
||||
}
|
||||
|
||||
mHelp = std::make_unique<HelpComponent>();
|
||||
mHelp->setStyle(style);
|
||||
mHelp->setPrompts(getHelpPrompts());
|
||||
|
||||
convertPage(mCurrentPage);
|
||||
|
|
|
@ -26,7 +26,6 @@ private:
|
|||
|
||||
bool input(InputConfig* config, Input input) override;
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
MenuComponent mMenu;
|
||||
bool mHasSystems;
|
||||
|
|
|
@ -161,13 +161,13 @@ GuiApplicationUpdater::GuiApplicationUpdater()
|
|||
};
|
||||
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(
|
||||
getHelpStyle(), 0.0f, _("ENTER DOWNLOAD DIRECTORY"),
|
||||
currentDownloadDirectory, directoryFunc, false));
|
||||
0.0f, _("ENTER DOWNLOAD DIRECTORY"), currentDownloadDirectory,
|
||||
directoryFunc, false));
|
||||
}
|
||||
else {
|
||||
mWindow->pushGui(
|
||||
new GuiTextEditPopup(getHelpStyle(), _("ENTER DOWNLOAD DIRECTORY"),
|
||||
currentDownloadDirectory, directoryFunc, false));
|
||||
mWindow->pushGui(new GuiTextEditPopup(_("ENTER DOWNLOAD DIRECTORY"),
|
||||
currentDownloadDirectory, directoryFunc,
|
||||
false));
|
||||
}
|
||||
});
|
||||
buttons.push_back(mButton2);
|
||||
|
@ -180,20 +180,20 @@ GuiApplicationUpdater::GuiApplicationUpdater()
|
|||
mThread.reset();
|
||||
}
|
||||
if (mDownloading) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(), _("DOWNLOAD ABORTED") + "\n" + _("NO PACKAGE SAVED TO DISK"),
|
||||
_("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.70f :
|
||||
0.45f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
mWindow->pushGui(
|
||||
new GuiMsgBox(_("DOWNLOAD ABORTED") + "\n" + _("NO PACKAGE SAVED TO DISK"), _("OK"),
|
||||
nullptr, "", nullptr, "", nullptr, nullptr, true, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.70f :
|
||||
0.45f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
}
|
||||
else if (mHasDownloaded || mReadyToInstall) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(), _("PACKAGE WAS DOWNLOADED AND CAN BE MANUALLY INSTALLED"), _("OK"),
|
||||
nullptr, "", nullptr, "", nullptr, nullptr, true, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.60f :
|
||||
0.35f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
mWindow->pushGui(
|
||||
new GuiMsgBox(_("PACKAGE WAS DOWNLOADED AND CAN BE MANUALLY INSTALLED"), _("OK"),
|
||||
nullptr, "", nullptr, "", nullptr, nullptr, true, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.60f :
|
||||
0.35f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
}
|
||||
delete this;
|
||||
});
|
||||
|
|
|
@ -38,13 +38,6 @@ public:
|
|||
private:
|
||||
void onSizeChanged() override;
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override
|
||||
{
|
||||
if (ViewController::getInstance()->getState().viewing == ViewController::ViewMode::NOTHING)
|
||||
return HelpStyle();
|
||||
else
|
||||
return ViewController::getInstance()->getViewHelpStyle();
|
||||
}
|
||||
|
||||
Renderer* mRenderer;
|
||||
BusyComponent mBusyAnim;
|
||||
|
|
|
@ -45,8 +45,8 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
|
|||
}
|
||||
|
||||
// Automatic collections.
|
||||
mCollectionSystemsAuto = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("SELECT COLLECTIONS"), true);
|
||||
mCollectionSystemsAuto =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("SELECT COLLECTIONS"), true);
|
||||
std::map<std::string, CollectionSystemData, StringComparator> autoSystems {
|
||||
CollectionSystemsManager::getInstance()->getAutoCollectionSystems()};
|
||||
// Add automatic systems.
|
||||
|
@ -95,8 +95,8 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
|
|||
});
|
||||
|
||||
// Custom collections.
|
||||
mCollectionSystemsCustom = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("SELECT COLLECTIONS"), true);
|
||||
mCollectionSystemsCustom =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("SELECT COLLECTIONS"), true);
|
||||
std::map<std::string, CollectionSystemData, StringComparator> customSystems {
|
||||
CollectionSystemsManager::getInstance()->getCustomCollectionSystems()};
|
||||
// Add custom systems.
|
||||
|
@ -178,8 +178,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
|
|||
row.makeAcceptInputHandler([this, unusedFolders] {
|
||||
auto ss = new GuiSettings(_("SELECT THEME FOLDER"));
|
||||
std::shared_ptr<OptionListComponent<std::string>> folderThemes {
|
||||
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(),
|
||||
_("SELECT THEME FOLDER"), true)};
|
||||
std::make_shared<OptionListComponent<std::string>>(_("SELECT THEME FOLDER"), true)};
|
||||
// Add custom systems.
|
||||
for (auto it = unusedFolders.cbegin(); it != unusedFolders.cend(); ++it) {
|
||||
ComponentListRow row;
|
||||
|
@ -224,13 +223,13 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
|
|||
const float verticalPosition {
|
||||
mRenderer->getIsVerticalOrientation() ? getMenu().getPosition().y : 0.0f};
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(
|
||||
getHelpStyle(), verticalPosition, _("NEW COLLECTION NAME"), "",
|
||||
createCollectionCall, false, _("CREATE"), _("CREATE COLLECTION?")));
|
||||
verticalPosition, _("NEW COLLECTION NAME"), "", createCollectionCall, false,
|
||||
_("CREATE"), _("CREATE COLLECTION?")));
|
||||
});
|
||||
}
|
||||
else {
|
||||
row.makeAcceptInputHandler([this, createCollectionCall] {
|
||||
mWindow->pushGui(new GuiTextEditPopup(getHelpStyle(), _("NEW COLLECTION NAME"), "",
|
||||
mWindow->pushGui(new GuiTextEditPopup(_("NEW COLLECTION NAME"), "",
|
||||
createCollectionCall, false, _("CREATE"),
|
||||
_("CREATE COLLECTION?")));
|
||||
});
|
||||
|
@ -251,7 +250,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
|
|||
row.makeAcceptInputHandler([this, customSystems] {
|
||||
auto ss = new GuiSettings(_("COLLECTION TO DELETE"));
|
||||
std::shared_ptr<OptionListComponent<std::string>> customCollections {
|
||||
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), "", true)};
|
||||
std::make_shared<OptionListComponent<std::string>>("", true)};
|
||||
for (std::map<std::string, CollectionSystemData, StringComparator>::const_iterator it =
|
||||
customSystems.cbegin();
|
||||
it != customSystems.cend(); ++it) {
|
||||
|
@ -259,7 +258,6 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
|
|||
std::string name {(*it).first};
|
||||
std::function<void()> deleteCollectionCall = [this, name] {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
Utils::String::format(
|
||||
_("THIS WILL PERMANENTLY DELETE THE COLLECTION\n'%s'\nARE YOU SURE?"),
|
||||
Utils::String::toUpper(name).c_str()),
|
||||
|
@ -318,8 +316,8 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
|
|||
addRow(row);
|
||||
|
||||
// Custom collections grouping.
|
||||
auto collectionCustomGrouping = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("GROUP CUSTOM COLLECTIONS"), false);
|
||||
auto collectionCustomGrouping =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("GROUP CUSTOM COLLECTIONS"), false);
|
||||
const std::string& selectedCustomGrouping {
|
||||
Settings::getInstance()->getString("CollectionCustomGrouping")};
|
||||
collectionCustomGrouping->add(_("IF UNTHEMED"), "unthemed",
|
||||
|
|
|
@ -124,16 +124,15 @@ void GuiGamelistFilter::addFiltersToMenu()
|
|||
row.makeAcceptInputHandler([this, updateVal] {
|
||||
const float verticalPosition {
|
||||
Renderer::getIsVerticalOrientation() ? mMenu.getPosition().y : 0.0f};
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(
|
||||
getHelpStyle(), verticalPosition, _("GAME NAME"), mTextFilterField->getValue(),
|
||||
updateVal, false, _("OK"), _("APPLY CHANGES?")));
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(verticalPosition, _("GAME NAME"),
|
||||
mTextFilterField->getValue(), updateVal,
|
||||
false, _("OK"), _("APPLY CHANGES?")));
|
||||
});
|
||||
}
|
||||
else {
|
||||
row.makeAcceptInputHandler([this, updateVal] {
|
||||
mWindow->pushGui(new GuiTextEditPopup(getHelpStyle(), _("GAME NAME"),
|
||||
mTextFilterField->getValue(), updateVal, false,
|
||||
_("OK"), _("APPLY CHANGES?")));
|
||||
mWindow->pushGui(new GuiTextEditPopup(_("GAME NAME"), mTextFilterField->getValue(),
|
||||
updateVal, false, _("OK"), _("APPLY CHANGES?")));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -172,11 +171,9 @@ void GuiGamelistFilter::addFiltersToMenu()
|
|||
// For bool values, make the selection exclusive so that both True and False can't be
|
||||
// selected at the same time. This should be changed to a SwitchComponent at some point.
|
||||
if (exclusiveSelect)
|
||||
optionList = std::make_shared<OptionListComponent<std::string>>(getHelpStyle(),
|
||||
menuLabel, true, true);
|
||||
optionList = std::make_shared<OptionListComponent<std::string>>(menuLabel, true, true);
|
||||
else
|
||||
optionList = std::make_shared<OptionListComponent<std::string>>(getHelpStyle(),
|
||||
menuLabel, true, false);
|
||||
optionList = std::make_shared<OptionListComponent<std::string>>(menuLabel, true, false);
|
||||
|
||||
// Still display fields that can't be filtered in the menu, but notify the user and set
|
||||
// the OptionListComponent as disabled.
|
||||
|
|
|
@ -28,7 +28,6 @@ public:
|
|||
bool input(InputConfig* config, Input input) override;
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
private:
|
||||
void initializeMenu();
|
||||
|
|
|
@ -103,7 +103,7 @@ GuiGamelistOptions::GuiGamelistOptions(SystemData* system)
|
|||
mCurrentFirstCharacter = Utils::String::getFirstCharacter(file->getSortName());
|
||||
}
|
||||
|
||||
mJumpToLetterList = std::make_shared<LetterList>(getHelpStyle(), _("JUMP TO..."), false);
|
||||
mJumpToLetterList = std::make_shared<LetterList>(_("JUMP TO..."), false);
|
||||
|
||||
// Enable key repeat so that the left or right button can be held to cycle through
|
||||
// the letters.
|
||||
|
@ -122,7 +122,7 @@ GuiGamelistOptions::GuiGamelistOptions(SystemData* system)
|
|||
// Add the sorting entry, unless this is the grouped custom collections list.
|
||||
if (!mIsCustomCollectionGroup) {
|
||||
// Sort list by selected sort type (persistent throughout the program session).
|
||||
mListSort = std::make_shared<SortList>(getHelpStyle(), _("SORT GAMES BY"), false);
|
||||
mListSort = std::make_shared<SortList>(_("SORT GAMES BY"), false);
|
||||
FileData* root {nullptr};
|
||||
if (mIsCustomCollection)
|
||||
root = getGamelist()->getCursor()->getSystem()->getRootFolder();
|
||||
|
|
|
@ -30,7 +30,6 @@ public:
|
|||
|
||||
bool input(InputConfig* config, Input input) override;
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
private:
|
||||
void openGamelistFilter();
|
||||
|
|
|
@ -19,8 +19,8 @@ GuiMediaViewerOptions::GuiMediaViewerOptions(const std::string& title)
|
|||
{
|
||||
|
||||
// Help prompts.
|
||||
auto mediaViewerHelpPrompts = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("HELP PROMPTS"), false);
|
||||
auto mediaViewerHelpPrompts =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("HELP PROMPTS"), false);
|
||||
std::string selectedHelpPrompts {Settings::getInstance()->getString("MediaViewerHelpPrompts")};
|
||||
mediaViewerHelpPrompts->add(_("TOP"), "top", selectedHelpPrompts == "top");
|
||||
mediaViewerHelpPrompts->add(_("BOTTOM"), "bottom", selectedHelpPrompts == "bottom");
|
||||
|
|
|
@ -131,8 +131,7 @@ void GuiMenu::openUIOptions()
|
|||
std::map<std::string, ThemeData::Theme, ThemeData::StringComparator>::const_iterator
|
||||
selectedTheme;
|
||||
|
||||
auto theme =
|
||||
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), _("THEME"), false);
|
||||
auto theme = std::make_shared<OptionListComponent<std::string>>(_("THEME"), false);
|
||||
|
||||
ComponentListRow themeDownloaderInputRow;
|
||||
themeDownloaderInputRow.elements.clear();
|
||||
|
@ -203,8 +202,8 @@ void GuiMenu::openUIOptions()
|
|||
}
|
||||
|
||||
// Theme variants.
|
||||
auto themeVariant = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("THEME VARIANT"), false);
|
||||
auto themeVariant =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("THEME VARIANT"), false);
|
||||
s->addWithLabel(_("THEME VARIANT"), themeVariant);
|
||||
s->addSaveFunc([themeVariant, s] {
|
||||
if (themeVariant->getSelected() != Settings::getInstance()->getString("ThemeVariant")) {
|
||||
|
@ -262,8 +261,8 @@ void GuiMenu::openUIOptions()
|
|||
Settings::getInstance()->getString("ThemeVariant"));
|
||||
|
||||
// Theme color schemes.
|
||||
auto themeColorScheme = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("THEME COLOR SCHEME"), false);
|
||||
auto themeColorScheme =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("THEME COLOR SCHEME"), false);
|
||||
s->addWithLabel(_("THEME COLOR SCHEME"), themeColorScheme);
|
||||
s->addSaveFunc([themeColorScheme, s] {
|
||||
if (themeColorScheme->getSelected() !=
|
||||
|
@ -315,8 +314,8 @@ void GuiMenu::openUIOptions()
|
|||
Settings::getInstance()->getString("ThemeColorScheme"));
|
||||
|
||||
// Theme font sizes.
|
||||
auto themeFontSize = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("THEME FONT SIZE"), false);
|
||||
auto themeFontSize =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("THEME FONT SIZE"), false);
|
||||
s->addWithLabel(_("THEME FONT SIZE"), themeFontSize);
|
||||
s->addSaveFunc([themeFontSize, s] {
|
||||
if (themeFontSize->getSelected() != Settings::getInstance()->getString("ThemeFontSize")) {
|
||||
|
@ -357,8 +356,8 @@ void GuiMenu::openUIOptions()
|
|||
Settings::getInstance()->getString("ThemeFontSize"));
|
||||
|
||||
// Theme aspect ratios.
|
||||
auto themeAspectRatio = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("THEME ASPECT RATIO"), false);
|
||||
auto themeAspectRatio =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("THEME ASPECT RATIO"), false);
|
||||
s->addWithLabel(_("THEME ASPECT RATIO"), themeAspectRatio);
|
||||
s->addSaveFunc([themeAspectRatio, s] {
|
||||
if (themeAspectRatio->getSelected() !=
|
||||
|
@ -401,8 +400,8 @@ void GuiMenu::openUIOptions()
|
|||
Settings::getInstance()->getString("ThemeAspectRatio"));
|
||||
|
||||
// Theme transitions.
|
||||
auto themeTransitions = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("THEME TRANSITIONS"), false);
|
||||
auto themeTransitions =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("THEME TRANSITIONS"), false);
|
||||
std::string selectedThemeTransitions {Settings::getInstance()->getString("ThemeTransitions")};
|
||||
themeTransitions->add(_("AUTOMATIC"), "automatic", selectedThemeTransitions == "automatic");
|
||||
// If there are no objects returned, then there must be a manually modified entry in the
|
||||
|
@ -516,8 +515,8 @@ void GuiMenu::openUIOptions()
|
|||
Settings::getInstance()->getString("ThemeTransitions"));
|
||||
|
||||
// Theme language.
|
||||
auto themeLanguage = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("THEME LANGUAGE"), false);
|
||||
auto themeLanguage =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("THEME LANGUAGE"), false);
|
||||
s->addWithLabel(_("THEME LANGUAGE"), themeLanguage);
|
||||
s->addSaveFunc([themeLanguage, s] {
|
||||
if (themeLanguage->getSelected() != Settings::getInstance()->getString("ThemeLanguage")) {
|
||||
|
@ -559,8 +558,8 @@ void GuiMenu::openUIOptions()
|
|||
Settings::getInstance()->getString("ThemeLanguage"));
|
||||
|
||||
// Application language.
|
||||
auto applicationLanguage = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("APPLICATION LANGUAGE"), false);
|
||||
auto applicationLanguage =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("APPLICATION LANGUAGE"), false);
|
||||
std::string selectedApplicationLanguage {
|
||||
Settings::getInstance()->getString("ApplicationLanguage")};
|
||||
applicationLanguage->add(_("AUTOMATIC"), "automatic",
|
||||
|
@ -605,8 +604,8 @@ void GuiMenu::openUIOptions()
|
|||
});
|
||||
|
||||
// Quick system select (navigate between systems in the gamelist view).
|
||||
auto quickSystemSelect = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("QUICK SYSTEM SELECT"), false);
|
||||
auto quickSystemSelect =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("QUICK SYSTEM SELECT"), false);
|
||||
std::string selectedQuickSelect {Settings::getInstance()->getString("QuickSystemSelect")};
|
||||
quickSystemSelect->add(_("LEFT/RIGHT OR SHOULDERS"), "leftrightshoulders",
|
||||
selectedQuickSelect == "leftrightshoulders");
|
||||
|
@ -631,8 +630,8 @@ void GuiMenu::openUIOptions()
|
|||
});
|
||||
|
||||
// Optionally start in selected system/gamelist.
|
||||
auto startupSystem = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("GAMELIST ON STARTUP"), false);
|
||||
auto startupSystem =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("GAMELIST ON STARTUP"), false);
|
||||
startupSystem->add(_("NONE"), "", Settings::getInstance()->getString("StartupSystem") == "");
|
||||
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
||||
it != SystemData::sSystemVector.cend(); ++it) {
|
||||
|
@ -660,8 +659,8 @@ void GuiMenu::openUIOptions()
|
|||
});
|
||||
|
||||
// Systems sorting.
|
||||
auto systemsSorting = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("SYSTEMS SORTING"), false);
|
||||
auto systemsSorting =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("SYSTEMS SORTING"), false);
|
||||
std::string selectedSystemsSorting {Settings::getInstance()->getString("SystemsSorting")};
|
||||
systemsSorting->add(_("FULL NAMES OR CUSTOM"), "default", selectedSystemsSorting == "default");
|
||||
systemsSorting->add(_("RELEASE YEAR"), "year", selectedSystemsSorting == "year");
|
||||
|
@ -691,7 +690,7 @@ void GuiMenu::openUIOptions()
|
|||
// Default gamelist sort order.
|
||||
std::string sortOrder;
|
||||
auto defaultSortOrder = std::make_shared<OptionListComponent<const FileData::SortType*>>(
|
||||
getHelpStyle(), _p("short", "GAMES DEFAULT SORT ORDER"), false);
|
||||
_p("short", "GAMES DEFAULT SORT ORDER"), false);
|
||||
// Exclude the System sort options.
|
||||
unsigned int numSortTypes {static_cast<unsigned int>(FileSorts::SortTypes.size() - 2)};
|
||||
for (unsigned int i {0}; i < numSortTypes; ++i) {
|
||||
|
@ -729,8 +728,8 @@ void GuiMenu::openUIOptions()
|
|||
});
|
||||
|
||||
// Menu color scheme.
|
||||
auto menuColorScheme = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("MENU COLOR SCHEME"), false);
|
||||
auto menuColorScheme =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("MENU COLOR SCHEME"), false);
|
||||
const std::string selectedMenuColor {Settings::getInstance()->getString("MenuColorScheme")};
|
||||
menuColorScheme->add(_("DARK"), "dark", selectedMenuColor == "dark");
|
||||
menuColorScheme->add(_("DARK AND RED"), "darkred", selectedMenuColor == "darkred");
|
||||
|
@ -754,8 +753,8 @@ void GuiMenu::openUIOptions()
|
|||
});
|
||||
|
||||
// Open menu effect.
|
||||
auto menuOpeningEffect = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("MENU OPENING ANIMATION"), false);
|
||||
auto menuOpeningEffect =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("MENU OPENING ANIMATION"), false);
|
||||
std::string selectedMenuEffect {Settings::getInstance()->getString("MenuOpeningEffect")};
|
||||
menuOpeningEffect->add(_("SCALE-UP"), "scale-up", selectedMenuEffect == "scale-up");
|
||||
menuOpeningEffect->add(_("NONE"), "none", selectedMenuEffect == "none");
|
||||
|
@ -774,8 +773,8 @@ void GuiMenu::openUIOptions()
|
|||
});
|
||||
|
||||
// Launch screen duration.
|
||||
auto launchScreenDuration = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("LAUNCH SCREEN DURATION"), false);
|
||||
auto launchScreenDuration =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("LAUNCH SCREEN DURATION"), false);
|
||||
std::string selectedDuration {Settings::getInstance()->getString("LaunchScreenDuration")};
|
||||
launchScreenDuration->add(_("NORMAL"), "normal", selectedDuration == "normal");
|
||||
launchScreenDuration->add(_("BRIEF"), "brief", selectedDuration == "brief");
|
||||
|
@ -796,8 +795,7 @@ void GuiMenu::openUIOptions()
|
|||
});
|
||||
|
||||
// UI mode.
|
||||
auto uiMode =
|
||||
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), _("UI MODE"), false);
|
||||
auto uiMode = std::make_shared<OptionListComponent<std::string>>(_("UI MODE"), false);
|
||||
std::string setMode;
|
||||
if (Settings::getInstance()->getBool("ForceKiosk"))
|
||||
setMode = "kiosk";
|
||||
|
@ -842,7 +840,7 @@ void GuiMenu::openUIOptions()
|
|||
UIModeController::getInstance()->getFormattedPassKeyStr().c_str());
|
||||
}
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
this->getHelpStyle(), msg, _("YES"),
|
||||
msg, _("YES"),
|
||||
[this, selectedMode] {
|
||||
LOG(LogDebug) << "GuiMenu::openUISettings(): Setting UI mode to '"
|
||||
<< selectedMode << "'.";
|
||||
|
@ -890,8 +888,8 @@ void GuiMenu::openUIOptions()
|
|||
});
|
||||
|
||||
// Random entry button.
|
||||
auto randomEntryButton = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("RANDOM ENTRY BUTTON"), false);
|
||||
auto randomEntryButton =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("RANDOM ENTRY BUTTON"), false);
|
||||
const std::string selectedRandomEntryButton {
|
||||
Settings::getInstance()->getString("RandomEntryButton")};
|
||||
randomEntryButton->add(_("GAMES ONLY"), "games", selectedRandomEntryButton == "games");
|
||||
|
@ -1183,8 +1181,7 @@ void GuiMenu::openSoundOptions()
|
|||
|
||||
#if defined(__ANDROID__)
|
||||
// Audio driver.
|
||||
auto audioDriver = std::make_shared<OptionListComponent<std::string>>(getHelpStyle(),
|
||||
_("AUDIO DRIVER"), false);
|
||||
auto audioDriver = std::make_shared<OptionListComponent<std::string>>(_("AUDIO DRIVER"), false);
|
||||
std::string selectedDriver {Settings::getInstance()->getString("AudioDriver")};
|
||||
audioDriver->add("OPENSL ES", "openslES", selectedDriver == "openslES");
|
||||
audioDriver->add("AAUDIO", "AAudio", selectedDriver == "AAudio");
|
||||
|
@ -1312,8 +1309,8 @@ void GuiMenu::openInputDeviceOptions()
|
|||
auto s = new GuiSettings(_("INPUT DEVICE SETTINGS"));
|
||||
|
||||
// Controller type.
|
||||
auto inputControllerType = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("CONTROLLER TYPE"), false);
|
||||
auto inputControllerType =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("CONTROLLER TYPE"), false);
|
||||
std::string selectedPlayer {Settings::getInstance()->getString("InputControllerType")};
|
||||
inputControllerType->add("XBOX", "xbox", selectedPlayer == "xbox");
|
||||
inputControllerType->add("XBOX 360", "xbox360", selectedPlayer == "xbox360");
|
||||
|
@ -1338,8 +1335,8 @@ void GuiMenu::openInputDeviceOptions()
|
|||
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
// Touch overlay size.
|
||||
auto touchOverlaySize = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("TOUCH OVERLAY SIZE"), false);
|
||||
auto touchOverlaySize =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("TOUCH OVERLAY SIZE"), false);
|
||||
std::string selectedOverlaySize {Settings::getInstance()->getString("InputTouchOverlaySize")};
|
||||
touchOverlaySize->add(_("MEDIUM"), "medium", selectedOverlaySize == "medium");
|
||||
touchOverlaySize->add(_("LARGE"), "large", selectedOverlaySize == "large");
|
||||
|
@ -1361,8 +1358,8 @@ void GuiMenu::openInputDeviceOptions()
|
|||
});
|
||||
|
||||
// Touch overlay opacity.
|
||||
auto touchOverlayOpacity = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("TOUCH OVERLAY OPACITY"), false);
|
||||
auto touchOverlayOpacity =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("TOUCH OVERLAY OPACITY"), false);
|
||||
std::string selectedOverlayOpacity {
|
||||
Settings::getInstance()->getString("InputTouchOverlayOpacity")};
|
||||
touchOverlayOpacity->add(_("NORMAL"), "normal", selectedOverlayOpacity == "normal");
|
||||
|
@ -1445,12 +1442,11 @@ void GuiMenu::openInputDeviceOptions()
|
|||
"CONFIGURATOR TO RUN ON NEXT STARTUP")};
|
||||
|
||||
Window* window {mWindow};
|
||||
window->pushGui(
|
||||
new GuiMsgBox(getHelpStyle(), message, _("OK"), nullptr, "", nullptr, "", nullptr,
|
||||
nullptr, true, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.84f :
|
||||
0.54f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
window->pushGui(new GuiMsgBox(
|
||||
message, _("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.84f :
|
||||
0.54f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
}
|
||||
|
||||
if (touchOverlaySize->getEnabled()) {
|
||||
|
@ -1565,7 +1561,7 @@ void GuiMenu::openConfigInput(GuiSettings* settings)
|
|||
|
||||
Window* window {mWindow};
|
||||
window->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(), message, _("PROCEED"),
|
||||
message, _("PROCEED"),
|
||||
[window] { window->pushGui(new GuiDetectDevice(false, false, nullptr)); }, _("CANCEL"),
|
||||
nullptr, "", nullptr, nullptr, false, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
|
@ -1618,14 +1614,14 @@ void GuiMenu::openOtherOptions()
|
|||
multiLineMediaDir] {
|
||||
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(
|
||||
getHelpStyle(), s->getMenu().getPosition().y, titleMediaDir,
|
||||
s->getMenu().getPosition().y, titleMediaDir,
|
||||
Settings::getInstance()->getString("MediaDirectory"), updateValMediaDir,
|
||||
multiLineMediaDir, _("SAVE"), _("SAVE CHANGES?"), mediaDirectoryStaticText,
|
||||
defaultDirectoryText, _("load default directory")));
|
||||
}
|
||||
else {
|
||||
mWindow->pushGui(new GuiTextEditPopup(
|
||||
getHelpStyle(), titleMediaDir, Settings::getInstance()->getString("MediaDirectory"),
|
||||
titleMediaDir, Settings::getInstance()->getString("MediaDirectory"),
|
||||
updateValMediaDir, multiLineMediaDir, _("SAVE"), _("SAVE CHANGES?"),
|
||||
mediaDirectoryStaticText, defaultDirectoryText, _("load default directory")));
|
||||
}
|
||||
|
@ -1647,8 +1643,8 @@ void GuiMenu::openOtherOptions()
|
|||
|
||||
#if !defined(USE_OPENGLES)
|
||||
// Anti-aliasing (MSAA).
|
||||
auto antiAliasing = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("ANTI-ALIASING (MSAA)"), false);
|
||||
auto antiAliasing =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("ANTI-ALIASING (MSAA)"), false);
|
||||
const std::string& selectedAntiAliasing {
|
||||
std::to_string(Settings::getInstance()->getInt("AntiAliasing"))};
|
||||
antiAliasing->add(_("DISABLED"), "0", selectedAntiAliasing == "0");
|
||||
|
@ -1671,8 +1667,8 @@ void GuiMenu::openOtherOptions()
|
|||
|
||||
#if !defined(__IOS__)
|
||||
// Display/monitor.
|
||||
auto displayIndex = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("DISPLAY/MONITOR INDEX"), false);
|
||||
auto displayIndex =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("DISPLAY/MONITOR INDEX"), false);
|
||||
std::vector<std::string> displayIndexEntry;
|
||||
displayIndexEntry.push_back("1");
|
||||
displayIndexEntry.push_back("2");
|
||||
|
@ -1693,8 +1689,8 @@ void GuiMenu::openOtherOptions()
|
|||
#endif
|
||||
|
||||
// Screen contents rotation.
|
||||
auto screenRotate = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("ROTATE SCREEN"), false);
|
||||
auto screenRotate =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("ROTATE SCREEN"), false);
|
||||
const std::string& selectedScreenRotate {
|
||||
std::to_string(Settings::getInstance()->getInt("ScreenRotate"))};
|
||||
screenRotate->add(_("DISABLED"), "0", selectedScreenRotate == "0");
|
||||
|
@ -1716,8 +1712,8 @@ void GuiMenu::openOtherOptions()
|
|||
});
|
||||
|
||||
// Keyboard quit shortcut.
|
||||
auto keyboardQuitShortcut = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("KEYBOARD QUIT SHORTCUT"), false);
|
||||
auto keyboardQuitShortcut =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("KEYBOARD QUIT SHORTCUT"), false);
|
||||
std::string selectedShortcut {Settings::getInstance()->getString("KeyboardQuitShortcut")};
|
||||
#if defined(_WIN64) || defined(__unix__) || defined(__HAIKU__)
|
||||
keyboardQuitShortcut->add("ALT + F4", "AltF4", selectedShortcut == "AltF4");
|
||||
|
@ -1746,7 +1742,7 @@ void GuiMenu::openOtherOptions()
|
|||
|
||||
// When to save game metadata.
|
||||
auto saveGamelistsMode = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _p("short", "WHEN TO SAVE GAME METADATA"), false);
|
||||
_p("short", "WHEN TO SAVE GAME METADATA"), false);
|
||||
saveGamelistsMode->add(_("ALWAYS"), "always",
|
||||
Settings::getInstance()->getString("SaveGamelistsMode") == "always");
|
||||
saveGamelistsMode->add(_("ON EXIT"), "on exit",
|
||||
|
@ -1776,8 +1772,8 @@ void GuiMenu::openOtherOptions()
|
|||
|
||||
#if defined(APPLICATION_UPDATER)
|
||||
// Application updater frequency.
|
||||
auto applicationUpdaterFrequency = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("APPLICATION UPDATES"), false);
|
||||
auto applicationUpdaterFrequency =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("APPLICATION UPDATES"), false);
|
||||
const std::string& selectedUpdaterFrequency {
|
||||
Settings::getInstance()->getString("ApplicationUpdaterFrequency")};
|
||||
applicationUpdaterFrequency->add(_("ALWAYS"), "always", selectedUpdaterFrequency == "always");
|
||||
|
@ -2114,8 +2110,6 @@ void GuiMenu::openUtilities()
|
|||
{
|
||||
auto s = new GuiSettings(_("UTILITIES"));
|
||||
|
||||
HelpStyle style {getHelpStyle()};
|
||||
|
||||
ComponentListRow row;
|
||||
row.addElement(std::make_shared<TextComponent>(_("ORPHANED DATA CLEANUP"),
|
||||
Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary),
|
||||
|
@ -2137,7 +2131,6 @@ void GuiMenu::openUtilities()
|
|||
|
||||
row.makeAcceptInputHandler([this] {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
_("THIS WILL CREATE ALL GAME SYSTEM DIRECTORIES INSIDE YOUR ROM FOLDER AND IT WILL "
|
||||
"ALSO UPDATE ALL SYSTEMINFO.TXT FILES. THIS IS A SAFE OPERATION THAT WILL NOT DELETE "
|
||||
"OR MODIFY YOUR GAME FILES. TO DECREASE APPLICATION STARTUP TIMES IT'S RECOMMENDED "
|
||||
|
@ -2146,8 +2139,7 @@ void GuiMenu::openUtilities()
|
|||
[this] {
|
||||
if (!SystemData::createSystemDirectories()) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(), _("THE SYSTEM DIRECTORIES WERE SUCCESSFULLY CREATED"),
|
||||
_("OK"),
|
||||
_("THE SYSTEM DIRECTORIES WERE SUCCESSFULLY CREATED"), _("OK"),
|
||||
[this] {
|
||||
if (CollectionSystemsManager::getInstance()->isEditing())
|
||||
CollectionSystemsManager::getInstance()->exitEditMode();
|
||||
|
@ -2165,7 +2157,6 @@ void GuiMenu::openUtilities()
|
|||
}
|
||||
else {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
_("ERROR CREATING SYSTEM DIRECTORIES, PERMISSION PROBLEMS OR "
|
||||
"DISK FULL? SEE THE LOG FILE FOR MORE DETAILS"),
|
||||
_("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true,
|
||||
|
@ -2192,7 +2183,6 @@ void GuiMenu::openUtilities()
|
|||
|
||||
row.makeAcceptInputHandler([this] {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
_("THIS WILL RESCAN YOUR ROM DIRECTORY FOR CHANGES SUCH AS ADDED OR REMOVED GAMES AND "
|
||||
"SYSTEMS"),
|
||||
_("PROCEED"),
|
||||
|
@ -2227,7 +2217,7 @@ void GuiMenu::openQuitMenu()
|
|||
if (!Settings::getInstance()->getBool("ShowQuitMenu")) {
|
||||
#endif
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
this->getHelpStyle(), _("REALLY QUIT?"), _("YES"),
|
||||
_("REALLY QUIT?"), _("YES"),
|
||||
[this] {
|
||||
close(true);
|
||||
Utils::Platform::quitES();
|
||||
|
@ -2238,13 +2228,12 @@ void GuiMenu::openQuitMenu()
|
|||
auto s = new GuiSettings(_("QUIT"));
|
||||
|
||||
Window* window {mWindow};
|
||||
HelpStyle style {getHelpStyle()};
|
||||
|
||||
ComponentListRow row;
|
||||
|
||||
row.makeAcceptInputHandler([window, this] {
|
||||
window->pushGui(new GuiMsgBox(
|
||||
this->getHelpStyle(), _("REALLY QUIT?"), _("YES"),
|
||||
_("REALLY QUIT?"), _("YES"),
|
||||
[this] {
|
||||
close(true);
|
||||
Utils::Platform::quitES();
|
||||
|
@ -2260,7 +2249,7 @@ void GuiMenu::openQuitMenu()
|
|||
row.elements.clear();
|
||||
row.makeAcceptInputHandler([window, this] {
|
||||
window->pushGui(new GuiMsgBox(
|
||||
this->getHelpStyle(), _("REALLY REBOOT?"), _("YES"),
|
||||
_("REALLY REBOOT?"), _("YES"),
|
||||
[] {
|
||||
if (Utils::Platform::quitES(Utils::Platform::QuitMode::REBOOT) != 0) {
|
||||
LOG(LogWarning) << "Reboot terminated with non-zero result!";
|
||||
|
@ -2277,7 +2266,7 @@ void GuiMenu::openQuitMenu()
|
|||
row.elements.clear();
|
||||
row.makeAcceptInputHandler([window, this] {
|
||||
window->pushGui(new GuiMsgBox(
|
||||
this->getHelpStyle(), _("REALLY POWER OFF?"), _("YES"),
|
||||
_("REALLY POWER OFF?"), _("YES"),
|
||||
[] {
|
||||
if (Utils::Platform::quitES(Utils::Platform::QuitMode::POWEROFF) != 0) {
|
||||
LOG(LogWarning) << "Power off terminated with non-zero result!";
|
||||
|
|
|
@ -24,7 +24,6 @@ public:
|
|||
bool input(InputConfig* config, Input input) override;
|
||||
void onSizeChanged() override;
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
private:
|
||||
void close(bool closeAllWindows);
|
||||
|
|
|
@ -626,14 +626,14 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
|
|||
const float verticalPosition {
|
||||
mRenderer->getIsVerticalOrientation() ? mPosition.y : 0.0f};
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(
|
||||
getHelpStyle(), verticalPosition, title, ed->getValue(), updateVal,
|
||||
multiLine, _("APPLY"), _("APPLY CHANGES?"), "", ""));
|
||||
verticalPosition, title, ed->getValue(), updateVal, multiLine,
|
||||
_("APPLY"), _("APPLY CHANGES?"), "", ""));
|
||||
});
|
||||
}
|
||||
else {
|
||||
row.makeAcceptInputHandler([this, title, ed, updateVal, multiLine] {
|
||||
mWindow->pushGui(new GuiTextEditPopup(getHelpStyle(), title, ed->getValue(),
|
||||
updateVal, multiLine, _("APPLY"),
|
||||
mWindow->pushGui(new GuiTextEditPopup(title, ed->getValue(), updateVal,
|
||||
multiLine, _("APPLY"),
|
||||
_("APPLY CHANGES?")));
|
||||
});
|
||||
}
|
||||
|
@ -689,7 +689,6 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
|
|||
};
|
||||
auto clearSelfBtnFunc = [this, clearSelf] {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
_("THIS WILL DELETE ANY MEDIA FILES AND "
|
||||
"THE GAMELIST.XML ENTRY FOR THIS FOLDER, "
|
||||
"BUT NEITHER THE DIRECTORY ITSELF OR ANY "
|
||||
|
@ -711,7 +710,6 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
|
|||
};
|
||||
auto clearSelfBtnFunc = [this, clearSelf] {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
_("THIS WILL DELETE ANY MEDIA FILES "
|
||||
"AND THE GAMELIST.XML ENTRY FOR "
|
||||
"THIS GAME, BUT THE GAME FILE "
|
||||
|
@ -734,8 +732,7 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
|
|||
};
|
||||
auto deleteGameBtnFunc = [this, deleteFilesAndSelf] {
|
||||
mWindow->pushGui(
|
||||
new GuiMsgBox(getHelpStyle(),
|
||||
_("THIS WILL DELETE THE GAME "
|
||||
new GuiMsgBox(_("THIS WILL DELETE THE GAME "
|
||||
"FILE, ANY MEDIA FILES AND "
|
||||
"THE GAMELIST.XML ENTRY\nARE YOU SURE?"),
|
||||
_("YES"), deleteFilesAndSelf, _("NO"), nullptr, "", nullptr,
|
||||
|
@ -1039,7 +1036,7 @@ void GuiMetaDataEd::close()
|
|||
if (metadataUpdated) {
|
||||
// Changes were made, ask if the user wants to save them.
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(), _("SAVE CHANGES?"), _("YES"),
|
||||
_("SAVE CHANGES?"), _("YES"),
|
||||
[this, closeFunc] {
|
||||
save();
|
||||
closeFunc();
|
||||
|
|
|
@ -38,7 +38,6 @@ public:
|
|||
void onSizeChanged() override;
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
private:
|
||||
void save();
|
||||
|
|
|
@ -31,7 +31,6 @@ private:
|
|||
void update(int deltaTime) override;
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
std::queue<FileData*> mGameQueue;
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ private:
|
|||
bool input(InputConfig* config, Input input) override;
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
Renderer* mRenderer;
|
||||
NinePatchComponent mBackground;
|
||||
|
|
|
@ -25,8 +25,7 @@ GuiScraperMenu::GuiScraperMenu(std::string title)
|
|||
, mMenu {title}
|
||||
{
|
||||
// Scraper service.
|
||||
mScraper =
|
||||
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), _("SCRAPE FROM"), false);
|
||||
mScraper = std::make_shared<OptionListComponent<std::string>>(_("SCRAPE FROM"), false);
|
||||
std::vector<std::string> scrapers = getScraperList();
|
||||
// Select either the first entry or the one read from the settings,
|
||||
// just in case the scraper from settings has vanished.
|
||||
|
@ -42,8 +41,8 @@ GuiScraperMenu::GuiScraperMenu(std::string title)
|
|||
|
||||
// Search filters, getSearches() will generate a queue of games to scrape
|
||||
// based on the outcome of the checks below.
|
||||
mFilters = std::make_shared<OptionListComponent<GameFilterFunc>>(
|
||||
getHelpStyle(), _("SCRAPE THESE GAMES"), false);
|
||||
mFilters =
|
||||
std::make_shared<OptionListComponent<GameFilterFunc>>(_("SCRAPE THESE GAMES"), false);
|
||||
mFilters->add(
|
||||
_("ALL GAMES"),
|
||||
[](SystemData*, FileData*) -> bool {
|
||||
|
@ -103,8 +102,7 @@ GuiScraperMenu::GuiScraperMenu(std::string title)
|
|||
});
|
||||
|
||||
// Add systems (all systems with an existing platform ID are listed).
|
||||
mSystems = std::make_shared<OptionListComponent<SystemData*>>(getHelpStyle(),
|
||||
_("SCRAPE THESE SYSTEMS"), true);
|
||||
mSystems = std::make_shared<OptionListComponent<SystemData*>>(_("SCRAPE THESE SYSTEMS"), true);
|
||||
for (unsigned int i {0}; i < SystemData::sSystemVector.size(); ++i) {
|
||||
if (!SystemData::sSystemVector[i]->hasPlatformId(PlatformIds::PLATFORM_IGNORE)) {
|
||||
mSystems->add(Utils::String::toUpper(SystemData::sSystemVector[i]->getFullName()),
|
||||
|
@ -462,8 +460,8 @@ void GuiScraperMenu::openMiximageOptions()
|
|||
auto s = new GuiSettings(_("MIXIMAGE SETTINGS"));
|
||||
|
||||
// Miximage resolution.
|
||||
auto miximageResolution = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("MIXIMAGE RESOLUTION"), false);
|
||||
auto miximageResolution =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("MIXIMAGE RESOLUTION"), false);
|
||||
std::string selectedResolution {Settings::getInstance()->getString("MiximageResolution")};
|
||||
miximageResolution->add("1280X960", "1280x960", selectedResolution == "1280x960");
|
||||
miximageResolution->add("1920X1440", "1920x1440", selectedResolution == "1920x1440");
|
||||
|
@ -484,7 +482,7 @@ void GuiScraperMenu::openMiximageOptions()
|
|||
|
||||
// Horizontally oriented screenshots fit.
|
||||
auto miximageHorizontalFit = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _p("short", "HORIZONTAL SCREENSHOT FIT"), false);
|
||||
_p("short", "HORIZONTAL SCREENSHOT FIT"), false);
|
||||
const std::string selectedHorizontalFit {
|
||||
Settings::getInstance()->getString("MiximageScreenshotHorizontalFit")};
|
||||
miximageHorizontalFit->add(_("CONTAIN"), "contain", selectedHorizontalFit == "contain");
|
||||
|
@ -506,7 +504,7 @@ void GuiScraperMenu::openMiximageOptions()
|
|||
|
||||
// Vertically oriented screenshots fit.
|
||||
auto miximageVerticalFit = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _p("short", "VERTICAL SCREENSHOT FIT"), false);
|
||||
_p("short", "VERTICAL SCREENSHOT FIT"), false);
|
||||
const std::string selectedVerticalFit {
|
||||
Settings::getInstance()->getString("MiximageScreenshotVerticalFit")};
|
||||
miximageVerticalFit->add(_("CONTAIN"), "contain", selectedVerticalFit == "contain");
|
||||
|
@ -528,7 +526,7 @@ void GuiScraperMenu::openMiximageOptions()
|
|||
|
||||
// Screenshots aspect ratio threshold.
|
||||
auto miximageAspectThreshold = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _p("short", "SCREENSHOT ASPECT RATIO THRESHOLD"), false);
|
||||
_p("short", "SCREENSHOT ASPECT RATIO THRESHOLD"), false);
|
||||
const std::string selectedAspectThreshold {
|
||||
Settings::getInstance()->getString("MiximageScreenshotAspectThreshold")};
|
||||
miximageAspectThreshold->add(_("HIGH"), "high", selectedAspectThreshold == "high");
|
||||
|
@ -548,8 +546,8 @@ void GuiScraperMenu::openMiximageOptions()
|
|||
});
|
||||
|
||||
// Blank areas fill color.
|
||||
auto miximageBlankAreasColor = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("BLANK AREAS FILL COLOR"), false);
|
||||
auto miximageBlankAreasColor =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("BLANK AREAS FILL COLOR"), false);
|
||||
const std::string selectedBlankAreasColor {
|
||||
Settings::getInstance()->getString("MiximageScreenshotBlankAreasColor")};
|
||||
miximageBlankAreasColor->add(_("BLACK"), "black", selectedBlankAreasColor == "black");
|
||||
|
@ -570,7 +568,7 @@ void GuiScraperMenu::openMiximageOptions()
|
|||
|
||||
// Screenshot scaling method.
|
||||
auto miximageScaling = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _p("short", "SCREENSHOT SCALING METHOD"), false);
|
||||
_p("short", "SCREENSHOT SCALING METHOD"), false);
|
||||
std::string selectedScaling {Settings::getInstance()->getString("MiximageScreenshotScaling")};
|
||||
miximageScaling->add(_("SHARP"), "sharp", selectedScaling == "sharp");
|
||||
miximageScaling->add(_("SMOOTH"), "smooth", selectedScaling == "smooth");
|
||||
|
@ -589,8 +587,7 @@ void GuiScraperMenu::openMiximageOptions()
|
|||
});
|
||||
|
||||
// Box/cover size.
|
||||
auto miximageBoxSize =
|
||||
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), _("BOX SIZE"), false);
|
||||
auto miximageBoxSize = std::make_shared<OptionListComponent<std::string>>(_("BOX SIZE"), false);
|
||||
std::string selectedBoxSize {Settings::getInstance()->getString("MiximageBoxSize")};
|
||||
miximageBoxSize->add(_("SMALL"), "small", selectedBoxSize == "small");
|
||||
miximageBoxSize->add(_("MEDIUM"), "medium", selectedBoxSize == "medium");
|
||||
|
@ -609,8 +606,8 @@ void GuiScraperMenu::openMiximageOptions()
|
|||
});
|
||||
|
||||
// Physical media size.
|
||||
auto miximagePhysicalMediaSize = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("PHYSICAL MEDIA SIZE"), false);
|
||||
auto miximagePhysicalMediaSize =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("PHYSICAL MEDIA SIZE"), false);
|
||||
std::string selectedPhysicalMediaSize {
|
||||
Settings::getInstance()->getString("MiximagePhysicalMediaSize")};
|
||||
miximagePhysicalMediaSize->add(_("SMALL"), "small", selectedPhysicalMediaSize == "small");
|
||||
|
@ -765,8 +762,7 @@ void GuiScraperMenu::openMiximageOptions()
|
|||
void GuiScraperMenu::openOfflineGenerator(GuiSettings* settings)
|
||||
{
|
||||
if (mSystems->getSelectedObjects().empty()) {
|
||||
mWindow->pushGui(new GuiMsgBox(getHelpStyle(),
|
||||
_("THE OFFLINE GENERATOR USES THE SAME SYSTEM "
|
||||
mWindow->pushGui(new GuiMsgBox(_("THE OFFLINE GENERATOR USES THE SAME SYSTEM "
|
||||
"SELECTIONS AS THE SCRAPER, SO PLEASE SELECT "
|
||||
"AT LEAST ONE SYSTEM TO GENERATE IMAGES FOR"),
|
||||
_("OK"), nullptr, "", nullptr, "", nullptr, nullptr, false,
|
||||
|
@ -807,8 +803,7 @@ void GuiScraperMenu::openOtherOptions()
|
|||
auto s = new GuiSettings(_("OTHER SETTINGS"));
|
||||
|
||||
// Scraper region.
|
||||
auto scraperRegion =
|
||||
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), _("REGION"), false);
|
||||
auto scraperRegion = std::make_shared<OptionListComponent<std::string>>(_("REGION"), false);
|
||||
std::string selectedScraperRegion {Settings::getInstance()->getString("ScraperRegion")};
|
||||
// clang-format off
|
||||
scraperRegion->add(_("EUROPE"), "eu", selectedScraperRegion == "eu");
|
||||
|
@ -838,8 +833,8 @@ void GuiScraperMenu::openOtherOptions()
|
|||
}
|
||||
|
||||
// Scraper language.
|
||||
auto scraperLanguage = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("PREFERRED LANGUAGE"), false);
|
||||
auto scraperLanguage =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("PREFERRED LANGUAGE"), false);
|
||||
std::string selectedScraperLanguage {Settings::getInstance()->getString("ScraperLanguage")};
|
||||
// clang-format off
|
||||
scraperLanguage->add("ENGLISH", "en", selectedScraperLanguage == "en");
|
||||
|
@ -1242,7 +1237,7 @@ void GuiScraperMenu::pressedStart()
|
|||
"SET, RESULTS MAY BE INACCURATE");
|
||||
}
|
||||
mWindow->pushGui(
|
||||
new GuiMsgBox(getHelpStyle(), Utils::String::toUpper(warningString), _("PROCEED"),
|
||||
new GuiMsgBox(Utils::String::toUpper(warningString), _("PROCEED"),
|
||||
std::bind(&GuiScraperMenu::start, this), _("CANCEL"), nullptr, "",
|
||||
nullptr, nullptr, false, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
|
@ -1257,8 +1252,7 @@ void GuiScraperMenu::pressedStart()
|
|||
void GuiScraperMenu::start()
|
||||
{
|
||||
if (mSystems->getSelectedObjects().empty()) {
|
||||
mWindow->pushGui(
|
||||
new GuiMsgBox(getHelpStyle(), _("PLEASE SELECT AT LEAST ONE SYSTEM TO SCRAPE")));
|
||||
mWindow->pushGui(new GuiMsgBox(_("PLEASE SELECT AT LEAST ONE SYSTEM TO SCRAPE")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1332,16 +1326,14 @@ void GuiScraperMenu::start()
|
|||
} while (0);
|
||||
|
||||
if (!contentToScrape) {
|
||||
mWindow->pushGui(
|
||||
new GuiMsgBox(getHelpStyle(), _("PLEASE SELECT AT LEAST ONE CONTENT TYPE TO SCRAPE")));
|
||||
mWindow->pushGui(new GuiMsgBox(_("PLEASE SELECT AT LEAST ONE CONTENT TYPE TO SCRAPE")));
|
||||
return;
|
||||
}
|
||||
|
||||
auto searches = getSearches(mSystems->getSelectedObjects(), mFilters->getSelected());
|
||||
|
||||
if (searches.first.empty()) {
|
||||
mWindow->pushGui(
|
||||
new GuiMsgBox(getHelpStyle(), _("ALL GAMES WERE FILTERED, NOTHING TO SCRAPE")));
|
||||
mWindow->pushGui(new GuiMsgBox(_("ALL GAMES WERE FILTERED, NOTHING TO SCRAPE")));
|
||||
}
|
||||
else {
|
||||
GuiScraperMulti* gsm {
|
||||
|
|
|
@ -33,7 +33,6 @@ public:
|
|||
bool input(InputConfig* config, Input input) override;
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
private:
|
||||
void pressedStart();
|
||||
|
|
|
@ -327,7 +327,7 @@ void GuiScraperMulti::finish()
|
|||
|
||||
// Pressing either OK or using the back button should delete us.
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(), ss.str(), _("OK"),
|
||||
ss.str(), _("OK"),
|
||||
[&] {
|
||||
mIsProcessing = false;
|
||||
delete this;
|
||||
|
|
|
@ -35,7 +35,6 @@ public:
|
|||
void onSizeChanged() override;
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
private:
|
||||
void acceptResult(const ScraperSearchResult& result);
|
||||
|
|
|
@ -419,7 +419,6 @@ void GuiScraperSearch::onSearchDone(std::vector<ScraperSearchResult>& results)
|
|||
// Check if the scraper used is still valid.
|
||||
if (!isValidConfiguredScraper()) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
Utils::String::toUpper("Configured scraper is no longer available.\n"
|
||||
"Please change the scraping source in the settings."),
|
||||
"FINISH", mSkipCallback));
|
||||
|
@ -559,8 +558,8 @@ void GuiScraperSearch::onSearchError(const std::string& error,
|
|||
{
|
||||
if (fatalError) {
|
||||
LOG(LogWarning) << "GuiScraperSearch: " << Utils::String::replace(error, "\n", "");
|
||||
mWindow->pushGui(new GuiMsgBox(getHelpStyle(), Utils::String::toUpper(error), _("OK"),
|
||||
mCancelCallback, "", nullptr, "", nullptr, nullptr, true));
|
||||
mWindow->pushGui(new GuiMsgBox(Utils::String::toUpper(error), _("OK"), mCancelCallback, "",
|
||||
nullptr, "", nullptr, nullptr, true));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -580,14 +579,14 @@ void GuiScraperSearch::onSearchError(const std::string& error,
|
|||
|
||||
if (mScrapeCount > 1) {
|
||||
LOG(LogError) << "GuiScraperSearch: " << Utils::String::replace(error, "\n", "");
|
||||
mWindow->pushGui(new GuiMsgBox(getHelpStyle(), Utils::String::toUpper(error), _("RETRY"),
|
||||
mWindow->pushGui(new GuiMsgBox(Utils::String::toUpper(error), _("RETRY"),
|
||||
std::bind(&GuiScraperSearch::search, this, mLastSearch),
|
||||
_("SKIP"), mSkipCallback, _("CANCEL"), mCancelCallback,
|
||||
nullptr, true));
|
||||
}
|
||||
else {
|
||||
LOG(LogError) << "GuiScraperSearch: " << Utils::String::replace(error, "\n", "");
|
||||
mWindow->pushGui(new GuiMsgBox(getHelpStyle(), Utils::String::toUpper(error), _("RETRY"),
|
||||
mWindow->pushGui(new GuiMsgBox(Utils::String::toUpper(error), _("RETRY"),
|
||||
std::bind(&GuiScraperSearch::search, this, mLastSearch),
|
||||
_("CANCEL"), mCancelCallback, "", nullptr, nullptr, true));
|
||||
}
|
||||
|
@ -1049,14 +1048,13 @@ void GuiScraperSearch::openInputScreen(ScraperSearchParams& params)
|
|||
searchString = Utils::String::replace(searchString, "_", " ");
|
||||
|
||||
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(
|
||||
getHelpStyle(), 0.0f, _("REFINE SEARCH"), searchString, searchForFunc, false,
|
||||
_("SEARCH"), _("SEARCH USING REFINED NAME?")));
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(0.0f, _("REFINE SEARCH"), searchString,
|
||||
searchForFunc, false, _("SEARCH"),
|
||||
_("SEARCH USING REFINED NAME?")));
|
||||
}
|
||||
else {
|
||||
mWindow->pushGui(new GuiTextEditPopup(getHelpStyle(), _("REFINE SEARCH"), searchString,
|
||||
searchForFunc, false, _("SEARCH"),
|
||||
_("SEARCH USING REFINED NAME?")));
|
||||
mWindow->pushGui(new GuiTextEditPopup(_("REFINE SEARCH"), searchString, searchForFunc,
|
||||
false, _("SEARCH"), _("SEARCH USING REFINED NAME?")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
void update(int deltaTime) override;
|
||||
void render(const glm::mat4& parentTrans) override;
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
void onSizeChanged() override;
|
||||
|
||||
void decreaseScrapeCount()
|
||||
|
|
|
@ -30,7 +30,6 @@ public:
|
|||
void update(int deltaTime) override;
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
private:
|
||||
bool mClose;
|
||||
|
|
|
@ -38,8 +38,8 @@ GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title)
|
|||
});
|
||||
|
||||
// Screensaver type.
|
||||
auto screensaverType = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), _("SCREENSAVER TYPE"), false);
|
||||
auto screensaverType =
|
||||
std::make_shared<OptionListComponent<std::string>>(_("SCREENSAVER TYPE"), false);
|
||||
std::string selectedScreensaver {Settings::getInstance()->getString("ScreensaverType")};
|
||||
screensaverType->add(_("DIM"), "dim", selectedScreensaver == "dim");
|
||||
screensaverType->add(_("BLACK"), "black", selectedScreensaver == "black");
|
||||
|
@ -224,14 +224,14 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
|
|||
initValueMediaDir, updateValMediaDir] {
|
||||
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(
|
||||
getHelpStyle(), s->getMenu().getPosition().y, titleCustomImageDir,
|
||||
s->getMenu().getPosition().y, titleCustomImageDir,
|
||||
Settings::getInstance()->getString("ScreensaverSlideshowCustomDir"),
|
||||
updateValMediaDir, false, _("SAVE"), _("SAVE CHANGES?"), defaultImageDirStaticText,
|
||||
defaultImageDirText, _("load default directory")));
|
||||
}
|
||||
else {
|
||||
mWindow->pushGui(new GuiTextEditPopup(
|
||||
getHelpStyle(), titleCustomImageDir,
|
||||
titleCustomImageDir,
|
||||
Settings::getInstance()->getString("ScreensaverSlideshowCustomDir"),
|
||||
updateValMediaDir, false, _("SAVE"), _("SAVE CHANGES?"), defaultImageDirStaticText,
|
||||
defaultImageDirText, _("load default directory")));
|
||||
|
|
|
@ -241,24 +241,23 @@ void GuiSettings::addEditableTextComponent(const std::string label,
|
|||
row.makeAcceptInputHandler([this, label, ed, updateVal, isPassword] {
|
||||
// Never display the value if it's a password, instead set it to blank.
|
||||
if (isPassword)
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(
|
||||
getHelpStyle(), getMenu().getPosition().y, label, "", updateVal, false,
|
||||
_("SAVE"), _("SAVE CHANGES?")));
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(getMenu().getPosition().y, label, "",
|
||||
updateVal, false, _("SAVE"),
|
||||
_("SAVE CHANGES?")));
|
||||
else
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(
|
||||
getHelpStyle(), getMenu().getPosition().y, label, ed->getValue(), updateVal,
|
||||
false, _("SAVE"), _("SAVE CHANGES?")));
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(getMenu().getPosition().y, label,
|
||||
ed->getValue(), updateVal, false,
|
||||
_("SAVE"), _("SAVE CHANGES?")));
|
||||
});
|
||||
}
|
||||
else {
|
||||
row.makeAcceptInputHandler([this, label, ed, updateVal, isPassword] {
|
||||
if (isPassword)
|
||||
mWindow->pushGui(new GuiTextEditPopup(getHelpStyle(), label, "", updateVal, false,
|
||||
_("SAVE"), _("SAVE CHANGES?")));
|
||||
else
|
||||
mWindow->pushGui(new GuiTextEditPopup(getHelpStyle(), label, ed->getValue(),
|
||||
updateVal, false, _("SAVE"),
|
||||
mWindow->pushGui(new GuiTextEditPopup(label, "", updateVal, false, _("SAVE"),
|
||||
_("SAVE CHANGES?")));
|
||||
else
|
||||
mWindow->pushGui(new GuiTextEditPopup(label, ed->getValue(), updateVal, false,
|
||||
_("SAVE"), _("SAVE CHANGES?")));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ public:
|
|||
|
||||
bool input(InputConfig* config, Input input) override;
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
private:
|
||||
Renderer* mRenderer;
|
||||
|
|
|
@ -609,7 +609,6 @@ bool GuiThemeDownloader::renameDirectory(const std::string& path, const std::str
|
|||
|
||||
if (renameStatus) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
Utils::String::format(_("COULDN'T RENAME DIRECTORY \"%s\"\nPERMISSION PROBLEMS?"),
|
||||
path.c_str()),
|
||||
_("OK"), [] { return; }, "", nullptr, "", nullptr, nullptr, true));
|
||||
|
@ -633,8 +632,8 @@ void GuiThemeDownloader::parseThemesList()
|
|||
if (!Utils::FileSystem::exists(themesFile)) {
|
||||
LOG(LogError) << "GuiThemeDownloader: No themes.json file found";
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(), _("COULDN'T FIND THE THEMES LIST CONFIGURATION FILE"), _("OK"),
|
||||
[] { return; }, "", nullptr, "", nullptr, nullptr, true));
|
||||
_("COULDN'T FIND THE THEMES LIST CONFIGURATION FILE"), _("OK"), [] { return; }, "",
|
||||
nullptr, "", nullptr, nullptr, true));
|
||||
mGrid.removeEntry(mCenterGrid);
|
||||
mGrid.setCursorTo(mButtons);
|
||||
return;
|
||||
|
@ -647,7 +646,6 @@ void GuiThemeDownloader::parseThemesList()
|
|||
if (doc.HasParseError()) {
|
||||
LOG(LogError) << "GuiThemeDownloader: Couldn't parse the themes.json file";
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
_("COULDN'T PARSE THE THEMES LIST CONFIGURATION FILE, MAYBE THE LOCAL REPOSITORY IS "
|
||||
"CORRUPT?"),
|
||||
_("OK"), [] { return; }, "", nullptr, "", nullptr, nullptr, true));
|
||||
|
@ -662,7 +660,6 @@ void GuiThemeDownloader::parseThemesList()
|
|||
LOG(LogWarning) << "Not running the most current application release, theme "
|
||||
"downloading is not recommended";
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
_("IT SEEMS AS IF YOU'RE NOT RUNNING THE LATEST ES-DE RELEASE, PLEASE UPGRADE "
|
||||
"BEFORE PROCEEDING AS THESE THEMES MAY NOT BE COMPATIBLE WITH YOUR VERSION"),
|
||||
_("OK"), [] { return; }, "", nullptr, "", nullptr, nullptr, true));
|
||||
|
@ -802,7 +799,6 @@ void GuiThemeDownloader::populateGUI()
|
|||
std::promise<bool>().swap(mPromise);
|
||||
if (theme.manuallyDownloaded || theme.invalidRepository) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
Utils::String::format(
|
||||
_("IT SEEMS AS IF THIS THEME HAS BEEN MANUALLY DOWNLOADED INSTEAD OF VIA "
|
||||
"THIS THEME DOWNLOADER. A FRESH DOWNLOAD IS REQUIRED AND THE OLD THEME "
|
||||
|
@ -830,7 +826,6 @@ void GuiThemeDownloader::populateGUI()
|
|||
}
|
||||
else if (theme.corruptRepository) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
Utils::String::format(
|
||||
_("IT SEEMS AS IF THIS THEME REPOSITORY IS CORRUPT, WHICH COULD HAVE BEEN "
|
||||
"CAUSED BY AN INTERRUPTION OF A PREVIOUS DOWNLOAD OR UPDATE, FOR EXAMPLE "
|
||||
|
@ -859,7 +854,6 @@ void GuiThemeDownloader::populateGUI()
|
|||
}
|
||||
else if (theme.shallowRepository) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
Utils::String::format(
|
||||
_("IT SEEMS AS IF THIS IS A SHALLOW REPOSITORY WHICH MEANS THAT IT HAS "
|
||||
"BEEN DOWNLOADED USING SOME OTHER TOOL THAN THIS THEME DOWNLOADER. A "
|
||||
|
@ -888,7 +882,6 @@ void GuiThemeDownloader::populateGUI()
|
|||
}
|
||||
else if (theme.wrongUrl) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
Utils::String::format(
|
||||
_("THE LOCALLY CLONED REPOSITORY CONTAINS THE WRONG URL WHICH NORMALLY "
|
||||
"MEANS THE THEME HAS BEEN MOVED TO A NEW GIT SITE. A FRESH DOWNLOAD IS "
|
||||
|
@ -917,7 +910,6 @@ void GuiThemeDownloader::populateGUI()
|
|||
}
|
||||
else if (theme.hasLocalChanges) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
Utils::String::format(
|
||||
_("THEME REPOSITORY \"%s\" CONTAINS LOCAL CHANGES. PROCEED TO OVERWRITE "
|
||||
"YOUR CHANGES OR CANCEL TO SKIP ALL UPDATES FOR THIS THEME"),
|
||||
|
@ -1133,8 +1125,8 @@ void GuiThemeDownloader::update(int deltaTime)
|
|||
}
|
||||
errorMessage.append(" ").append(Utils::String::toUpper(mMessage));
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(), errorMessage, _("OK"), [] { return; }, "", nullptr, "",
|
||||
nullptr, nullptr, true));
|
||||
errorMessage, _("OK"), [] { return; }, "", nullptr, "", nullptr, nullptr,
|
||||
true));
|
||||
mRepositoryError = RepositoryError::NO_REPO_ERROR;
|
||||
mMessage = "";
|
||||
getHelpPrompts();
|
||||
|
@ -1320,7 +1312,6 @@ bool GuiThemeDownloader::input(InputConfig* config, Input input)
|
|||
if (config->isMappedTo("y", input) && input.value &&
|
||||
mGrid.getSelectedComponent() == mCenterGrid && mThemes[mList->getCursorId()].isCloned) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
#if defined(__ANDROID__)
|
||||
_("THIS WILL COMPLETELY DELETE THE THEME"),
|
||||
#else
|
||||
|
@ -1339,8 +1330,8 @@ bool GuiThemeDownloader::input(InputConfig* config, Input input)
|
|||
LOG(LogInfo) << "Deleting theme directory \"" << themeDirectory << "\"";
|
||||
if (!Utils::FileSystem::removeDirectory(themeDirectory, true)) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(), _("COULDN'T DELETE THEME, PERMISSION PROBLEMS?"), _("OK"),
|
||||
[] { return; }, "", nullptr, "", nullptr, nullptr, true));
|
||||
_("COULDN'T DELETE THEME, PERMISSION PROBLEMS?"), _("OK"), [] { return; },
|
||||
"", nullptr, "", nullptr, nullptr, true));
|
||||
}
|
||||
else {
|
||||
mMessage = _("THEME WAS DELETED");
|
||||
|
@ -1424,7 +1415,6 @@ bool GuiThemeDownloader::fetchThemesList()
|
|||
|
||||
if (errorCode != 0 || checkCorruptRepository(repository)) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
_("IT SEEMS AS IF THE THEMES LIST REPOSITORY IS CORRUPT, WHICH COULD HAVE BEEN "
|
||||
"CAUSED BY AN INTERRUPTION OF A PREVIOUS DOWNLOAD OR UPDATE, FOR EXAMPLE IF THE "
|
||||
"ES-DE PROCESS WAS KILLED. A FRESH DOWNLOAD IS REQUIRED AND THE OLD DIRECTORY "
|
||||
|
@ -1467,7 +1457,6 @@ bool GuiThemeDownloader::fetchThemesList()
|
|||
}
|
||||
else {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
_("IT SEEMS AS IF YOU'RE USING THE THEME DOWNLOADER FOR THE FIRST TIME. "
|
||||
"AS SUCH THE THEMES LIST REPOSITORY WILL BE DOWNLOADED WHICH WILL TAKE A LITTLE "
|
||||
"WHILE. SUBSEQUENT RUNS WILL HOWEVER BE MUCH FASTER AS ONLY NEW OR MODIFIED FILES "
|
||||
|
|
|
@ -47,7 +47,6 @@ public:
|
|||
bool input(InputConfig* config, Input input) override;
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
||||
|
||||
private:
|
||||
struct Screenshot {
|
||||
|
|
|
@ -500,6 +500,7 @@ bool GamelistBase::input(InputConfig* config, Input input)
|
|||
stopListScrolling();
|
||||
pauseViewVideos();
|
||||
stopGamelistFadeAnimations();
|
||||
ViewController::getInstance()->setHelpComponentsVisibility(false);
|
||||
mWindow->setAllowTextScrolling(false);
|
||||
mWindow->setAllowFileAnimation(false);
|
||||
mWindow->pushGui(new GuiGamelistOptions(this->mRoot->getSystem()));
|
||||
|
|
|
@ -349,9 +349,11 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
|
|||
mRatingComponents.back()->setOpacity(mRatingComponents.back()->getOpacity());
|
||||
addChild(mRatingComponents.back().get());
|
||||
}
|
||||
else if (element.second.type == "helpsystem") {
|
||||
mHelpComponents.emplace_back(std::make_unique<HelpComponent>());
|
||||
mHelpComponents.back()->applyTheme(theme, "gamelist", element.first, ALL);
|
||||
}
|
||||
}
|
||||
|
||||
mHelpStyle.applyTheme(mTheme, "gamelist");
|
||||
}
|
||||
|
||||
if (mPrimary == nullptr) {
|
||||
|
@ -512,6 +514,7 @@ void GamelistView::render(const glm::mat4& parentTrans)
|
|||
|
||||
std::vector<HelpPrompt> GamelistView::getHelpPrompts()
|
||||
{
|
||||
mWindow->passHelpComponents(&mHelpComponents);
|
||||
std::vector<HelpPrompt> prompts;
|
||||
|
||||
if (Settings::getInstance()->getString("QuickSystemSelect") != "disabled") {
|
||||
|
|
|
@ -101,10 +101,15 @@ public:
|
|||
}
|
||||
void onThemeChanged(const std::shared_ptr<ThemeData>& theme);
|
||||
|
||||
void setHelpComponentsVisibility(const bool state) override
|
||||
{
|
||||
for (auto& helpComponent : mHelpComponents)
|
||||
helpComponent->setVisible(state);
|
||||
}
|
||||
|
||||
void update(int deltaTime) override;
|
||||
void render(const glm::mat4& parentTrans) override;
|
||||
|
||||
HelpStyle getHelpStyle() override { return mHelpStyle; }
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
|
||||
private:
|
||||
|
@ -112,7 +117,6 @@ private:
|
|||
void setGameImage(FileData* file, GuiComponent* comp);
|
||||
|
||||
Renderer* mRenderer;
|
||||
HelpStyle mHelpStyle;
|
||||
bool mStaticVideoAudio;
|
||||
|
||||
std::shared_ptr<ThemeData> mTheme;
|
||||
|
@ -130,6 +134,7 @@ private:
|
|||
std::vector<std::unique_ptr<ScrollableContainer>> mContainerComponents;
|
||||
std::vector<std::unique_ptr<TextComponent>> mContainerTextComponents;
|
||||
std::vector<std::unique_ptr<TextComponent>> mGamelistInfoComponents;
|
||||
std::vector<std::unique_ptr<HelpComponent>> mHelpComponents;
|
||||
};
|
||||
|
||||
#endif // ES_APP_VIEWS_GAMELIST_VIEW_H
|
||||
|
|
|
@ -211,7 +211,9 @@ void SystemView::onThemeChanged(const std::shared_ptr<ThemeData>& /*theme*/)
|
|||
|
||||
std::vector<HelpPrompt> SystemView::getHelpPrompts()
|
||||
{
|
||||
mWindow->passHelpComponents(&mSystemElements[mPrimary->getCursor()].helpComponents);
|
||||
std::vector<HelpPrompt> prompts;
|
||||
|
||||
if (mCarousel != nullptr) {
|
||||
if (mCarousel->getType() == CarouselComponent<SystemData*>::CarouselType::VERTICAL ||
|
||||
mCarousel->getType() == CarouselComponent<SystemData*>::CarouselType::VERTICAL_WHEEL)
|
||||
|
@ -239,6 +241,8 @@ std::vector<HelpPrompt> SystemView::getHelpPrompts()
|
|||
|
||||
void SystemView::onCursorChanged(const CursorState& state)
|
||||
{
|
||||
mWindow->passHelpComponents(nullptr);
|
||||
|
||||
// Reset horizontally scrolling text.
|
||||
for (auto& text : mSystemElements[mPrimary->getCursor()].gameCountComponents)
|
||||
text->resetComponent();
|
||||
|
@ -714,6 +718,11 @@ void SystemView::populate()
|
|||
elements.ratingComponents.back()->getOpacity());
|
||||
elements.children.emplace_back(elements.ratingComponents.back().get());
|
||||
}
|
||||
else if (element.second.type == "helpsystem") {
|
||||
elements.helpComponents.emplace_back(std::make_unique<HelpComponent>());
|
||||
elements.helpComponents.back()->applyTheme(theme, "system", element.first,
|
||||
ThemeFlags::ALL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -737,7 +746,6 @@ void SystemView::populate()
|
|||
return b->getZIndex() > a->getZIndex();
|
||||
});
|
||||
mSystemElements.emplace_back(std::move(elements));
|
||||
mSystemElements.back().helpStyle.applyTheme(theme, "system");
|
||||
|
||||
if (mPrimary == nullptr) {
|
||||
mCarousel = std::make_unique<CarouselComponent<SystemData*>>();
|
||||
|
@ -877,6 +885,7 @@ void SystemView::populate()
|
|||
}
|
||||
}
|
||||
|
||||
mWindow->passHelpComponents(&mSystemElements[mPrimary->getCursor()].helpComponents);
|
||||
mFadeTransitions = (static_cast<ViewTransitionAnimation>(Settings::getInstance()->getInt(
|
||||
"TransitionsSystemToSystem")) == ViewTransitionAnimation::FADE);
|
||||
}
|
||||
|
|
|
@ -103,8 +103,13 @@ public:
|
|||
|
||||
void onThemeChanged(const std::shared_ptr<ThemeData>& theme);
|
||||
|
||||
void setHelpComponentsVisibility(const bool state) override
|
||||
{
|
||||
for (auto& helpComponent : mSystemElements[mPrimary->getCursor()].helpComponents)
|
||||
helpComponent->setVisible(state);
|
||||
}
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return mSystemElements[mPrimary->getCursor()].helpStyle; }
|
||||
|
||||
protected:
|
||||
void onCursorChanged(const CursorState& state);
|
||||
|
@ -117,7 +122,6 @@ private:
|
|||
|
||||
struct SystemViewElements {
|
||||
SystemData* system;
|
||||
HelpStyle helpStyle;
|
||||
std::string name;
|
||||
std::string fullName;
|
||||
std::vector<std::unique_ptr<GameSelectorComponent>> gameSelectors;
|
||||
|
@ -133,6 +137,7 @@ private:
|
|||
std::vector<std::unique_ptr<TextComponent>> textComponents;
|
||||
std::vector<std::unique_ptr<DateTimeComponent>> dateTimeComponents;
|
||||
std::vector<std::unique_ptr<RatingComponent>> ratingComponents;
|
||||
std::vector<std::unique_ptr<HelpComponent>> helpComponents;
|
||||
};
|
||||
|
||||
Renderer* mRenderer;
|
||||
|
|
|
@ -199,8 +199,7 @@ void ViewController::legacyAppDataDialog()
|
|||
#endif
|
||||
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
HelpStyle(), upgradeMessage.c_str(), _("OK"), [] {}, "", nullptr, "", nullptr, nullptr,
|
||||
true, true,
|
||||
upgradeMessage.c_str(), _("OK"), [] {}, "", nullptr, "", nullptr, nullptr, true, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.85f :
|
||||
0.55f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
|
@ -213,7 +212,7 @@ void ViewController::migratedAppDataFilesDialog()
|
|||
"THE CONFIGURATION"};
|
||||
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
HelpStyle(), message.c_str(), "QUIT",
|
||||
message.c_str(), "QUIT",
|
||||
[] {
|
||||
SDL_Event quit {};
|
||||
quit.type = SDL_QUIT;
|
||||
|
@ -235,8 +234,7 @@ void ViewController::unsafeUpgradeDialog()
|
|||
"README.TXT FILE THAT CAN BE FOUND IN THE ES-DE DIRECTORY.")};
|
||||
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
HelpStyle(), upgradeMessage.c_str(), _("OK"), [] {}, "", nullptr, "", nullptr, nullptr,
|
||||
true, true,
|
||||
upgradeMessage.c_str(), _("OK"), [] {}, "", nullptr, "", nullptr, nullptr, true, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.85f :
|
||||
0.55f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
|
@ -252,7 +250,7 @@ void ViewController::invalidSystemsFileDialog()
|
|||
"LOG FILE es_log.txt FOR ADDITIONAL INFO")};
|
||||
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
HelpStyle(), errorMessage.c_str(), _("QUIT"),
|
||||
errorMessage.c_str(), _("QUIT"),
|
||||
[] {
|
||||
SDL_Event quit {};
|
||||
quit.type = SDL_QUIT;
|
||||
|
@ -291,10 +289,10 @@ void ViewController::noGamesDialog()
|
|||
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
mNoGamesMessageBox = new GuiMsgBox(
|
||||
HelpStyle(), mNoGamesErrorMessage + mRomDirectory,
|
||||
mNoGamesErrorMessage + mRomDirectory,
|
||||
#else
|
||||
mNoGamesMessageBox = new GuiMsgBox(
|
||||
HelpStyle(), mNoGamesErrorMessage + mRomDirectory, _("CHANGE ROM DIRECTORY"),
|
||||
mNoGamesErrorMessage + mRomDirectory, _("CHANGE ROM DIRECTORY"),
|
||||
[this] {
|
||||
std::string currentROMDirectory;
|
||||
#if defined(_WIN64)
|
||||
|
@ -304,7 +302,7 @@ void ViewController::noGamesDialog()
|
|||
#endif
|
||||
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
|
||||
mWindow->pushGui(new GuiTextEditKeyboardPopup(
|
||||
HelpStyle(), 0.0f, _("ENTER ROM DIRECTORY PATH"), currentROMDirectory,
|
||||
0.0f, _("ENTER ROM DIRECTORY PATH"), currentROMDirectory,
|
||||
[this, currentROMDirectory](const std::string& newROMDirectory) {
|
||||
if (currentROMDirectory != newROMDirectory) {
|
||||
Settings::getInstance()->setString(
|
||||
|
@ -318,7 +316,6 @@ void ViewController::noGamesDialog()
|
|||
#endif
|
||||
mNoGamesMessageBox->changeText(mNoGamesErrorMessage + mRomDirectory);
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
HelpStyle(),
|
||||
_("ROM DIRECTORY SETTING SAVED, RESTART "
|
||||
"THE APPLICATION TO RESCAN THE SYSTEMS"),
|
||||
_("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true,
|
||||
|
@ -333,7 +330,7 @@ void ViewController::noGamesDialog()
|
|||
}
|
||||
else {
|
||||
mWindow->pushGui(new GuiTextEditPopup(
|
||||
HelpStyle(), _("ENTER ROM DIRECTORY PATH"), currentROMDirectory,
|
||||
_("ENTER ROM DIRECTORY PATH"), currentROMDirectory,
|
||||
[this](const std::string& newROMDirectory) {
|
||||
Settings::getInstance()->setString("ROMDirectory",
|
||||
Utils::String::trim(newROMDirectory));
|
||||
|
@ -346,7 +343,6 @@ void ViewController::noGamesDialog()
|
|||
#endif
|
||||
mNoGamesMessageBox->changeText(mNoGamesErrorMessage + mRomDirectory);
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
HelpStyle(),
|
||||
_("ROM DIRECTORY SETTING SAVED, RESTART "
|
||||
"THE APPLICATION TO RESCAN THE SYSTEMS"),
|
||||
_("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true,
|
||||
|
@ -363,7 +359,6 @@ void ViewController::noGamesDialog()
|
|||
_("CREATE DIRECTORIES"),
|
||||
[this] {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
HelpStyle(),
|
||||
_("THIS WILL CREATE DIRECTORIES FOR ALL THE "
|
||||
"GAME SYSTEMS DEFINED IN es_systems.xml\n\n"
|
||||
"THIS MAY CREATE A LOT OF FOLDERS SO IT'S "
|
||||
|
@ -372,7 +367,6 @@ void ViewController::noGamesDialog()
|
|||
[this] {
|
||||
if (!SystemData::createSystemDirectories()) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
HelpStyle(),
|
||||
_("THE SYSTEM DIRECTORIES WERE SUCCESSFULLY "
|
||||
"GENERATED, EXIT THE APPLICATION AND PLACE "
|
||||
"YOUR GAMES IN THE NEW FOLDERS"),
|
||||
|
@ -383,7 +377,6 @@ void ViewController::noGamesDialog()
|
|||
}
|
||||
else {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
HelpStyle(),
|
||||
_("ERROR CREATING THE SYSTEM DIRECTORIES, "
|
||||
"PERMISSION PROBLEMS OR DISK FULL?\n\n"
|
||||
"SEE THE LOG FILE FOR MORE DETAILS"),
|
||||
|
@ -422,8 +415,7 @@ void ViewController::noGamesDialog()
|
|||
void ViewController::invalidAlternativeEmulatorDialog()
|
||||
{
|
||||
cancelViewTransitions();
|
||||
mWindow->pushGui(new GuiMsgBox(getHelpStyle(),
|
||||
_("AT LEAST ONE OF YOUR SYSTEMS HAS AN "
|
||||
mWindow->pushGui(new GuiMsgBox(_("AT LEAST ONE OF YOUR SYSTEMS HAS AN "
|
||||
"INVALID ALTERNATIVE EMULATOR CONFIGURED "
|
||||
"WITH NO MATCHING ENTRY IN THE SYSTEMS "
|
||||
"CONFIGURATION FILE, PLEASE REVIEW YOUR "
|
||||
|
@ -451,7 +443,7 @@ void ViewController::updateAvailableDialog()
|
|||
<< "\"";
|
||||
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(), results, _("UPDATE"),
|
||||
results, _("UPDATE"),
|
||||
[this, package] {
|
||||
mWindow->pushGui(new GuiApplicationUpdater());
|
||||
|
||||
|
@ -481,8 +473,8 @@ void ViewController::updateAvailableDialog()
|
|||
"THE UPGRADE.");
|
||||
}
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(), upgradeMessage.c_str(), _("OK"), [] {}, "", nullptr, "",
|
||||
nullptr, nullptr, true, true,
|
||||
upgradeMessage.c_str(), _("OK"), [] {}, "", nullptr, "", nullptr, nullptr,
|
||||
true, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.85f :
|
||||
0.535f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
|
@ -499,8 +491,8 @@ void ViewController::updateAvailableDialog()
|
|||
0.45f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
}
|
||||
else {
|
||||
mWindow->pushGui(new GuiMsgBox(getHelpStyle(), results, _("OK"), nullptr, "", nullptr, "",
|
||||
nullptr, nullptr, true, true,
|
||||
mWindow->pushGui(new GuiMsgBox(results, _("OK"), nullptr, "", nullptr, "", nullptr, nullptr,
|
||||
true, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.70f :
|
||||
0.45f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
|
@ -1249,6 +1241,9 @@ bool ViewController::input(InputConfig* config, Input input)
|
|||
if (!(UIModeController::getInstance()->isUIModeKid() &&
|
||||
!Settings::getInstance()->getBool("EnableMenuKidMode")) &&
|
||||
config->isMappedTo("start", input) && input.value != 0 && mCurrentView != nullptr) {
|
||||
|
||||
setHelpComponentsVisibility(false);
|
||||
|
||||
// If we don't stop the scrolling here, it will continue to
|
||||
// run after closing the menu.
|
||||
if (mSystemListView->isScrolling())
|
||||
|
@ -1689,19 +1684,3 @@ std::vector<HelpPrompt> ViewController::getHelpPrompts()
|
|||
prompts.push_back(HelpPrompt("start", _("menu")));
|
||||
return prompts;
|
||||
}
|
||||
|
||||
HelpStyle ViewController::getHelpStyle()
|
||||
{
|
||||
if (!mCurrentView)
|
||||
return GuiComponent::getHelpStyle();
|
||||
|
||||
return mCurrentView->getHelpStyle();
|
||||
}
|
||||
|
||||
HelpStyle ViewController::getViewHelpStyle()
|
||||
{
|
||||
if (mState.viewing == ViewMode::GAMELIST)
|
||||
return getGamelistView(mState.getSystem())->getHelpStyle();
|
||||
else
|
||||
return getSystemListView()->getHelpStyle();
|
||||
}
|
||||
|
|
|
@ -131,8 +131,12 @@ public:
|
|||
const State& getState() const { return mState; }
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override;
|
||||
HelpStyle getViewHelpStyle();
|
||||
|
||||
void setHelpComponentsVisibility(const bool state)
|
||||
{
|
||||
if (mCurrentView != nullptr)
|
||||
mCurrentView->setHelpComponentsVisibility(state);
|
||||
}
|
||||
|
||||
std::shared_ptr<GamelistView> getGamelistView(SystemData* system);
|
||||
std::shared_ptr<SystemView> getSystemListView();
|
||||
|
|
|
@ -14,7 +14,6 @@ set(CORE_HEADERS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/src/AudioManager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/CECInput.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/GuiComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/HelpStyle.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/HttpReq.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/ImageIO.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/InputConfig.h
|
||||
|
@ -101,7 +100,6 @@ set(CORE_SOURCES
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/src/AudioManager.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/CECInput.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/GuiComponent.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/HelpStyle.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/HttpReq.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/ImageIO.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/InputConfig.cpp
|
||||
|
|
|
@ -31,6 +31,7 @@ GuiComponent::GuiComponent()
|
|||
, mRotationOrigin {0.5f, 0.5f}
|
||||
, mSize {0.0f, 0.0f}
|
||||
, mStationary {Stationary::NEVER}
|
||||
, mHelpComponentScope {HelpComponentScope::SHARED}
|
||||
, mRenderDuringTransitions {true}
|
||||
, mBrightness {0.0f}
|
||||
, mOpacity {1.0f}
|
||||
|
@ -420,7 +421,7 @@ void GuiComponent::updateHelpPrompts()
|
|||
std::vector<HelpPrompt> prompts {getHelpPrompts()};
|
||||
|
||||
if (mWindow->peekGui() == this)
|
||||
mWindow->setHelpPrompts(prompts, getHelpStyle());
|
||||
mWindow->setHelpPrompts(prompts);
|
||||
}
|
||||
|
||||
void GuiComponent::updateSelf(int deltaTime)
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#define ES_CORE_GUI_COMPONENT_H
|
||||
|
||||
#include "HelpPrompt.h"
|
||||
#include "HelpStyle.h"
|
||||
#include "InputConfig.h"
|
||||
#include "animations/AnimationController.h"
|
||||
#include "utils/MathUtil.h"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
@ -65,6 +65,12 @@ enum class Stationary {
|
|||
BETWEEN_VIEWS
|
||||
};
|
||||
|
||||
enum class HelpComponentScope {
|
||||
SHARED,
|
||||
VIEW,
|
||||
MENU
|
||||
};
|
||||
|
||||
class GuiComponent
|
||||
{
|
||||
public:
|
||||
|
@ -118,6 +124,7 @@ public:
|
|||
void setRotationOrigin(glm::vec2 origin) { setRotationOrigin(origin.x, origin.y); }
|
||||
|
||||
const Stationary getStationary() const { return mStationary; }
|
||||
const HelpComponentScope getHelpComponentScope() const { return mHelpComponentScope; }
|
||||
const bool getRenderDuringTransitions() const { return mRenderDuringTransitions; }
|
||||
|
||||
virtual glm::vec2 getSize() const { return mSize; }
|
||||
|
@ -321,8 +328,8 @@ public:
|
|||
// Used by TextComponent.
|
||||
virtual void setHorizontalScrolling(bool state) {}
|
||||
|
||||
// Default implementation just handles <pos> and <size> tags as normalized float pairs.
|
||||
// You probably want to keep this behavior for any derived classes as well as add your own.
|
||||
// Applies basic theme configuration, element-specific configuration is applied by
|
||||
// each component's applyTheme() function.
|
||||
virtual void applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||
const std::string& view,
|
||||
const std::string& element,
|
||||
|
@ -334,12 +341,12 @@ public:
|
|||
// Called whenever help prompts change.
|
||||
void updateHelpPrompts();
|
||||
|
||||
virtual HelpStyle getHelpStyle() { return HelpStyle(); }
|
||||
virtual void setHelpComponentsVisibility(const bool state) {};
|
||||
|
||||
// Returns true if the component is busy doing background processing (e.g. HTTP downloads).
|
||||
const bool isProcessing() const { return mIsProcessing; }
|
||||
|
||||
const static unsigned char MAX_ANIMATIONS = 4;
|
||||
const static unsigned char MAX_ANIMATIONS {4};
|
||||
|
||||
protected:
|
||||
void updateSelf(int deltaTime); // Updates animations.
|
||||
|
@ -406,6 +413,7 @@ protected:
|
|||
glm::vec2 mRotationOrigin;
|
||||
glm::vec2 mSize;
|
||||
Stationary mStationary;
|
||||
HelpComponentScope mHelpComponentScope;
|
||||
bool mRenderDuringTransitions;
|
||||
|
||||
float mBrightness;
|
||||
|
|
|
@ -554,6 +554,8 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
|||
{"fontPath", PATH},
|
||||
{"fontSize", FLOAT},
|
||||
{"fontSizeDimmed", FLOAT},
|
||||
{"scope", STRING},
|
||||
{"entries", STRING},
|
||||
{"entrySpacing", FLOAT},
|
||||
{"entrySpacingDimmed", FLOAT},
|
||||
{"iconTextSpacing", FLOAT},
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
Window::Window() noexcept
|
||||
: mRenderer {Renderer::getInstance()}
|
||||
, mHelpComponents {nullptr}
|
||||
, mSplashTextPositions {0.0f, 0.0f, 0.0f, 0.0f}
|
||||
, mBackgroundOverlayOpacity {1.0f}
|
||||
, mScreensaver {nullptr}
|
||||
|
@ -347,8 +348,13 @@ void Window::logInput(InputConfig* config, Input input)
|
|||
|
||||
void Window::update(int deltaTime)
|
||||
{
|
||||
if (mInvalidateCacheTimer > 0)
|
||||
if (mInvalidateCacheTimer > 0) {
|
||||
mInvalidateCacheTimer = glm::clamp(mInvalidateCacheTimer - deltaTime, 0, 500);
|
||||
if (mHelpComponents != nullptr) {
|
||||
for (auto& helpComponent : *mHelpComponents)
|
||||
helpComponent->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (mNormalizeNextUpdate) {
|
||||
mNormalizeNextUpdate = false;
|
||||
|
@ -599,8 +605,19 @@ void Window::render()
|
|||
}
|
||||
}
|
||||
|
||||
if (!mRenderedHelpPrompts)
|
||||
mHelp->render(trans);
|
||||
if (!mRenderedHelpPrompts) {
|
||||
if (mHelpComponents != nullptr) {
|
||||
for (auto& helpComponent : *mHelpComponents) {
|
||||
if (helpComponent->getHelpComponentScope() != HelpComponentScope::VIEW) {
|
||||
helpComponent->setVisible(true);
|
||||
helpComponent->render(trans);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
mHelp->render(trans);
|
||||
}
|
||||
}
|
||||
|
||||
if (!mRenderLaunchScreen)
|
||||
top->render(trans);
|
||||
|
@ -754,15 +771,22 @@ void Window::renderListScrollOverlay(const float opacity, const std::string& tex
|
|||
|
||||
void Window::renderHelpPromptsEarly()
|
||||
{
|
||||
mHelp->render(mRenderer->getIdentity());
|
||||
if (mHelpComponents != nullptr) {
|
||||
for (auto& helpComponent : *mHelpComponents) {
|
||||
if (helpComponent->getHelpComponentScope() != HelpComponentScope::MENU) {
|
||||
helpComponent->setVisible(true);
|
||||
helpComponent->render(mRenderer->getIdentity());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
mHelp->render(mRenderer->getIdentity());
|
||||
}
|
||||
mRenderedHelpPrompts = true;
|
||||
}
|
||||
|
||||
void Window::setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpStyle& style)
|
||||
void Window::setHelpPrompts(const std::vector<HelpPrompt>& prompts)
|
||||
{
|
||||
mHelp->clearPrompts();
|
||||
mHelp->setStyle(style);
|
||||
|
||||
std::vector<HelpPrompt> addPrompts;
|
||||
|
||||
std::map<std::string, bool> inputSeenMap;
|
||||
|
@ -826,7 +850,15 @@ void Window::setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpSt
|
|||
return aVal > bVal;
|
||||
});
|
||||
|
||||
mHelp->setPrompts(addPrompts);
|
||||
if (mHelpComponents != nullptr) {
|
||||
for (auto& helpComponent : *mHelpComponents) {
|
||||
helpComponent->clearPrompts();
|
||||
helpComponent->setPrompts(addPrompts);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mHelp->setPrompts(addPrompts);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::stopInfoPopup()
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
#include "GuiComponent.h"
|
||||
#include "HelpPrompt.h"
|
||||
#include "HelpStyle.h"
|
||||
#include "InputConfig.h"
|
||||
#include "Settings.h"
|
||||
#include "components/HelpComponent.h"
|
||||
|
@ -119,7 +118,7 @@ public:
|
|||
void renderListScrollOverlay(const float opacity, const std::string& text);
|
||||
|
||||
void renderHelpPromptsEarly(); // Used to render HelpPrompts before a fade.
|
||||
void setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpStyle& style);
|
||||
void setHelpPrompts(const std::vector<HelpPrompt>& prompts);
|
||||
|
||||
// GuiInfoPopup notifications.
|
||||
void queueInfoPopup(const std::string& message, const int& duration)
|
||||
|
@ -169,6 +168,11 @@ public:
|
|||
void setChangedTheme() { mChangedTheme = true; }
|
||||
bool getChangedTheme() { return mChangedTheme; }
|
||||
|
||||
void passHelpComponents(std::vector<std::unique_ptr<HelpComponent>>* helpComponents)
|
||||
{
|
||||
mHelpComponents = helpComponents;
|
||||
}
|
||||
|
||||
private:
|
||||
Window() noexcept;
|
||||
~Window();
|
||||
|
@ -185,6 +189,7 @@ private:
|
|||
};
|
||||
|
||||
Renderer* mRenderer;
|
||||
std::vector<std::unique_ptr<HelpComponent>>* mHelpComponents;
|
||||
std::unique_ptr<HelpComponent> mHelp;
|
||||
std::unique_ptr<ImageComponent> mBackgroundOverlay;
|
||||
std::unique_ptr<ImageComponent> mSplash;
|
||||
|
|
|
@ -8,22 +8,38 @@
|
|||
|
||||
#include "components/HelpComponent.h"
|
||||
|
||||
#include "Log.h"
|
||||
#include "Settings.h"
|
||||
#include "Window.h"
|
||||
#include "components/ComponentGrid.h"
|
||||
#include "components/ImageComponent.h"
|
||||
#include "components/TextComponent.h"
|
||||
#include "resources/TextureResource.h"
|
||||
#include "utils/StringUtil.h"
|
||||
|
||||
static std::map<std::string, std::string> sIconPathMap {};
|
||||
#define PREFIX "button_"
|
||||
|
||||
HelpComponent::HelpComponent()
|
||||
HelpComponent::HelpComponent(std::shared_ptr<Font> font)
|
||||
: mRenderer {Renderer::getInstance()}
|
||||
, mStyleFont {font}
|
||||
, mStyleFontDimmed {font}
|
||||
, mStylePosition {glm::vec2 {Renderer::getScreenWidth() * 0.012f,
|
||||
Renderer::getScreenHeight() *
|
||||
(Renderer::getIsVerticalOrientation() ? 0.975f : 0.9515f)}}
|
||||
, mStylePositionDimmed {mStylePosition}
|
||||
, mStyleOrigin {glm::vec2 {0.0f, 0.0f}}
|
||||
, mStyleOriginDimmed {mStyleOrigin}
|
||||
, mStyleTextColor {0x777777FF}
|
||||
, mStyleTextColorDimmed {0x777777FF}
|
||||
, mStyleIconColor {0x777777FF}
|
||||
, mStyleIconColorDimmed {0x777777FF}
|
||||
, mStyleEntrySpacing {0.00833f}
|
||||
, mStyleEntrySpacingDimmed {mStyleEntrySpacing}
|
||||
, mStyleIconTextSpacing {0.00416f}
|
||||
, mStyleIconTextSpacingDimmed {mStyleIconTextSpacing}
|
||||
, mStyleOpacity {1.0f}
|
||||
, mStyleOpacityDimmed {mStyleOpacity}
|
||||
, mStyleLetterCase {"uppercase"}
|
||||
|
||||
{
|
||||
// Assign icons.
|
||||
assignIcons();
|
||||
updateGrid();
|
||||
}
|
||||
|
||||
void HelpComponent::assignIcons()
|
||||
|
@ -46,179 +62,176 @@ void HelpComponent::assignIcons()
|
|||
}
|
||||
|
||||
// These graphics files are common between all controller types.
|
||||
sIconPathMap["up/down"] = mStyle.mCustomButtons.dpad_updown.empty() ?
|
||||
sIconPathMap["up/down"] = mCustomButtons.dpad_updown.empty() ?
|
||||
":/graphics/help/dpad_updown.svg" :
|
||||
mStyle.mCustomButtons.dpad_updown;
|
||||
sIconPathMap["up"] = mStyle.mCustomButtons.dpad_up.empty() ? ":/graphics/help/dpad_up.svg" :
|
||||
mStyle.mCustomButtons.dpad_up;
|
||||
sIconPathMap["down"] = mStyle.mCustomButtons.dpad_down.empty() ?
|
||||
":/graphics/help/dpad_down.svg" :
|
||||
mStyle.mCustomButtons.dpad_down;
|
||||
sIconPathMap["left/right"] = mStyle.mCustomButtons.dpad_leftright.empty() ?
|
||||
mCustomButtons.dpad_updown;
|
||||
sIconPathMap["up"] =
|
||||
mCustomButtons.dpad_up.empty() ? ":/graphics/help/dpad_up.svg" : mCustomButtons.dpad_up;
|
||||
sIconPathMap["down"] = mCustomButtons.dpad_down.empty() ? ":/graphics/help/dpad_down.svg" :
|
||||
mCustomButtons.dpad_down;
|
||||
sIconPathMap["left/right"] = mCustomButtons.dpad_leftright.empty() ?
|
||||
":/graphics/help/dpad_leftright.svg" :
|
||||
mStyle.mCustomButtons.dpad_leftright;
|
||||
sIconPathMap["up/down/left/right"] = mStyle.mCustomButtons.dpad_all.empty() ?
|
||||
":/graphics/help/dpad_all.svg" :
|
||||
mStyle.mCustomButtons.dpad_all;
|
||||
sIconPathMap["thumbstickclick"] = mStyle.mCustomButtons.thumbstick_click.empty() ?
|
||||
mCustomButtons.dpad_leftright;
|
||||
sIconPathMap["up/down/left/right"] =
|
||||
mCustomButtons.dpad_all.empty() ? ":/graphics/help/dpad_all.svg" : mCustomButtons.dpad_all;
|
||||
sIconPathMap["thumbstickclick"] = mCustomButtons.thumbstick_click.empty() ?
|
||||
":/graphics/help/thumbstick_click.svg" :
|
||||
mStyle.mCustomButtons.thumbstick_click;
|
||||
sIconPathMap["l"] = mStyle.mCustomButtons.button_l.empty() ? ":/graphics/help/button_l.svg" :
|
||||
mStyle.mCustomButtons.button_l;
|
||||
sIconPathMap["r"] = mStyle.mCustomButtons.button_r.empty() ? ":/graphics/help/button_r.svg" :
|
||||
mStyle.mCustomButtons.button_r;
|
||||
sIconPathMap["lr"] = mStyle.mCustomButtons.button_lr.empty() ? ":/graphics/help/button_lr.svg" :
|
||||
mStyle.mCustomButtons.button_lr;
|
||||
sIconPathMap["lt"] = mStyle.mCustomButtons.button_lt.empty() ? ":/graphics/help/button_lt.svg" :
|
||||
mStyle.mCustomButtons.button_lt;
|
||||
sIconPathMap["rt"] = mStyle.mCustomButtons.button_rt.empty() ? ":/graphics/help/button_rt.svg" :
|
||||
mStyle.mCustomButtons.button_rt;
|
||||
sIconPathMap["ltrt"] = mStyle.mCustomButtons.button_ltrt.empty() ?
|
||||
":/graphics/help/button_ltrt.svg" :
|
||||
mStyle.mCustomButtons.button_ltrt;
|
||||
mCustomButtons.thumbstick_click;
|
||||
sIconPathMap["l"] =
|
||||
mCustomButtons.button_l.empty() ? ":/graphics/help/button_l.svg" : mCustomButtons.button_l;
|
||||
sIconPathMap["r"] =
|
||||
mCustomButtons.button_r.empty() ? ":/graphics/help/button_r.svg" : mCustomButtons.button_r;
|
||||
sIconPathMap["lr"] = mCustomButtons.button_lr.empty() ? ":/graphics/help/button_lr.svg" :
|
||||
mCustomButtons.button_lr;
|
||||
sIconPathMap["lt"] = mCustomButtons.button_lt.empty() ? ":/graphics/help/button_lt.svg" :
|
||||
mCustomButtons.button_lt;
|
||||
sIconPathMap["rt"] = mCustomButtons.button_rt.empty() ? ":/graphics/help/button_rt.svg" :
|
||||
mCustomButtons.button_rt;
|
||||
sIconPathMap["ltrt"] = mCustomButtons.button_ltrt.empty() ? ":/graphics/help/button_ltrt.svg" :
|
||||
mCustomButtons.button_ltrt;
|
||||
|
||||
// These graphics files are custom per controller type.
|
||||
if (controllerType == "snes") {
|
||||
sIconPathMap[buttonA] = mStyle.mCustomButtons.button_a_SNES.empty() ?
|
||||
sIconPathMap[buttonA] = mCustomButtons.button_a_SNES.empty() ?
|
||||
":/graphics/help/button_a_SNES.svg" :
|
||||
mStyle.mCustomButtons.button_a_SNES;
|
||||
sIconPathMap[buttonB] = mStyle.mCustomButtons.button_b_SNES.empty() ?
|
||||
mCustomButtons.button_a_SNES;
|
||||
sIconPathMap[buttonB] = mCustomButtons.button_b_SNES.empty() ?
|
||||
":/graphics/help/button_b_SNES.svg" :
|
||||
mStyle.mCustomButtons.button_b_SNES;
|
||||
sIconPathMap[buttonX] = mStyle.mCustomButtons.button_x_SNES.empty() ?
|
||||
mCustomButtons.button_b_SNES;
|
||||
sIconPathMap[buttonX] = mCustomButtons.button_x_SNES.empty() ?
|
||||
":/graphics/help/button_x_SNES.svg" :
|
||||
mStyle.mCustomButtons.button_x_SNES;
|
||||
sIconPathMap[buttonY] = mStyle.mCustomButtons.button_y_SNES.empty() ?
|
||||
mCustomButtons.button_x_SNES;
|
||||
sIconPathMap[buttonY] = mCustomButtons.button_y_SNES.empty() ?
|
||||
":/graphics/help/button_y_SNES.svg" :
|
||||
mStyle.mCustomButtons.button_y_SNES;
|
||||
sIconPathMap["back"] = mStyle.mCustomButtons.button_back_SNES.empty() ?
|
||||
mCustomButtons.button_y_SNES;
|
||||
sIconPathMap["back"] = mCustomButtons.button_back_SNES.empty() ?
|
||||
":/graphics/help/button_back_SNES.svg" :
|
||||
mStyle.mCustomButtons.button_back_SNES;
|
||||
sIconPathMap["start"] = mStyle.mCustomButtons.button_start_SNES.empty() ?
|
||||
mCustomButtons.button_back_SNES;
|
||||
sIconPathMap["start"] = mCustomButtons.button_start_SNES.empty() ?
|
||||
":/graphics/help/button_start_SNES.svg" :
|
||||
mStyle.mCustomButtons.button_start_SNES;
|
||||
mCustomButtons.button_start_SNES;
|
||||
}
|
||||
else if (controllerType == "switchpro") {
|
||||
sIconPathMap[buttonA] = mStyle.mCustomButtons.button_a_switch.empty() ?
|
||||
sIconPathMap[buttonA] = mCustomButtons.button_a_switch.empty() ?
|
||||
":/graphics/help/button_a_switch.svg" :
|
||||
mStyle.mCustomButtons.button_a_switch;
|
||||
sIconPathMap[buttonB] = mStyle.mCustomButtons.button_b_switch.empty() ?
|
||||
mCustomButtons.button_a_switch;
|
||||
sIconPathMap[buttonB] = mCustomButtons.button_b_switch.empty() ?
|
||||
":/graphics/help/button_b_switch.svg" :
|
||||
mStyle.mCustomButtons.button_b_switch;
|
||||
sIconPathMap[buttonX] = mStyle.mCustomButtons.button_x_switch.empty() ?
|
||||
mCustomButtons.button_b_switch;
|
||||
sIconPathMap[buttonX] = mCustomButtons.button_x_switch.empty() ?
|
||||
":/graphics/help/button_x_switch.svg" :
|
||||
mStyle.mCustomButtons.button_x_switch;
|
||||
sIconPathMap[buttonY] = mStyle.mCustomButtons.button_y_switch.empty() ?
|
||||
mCustomButtons.button_x_switch;
|
||||
sIconPathMap[buttonY] = mCustomButtons.button_y_switch.empty() ?
|
||||
":/graphics/help/button_y_switch.svg" :
|
||||
mStyle.mCustomButtons.button_y_switch;
|
||||
sIconPathMap["back"] = mStyle.mCustomButtons.button_back_switch.empty() ?
|
||||
mCustomButtons.button_y_switch;
|
||||
sIconPathMap["back"] = mCustomButtons.button_back_switch.empty() ?
|
||||
":/graphics/help/button_back_switch.svg" :
|
||||
mStyle.mCustomButtons.button_back_switch;
|
||||
sIconPathMap["start"] = mStyle.mCustomButtons.button_start_switch.empty() ?
|
||||
mCustomButtons.button_back_switch;
|
||||
sIconPathMap["start"] = mCustomButtons.button_start_switch.empty() ?
|
||||
":/graphics/help/button_start_switch.svg" :
|
||||
mStyle.mCustomButtons.button_start_switch;
|
||||
mCustomButtons.button_start_switch;
|
||||
}
|
||||
else if (controllerType == "ps123") {
|
||||
sIconPathMap[buttonA] = mStyle.mCustomButtons.button_a_PS.empty() ?
|
||||
sIconPathMap[buttonA] = mCustomButtons.button_a_PS.empty() ?
|
||||
":/graphics/help/button_a_PS.svg" :
|
||||
mStyle.mCustomButtons.button_a_PS;
|
||||
sIconPathMap[buttonB] = mStyle.mCustomButtons.button_b_PS.empty() ?
|
||||
mCustomButtons.button_a_PS;
|
||||
sIconPathMap[buttonB] = mCustomButtons.button_b_PS.empty() ?
|
||||
":/graphics/help/button_b_PS.svg" :
|
||||
mStyle.mCustomButtons.button_b_PS;
|
||||
sIconPathMap[buttonX] = mStyle.mCustomButtons.button_x_PS.empty() ?
|
||||
mCustomButtons.button_b_PS;
|
||||
sIconPathMap[buttonX] = mCustomButtons.button_x_PS.empty() ?
|
||||
":/graphics/help/button_x_PS.svg" :
|
||||
mStyle.mCustomButtons.button_x_PS;
|
||||
sIconPathMap[buttonY] = mStyle.mCustomButtons.button_y_PS.empty() ?
|
||||
mCustomButtons.button_x_PS;
|
||||
sIconPathMap[buttonY] = mCustomButtons.button_y_PS.empty() ?
|
||||
":/graphics/help/button_y_PS.svg" :
|
||||
mStyle.mCustomButtons.button_y_PS;
|
||||
sIconPathMap["back"] = mStyle.mCustomButtons.button_back_PS123.empty() ?
|
||||
mCustomButtons.button_y_PS;
|
||||
sIconPathMap["back"] = mCustomButtons.button_back_PS123.empty() ?
|
||||
":/graphics/help/button_back_PS123.svg" :
|
||||
mStyle.mCustomButtons.button_back_PS123;
|
||||
sIconPathMap["start"] = mStyle.mCustomButtons.button_start_PS123.empty() ?
|
||||
mCustomButtons.button_back_PS123;
|
||||
sIconPathMap["start"] = mCustomButtons.button_start_PS123.empty() ?
|
||||
":/graphics/help/button_start_PS123.svg" :
|
||||
mStyle.mCustomButtons.button_start_PS123;
|
||||
mCustomButtons.button_start_PS123;
|
||||
}
|
||||
else if (controllerType == "ps4") {
|
||||
sIconPathMap[buttonA] = mStyle.mCustomButtons.button_a_PS.empty() ?
|
||||
sIconPathMap[buttonA] = mCustomButtons.button_a_PS.empty() ?
|
||||
":/graphics/help/button_a_PS.svg" :
|
||||
mStyle.mCustomButtons.button_a_PS;
|
||||
sIconPathMap[buttonB] = mStyle.mCustomButtons.button_b_PS.empty() ?
|
||||
mCustomButtons.button_a_PS;
|
||||
sIconPathMap[buttonB] = mCustomButtons.button_b_PS.empty() ?
|
||||
":/graphics/help/button_b_PS.svg" :
|
||||
mStyle.mCustomButtons.button_b_PS;
|
||||
sIconPathMap[buttonX] = mStyle.mCustomButtons.button_x_PS.empty() ?
|
||||
mCustomButtons.button_b_PS;
|
||||
sIconPathMap[buttonX] = mCustomButtons.button_x_PS.empty() ?
|
||||
":/graphics/help/button_x_PS.svg" :
|
||||
mStyle.mCustomButtons.button_x_PS;
|
||||
sIconPathMap[buttonY] = mStyle.mCustomButtons.button_y_PS.empty() ?
|
||||
mCustomButtons.button_x_PS;
|
||||
sIconPathMap[buttonY] = mCustomButtons.button_y_PS.empty() ?
|
||||
":/graphics/help/button_y_PS.svg" :
|
||||
mStyle.mCustomButtons.button_y_PS;
|
||||
sIconPathMap["back"] = mStyle.mCustomButtons.button_back_PS4.empty() ?
|
||||
mCustomButtons.button_y_PS;
|
||||
sIconPathMap["back"] = mCustomButtons.button_back_PS4.empty() ?
|
||||
":/graphics/help/button_back_PS4.svg" :
|
||||
mStyle.mCustomButtons.button_back_PS4;
|
||||
sIconPathMap["start"] = mStyle.mCustomButtons.button_start_PS4.empty() ?
|
||||
mCustomButtons.button_back_PS4;
|
||||
sIconPathMap["start"] = mCustomButtons.button_start_PS4.empty() ?
|
||||
":/graphics/help/button_start_PS4.svg" :
|
||||
mStyle.mCustomButtons.button_start_PS4;
|
||||
mCustomButtons.button_start_PS4;
|
||||
}
|
||||
else if (controllerType == "ps5") {
|
||||
sIconPathMap[buttonA] = mStyle.mCustomButtons.button_a_PS.empty() ?
|
||||
sIconPathMap[buttonA] = mCustomButtons.button_a_PS.empty() ?
|
||||
":/graphics/help/button_a_PS.svg" :
|
||||
mStyle.mCustomButtons.button_a_PS;
|
||||
sIconPathMap[buttonB] = mStyle.mCustomButtons.button_b_PS.empty() ?
|
||||
mCustomButtons.button_a_PS;
|
||||
sIconPathMap[buttonB] = mCustomButtons.button_b_PS.empty() ?
|
||||
":/graphics/help/button_b_PS.svg" :
|
||||
mStyle.mCustomButtons.button_b_PS;
|
||||
sIconPathMap[buttonX] = mStyle.mCustomButtons.button_x_PS.empty() ?
|
||||
mCustomButtons.button_b_PS;
|
||||
sIconPathMap[buttonX] = mCustomButtons.button_x_PS.empty() ?
|
||||
":/graphics/help/button_x_PS.svg" :
|
||||
mStyle.mCustomButtons.button_x_PS;
|
||||
sIconPathMap[buttonY] = mStyle.mCustomButtons.button_y_PS.empty() ?
|
||||
mCustomButtons.button_x_PS;
|
||||
sIconPathMap[buttonY] = mCustomButtons.button_y_PS.empty() ?
|
||||
":/graphics/help/button_y_PS.svg" :
|
||||
mStyle.mCustomButtons.button_y_PS;
|
||||
sIconPathMap["back"] = mStyle.mCustomButtons.button_back_PS5.empty() ?
|
||||
mCustomButtons.button_y_PS;
|
||||
sIconPathMap["back"] = mCustomButtons.button_back_PS5.empty() ?
|
||||
":/graphics/help/button_back_PS5.svg" :
|
||||
mStyle.mCustomButtons.button_back_PS5;
|
||||
sIconPathMap["start"] = mStyle.mCustomButtons.button_start_PS5.empty() ?
|
||||
mCustomButtons.button_back_PS5;
|
||||
sIconPathMap["start"] = mCustomButtons.button_start_PS5.empty() ?
|
||||
":/graphics/help/button_start_PS5.svg" :
|
||||
mStyle.mCustomButtons.button_start_PS5;
|
||||
mCustomButtons.button_start_PS5;
|
||||
}
|
||||
else if (controllerType == "xbox360") {
|
||||
|
||||
sIconPathMap[buttonA] = mStyle.mCustomButtons.button_a_XBOX.empty() ?
|
||||
sIconPathMap[buttonA] = mCustomButtons.button_a_XBOX.empty() ?
|
||||
":/graphics/help/button_a_XBOX.svg" :
|
||||
mStyle.mCustomButtons.button_a_XBOX;
|
||||
sIconPathMap[buttonB] = mStyle.mCustomButtons.button_b_XBOX.empty() ?
|
||||
mCustomButtons.button_a_XBOX;
|
||||
sIconPathMap[buttonB] = mCustomButtons.button_b_XBOX.empty() ?
|
||||
":/graphics/help/button_b_XBOX.svg" :
|
||||
mStyle.mCustomButtons.button_b_XBOX;
|
||||
sIconPathMap[buttonX] = mStyle.mCustomButtons.button_x_XBOX.empty() ?
|
||||
mCustomButtons.button_b_XBOX;
|
||||
sIconPathMap[buttonX] = mCustomButtons.button_x_XBOX.empty() ?
|
||||
":/graphics/help/button_x_XBOX.svg" :
|
||||
mStyle.mCustomButtons.button_x_XBOX;
|
||||
sIconPathMap[buttonY] = mStyle.mCustomButtons.button_y_XBOX.empty() ?
|
||||
mCustomButtons.button_x_XBOX;
|
||||
sIconPathMap[buttonY] = mCustomButtons.button_y_XBOX.empty() ?
|
||||
":/graphics/help/button_y_XBOX.svg" :
|
||||
mStyle.mCustomButtons.button_y_XBOX;
|
||||
sIconPathMap["back"] = mStyle.mCustomButtons.button_back_XBOX360.empty() ?
|
||||
mCustomButtons.button_y_XBOX;
|
||||
sIconPathMap["back"] = mCustomButtons.button_back_XBOX360.empty() ?
|
||||
":/graphics/help/button_back_XBOX360.svg" :
|
||||
mStyle.mCustomButtons.button_back_XBOX360;
|
||||
sIconPathMap["start"] = mStyle.mCustomButtons.button_start_XBOX360.empty() ?
|
||||
mCustomButtons.button_back_XBOX360;
|
||||
sIconPathMap["start"] = mCustomButtons.button_start_XBOX360.empty() ?
|
||||
":/graphics/help/button_start_XBOX360.svg" :
|
||||
mStyle.mCustomButtons.button_start_XBOX360;
|
||||
mCustomButtons.button_start_XBOX360;
|
||||
}
|
||||
else {
|
||||
// Xbox One and later.
|
||||
sIconPathMap[buttonA] = mStyle.mCustomButtons.button_a_XBOX.empty() ?
|
||||
sIconPathMap[buttonA] = mCustomButtons.button_a_XBOX.empty() ?
|
||||
":/graphics/help/button_a_XBOX.svg" :
|
||||
mStyle.mCustomButtons.button_a_XBOX;
|
||||
sIconPathMap[buttonB] = mStyle.mCustomButtons.button_b_XBOX.empty() ?
|
||||
mCustomButtons.button_a_XBOX;
|
||||
sIconPathMap[buttonB] = mCustomButtons.button_b_XBOX.empty() ?
|
||||
":/graphics/help/button_b_XBOX.svg" :
|
||||
mStyle.mCustomButtons.button_b_XBOX;
|
||||
sIconPathMap[buttonX] = mStyle.mCustomButtons.button_x_XBOX.empty() ?
|
||||
mCustomButtons.button_b_XBOX;
|
||||
sIconPathMap[buttonX] = mCustomButtons.button_x_XBOX.empty() ?
|
||||
":/graphics/help/button_x_XBOX.svg" :
|
||||
mStyle.mCustomButtons.button_x_XBOX;
|
||||
sIconPathMap[buttonY] = mStyle.mCustomButtons.button_y_XBOX.empty() ?
|
||||
mCustomButtons.button_x_XBOX;
|
||||
sIconPathMap[buttonY] = mCustomButtons.button_y_XBOX.empty() ?
|
||||
":/graphics/help/button_y_XBOX.svg" :
|
||||
mStyle.mCustomButtons.button_y_XBOX;
|
||||
sIconPathMap["back"] = mStyle.mCustomButtons.button_back_XBOX.empty() ?
|
||||
mCustomButtons.button_y_XBOX;
|
||||
sIconPathMap["back"] = mCustomButtons.button_back_XBOX.empty() ?
|
||||
":/graphics/help/button_back_XBOX.svg" :
|
||||
mStyle.mCustomButtons.button_back_XBOX;
|
||||
sIconPathMap["start"] = mStyle.mCustomButtons.button_start_XBOX.empty() ?
|
||||
mCustomButtons.button_back_XBOX;
|
||||
sIconPathMap["start"] = mCustomButtons.button_start_XBOX.empty() ?
|
||||
":/graphics/help/button_start_XBOX.svg" :
|
||||
mStyle.mCustomButtons.button_start_XBOX;
|
||||
mCustomButtons.button_start_XBOX;
|
||||
}
|
||||
|
||||
// Invalidate cache for icons that have changed.
|
||||
|
@ -246,92 +259,243 @@ void HelpComponent::setPrompts(const std::vector<HelpPrompt>& prompts)
|
|||
updateGrid();
|
||||
}
|
||||
|
||||
void HelpComponent::setStyle(const HelpStyle& style)
|
||||
void HelpComponent::setOpacity(float opacity)
|
||||
{
|
||||
mStyle = style;
|
||||
updateGrid();
|
||||
if (!mGrid)
|
||||
return;
|
||||
|
||||
GuiComponent::setOpacity(opacity *
|
||||
(mWindow->isBackgroundDimmed() ? mStyleOpacityDimmed : mStyleOpacity));
|
||||
|
||||
for (unsigned int i {0}; i < mGrid->getChildCount(); ++i)
|
||||
mGrid->getChild(i)->setOpacity(
|
||||
opacity * (mWindow->isBackgroundDimmed() ? mStyleOpacityDimmed : mStyleOpacity));
|
||||
}
|
||||
|
||||
void HelpComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||
const std::string& view,
|
||||
const std::string& element,
|
||||
unsigned int properties)
|
||||
{
|
||||
const ThemeData::ThemeElement* elem {theme->getElement(view, element, "helpsystem")};
|
||||
|
||||
if (!elem)
|
||||
return;
|
||||
|
||||
if (elem->has("pos"))
|
||||
mStylePosition = elem->get<glm::vec2>("pos") *
|
||||
glm::vec2 {Renderer::getScreenWidth(), Renderer::getScreenHeight()};
|
||||
|
||||
if (elem->has("posDimmed"))
|
||||
mStylePositionDimmed = elem->get<glm::vec2>("posDimmed") *
|
||||
glm::vec2 {Renderer::getScreenWidth(), Renderer::getScreenHeight()};
|
||||
else
|
||||
mStylePositionDimmed = mStylePosition;
|
||||
|
||||
if (elem->has("origin"))
|
||||
mStyleOrigin = elem->get<glm::vec2>("origin");
|
||||
|
||||
if (elem->has("originDimmed"))
|
||||
mStyleOriginDimmed = elem->get<glm::vec2>("originDimmed");
|
||||
else
|
||||
mStyleOriginDimmed = mStyleOrigin;
|
||||
|
||||
if (elem->has("textColor"))
|
||||
mStyleTextColor = elem->get<unsigned int>("textColor");
|
||||
|
||||
if (elem->has("textColorDimmed"))
|
||||
mStyleTextColorDimmed = elem->get<unsigned int>("textColorDimmed");
|
||||
else
|
||||
mStyleTextColorDimmed = mStyleTextColor;
|
||||
|
||||
if (elem->has("iconColor"))
|
||||
mStyleIconColor = elem->get<unsigned int>("iconColor");
|
||||
|
||||
if (elem->has("iconColorDimmed"))
|
||||
mStyleIconColorDimmed = elem->get<unsigned int>("iconColorDimmed");
|
||||
else
|
||||
mStyleIconColorDimmed = mStyleIconColor;
|
||||
|
||||
if (elem->has("fontPath") || elem->has("fontSize")) {
|
||||
mStyleFont = Font::getFromTheme(elem, ThemeFlags::ALL, mStyleFont);
|
||||
if (!elem->has("fontSizeDimmed"))
|
||||
mStyleFontDimmed = Font::getFromTheme(elem, ThemeFlags::ALL, mStyleFont);
|
||||
}
|
||||
|
||||
if (elem->has("fontSizeDimmed"))
|
||||
mStyleFontDimmed = Font::getFromTheme(elem, ThemeFlags::ALL, mStyleFont, 0.0f, 1.0f, true);
|
||||
|
||||
if (elem->has("scope")) {
|
||||
const std::string& scope {elem->get<std::string>("scope")};
|
||||
if (scope == "shared") {
|
||||
mHelpComponentScope = HelpComponentScope::SHARED;
|
||||
}
|
||||
else if (scope == "view") {
|
||||
mHelpComponentScope = HelpComponentScope::VIEW;
|
||||
}
|
||||
else if (scope == "menu") {
|
||||
mHelpComponentScope = HelpComponentScope::MENU;
|
||||
}
|
||||
else {
|
||||
LOG(LogWarning) << "HelpComponent: Invalid theme configuration, property "
|
||||
"\"scope\" for element \""
|
||||
<< element.substr(11) << "\" defined as \"" << scope << "\"";
|
||||
}
|
||||
}
|
||||
|
||||
if (elem->has("entries")) {
|
||||
// Replace possible whitespace separators with commas.
|
||||
std::string entriesTag {Utils::String::toLower(elem->get<std::string>("entries"))};
|
||||
for (auto& character : entriesTag) {
|
||||
if (std::isspace(character))
|
||||
character = ',';
|
||||
}
|
||||
entriesTag = Utils::String::replace(entriesTag, ",,", ",");
|
||||
std::vector<std::string> entries {Utils::String::delimitedStringToVector(entriesTag, ",")};
|
||||
|
||||
// If the "all" value has been set then leave mEntries blank (allow all entries).
|
||||
if (std::find(entries.begin(), entries.end(), "all") == entries.end()) {
|
||||
for (auto& allowedEntry : sAllowedEntries) {
|
||||
if (std::find(entries.cbegin(), entries.cend(), allowedEntry) != entries.cend())
|
||||
mEntries.emplace_back(allowedEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (elem->has("entrySpacing"))
|
||||
mStyleEntrySpacing = glm::clamp(elem->get<float>("entrySpacing"), 0.0f, 0.04f);
|
||||
|
||||
if (elem->has("entrySpacingDimmed"))
|
||||
mStyleEntrySpacingDimmed = glm::clamp(elem->get<float>("entrySpacingDimmed"), 0.0f, 0.04f);
|
||||
else
|
||||
mStyleEntrySpacingDimmed = mStyleEntrySpacing;
|
||||
|
||||
if (elem->has("iconTextSpacing"))
|
||||
mStyleIconTextSpacing = glm::clamp(elem->get<float>("iconTextSpacing"), 0.0f, 0.04f);
|
||||
|
||||
if (elem->has("iconTextSpacingDimmed"))
|
||||
mStyleIconTextSpacingDimmed =
|
||||
glm::clamp(elem->get<float>("iconTextSpacingDimmed"), 0.0f, 0.04f);
|
||||
else
|
||||
mStyleIconTextSpacingDimmed = mStyleIconTextSpacing;
|
||||
|
||||
if (elem->has("letterCase"))
|
||||
mStyleLetterCase = elem->get<std::string>("letterCase");
|
||||
|
||||
if (elem->has("opacity"))
|
||||
mStyleOpacity = glm::clamp(elem->get<float>("opacity"), 0.2f, 1.0f);
|
||||
|
||||
if (elem->has("opacityDimmed"))
|
||||
mStyleOpacityDimmed = glm::clamp(elem->get<float>("opacityDimmed"), 0.2f, 1.0f);
|
||||
else
|
||||
mStyleOpacityDimmed = mStyleOpacity;
|
||||
|
||||
// Load custom button icons.
|
||||
// The names may look a bit strange when combined with the PREFIX string "button_" but it's
|
||||
// because ThemeData adds this prefix to avoid name collisions when using XML attributes.
|
||||
|
||||
// General.
|
||||
if (elem->has(PREFIX "dpad_updown"))
|
||||
mCustomButtons.dpad_updown = elem->get<std::string>(PREFIX "dpad_updown");
|
||||
if (elem->has(PREFIX "dpad_leftright"))
|
||||
mCustomButtons.dpad_leftright = elem->get<std::string>(PREFIX "dpad_leftright");
|
||||
if (elem->has(PREFIX "dpad_all"))
|
||||
mCustomButtons.dpad_all = elem->get<std::string>(PREFIX "dpad_all");
|
||||
if (elem->has(PREFIX "thumbstick_click"))
|
||||
mCustomButtons.thumbstick_click = elem->get<std::string>(PREFIX "thumbstick_click");
|
||||
if (elem->has(PREFIX "button_l"))
|
||||
mCustomButtons.button_l = elem->get<std::string>(PREFIX "button_l");
|
||||
if (elem->has(PREFIX "button_r"))
|
||||
mCustomButtons.button_r = elem->get<std::string>(PREFIX "button_r");
|
||||
if (elem->has(PREFIX "button_lr"))
|
||||
mCustomButtons.button_lr = elem->get<std::string>(PREFIX "button_lr");
|
||||
if (elem->has(PREFIX "button_lt"))
|
||||
mCustomButtons.button_lt = elem->get<std::string>(PREFIX "button_lt");
|
||||
if (elem->has(PREFIX "button_rt"))
|
||||
mCustomButtons.button_rt = elem->get<std::string>(PREFIX "button_rt");
|
||||
if (elem->has(PREFIX "button_ltrt"))
|
||||
mCustomButtons.button_ltrt = elem->get<std::string>(PREFIX "button_ltrt");
|
||||
|
||||
// SNES.
|
||||
if (elem->has(PREFIX "button_a_SNES"))
|
||||
mCustomButtons.button_a_SNES = elem->get<std::string>(PREFIX "button_a_SNES");
|
||||
if (elem->has(PREFIX "button_b_SNES"))
|
||||
mCustomButtons.button_b_SNES = elem->get<std::string>(PREFIX "button_b_SNES");
|
||||
if (elem->has(PREFIX "button_x_SNES"))
|
||||
mCustomButtons.button_x_SNES = elem->get<std::string>(PREFIX "button_x_SNES");
|
||||
if (elem->has(PREFIX "button_y_SNES"))
|
||||
mCustomButtons.button_y_SNES = elem->get<std::string>(PREFIX "button_y_SNES");
|
||||
if (elem->has(PREFIX "button_back_SNES"))
|
||||
mCustomButtons.button_back_SNES = elem->get<std::string>(PREFIX "button_back_SNES");
|
||||
if (elem->has(PREFIX "button_start_SNES"))
|
||||
mCustomButtons.button_start_SNES = elem->get<std::string>(PREFIX "button_start_SNES");
|
||||
|
||||
// Switch Pro.
|
||||
if (elem->has(PREFIX "button_a_switch"))
|
||||
mCustomButtons.button_a_switch = elem->get<std::string>(PREFIX "button_a_switch");
|
||||
if (elem->has(PREFIX "button_b_switch"))
|
||||
mCustomButtons.button_b_switch = elem->get<std::string>(PREFIX "button_b_switch");
|
||||
if (elem->has(PREFIX "button_x_switch"))
|
||||
mCustomButtons.button_x_switch = elem->get<std::string>(PREFIX "button_x_switch");
|
||||
if (elem->has(PREFIX "button_y_switch"))
|
||||
mCustomButtons.button_y_switch = elem->get<std::string>(PREFIX "button_y_switch");
|
||||
if (elem->has(PREFIX "button_back_switch"))
|
||||
mCustomButtons.button_back_switch = elem->get<std::string>(PREFIX "button_back_switch");
|
||||
if (elem->has(PREFIX "button_start_switch"))
|
||||
mCustomButtons.button_start_switch = elem->get<std::string>(PREFIX "button_start_switch");
|
||||
|
||||
// PlayStation.
|
||||
if (elem->has(PREFIX "button_a_PS"))
|
||||
mCustomButtons.button_a_PS = elem->get<std::string>(PREFIX "button_a_PS");
|
||||
if (elem->has(PREFIX "button_b_PS"))
|
||||
mCustomButtons.button_b_PS = elem->get<std::string>(PREFIX "button_b_PS");
|
||||
if (elem->has(PREFIX "button_x_PS"))
|
||||
mCustomButtons.button_x_PS = elem->get<std::string>(PREFIX "button_x_PS");
|
||||
if (elem->has(PREFIX "button_y_PS"))
|
||||
mCustomButtons.button_y_PS = elem->get<std::string>(PREFIX "button_y_PS");
|
||||
if (elem->has(PREFIX "button_back_PS123"))
|
||||
mCustomButtons.button_back_PS123 = elem->get<std::string>(PREFIX "button_back_PS123");
|
||||
if (elem->has(PREFIX "button_start_PS123"))
|
||||
mCustomButtons.button_start_PS123 = elem->get<std::string>(PREFIX "button_start_PS123");
|
||||
if (elem->has(PREFIX "button_back_PS4"))
|
||||
mCustomButtons.button_back_PS4 = elem->get<std::string>(PREFIX "button_back_PS4");
|
||||
if (elem->has(PREFIX "button_start_PS4"))
|
||||
mCustomButtons.button_start_PS4 = elem->get<std::string>(PREFIX "button_start_PS4");
|
||||
if (elem->has(PREFIX "button_back_PS5"))
|
||||
mCustomButtons.button_back_PS5 = elem->get<std::string>(PREFIX "button_back_PS5");
|
||||
if (elem->has(PREFIX "button_start_PS5"))
|
||||
mCustomButtons.button_start_PS5 = elem->get<std::string>(PREFIX "button_start_PS5");
|
||||
|
||||
// XBOX.
|
||||
if (elem->has(PREFIX "button_a_XBOX"))
|
||||
mCustomButtons.button_a_XBOX = elem->get<std::string>(PREFIX "button_a_XBOX");
|
||||
if (elem->has(PREFIX "button_b_XBOX"))
|
||||
mCustomButtons.button_b_XBOX = elem->get<std::string>(PREFIX "button_b_XBOX");
|
||||
if (elem->has(PREFIX "button_x_XBOX"))
|
||||
mCustomButtons.button_x_XBOX = elem->get<std::string>(PREFIX "button_x_XBOX");
|
||||
if (elem->has(PREFIX "button_y_XBOX"))
|
||||
mCustomButtons.button_y_XBOX = elem->get<std::string>(PREFIX "button_y_XBOX");
|
||||
if (elem->has(PREFIX "button_back_XBOX"))
|
||||
mCustomButtons.button_back_XBOX = elem->get<std::string>(PREFIX "button_back_XBOX");
|
||||
if (elem->has(PREFIX "button_start_XBOX"))
|
||||
mCustomButtons.button_start_XBOX = elem->get<std::string>(PREFIX "button_start_XBOX");
|
||||
if (elem->has(PREFIX "button_back_XBOX360"))
|
||||
mCustomButtons.button_back_XBOX360 = elem->get<std::string>(PREFIX "button_back_XBOX360");
|
||||
if (elem->has(PREFIX "button_start_XBOX360"))
|
||||
mCustomButtons.button_start_XBOX360 = elem->get<std::string>(PREFIX "button_start_XBOX360");
|
||||
|
||||
assignIcons();
|
||||
}
|
||||
|
||||
void HelpComponent::updateGrid()
|
||||
void HelpComponent::render(const glm::mat4& parentTrans)
|
||||
{
|
||||
if (!Settings::getInstance()->getBool("ShowHelpPrompts") || mPrompts.empty()) {
|
||||
mGrid.reset();
|
||||
if (!mVisible)
|
||||
return;
|
||||
}
|
||||
|
||||
const bool isDimmed {mWindow->isBackgroundDimmed()};
|
||||
const glm::mat4 trans {parentTrans * getTransform()};
|
||||
|
||||
std::shared_ptr<Font>& font {isDimmed ? mStyle.fontDimmed : mStyle.font};
|
||||
mGrid = std::make_shared<ComponentGrid>(glm::ivec2 {static_cast<int>(mPrompts.size()) * 5, 1});
|
||||
|
||||
std::vector<std::shared_ptr<ImageComponent>> icons;
|
||||
std::vector<std::shared_ptr<TextComponent>> labels;
|
||||
|
||||
float width {0.0f};
|
||||
float height {font->getLetterHeight() * 1.25f};
|
||||
|
||||
for (auto it = mPrompts.cbegin(); it != mPrompts.cend(); ++it) {
|
||||
auto icon = std::make_shared<ImageComponent>();
|
||||
icon->setImage(getIconTexture(it->first.c_str()), false);
|
||||
icon->setColorShift(isDimmed ? mStyle.iconColorDimmed : mStyle.iconColor);
|
||||
icon->setResize(0, height);
|
||||
icon->setOpacity(isDimmed ? mStyle.opacityDimmed : mStyle.opacity);
|
||||
icons.push_back(icon);
|
||||
|
||||
// Apply text style and color from the theme to the label and add it to the label list.
|
||||
std::string lblInput {it->second};
|
||||
if (mStyle.letterCase == "lowercase")
|
||||
lblInput = Utils::String::toLower(lblInput);
|
||||
else if (mStyle.letterCase == "capitalize")
|
||||
lblInput = Utils::String::toCapitalized(lblInput);
|
||||
else
|
||||
lblInput = Utils::String::toUpper(lblInput);
|
||||
auto lbl = std::make_shared<TextComponent>(
|
||||
lblInput, font, isDimmed ? mStyle.textColorDimmed : mStyle.textColor);
|
||||
lbl->setOpacity(isDimmed ? mStyle.opacityDimmed : mStyle.opacity);
|
||||
labels.push_back(lbl);
|
||||
|
||||
width += icon->getSize().x + lbl->getSize().x +
|
||||
(((isDimmed ? mStyle.iconTextSpacingDimmed : mStyle.iconTextSpacing) *
|
||||
mRenderer->getScreenWidth() +
|
||||
(isDimmed ? mStyle.entrySpacingDimmed : mStyle.entrySpacing) *
|
||||
mRenderer->getScreenWidth()));
|
||||
}
|
||||
|
||||
mGrid->setSize(width, height);
|
||||
|
||||
for (int i {0}; i < static_cast<int>(icons.size()); ++i) {
|
||||
const int col {i * 5};
|
||||
mGrid->setColWidthPerc(col, icons.at(i)->getSize().x / width);
|
||||
mGrid->setColWidthPerc(col + 1,
|
||||
((isDimmed ? mStyle.iconTextSpacingDimmed : mStyle.iconTextSpacing) *
|
||||
mRenderer->getScreenWidth()) /
|
||||
width);
|
||||
mGrid->setColWidthPerc(col + 2, labels.at(i)->getSize().x / width);
|
||||
mGrid->setColWidthPerc(col + 3,
|
||||
((isDimmed ? mStyle.entrySpacingDimmed : mStyle.entrySpacing) *
|
||||
mRenderer->getScreenWidth()) /
|
||||
width);
|
||||
|
||||
mGrid->setEntry(icons.at(i), glm::ivec2 {col, 0}, false, false);
|
||||
mGrid->setEntry(labels.at(i), glm::ivec2 {col + 2, 0}, false, false);
|
||||
}
|
||||
|
||||
if (isDimmed) {
|
||||
mGrid->setPosition(
|
||||
{mStyle.positionDimmed.x + ((mStyle.entrySpacingDimmed * mRenderer->getScreenWidth()) *
|
||||
mStyle.originDimmed.x),
|
||||
mStyle.positionDimmed.y, 0.0f});
|
||||
}
|
||||
else {
|
||||
mGrid->setPosition(
|
||||
{mStyle.position.x +
|
||||
((mStyle.entrySpacing * mRenderer->getScreenWidth()) * mStyle.origin.x),
|
||||
mStyle.position.y, 0.0f});
|
||||
}
|
||||
|
||||
mGrid->setOrigin(isDimmed ? mStyle.originDimmed : mStyle.origin);
|
||||
if (mGrid)
|
||||
mGrid->render(trans);
|
||||
}
|
||||
|
||||
std::shared_ptr<TextureResource> HelpComponent::getIconTexture(const char* name)
|
||||
|
@ -358,20 +522,86 @@ std::shared_ptr<TextureResource> HelpComponent::getIconTexture(const char* name)
|
|||
return tex;
|
||||
}
|
||||
|
||||
void HelpComponent::setOpacity(float opacity)
|
||||
void HelpComponent::updateGrid()
|
||||
{
|
||||
GuiComponent::setOpacity(
|
||||
opacity * (mWindow->isBackgroundDimmed() ? mStyle.opacityDimmed : mStyle.opacity));
|
||||
if (!Settings::getInstance()->getBool("ShowHelpPrompts") || mPrompts.empty()) {
|
||||
mGrid.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < mGrid->getChildCount(); ++i)
|
||||
mGrid->getChild(i)->setOpacity(
|
||||
opacity * (mWindow->isBackgroundDimmed() ? mStyle.opacityDimmed : mStyle.opacity));
|
||||
}
|
||||
|
||||
void HelpComponent::render(const glm::mat4& parentTrans)
|
||||
{
|
||||
glm::mat4 trans {parentTrans * getTransform()};
|
||||
|
||||
if (mGrid)
|
||||
mGrid->render(trans);
|
||||
const bool isDimmed {mWindow->isBackgroundDimmed()};
|
||||
|
||||
std::shared_ptr<Font>& font {isDimmed ? mStyleFontDimmed : mStyleFont};
|
||||
mGrid = std::make_shared<ComponentGrid>(glm::ivec2 {static_cast<int>(mPrompts.size()) * 5, 1});
|
||||
|
||||
std::vector<std::shared_ptr<ImageComponent>> icons;
|
||||
std::vector<std::shared_ptr<TextComponent>> labels;
|
||||
|
||||
float width {0.0f};
|
||||
float height {font->getLetterHeight() * 1.25f};
|
||||
|
||||
for (auto it = mPrompts.cbegin(); it != mPrompts.cend(); ++it) {
|
||||
if (!mEntries.empty() &&
|
||||
std::find(mEntries.cbegin(), mEntries.cend(), (*it).first) == mEntries.cend())
|
||||
continue;
|
||||
|
||||
auto icon = std::make_shared<ImageComponent>();
|
||||
icon->setImage(getIconTexture(it->first.c_str()), false);
|
||||
icon->setColorShift(isDimmed ? mStyleIconColorDimmed : mStyleIconColor);
|
||||
icon->setResize(0, height);
|
||||
icon->setOpacity(isDimmed ? mStyleOpacityDimmed : mStyleOpacity);
|
||||
icons.push_back(icon);
|
||||
|
||||
// Apply text style and color from the theme to the label and add it to the label list.
|
||||
std::string lblInput {it->second};
|
||||
if (mStyleLetterCase == "lowercase")
|
||||
lblInput = Utils::String::toLower(lblInput);
|
||||
else if (mStyleLetterCase == "capitalize")
|
||||
lblInput = Utils::String::toCapitalized(lblInput);
|
||||
else
|
||||
lblInput = Utils::String::toUpper(lblInput);
|
||||
auto lbl = std::make_shared<TextComponent>(
|
||||
lblInput, font, isDimmed ? mStyleTextColorDimmed : mStyleTextColor);
|
||||
lbl->setOpacity(isDimmed ? mStyleOpacityDimmed : mStyleOpacity);
|
||||
labels.push_back(lbl);
|
||||
|
||||
width += icon->getSize().x + lbl->getSize().x +
|
||||
(((isDimmed ? mStyleIconTextSpacingDimmed : mStyleIconTextSpacing) *
|
||||
mRenderer->getScreenWidth() +
|
||||
(isDimmed ? mStyleEntrySpacingDimmed : mStyleEntrySpacing) *
|
||||
mRenderer->getScreenWidth()));
|
||||
}
|
||||
|
||||
mGrid->setSize(width, height);
|
||||
|
||||
for (int i {0}; i < static_cast<int>(icons.size()); ++i) {
|
||||
const int col {i * 5};
|
||||
mGrid->setColWidthPerc(col, icons.at(i)->getSize().x / width);
|
||||
mGrid->setColWidthPerc(col + 1,
|
||||
((isDimmed ? mStyleIconTextSpacingDimmed : mStyleIconTextSpacing) *
|
||||
mRenderer->getScreenWidth()) /
|
||||
width);
|
||||
mGrid->setColWidthPerc(col + 2, labels.at(i)->getSize().x / width);
|
||||
mGrid->setColWidthPerc(col + 3,
|
||||
((isDimmed ? mStyleEntrySpacingDimmed : mStyleEntrySpacing) *
|
||||
mRenderer->getScreenWidth()) /
|
||||
width);
|
||||
|
||||
mGrid->setEntry(icons.at(i), glm::ivec2 {col, 0}, false, false);
|
||||
mGrid->setEntry(labels.at(i), glm::ivec2 {col + 2, 0}, false, false);
|
||||
}
|
||||
|
||||
if (isDimmed) {
|
||||
mGrid->setPosition(
|
||||
{mStylePositionDimmed.x +
|
||||
((mStyleEntrySpacingDimmed * mRenderer->getScreenWidth()) * mStyleOriginDimmed.x),
|
||||
mStylePositionDimmed.y, 0.0f});
|
||||
}
|
||||
else {
|
||||
mGrid->setPosition({mStylePosition.x + ((mStyleEntrySpacing * mRenderer->getScreenWidth()) *
|
||||
mStyleOrigin.x),
|
||||
mStylePosition.y, 0.0f});
|
||||
}
|
||||
|
||||
mGrid->setOrigin(isDimmed ? mStyleOriginDimmed : mStyleOrigin);
|
||||
}
|
||||
|
|
|
@ -10,27 +10,34 @@
|
|||
#define ES_CORE_COMPONENTS_HELP_COMPONENT_H
|
||||
|
||||
#include "GuiComponent.h"
|
||||
#include "HelpStyle.h"
|
||||
#include "components/ComponentGrid.h"
|
||||
#include "renderers/Renderer.h"
|
||||
|
||||
class ComponentGrid;
|
||||
class ImageComponent;
|
||||
class TextureResource;
|
||||
#include "resources/Font.h"
|
||||
#include "resources/TextureResource.h"
|
||||
|
||||
class HelpComponent : public GuiComponent
|
||||
{
|
||||
public:
|
||||
HelpComponent();
|
||||
HelpComponent(std::shared_ptr<Font> font = Renderer::getIsVerticalOrientation() ?
|
||||
Font::get(0.025f * Renderer::getScreenWidth()) :
|
||||
Font::get(FONT_SIZE_SMALL));
|
||||
|
||||
void assignIcons();
|
||||
|
||||
void clearPrompts();
|
||||
void setPrompts(const std::vector<HelpPrompt>& prompts);
|
||||
|
||||
void render(const glm::mat4& parent) override;
|
||||
void setOpacity(float opacity) override;
|
||||
void setStylePosition(const glm::vec2 position) { mStylePosition = position; }
|
||||
void setStyleOrigin(const glm::vec2 origin) { mStyleOrigin = origin; }
|
||||
void setStyleTextColor(const unsigned int textColor) { mStyleTextColor = textColor; }
|
||||
void setStyleIconColor(const unsigned int iconColor) { mStyleIconColor = iconColor; }
|
||||
|
||||
void setStyle(const HelpStyle& style);
|
||||
void applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||
const std::string& view,
|
||||
const std::string& element,
|
||||
unsigned int properties) override;
|
||||
|
||||
void render(const glm::mat4& parent) override;
|
||||
|
||||
private:
|
||||
Renderer* mRenderer;
|
||||
|
@ -41,7 +48,99 @@ private:
|
|||
void updateGrid();
|
||||
|
||||
std::vector<HelpPrompt> mPrompts;
|
||||
HelpStyle mStyle;
|
||||
static inline std::map<std::string, std::string> sIconPathMap;
|
||||
|
||||
std::shared_ptr<Font> mStyleFont;
|
||||
std::shared_ptr<Font> mStyleFontDimmed;
|
||||
|
||||
std::vector<std::string> mEntries;
|
||||
static inline std::vector<std::string> sAllowedEntries {"up/down/left/right",
|
||||
"up/down",
|
||||
"up",
|
||||
"down",
|
||||
"left/right",
|
||||
"rt",
|
||||
"lt",
|
||||
"r",
|
||||
"l",
|
||||
"y",
|
||||
"x",
|
||||
"b",
|
||||
"a",
|
||||
"start",
|
||||
"back"};
|
||||
|
||||
glm::vec2 mStylePosition;
|
||||
glm::vec2 mStylePositionDimmed;
|
||||
glm::vec2 mStyleOrigin;
|
||||
glm::vec2 mStyleOriginDimmed;
|
||||
unsigned int mStyleTextColor;
|
||||
unsigned int mStyleTextColorDimmed;
|
||||
unsigned int mStyleIconColor;
|
||||
unsigned int mStyleIconColorDimmed;
|
||||
float mStyleEntrySpacing;
|
||||
float mStyleEntrySpacingDimmed;
|
||||
float mStyleIconTextSpacing;
|
||||
float mStyleIconTextSpacingDimmed;
|
||||
float mStyleOpacity;
|
||||
float mStyleOpacityDimmed;
|
||||
std::string mStyleLetterCase;
|
||||
|
||||
struct CustomButtonIcons {
|
||||
// Generic
|
||||
std::string dpad_updown;
|
||||
std::string dpad_up;
|
||||
std::string dpad_down;
|
||||
std::string dpad_leftright;
|
||||
std::string dpad_all;
|
||||
std::string thumbstick_click;
|
||||
std::string button_l;
|
||||
std::string button_r;
|
||||
std::string button_lr;
|
||||
std::string button_lt;
|
||||
std::string button_rt;
|
||||
std::string button_ltrt;
|
||||
|
||||
// SNES
|
||||
std::string button_a_SNES;
|
||||
std::string button_b_SNES;
|
||||
std::string button_x_SNES;
|
||||
std::string button_y_SNES;
|
||||
std::string button_back_SNES;
|
||||
std::string button_start_SNES;
|
||||
|
||||
// Switch Pro
|
||||
std::string button_a_switch;
|
||||
std::string button_b_switch;
|
||||
std::string button_x_switch;
|
||||
std::string button_y_switch;
|
||||
std::string button_back_switch;
|
||||
std::string button_start_switch;
|
||||
|
||||
// PlayStation
|
||||
std::string button_a_PS;
|
||||
std::string button_b_PS;
|
||||
std::string button_x_PS;
|
||||
std::string button_y_PS;
|
||||
std::string button_back_PS123;
|
||||
std::string button_start_PS123;
|
||||
std::string button_back_PS4;
|
||||
std::string button_start_PS4;
|
||||
std::string button_back_PS5;
|
||||
std::string button_start_PS5;
|
||||
|
||||
// XBOX
|
||||
std::string button_a_XBOX;
|
||||
std::string button_b_XBOX;
|
||||
std::string button_x_XBOX;
|
||||
std::string button_y_XBOX;
|
||||
std::string button_back_XBOX;
|
||||
std::string button_start_XBOX;
|
||||
std::string button_back_XBOX360;
|
||||
std::string button_start_XBOX360;
|
||||
};
|
||||
|
||||
CustomButtonIcons mCustomButtons;
|
||||
};
|
||||
|
||||
#endif // ES_CORE_COMPONENTS_HELP_COMPONENT_H
|
||||
|
|
|
@ -27,13 +27,11 @@
|
|||
template <typename T> class OptionListComponent : public GuiComponent
|
||||
{
|
||||
public:
|
||||
OptionListComponent(const HelpStyle& helpstyle,
|
||||
const std::string& name,
|
||||
OptionListComponent(const std::string& name,
|
||||
bool multiSelect = false,
|
||||
bool multiExclusiveSelect = false,
|
||||
bool multiShowTotal = false)
|
||||
: mHelpStyle {helpstyle}
|
||||
, mMultiSelect {multiSelect}
|
||||
: mMultiSelect {multiSelect}
|
||||
, mMultiExclusiveSelect {multiExclusiveSelect}
|
||||
, mMultiShowTotal {multiShowTotal}
|
||||
, mKeyRepeat {false}
|
||||
|
@ -297,8 +295,6 @@ public:
|
|||
GuiComponent::update(deltaTime);
|
||||
}
|
||||
|
||||
HelpStyle getHelpStyle() override { return mHelpStyle; }
|
||||
|
||||
private:
|
||||
struct OptionListData {
|
||||
std::string name;
|
||||
|
@ -307,13 +303,12 @@ private:
|
|||
float maxNameLength;
|
||||
};
|
||||
|
||||
HelpStyle mHelpStyle;
|
||||
std::function<void(const T& object)> mSelectedChangedCallback;
|
||||
|
||||
void open()
|
||||
{
|
||||
// Open the list popup.
|
||||
mWindow->pushGui(new OptionListPopup(getHelpStyle(), this, mName));
|
||||
mWindow->pushGui(new OptionListPopup(this, mName));
|
||||
}
|
||||
|
||||
void onSelectedChanged()
|
||||
|
@ -417,12 +412,9 @@ private:
|
|||
class OptionListPopup : public GuiComponent
|
||||
{
|
||||
public:
|
||||
OptionListPopup(const HelpStyle& helpstyle,
|
||||
OptionListComponent<T>* parent,
|
||||
const std::string& title)
|
||||
OptionListPopup(OptionListComponent<T>* parent, const std::string& title)
|
||||
: mMenu(title.c_str())
|
||||
, mParent(parent)
|
||||
, mHelpStyle(helpstyle)
|
||||
{
|
||||
auto font = Font::get(FONT_SIZE_MEDIUM);
|
||||
ComponentListRow row;
|
||||
|
@ -579,12 +571,9 @@ private:
|
|||
return prompts;
|
||||
}
|
||||
|
||||
HelpStyle getHelpStyle() override { return mHelpStyle; }
|
||||
|
||||
private:
|
||||
MenuComponent mMenu;
|
||||
OptionListComponent<T>* mParent;
|
||||
HelpStyle mHelpStyle;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
#define HORIZONTAL_PADDING_PX 20.0f
|
||||
#define VERTICAL_PADDING_MODIFIER 1.225f
|
||||
|
||||
GuiMsgBox::GuiMsgBox(const HelpStyle& helpstyle,
|
||||
const std::string& text,
|
||||
GuiMsgBox::GuiMsgBox(const std::string& text,
|
||||
const std::string& name1,
|
||||
const std::function<void()>& func1,
|
||||
const std::string& name2,
|
||||
|
@ -30,7 +29,6 @@ GuiMsgBox::GuiMsgBox(const HelpStyle& helpstyle,
|
|||
: mRenderer {Renderer::getInstance()}
|
||||
, mBackground {":/graphics/frame.svg"}
|
||||
, mGrid {glm::ivec2 {1, 2}}
|
||||
, mHelpStyle {helpstyle}
|
||||
, mBackFunc {backFunc}
|
||||
, mDisableBackButton {disableBackButton}
|
||||
, mDeleteOnButtonPress {deleteOnButtonPress}
|
||||
|
|
|
@ -21,8 +21,7 @@ class TextComponent;
|
|||
class GuiMsgBox : public GuiComponent
|
||||
{
|
||||
public:
|
||||
GuiMsgBox(const HelpStyle& helpstyle,
|
||||
const std::string& text,
|
||||
GuiMsgBox(const std::string& text,
|
||||
const std::string& name1 = _("OK"),
|
||||
const std::function<void()>& func1 = nullptr,
|
||||
const std::string& name2 = "",
|
||||
|
@ -42,7 +41,6 @@ public:
|
|||
void onSizeChanged() override;
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return mHelpStyle; }
|
||||
|
||||
private:
|
||||
void deleteMeAndCall(const std::function<void()>& func);
|
||||
|
@ -51,7 +49,6 @@ private:
|
|||
NinePatchComponent mBackground;
|
||||
ComponentGrid mGrid;
|
||||
|
||||
HelpStyle mHelpStyle;
|
||||
std::shared_ptr<TextComponent> mMsg;
|
||||
std::vector<std::shared_ptr<ButtonComponent>> mButtons;
|
||||
std::shared_ptr<ComponentGrid> mButtonGrid;
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "utils/StringUtil.h"
|
||||
|
||||
GuiTextEditKeyboardPopup::GuiTextEditKeyboardPopup(
|
||||
const HelpStyle& helpstyle,
|
||||
const float verticalPosition,
|
||||
const std::string& title,
|
||||
const std::string& initValue,
|
||||
|
@ -57,7 +56,6 @@ GuiTextEditKeyboardPopup::GuiTextEditKeyboardPopup(
|
|||
: mRenderer {Renderer::getInstance()}
|
||||
, mBackground {":/graphics/frame.svg"}
|
||||
, mGrid {glm::ivec2 {1, (infoString != "" && defaultValue != "" ? 8 : 6)}}
|
||||
, mHelpStyle {helpstyle}
|
||||
, mInitValue {initValue}
|
||||
, mAcceptBtnHelpText {acceptBtnHelpText}
|
||||
, mSaveConfirmationText {saveConfirmationText}
|
||||
|
@ -365,7 +363,7 @@ bool GuiTextEditKeyboardPopup::input(InputConfig* config, Input input)
|
|||
if (mText->getValue() != mInitValue) {
|
||||
// Changes were made, ask if the user wants to save them.
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
mHelpStyle, mSaveConfirmationText, _("YES"),
|
||||
mSaveConfirmationText, _("YES"),
|
||||
[this] {
|
||||
this->mOkCallback(mText->getValue());
|
||||
delete this;
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
class GuiTextEditKeyboardPopup : public GuiComponent
|
||||
{
|
||||
public:
|
||||
GuiTextEditKeyboardPopup(const HelpStyle& helpstyle,
|
||||
const float verticalPosition,
|
||||
GuiTextEditKeyboardPopup(const float verticalPosition,
|
||||
const std::string& title,
|
||||
const std::string& initValue,
|
||||
const std::function<void(const std::string&)>& okCallback,
|
||||
|
@ -39,7 +38,6 @@ public:
|
|||
void update(int deltaTime) override;
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return mHelpStyle; }
|
||||
|
||||
private:
|
||||
class KeyboardButton
|
||||
|
@ -81,7 +79,6 @@ private:
|
|||
Renderer* mRenderer;
|
||||
NinePatchComponent mBackground;
|
||||
ComponentGrid mGrid;
|
||||
HelpStyle mHelpStyle;
|
||||
|
||||
std::shared_ptr<TextComponent> mTitle;
|
||||
std::shared_ptr<TextComponent> mInfoString;
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
#include "components/MenuComponent.h"
|
||||
#include "guis/GuiMsgBox.h"
|
||||
|
||||
GuiTextEditPopup::GuiTextEditPopup(const HelpStyle& helpstyle,
|
||||
const std::string& title,
|
||||
GuiTextEditPopup::GuiTextEditPopup(const std::string& title,
|
||||
const std::string& initValue,
|
||||
const std::function<void(const std::string&)>& okCallback,
|
||||
bool multiLine,
|
||||
|
@ -29,7 +28,6 @@ GuiTextEditPopup::GuiTextEditPopup(const HelpStyle& helpstyle,
|
|||
const std::string& cancelBtnHelpText)
|
||||
: mBackground {":/graphics/frame.svg"}
|
||||
, mGrid {glm::ivec2 {1, (infoString != "" && defaultValue != "" ? 5 : 3)}}
|
||||
, mHelpStyle {helpstyle}
|
||||
, mInitValue {initValue}
|
||||
, mAcceptBtnText {acceptBtnText}
|
||||
, mSaveConfirmationText {saveConfirmationText}
|
||||
|
@ -191,7 +189,7 @@ bool GuiTextEditPopup::input(InputConfig* config, Input input)
|
|||
if (mText->getValue() != mInitValue) {
|
||||
// Changes were made, ask if the user wants to save them.
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
mHelpStyle, mSaveConfirmationText, _("YES"),
|
||||
mSaveConfirmationText, _("YES"),
|
||||
[this] {
|
||||
this->mOkCallback(mText->getValue());
|
||||
delete this;
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
class GuiTextEditPopup : public GuiComponent
|
||||
{
|
||||
public:
|
||||
GuiTextEditPopup(const HelpStyle& helpstyle,
|
||||
const std::string& title,
|
||||
GuiTextEditPopup(const std::string& title,
|
||||
const std::string& initValue,
|
||||
const std::function<void(const std::string&)>& okCallback,
|
||||
bool multiLine,
|
||||
|
@ -38,14 +37,12 @@ public:
|
|||
void update(int deltaTime) override;
|
||||
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override { return mHelpStyle; }
|
||||
|
||||
private:
|
||||
void updateDeleteRepeat(int deltaTime);
|
||||
|
||||
NinePatchComponent mBackground;
|
||||
ComponentGrid mGrid;
|
||||
HelpStyle mHelpStyle;
|
||||
|
||||
std::shared_ptr<TextComponent> mTitle;
|
||||
std::shared_ptr<TextComponent> mInfoString;
|
||||
|
|
Loading…
Reference in a new issue