mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-09-27 07:46:35 -04:00
Fix bad 'SoapySDR missing' modal dialog thread call
This commit is contained in:
parent
416cb54fb9
commit
8d738aed25
@ -204,6 +204,7 @@ bool CubicSDR::OnInit() {
|
||||
offset = 0;
|
||||
ppm = 0;
|
||||
devicesReady.store(false);
|
||||
devicesFailed.store(false);
|
||||
deviceSelectorOpen.store(false);
|
||||
|
||||
// Visual Data
|
||||
@ -414,14 +415,12 @@ void CubicSDR::sdrEnumThreadNotify(SDREnumerator::SDREnumState state, std::strin
|
||||
devs = SDREnumerator::enumerate_devices("", true);
|
||||
devicesReady.store(true);
|
||||
}
|
||||
if (state == SDREnumerator::SDR_ENUM_FAILED) {
|
||||
devicesFailed.store(true);
|
||||
}
|
||||
//if (appframe) { appframe->SetStatusText(message); }
|
||||
notify_busy.unlock();
|
||||
|
||||
if (state == SDREnumerator::SDR_ENUM_FAILED) {
|
||||
wxMessageDialog *info;
|
||||
info = new wxMessageDialog(NULL, wxT("\nNo SoapySDR modules were found.\n\nCubicSDR requires at least one SoapySDR device support module to be installed.\n\nPlease visit https://github.com/cjcliffe/CubicSDR/wiki and in the build instructions for your platform read the 'Support Modules' section for more information."), wxT("\x28\u256F\xB0\u25A1\xB0\uFF09\u256F\uFE35\x20\u253B\u2501\u253B"), wxOK | wxICON_ERROR);
|
||||
info->ShowModal();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -693,6 +692,10 @@ bool CubicSDR::areDevicesEnumerating() {
|
||||
return !sdrEnum->isTerminated();
|
||||
}
|
||||
|
||||
bool CubicSDR::areModulesMissing() {
|
||||
return devicesFailed.load();
|
||||
}
|
||||
|
||||
std::string CubicSDR::getNotification() {
|
||||
std::string msg;
|
||||
notify_busy.lock();
|
||||
|
@ -129,6 +129,7 @@ public:
|
||||
|
||||
bool areDevicesReady();
|
||||
bool areDevicesEnumerating();
|
||||
bool areModulesMissing();
|
||||
std::string getNotification();
|
||||
|
||||
void addRemote(std::string remoteAddr);
|
||||
@ -193,6 +194,7 @@ private:
|
||||
|
||||
std::thread *t_SDR, *t_SDREnum, *t_PostSDR, *t_SpectrumVisual, *t_DemodVisual;
|
||||
std::atomic_bool devicesReady;
|
||||
std::atomic_bool devicesFailed;
|
||||
std::atomic_bool deviceSelectorOpen;
|
||||
std::atomic_bool sampleRateInitialized;
|
||||
std::atomic_bool useLocalMod;
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
SDRDevicesDialog::SDRDevicesDialog( wxWindow* parent ): devFrame( parent ) {
|
||||
refresh = true;
|
||||
failed = false;
|
||||
m_addRemoteButton->Disable();
|
||||
m_useSelectedButton->Disable();
|
||||
m_deviceTimer.Start(250);
|
||||
@ -229,6 +230,16 @@ void SDRDevicesDialog::OnTreeDoubleClick( wxMouseEvent& event ) {
|
||||
|
||||
void SDRDevicesDialog::OnDeviceTimer( wxTimerEvent& event ) {
|
||||
if (refresh) {
|
||||
if (wxGetApp().areModulesMissing()) {
|
||||
if (!failed) {
|
||||
wxMessageDialog *info;
|
||||
info = new wxMessageDialog(NULL, wxT("\nNo SoapySDR modules were found.\n\nCubicSDR requires at least one SoapySDR device support module to be installed.\n\nPlease visit https://github.com/cjcliffe/CubicSDR/wiki and in the build instructions for your platform read the 'Support Modules' section for more information."), wxT("\x28\u256F\xB0\u25A1\xB0\uFF09\u256F\uFE35\x20\u253B\u2501\u253B"), wxOK | wxICON_ERROR);
|
||||
info->ShowModal();
|
||||
failed = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (wxGetApp().areDevicesEnumerating() || !wxGetApp().areDevicesReady()) {
|
||||
std::string msg = wxGetApp().getNotification();
|
||||
devStatusBar->SetStatusText(msg);
|
||||
@ -237,7 +248,7 @@ void SDRDevicesDialog::OnDeviceTimer( wxTimerEvent& event ) {
|
||||
event.Skip();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
devTree->DeleteAllItems();
|
||||
|
||||
wxTreeItemId devRoot = devTree->AddRoot("Devices");
|
||||
|
@ -23,7 +23,7 @@ private:
|
||||
SDRDeviceInfo *getSelectedDevice(wxTreeItemId selId);
|
||||
wxPGProperty *addArgInfoProperty(wxPropertyGrid *pg, SoapySDR::ArgInfo arg);
|
||||
|
||||
bool refresh;
|
||||
bool refresh, failed;
|
||||
std::map<std::string, std::vector<SDRDeviceInfo *>* > devs;
|
||||
std::vector<SDRDeviceInfo *>::iterator devs_i;
|
||||
std::map<wxTreeItemId, SDRDeviceInfo *> devItems;
|
||||
|
Loading…
Reference in New Issue
Block a user