#pragma once #include #include #include // 热力图宽 // 热力图高 // 量程 // baud enum class Tactile_TYPE { PiezoresistiveA, PiezoresistiveB, Hall, }; typedef struct ConfigProfile { QString name; Tactile_TYPE type; int matrix_width; int matrix_height; int range_left; int range_right; int baud_rate; } ConfigProfile; class GlobalHelper { public: static GlobalHelper& instance(); GlobalHelper(const GlobalHelper&) = delete; GlobalHelper& operator=(const GlobalHelper&) = delete; GlobalHelper(GlobalHelper&&) = delete; GlobalHelper& operator=(GlobalHelper&&) = delete; bool add_new_profile(QString name, Tactile_TYPE type, int width, int height, int rl, int rr, int baud); bool add_new_profile(const ConfigProfile& profile); void remove_profile(const QString& name); void save_profile(const ConfigProfile& profile, int is_default = 0); std::vector& get_all_profile(); void reload_profiles(); private: GlobalHelper(); void load_profiles(); std::vector config_vec; };