fixed file select and folder select widget bug

This commit is contained in:
Ryzerth 2021-02-11 15:29:51 +01:00
parent c90772666e
commit 3422998bd1
4 changed files with 29 additions and 11 deletions

View File

@ -11,8 +11,8 @@ FileSelect::FileSelect(std::string defaultPath) {
bool FileSelect::render(std::string id) {
bool _pathChanged = false;
#ifdef _WIN32
float menuColumnWidth = ImGui::GetContentRegionAvailWidth();
#ifdef _WIN32
float buttonWidth = ImGui::CalcTextSize("...").x + 20.0f;
bool lastPathValid = pathValid;
if (!lastPathValid) {

View File

@ -9,8 +9,8 @@ FolderSelect::FolderSelect(std::string defaultPath) {
bool FolderSelect::render(std::string id) {
bool _pathChanged = false;
#ifdef _WIN32
float menuColumnWidth = ImGui::GetContentRegionAvailWidth();
#ifdef _WIN32
float buttonWidth = ImGui::CalcTextSize("...").x + 20.0f;
bool lastPathValid = pathValid;
if (!lastPathValid) {

View File

@ -18,14 +18,15 @@ set_target_properties(sdrplay_source PROPERTIES PREFIX "")
if (MSVC)
# Lib path
target_link_directories(sdrpp_core PUBLIC "C:/Program Files/SDRplay/API/x64")
target_include_directories(sdrplay_source PUBLIC "C:/Program Files/SDRplay/API/inc")
target_link_libraries(sdrplay_source PUBLIC sdrplay_api)
else (MSVC)
find_package(PkgConfig)
pkg_check_modules(LIBAIRSPYHF REQUIRED libairspy)
pkg_check_modules(LIBSDRPLAY REQUIRED libsdrplay)
target_include_directories(sdrplay_source PUBLIC ${LIBAIRSPYHF_INCLUDE_DIRS})
target_link_directories(sdrplay_source PUBLIC ${LIBAIRSPYHF_LIBRARY_DIRS})
target_link_libraries(sdrplay_source PUBLIC ${LIBAIRSPYHF_LIBRARIES})
target_include_directories(sdrplay_source PUBLIC ${LIBSDRPLAY_INCLUDE_DIRS})
target_link_directories(sdrplay_source PUBLIC ${LIBSDRPLAY_LIBRARY_DIRS})
target_link_libraries(sdrplay_source PUBLIC ${LIBSDRPLAY_LIBRARIES})
endif (MSVC)

View File

@ -7,7 +7,7 @@
#include <gui/style.h>
#include <config.h>
#include <options.h>
#include <libairspy/airspy.h>
#include <sdrplay_api.h>
#define CONCAT(a, b) ((std::string(a) + b).c_str())
@ -27,6 +27,8 @@ public:
SDRPlaySourceModule(std::string name) {
this->name = name;
sdrplay_api_Open();
sampleRate = 10000000.0;
handler.ctx = this;
@ -54,7 +56,7 @@ public:
}
~SDRPlaySourceModule() {
sdrplay_api_Close();
}
void enable() {
@ -73,7 +75,15 @@ public:
devList.clear();
devListTxt = "";
// Fill in list here
sdrplay_api_DeviceT devArr[128];
unsigned int numDev = 0;
sdrplay_api_GetDevices(devArr, &numDev, 128);
for (unsigned int i = 0; i < numDev; i++) {
devList.push_back(devArr[i].SerNo);
devListTxt += devArr[i].SerNo;
devListTxt += '\0';
}
}
private:
@ -145,7 +155,12 @@ private:
ImGui::SetNextItemWidth(menuWidth);
// Menu here
if (_this->running) { style::beginDisabled(); }
if (ImGui::Combo(CONCAT("##sdrplay_dev", _this->name), &_this->devId, _this->devListTxt.c_str())) {
}
if (_this->running) { style::endDisabled(); }
}
@ -158,10 +173,12 @@ private:
bool running = false;
double freq;
sdrplay_api_DeviceT openDev;
int devId = 0;
int srId = 0;
std::vector<uint64_t> devList;
std::vector<std::string> devList;
std::string devListTxt;
std::vector<uint32_t> sampleRateList;
std::string sampleRateListTxt;