summaryrefslogtreecommitdiff
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2012-10-15 18:32:51 +0000
committerGerald Combs <gerald@wireshark.org>2012-10-15 18:32:51 +0000
commit9051385deb6a3f318da44862ae17c33be2b04fec (patch)
treecd536ed0796af408eb496311dd6039d11d0b6857 /ui/qt
parent4ee129c34181d7073dc47e5fffeb80ec465247b6 (diff)
downloadwireshark-9051385deb6a3f318da44862ae17c33be2b04fec.tar.gz
Add help buttons. Ifdef out some code on Windows.
svn path=/trunk/; revision=45564
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/capture_file_dialog.cpp41
-rw-r--r--ui/qt/capture_file_dialog.h6
-rw-r--r--ui/qt/export_dissection_dialog.cpp21
-rw-r--r--ui/qt/export_dissection_dialog.h1
-rw-r--r--ui/qt/file_set_dialog.h1
-rw-r--r--ui/qt/qtshark_fr.qmbin25190 -> 25189 bytes
6 files changed, 61 insertions, 9 deletions
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index c73336cddd..bbe660d896 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -47,6 +47,8 @@
#include <QFileInfo>
#include <QMessageBox>
#include <QSpacerItem>
+#include <QDesktopServices>
+#include <QUrl>
#endif // Q_WS_WIN
#include <QDebug>
@@ -125,7 +127,8 @@ CaptureFileDialog::CaptureFileDialog(QWidget *parent, capture_file *cf, QString
display_filter_(display_filter),
#if !defined(Q_WS_WIN)
default_ft_(-1),
- save_bt_(NULL)
+ save_bt_(NULL),
+ help_topic_(TOPIC_ACTION_NONE)
#else
file_type_(-1)
#endif
@@ -147,8 +150,6 @@ CaptureFileDialog::CaptureFileDialog(QWidget *parent, capture_file *cf, QString
h_box->addLayout(&left_v_box_);
h_box->addLayout(&right_v_box_);
- qDebug() << "FIX: CaptureFileDialog help button";
-
#else // Q_WS_WIN
merge_type_ = 0;
#endif // Q_WS_WIN
@@ -498,6 +499,21 @@ void CaptureFileDialog::addRangeControls(QVBoxLayout &v_box, packet_range_t *ran
v_box.addWidget(&packet_range_group_box_, 0, Qt::AlignTop);
}
+QDialogButtonBox *CaptureFileDialog::addHelpButton(topic_action_e help_topic)
+{
+ // This doesn't appear to be documented anywhere but it seems pretty obvious
+ // and it works.
+ QDialogButtonBox *button_box = findChild<QDialogButtonBox *>();
+
+ help_topic_ = help_topic;
+
+ if (button_box) {
+ button_box->addButton(QDialogButtonBox::Help);
+ connect(button_box, SIGNAL(helpRequested()), this, SLOT(on_buttonBox_helpRequested()));
+ }
+ return button_box;
+}
+
int CaptureFileDialog::open(QString &file_name) {
setWindowTitle(tr("Wireshark: Open Capture File"));
setNameFilters(buildFileOpenTypeList());
@@ -506,6 +522,7 @@ int CaptureFileDialog::open(QString &file_name) {
addDisplayFilterEdit();
addResolutionControls(left_v_box_);
addPreview(right_v_box_);
+ addHelpButton(HELP_OPEN_DIALOG);
// Grow the dialog to account for the extra widgets.
resize(width(), height() + left_v_box_.minimumSize().height() + display_filter_edit_->minimumSize().height());
@@ -541,6 +558,7 @@ check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_suppo
setLabelText(FileType, "Save as:");
addGzipControls(left_v_box_);
+ addHelpButton(HELP_SAVE_DIALOG);
// Grow the dialog to account for the extra widgets.
resize(width(), height() + left_v_box_.minimumSize().height());
@@ -557,7 +575,7 @@ check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_suppo
}
check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name, packet_range_t *range) {
- QDialogButtonBox *button_box = findChild<QDialogButtonBox *>();
+ QDialogButtonBox *button_box;
setWindowTitle(tr("Wireshark: Export Specified Packets"));
// XXX See comment in ::saveAs regarding setNameFilters
@@ -567,6 +585,7 @@ check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name,
addRangeControls(left_v_box_, range);
addGzipControls(right_v_box_);
+ button_box = addHelpButton(HELP_EXPORT_FILE_DIALOG);
if (button_box) {
save_bt_ = button_box->button(QDialogButtonBox::Save);
@@ -598,6 +617,7 @@ int CaptureFileDialog::merge(QString &file_name) {
addDisplayFilterEdit();
addMergeControls(left_v_box_);
addPreview(right_v_box_);
+ addHelpButton(HELP_MERGE_DIALOG);
file_name.clear();
display_filter_.clear();
@@ -791,6 +811,19 @@ void CaptureFileDialog::preview(const QString & path)
wtap_close(wth);
}
+void CaptureFileDialog::on_buttonBox_helpRequested()
+{
+ gchar *url;
+
+ if (help_topic_ == TOPIC_ACTION_NONE) return;
+
+ url = topic_action_url(help_topic_);
+ if(url != NULL) {
+ QDesktopServices::openUrl(QUrl(url));
+ g_free(url);
+ }
+}
+
#endif // Q_WS_WINDOWS
/*
diff --git a/ui/qt/capture_file_dialog.h b/ui/qt/capture_file_dialog.h
index 9e49f9e2ba..e873f04c44 100644
--- a/ui/qt/capture_file_dialog.h
+++ b/ui/qt/capture_file_dialog.h
@@ -24,8 +24,11 @@
#ifndef CAPTURE_FILE_DIALOG_H
#define CAPTURE_FILE_DIALOG_H
+#ifndef Q_QS_WIN
#include "display_filter_edit.h"
#include "packet_range_group_box.h"
+#include "ui/help_url.h"
+#endif // Q_WS_WIN
#include "packet_list_record.h"
#include "cfile.h"
@@ -106,6 +109,7 @@ private:
void addResolutionControls(QVBoxLayout &v_box);
void addGzipControls(QVBoxLayout &v_box);
void addRangeControls(QVBoxLayout &v_box, packet_range_t *range);
+ QDialogButtonBox *addHelpButton(topic_action_e help_topic);
QStringList buildFileSaveAsTypeList(bool must_support_comments);
@@ -120,6 +124,7 @@ private:
PacketRangeGroupBox packet_range_group_box_;
QPushButton *save_bt_;
+ topic_action_e help_topic_;
#else // Q_WS_WIN
int file_type_;
@@ -140,6 +145,7 @@ public slots:
private slots:
#if !defined(Q_WS_WIN)
void preview(const QString & path);
+ void on_buttonBox_helpRequested();
#endif // Q_WS_WIN
};
diff --git a/ui/qt/export_dissection_dialog.cpp b/ui/qt/export_dissection_dialog.cpp
index 0fe701335a..59920d04f0 100644
--- a/ui/qt/export_dissection_dialog.cpp
+++ b/ui/qt/export_dissection_dialog.cpp
@@ -66,10 +66,6 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca
setAcceptMode(QFileDialog::AcceptSave);
setLabelText(FileType, "Export as:");
- if (button_box) {
- save_bt_ = button_box->button(QDialogButtonBox::Save);
- }
-
// export_type_map_keys() sorts alphabetically. We don't want that.
name_filters
<< "Plain text (*.txt)"
@@ -100,6 +96,13 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca
h_box->addWidget(&packet_format_group_box_, 0, Qt::AlignTop);
+ if (button_box) {
+ button_box->addButton(QDialogButtonBox::Help);
+ connect(button_box, SIGNAL(helpRequested()), this, SLOT(on_buttonBox_helpRequested()));
+
+ save_bt_ = button_box->button(QDialogButtonBox::Save);
+ }
+
if (save_bt_) {
connect(&packet_range_group_box_, SIGNAL(validityChanged(bool)),
this, SLOT(checkValidity()));
@@ -240,4 +243,14 @@ void ExportDissectionDialog::checkValidity()
save_bt_->setEnabled(enable);
}
+
+void ExportDissectionDialog::on_buttonBox_helpRequested()
+{
+ gchar *url = topic_action_url(HELP_EXPORT_FILE_DIALOG);
+
+ if(url != NULL) {
+ QDesktopServices::openUrl(QUrl(url));
+ g_free(url);
+ }
+}
#endif // Q_WS_WIN
diff --git a/ui/qt/export_dissection_dialog.h b/ui/qt/export_dissection_dialog.h
index 4de468904a..1dd03a0e24 100644
--- a/ui/qt/export_dissection_dialog.h
+++ b/ui/qt/export_dissection_dialog.h
@@ -55,6 +55,7 @@ private slots:
#ifndef Q_WS_WIN
void exportTypeChanged(QString name_filter);
void checkValidity();
+ void on_buttonBox_helpRequested();
#endif // Q_WS_WIN
private:
diff --git a/ui/qt/file_set_dialog.h b/ui/qt/file_set_dialog.h
index 275b9bf6f7..28ceb1b120 100644
--- a/ui/qt/file_set_dialog.h
+++ b/ui/qt/file_set_dialog.h
@@ -55,7 +55,6 @@ signals:
private slots:
void on_buttonBox_helpRequested();
-
void on_fileSetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
private:
diff --git a/ui/qt/qtshark_fr.qm b/ui/qt/qtshark_fr.qm
index d44c18768d..f65defc00a 100644
--- a/ui/qt/qtshark_fr.qm
+++ b/ui/qt/qtshark_fr.qm
Binary files differ