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

pull/278/head
f4exb 2019-01-14 23:41:24 +01:00
rodzic cdfc72a859
commit 69b8aaa482
3 zmienionych plików z 34 dodań i 22 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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