1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#pragma once
#include "nlohmann/json.hpp"
#include "imgui/pfd/widget.h"
#include "common/dsp/io/baseband_type.h"
#include "common/widgets/datetime.h"
#include "common/widgets/notated_num.h"
namespace satdump
{
/*
This is really mostly means for the user interface,
to have a common method to represent and input
parameters, without hardcoding them.
*/
namespace params
{
enum ParameterType
{
PARAM_STRING,
PARAM_PASSWORD,
PARAM_INT,
PARAM_FLOAT,
PARAM_BOOL,
PARAM_OPTIONS,
PARAM_PATH,
PARAM_TIMESTAMP,
PARAM_NOTATED_INT,
PARAM_COLOR,
PARAM_BASEBAND_TYPE,
PARAM_LABELED_OPTIONS
};
class EditableParameter
{
public:
ParameterType d_type;
std::string d_name;
int d_imgui_id;
std::string d_id;
std::string d_description;
// All the values we might need
std::string p_string;
int p_int;
double p_float;
bool p_bool;
float p_color[4] = {0, 0, 0, 0};
dsp::BasebandType baseband_type;
std::shared_ptr<FileSelectWidget> file_select;
std::shared_ptr<widgets::DateTimePicker> date_time_picker;
std::shared_ptr<widgets::NotatedNum<int64_t>> notated_int;
int d_option;
std::string d_options_str;
std::vector<std::string> d_options;
std::vector<std::pair<std::string, std::string>> d_labeled_opts;
public:
EditableParameter(nlohmann::json p_json);
void draw();
nlohmann::json getValue();
nlohmann::json setValue(nlohmann::json v);
};
}
}
|