2020-06-06 14:48:05 +00:00
|
|
|
//
|
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
|
|
|
#pragma once
|
|
|
|
#ifndef ES_APP_VIEWS_UI_MODE_CONTROLLER_H
|
|
|
|
#define ES_APP_VIEWS_UI_MODE_CONTROLLER_H
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
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();
|
|
|
|
inline std::vector<std::string> getUIModes() { return mUIModes; };
|
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);
|
|
|
|
void logInput(InputConfig * config, Input input);
|
|
|
|
|
|
|
|
// Return UI mode to 'full'.
|
|
|
|
void unlockUIMode();
|
|
|
|
|
|
|
|
static UIModeController * sInstance;
|
2020-07-27 10:11:30 +00:00
|
|
|
const std::vector<std::string> mUIModes = { "full", "kiosk", "kid" };
|
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
|