diff --git a/ui/qt/capture_interfaces_dialog.cpp b/ui/qt/capture_interfaces_dialog.cpp index 37c0f23ea8..cb18f1170e 100644 --- a/ui/qt/capture_interfaces_dialog.cpp +++ b/ui/qt/capture_interfaces_dialog.cpp @@ -23,14 +23,15 @@ #include "config.h" +#include + #include "capture_interfaces_dialog.h" #include "ui_capture_interfaces_dialog.h" +#include "wireshark_application.h" + #ifdef HAVE_LIBPCAP -#include - -#include #include #include "capture_ui_utils.h" @@ -57,6 +58,14 @@ CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) : stat_timer_ = NULL; stat_cache_ = NULL; + // XXX - Enable / disable as needed + start_bt_ = ui->buttonBox->addButton(tr("Start"), QDialogButtonBox::YesRole); + connect(start_bt_, SIGNAL(clicked()), this, SLOT(on_bStart_clicked())); + + stop_bt_ = ui->buttonBox->addButton(tr("Stop"), QDialogButtonBox::NoRole); + stop_bt_->setEnabled(false); + connect(stop_bt_, SIGNAL(clicked()), this, SLOT(on_bStop_clicked())); + //connect(ui->tbInterfaces,SIGNAL(itemPressed(QTableWidgetItem *)),this,SLOT(tableItemPressed(QTableWidgetItem *))); connect(ui->tbInterfaces,SIGNAL(itemClicked(QTableWidgetItem *)),this,SLOT(tableItemClicked(QTableWidgetItem *))); } @@ -106,12 +115,12 @@ void CaptureInterfacesDialog::on_capturePromModeCheckBox_toggled(bool checked) prefs.capture_prom_mode = checked; } -void CaptureInterfacesDialog::on_cbStopCaptureAuto_toggled(bool checked) +void CaptureInterfacesDialog::on_gbStopCaptureAuto_toggled(bool checked) { global_capture_opts.has_file_duration = checked; } -void CaptureInterfacesDialog::on_cbNewFileAuto_toggled(bool checked) +void CaptureInterfacesDialog::on_gbNewFileAuto_toggled(bool checked) { global_capture_opts.multi_files_on = checked; } @@ -153,7 +162,7 @@ void CaptureInterfacesDialog::on_bStart_clicked() emit startCapture(); - this->close(); + accept(); } void CaptureInterfacesDialog::on_bStop_clicked() @@ -163,13 +172,29 @@ void CaptureInterfacesDialog::on_bStop_clicked() emit stopCapture(); } +// Not sure why we have to do this manually. +void CaptureInterfacesDialog::on_buttonBox_rejected() +{ + reject(); +} + +void CaptureInterfacesDialog::on_buttonBox_helpRequested() +{ + // Probably the wrong URL. + wsApp->helpTopicAction(HELP_CAPTURE_INTERFACES_DIALOG); +} + void CaptureInterfacesDialog::UpdateInterfaces() { - ui->cbPcap->setCurrentIndex(!prefs.capture_pcap_ng); + if(prefs.capture_pcap_ng) { + ui->rbPcapng->setChecked(true); + } else { + ui->rbPcap->setChecked(true); + } ui->capturePromModeCheckBox->setChecked(prefs.capture_prom_mode); - ui->cbStopCaptureAuto->setChecked(global_capture_opts.has_file_duration); - ui->cbNewFileAuto->setChecked(global_capture_opts.multi_files_on); + ui->gbStopCaptureAuto->setChecked(global_capture_opts.has_file_duration); + ui->gbNewFileAuto->setChecked(global_capture_opts.multi_files_on); ui->cbUpdatePacketsRT->setChecked(global_capture_opts.real_time_mode); ui->cbAutoScroll->setChecked(true); @@ -181,7 +206,6 @@ void CaptureInterfacesDialog::UpdateInterfaces() ui->tbInterfaces->setRowCount(0); - GList *if_list; int err; gchar *err_str = NULL; diff --git a/ui/qt/capture_interfaces_dialog.h b/ui/qt/capture_interfaces_dialog.h index f9036ea029..5e1d8acb22 100644 --- a/ui/qt/capture_interfaces_dialog.h +++ b/ui/qt/capture_interfaces_dialog.h @@ -30,6 +30,7 @@ #ifdef HAVE_LIBPCAP #include +#include #include typedef struct if_stat_cache_s if_stat_cache_t; @@ -77,16 +78,18 @@ public: private slots: void on_capturePromModeCheckBox_toggled(bool checked); - void on_cbStopCaptureAuto_toggled(bool checked); + void on_gbStopCaptureAuto_toggled(bool checked); void on_cbUpdatePacketsRT_toggled(bool checked); void on_cbAutoScroll_toggled(bool checked); - void on_cbNewFileAuto_toggled(bool checked); + void on_gbNewFileAuto_toggled(bool checked); void on_cbExtraCaptureInfo_toggled(bool checked); void on_cbResolveMacAddresses_toggled(bool checked); void on_cbResolveNetworkNames_toggled(bool checked); void on_cbResolveTransportNames_toggled(bool checked); void on_bStart_clicked(); void on_bStop_clicked(); + void on_buttonBox_rejected(); + void on_buttonBox_helpRequested(); void tableItemClicked(QTableWidgetItem * item); void updateStatistics(void); //void on_tbInterfaces_hideEvent(QHideEvent *evt); @@ -101,6 +104,8 @@ private: Ui::CaptureInterfacesDialog *ui; Qt::CheckState m_pressedItemState; + QPushButton *start_bt_; + QPushButton *stop_bt_; if_stat_cache_t *stat_cache_; QTimer *stat_timer_; }; diff --git a/ui/qt/capture_interfaces_dialog.ui b/ui/qt/capture_interfaces_dialog.ui index 69c7b333ad..7e7bfb7590 100644 --- a/ui/qt/capture_interfaces_dialog.ui +++ b/ui/qt/capture_interfaces_dialog.ui @@ -6,680 +6,628 @@ 0 0 - 636 - 403 + 750 + 475 Wireshark: Capture interfaces - - - - 0 - 0 - 641 - 351 - - - - 1 - - - - Input - - - - - 510 - 250 - 91 - 23 - + + + + + 2 - - Add pipe... - - - - - - 20 - 244 - 363 - 20 - - - - <html><head/><body><p>You probably want to enable this. Usually a network card will only capture the traffic sent to its own network address. If you want to capture all traffic that the network card can &quot;see&quot;, mark this option. See the FAQ for some more details of capturing packets from a switched network.</p></body></html> - - - Capture packets in promiscuous mode - - - - - - 20 - 280 - 363 - 20 - - - - <html><head/><body><p>Show the capture summary dialog while capturing.</p></body></html> - - - Show the capture summary dialog while capturing - - - - - - 10 - 10 - 611 - 221 - - - - QAbstractItemView::NoEditTriggers - - - true - - - true - - - 0 - - - 9 - - - - Capture - - - - - Interface - - - - - Traffic - - - - - Link-layer header - - - - - Prom. mode - - - - - Snaplen [B] - - - - - Buffer [MB] - - - - - Mon. Mode - - - - - Capture Filter - - - - - - - Output - - - - - 40 - 50 - 231 - 21 - - - - Capture direcly to file - - - - - - 40 - 110 - 341 - 21 - - - - Create a new file automatically after... - - - - - - 61 - 143 - 271 - 21 - - - - packets - - - - - - 85 - 141 - 121 - 25 - - - - QAbstractSpinBox::PlusMinus - - - 1000 - - - - - - 60 - 170 - 21 - 21 - - - - - - - - - - 60 - 200 - 51 - 21 - - - - - - - - - - 40 - 230 - 131 - 21 - - - - Reuse old files - - - - - - 50 - 70 - 311 - 29 - - - - - - - File: - - - - - - - - - - Browse... - - - - - - - - - 40 - 10 - 199 - 29 - - - - - - - Output format - - - - - - - - PCAP-NG - - - - - PCAP - - - - - - - - - - 84 - 198 - 251 - 29 - - - - - - - QAbstractSpinBox::PlusMinus - - - 1000 - - - - - - - - seconds - - - - - minutes - - - - - hours - - - - - - - - - - 84 - 168 - 251 - 29 - - - - - - - QAbstractSpinBox::PlusMinus - - - 1000 - - - - - - - - Megabytes - - - - - Kilobytes - - - - - Bytes - - - - - - - layoutWidget_1 - layoutWidget_2 - layoutWidget_3 - layoutWidget_4 - checkBox_3 - checkBox - cbNewFileAuto - spinBox - checkBox_4 - checkBox_5 - checkBox_6 - - - - Options - - - - - 10 - 170 - 261 - 21 - - - - Stop capture automatically after... - - - - - - 54 - 198 - 121 - 25 - - - - QAbstractSpinBox::PlusMinus - - - 1000 - - - - - - 29 - 227 - 21 - 21 - - - - - - - - - - 53 - 255 - 251 - 29 - - - - - - - QAbstractSpinBox::PlusMinus - - - 1000 - - - - - - - - seconds - - - - - minutes - - - - - hours - - - - - - - - - - 29 - 257 - 51 - 21 - - - - - - - - - - 53 - 225 - 251 - 29 - - - - - - - QAbstractSpinBox::PlusMinus - - - 1000 - - - - - - - - Megabytes - - - - - Kilobytes - - - - - Bytes - - - - - - - - - - 30 - 200 - 271 - 21 - - - - packets - - - - - - 10 - 10 - 601 - 111 - - - - Display Options - - - - - 10 - 20 - 298 - 80 - - - + + + Input + + - - - Update list of packets in real-time + + + QAbstractItemView::NoEditTriggers + + true + + + QAbstractItemView::SelectRows + + + Qt::ElideMiddle + + + true + + + 0 + + + 9 + + + + Capture + + + + + Interface + + + + + Traffic + + + + + Link-layer header + + + + + Prom. mode + + + + + Snaplen [B] + + + + + Buffer [MB] + + + + + Mon. Mode + + + + + Capture Filter + + - - - Automatically scroll during live capture - - - - - - - Show extra capture information dialog - - + + + + + + + <html><head/><body><p>You probably want to enable this. Usually a network card will only capture the traffic sent to its own network address. If you want to capture all traffic that the network card can &quot;see&quot;, mark this option. See the FAQ for some more details of capturing packets from a switched network.</p></body></html> + + + Capture packets in promiscuous mode + + + + + + + <html><head/><body><p>Show the capture summary dialog while capturing.</p></body></html> + + + Show the capture summary dialog while capturing + + + + + + + + + Qt::Horizontal + + + + 40 + 48 + + + + + + + + + + false + + + Add pipe... + + + + + + + Qt::Vertical + + + + 20 + 18 + + + + + + + - - - - 320 - 0 - 601 - 111 - - - - Name Resolution - - - - - 10 - 20 - 211 - 80 - - - - - - - Resolve MAC Addresses - - - - - - - Resolve network names - - - - - - - Resolve transport names - - - - - + + + Output + + + + + + + + Output format: + + + + + + + pcap-ng + + + + + + + pcap + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Capture direcly to file + + + true + + + true + + + + + + Browse... + + + + + + + File: + + + + + + + + + + + + + Create a new file automatically after... + + + true + + + true + + + + + + QAbstractSpinBox::PlusMinus + + + 1000 + + + + + + + QAbstractSpinBox::PlusMinus + + + 1000 + + + + + + + + Megabytes + + + + + Kilobytes + + + + + Bytes + + + + + + + + + seconds + + + + + minutes + + + + + hours + + + + + + + + packets + + + + + + + + + + + + + + + + + + + + + QAbstractSpinBox::PlusMinus + + + 1000 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Reuse old files + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + checkBox_6 + gbNewFileAuto + gbCaptureToFile + + + + Options + + + + + + + + Display Options + + + true + + + false + + + + + + Update list of packets in real-time + + + + + + + Automatically scroll during live capture + + + + + + + Show extra capture information dialog + + + + + + + + + + Name Resolution + + + true + + + + + + Resolve MAC Addresses + + + + + + + Resolve network names + + + + + + + Resolve transport names + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Stop capture automatically after... + + + true + + + true + + + + + + QAbstractSpinBox::PlusMinus + + + 1000 + + + + + + + QAbstractSpinBox::PlusMinus + + + 1000 + + + + + + + + + + + + + + packets + + + + + + + + + + + + + + + seconds + + + + + minutes + + + + + hours + + + + + + + + + + + + + + + + Megabytes + + + + + Kilobytes + + + + + Bytes + + + + + + + + QAbstractSpinBox::PlusMinus + + + 1000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + - - - - - - 10 - 360 - 360 - 29 - - - - - - - Start - - - - - - - Stop - - - - - - - Close - - - - - + + + + + QDialogButtonBox::Close|QDialogButtonBox::Help + + + +