1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

SerialDV: corrected cmake find module and improved main window error messages for SerialDV support

This commit is contained in:
f4exb 2019-01-14 23:41:24 +01:00
parent cdfc72a859
commit 69b8aaa482
3 changed files with 34 additions and 22 deletions

View File

@ -1,6 +1,6 @@
# Find serialDV
find_path(LIBSERIALDV_INCLUDE_DIR
find_path(LIBSERIALDV_INCLUDE_DIR
NAMES dvcontroller.h
PATHS ${SERIALDV_DIR}/include/serialdv
/usr/include/serialdv
@ -9,8 +9,8 @@ find_path(LIBSERIALDV_INCLUDE_DIR
set(LIBSERIAL_NAMES ${LIBSERIAL_NAMES} serialdv libserialdv)
find_library(LIBSERIALDV_LIBRARY
NAMES ${LIBSERIALDV_NAMES}
find_library(LIBSERIALDV_LIBRARY
NAMES serialdv
PATHS ${SERIALDV_DIR}/lib
/usr/lib
/usr/local/lib

View File

@ -255,8 +255,11 @@ if (LIBSERIALDV_FOUND)
dsp/dvserialworker.h
dsp/dvserialengine.h
)
message(STATUS "Will have SerialDV support")
add_definitions(-DDSD_USE_SERIALDV)
include_directories(${LIBSERIALDV_INCLUDE_DIR})
else(LIBSERIALDV_FOUND)
message(STATUS "No SerialDV support")
endif(LIBSERIALDV_FOUND)
if (BUILD_DEBIAN)

View File

@ -1449,29 +1449,38 @@ void MainWindow::on_action_DV_Serial_triggered(bool checked)
if (checked)
{
std::vector<std::string> deviceNames;
m_dspEngine->getDVSerialNames(deviceNames);
if (deviceNames.size() == 0)
if (m_dspEngine->hasDVSerialSupport())
{
QMessageBox::information(this, tr("Message"), tr("No DV serial devices found"));
std::vector<std::string> deviceNames;
m_dspEngine->getDVSerialNames(deviceNames);
if (deviceNames.size() == 0)
{
QMessageBox::information(this, tr("Message"), tr("No DV serial devices found"));
qDebug("MainWindow::on_action_DV_Serial_triggered: No DV serial devices found");
}
else
{
std::vector<std::string>::iterator it = deviceNames.begin();
std::string deviceNamesStr = "DV Serial devices found: ";
while (it != deviceNames.end())
{
if (it != deviceNames.begin()) {
deviceNamesStr += ",";
}
deviceNamesStr += *it;
++it;
}
QMessageBox::information(this, tr("Message"), tr(deviceNamesStr.c_str()));
}
}
else
{
std::vector<std::string>::iterator it = deviceNames.begin();
std::string deviceNamesStr = "DV Serial devices found: ";
while (it != deviceNames.end())
{
if (it != deviceNames.begin()) {
deviceNamesStr += ",";
}
deviceNamesStr += *it;
++it;
}
QMessageBox::information(this, tr("Message"), tr(deviceNamesStr.c_str()));
QMessageBox::information(this, tr("Message"), tr("No DV serial support"));
qDebug("MainWindow::on_action_DV_Serial_triggered: No DV serial support");
}
}
}