2020-09-15 19:12:32 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-06 14:48:05 +00:00
|
|
|
//
|
2020-09-15 19:12:32 +00:00
|
|
|
// EmulationStation Desktop Edition
|
2020-06-21 12:25:28 +00:00
|
|
|
// UIModeController.h
|
2020-06-06 14:48:05 +00:00
|
|
|
//
|
2020-06-21 12:25:28 +00:00
|
|
|
// Handling of application user interface modes (full, kiosk and kid).
|
|
|
|
// This includes switching the mode when the UI mode passkey is used.
|
2020-06-06 14:48:05 +00:00
|
|
|
//
|
|
|
|
|
2017-11-18 22:23:56 +00:00
|
|
|
#ifndef ES_APP_VIEWS_UI_MODE_CONTROLLER_H
|
|
|
|
#define ES_APP_VIEWS_UI_MODE_CONTROLLER_H
|
|
|
|
|
|
|
|
#include <string>
|
2020-09-21 17:17:34 +00:00
|
|
|
#include <vector>
|
2017-11-18 22:23:56 +00:00
|
|
|
|
|
|
|
class FileData;
|
|
|
|
class InputConfig;
|
|
|
|
class ViewController;
|
|
|
|
|
|
|
|
struct Input;
|
|
|
|
|
2020-06-06 14:48:05 +00:00
|
|
|
class UIModeController
|
|
|
|
{
|
2017-11-18 22:23:56 +00:00
|
|
|
public:
|
2020-06-21 12:25:28 +00:00
|
|
|
static UIModeController* getInstance();
|
2017-11-18 22:23:56 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
// Monitor input for UI mode change, returns true (consumes input) when a UI mode
|
|
|
|
// change is triggered.
|
|
|
|
bool listen(InputConfig* config, Input input);
|
2019-08-25 15:23:02 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
// Get the current Passphrase as a (unicode) formatted, comma-separated, string.
|
|
|
|
std::string getFormattedPassKeyStr();
|
2017-11-18 22:23:56 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
// Check for change in UI mode.
|
|
|
|
void monitorUIMode();
|
2017-11-18 22:23:56 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
bool isUIModeFull();
|
|
|
|
bool isUIModeKid();
|
|
|
|
bool isUIModeKiosk();
|
2020-06-06 14:48:05 +00:00
|
|
|
|
2017-11-18 22:23:56 +00:00
|
|
|
private:
|
2020-06-21 12:25:28 +00:00
|
|
|
UIModeController();
|
|
|
|
bool inputIsMatch(InputConfig * config, Input input);
|
|
|
|
bool isValidInput(InputConfig * config, Input input);
|
|
|
|
|
|
|
|
// Return UI mode to 'full'.
|
|
|
|
void unlockUIMode();
|
|
|
|
|
2020-11-05 17:18:11 +00:00
|
|
|
static UIModeController* sInstance;
|
2020-06-21 12:25:28 +00:00
|
|
|
|
|
|
|
// Default passkeyseq = "uuddlrlrba", as defined in the setting 'UIMode_passkey'.
|
|
|
|
std::string mPassKeySequence;
|
|
|
|
int mPassKeyCounter;
|
|
|
|
const std::vector<std::string> mInputVals =
|
|
|
|
{ "up", "down", "left", "right", "a", "b", "x", "y" };
|
|
|
|
std::string mCurrentUIMode;
|
2017-11-18 22:23:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ES_APP_VIEWS_UI_MODE_CONTROLLER_H
|