aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2014-08-14 13:20:09 -0700
committerGerald Combs <gerald@wireshark.org>2014-08-29 00:24:02 +0000
commita71f6807b82bb4a4149141af7eff79738304ee22 (patch)
tree8dbd4bfa0cb7774345f4b6e5d54e01626b692bf7 /ui
parentb65d0e07193fe15df08739f89d95c29edb6aafed (diff)
Qt: Rework the "Manage Interfaces" dialog.
Convert QTableWidget to QTreeWidget. It looks like the GTK+ version has a separate set of apply/save buttons for each tab which *only* operates on that tab. This can result unexpected behavior which throws away changes if the user updates more than one tab. Use a single "OK" button that applies all of our changes instead. Reorder the tabs. Put Local Interfaces first and select it by default. Always show Remote Interfaces. Disable it on platforms that don't have PCAP_REMOTE. Automatically start editing when we add a new pipe. Don't immediately update pipe interface settings. Wait until we hit "OK" instead. Rename NewFileDelegate to PathChooserDelegate. Note that we might want to move it use it elsewhere in the application. Try switching the user-facing terminology from "Hide" to the more positive "Show". Tell the user that we don't save pipe or remote interface settings. Add a help URL for the "Manage Interfaces" dialog box. Use the GLib and Qt string functions and classes to split and join comma-separated preferences. This makes sure capture_dev_user_descr_find doesn't skip over the first interface. It also keeps the Qt code from adding a leading comma to our capture preferences. Add a note about strings to README.qt. Summary: Use QStrings. For another day: - If we *do* save remote settings we need to store credentials securely, e.g. with CryptProtectData. - Get rid of the remote settings dialogs. Their controls should fit in the remote settings tab. - Add an extcap tab. - We need getter/setter functions for global_capture_opts.all_ifaces. We iterate over it *way* too much. Change-Id: Ib7b61972f3ece4325e0230f725e7f2678acbb24b Reviewed-on: https://code.wireshark.org/review/3873 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/capture_ui_utils.c70
-rw-r--r--ui/help_url.c3
-rw-r--r--ui/help_url.h1
-rw-r--r--ui/qt/capture_interfaces_dialog.cpp84
-rw-r--r--ui/qt/capture_interfaces_dialog.ui4
-rw-r--r--ui/qt/manage_interfaces_dialog.cpp580
-rw-r--r--ui/qt/manage_interfaces_dialog.h74
-rw-r--r--ui/qt/manage_interfaces_dialog.ui738
-rw-r--r--ui/qt/packet_list.h1
-rw-r--r--ui/qt/remote_capture_dialog.cpp2
-rw-r--r--ui/qt/remote_settings_dialog.cpp2
11 files changed, 743 insertions, 816 deletions
diff --git a/ui/capture_ui_utils.c b/ui/capture_ui_utils.c
index 23de71f716..6f1fae83fb 100644
--- a/ui/capture_ui_utils.c
+++ b/ui/capture_ui_utils.c
@@ -44,63 +44,37 @@
char *
capture_dev_user_descr_find(const gchar *if_name)
{
- char *p, *str;
- char *p2 = NULL;
- char *descr = NULL;
- int lp = 0;
- int ct = 0;
-
- if ((prefs.capture_devices_descr == NULL) ||
- (*prefs.capture_devices_descr == '\0')) {
- /* There are no descriptions. */
+ gchar **if_tokens;
+ gchar *descr = NULL;
+ int i;
+
+ if (if_name == NULL || strlen(if_name) < 1) {
return NULL;
}
- /* There might be names like 'lo' and 'nflog' in Ubuntu which can lead to wrong results.
- Therefore, the search must be more exact. */
- str = g_strdup_printf(",%s(", if_name);
- if ((p = strstr(prefs.capture_devices_descr, str)) == NULL) {
- /* There are, but there isn't one for this interface. */
+ if (prefs.capture_devices_descr == NULL ||
+ strlen(prefs.capture_devices_descr) < 1) {
+ /* There are no descriptions. */
return NULL;
}
- p++;
- while (*p != '\0') {
- /* error: ran into next interface description */
- if (*p == ',')
- return NULL;
- /* found left parenthesis, start of description */
- else if (*p == '(') {
- ct = 0;
- lp++;
- /* skip over left parenthesis */
- p++;
- /* save pointer to beginning of description */
- p2 = p;
- continue;
- }
- else if (*p == ')') {
- /* end of description */
- break;
- }
- else {
- p++;
- ct++;
+
+ if_tokens = g_strsplit(prefs.capture_devices_descr, ",", -1);
+ for (i = 0; if_tokens[i] != NULL; i++) {
+ gchar **descr_tokens;
+ descr_tokens = g_strsplit_set(if_tokens[i], "()", -1);
+ if (g_strv_length(descr_tokens) == 3) { /* interface + description + empty */
+ if (strcmp(descr_tokens[0], if_name) == 0 && strlen(descr_tokens[1]) > 0) {
+ descr = g_strdup(descr_tokens[1]);
+ g_strfreev(descr_tokens);
+ break;
+ }
}
+ g_strfreev(descr_tokens);
}
+ g_strfreev(if_tokens);
- g_free(str);
- if ((lp == 1) && (ct > 0) && (p2 != NULL)) {
- /* Allocate enough space to return the string,
- which runs from p2 to p, plus a terminating
- '\0'. */
- descr = (char *)g_malloc(p - p2 + 1);
- memcpy(descr, p2, p - p2);
- descr[p - p2] = '\0';
- return descr;
- }
- else
- return NULL;
+ return descr;
}
gint
diff --git a/ui/help_url.c b/ui/help_url.c
index f82860c7b5..024481cbf7 100644
--- a/ui/help_url.c
+++ b/ui/help_url.c
@@ -242,6 +242,9 @@ topic_action_url(topic_action_e action)
case(HELP_CAPTURE_INFO_DIALOG):
url = user_guide_url("ChCapRunningSection.html");
break;
+ case(HELP_CAPTURE_MANAGE_INTERFACES_DIALOG):
+ url = user_guide_url("ChCapManageInterfacesSection.html");
+ break;
case(HELP_ENABLED_PROTOCOLS_DIALOG):
url = user_guide_url("ChCustProtocolDissectionSection.html");
break;
diff --git a/ui/help_url.h b/ui/help_url.h
index ab11c4221e..ecaa0b4ee3 100644
--- a/ui/help_url.h
+++ b/ui/help_url.h
@@ -77,6 +77,7 @@ typedef enum {
HELP_FIREWALL_DIALOG,
HELP_GOTO_DIALOG,
HELP_CAPTURE_INTERFACES_DIALOG,
+ HELP_CAPTURE_MANAGE_INTERFACES_DIALOG,
HELP_ENABLED_PROTOCOLS_DIALOG,
HELP_DECODE_AS_DIALOG,
HELP_DECODE_AS_SHOW_DIALOG,
diff --git a/ui/qt/capture_interfaces_dialog.cpp b/ui/qt/capture_interfaces_dialog.cpp
index 837ddad928..3da8e79a05 100644
--- a/ui/qt/capture_interfaces_dialog.cpp
+++ b/ui/qt/capture_interfaces_dialog.cpp
@@ -54,6 +54,7 @@
#include <epan/addr_resolv.h>
#include <wsutil/filesystem.h>
+#include "qt_ui_utils.h"
#include "sparkline_delegate.h"
// To do:
@@ -128,6 +129,9 @@ CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) :
#endif
ui->interfaceTree->setItemDelegateForColumn(col_filter_, &interface_item_delegate_);
+ interface_item_delegate_.setTree(ui->interfaceTree);
+ ui->interfaceTree->setColumnWidth(col_link_, 100);
+
connect(ui->interfaceTree,SIGNAL(itemClicked(QTreeWidgetItem*,int)),this,SLOT(interfaceClicked(QTreeWidgetItem*,int)));
connect(ui->interfaceTree, SIGNAL(itemSelectionChanged()), this, SLOT(interfaceSelected()));
connect(ui->allFilterComboBox, SIGNAL(captureFilterSyntaxChanged(bool)), this, SLOT(allFilterChanged()));
@@ -469,6 +473,7 @@ void CaptureInterfacesDialog::updateInterfaces()
addr_ti->setText(0, addr_str);
addr_ti->setFlags(addr_ti->flags() ^ Qt::ItemIsSelectable);
addr_ti->setFirstColumnSpanned(true);
+ addr_ti->setToolTip(col_interface_, QString("<span>%1</span>").arg(addr_str));
ti->setToolTip(col_interface_, QString("<span>%1</span>").arg(addr_str));
} else {
ti->setToolTip(col_interface_, tr("no addresses"));
@@ -513,8 +518,6 @@ void CaptureInterfacesDialog::updateInterfaces()
}
#endif
- interface_item_delegate_.setTree(ui->interfaceTree);
- ui->interfaceTree->setColumnWidth(col_link_, 100);
ti->setText(col_link_, linkname);
ti->setText(col_pmode_, device.pmode ? tr("enabled") : tr("disabled"));
@@ -607,7 +610,6 @@ void CaptureInterfacesDialog::on_compileBPF_clicked()
bool CaptureInterfacesDialog::saveOptionsToPreferences()
{
interface_t device;
- gchar *new_prefs, *tmp_prefs;
if (ui->rbPcapng->isChecked()) {
global_capture_opts.use_pcapng = true;
@@ -621,10 +623,10 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences()
if (filename.length() > 0) {
/* User specified a file to which the capture should be written. */
global_capture_opts.saving_to_file = true;
- global_capture_opts.save_file = g_strdup(filename.toUtf8().constData());
- global_capture_opts.orig_save_file = g_strdup(filename.toUtf8().constData());
+ global_capture_opts.save_file = qstring_strdup(filename);
+ global_capture_opts.orig_save_file = qstring_strdup(filename);
/* Save the directory name for future file dialogs. */
- set_last_open_dir(get_dirname(g_strdup(filename.toUtf8().constData())));
+ set_last_open_dir(get_dirname(filename.toUtf8().data()));
} else {
/* User didn't specify a file; save to a temporary file. */
global_capture_opts.save_file = NULL;
@@ -740,103 +742,100 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences()
word boundaries. As 'lo' is part of 'nflog' an exact match is necessary. */
switch (col) {
case col_link_:
- new_prefs = (gchar *)g_malloc0(MAX_VAL_LEN);
+ {
+ QStringList link_list;
for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]);
if (device.active_dlt == -1) {
continue;
}
- g_strlcat(new_prefs, ",", MAX_VAL_LEN);
- tmp_prefs = g_strdup_printf("%s(%d)", device.name, device.active_dlt);
- g_strlcat(new_prefs, tmp_prefs, MAX_VAL_LEN);
- g_free(tmp_prefs);
+ link_list << QString("%1(%2)").arg(device.name).arg(device.active_dlt);
}
g_free(prefs.capture_devices_linktypes);
- prefs.capture_devices_linktypes = new_prefs;
+ prefs.capture_devices_linktypes = qstring_strdup(link_list.join(","));
break;
+ }
#ifdef SHOW_BUFFER_COLUMN
case col_buffer_:
- new_prefs = (gchar *)g_malloc0(MAX_VAL_LEN);
+ {
+ QStringList buffer_size_list;
for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]);
if (device.buffer == -1) {
continue;
}
- g_strlcat(new_prefs, ",", MAX_VAL_LEN);
- tmp_prefs = g_strdup_printf("%s(%d)", device.name, device.buffer);
- g_strlcat(new_prefs, tmp_prefs, MAX_VAL_LEN);
- g_free(tmp_prefs);
+ buffer_size_list << QString("%1(%2)").arg(device.name).arg(device.buffer);
}
g_free(prefs.capture_devices_buffersize);
- prefs.capture_devices_buffersize = new_prefs;
+ prefs.capture_devices_buffersize = qstring_strdup(buffer_size_list.join(","));
break;
+ }
#endif // HAVE_BUFFER_SETTING
case col_snaplen_:
- new_prefs = (gchar *)g_malloc0(MAX_VAL_LEN);
+ {
+ QStringList snaplen_list;
for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]);
- g_strlcat(new_prefs, ",", MAX_VAL_LEN);
- tmp_prefs = g_strdup_printf("%s:%d(%d)", device.name, device.has_snaplen, (device.has_snaplen?device.snaplen:WTAP_MAX_PACKET_SIZE));
- g_strlcat(new_prefs, tmp_prefs, MAX_VAL_LEN);
- g_free(tmp_prefs);
+ snaplen_list << QString("%1:%2(%3)")
+ .arg(device.name)
+ .arg(device.has_snaplen)
+ .arg(device.has_snaplen ? device.snaplen : WTAP_MAX_PACKET_SIZE);
}
g_free(prefs.capture_devices_snaplen);
- prefs.capture_devices_snaplen = new_prefs;
+ prefs.capture_devices_snaplen = qstring_strdup(snaplen_list.join(","));
break;
+ }
case col_pmode_:
- new_prefs = (gchar *)g_malloc0(MAX_VAL_LEN);
+ {
+ QStringList pmode_list;
for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]);
if (device.pmode == -1) {
continue;
}
- g_strlcat(new_prefs, ",", MAX_VAL_LEN);
- tmp_prefs = g_strdup_printf("%s(%d)", device.name, device.pmode);
- g_strlcat(new_prefs, tmp_prefs, MAX_VAL_LEN);
- g_free(tmp_prefs);
+ pmode_list << QString("%1(%2)").arg(device.name).arg(device.pmode);
}
g_free(prefs.capture_devices_pmode);
- prefs.capture_devices_pmode = new_prefs;
+ prefs.capture_devices_pmode = qstring_strdup(pmode_list.join(","));
break;
+ }
#ifdef SHOW_MONITOR_COLUMN
case col_monitor_:
- new_prefs = (gchar *)g_malloc0(MAX_VAL_LEN);
+ {
+ QStringList monitor_list;
for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]);
if (!device.monitor_mode_supported || (device.monitor_mode_supported && !device.monitor_mode_enabled)) {
continue;
}
- g_strlcat(new_prefs, ",", MAX_VAL_LEN);
- tmp_prefs = g_strdup_printf("%s", device.name);
- g_strlcat(new_prefs, tmp_prefs, MAX_VAL_LEN);
- g_free(tmp_prefs);
+ monitor_list << device.name;
}
g_free(prefs.capture_devices_monitor_mode);
- prefs.capture_devices_monitor_mode = new_prefs;
+ prefs.capture_devices_monitor_mode = qstring_strdup(monitor_list.join(","));
break;
+ }
#endif // HAVE_MONITOR_SETTING
case col_filter_:
- new_prefs = (gchar *)g_malloc0(MAX_VAL_LEN);
+ {
+ QStringList filter_list;
for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]);
if (!device.cfilter) {
continue;
}
- g_strlcat(new_prefs, ",", MAX_VAL_LEN);
- tmp_prefs = g_strdup_printf("%s(%s)", device.name, device.cfilter);
- g_strlcat(new_prefs, tmp_prefs, MAX_VAL_LEN);
- g_free(tmp_prefs);
+ filter_list << QString("%1(%2)").arg(device.name).arg(device.cfilter);
}
g_free(prefs.capture_devices_filter);
- prefs.capture_devices_filter = new_prefs;
+ prefs.capture_devices_filter = qstring_strdup(filter_list.join(","));
break;
}
+ }
}
if (!prefs.gui_use_pref_save) {
prefs_main_write();
@@ -844,7 +843,6 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences()
return true;
}
-
void CaptureInterfacesDialog::on_manage_clicked()
{
if (saveOptionsToPreferences()) {
diff --git a/ui/qt/capture_interfaces_dialog.ui b/ui/qt/capture_interfaces_dialog.ui
index 51523230c9..84e33d3ea7 100644
--- a/ui/qt/capture_interfaces_dialog.ui
+++ b/ui/qt/capture_interfaces_dialog.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>750</width>
- <height>350</height>
+ <height>435</height>
</rect>
</property>
<property name="windowTitle">
@@ -114,7 +114,7 @@
<bool>true</bool>
</property>
<property name="toolTip">
- <string>Add a </string>
+ <string>Show and hide interfaces, add comments, and manage pipes and remote interfaces.</string>
</property>
<property name="text">
<string>Manage Interfaces...</string>
diff --git a/ui/qt/manage_interfaces_dialog.cpp b/ui/qt/manage_interfaces_dialog.cpp
index 5d351c1317..118f2fdf6d 100644
--- a/ui/qt/manage_interfaces_dialog.cpp
+++ b/ui/qt/manage_interfaces_dialog.cpp
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "config.h"
#include <glib.h>
#include "manage_interfaces_dialog.h"
#include "ui_manage_interfaces_dialog.h"
@@ -37,16 +36,50 @@
#include "ui/preference_utils.h"
#include "ui/ui_util.h"
+#include "qt_ui_utils.h"
+
+#include "wireshark_application.h"
+
+#include <QDebug>
+
#ifdef HAVE_LIBPCAP
+#include <QCheckBox>
#include <QFileDialog>
#include <QHBoxLayout>
-#include <QMessageBox>
-#include <QCheckBox>
+#include <QTreeWidgetItemIterator>
+
+// To do:
+// - Check the validity of pipes and remote interfaces and provide feedback
+// via hintLabel.
+// - We might want to move PathChooserDelegate to its own module and use it in
+// other parts of the application such as the general preferences and UATs.
+// Qt Creator has a much more elaborate version from which we might want
+// to draw inspiration.
enum {
col_p_pipe_
};
+enum
+{
+ col_l_show_,
+ col_l_friendly_name_,
+ col_l_local_name_,
+ col_l_comment_,
+};
+
+enum
+{
+ col_r_show_,
+ col_r_host_dev_,
+};
+
+enum {
+ tab_local_,
+ tab_pipe_,
+ tab_remote_
+};
+
ManageInterfacesDialog::ManageInterfacesDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ManageInterfacesDialog)
@@ -54,29 +87,47 @@ ManageInterfacesDialog::ManageInterfacesDialog(QWidget *parent) :
ui->setupUi(this);
#ifdef Q_OS_MAC
- ui->addButton->setAttribute(Qt::WA_MacSmallSize, true);
- ui->delButton->setAttribute(Qt::WA_MacSmallSize, true);
+ ui->addPipe->setAttribute(Qt::WA_MacSmallSize, true);
+ ui->addPipe->setAttribute(Qt::WA_MacSmallSize, true);
+ ui->addRemote->setAttribute(Qt::WA_MacSmallSize, true);
+ ui->delRemote->setAttribute(Qt::WA_MacSmallSize, true);
#endif
- ui->pipeList->setItemDelegateForColumn(0, &new_pipe_item_delegate_);
- new_pipe_item_delegate_.setTable(ui->pipeList);
- showPipes();
- connect(this, SIGNAL(ifsChanged()), parent, SIGNAL(ifsChanged()));
-#ifdef HAVE_PCAP_REMOTE
- connect(this, SIGNAL(remoteAdded(GList*, remote_options*)), this, SLOT(addRemoteInterfaces(GList*, remote_options*)));
- connect(this, SIGNAL(remoteSettingsChanged(interface_t *)), this, SLOT(setRemoteSettings(interface_t *)));
+
+ int one_em = fontMetrics().height();
+
+ ui->localList->setColumnWidth(col_l_show_, one_em * 3);
+#ifndef Q_OS_WIN
+ ui->localList->setColumnHidden(col_l_friendly_name_, true);
#endif
+
+ ui->pipeList->setItemDelegateForColumn(col_p_pipe_, &new_pipe_item_delegate_);
+ new_pipe_item_delegate_.setTree(ui->pipeList);
+
+ showPipes();
showLocalInterfaces();
-#if !defined(HAVE_PCAP_REMOTE)
- ui->tabWidget->removeTab(2);
-#else
- ui->remoteList->setHeaderLabels(QStringList() << "Host" << "Hide" << "Name");
- ui->remoteList->header()->setDefaultAlignment(Qt::AlignCenter);
- ui->remoteList->setColumnWidth(HIDDEN, 50);
+#if defined(HAVE_PCAP_REMOTE)
+ // The default indentation (20) means our checkboxes are shifted too far on Windows.
+ // Assume that our disclosure and checkbox controls are square, or at least fit within an em.
+ ui->remoteList->setIndentation(one_em);
+ ui->remoteList->setColumnWidth(col_r_show_, one_em * 4);
ui->remoteSettings->setEnabled(false);
showRemoteInterfaces();
+#else
+ ui->remoteTab->setEnabled(false);
+#endif
+
+ connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateWidgets()));
+ connect(this, SIGNAL(ifsChanged()), parent, SIGNAL(ifsChanged()));
+
+#ifdef HAVE_PCAP_REMOTE
+ connect(this, SIGNAL(remoteAdded(GList*, remote_options*)), this, SLOT(addRemoteInterfaces(GList*, remote_options*)));
+ connect(this, SIGNAL(remoteSettingsChanged(interface_t *)), this, SLOT(setRemoteSettings(interface_t *)));
connect(ui->remoteList, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(remoteSelectionChanged(QTreeWidgetItem*, int)));
#endif
+
+ ui->tabWidget->setCurrentIndex(tab_local_);
+ updateWidgets();
}
ManageInterfacesDialog::~ManageInterfacesDialog()
@@ -84,10 +135,55 @@ ManageInterfacesDialog::~ManageInterfacesDialog()
delete ui;
}
+void ManageInterfacesDialog::updateWidgets()
+{
+ QString hint;
+
+ if (ui->pipeList->selectedItems().length() > 0) {
+ ui->delPipe->setEnabled(true);
+ } else {
+ ui->delPipe->setEnabled(false);
+ }
+
+#ifdef HAVE_PCAP_REMOTE
+ bool enable_del_remote = false;
+ bool enable_remote_settings = false;
+ QTreeWidgetItem *item = ui->remoteList->currentItem();
+
+ if (item) {
+ if (item->childCount() < 1) { // Leaf
+ enable_remote_settings = true;
+ } else {
+ enable_del_remote = true;
+ }
+ }
+ ui->delRemote->setEnabled(enable_del_remote);
+ ui->remoteSettings->setEnabled(enable_remote_settings);
+#endif
+
+ switch (ui->tabWidget->currentIndex()) {
+ case tab_pipe_:
+ hint = tr("This version of Wireshark does not save pipe settings.");
+ break;
+ case tab_remote_:
+#ifdef HAVE_PCAP_REMOTE
+ hint = tr("This version of Wireshark does not save remote settings.");
+#else
+ hint = tr("This version of Wireshark does not support remote interfaces.");
+#endif
+ break;
+ default:
+ break;
+ }
+
+ hint.prepend("<small><i>");
+ hint.append("</i></small>");
+ ui->hintLabel->setText(hint);
+}
void ManageInterfacesDialog::showPipes()
{
- ui->pipeList->setRowCount(0);
+ ui->pipeList->clear();
if (global_capture_opts.all_ifaces->len > 0) {
interface_t device;
@@ -99,41 +195,69 @@ void ManageInterfacesDialog::showPipes()
if (device.hidden || device.type != IF_PIPE) {
continue;
}
- ui->pipeList->setRowCount(ui->pipeList->rowCount()+1);
- QString output = QString(device.display_name);
- ui->pipeList->setItem(ui->pipeList->rowCount()-1, col_p_pipe_, new QTableWidgetItem(output));
+ QTreeWidgetItem *item = new QTreeWidgetItem(ui->pipeList);
+ item->setFlags(item->flags() | Qt::ItemIsEditable);
+ item->setText(col_p_pipe_, device.display_name);
}
}
}
-void ManageInterfacesDialog::on_addButton_clicked()
+void ManageInterfacesDialog::on_buttonBox_accepted()
{
- ui->pipeList->setRowCount(ui->pipeList->rowCount() + 1);
- QTableWidgetItem *widget = new QTableWidgetItem(QString(tr("New Pipe")));
- ui->pipeList->setItem(ui->pipeList->rowCount() - 1 , 0, widget);
+ pipeAccepted();
+ localAccepted();
+#ifdef HAVE_PCAP_REMOTE
+ remoteAccepted();
+#endif
+ prefs_main_write();
+ emit ifsChanged();
}
+const QString new_pipe_default_ = QObject::tr("New Pipe");
+void ManageInterfacesDialog::on_addPipe_clicked()
+{
+ QTreeWidgetItem *item = new QTreeWidgetItem(ui->pipeList);
+ item->setText(col_p_pipe_, new_pipe_default_);
+ item->setFlags(item->flags() | Qt::ItemIsEditable);
+ ui->pipeList->setCurrentItem(item);
+ ui->pipeList->editItem(item, col_p_pipe_);
+}
-void ManageInterfacesDialog::on_buttonBox_accepted()
+void ManageInterfacesDialog::pipeAccepted()
{
interface_t device;
- gchar *pipe_name;
- for (int row = 0; row < ui->pipeList->rowCount(); row++) {
- pipe_name = g_strdup(ui->pipeList->item(row,0)->text().toUtf8().constData());
- if (!strcmp(pipe_name, "New pipe") || !strcmp(pipe_name, "")) {
- g_free(pipe_name);
- return;
+ // First clear the current pipes
+ for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
+ device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
+ /* Continue if capture device is hidden or not a pipe */
+ if (device.hidden || device.type != IF_PIPE) {
+ continue;
+ }
+ global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
+ }
+
+ // Next rebuild a fresh list
+ QTreeWidgetItemIterator it(ui->pipeList);
+ while (*it) {
+ QString pipe_name = (*it)->text(col_p_pipe_);
+ if (pipe_name.isEmpty() || pipe_name == new_pipe_default_) {
+ ++it;
+ continue;
}
+
for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
- device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
- if (strcmp(pipe_name, device.name) == 0) {
- g_free(pipe_name);
- return;
- }
+ // Instead of just deleting the device we might want to add a hint label
+ // and let the user know what's going to happen.
+ device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
+ if (pipe_name.compare(device.name) == 0) { // Duplicate
+ ++it;
+ continue;
+ }
}
- device.name = g_strdup(pipe_name);
- device.display_name = g_strdup_printf("%s", device.name);
+
+ device.name = qstring_strdup(pipe_name);
+ device.display_name = g_strdup(device.name);
device.hidden = FALSE;
device.selected = TRUE;
device.type = IF_PIPE;
@@ -141,106 +265,74 @@ void ManageInterfacesDialog::on_buttonBox_accepted()
device.has_snaplen = global_capture_opts.default_options.has_snaplen;
device.snaplen = global_capture_opts.default_options.snaplen;
device.cfilter = g_strdup(global_capture_opts.default_options.cfilter);
- device.addresses = g_strdup("");
+ device.addresses = NULL;
device.no_addresses = 0;
device.last_packets = 0;
device.links = NULL;
- #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
device.buffer = DEFAULT_CAPTURE_BUFFER_SIZE;
- #endif
+#endif
device.active_dlt = -1;
device.locked = FALSE;
- device.if_info.name = g_strdup(pipe_name);
+ device.if_info.name = g_strdup(device.name);
device.if_info.friendly_name = NULL;
device.if_info.vendor_description = NULL;
device.if_info.addrs = NULL;
device.if_info.loopback = FALSE;
device.if_info.type = IF_PIPE;
- #if defined(HAVE_PCAP_CREATE)
+#if defined(HAVE_PCAP_CREATE)
device.monitor_mode_enabled = FALSE;
device.monitor_mode_supported = FALSE;
- #endif
+#endif
global_capture_opts.num_selected++;
g_array_append_val(global_capture_opts.all_ifaces, device);
-
- g_free(pipe_name);
+ ++it;
}
- emit ifsChanged();
}
+void ManageInterfacesDialog::on_delPipe_clicked()
+{
+ // We're just managing a list of strings at this point.
+ delete ui->pipeList->currentItem();
+}
-
-void ManageInterfacesDialog::on_delButton_clicked()
+void ManageInterfacesDialog::on_pipeList_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
{
- interface_t device;
- bool found = false;
- QList<QTableWidgetItem*> selected = ui->pipeList->selectedItems();
- if (selected.length() == 0) {
- QMessageBox::warning(this, tr("Error"),
- tr("No interface selected."));
- return;
- }
- QString pipename = selected[0]->text();
- for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
- device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
- /* Continue if capture device is hidden or not a pipe*/
- if (device.hidden || device.type != IF_PIPE) {
- continue;
- }
- if (pipename.compare(device.name)) {
- continue;
- }
- global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
- ui->pipeList->removeRow(selected[0]->row());
- found = true;
- break;
- }
- if (found)
- emit ifsChanged();
- else /* pipe has not been saved yet */
- ui->pipeList->removeRow(selected[0]->row());
+ Q_UNUSED(current)
+ Q_UNUSED(previous)
+ updateWidgets();
}
void ManageInterfacesDialog::showLocalInterfaces()
{
guint i;
interface_t device;
- QString output;
- Qt::ItemFlags eFlags;
gchar *pr_descr = g_strdup("");
char *comment = NULL;
- ui->localList->setRowCount(0);
+ ui->localList->clear();
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
if (device.local && device.type != IF_PIPE && device.type != IF_STDIN) {
- ui->localList->setRowCount(ui->localList->rowCount()+1);
- QTableWidgetItem *item = new QTableWidgetItem("");
- item->setCheckState(device.hidden?Qt::Checked:Qt::Unchecked);
- ui->localList->setItem(ui->localList->rowCount()-1, HIDE, item);
- ui->localList->setColumnWidth(HIDE, 40);
+ QTreeWidgetItem *item = new QTreeWidgetItem(ui->localList);
+ item->setFlags(item->flags() | Qt::ItemIsEditable);
+ if (prefs.capture_device && strstr(prefs.capture_device, device.name)) {
+ // Force the default device to be checked.
+ item->setFlags(item->flags() ^ Qt::ItemIsUserCheckable);
+ item->setCheckState(col_l_show_, Qt::Checked);
+ } else {
+ item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
+ item->setCheckState(col_l_show_, device.hidden ? Qt::Unchecked : Qt::Checked);
+ }
#ifdef _WIN32
- output = QString(device.friendly_name);
- ui->localList->setItem(ui->localList->rowCount()-1, FRIENDLY, new QTableWidgetItem(output));
- eFlags = ui->localList->item(ui->localList->rowCount()-1, FRIENDLY)->flags();
- eFlags &= Qt::NoItemFlags;
- eFlags |= Qt::ItemIsSelectable | Qt::ItemIsEnabled;
- ui->localList->item(ui->localList->rowCount()-1, FRIENDLY)->setFlags(eFlags);
-#else
- ui->localList->setColumnHidden(FRIENDLY, true);
+ item->setText(col_l_friendly_name_, device.friendly_name);
#endif
- output = QString(device.name);
- ui->localList->setItem(ui->localList->rowCount()-1, LOCAL_NAME, new QTableWidgetItem(output));
- output = QString("");
- eFlags = ui->localList->item(ui->localList->rowCount()-1, LOCAL_NAME)->flags();
- eFlags &= Qt::NoItemFlags;
- eFlags |= Qt::ItemIsSelectable | Qt::ItemIsEnabled;
- ui->localList->item(ui->localList->rowCount()-1, LOCAL_NAME)->setFlags(eFlags);
+ item->setText(col_l_local_name_, device.name);
comment = capture_dev_user_descr_find(device.name);
- if (comment)
- output = QString(comment);
- ui->localList->setItem(ui->localList->rowCount()-1, COMMENT, new QTableWidgetItem(output));
+ if (comment) {
+ item->setText(col_l_comment_, comment);
+ }
} else {
continue;
}
@@ -248,21 +340,16 @@ void ManageInterfacesDialog::showLocalInterfaces()
g_free(pr_descr);
}
-void ManageInterfacesDialog::saveLocalHideChanges(QTableWidgetItem* item)
+void ManageInterfacesDialog::saveLocalHideChanges(QTreeWidgetItem *item)
{
guint i;
interface_t device;
- if (item->column() != HIDE) {
- return;
- }
- QTableWidgetItem* nameItem = ui->localList->item(item->row(), LOCAL_NAME);
-
- if (!nameItem) {
+ if (!item) {
return;
}
- QString name = nameItem->text();
+ QString name = item->text(col_l_local_name_);
/* See if this is the currently selected capturing device */
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
@@ -270,28 +357,23 @@ void ManageInterfacesDialog::saveLocalHideChanges(QTableWidgetItem* item)
if (name.compare(device.name)) {
continue;
}
- device.hidden = (item->checkState()==Qt::Checked?true:false);
+ device.hidden = (item->checkState(col_l_show_) == Qt::Checked ? false : true);
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
g_array_insert_val(global_capture_opts.all_ifaces, i, device);
}
}
-void ManageInterfacesDialog::saveLocalCommentChanges(QTableWidgetItem* item)
+void ManageInterfacesDialog::saveLocalCommentChanges(QTreeWidgetItem* item)
{
guint i;
interface_t device;
- if (item->column() != COMMENT) {
+ if (!item) {
return;
}
- QTableWidgetItem* nameItem = ui->localList->item(item->row(), LOCAL_NAME);
- if (!nameItem) {
- return;
- }
-
- QString name = nameItem->text();
- QString comment = ui->localList->item(item->row(), COMMENT)->text();
+ QString name = item->text(col_l_local_name_);
+ QString comment = item->text(col_l_comment_);
/* See if this is the currently selected capturing device */
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
@@ -299,32 +381,32 @@ void ManageInterfacesDialog::saveLocalCommentChanges(QTableWidgetItem* item)
if (name.compare(device.name)) {
continue;
}
- if (!comment.compare("")) {
- device.display_name = g_strdup_printf("%s", name.toUtf8().constData());
+
+ g_free(device.display_name);
+ // XXX The GTK+ UI uses the raw device name instead of the friendly name.
+ // This seems to make more sense.
+ gchar *if_string = device.friendly_name ? device.friendly_name : device.name;
+ if (comment.isEmpty()) {
+ device.display_name = g_strdup(if_string);
} else {
- device.display_name = g_strdup_printf("%s: %s", comment.toUtf8().constData(), name.toUtf8().constData());
+ device.display_name = qstring_strdup(QString("%1: %2").arg(comment).arg(if_string));
}
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
g_array_insert_val(global_capture_opts.all_ifaces, i, device);
}
}
-
-void ManageInterfacesDialog::checkBoxChanged(QTableWidgetItem* item)
+#if 0 // Not needed?
+void ManageInterfacesDialog::checkBoxChanged(QTreeWidgetItem* item)
{
guint i;
interface_t device;
- if (item->column() != HIDE) {
+ if (!item) {
return;
}
- QTableWidgetItem* nameItem = ui->localList->item(item->row(), LOCAL_NAME);
- if (!nameItem) {
- return;
- }
-
- QString name = nameItem->text();
+ QString name = item->text(col_l_local_name_);
/* See if this is the currently selected capturing device */
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
@@ -341,66 +423,52 @@ void ManageInterfacesDialog::checkBoxChanged(QTableWidgetItem* item)
}
}
}
+#endif // checkBoxChanged not needed?
-void ManageInterfacesDialog::on_localButtonBox_accepted()
+void ManageInterfacesDialog::localAccepted()
{
- gchar *new_hide = g_strdup("");
- gchar *new_comment = NULL;
- QString name;
- gchar *tmp_descr = NULL;
if (global_capture_opts.all_ifaces->len > 0) {
- new_hide = (gchar*)g_malloc0(MAX_VAL_LEN);
- for (int row = 0; row < ui->localList->rowCount(); row++) {
- QTableWidgetItem* hitem = ui->localList->item(row, HIDE);
- checkBoxChanged(hitem);
- if (hitem->checkState() == Qt::Checked) {
- name = ui->localList->item(row, LOCAL_NAME)->text();
- g_strlcat (new_hide, ",", MAX_VAL_LEN);
- g_strlcat (new_hide, name.toUtf8().constData(), MAX_VAL_LEN);
+ QStringList hide_list;
+ QStringList comment_list;
+ QTreeWidgetItemIterator it(ui->localList);
+ while (*it) {
+ if ((*it)->checkState(col_l_show_) != Qt::Checked) {
+ hide_list << (*it)->text(col_l_local_name_);
}
- saveLocalHideChanges(hitem);
+
+ if (!(*it)->text(col_l_local_name_).isEmpty()) {
+ comment_list << QString("%1(%2)").arg((*it)->text(col_l_local_name_)).arg((*it)->text(col_l_comment_));
+ }
+
+ saveLocalHideChanges(*it);
+ saveLocalCommentChanges(*it);
+ ++it;
}
/* write new "hidden" string to preferences */
g_free(prefs.capture_devices_hide);
+ gchar *new_hide = qstring_strdup(hide_list.join(","));
prefs.capture_devices_hide = new_hide;
hide_interface(g_strdup(new_hide));
- new_comment = (gchar*)g_malloc0(MAX_VAL_LEN);
- for (int row = 0; row < ui->localList->rowCount(); row++) {
- name = ui->localList->item(row, LOCAL_NAME)->text();
- QTableWidgetItem* citem = ui->localList->item(row, COMMENT);
- if (citem->text().compare("")) {
- g_strlcat (new_comment, ",", MAX_VAL_LEN);
- tmp_descr = g_strdup_printf("%s(%s)", name.toUtf8().constData(), citem->text().toUtf8().constData());
- g_strlcat (new_comment, tmp_descr, MAX_VAL_LEN);
- g_free(tmp_descr);
- }
- saveLocalCommentChanges(citem);
- }
/* write new description string to preferences */
if (prefs.capture_devices_descr)
g_free(prefs.capture_devices_descr);
- prefs.capture_devices_descr = new_comment;
+ prefs.capture_devices_descr = qstring_strdup(comment_list.join(","));;
}
+}
- /* save changes to the preferences file */
- if (!prefs.gui_use_pref_save) {
- prefs_main_write();
- }
- emit ifsChanged();
+void ManageInterfacesDialog::on_buttonBox_helpRequested()
+{
+ wsApp->helpTopicAction(HELP_CAPTURE_MANAGE_INTERFACES_DIALOG);
}
#ifdef HAVE_PCAP_REMOTE
void ManageInterfacesDialog::remoteSelectionChanged(QTreeWidgetItem* item, int col)
{
- Q_UNUSED(item);
-
- if (col != 0 && item->isSelected()) {
- ui->remoteSettings->setEnabled(true);
- } else if (col == 0) {
- ui->remoteSettings->setEnabled(false);
- }
+ Q_UNUSED(item)
+ Q_UNUSED(col)
+ updateWidgets();
}
void ManageInterfacesDialog::addRemoteInterfaces(GList* rlist, remote_options *roptions)
@@ -562,47 +630,63 @@ void ManageInterfacesDialog::addRemoteInterfaces(GList* rlist, remote_options *r
showRemoteInterfaces();
}
-void ManageInterfacesDialog::on_remoteButtonBox_accepted()
+// We don't actually store these. When we do we should make sure they're stored
+// securely using CryptProtectData, the OS X Keychain, GNOME Keyring, KWallet, etc.
+void ManageInterfacesDialog::remoteAccepted()
{
QTreeWidgetItemIterator it(ui->remoteList);
while(*it) {
for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
interface_t device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
- if ((*it)->text(2).compare(device.name))
+ if ((*it)->text(col_r_host_dev_).compare(device.name))
continue;
- device.hidden = ((*it)->checkState(1)==Qt::Checked?true:false);
+ device.hidden = ((*it)->checkState(col_r_show_) == Qt::Checked ? false : true);
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
g_array_insert_val(global_capture_opts.all_ifaces, i, device);
}
++it;
}
- emit ifsChanged();
}
-void ManageInterfacesDialog::on_delRemote_clicked()
+void ManageInterfacesDialog::on_remoteList_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
{
- QList<QTreeWidgetItem*> selected = ui->remoteList->selectedItems();
- if (selected.length() == 0) {
- QMessageBox::warning(this, tr("Error"),
- tr("No host selected. Select the host to be removed."));
+ Q_UNUSED(current)
+ Q_UNUSED(previous)
+ updateWidgets();
+}
+
+void ManageInterfacesDialog::on_remoteList_itemClicked(QTreeWidgetItem *item, int column)
+{
+ if (!item || column != col_r_show_) {
return;
}
- QString host = selected[0]->text(0);
- int index = ui->remoteList->indexOfTopLevelItem(selected[0]);
- QTreeWidgetItem *top = ui->remoteList->takeTopLevelItem(index);
- int numChildren = top->childCount();
- for (int i = 0; i < numChildren; i++) {
- QTreeWidgetItem *child = top->child(i);
- for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
- interface_t device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
- if (child->text(2).compare(device.name))
+
+ for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
+ interface_t device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
+ if (!device.local) {
+ if (item->text(col_r_host_dev_).compare(device.name))
continue;
- global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
+ device.hidden = (item->checkState(col_r_show_) == Qt::Checked ? false : true);
}
}
- ui->remoteList->removeItemWidget(top, 0);
- fflush(stdout);
+}
+
+void ManageInterfacesDialog::on_delRemote_clicked()
+{
+ QTreeWidgetItem* item = ui->remoteList->currentItem();
+ if (!item) {
+ return;
+ }
+
+ for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
+ interface_t device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
+ if (item->text(col_r_host_dev_).compare(device.remote_opts.remote_host_opts.remote_host))
+ continue;
+ global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
+ }
+ delete item;
+ fflush(stdout); // ???
}
void ManageInterfacesDialog::on_addRemote_clicked()
@@ -615,25 +699,21 @@ void ManageInterfacesDialog::showRemoteInterfaces()
{
guint i;
interface_t device;
- gchar *host = g_strdup("");
- QTreeWidgetItem *child;
+ QTreeWidgetItem *item = NULL;
+ // We assume that remote interfaces are grouped by host.
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
+ QTreeWidgetItem *child;
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
if (!device.local) {
- QTreeWidgetItem *itm;
- if (strcmp(host, device.remote_opts.remote_host_opts.remote_host)) {
- host = g_strdup(device.remote_opts.remote_host_opts.remote_host);
- itm = new QTreeWidgetItem(ui->remoteList);
- itm->setText(HOST, host);
- child = new QTreeWidgetItem(itm);
- child->setCheckState(HIDDEN, device.hidden?Qt::Checked:Qt::Unchecked);
- child->setText(REMOTE_NAME, QString(device.name));
- } else {
- child = new QTreeWidgetItem(itm);
- child->setCheckState(HIDDEN, device.hidden?Qt::Checked:Qt::Unchecked);
- child->setText(REMOTE_NAME, QString(device.name));
+ if (!item || item->text(col_r_host_dev_).compare(device.remote_opts.remote_host_opts.remote_host) != 0) {
+ item = new QTreeWidgetItem(ui->remoteList);
+ item->setText(col_r_host_dev_, device.remote_opts.remote_host_opts.remote_host);
+ item->setExpanded(true);
}
+ child = new QTreeWidgetItem(item);
+ child->setCheckState(col_r_show_, device.hidden ? Qt::Unchecked : Qt::Checked);
+ child->setText(col_r_host_dev_, QString(device.name));
}
}
}
@@ -642,12 +722,15 @@ void ManageInterfacesDialog::on_remoteSettings_clicked()
{
guint i = 0;
interface_t device;
+ QTreeWidgetItem* item = ui->remoteList->currentItem();
+ if (!item) {
+ return;
+ }
- QList<QTreeWidgetItem*> selected = ui->remoteList->selectedItems();
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
if (!device.local) {
- if (selected[0]->text(2).compare(device.name)) {
+ if (item->text(col_r_host_dev_).compare(device.name)) {
continue;
} else {
RemoteSettingsDialog *dlg = new RemoteSettingsDialog(this, &device);
@@ -677,52 +760,74 @@ void ManageInterfacesDialog::setRemoteSettings(interface_t *iface)
}
}
}
-#endif
+#endif // HAVE_PCAP_REMOTE
-NewFileDelegate::NewFileDelegate(QObject *parent)
+PathChooserDelegate::PathChooserDelegate(QObject *parent)
: QStyledItemDelegate(parent)
{
}
-
-NewFileDelegate::~NewFileDelegate()
+PathChooserDelegate::~PathChooserDelegate()
{
}
-
-QWidget* NewFileDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const
+QWidget* PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
- Q_UNUSED(option);
- Q_UNUSED(index);
+ Q_UNUSED(index)
+
+ QTreeWidgetItem *item = tree_->currentItem();
+ if (!item) {
+ return NULL;
+ }
+ path_item_ = item;
+
+ path_editor_ = new QWidget(parent);
+ QHBoxLayout *hbox = new QHBoxLayout(path_editor_);
+ path_editor_->setLayout(hbox);
+ path_le_ = new QLineEdit(path_editor_);
+ QPushButton *pb = new QPushButton(path_editor_);
- QWidget * widg = new QWidget(parent);
- QHBoxLayout *hbox = new QHBoxLayout(widg);
- widg->setLayout(hbox);
- QLineEdit *le = new QLineEdit(widg);
- QPushButton *pb = new QPushButton(widg);
+ path_le_->setText(item->text(col_p_pipe_));
pb->setText(QString(tr("Browse...")));
- le->setText(table->currentItem()->text());
- hbox->addWidget(le);
+
+ hbox->setContentsMargins(0, 0, 0, 0);
+ hbox->addWidget(path_le_);
hbox->addWidget(pb);
- hbox->setMargin(0);
+ hbox->setSizeConstraint(QLayout::SetMinimumSize);
+
+ // Grow the item to match the editor. According to the QAbstractItemDelegate
+ // documenation we're supposed to reimplement sizeHint but this seems to work.
+ QSize size = option.rect.size();
+ size.setHeight(qMax(option.rect.height(), hbox->sizeHint().height()));
+ item->setData(col_p_pipe_, Qt::SizeHintRole, size);
+
+ path_le_->selectAll();
+ path_editor_->setFocusProxy(path_le_);
+ path_editor_->setFocusPolicy(path_le_->focusPolicy());
- connect(le, SIGNAL(textEdited(const QString &)), this, SLOT(setTextField(const QString &)));
- connect(le, SIGNAL(editingFinished()), this, SLOT(stopEditor()));
+ connect(path_le_, SIGNAL(destroyed()), this, SLOT(stopEditor()));
connect(pb, SIGNAL(pressed()), this, SLOT(browse_button_clicked()));
- return widg;
+ return path_editor_;
}
-void NewFileDelegate::setTextField(const QString &text)
+void PathChooserDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
- table->currentItem()->setText(text);
+ Q_UNUSED(index)
+ QRect rect = option.rect;
+
+ // Make sure the editor doesn't get squashed.
+ editor->adjustSize();
+ rect.setHeight(qMax(option.rect.height(), editor->height()));
+ editor->setGeometry(rect);
}
-void NewFileDelegate::stopEditor()
+void PathChooserDelegate::stopEditor()
{
- closeEditor(table->cellWidget(table->currentRow(), 0));
+ path_item_->setData(col_p_pipe_, Qt::SizeHintRole, QVariant());
+ path_item_->setText(col_p_pipe_, path_le_->text());
}
-void NewFileDelegate::browse_button_clicked()
+void PathChooserDelegate::browse_button_clicked()
{
char *open_dir = NULL;
@@ -737,9 +842,10 @@ void NewFileDelegate::browse_button_clicked()
open_dir = prefs.gui_fileopen_dir;
break;
}
- QString file_name = QFileDialog::getOpenFileName(table, tr("Open Pipe"), open_dir);
- closeEditor(table->cellWidget(table->currentRow(), 0));
- table->currentItem()->setText(file_name);
+ QString file_name = QFileDialog::getOpenFileName(tree_, tr("Open Pipe"), open_dir);
+ if (!file_name.isEmpty()) {
+ path_le_->setText(file_name);
+ }
}
#endif /* HAVE_LIBPCAP */
diff --git a/ui/qt/manage_interfaces_dialog.h b/ui/qt/manage_interfaces_dialog.h
index 615fd12d58..28ff425605 100644
--- a/ui/qt/manage_interfaces_dialog.h
+++ b/ui/qt/manage_interfaces_dialog.h
@@ -22,6 +22,11 @@
#ifndef MANAGE_INTERFACES_DIALOG_H
#define MANAGE_INTERFACES_DIALOG_H
+#include "config.h"
+
+#include <glib.h>
+#include "capture_opts.h"
+
#include <QDialog>
#include <QLineEdit>
#include <QTableWidget>
@@ -29,45 +34,29 @@
#include <QTreeWidgetItem>
#include <QStandardItemModel>
-#include <glib.h>
-#include "capture_opts.h"
-
-enum
-{
- HIDE = 0,
- FRIENDLY,
- LOCAL_NAME,
- COMMENT,
- NUM_LOCAL_COLUMNS
-};
-
-enum
-{
- HOST = 0,
- HIDDEN,
- REMOTE_NAME,
- NUM_REMOTE_COLUMNS
-};
-
-
-class NewFileDelegate : public QStyledItemDelegate
+class PathChooserDelegate : public QStyledItemDelegate
{
Q_OBJECT
private:
- QTableWidget* table;
+ QTreeWidget* tree_;
+ mutable QTreeWidgetItem *path_item_;
+ mutable QWidget *path_editor_;
+ mutable QLineEdit *path_le_;
public:
- NewFileDelegate(QObject *parent = 0);
- ~NewFileDelegate();
+ PathChooserDelegate(QObject *parent = 0);
+ ~PathChooserDelegate();
+
+ void setTree(QTreeWidget* tree) { tree_ = tree; }
+protected:
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- void setTable(QTableWidget* tb) { table = tb; }
+ void updateEditorGeometry ( QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
private slots:
- void browse_button_clicked();
- void setTextField(const QString &text);
void stopEditor();
+ void browse_button_clicked();
};
@@ -85,15 +74,17 @@ public:
private:
Ui::ManageInterfacesDialog *ui;
- NewFileDelegate new_pipe_item_delegate_;
+ PathChooserDelegate new_pipe_item_delegate_;
QStandardItemModel *remoteModel;
void showPipes();
void showLocalInterfaces();
void showRemoteInterfaces();
- void saveLocalHideChanges(QTableWidgetItem *item);
- void saveLocalCommentChanges(QTableWidgetItem *item);
- void checkBoxChanged(QTableWidgetItem *item);
+ void saveLocalHideChanges(QTreeWidgetItem *item);
+ void saveLocalCommentChanges(QTreeWidgetItem *item);
+#if 0 // Not needed?
+ void checkBoxChanged(QTreeWidgetItem *item);
+#endif
signals:
void ifsChanged();
@@ -103,19 +94,28 @@ signals:
#endif
private slots:
- void on_addButton_clicked();
+ void updateWidgets();
+
void on_buttonBox_accepted();
- void on_delButton_clicked();
- void on_localButtonBox_accepted();
+
+ void on_addPipe_clicked();
+ void on_delPipe_clicked();
+ void pipeAccepted();
+ void on_pipeList_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
+
+ void localAccepted();
#ifdef HAVE_PCAP_REMOTE
void on_addRemote_clicked();
- void on_remoteButtonBox_accepted();
+ void on_delRemote_clicked();
+ void remoteAccepted();
+ void on_remoteList_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
+ void on_remoteList_itemClicked(QTreeWidgetItem *item, int column);
void addRemoteInterfaces(GList *rlist, remote_options *roptions);
void setRemoteSettings(interface_t *iface);
- void on_delRemote_clicked();
void remoteSelectionChanged(QTreeWidgetItem* item, int col);
void on_remoteSettings_clicked();
#endif
+ void on_buttonBox_helpRequested();
};
#endif // MANAGE_INTERFACES_DIALOG_H
diff --git a/ui/qt/manage_interfaces_dialog.ui b/ui/qt/manage_interfaces_dialog.ui
index 8bef47f800..0e689390e2 100644
--- a/ui/qt/manage_interfaces_dialog.ui
+++ b/ui/qt/manage_interfaces_dialog.ui
@@ -1,457 +1,299 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>ManageInterfacesDialog</class>
- <widget class="QDialog" name="ManageInterfacesDialog">
- <property name="windowModality">
- <enum>Qt::ApplicationModal</enum>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>574</width>
- <height>338</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Manage Interfaces</string>
- </property>
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="modal">
- <bool>false</bool>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="leftMargin">
- <number>3</number>
+ <class>ManageInterfacesDialog</class>
+ <widget class="QDialog" name="ManageInterfacesDialog">
+ <property name="windowModality">
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>750</width>
+ <height>425</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Manage Interfaces</string>
+ </property>
+ <property name="modal">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>2</number>
+ </property>
+ <widget class="QWidget" name="localTab">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Click the checkbox to hide or show a hidden interface.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
- <property name="topMargin">
- <number>10</number>
- </property>
- <property name="rightMargin">
- <number>3</number>
- </property>
- <property name="bottomMargin">
- <number>3</number>
+ <attribute name="title">
+ <string>Local Interfaces</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTreeWidget" name="localList">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="indentation">
+ <number>0</number>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>false</bool>
+ </property>
+ <property name="uniformRowHeights">
+ <bool>true</bool>
+ </property>
+ <property name="itemsExpandable">
+ <bool>false</bool>
+ </property>
+ <column>
+ <property name="text">
+ <string>Show</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Friendly Name</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Interface Name</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Comment</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="pipeTab">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add a pipe to capture from or remove an existing pipe from the list.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>2</number>
+ <attribute name="title">
+ <string>Pipes</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QTreeWidget" name="pipeList">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="verticalScrollBarPolicy">
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="textElideMode">
+ <enum>Qt::ElideMiddle</enum>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>false</bool>
+ </property>
+ <property name="itemsExpandable">
+ <bool>false</bool>
+ </property>
+ <column>
+ <property name="text">
+ <string notr="true">Named Pipe Path</string>
</property>
- <widget class="QWidget" name="Pipes">
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add a pipe to capture from or remove an existing pipe from the list.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <attribute name="title">
- <string>Pipes</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="leftMargin">
- <number>5</number>
- </property>
- <property name="topMargin">
- <number>5</number>
- </property>
- <property name="rightMargin">
- <number>5</number>
- </property>
- <property name="bottomMargin">
- <number>5</number>
- </property>
- <item>
- <widget class="QTableWidget" name="pipeList">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="baseSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="verticalScrollBarPolicy">
- <enum>Qt::ScrollBarAsNeeded</enum>
- </property>
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- <property name="alternatingRowColors">
- <bool>true</bool>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::SingleSelection</enum>
- </property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
- <property name="showGrid">
- <bool>false</bool>
- </property>
- <property name="rowCount">
- <number>1</number>
- </property>
- <property name="columnCount">
- <number>1</number>
- </property>
- <attribute name="horizontalHeaderVisible">
- <bool>false</bool>
- </attribute>
- <attribute name="horizontalHeaderStretchLastSection">
- <bool>true</bool>
- </attribute>
- <attribute name="verticalHeaderVisible">
- <bool>false</bool>
- </attribute>
- <row/>
- <column>
- <property name="text">
- <string>Pipe</string>
- </property>
- </column>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QPushButton" name="addButton">
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add a new pipe using default settings.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../image/toolbar.qrc">
- <normaloff>:/stock/plus-8.png</normaloff>:/stock/plus-8.png
- </iconset>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="delButton">
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Remove the selected pipe from the list.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../image/toolbar.qrc">
- <normaloff>:/stock/minus-8.png</normaloff>:/stock/minus-8.png
- </iconset>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="Local">
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Click the checkbox to hide or show a hidden interface.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <attribute name="title">
- <string>Local Interfaces</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="leftMargin">
- <number>5</number>
- </property>
- <property name="topMargin">
- <number>5</number>
- </property>
- <property name="rightMargin">
- <number>5</number>
- </property>
- <property name="bottomMargin">
- <number>5</number>
- </property>
- <item>
- <widget class="QTableWidget" name="localList">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="editTriggers">
- <set>QAbstractItemView::DoubleClicked</set>
- </property>
- <property name="alternatingRowColors">
- <bool>true</bool>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::SingleSelection</enum>
- </property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
- <attribute name="horizontalHeaderStretchLastSection">
- <bool>true</bool>
- </attribute>
- <attribute name="verticalHeaderVisible">
- <bool>false</bool>
- </attribute>
- <column>
- <property name="text">
- <string>Hide</string>
- </property>
- <property name="textAlignment">
- <set>AlignHCenter|AlignVCenter|AlignCenter</set>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Friendly Name</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Interface Name</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Comment</string>
- </property>
- </column>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="localButtonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QToolButton" name="addPipe">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add a new pipe using default settings.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../image/toolbar.qrc">
+ <normaloff>:/stock/plus-8.png</normaloff>:/stock/plus-8.png</iconset>
+ </property>
</widget>
- <widget class="QWidget" name="Remote">
- <attribute name="title">
- <string>Remote Interfaces</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <property name="leftMargin">
- <number>5</number>
- </property>
- <property name="topMargin">
- <number>5</number>
- </property>
- <property name="rightMargin">
- <number>5</number>
- </property>
- <property name="bottomMargin">
- <number>5</number>
- </property>
- <item>
- <widget class="QTreeWidget" name="remoteList">
- <property name="editTriggers">
- <set>QAbstractItemView::DoubleClicked</set>
- </property>
- <property name="tabKeyNavigation">
- <bool>true</bool>
- </property>
- <property name="dragDropOverwriteMode">
- <bool>true</bool>
- </property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
- <column>
- <property name="text">
- <string notr="true">1</string>
- </property>
- </column>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QPushButton" name="addRemote">
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add a remote host and its interfaces&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../image/toolbar.qrc">
- <normaloff>:/stock/plus-8.png</normaloff>:/stock/plus-8.png
- </iconset>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="delRemote">
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Remove the selected host from the list.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../image/toolbar.qrc">
- <normaloff>:/stock/minus-8.png</normaloff>:/stock/minus-8.png
- </iconset>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>328</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="remoteSettings">
- <property name="text">
- <string>Remote Settings</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="remoteButtonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
+ </item>
+ <item>
+ <widget class="QToolButton" name="delPipe">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Remove the selected pipe from the list.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../image/toolbar.qrc">
+ <normaloff>:/stock/minus-8.png</normaloff>:/stock/minus-8.png</iconset>
+ </property>
</widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="remoteTab">
+ <attribute name="title">
+ <string>Remote Interfaces</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QTreeWidget" name="remoteList">
+ <property name="uniformRowHeights">
+ <bool>true</bool>
+ </property>
+ <column>
+ <property name="text">
+ <string notr="true">Show</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Host / Device URL</string>
+ </property>
+ </column>
</widget>
- </item>
- </layout>
- </widget>
- <resources>
- <include location="../../image/toolbar.qrc"/>
- </resources>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>ManageInterfacesDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>469</x>
- <y>303</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>164</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>ManageInterfacesDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>469</x>
- <y>303</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>164</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>localButtonBox</sender>
- <signal>rejected()</signal>
- <receiver>ManageInterfacesDialog</receiver>
- <slot>close()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>469</x>
- <y>303</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>164</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>localButtonBox</sender>
- <signal>accepted()</signal>
- <receiver>ManageInterfacesDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>469</x>
- <y>303</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>164</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>remoteButtonBox</sender>
- <signal>rejected()</signal>
- <receiver>ManageInterfacesDialog</receiver>
- <slot>close()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>482</x>
- <y>312</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>168</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>remoteButtonBox</sender>
- <signal>accepted()</signal>
- <receiver>ManageInterfacesDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>482</x>
- <y>312</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>168</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QToolButton" name="addRemote">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add a remote host and its interfaces&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../image/toolbar.qrc">
+ <normaloff>:/stock/plus-8.png</normaloff>:/stock/plus-8.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="delRemote">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Remove the selected host from the list.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../image/toolbar.qrc">
+ <normaloff>:/stock/minus-8.png</normaloff>:/stock/minus-8.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>328</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="remoteSettings">
+ <property name="text">
+ <string>Remote Settings</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="hintLabel">
+ <property name="text">
+ <string>&lt;small&gt;&lt;i&gt;&lt;/i&gt;&lt;/small&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources>
+ <include location="../../image/toolbar.qrc"/>
+ </resources>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ManageInterfacesDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>374</x>
+ <y>404</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>374</x>
+ <y>212</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>ManageInterfacesDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>374</x>
+ <y>404</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>374</x>
+ <y>212</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>
diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h
index f632044a0c..c957b7eb41 100644
--- a/ui/qt/packet_list.h
+++ b/ui/qt/packet_list.h
@@ -31,7 +31,6 @@
#include <QTreeWidget>
#include <QMenu>
-// It might make more sense to subclass QTableView here.
class PacketList : public QTreeView
{
Q_OBJECT
diff --git a/ui/qt/remote_capture_dialog.cpp b/ui/qt/remote_capture_dialog.cpp
index 38c53d2dbb..57b7eff50d 100644
--- a/ui/qt/remote_capture_dialog.cpp
+++ b/ui/qt/remote_capture_dialog.cpp
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+// XXX This shouldn't exist. These controls should be in ManageInterfacesDialog instead.
+
#include "config.h"
#ifdef HAVE_PCAP_REMOTE
#include <glib.h>
diff --git a/ui/qt/remote_settings_dialog.cpp b/ui/qt/remote_settings_dialog.cpp
index c677df3704..2d98e225d6 100644
--- a/ui/qt/remote_settings_dialog.cpp
+++ b/ui/qt/remote_settings_dialog.cpp
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+// XXX This shouldn't exist. These controls should be in ManageInterfacesDialog instead.
+
#include "config.h"
#ifdef HAVE_PCAP_REMOTE
#include "remote_settings_dialog.h"