Capture Interfaces dialog cleanup.

Apply layouts as needed to allow resizing. Select the interface list by
row. We might want to switch the interface list to a QTreeWidget. Today
I learned that you can make QGroupBox titles checkable. Do that where we
enable and disable groups of items. Flatten all of the group boxes.
Change the output format combo to radio buttons. There are only two
choices and we have lots of real estate available. Use a
QDialogButtonBox so Qt can size and order the buttons appropriately.

svn path=/trunk/; revision=54052
This commit is contained in:
Gerald Combs 2013-12-13 18:36:59 +00:00
parent 093ace5c24
commit a2835dd48a
3 changed files with 647 additions and 670 deletions

View File

@ -23,14 +23,15 @@
#include "config.h"
#include <glib.h>
#include "capture_interfaces_dialog.h"
#include "ui_capture_interfaces_dialog.h"
#include "wireshark_application.h"
#ifdef HAVE_LIBPCAP
#include <glib.h>
#include <QSpacerItem>
#include <QTimer>
#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;

View File

@ -30,6 +30,7 @@
#ifdef HAVE_LIBPCAP
#include <QDialog>
#include <QPushButton>
#include <QTableWidget>
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_;
};

File diff suppressed because it is too large Load Diff