X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdevicemanager.cpp;h=58f507c92fae06c2cd2b84dfce474a5dfc5638de;hp=a51148b1d3ad2851a55888749312cb12b837e523;hb=33094993339188a3baef302fb09eff6bf6bb6779;hpb=aca9aa834c742ba70f49d1ac3eb2d1e02e759416 diff --git a/pv/devicemanager.cpp b/pv/devicemanager.cpp index a51148b1..58f507c9 100644 --- a/pv/devicemanager.cpp +++ b/pv/devicemanager.cpp @@ -22,12 +22,17 @@ #include #include +#include #include #include #include #include +#include +#include +#include + #include #include @@ -39,6 +44,7 @@ using std::placeholders::_1; using std::placeholders::_2; using std::shared_ptr; using std::string; +using std::unique_ptr; using Glib::VariantBase; @@ -51,8 +57,24 @@ namespace pv { DeviceManager::DeviceManager(shared_ptr context) : context_(context) { - for (auto entry : context->drivers()) + unique_ptr progress(new QProgressDialog("", + QObject::tr("Cancel"), 0, context->drivers().size())); + progress->setWindowModality(Qt::WindowModal); + progress->setMinimumDuration(1); // To show the dialog immediately + + int entry_num = 1; + + for (auto entry : context->drivers()) { + progress->setLabelText(QObject::tr("Scanning for %1...") + .arg(QString::fromStdString(entry.first))); + driver_scan(entry.second, map()); + + progress->setValue(entry_num++); + QApplication::processEvents(); + if (progress->wasCanceled()) + break; + } } const shared_ptr& DeviceManager::context() const