mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-12 19:27:11 +01:00
UI improvements
This commit is contained in:
parent
1dbc39b970
commit
1ebcfe7d80
@ -114,16 +114,15 @@ public:
|
|||||||
airspy_get_samplerates(dev, sampleRates, 0);
|
airspy_get_samplerates(dev, sampleRates, 0);
|
||||||
int n = sampleRates[0];
|
int n = sampleRates[0];
|
||||||
airspy_get_samplerates(dev, sampleRates, n);
|
airspy_get_samplerates(dev, sampleRates, n);
|
||||||
char buf[1024];
|
|
||||||
sampleRateList.clear();
|
sampleRateList.clear();
|
||||||
sampleRateListTxt = "";
|
sampleRateListTxt = "";
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
sampleRateList.push_back(sampleRates[i]);
|
sampleRateList.push_back(sampleRates[i]);
|
||||||
sprintf(buf, "%d", sampleRates[i]);
|
sampleRateListTxt += getBandwdithScaled(sampleRates[i]);
|
||||||
sampleRateListTxt += buf;
|
|
||||||
sampleRateListTxt += '\0';
|
sampleRateListTxt += '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char buf[1024];
|
||||||
sprintf(buf, "%016" PRIX64, serial);
|
sprintf(buf, "%016" PRIX64, serial);
|
||||||
selectedSerStr = std::string(buf);
|
selectedSerStr = std::string(buf);
|
||||||
|
|
||||||
@ -193,6 +192,20 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string getBandwdithScaled(double bw) {
|
||||||
|
char buf[1024];
|
||||||
|
if (bw >= 1000000.0) {
|
||||||
|
sprintf(buf, "%.1lfMHz", bw / 1000000.0);
|
||||||
|
}
|
||||||
|
else if (bw >= 1000.0) {
|
||||||
|
sprintf(buf, "%.1lfKHz", bw / 1000.0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sprintf(buf, "%.1lfHz", bw);
|
||||||
|
}
|
||||||
|
return std::string(buf);
|
||||||
|
}
|
||||||
|
|
||||||
static void menuSelected(void* ctx) {
|
static void menuSelected(void* ctx) {
|
||||||
AirspySourceModule* _this = (AirspySourceModule*)ctx;
|
AirspySourceModule* _this = (AirspySourceModule*)ctx;
|
||||||
core::setInputSampleRate(_this->sampleRate);
|
core::setInputSampleRate(_this->sampleRate);
|
||||||
@ -411,9 +424,13 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_this->gainMode == 2) {
|
else if (_this->gainMode == 2) {
|
||||||
|
// Calculate position of sliders
|
||||||
|
float pos = ImGui::CalcTextSize("Mixer Gain").x + 10;
|
||||||
|
|
||||||
if (_this->lnaAgc) { style::beginDisabled(); }
|
if (_this->lnaAgc) { style::beginDisabled(); }
|
||||||
ImGui::Text("LNA Gain");
|
ImGui::Text("LNA Gain");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
ImGui::SetCursorPosX(pos);
|
||||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||||
if (ImGui::SliderInt(CONCAT("##_airspy_lna_gain_", _this->name), &_this->lnaGain, 0, 15)) {
|
if (ImGui::SliderInt(CONCAT("##_airspy_lna_gain_", _this->name), &_this->lnaGain, 0, 15)) {
|
||||||
if (_this->running) {
|
if (_this->running) {
|
||||||
@ -430,6 +447,7 @@ private:
|
|||||||
if (_this->mixerAgc) { style::beginDisabled(); }
|
if (_this->mixerAgc) { style::beginDisabled(); }
|
||||||
ImGui::Text("Mixer Gain");
|
ImGui::Text("Mixer Gain");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
ImGui::SetCursorPosX(pos);
|
||||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||||
if (ImGui::SliderInt(CONCAT("##_airspy_mix_gain_", _this->name), &_this->mixerGain, 0, 15)) {
|
if (ImGui::SliderInt(CONCAT("##_airspy_mix_gain_", _this->name), &_this->mixerGain, 0, 15)) {
|
||||||
if (_this->running) {
|
if (_this->running) {
|
||||||
@ -445,6 +463,7 @@ private:
|
|||||||
|
|
||||||
ImGui::Text("VGA Gain");
|
ImGui::Text("VGA Gain");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
ImGui::SetCursorPosX(pos);
|
||||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||||
if (ImGui::SliderInt(CONCAT("##_airspy_vga_gain_", _this->name), &_this->vgaGain, 0, 15)) {
|
if (ImGui::SliderInt(CONCAT("##_airspy_vga_gain_", _this->name), &_this->vgaGain, 0, 15)) {
|
||||||
if (_this->running) {
|
if (_this->running) {
|
||||||
@ -474,7 +493,6 @@ private:
|
|||||||
config.release(true);
|
config.release(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox(CONCAT("Mixer AGC##_airspy_", _this->name), &_this->mixerAgc)) {
|
if (ImGui::Checkbox(CONCAT("Mixer AGC##_airspy_", _this->name), &_this->mixerAgc)) {
|
||||||
if (_this->running) {
|
if (_this->running) {
|
||||||
if (_this->mixerAgc) {
|
if (_this->mixerAgc) {
|
||||||
|
@ -121,16 +121,15 @@ public:
|
|||||||
airspyhf_get_samplerates(dev, sampleRates, 0);
|
airspyhf_get_samplerates(dev, sampleRates, 0);
|
||||||
int n = sampleRates[0];
|
int n = sampleRates[0];
|
||||||
airspyhf_get_samplerates(dev, sampleRates, n);
|
airspyhf_get_samplerates(dev, sampleRates, n);
|
||||||
char buf[1024];
|
|
||||||
sampleRateList.clear();
|
sampleRateList.clear();
|
||||||
sampleRateListTxt = "";
|
sampleRateListTxt = "";
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
sampleRateList.push_back(sampleRates[i]);
|
sampleRateList.push_back(sampleRates[i]);
|
||||||
sprintf(buf, "%d", sampleRates[i]);
|
sampleRateListTxt += getBandwdithScaled(sampleRates[i]);
|
||||||
sampleRateListTxt += buf;
|
|
||||||
sampleRateListTxt += '\0';
|
sampleRateListTxt += '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char buf[1024];
|
||||||
sprintf(buf, "%016" PRIX64, serial);
|
sprintf(buf, "%016" PRIX64, serial);
|
||||||
selectedSerStr = std::string(buf);
|
selectedSerStr = std::string(buf);
|
||||||
|
|
||||||
@ -174,6 +173,20 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string getBandwdithScaled(double bw) {
|
||||||
|
char buf[1024];
|
||||||
|
if (bw >= 1000000.0) {
|
||||||
|
sprintf(buf, "%.1lfMHz", bw / 1000000.0);
|
||||||
|
}
|
||||||
|
else if (bw >= 1000.0) {
|
||||||
|
sprintf(buf, "%.1lfKHz", bw / 1000.0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sprintf(buf, "%.1lfHz", bw);
|
||||||
|
}
|
||||||
|
return std::string(buf);
|
||||||
|
}
|
||||||
|
|
||||||
static void menuSelected(void* ctx) {
|
static void menuSelected(void* ctx) {
|
||||||
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
|
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
|
||||||
core::setInputSampleRate(_this->sampleRate);
|
core::setInputSampleRate(_this->sampleRate);
|
||||||
|
Loading…
Reference in New Issue
Block a user