47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#pragma once
|
|
#include <QStringList>
|
|
#include <array>
|
|
#include <vector>
|
|
|
|
// 热力图宽
|
|
// 热力图高
|
|
// 量程
|
|
// 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<ConfigProfile>& get_all_profile();
|
|
void reload_profiles();
|
|
private:
|
|
GlobalHelper();
|
|
void load_profiles();
|
|
std::vector<ConfigProfile> config_vec;
|
|
};
|