From 5353db25dfcdaeb0c844c48dedc110eba8b9a7fb Mon Sep 17 00:00:00 2001 From: "Sean C. Rhea" Date: Sat, 24 Jan 2009 20:09:13 +0000 Subject: [PATCH] pop up a warning if we can't find libftd2xx --- src/D2XX.cpp | 2 +- src/Device.cpp | 9 +++------ src/DownloadRideDialog.cpp | 6 ++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/D2XX.cpp b/src/D2XX.cpp index 3aae110b7..7a9c2622d 100644 --- a/src/D2XX.cpp +++ b/src/D2XX.cpp @@ -60,7 +60,7 @@ struct D2XXWrapper { const char *libname = "libftd2xx.dylib"; handle = dlopen(libname, RTLD_NOW); if (!handle) { - error = QString("couldn't load library ") + libname; + error = QString("Couldn't load library ") + libname + "."; return false; } LOAD_SYM(FP_OpenEx, open_ex, "FT_OpenEx"); diff --git a/src/Device.cpp b/src/Device.cpp index f9d05ddd3..a85cf21f9 100644 --- a/src/Device.cpp +++ b/src/Device.cpp @@ -37,13 +37,10 @@ Device::listDevices(QString &err) QVector result; for (int i = 0; listFunctions && i < listFunctions->size(); ++i) { QVector tmp = (*listFunctions)[i](err); - if (err == "") { - for (int j = 0; j < tmp.size(); ++j) - result.append(tmp[j]); - } - else { + if (err == "") + result << tmp; + else err += "\n"; - } } return result; } diff --git a/src/DownloadRideDialog.cpp b/src/DownloadRideDialog.cpp index f35bb6bfd..2aceb4417 100644 --- a/src/DownloadRideDialog.cpp +++ b/src/DownloadRideDialog.cpp @@ -101,6 +101,12 @@ DownloadRideDialog::scanDevices() listWidget->clear(); QString err; devList = Device::listDevices(err); + if (err != "") { + QString msg = "Warning:\n\n" + err + "You may need to (re)install " + "the FTDI drivers before downloading."; + QMessageBox::warning(0, "Error Loading Device Drivers", msg, + QMessageBox::Ok, QMessageBox::NoButton); + } for (int i = 0; i < devList.size(); ++i) new QListWidgetItem(devList[i]->name(), listWidget); if (listWidget->count() > 0) {