figments: input: remove unused event intents, move stringification into figments lib

This commit is contained in:
Torrie Fischer 2023-12-23 11:11:33 +01:00
parent 89e943b767
commit e43b594637
2 changed files with 61 additions and 13 deletions

View File

@ -98,3 +98,55 @@ BufferedInputSource::setEvent(InputEvent::Intent intent, Variant &&v)
{
m_eventQueue.insert(InputEvent{intent, std::move(v)});
}
const char*
InputEvent::name() const
{
switch (intent) {
case InputEvent::BeatDetect:
return "beat-detection";
case InputEvent::Beat:
return "beat";
case InputEvent::ReadyToRoll:
return "ready-to-roll";
case InputEvent::PowerToggle:
return "power-toggle";
case InputEvent::SetPower:
return "set-power";
case InputEvent::SetPattern:
return "set-pattern";
case InputEvent::SetScene:
return "set-scene";
case InputEvent::SetColor:
return "set-color";
case InputEvent::Acceleration:
return "acceleration";
case InputEvent::SetBrightness:
return "set-brightness";
case InputEvent::FirmwareUpdate:
return "firmware-update";
case InputEvent::NetworkStatus:
return "network-status";
case InputEvent::NetworkActivity:
return "network-activity";
case InputEvent::StartThing:
return "start-thing";
case InputEvent::StopThing:
return "stop-thing";
case InputEvent::SaveConfigurationRequest:
return "save-configuration";
case InputEvent::ConfigurationChanged:
return "configuration-changed";
case InputEvent::IdleStart:
return "idle-start";
case InputEvent::IdleStop:
return "idle-stop";
case InputEvent::ButtonPress:
return "button";
case InputEvent::LoadConfigurationByName:
return "load-config";
case None:
return "none";
}
return "unknown";
}

View File

@ -55,9 +55,10 @@ struct InputEvent: public Variant {
// An empty non-event
None,
// An input from the user, for other tasks to translate into canonical
// types. Makes for easy button re-mapping on the fly.
UserInput,
// System activity
ReadyToRoll,
IdleStart,
IdleStop,
//
// The canonical types
@ -65,6 +66,8 @@ struct InputEvent: public Variant {
// Hardware inputs
ButtonPress,
Acceleration,
// Network management
NetworkStatus,
NetworkActivity,
@ -74,15 +77,10 @@ struct InputEvent: public Variant {
SetBrightness,
// Animation sequencing
PreviousPattern,
NextPattern,
SetPattern,
PreviousScene,
NextScene,
SetScene,
// Timekeeping
ScheduleChange,
Beat,
BeatDetect,
@ -91,17 +89,13 @@ struct InputEvent: public Variant {
StopThing,
// Configuration
SetDisplayOffset,
SetDisplayLength,
LoadConfigurationByName,
SetColor,
SaveConfigurationRequest,
ConfigurationChanged,
SetColor,
// Firmware events
FirmwareUpdate,
ReadyToRoll,
};
template<typename Value>
@ -118,6 +112,8 @@ struct InputEvent: public Variant {
return intent != otherIntent;
}
const char* name() const;
Intent intent;
};