2019-10-05 01:56:17 +00:00
|
|
|
#ifndef LOGID_CONFIGURATION_H
|
|
|
|
#define LOGID_CONFIGURATION_H
|
2019-07-17 05:53:51 +00:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <libconfig.h++>
|
2019-07-28 06:08:18 +00:00
|
|
|
#include <hidpp20/ISmartShift.h>
|
|
|
|
#include "Actions.h"
|
2019-07-17 05:53:51 +00:00
|
|
|
|
2019-10-05 01:56:17 +00:00
|
|
|
namespace logid
|
2019-07-17 05:53:51 +00:00
|
|
|
{
|
2019-10-05 01:56:17 +00:00
|
|
|
class DeviceConfig;
|
|
|
|
class ButtonAction;
|
|
|
|
enum class Action;
|
2019-07-17 05:53:51 +00:00
|
|
|
|
2019-10-05 01:56:17 +00:00
|
|
|
class DeviceConfig
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DeviceConfig();
|
|
|
|
~DeviceConfig();
|
|
|
|
DeviceConfig(DeviceConfig* dc, Device* dev);
|
|
|
|
DeviceConfig(const libconfig::Setting& root);
|
|
|
|
const int* dpi = nullptr;
|
|
|
|
HIDPP20::ISmartShift::SmartshiftStatus* smartshift;
|
|
|
|
const uint8_t* hiresscroll = nullptr;
|
|
|
|
std::map<uint16_t, ButtonAction*> actions;
|
|
|
|
const bool baseConfig = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Configuration
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Configuration(const char* config_file);
|
|
|
|
Configuration() {}
|
|
|
|
std::map<std::string, DeviceConfig*> devices;
|
|
|
|
private:
|
|
|
|
libconfig::Config cfg;
|
|
|
|
};
|
2019-07-17 05:53:51 +00:00
|
|
|
|
2019-10-05 01:56:17 +00:00
|
|
|
ButtonAction* parse_action(Action action, const libconfig::Setting* action_config, bool is_gesture=false);
|
2019-07-17 05:53:51 +00:00
|
|
|
|
2019-10-05 01:56:17 +00:00
|
|
|
extern Configuration* global_config;
|
|
|
|
}
|
2019-07-17 05:53:51 +00:00
|
|
|
|
2019-10-05 01:56:17 +00:00
|
|
|
#endif //LOGID_CONFIGURATION_H
|