2020-09-21 17:17:34 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-23 18:07:00 +00:00
|
|
|
//
|
2020-09-21 17:17:34 +00:00
|
|
|
// EmulationStation Desktop Edition
|
2020-06-23 18:07:00 +00:00
|
|
|
// GuiSettings.h
|
|
|
|
//
|
|
|
|
// User interface template for a settings GUI.
|
2021-06-16 17:05:24 +00:00
|
|
|
// The saving of es_settings.xml, the reload of gamelists and some other actions are
|
2021-01-05 09:45:32 +00:00
|
|
|
// also triggered to be executed here via flags set by the menu entries' lambda functions.
|
2020-06-23 18:07:00 +00:00
|
|
|
//
|
|
|
|
|
2017-10-31 17:12:50 +00:00
|
|
|
#ifndef ES_APP_GUIS_GUI_SETTINGS_H
|
|
|
|
#define ES_APP_GUIS_GUI_SETTINGS_H
|
|
|
|
|
2020-11-06 19:27:41 +00:00
|
|
|
#include "SystemData.h"
|
2021-07-07 18:03:42 +00:00
|
|
|
#include "components/MenuComponent.h"
|
2022-03-18 19:14:51 +00:00
|
|
|
#include "views/ViewController.h"
|
2014-06-25 16:29:58 +00:00
|
|
|
|
|
|
|
// This is just a really simple template for a GUI that calls some save functions when closed.
|
|
|
|
class GuiSettings : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
2022-01-19 17:01:54 +00:00
|
|
|
GuiSettings(std::string title);
|
2020-11-05 17:18:11 +00:00
|
|
|
virtual ~GuiSettings();
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
void save();
|
2021-08-22 13:20:10 +00:00
|
|
|
void addRow(const ComponentListRow& row, bool setCursorHere = false)
|
|
|
|
{
|
|
|
|
mMenu.addRow(row, setCursorHere);
|
|
|
|
}
|
2021-07-07 18:03:42 +00:00
|
|
|
void addWithLabel(const std::string& label, const std::shared_ptr<GuiComponent>& comp)
|
|
|
|
{
|
|
|
|
mMenu.addWithLabel(label, comp);
|
|
|
|
}
|
|
|
|
void addEditableTextComponent(const std::string label,
|
|
|
|
std::shared_ptr<GuiComponent> ed,
|
|
|
|
std::string value,
|
|
|
|
std::string defaultValue = "",
|
|
|
|
bool isPassword = false);
|
|
|
|
void addSaveFunc(const std::function<void()>& func) { mSaveFuncs.push_back(func); }
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2022-05-21 17:52:05 +00:00
|
|
|
MenuComponent& getMenu() { return mMenu; }
|
2021-08-22 13:20:10 +00:00
|
|
|
glm::vec2 getMenuSize() { return mMenu.getSize(); }
|
|
|
|
void setMenuSize(glm::vec2 size) { mMenu.setSize(size); }
|
|
|
|
glm::vec3 getMenuPosition() { return mMenu.getPosition(); }
|
2022-05-21 17:59:05 +00:00
|
|
|
void setMenuPosition(glm::vec3 position) { mMenu.setPosition(position); }
|
2021-08-22 13:20:10 +00:00
|
|
|
|
2021-07-07 18:03:42 +00:00
|
|
|
void setNeedsSaving(bool state = true) { mNeedsSaving = state; }
|
|
|
|
void setNeedsCollectionsUpdate() { mNeedsCollectionsUpdate = true; }
|
|
|
|
void setNeedsSorting() { mNeedsSorting = true; }
|
|
|
|
void setNeedsSortingCollections() { mNeedsSortingCollections = true; }
|
2021-01-05 09:45:32 +00:00
|
|
|
void setNeedsResetFilters() { mNeedsResetFilters = true; }
|
2021-07-07 18:03:42 +00:00
|
|
|
void setNeedsReloading() { mNeedsReloading = true; }
|
|
|
|
void setNeedsGoToStart() { mNeedsGoToStart = true; }
|
2021-01-01 21:37:21 +00:00
|
|
|
void setNeedsGoToSystem(SystemData* goToSystem)
|
2021-07-07 18:03:42 +00:00
|
|
|
{
|
|
|
|
mNeedsGoToSystem = true;
|
|
|
|
mGoToSystem = goToSystem;
|
|
|
|
};
|
|
|
|
void setNeedsGoToGroupedCollections() { mNeedsGoToGroupedCollections = true; }
|
|
|
|
void setInvalidateCachedBackground() { mInvalidateCachedBackground = true; }
|
2020-11-05 17:18:11 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
bool input(InputConfig* config, Input input) override;
|
|
|
|
std::vector<HelpPrompt> getHelpPrompts() override;
|
2022-03-18 19:14:51 +00:00
|
|
|
HelpStyle getHelpStyle() override { return ViewController::getInstance()->getViewHelpStyle(); }
|
2014-06-25 16:29:58 +00:00
|
|
|
|
|
|
|
private:
|
2020-06-23 18:07:00 +00:00
|
|
|
MenuComponent mMenu;
|
2020-11-05 17:18:11 +00:00
|
|
|
std::vector<std::function<void()>> mSaveFuncs;
|
2021-07-07 18:03:42 +00:00
|
|
|
SystemData* mGoToSystem;
|
|
|
|
|
2020-11-05 17:18:11 +00:00
|
|
|
bool mNeedsSaving;
|
2020-11-06 19:27:41 +00:00
|
|
|
bool mNeedsCollectionsUpdate;
|
2020-11-05 17:18:11 +00:00
|
|
|
bool mNeedsSorting;
|
|
|
|
bool mNeedsSortingCollections;
|
2021-01-05 09:45:32 +00:00
|
|
|
bool mNeedsResetFilters;
|
|
|
|
bool mNeedsReloading;
|
2020-11-06 19:27:41 +00:00
|
|
|
bool mNeedsGoToStart;
|
2021-01-01 21:37:21 +00:00
|
|
|
bool mNeedsGoToSystem;
|
2021-01-02 11:33:27 +00:00
|
|
|
bool mNeedsGoToGroupedCollections;
|
2021-03-21 17:46:45 +00:00
|
|
|
bool mInvalidateCachedBackground;
|
2017-10-31 17:12:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ES_APP_GUIS_GUI_SETTINGS_H
|