X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdevicemanager.cpp;h=58f507c92fae06c2cd2b84dfce474a5dfc5638de;hp=9e3944b5974e4ce5fa1dbd9c2d268c1ebb1e72bd;hb=669686c18ca6f1ee0697ae7804bfddf4fc6bd1e1;hpb=efdec55aec1a137460fa362a381ed1904182bfed diff --git a/pv/devicemanager.cpp b/pv/devicemanager.cpp index 9e3944b5..58f507c9 100644 --- a/pv/devicemanager.cpp +++ b/pv/devicemanager.cpp @@ -22,49 +22,62 @@ #include #include -#include +#include #include +#include #include -#include #include -#include +#include +#include +#include + #include #include -using boost::algorithm::join; - using std::bind; -using std::dynamic_pointer_cast; using std::list; using std::map; using std::placeholders::_1; using std::placeholders::_2; -using std::remove_if; -using std::runtime_error; using std::shared_ptr; using std::string; -using std::vector; +using std::unique_ptr; using Glib::VariantBase; using sigrok::ConfigKey; using sigrok::Context; using sigrok::Driver; -using sigrok::SessionDevice; 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 std::shared_ptr& DeviceManager::context() const +const shared_ptr& DeviceManager::context() const { return context_; }