]> sigrok.org Git - pulseview.git/blobdiff - pv/toolbars/mainbar.cpp
MainBar: fixup file extension filter in "Import File" dialog
[pulseview.git] / pv / toolbars / mainbar.cpp
index 272e844f981df35ba05be9f1a472322ec2ea99b3..1879693d57a31c01bc87458f556d67dd01db7506 100644 (file)
@@ -480,12 +480,6 @@ void MainBar::update_device_config_widgets()
        if (sr_dev->config_check(ConfigKey::LIMIT_SAMPLES, Capability::SET))
                sample_count_supported_ = true;
 
-       if (sr_dev->config_check(ConfigKey::LIMIT_FRAMES, Capability::SET)) {
-               sr_dev->config_set(ConfigKey::LIMIT_FRAMES,
-                       Glib::Variant<guint64>::create(1));
-                       on_config_changed();
-       }
-
        // Add notification of reconfigure events
        disconnect(this, SLOT(on_config_changed()));
        connect(&opts->binding(), SIGNAL(config_changed()),
@@ -674,16 +668,19 @@ void MainBar::import_file(shared_ptr<InputFormat> format)
 
        // Construct the filter
        const vector<string> exts = format->extensions();
-       const QString filter = exts.empty() ? "" :
-               tr("%1 files (*.%2)").arg(
-                       QString::fromStdString(format->description()),
-                       QString::fromStdString(join(exts, ", *.")));
+       const QString filter_exts = exts.empty() ? "" : QString::fromStdString("%1 (%2)").arg(
+               tr("%1 files").arg(QString::fromStdString(format->description())),
+               QString::fromStdString("*.%1").arg(QString::fromStdString(join(exts, " *."))));
+       const QString filter_all = QString::fromStdString("%1 (%2)").arg(
+               tr("All Files"), QString::fromStdString("*"));
+       const QString filter = QString::fromStdString("%1%2%3").arg(
+               exts.empty() ? "" : filter_exts,
+               exts.empty() ? "" : ";;",
+               filter_all);
 
        // Show the file dialog
        const QString file_name = QFileDialog::getOpenFileName(
-               this, tr("Import File"), dir, tr(
-                       "%1 files (*);;All Files (*)").arg(
-                       QString::fromStdString(format->description())));
+               this, tr("Import File"), dir, filter);
 
        if (file_name.isEmpty())
                return;