aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-02-01 00:14:15 +0000
committerGerald Combs <gerald@wireshark.org>2013-02-01 00:14:15 +0000
commit89c5066f6710083f10ed921c73209f659f160d3a (patch)
tree91f056a6a9a94c078dbc8f0c8489d40442c718ec /ui
parent7fb4d231c3fa80edfcce9944a90652ec274e24be (diff)
Add interface prefs. Adjust some spacing and resize behavior.
svn path=/trunk/; revision=47403
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/CMakeLists.txt3
-rw-r--r--ui/qt/Makefile.am2
-rw-r--r--ui/qt/Makefile.common4
-rw-r--r--ui/qt/QtShark.pro9
-rw-r--r--ui/qt/capture_preferences_frame.cpp137
-rw-r--r--ui/qt/capture_preferences_frame.h67
-rw-r--r--ui/qt/capture_preferences_frame.ui127
-rw-r--r--ui/qt/main_window_preferences_frame.ui21
-rw-r--r--ui/qt/preferences_dialog.cpp3
-rw-r--r--ui/qt/preferences_dialog.ui14
10 files changed, 376 insertions, 11 deletions
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index db8f3063c6..13556e1f6a 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -32,6 +32,7 @@ set(QTSHARK_H_SRC
capture_interface_dialog.h
color_dialog.h
color_utils.h
+ capture_preferences_frame.h
column_preferences_frame.h
display_filter_combo.h
display_filter_edit.h
@@ -80,6 +81,7 @@ set(QTSHARK_CPP_SRC
capture_interface_dialog.cpp
color_dialog.cpp
color_utils.cpp
+ capture_preferences_frame.cpp
column_preferences_frame.cpp
display_filter_combo.cpp
display_filter_edit.cpp
@@ -124,6 +126,7 @@ set(QTSHARK_SRC
)
set(QTSHARK_UI
+ capture_preferences_frame.ui
column_preferences_frame.ui
export_object_dialog.ui
file_set_dialog.ui
diff --git a/ui/qt/Makefile.am b/ui/qt/Makefile.am
index 7fe01cba0d..6ab2094d14 100644
--- a/ui/qt/Makefile.am
+++ b/ui/qt/Makefile.am
@@ -83,6 +83,8 @@ ui_%.h: %.ui
#moc_%.cpp: %.h
# moc $< -o $@
+capture_preferences_frame.cpp capture_preferences_frame.h: ui_capture_preferences_frame.h
+
column_preferences_frame.cpp column_preferences_frame.h: ui_column_preferences_frame.h
export_object_dialog.cpp export_object_dialog.h: ui_export_object_dialog.h
diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common
index 613434597e..40fbdb53d0 100644
--- a/ui/qt/Makefile.common
+++ b/ui/qt/Makefile.common
@@ -31,6 +31,7 @@ GENERATED_HEADER_FILES =
# Generated header files that we don't want in the distribution.
GENERATED_NODIST_HEADER_FILES = \
+ ui_capture_preferences_frame.h \
ui_column_preferences_frame.h \
ui_export_object_dialog.h \
ui_file_set_dialog.h \
@@ -91,6 +92,7 @@ MOC_HDRS = \
capture_interface_dialog.h \
color_dialog.h \
color_utils.h \
+ capture_preferences_frame.h \
column_preferences_frame.h \
display_filter_combo.h \
display_filter_edit.h \
@@ -130,6 +132,7 @@ MOC_HDRS = \
# .ui files.
#
UI_FILES = \
+ capture_preferences_frame.ui \
column_preferences_frame.ui \
export_object_dialog.ui \
file_set_dialog.ui \
@@ -201,6 +204,7 @@ WIRESHARK_QT_SRC = \
capture_interface_dialog.cpp \
color_dialog.cpp \
color_utils.cpp \
+ capture_preferences_frame.cpp \
column_preferences_frame.cpp \
display_filter_combo.cpp \
display_filter_edit.cpp \
diff --git a/ui/qt/QtShark.pro b/ui/qt/QtShark.pro
index 0f0eaf9b02..5280dd79e9 100644
--- a/ui/qt/QtShark.pro
+++ b/ui/qt/QtShark.pro
@@ -202,7 +202,8 @@ FORMS += main_window.ui \
main_window_preferences_frame.ui \
layout_preferences_frame.ui \
column_preferences_frame.ui \
- font_color_preferences_frame.ui
+ font_color_preferences_frame.ui \
+ capture_preferences_frame.ui
win32 { ## These should be in config.pri ??
!isEmpty(PORTAUDIO_DIR) {
@@ -240,7 +241,8 @@ HEADERS += $$HEADERS_WS_C \
main_window_preferences_frame.h \
layout_preferences_frame.h \
column_preferences_frame.h \
- font_color_preferences_frame.h
+ font_color_preferences_frame.h \
+ capture_preferences_frame.h
win32 {
OBJECTS_WS_C = $$SOURCES_WS_C
@@ -462,4 +464,5 @@ SOURCES += \
main_window_preferences_frame.cpp \
layout_preferences_frame.cpp \
column_preferences_frame.cpp \
- font_color_preferences_frame.cpp
+ font_color_preferences_frame.cpp \
+ capture_preferences_frame.cpp
diff --git a/ui/qt/capture_preferences_frame.cpp b/ui/qt/capture_preferences_frame.cpp
new file mode 100644
index 0000000000..d7d0a40505
--- /dev/null
+++ b/ui/qt/capture_preferences_frame.cpp
@@ -0,0 +1,137 @@
+/* capture_preferences_frame.cpp
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "capture_preferences_frame.h"
+#include "ui_capture_preferences_frame.h"
+
+#include <QSpacerItem>
+
+#include "capture_ui_utils.h"
+
+#include <epan/prefs-int.h>
+
+CapturePreferencesFrame::CapturePreferencesFrame(QWidget *parent) :
+ QFrame(parent),
+ ui(new Ui::CapturePreferencesFrame)
+{
+ ui->setupUi(this);
+
+ pref_device_ = prefFromPrefPtr(&prefs.capture_device);
+ pref_prom_mode_ = prefFromPrefPtr(&prefs.capture_prom_mode);
+ pref_pcap_ng_ = prefFromPrefPtr(&prefs.capture_pcap_ng);
+ pref_real_time_ = prefFromPrefPtr(&prefs.capture_real_time);
+ pref_auto_scroll_ = prefFromPrefPtr(&prefs.capture_auto_scroll);
+ pref_show_info_ = prefFromPrefPtr(&prefs.capture_show_info);
+
+ // Setting the left margin via a style sheet clobbers its
+ // appearance.
+ int margin = style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
+ QRect geom = ui->defaultInterfaceSpacer->geometry();
+ geom.setWidth(margin);
+ ui->defaultInterfaceSpacer->setGeometry(geom);
+}
+
+CapturePreferencesFrame::~CapturePreferencesFrame()
+{
+ delete ui;
+}
+
+void CapturePreferencesFrame::showEvent(QShowEvent *evt)
+{
+ Q_UNUSED(evt);
+ updateWidgets();
+}
+
+void CapturePreferencesFrame::updateWidgets()
+{
+ GList *if_list, *combo_list, *combo_entry;
+ int err;
+
+ ui->defaultInterfaceComboBox->clear();
+ if_list = capture_interface_list(&err, NULL);
+ combo_list = build_capture_combo_list(if_list, FALSE);
+ free_interface_list(if_list);
+ for (combo_entry = combo_list; combo_entry != NULL && combo_entry->data != NULL; combo_entry = g_list_next(combo_entry)) {
+ ui->defaultInterfaceComboBox->addItem(QString((const char *)combo_entry->data));
+ }
+
+ if (pref_device_->stashed_val.string) {
+ ui->defaultInterfaceComboBox->setEditText(pref_device_->stashed_val.string);
+ } else {
+ ui->defaultInterfaceComboBox->clearEditText();
+ }
+
+ ui->capturePromModeCheckBox->setChecked(pref_prom_mode_->stashed_val.boolval);
+ ui->capturePcapNgCheckBox->setChecked(pref_pcap_ng_->stashed_val.boolval);
+ ui->captureRealTimeCheckBox->setChecked(pref_real_time_->stashed_val.boolval);
+ ui->captureAutoScrollCheckBox->setChecked(pref_auto_scroll_->stashed_val.boolval);
+ ui->captureShowInfoCheckBox->setChecked(pref_show_info_->stashed_val.boolval);
+}
+
+void CapturePreferencesFrame::on_defaultInterfaceComboBox_editTextChanged(const QString &new_iface)
+{
+ g_free((void *)pref_device_->stashed_val.string);
+ pref_device_->stashed_val.string = g_strdup(new_iface.toUtf8().constData());
+}
+
+void CapturePreferencesFrame::on_capturePromModeCheckBox_toggled(bool checked)
+{
+ pref_prom_mode_->stashed_val.boolval = checked;
+}
+
+void CapturePreferencesFrame::on_capturePcapNgCheckBox_toggled(bool checked)
+{
+ pref_pcap_ng_->stashed_val.boolval = checked;
+}
+
+void CapturePreferencesFrame::on_captureRealTimeCheckBox_toggled(bool checked)
+{
+ pref_real_time_->stashed_val.boolval = checked;
+}
+
+void CapturePreferencesFrame::on_captureAutoScrollCheckBox_toggled(bool checked)
+{
+ pref_auto_scroll_->stashed_val.boolval = checked;
+}
+
+void CapturePreferencesFrame::on_captureShowInfoCheckBox_toggled(bool checked)
+{
+ pref_show_info_->stashed_val.boolval = checked;
+}
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/qt/capture_preferences_frame.h b/ui/qt/capture_preferences_frame.h
new file mode 100644
index 0000000000..670253a850
--- /dev/null
+++ b/ui/qt/capture_preferences_frame.h
@@ -0,0 +1,67 @@
+/* capture_preferences_frame.h
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef CAPTURE_PREFERENCES_FRAME_H
+#define CAPTURE_PREFERENCES_FRAME_H
+
+#include "preferences_dialog.h"
+
+#include <QFrame>
+
+namespace Ui {
+class CapturePreferencesFrame;
+}
+
+class CapturePreferencesFrame : public QFrame
+{
+ Q_OBJECT
+
+public:
+ explicit CapturePreferencesFrame(QWidget *parent = 0);
+ ~CapturePreferencesFrame();
+
+protected:
+ void showEvent(QShowEvent *evt);
+
+private slots:
+ void on_defaultInterfaceComboBox_editTextChanged(const QString &new_iface);
+ void on_capturePromModeCheckBox_toggled(bool checked);
+ void on_capturePcapNgCheckBox_toggled(bool checked);
+ void on_captureRealTimeCheckBox_toggled(bool checked);
+ void on_captureAutoScrollCheckBox_toggled(bool checked);
+ void on_captureShowInfoCheckBox_toggled(bool checked);
+
+private:
+ Ui::CapturePreferencesFrame *ui;
+
+ pref_t *pref_device_;
+ pref_t *pref_prom_mode_;
+ pref_t *pref_pcap_ng_;
+ pref_t *pref_real_time_;
+ pref_t *pref_auto_scroll_;
+ pref_t *pref_show_info_;
+
+ void updateWidgets();
+};
+
+#endif // CAPTURE_PREFERENCES_FRAME_H
diff --git a/ui/qt/capture_preferences_frame.ui b/ui/qt/capture_preferences_frame.ui
new file mode 100644
index 0000000000..0f763333fe
--- /dev/null
+++ b/ui/qt/capture_preferences_frame.ui
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CapturePreferencesFrame</class>
+ <widget class="QFrame" name="CapturePreferencesFrame">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>354</width>
+ <height>194</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>191</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Frame</string>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Default interface</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="defaultInterfaceSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>18</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QComboBox" name="defaultInterfaceComboBox">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="capturePromModeCheckBox">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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 &amp;quot;see&amp;quot;, mark this option. See the FAQ for some more details of capturing packets from a switched network.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>Capture packets in promiscuous mode</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="capturePcapNgCheckBox">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Capture packets in the next-generation capture file format.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>Capture packets in pcap-ng format</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="captureRealTimeCheckBox">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Update the list of packets while capture is in progress. This can result in dropped packets on high-speed networks.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>Update list of packets in real time</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="captureAutoScrollCheckBox">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Keep the packet list scrolled to the bottom while capturing.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>Automatic scrolling in live capture</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="captureShowInfoCheckBox">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show the capture summary dialog while capturing.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>Show the capture summary dialog while capturing</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>3</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui/qt/main_window_preferences_frame.ui b/ui/qt/main_window_preferences_frame.ui
index d036987b65..7a4e8af51c 100644
--- a/ui/qt/main_window_preferences_frame.ui
+++ b/ui/qt/main_window_preferences_frame.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>425</width>
- <height>373</height>
+ <height>384</height>
</rect>
</property>
<property name="sizePolicy">
@@ -16,6 +16,12 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>384</height>
+ </size>
+ </property>
<property name="windowTitle">
<string>Frame</string>
</property>
@@ -278,6 +284,19 @@
</item>
</layout>
</item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>1</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
<resources/>
diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp
index 24d43f9b45..cf40f1c0f1 100644
--- a/ui/qt/preferences_dialog.cpp
+++ b/ui/qt/preferences_dialog.cpp
@@ -218,6 +218,9 @@ void PreferencesDialog::showEvent(QShowEvent *evt)
int new_prefs_tree_width = pd_ui_->prefsTree->style()->subElementRect(QStyle::SE_TreeViewDisclosureItem, &style_opt).left();
QList<int> sizes = pd_ui_->splitter->sizes();
+#ifdef Q_WS_WIN
+ new_prefs_tree_width *= 2;
+#endif
pd_ui_->prefsTree->resizeColumnToContents(0);
new_prefs_tree_width += pd_ui_->prefsTree->columnWidth(0);
pd_ui_->prefsTree->setMinimumWidth(new_prefs_tree_width);
diff --git a/ui/qt/preferences_dialog.ui b/ui/qt/preferences_dialog.ui
index cc710080c7..1ea043de7b 100644
--- a/ui/qt/preferences_dialog.ui
+++ b/ui/qt/preferences_dialog.ui
@@ -61,9 +61,6 @@
<property name="text">
<string>Capture</string>
</property>
- <property name="flags">
- <set>ItemIsDragEnabled|ItemIsUserCheckable</set>
- </property>
</item>
<item>
<property name="text">
@@ -110,14 +107,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="currentIndex">
- <number>0</number>
- </property>
<widget class="MainWindowPreferencesFrame" name="appearanceFrame"/>
<widget class="LayoutPreferencesFrame" name="layoutFrame"/>
<widget class="ColumnPreferencesFrame" name="columnFrame"/>
<widget class="FontColorPreferencesFrame" name="fontandcolorFrame"/>
- <widget class="QFrame" name="captureFrame"/>
+ <widget class="CapturePreferencesFrame" name="captureFrame"/>
<widget class="QFrame" name="filterFrame"/>
<widget class="QFrame" name="nameresolutionFrame"/>
<widget class="QFrame" name="protocolsFrame"/>
@@ -220,6 +214,12 @@
<header>font_color_preferences_frame.h</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>CapturePreferencesFrame</class>
+ <extends>QFrame</extends>
+ <header>capture_preferences_frame.h</header>
+ <container>1</container>
+ </customwidget>
</customwidgets>
<resources/>
<connections>