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
|
|
|
|
|
2014-06-25 16:29:58 +00:00
|
|
|
#include "components/MenuComponent.h"
|
2020-11-06 19:27:41 +00:00
|
|
|
#include "SystemData.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:
|
2020-11-06 19:27:41 +00:00
|
|
|
GuiSettings(Window* window, 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();
|
|
|
|
inline void addRow(const ComponentListRow& row) { mMenu.addRow(row); };
|
|
|
|
inline void addWithLabel(const std::string& label,
|
|
|
|
const std::shared_ptr<GuiComponent>& comp) { mMenu.addWithLabel(label, comp); };
|
2020-11-07 14:34:15 +00:00
|
|
|
void addEditableTextComponent(
|
|
|
|
const std::string label,
|
|
|
|
std::shared_ptr<GuiComponent> ed,
|
|
|
|
std::string value,
|
|
|
|
std::string defaultValue = "",
|
|
|
|
bool isPassword = false);
|
2020-06-23 18:07:00 +00:00
|
|
|
inline void addSaveFunc(const std::function<void()>& func) { mSaveFuncs.push_back(func); };
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2021-06-09 18:56:41 +00:00
|
|
|
void setNeedsSaving(bool state = true) { mNeedsSaving = state; };
|
2021-05-23 17:12:31 +00:00
|
|
|
void setNeedsReloadHelpPrompts() { mNeedsReloadHelpPrompts = true; };
|
2020-11-06 19:27:41 +00:00
|
|
|
void setNeedsCollectionsUpdate() { mNeedsCollectionsUpdate = true; };
|
2020-11-05 17:18:11 +00:00
|
|
|
void setNeedsSorting() { mNeedsSorting = true; };
|
|
|
|
void setNeedsSortingCollections() { mNeedsSortingCollections = true; };
|
2021-01-05 09:45:32 +00:00
|
|
|
void setNeedsResetFilters() { mNeedsResetFilters = true; }
|
|
|
|
void setNeedsReloading() { mNeedsReloading = true; };
|
2020-11-06 19:27:41 +00:00
|
|
|
void setNeedsGoToStart() { mNeedsGoToStart = true; };
|
2021-01-01 21:37:21 +00:00
|
|
|
void setNeedsGoToSystem(SystemData* goToSystem)
|
|
|
|
{ mNeedsGoToSystem = true; mGoToSystem = goToSystem; };
|
2021-01-02 11:33:27 +00:00
|
|
|
void setNeedsGoToGroupedCollections() { mNeedsGoToGroupedCollections = true; };
|
2021-03-21 17:46:45 +00:00
|
|
|
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;
|
|
|
|
HelpStyle getHelpStyle() override;
|
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;
|
|
|
|
bool mNeedsSaving;
|
2021-05-23 17:12:31 +00:00
|
|
|
bool mNeedsReloadHelpPrompts;
|
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;
|
2020-11-06 19:27:41 +00:00
|
|
|
|
|
|
|
SystemData* mGoToSystem;
|
2017-10-31 17:12:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ES_APP_GUIS_GUI_SETTINGS_H
|