mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-24 18:08:27 +01:00
fixed file select and folder select widget bug
This commit is contained in:
parent
c90772666e
commit
3422998bd1
@ -11,8 +11,8 @@ FileSelect::FileSelect(std::string defaultPath) {
|
|||||||
|
|
||||||
bool FileSelect::render(std::string id) {
|
bool FileSelect::render(std::string id) {
|
||||||
bool _pathChanged = false;
|
bool _pathChanged = false;
|
||||||
#ifdef _WIN32
|
|
||||||
float menuColumnWidth = ImGui::GetContentRegionAvailWidth();
|
float menuColumnWidth = ImGui::GetContentRegionAvailWidth();
|
||||||
|
#ifdef _WIN32
|
||||||
float buttonWidth = ImGui::CalcTextSize("...").x + 20.0f;
|
float buttonWidth = ImGui::CalcTextSize("...").x + 20.0f;
|
||||||
bool lastPathValid = pathValid;
|
bool lastPathValid = pathValid;
|
||||||
if (!lastPathValid) {
|
if (!lastPathValid) {
|
||||||
|
@ -9,8 +9,8 @@ FolderSelect::FolderSelect(std::string defaultPath) {
|
|||||||
|
|
||||||
bool FolderSelect::render(std::string id) {
|
bool FolderSelect::render(std::string id) {
|
||||||
bool _pathChanged = false;
|
bool _pathChanged = false;
|
||||||
#ifdef _WIN32
|
|
||||||
float menuColumnWidth = ImGui::GetContentRegionAvailWidth();
|
float menuColumnWidth = ImGui::GetContentRegionAvailWidth();
|
||||||
|
#ifdef _WIN32
|
||||||
float buttonWidth = ImGui::CalcTextSize("...").x + 20.0f;
|
float buttonWidth = ImGui::CalcTextSize("...").x + 20.0f;
|
||||||
bool lastPathValid = pathValid;
|
bool lastPathValid = pathValid;
|
||||||
if (!lastPathValid) {
|
if (!lastPathValid) {
|
||||||
|
@ -18,14 +18,15 @@ set_target_properties(sdrplay_source PROPERTIES PREFIX "")
|
|||||||
if (MSVC)
|
if (MSVC)
|
||||||
# Lib path
|
# Lib path
|
||||||
target_link_directories(sdrpp_core PUBLIC "C:/Program Files/SDRplay/API/x64")
|
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)
|
target_link_libraries(sdrplay_source PUBLIC sdrplay_api)
|
||||||
else (MSVC)
|
else (MSVC)
|
||||||
find_package(PkgConfig)
|
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_include_directories(sdrplay_source PUBLIC ${LIBSDRPLAY_INCLUDE_DIRS})
|
||||||
target_link_directories(sdrplay_source PUBLIC ${LIBAIRSPYHF_LIBRARY_DIRS})
|
target_link_directories(sdrplay_source PUBLIC ${LIBSDRPLAY_LIBRARY_DIRS})
|
||||||
target_link_libraries(sdrplay_source PUBLIC ${LIBAIRSPYHF_LIBRARIES})
|
target_link_libraries(sdrplay_source PUBLIC ${LIBSDRPLAY_LIBRARIES})
|
||||||
endif (MSVC)
|
endif (MSVC)
|
@ -7,7 +7,7 @@
|
|||||||
#include <gui/style.h>
|
#include <gui/style.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <options.h>
|
#include <options.h>
|
||||||
#include <libairspy/airspy.h>
|
#include <sdrplay_api.h>
|
||||||
|
|
||||||
|
|
||||||
#define CONCAT(a, b) ((std::string(a) + b).c_str())
|
#define CONCAT(a, b) ((std::string(a) + b).c_str())
|
||||||
@ -27,6 +27,8 @@ public:
|
|||||||
SDRPlaySourceModule(std::string name) {
|
SDRPlaySourceModule(std::string name) {
|
||||||
this->name = name;
|
this->name = name;
|
||||||
|
|
||||||
|
sdrplay_api_Open();
|
||||||
|
|
||||||
sampleRate = 10000000.0;
|
sampleRate = 10000000.0;
|
||||||
|
|
||||||
handler.ctx = this;
|
handler.ctx = this;
|
||||||
@ -54,7 +56,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
~SDRPlaySourceModule() {
|
~SDRPlaySourceModule() {
|
||||||
|
sdrplay_api_Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void enable() {
|
void enable() {
|
||||||
@ -73,7 +75,15 @@ public:
|
|||||||
devList.clear();
|
devList.clear();
|
||||||
devListTxt = "";
|
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:
|
private:
|
||||||
@ -145,7 +155,12 @@ private:
|
|||||||
|
|
||||||
ImGui::SetNextItemWidth(menuWidth);
|
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;
|
bool running = false;
|
||||||
double freq;
|
double freq;
|
||||||
|
|
||||||
|
sdrplay_api_DeviceT openDev;
|
||||||
|
|
||||||
int devId = 0;
|
int devId = 0;
|
||||||
int srId = 0;
|
int srId = 0;
|
||||||
|
|
||||||
std::vector<uint64_t> devList;
|
std::vector<std::string> devList;
|
||||||
std::string devListTxt;
|
std::string devListTxt;
|
||||||
std::vector<uint32_t> sampleRateList;
|
std::vector<uint32_t> sampleRateList;
|
||||||
std::string sampleRateListTxt;
|
std::string sampleRateListTxt;
|
||||||
|
Loading…
Reference in New Issue
Block a user