Qt: Always show the Plugins tab in the about box.
authorGerald Combs <gerald@wireshark.org>
Wed, 31 Jan 2018 21:45:22 +0000 (13:45 -0800)
committerGerald Combs <gerald@wireshark.org>
Thu, 1 Feb 2018 16:55:03 +0000 (16:55 +0000)
Always show the Plugins tab. We probably have plugins via extcap even if
Lua and dissector plugins are disabled. Tell the user if we don't find
any plugins.

Change-Id: I7ab1fb302298232a847193754b53688620855959
Reviewed-on: https://code.wireshark.org/review/25543
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
ui/qt/about_dialog.cpp
ui/qt/about_dialog.ui

index ec3ffc65c3e8b7609979277face936b65fd27398..9e9cae5ef1e017f2d7ccc60996479e32ce89d1d3 100644 (file)
@@ -111,6 +111,7 @@ QStringList AuthorListModel::headerColumns() const
     return QStringList() << tr("Name") << tr("Email");
 }
 
+#if defined(HAVE_PLUGINS) || defined(HAVE_LUA)
 static void plugins_add_description(const char *name, const char *version,
                                     const char *types, const char *filename,
                                     void *user_data)
@@ -119,6 +120,7 @@ static void plugins_add_description(const char *name, const char *version,
     QStringList plugin_row = QStringList() << name << version << types << filename;
     *plugin_data << plugin_row;
 }
+#endif
 
 PluginListModel::PluginListModel(QObject * parent) : AStringListListModel(parent)
 {
@@ -349,8 +351,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
 
 
     /* Plugins */
-#if defined(HAVE_PLUGINS) || defined(HAVE_LUA)
-
+    ui->label_no_plugins->hide();
     PluginListModel * pluginModel = new PluginListModel(this);
     AStringListListSortFilterProxyModel * pluginFilterModel = new AStringListListSortFilterProxyModel(this);
     pluginFilterModel->setSourceModel(pluginModel);
@@ -366,10 +367,14 @@ AboutDialog::AboutDialog(QWidget *parent) :
     connect(ui->tblPlugins, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(handleCopyMenu(QPoint)));
     connect(ui->searchPlugins, SIGNAL(textChanged(QString)), pluginFilterModel, SLOT(setFilter(QString)));
     connect(ui->cmbType, SIGNAL(currentIndexChanged(QString)), pluginTypeModel, SLOT(setFilter(QString)));
-
-#else
-    ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tab_plugins));
-#endif
+    if (ui->tblPlugins->model()->rowCount() < 1) {
+        foreach (QWidget *w, ui->tab_plugins->findChildren<QWidget *>()) {
+            w->hide();
+        }
+        ui->label_no_plugins->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
+        ui->label_no_plugins->setEnabled(false);
+        ui->label_no_plugins->show();
+    }
 
     /* Shortcuts */
     ShortcutListModel * shortcutModel = new ShortcutListModel(this);
index 527012415ff738d1758fe99f3c45061cbe5ec9af..cfc48b81d9442e1f6b6ba9ee71a813276967f5c9 100644 (file)
        <string>Plugins</string>
       </attribute>
       <layout class="QVBoxLayout" name="verticalLayout_4">
+       <item>
+        <widget class="QLabel" name="label_no_plugins">
+         <property name="text">
+          <string>No plugins found.</string>
+         </property>
+        </widget>
+       </item>
        <item>
         <layout class="QHBoxLayout" name="horizontalLayout_3">
          <item>