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
|
|
|
//
|
|
|
|
|
2022-01-17 20:59:00 +00:00
|
|
|
#ifndef ES_APP_UI_MODE_CONTROLLER_H
|
|
|
|
#define ES_APP_UI_MODE_CONTROLLER_H
|
2017-11-18 22:23:56 +00:00
|
|
|
|
|
|
|
#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
|
|
|
|
2021-07-07 18:03:42 +00:00
|
|
|
void setCurrentUIMode(const std::string& mode) { mCurrentUIMode = mode; }
|
2021-01-05 09:45:32 +00:00
|
|
|
|
2017-11-18 22:23:56 +00:00
|
|
|
private:
|
2022-01-04 20:21:26 +00:00
|
|
|
UIModeController() noexcept;
|
|
|
|
|
2021-07-01 15:48:14 +00:00
|
|
|
bool inputIsMatch(InputConfig* config, Input input);
|
|
|
|
bool isValidInput(InputConfig* config, Input input);
|
2020-06-21 12:25:28 +00:00
|
|
|
|
|
|
|
// Return UI mode to 'full'.
|
|
|
|
void unlockUIMode();
|
|
|
|
|
|
|
|
// Default passkeyseq = "uuddlrlrba", as defined in the setting 'UIMode_passkey'.
|
|
|
|
std::string mPassKeySequence;
|
2021-07-01 15:48:14 +00:00
|
|
|
|
|
|
|
std::string mCurrentUIMode;
|
2020-06-21 12:25:28 +00:00
|
|
|
int mPassKeyCounter;
|
2021-07-01 15:48:14 +00:00
|
|
|
|
|
|
|
// These are Xbox button names, so they may be different in pracise on non-Xbox controllers.
|
2021-08-17 16:41:45 +00:00
|
|
|
const std::vector<std::string> mInputVals = {"up", "down", "left", "right", "a", "b", "x", "y"};
|
2017-11-18 22:23:56 +00:00
|
|
|
};
|
|
|
|
|
2022-01-17 20:59:00 +00:00
|
|
|
#endif // ES_APP_UI_MODE_CONTROLLER_H
|