aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capture_opts.c2
-rw-r--r--ui/qt/interface_frame.cpp28
-rw-r--r--ui/qt/interface_frame.h2
-rw-r--r--ui/qt/main_window.cpp4
-rw-r--r--ui/qt/main_window.h2
-rw-r--r--ui/qt/main_window_slots.cpp25
-rw-r--r--ui/qt/welcome_page.cpp12
-rw-r--r--ui/qt/welcome_page.h5
8 files changed, 59 insertions, 21 deletions
diff --git a/capture_opts.c b/capture_opts.c
index a3809d8ab7..a0ac0bb125 100644
--- a/capture_opts.c
+++ b/capture_opts.c
@@ -1307,7 +1307,7 @@ collect_ifaces(capture_options *capture_opts)
/* Now fill the list up again. */
for (i = 0; i < capture_opts->all_ifaces->len; i++) {
device = &g_array_index(capture_opts->all_ifaces, interface_t, i);
- if (!device->hidden && device->selected) {
+ if (device->selected) {
interface_opts.name = g_strdup(device->name);
interface_opts.descr = g_strdup(device->friendly_name);
interface_opts.ifname = NULL;
diff --git a/ui/qt/interface_frame.cpp b/ui/qt/interface_frame.cpp
index 5bb2d9cf7c..f03988a6ac 100644
--- a/ui/qt/interface_frame.cpp
+++ b/ui/qt/interface_frame.cpp
@@ -151,15 +151,12 @@ QMenu * InterfaceFrame::getSelectionMenu()
}
#endif
-#if 0
- // Disabled until bug 13354 is fixed
contextMenu->addSeparator();
QAction * toggleHideAction = new QAction(tr("Show hidden interfaces"), this);
toggleHideAction->setCheckable(true);
- toggleHideAction->setChecked(! proxy_model_->filterHidden());
+ toggleHideAction->setChecked(! proxy_model_.filterHidden());
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHiddenInterfaces()));
contextMenu->addAction(toggleHideAction);
-#endif
return contextMenu;
}
@@ -410,11 +407,15 @@ void InterfaceFrame::on_interfaceTree_doubleClicked(const QModelIndex &index)
if (! realIndex.isValid())
return;
+ QStringList interfaces;
+
#ifdef HAVE_LIBPCAP
QString device_name = source_model_.getColumnContent(realIndex.row(), IFTREE_COL_NAME).toString();
QString extcap_string = source_model_.getColumnContent(realIndex.row(), IFTREE_COL_EXTCAP_PATH).toString();
+ interfaces << device_name;
+
/* We trust the string here. If this interface is really extcap, the string is
* being checked immediatly before the dialog is being generated */
if (extcap_string.length() > 0)
@@ -427,7 +428,8 @@ void InterfaceFrame::on_interfaceTree_doubleClicked(const QModelIndex &index)
}
}
#endif
- emit startCapture();
+
+ startCapture(interfaces);
}
#ifdef HAVE_LIBPCAP
@@ -492,7 +494,21 @@ void InterfaceFrame::showContextMenu(QPoint pos)
{
QMenu ctx_menu;
- ctx_menu.addAction(tr("Start capture"), this, SIGNAL(startCapture()));
+ ctx_menu.addAction(tr("Start capture"), this, [=] () {
+ QStringList ifaces;
+ QModelIndexList selIndices = ui->interfaceTree->selectionModel()->selectedIndexes();
+ foreach(QModelIndex idx, selIndices)
+ {
+ QModelIndex realIndex = proxy_model_.mapToSource(info_model_.mapToSource(idx));
+ if (realIndex.column() != IFTREE_COL_NAME)
+ realIndex = realIndex.siblingAtColumn(IFTREE_COL_NAME);
+ QString name = realIndex.data(Qt::DisplayRole).toString();
+ if (! ifaces.contains(name))
+ ifaces << name;
+ }
+
+ startCapture(ifaces);
+ });
ctx_menu.exec(ui->interfaceTree->mapToGlobal(pos));
}
diff --git a/ui/qt/interface_frame.h b/ui/qt/interface_frame.h
index 031a65e308..14871d34ef 100644
--- a/ui/qt/interface_frame.h
+++ b/ui/qt/interface_frame.h
@@ -47,7 +47,7 @@ public:
Q_SIGNALS:
void showExtcapOptions(QString device_name, bool startCaptureOnClose);
- void startCapture();
+ void startCapture(QStringList);
void itemSelectionChanged();
void typeSelectionChanged();
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index dcd3849a74..88c7799eca 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -589,8 +589,8 @@ main_ui_->goToLineEdit->setValidator(goToLineQiv);
connect(main_ui_->mainStack, SIGNAL(currentChanged(int)),
this, SLOT(mainStackChanged(int)));
- connect(welcome_page_, SIGNAL(startCapture()),
- this, SLOT(startCapture()));
+ connect(welcome_page_, SIGNAL(startCapture(QStringList)),
+ this, SLOT(startCapture(QStringList)));
connect(welcome_page_, SIGNAL(recentFileActivated(QString)),
this, SLOT(openCaptureFile(QString)));
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index 923ee7802d..015ac4b277 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -388,7 +388,7 @@ private slots:
* Start capturing from the selected interfaces using the capture filter
* shown in the main welcome screen.
*/
- void startCapture();
+ void startCapture(QStringList);
void pipeTimeout();
void pipeActivated(int source);
void pipeNotifierDestroyed();
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index b299f13160..c98bb8d9f6 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -831,13 +831,28 @@ void MainWindow::captureFileClosed() {
// ui/gtk/capture_dlg.c:start_capture_confirmed
-void MainWindow::startCapture() {
+void MainWindow::startCapture(QStringList interfaces _U_) {
#ifdef HAVE_LIBPCAP
interface_options *interface_opts;
guint i;
interface_t *device;
gboolean can_start_capture = TRUE;
+ if (interfaces.count() > 0) {
+ global_capture_opts.num_selected = 0;
+ for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
+ device = &g_array_index(global_capture_opts.all_ifaces, interface_t, i);
+
+ if (interfaces.contains(device->name)) {
+ device->selected = TRUE;
+ global_capture_opts.num_selected++;
+ }
+ else {
+ device->selected = FALSE;
+ }
+ }
+ }
+
/* did the user ever select a capture interface before? */
if (global_capture_opts.num_selected == 0) {
QString msg = QString(tr("No interface selected."));
@@ -1495,7 +1510,7 @@ void MainWindow::startInterfaceCapture(bool valid, const QString capture_filter)
if (testCaptureFileClose(before_what)) {
// The interface tree will update the selected interfaces via its timer
// so no need to do anything here.
- startCapture();
+ startCapture(QStringList());
}
}
@@ -3964,7 +3979,7 @@ void MainWindow::on_actionCaptureStart_triggered()
/* XXX - will closing this remove a temporary file? */
QString before_what(tr(" before starting a new capture"));
if (testCaptureFileClose(before_what)) {
- startCapture();
+ startCapture(QStringList());
} else {
// simply clicking the button sets it to 'checked' even though we've
// decided to do nothing, so undo that
@@ -3986,7 +4001,7 @@ void MainWindow::on_actionCaptureRestart_triggered()
if (!testCaptureFileClose(before_what, Restart))
return;
- startCapture();
+ startCapture(QStringList());
#endif // HAVE_LIBPCAP
}
@@ -4116,7 +4131,7 @@ void MainWindow::extcap_options_finished(int result)
if (result == QDialog::Accepted) {
QString before_what(tr(" before starting a new capture"));
if (testCaptureFileClose(before_what)) {
- startCapture();
+ startCapture(QStringList());
}
}
this->welcome_page_->getInterfaceFrame()->interfaceListChanged();
diff --git a/ui/qt/welcome_page.cpp b/ui/qt/welcome_page.cpp
index 87618cdf34..e03c879911 100644
--- a/ui/qt/welcome_page.cpp
+++ b/ui/qt/welcome_page.cpp
@@ -86,7 +86,7 @@ WelcomePage::WelcomePage(QWidget *parent) :
connect(welcome_ui_->captureFilterComboBox, SIGNAL(captureFilterSyntaxChanged(bool)),
this, SIGNAL(captureFilterSyntaxChanged(bool)));
connect(welcome_ui_->captureFilterComboBox, SIGNAL(startCapture()),
- this, SIGNAL(startCapture()));
+ this, SLOT(captureStarting()));
connect(recent_files_, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(openRecentItem(QListWidgetItem *)));
updateRecentCaptures();
@@ -248,9 +248,15 @@ void WelcomePage::on_interfaceFrame_showExtcapOptions(QString device_name, bool
emit showExtcapOptions(device_name, startCaptureOnClose);
}
-void WelcomePage::on_interfaceFrame_startCapture()
+void WelcomePage::on_interfaceFrame_startCapture(QStringList ifaces)
{
- emit startCapture();
+ emit startCapture(ifaces);
+}
+
+void WelcomePage::captureStarting()
+{
+ welcome_ui_->interfaceFrame->ensureSelectedInterface();
+ emit startCapture(QStringList());
}
void WelcomePage::updateRecentCaptures() {
diff --git a/ui/qt/welcome_page.h b/ui/qt/welcome_page.h
index e11a87146f..9d48cd8b42 100644
--- a/ui/qt/welcome_page.h
+++ b/ui/qt/welcome_page.h
@@ -59,7 +59,7 @@ private:
QListWidget *recent_files_;
signals:
- void startCapture();
+ void startCapture(QStringList);
void recentFileActivated(QString cfile);
void captureFilterSyntaxChanged(bool valid);
void showExtcapOptions(QString &device_name, bool startCaptureOnClose);
@@ -81,7 +81,8 @@ private slots:
void removeRecentPath();
void on_interfaceFrame_showExtcapOptions(QString device_name, bool startCaptureOnClose);
- void on_interfaceFrame_startCapture();
+ void on_interfaceFrame_startCapture(QStringList);
+ void captureStarting();
};
#endif // WELCOME_PAGE_H