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.
|
2020-11-05 17:18:11 +00:00
|
|
|
// The saving of es_settings.cfg and the reload of the gamelists are triggered from here
|
|
|
|
// based on the flags set by the actual 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
|
|
|
|
2020-11-05 17:18:11 +00:00
|
|
|
void setNeedsSaving() { mNeedsSaving = true; };
|
2020-11-06 19:27:41 +00:00
|
|
|
void setNeedsCollectionsUpdate() { mNeedsCollectionsUpdate = true; };
|
2020-11-05 17:18:11 +00:00
|
|
|
void setNeedsReloading() { mNeedsReloading = true; };
|
|
|
|
void setNeedsSorting() { mNeedsSorting = true; };
|
|
|
|
void setNeedsSortingCollections() { mNeedsSortingCollections = true; };
|
2020-11-06 19:27:41 +00:00
|
|
|
void setNeedsGoToStart() { mNeedsGoToStart = true; };
|
|
|
|
void setNeedsGoToSystemView(SystemData* goToSystem)
|
|
|
|
{ mNeedsGoToSystemView = true; mGoToSystem = goToSystem; };
|
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;
|
2020-11-06 19:27:41 +00:00
|
|
|
bool mNeedsCollectionsUpdate;
|
2020-11-05 17:18:11 +00:00
|
|
|
bool mNeedsReloading;
|
|
|
|
bool mNeedsSorting;
|
|
|
|
bool mNeedsSortingCollections;
|
2020-11-06 19:27:41 +00:00
|
|
|
bool mNeedsGoToStart;
|
|
|
|
bool mNeedsGoToSystemView;
|
|
|
|
|
|
|
|
SystemData* mGoToSystem;
|
2017-10-31 17:12:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ES_APP_GUIS_GUI_SETTINGS_H
|