summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ui/qt/QtShark.pro3
-rw-r--r--ui/qt/interface_tree.cpp24
-rw-r--r--ui/qt/main_welcome.cpp132
-rw-r--r--ui/qt/main_welcome.h8
-rw-r--r--ui/qt/main_welcome.ui189
-rw-r--r--ui/qt/main_window.cpp134
-rw-r--r--ui/qt/main_window.h14
7 files changed, 332 insertions, 172 deletions
diff --git a/ui/qt/QtShark.pro b/ui/qt/QtShark.pro
index 7834c38389..e757d43b29 100644
--- a/ui/qt/QtShark.pro
+++ b/ui/qt/QtShark.pro
@@ -238,7 +238,8 @@ HEADERS_QT_CPP = \
sparkline_delegate.h \
wireshark_application.h
-FORMS += main_window.ui
+FORMS += main_window.ui \
+ main_welcome.ui
win32 { ## These should be in config.pri ??
!isEmpty(PORTAUDIO_DIR) {
diff --git a/ui/qt/interface_tree.cpp b/ui/qt/interface_tree.cpp
index d594b0efe5..6269208013 100644
--- a/ui/qt/interface_tree.cpp
+++ b/ui/qt/interface_tree.cpp
@@ -48,17 +48,7 @@ InterfaceTree::InterfaceTree(QWidget *parent) :
setRootIsDecorated(false);
setUniformRowHeights(true);
setColumnCount(2);
-#ifdef Q_WS_MAC
- setAttribute(Qt::WA_MacShowFocusRect, false);
-#endif
setAccessibleName(tr("Welcome screen list"));
- setColumnWidth(1, 10);
-
- setStyleSheet(
- "QTreeWidget {"
- " border: 0;"
- "}"
- );
m_statCache = NULL;
m_statTimer = new QTimer(this);
@@ -70,13 +60,10 @@ InterfaceTree::InterfaceTree(QWidget *parent) :
if_list = g_list_sort(if_list, if_list_comparator_alph);
if (if_list == NULL && err == CANT_GET_INTERFACE_LIST) {
- ti = new QTreeWidgetItem();
- QLabel *label = new QLabel(QString(tr("<h3>No interfaces found</h3>%1")).arg(QString().fromUtf8(err_str)));
- label->setWordWrap(true);
-
setDisabled(true);
+ ti = new QTreeWidgetItem();
+ ti->setText(0, QString(tr("No interfaces found\n%1")).arg(QString().fromUtf8(err_str)));
addTopLevelItem(ti);
- setItemWidget(ti, 0, label);
return;
} else if (err_str) {
g_free(err_str);
@@ -144,6 +131,9 @@ void InterfaceTree::hideEvent(QHideEvent *evt) {
void InterfaceTree::showEvent(QShowEvent *evt) {
Q_UNUSED(evt);
+ // XXX The column disappears otherwise.
+ setColumnWidth(1, 10);
+
m_statTimer->start(1000);
}
@@ -159,6 +149,8 @@ void InterfaceTree::updateStatistics(void) {
}
if (!m_statCache) return;
+ qDebug() << "cw0" << columnWidth(0) << "cw1" << columnWidth(1);
+
QTreeWidgetItemIterator iter(this);
while (*iter) {
QList<int> *points;
@@ -166,7 +158,6 @@ void InterfaceTree::updateStatistics(void) {
for (if_idx = 0; if_idx < global_capture_opts.all_ifaces->len; if_idx++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, if_idx);
-
if ((*iter)->text(0).compare(QString().fromUtf8(device.name)) || device.hidden || device.type == IF_PIPE)
continue;
@@ -184,7 +175,6 @@ void InterfaceTree::updateStatistics(void) {
update(indexFromItem((*iter), 1));
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, if_idx);
g_array_insert_val(global_capture_opts.all_ifaces, if_idx, device);
-
}
iter++;
}
diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp
index 800aafc799..46b4428aa4 100644
--- a/ui/qt/main_welcome.cpp
+++ b/ui/qt/main_welcome.cpp
@@ -30,20 +30,12 @@
#include "version_info.h"
#include "main_welcome.h"
+#include "ui_main_welcome.h"
#include "wireshark_application.h"
#include "interface_tree.h"
#include <QWidget>
-#include <QGridLayout>
-#include <QVBoxLayout>
-#include <QPainter>
-#include <QPen>
-#include <QResizeEvent>
-#include <QGraphicsBlurEffect>
-#include <QLabel>
-#include <QHeaderView>
-#include <QFont>
//MWOverlay::MWOverlay(QWidget *parent) : QWidget(parent)
//{
@@ -76,52 +68,51 @@
MainWelcome::MainWelcome(QWidget *parent) :
- QFrame(parent)
+ QFrame(parent),
+ welcome_ui_(new Ui::MainWelcome)
+
{
- QGridLayout *grid = new QGridLayout(this);
- QVBoxLayout *column;
- QLabel *heading;
+// QGridLayout *grid = new QGridLayout(this);
+// QVBoxLayout *column;
+// QLabel *heading;
InterfaceTree *iface_tree;
- setStyleSheet(
- "QFrame {"
- " background: palette(base);"
- " }"
- );
-
-// grid->setContentsMargins (0, 0, 0, 0);
- grid->setColumnStretch(0, 60);
-
- // Banner row, 3 column span
- QString banner = QString(tr("Wireshark"));
- heading = new QLabel(banner);
- grid->addWidget(heading, 0, 0, 1, 3);
+ welcome_ui_->setupUi(this);
+ task_list_ = welcome_ui_->taskList;
+ iface_tree = welcome_ui_->interfaceTree;
+ recent_files_ = welcome_ui_->recentList;
- // Column 1: Capture
- column = new QVBoxLayout();
- grid->addLayout(column, 1, 0, Qt::AlignTop);
-
- heading = new QLabel(tr("<h1>Capture</h1>"));
- column->addWidget(heading);
-
- iface_tree = new InterfaceTree(this);
- column->addWidget(iface_tree);
-
- heading = new QLabel(tr("<h1>Capture Help</h1>"));
- column->addWidget(heading);
-
- // Column 2: Files
- column = new QVBoxLayout();
- grid->addLayout(column, 1, 1, Qt::AlignTop);
- grid->setColumnStretch(1, 70);
+ setStyleSheet(
+ "QFrame {"
+ " background: palette(base);"
+ " }"
+ "QListWidget {"
+ " border: 0;"
+ "}"
+ "QListWidget::focus {"
+ " border: 1px dotted palette(mid);"
+ " background-color: palette(midlight);"
+ "}"
+ "QListWidget::item::hover {"
+ " background-color: palette(highlight);"
+ " color: palette(highlighted-text);"
+ "}"
+ "QTreeWidget {"
+ " border: 0;"
+ "}"
+ "QTreeWidget::focus {"
+ " border: 1px dotted palette(mid);"
+ " background-color: palette(midlight);"
+ "}"
+ );
- heading = new QLabel(tr("<h1>Recent Files</h1>"));
- column->addWidget(heading);
+#ifdef Q_WS_MAC
+ recent_files_->setAttribute(Qt::WA_MacShowFocusRect, false);
+ welcome_ui_->taskList->setAttribute(Qt::WA_MacShowFocusRect, false);
+ iface_tree->setAttribute(Qt::WA_MacShowFocusRect, false);
+#endif
- m_recent_files.setStyleSheet(
- "QListWidget {"
- " border: 0;"
- "}"
+ recent_files_->setStyleSheet(
"QListWidget::item {"
" padding-top: 0.1em;"
" padding-bottom: 0.1em;"
@@ -132,38 +123,21 @@ MainWelcome::MainWelcome(QWidget *parent) :
"QListWidget::item::last {"
" padding-bottom: 0;"
"}"
- "QListWidget::item::hover {"
- " background-color: palette(highlight);"
- " color: palette(highlighted-text);"
- "}"
);
- m_recent_files.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-#ifdef Q_WS_MAC
- m_recent_files.setAttribute(Qt::WA_MacShowFocusRect, false);
-#endif
- m_recent_files.setTextElideMode(Qt::ElideLeft);
- column->addWidget(&m_recent_files);
+ recent_files_->setTextElideMode(Qt::ElideLeft);
+
connect(wsApp, SIGNAL(updateRecentItemStatus(const QString &, qint64, bool)), this, SLOT(updateRecentFiles()));
- connect(&m_recent_files, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(openRecentItem(QListWidgetItem *)));
+ connect(task_list_, SIGNAL(itemSelectionChanged()), this, SLOT(showTask()));
+ connect(recent_files_, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(openRecentItem(QListWidgetItem *)));
updateRecentFiles();
- // Column 3: Online Resources
- column = new QVBoxLayout();
- grid->addLayout(column, 1, 2, Qt::AlignTop);
- grid->setColumnStretch(2, 50);
-
- heading = new QLabel(tr("<h1>Online</h1>"));
- column->addWidget(heading);
-
- // Sigh. This doesn't work in Qt 4.7 on OS X.
-// QGraphicsBlurEffect *effect = new QGraphicsBlurEffect(this) ;
-// effect->setBlurRadius(10);
-// effect->setBlurHints(QGraphicsBlurEffect::QualityHint);
-// setGraphicsEffect( effect );
-// overlay = new MWOverlay(this);
+ task_list_->setCurrentRow(0);
}
+void MainWelcome::showTask() {
+ welcome_ui_->taskStack->setCurrentIndex(task_list_->currentRow());
+}
void MainWelcome::updateRecentFiles() {
QString itemLabel;
@@ -174,8 +148,8 @@ void MainWelcome::updateRecentFiles() {
foreach (recent_item_status *ri, wsApp->recent_item_list()) {
itemLabel = ri->filename;
- if (rfRow >= m_recent_files.count()) {
- m_recent_files.addItem(itemLabel);
+ if (rfRow >= recent_files_->count()) {
+ recent_files_->addItem(itemLabel);
}
itemLabel.append(" (");
@@ -194,7 +168,7 @@ void MainWelcome::updateRecentFiles() {
}
itemLabel.append(")");
rfFont.setItalic(!ri->accessible);
- rfItem = m_recent_files.item(rfRow);
+ rfItem = recent_files_->item(rfRow);
rfItem->setText(itemLabel);
rfItem->setData(Qt::UserRole, ri->filename);
rfItem->setFlags(ri->accessible ? Qt::ItemIsSelectable | Qt::ItemIsEnabled : Qt::NoItemFlags);
@@ -202,8 +176,8 @@ void MainWelcome::updateRecentFiles() {
rfRow++;
}
- while (m_recent_files.count() > (int) prefs.gui_recent_files_count_max) {
- m_recent_files.takeItem(m_recent_files.count());
+ while (recent_files_->count() > (int) prefs.gui_recent_files_count_max) {
+ recent_files_->takeItem(recent_files_->count());
}
}
diff --git a/ui/qt/main_welcome.h b/ui/qt/main_welcome.h
index 9992cbb971..c3759596f9 100644
--- a/ui/qt/main_welcome.h
+++ b/ui/qt/main_welcome.h
@@ -36,6 +36,9 @@
// void paintEvent(QPaintEvent *event);
//};
+namespace Ui {
+ class MainWelcome;
+}
class MainWelcome : public QFrame
{
@@ -49,7 +52,9 @@ protected:
private:
// QListWidget doesn't activate items when the return or enter keys are pressed on OS X.
// We may want to subclass it at some point.
- QListWidget m_recent_files;
+ Ui::MainWelcome *welcome_ui_;
+ QListWidget *task_list_;
+ QListWidget *recent_files_;
// MWOverlay *overlay;
@@ -57,6 +62,7 @@ signals:
void recentFileActivated(QString& cfile);
private slots:
+ void showTask();
void updateRecentFiles();
void openRecentItem(QListWidgetItem *item);
diff --git a/ui/qt/main_welcome.ui b/ui/qt/main_welcome.ui
new file mode 100644
index 0000000000..9d4c7baf05
--- /dev/null
+++ b/ui/qt/main_welcome.ui
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWelcome</class>
+ <widget class="QWidget" name="MainWelcome">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>811</width>
+ <height>533</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <widget class="QWidget" name="layoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>743</width>
+ <height>481</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" colspan="2">
+ <widget class="QLabel" name="mainWelcomeBanner">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Wireshark&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QStackedWidget" name="taskStack">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="capturePage">
+ <widget class="InterfaceTree" name="interfaceTree">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>521</width>
+ <height>421</height>
+ </rect>
+ </property>
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="columnCount">
+ <number>2</number>
+ </property>
+ <attribute name="headerVisible">
+ <bool>false</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string notr="true">2</string>
+ </property>
+ </column>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="recentPage">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QListWidget" name="recentList">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>521</width>
+ <height>431</height>
+ </rect>
+ </property>
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="helpPage">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QLabel" name="helpLinks">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>321</width>
+ <height>391</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;User's Guide&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Wiki&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QListWidget" name="taskList">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>5</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="verticalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="autoScroll">
+ <bool>false</bool>
+ </property>
+ <item>
+ <property name="text">
+ <string>Capture
+live packets from the network</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Open
+recent capture files</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Learn
+more about Wireshark</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>InterfaceTree</class>
+ <extends>QTreeWidget</extends>
+ <header>interface_tree.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index c0d3a6b968..e320c1a866 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -52,24 +52,24 @@
//menu_recent_file_write_all
// If we ever add support for multiple windows this will need to be replaced.
-static MainWindow *cur_main_window = NULL;
+static MainWindow *gbl_cur_main_window = NULL;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
- ui(new Ui::MainWindow)
+ main_ui_(new Ui::MainWindow)
{
- capFile = NULL;
- cur_main_window = this;
- ui->setupUi(this);
+ cap_file_ = NULL;
+ gbl_cur_main_window = this;
+ main_ui_->setupUi(this);
connect(wsApp, SIGNAL(updateRecentItemStatus(const QString &, qint64, bool)), this, SLOT(updateRecentFiles()));
updateRecentFiles();
- dfComboBox = new DisplayFilterCombo();
- const DisplayFilterEdit *dfEdit = dynamic_cast<DisplayFilterEdit *>(dfComboBox->lineEdit());
- connect(dfEdit, SIGNAL(pushFilterSyntaxStatus(QString&)), ui->statusBar, SLOT(pushFilterStatus(QString&)));
- connect(dfEdit, SIGNAL(popFilterSyntaxStatus()), ui->statusBar, SLOT(popFilterStatus()));
- connect(dfEdit, SIGNAL(pushFilterSyntaxWarning(QString&)), ui->statusBar, SLOT(pushTemporaryStatus(QString&)));
+ df_combo_box_ = new DisplayFilterCombo();
+ const DisplayFilterEdit *dfEdit = dynamic_cast<DisplayFilterEdit *>(df_combo_box_->lineEdit());
+ connect(dfEdit, SIGNAL(pushFilterSyntaxStatus(QString&)), main_ui_->statusBar, SLOT(pushFilterStatus(QString&)));
+ connect(dfEdit, SIGNAL(popFilterSyntaxStatus()), main_ui_->statusBar, SLOT(popFilterStatus()));
+ connect(dfEdit, SIGNAL(pushFilterSyntaxWarning(QString&)), main_ui_->statusBar, SLOT(pushTemporaryStatus(QString&)));
#ifdef _WIN32
// Qt <= 4.7 doesn't seem to style Windows toolbars. If we wanted to be really fancy we could use Blur Behind:
@@ -80,33 +80,33 @@ MainWindow::MainWindow(QWidget *parent) :
"}"
);
#endif
- ui->mainToolBar->addWidget(dfComboBox);
+ main_ui_->mainToolBar->addWidget(df_combo_box_);
- splitterV = new QSplitter(ui->mainStack);
- splitterV->setObjectName(QString::fromUtf8("splitterV"));
- splitterV->setOrientation(Qt::Vertical);
+ splitter_v_ = new QSplitter(main_ui_->mainStack);
+ splitter_v_->setObjectName(QString::fromUtf8("splitterV"));
+ splitter_v_->setOrientation(Qt::Vertical);
- m_packetList = new PacketList(splitterV);
+ packet_list_ = new PacketList(splitter_v_);
- ProtoTree *protoTree = new ProtoTree(splitterV);
+ ProtoTree *protoTree = new ProtoTree(splitter_v_);
protoTree->setHeaderHidden(true);
- ByteViewTab *byteViewTab = new ByteViewTab(splitterV);
+ ByteViewTab *byteViewTab = new ByteViewTab(splitter_v_);
byteViewTab->setTabPosition(QTabWidget::South);
byteViewTab->setDocumentMode(true);
- m_packetList->setProtoTree(protoTree);
- m_packetList->setByteViewTab(byteViewTab);
+ packet_list_->setProtoTree(protoTree);
+ packet_list_->setByteViewTab(byteViewTab);
- splitterV->addWidget(m_packetList);
- splitterV->addWidget(protoTree);
- splitterV->addWidget(byteViewTab);
+ splitter_v_->addWidget(packet_list_);
+ splitter_v_->addWidget(protoTree);
+ splitter_v_->addWidget(byteViewTab);
- ui->mainStack->addWidget(splitterV);
+ main_ui_->mainStack->addWidget(splitter_v_);
- mainWelcome = new MainWelcome(ui->mainStack);
- ui->mainStack->addWidget(mainWelcome);
- connect(mainWelcome, SIGNAL(recentFileActivated(QString&)),
+ main_welcome_ = new MainWelcome(main_ui_->mainStack);
+ main_ui_->mainStack->addWidget(main_welcome_);
+ connect(main_welcome_, SIGNAL(recentFileActivated(QString&)),
this, SLOT(on_actionFileOpen_triggered(QString&)));
connect(wsApp, SIGNAL(captureFileReadStarted(const capture_file*)),
@@ -118,55 +118,55 @@ MainWindow::MainWindow(QWidget *parent) :
connect(wsApp, SIGNAL(captureFileClosed(const capture_file*)),
this, SLOT(captureFileClosed(const capture_file*)));
- connect(ui->actionGoNextPacket, SIGNAL(triggered()),
- m_packetList, SLOT(goNextPacket()));
- connect(ui->actionGoPreviousPacket, SIGNAL(triggered()),
- m_packetList, SLOT(goPreviousPacket()));
- connect(ui->actionGoFirstPacket, SIGNAL(triggered()),
- m_packetList, SLOT(goFirstPacket()));
- connect(ui->actionGoLastPacket, SIGNAL(triggered()),
- m_packetList, SLOT(goLastPacket()));
+ connect(main_ui_->actionGoNextPacket, SIGNAL(triggered()),
+ packet_list_, SLOT(goNextPacket()));
+ connect(main_ui_->actionGoPreviousPacket, SIGNAL(triggered()),
+ packet_list_, SLOT(goPreviousPacket()));
+ connect(main_ui_->actionGoFirstPacket, SIGNAL(triggered()),
+ packet_list_, SLOT(goFirstPacket()));
+ connect(main_ui_->actionGoLastPacket, SIGNAL(triggered()),
+ packet_list_, SLOT(goLastPacket()));
- connect(ui->actionViewExpandSubtrees, SIGNAL(triggered()),
+ connect(main_ui_->actionViewExpandSubtrees, SIGNAL(triggered()),
protoTree, SLOT(expandSubtrees()));
- connect(ui->actionViewExpandAll, SIGNAL(triggered()),
+ connect(main_ui_->actionViewExpandAll, SIGNAL(triggered()),
protoTree, SLOT(expandAll()));
- connect(ui->actionViewCollapseAll, SIGNAL(triggered()),
+ connect(main_ui_->actionViewCollapseAll, SIGNAL(triggered()),
protoTree, SLOT(collapseAll()));
connect(protoTree, SIGNAL(protoItemSelected(QString&)),
- ui->statusBar, SLOT(pushFieldStatus(QString&)));
+ main_ui_->statusBar, SLOT(pushFieldStatus(QString&)));
connect(protoTree, SIGNAL(protoItemSelected(bool)),
- ui->actionViewExpandSubtrees, SLOT(setEnabled(bool)));
+ main_ui_->actionViewExpandSubtrees, SLOT(setEnabled(bool)));
- ui->mainStack->setCurrentWidget(mainWelcome);
+ main_ui_->mainStack->setCurrentWidget(main_welcome_);
}
MainWindow::~MainWindow()
{
- delete ui;
+ delete main_ui_;
}
void MainWindow::keyPressEvent(QKeyEvent *event) {
// Explicitly focus on the display filter combo.
if (event->modifiers() & Qt::ControlModifier && event->key() == Qt::Key_Slash) {
- dfComboBox->setFocus(Qt::ShortcutFocusReason);
+ df_combo_box_->setFocus(Qt::ShortcutFocusReason);
return;
}
// The user typed some text. Start filling in a filter.
// XXX We need to install an event filter for the packet list and proto tree
if ((event->modifiers() == Qt::NoModifier || event->modifiers() == Qt::ShiftModifier) && event->text().length() > 0) {
- QApplication::sendEvent(dfComboBox, event);
+ QApplication::sendEvent(df_combo_box_, event);
}
// Move up & down the packet list.
if (event->key() == Qt::Key_F7) {
- m_packetList->goPreviousPacket();
+ packet_list_->goPreviousPacket();
} else if (event->key() == Qt::Key_F8) {
- m_packetList->goNextPacket();
+ packet_list_->goNextPacket();
}
// Move along, citizen.
@@ -174,21 +174,21 @@ void MainWindow::keyPressEvent(QKeyEvent *event) {
}
void MainWindow::captureFileReadStarted(const capture_file *cf) {
- if (cf != capFile) return;
+ if (cf != cap_file_) return;
// tap_param_dlg_update();
/* Set up main window for a capture file. */
// main_set_for_capture_file(TRUE);
- ui->statusBar->popFileStatus();
+ main_ui_->statusBar->popFileStatus();
QString msg = QString(tr("Loading: %1")).arg(get_basename(cf->filename));
- ui->statusBar->pushFileStatus(msg);
- ui->mainStack->setCurrentWidget(splitterV);
+ main_ui_->statusBar->pushFileStatus(msg);
+ main_ui_->mainStack->setCurrentWidget(splitter_v_);
WiresharkApplication::processEvents();
}
void MainWindow::captureFileReadFinished(const capture_file *cf) {
- if (cf != capFile) return;
+ if (cf != cap_file_) return;
// gchar *dir_path;
@@ -210,16 +210,16 @@ void MainWindow::captureFileReadFinished(const capture_file *cf) {
// /* Enable menu items that make sense if you have some captured packets. */
// set_menus_for_captured_packets(TRUE);
- ui->statusBar->popFileStatus();
+ main_ui_->statusBar->popFileStatus();
QString msg = QString().sprintf("%s", get_basename(cf->filename));
- ui->statusBar->pushFileStatus(msg);
+ main_ui_->statusBar->pushFileStatus(msg);
}
void MainWindow::captureFileClosing(const capture_file *cf) {
- if (cf != capFile) return;
+ if (cf != cap_file_) return;
// Reset expert info indicator
- ui->statusBar->hideExpert();
+ main_ui_->statusBar->hideExpert();
// gtk_widget_show(expert_info_none);
}
@@ -262,14 +262,14 @@ void MainWindow::on_actionHelpSampleCaptures_triggered() {
}
void MainWindow::captureFileClosed(const capture_file *cf) {
- if (cf != capFile) return;
+ if (cf != cap_file_) return;
packets_bar_update();
// Reset expert info indicator
- ui->statusBar->hideExpert();
+ main_ui_->statusBar->hideExpert();
- ui->statusBar->popFileStatus();
- capFile = NULL;
+ main_ui_->statusBar->popFileStatus();
+ cap_file_ = NULL;
}
// XXX - Copied from ui/gtk/menus.c
@@ -283,7 +283,7 @@ void MainWindow::captureFileClosed(const capture_file *cf) {
// XXX - We should probably create a RecentFile class.
void MainWindow::updateRecentFiles() {
QAction *ra;
- QMenu *recentMenu = ui->menuOpenRecentCaptureFile;
+ QMenu *recentMenu = main_ui_->menuOpenRecentCaptureFile;
QString action_cf_name;
if (!recentMenu) {
@@ -323,8 +323,8 @@ void MainWindow::updateRecentFiles() {
recentMenu->insertAction(NULL, ra);
connect(ra, SIGNAL(triggered()), wsApp, SLOT(clearRecentItems()));
} else {
- if (ui->actionDummyNoFilesFound) {
- recentMenu->addAction(ui->actionDummyNoFilesFound);
+ if (main_ui_->actionDummyNoFilesFound) {
+ recentMenu->addAction(main_ui_->actionDummyNoFilesFound);
}
}
}
@@ -336,7 +336,7 @@ void MainWindow::on_actionFileOpen_triggered(QString &cfPath)
dfilter_t *rfcode = NULL;
int err;
- capFile = NULL;
+ cap_file_ = NULL;
for (;;) {
@@ -376,7 +376,7 @@ void MainWindow::on_actionFileOpen_triggered(QString &cfPath)
continue;
}
- capFile = &cfile;
+ cap_file_ = &cfile;
cfile.window = this;
switch (cf_read(&cfile, FALSE)) {
@@ -393,21 +393,21 @@ void MainWindow::on_actionFileOpen_triggered(QString &cfPath)
capture file has been closed - just free the capture file name
string and return (without changing the last containing
directory). */
- capFile = NULL;
+ cap_file_ = NULL;
return;
}
break;
}
// get_dirname overwrites its path. Hopefully this isn't a problem.
set_last_open_dir(get_dirname(cfPath.toUtf8().data()));
- dfComboBox->setEditText(displayFilter);
+ df_combo_box_->setEditText(displayFilter);
- ui->statusBar->showExpert();
+ main_ui_->statusBar->showExpert();
}
void MainWindow::on_actionFileClose_triggered() {
cf_close(&cfile);
- ui->mainStack->setCurrentWidget(mainWelcome);
+ main_ui_->mainStack->setCurrentWidget(main_welcome_);
}
void MainWindow::recentActionTriggered() {
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index 995f50321e..e65cba8796 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -57,13 +57,13 @@ protected:
void keyPressEvent(QKeyEvent *event);
private:
- Ui::MainWindow *ui;
- QMenu *openRecentMenu;
- QSplitter *splitterV;
- MainWelcome *mainWelcome;
- DisplayFilterCombo *dfComboBox;
- capture_file *capFile;
- PacketList *m_packetList;
+ Ui::MainWindow *main_ui_;
+ QMenu *open_recent_menu_;
+ QSplitter *splitter_v_;
+ MainWelcome *main_welcome_;
+ DisplayFilterCombo *df_combo_box_;
+ capture_file *cap_file_;
+ PacketList *packet_list_;
signals:
void showProgress(progdlg_t **dlg_p, bool animate, const QString message, bool terminate_is_stop, bool *stop_flag, float pct);