pop up a warning if we can't find libftd2xx

This commit is contained in:
Sean C. Rhea
2009-01-24 20:09:13 +00:00
parent a6f269363e
commit 9e4d237ce9
3 changed files with 10 additions and 7 deletions

View File

@@ -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");

View File

@@ -37,13 +37,10 @@ Device::listDevices(QString &err)
QVector<DevicePtr> result;
for (int i = 0; listFunctions && i < listFunctions->size(); ++i) {
QVector<DevicePtr> 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;
}

View File

@@ -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) {