Qt: Add back pathLabel in some dialogs
Add the pathLabel for Coloring Rules, Decode As, Display Filters and Capture Filter. Put the absolute file path into the pathLabel if the file exists. This aligns with UAT dialogs and frames. Change-Id: I72bd06e31bab220de0a0ef8df99df9a4daed667c Reviewed-on: https://code.wireshark.org/review/30089 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
eade1c52cb
commit
e1fc60ddae
|
@ -287,7 +287,7 @@ color_filters_get(gchar** err_msg, color_filter_add_cb_func add_cb)
|
||||||
* Get the path for the file that would have their filters, and
|
* Get the path for the file that would have their filters, and
|
||||||
* try to open it.
|
* try to open it.
|
||||||
*/
|
*/
|
||||||
path = get_persconffile_path("colorfilters", TRUE);
|
path = get_persconffile_path(COLORFILTERS_FILE_NAME, TRUE);
|
||||||
if ((f = ws_fopen(path, "r")) == NULL) {
|
if ((f = ws_fopen(path, "r")) == NULL) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
/* Error trying to open the file; give up. */
|
/* Error trying to open the file; give up. */
|
||||||
|
@ -687,7 +687,7 @@ color_filters_read_globals(gpointer user_data, gchar** err_msg, color_filter_add
|
||||||
* Get the path for the file that would have the global filters, and
|
* Get the path for the file that would have the global filters, and
|
||||||
* try to open it.
|
* try to open it.
|
||||||
*/
|
*/
|
||||||
path = get_datafile_path("colorfilters");
|
path = get_datafile_path(COLORFILTERS_FILE_NAME);
|
||||||
if ((f = ws_fopen(path, "r")) == NULL) {
|
if ((f = ws_fopen(path, "r")) == NULL) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
/* Error trying to open the file; give up. */
|
/* Error trying to open the file; give up. */
|
||||||
|
@ -804,7 +804,7 @@ color_filters_write(GSList *cfl, gchar** err_msg)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = get_persconffile_path("colorfilters", TRUE);
|
path = get_persconffile_path(COLORFILTERS_FILE_NAME, TRUE);
|
||||||
if ((f = ws_fopen(path, "w+")) == NULL) {
|
if ((f = ws_fopen(path, "w+")) == NULL) {
|
||||||
*err_msg = g_strdup_printf("Could not open\n%s\nfor writing: %s.",
|
*err_msg = g_strdup_printf("Could not open\n%s\nfor writing: %s.",
|
||||||
path, g_strerror(errno));
|
path, g_strerror(errno));
|
||||||
|
|
|
@ -20,6 +20,8 @@ extern "C" {
|
||||||
|
|
||||||
struct epan_dissect;
|
struct epan_dissect;
|
||||||
|
|
||||||
|
#define COLORFILTERS_FILE_NAME "colorfilters"
|
||||||
|
|
||||||
#define CONVERSATION_COLOR_PREFIX "___conversation_color_filter___"
|
#define CONVERSATION_COLOR_PREFIX "___conversation_color_filter___"
|
||||||
/** @file
|
/** @file
|
||||||
* Color filters.
|
* Color filters.
|
||||||
|
|
|
@ -22,21 +22,6 @@
|
||||||
|
|
||||||
#include "ui/filter_files.h"
|
#include "ui/filter_files.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* Old filter file name.
|
|
||||||
*/
|
|
||||||
#define FILTER_FILE_NAME "filters"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Capture filter file name.
|
|
||||||
*/
|
|
||||||
#define CFILTER_FILE_NAME "cfilters"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Display filter file name.
|
|
||||||
*/
|
|
||||||
#define DFILTER_FILE_NAME "dfilters"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List of capture filters - saved.
|
* List of capture filters - saved.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,6 +15,21 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Old filter file name.
|
||||||
|
*/
|
||||||
|
#define FILTER_FILE_NAME "filters"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Capture filter file name.
|
||||||
|
*/
|
||||||
|
#define CFILTER_FILE_NAME "cfilters"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Display filter file name.
|
||||||
|
*/
|
||||||
|
#define DFILTER_FILE_NAME "dfilters"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Filter lists.
|
* Filter lists.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,12 +20,14 @@
|
||||||
#include "wsutil/filesystem.h"
|
#include "wsutil/filesystem.h"
|
||||||
|
|
||||||
#include "wireshark_application.h"
|
#include "wireshark_application.h"
|
||||||
|
#include "ui/qt/utils/qt_ui_utils.h"
|
||||||
#include "ui/qt/widgets/copy_from_profile_menu.h"
|
#include "ui/qt/widgets/copy_from_profile_menu.h"
|
||||||
#include "ui/qt/widgets/wireshark_file_dialog.h"
|
#include "ui/qt/widgets/wireshark_file_dialog.h"
|
||||||
|
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @file Coloring Rules dialog
|
* @file Coloring Rules dialog
|
||||||
|
@ -58,6 +60,14 @@ ColoringRulesDialog::ColoringRulesDialog(QWidget *parent, QString add_filter) :
|
||||||
ui->coloringRulesTreeView->resizeColumnToContents(i);
|
ui->coloringRulesTreeView->resizeColumnToContents(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
ui->newToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
ui->deleteToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
ui->copyToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
ui->clearToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
ui->pathLabel->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
connect(ui->coloringRulesTreeView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
|
connect(ui->coloringRulesTreeView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
|
||||||
this, SLOT(colorRuleSelectionChanged(const QItemSelection &, const QItemSelection &)));
|
this, SLOT(colorRuleSelectionChanged(const QItemSelection &, const QItemSelection &)));
|
||||||
connect(&colorRuleDelegate_, SIGNAL(invalidField(const QModelIndex&, const QString&)),
|
connect(&colorRuleDelegate_, SIGNAL(invalidField(const QModelIndex&, const QString&)),
|
||||||
|
@ -75,12 +85,20 @@ ColoringRulesDialog::ColoringRulesDialog(QWidget *parent, QString add_filter) :
|
||||||
export_button_->setToolTip(tr("Save filters in a file."));
|
export_button_->setToolTip(tr("Save filters in a file."));
|
||||||
|
|
||||||
QPushButton *copy_button = ui->buttonBox->addButton(tr("Copy from"), QDialogButtonBox::ActionRole);
|
QPushButton *copy_button = ui->buttonBox->addButton(tr("Copy from"), QDialogButtonBox::ActionRole);
|
||||||
copy_from_menu_ = new CopyFromProfileMenu("colorfilters");
|
copy_from_menu_ = new CopyFromProfileMenu(COLORFILTERS_FILE_NAME);
|
||||||
copy_button->setMenu(copy_from_menu_);
|
copy_button->setMenu(copy_from_menu_);
|
||||||
copy_button->setToolTip(tr("Copy coloring rules from another profile."));
|
copy_button->setToolTip(tr("Copy coloring rules from another profile."));
|
||||||
copy_button->setEnabled(copy_from_menu_->haveProfiles());
|
copy_button->setEnabled(copy_from_menu_->haveProfiles());
|
||||||
connect(copy_from_menu_, SIGNAL(triggered(QAction *)), this, SLOT(copyFromProfile(QAction *)));
|
connect(copy_from_menu_, SIGNAL(triggered(QAction *)), this, SLOT(copyFromProfile(QAction *)));
|
||||||
|
|
||||||
|
QString abs_path = gchar_free_to_qstring(get_persconffile_path(COLORFILTERS_FILE_NAME, TRUE));
|
||||||
|
if (file_exists(abs_path.toUtf8().constData())) {
|
||||||
|
ui->pathLabel->setText(abs_path);
|
||||||
|
ui->pathLabel->setUrl(QUrl::fromLocalFile(abs_path).toString());
|
||||||
|
ui->pathLabel->setToolTip(tr("Open ") + COLORFILTERS_FILE_NAME);
|
||||||
|
ui->pathLabel->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (!add_filter.isEmpty()) {
|
if (!add_filter.isEmpty()) {
|
||||||
colorRuleModel_.addColor(false, add_filter, palette().color(QPalette::Text), palette().color(QPalette::Base));
|
colorRuleModel_.addColor(false, add_filter, palette().color(QPalette::Text), palette().color(QPalette::Base));
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0,0,0,1">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0,0,0,0,1">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="newToolButton">
|
<widget class="QToolButton" name="newToolButton">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -189,6 +189,25 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="ElidedLabel" name="pathLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -209,6 +228,11 @@
|
||||||
<extends>QTreeView</extends>
|
<extends>QTreeView</extends>
|
||||||
<header>widgets/tabnav_tree_view.h</header>
|
<header>widgets/tabnav_tree_view.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>ElidedLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>widgets/elided_label.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../image/stock_icons.qrc"/>
|
<include location="../../image/stock_icons.qrc"/>
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include "ui/decode_as_utils.h"
|
#include "ui/decode_as_utils.h"
|
||||||
#include "ui/simple_dialog.h"
|
#include "ui/simple_dialog.h"
|
||||||
|
#include "wsutil/filesystem.h"
|
||||||
#include <wsutil/utf8_entities.h>
|
#include <wsutil/utf8_entities.h>
|
||||||
|
|
||||||
#include <ui/qt/utils/qt_ui_utils.h>
|
#include <ui/qt/utils/qt_ui_utils.h>
|
||||||
|
@ -26,6 +27,8 @@
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
// To do:
|
// To do:
|
||||||
|
@ -46,8 +49,24 @@ DecodeAsDialog::DecodeAsDialog(QWidget *parent, capture_file *cf, bool create_ne
|
||||||
ui->decodeAsTreeView->setModel(model_);
|
ui->decodeAsTreeView->setModel(model_);
|
||||||
ui->decodeAsTreeView->setItemDelegate(delegate_);
|
ui->decodeAsTreeView->setItemDelegate(delegate_);
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
ui->newToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
ui->deleteToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
ui->copyToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
ui->clearToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
ui->pathLabel->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
setWindowTitle(wsApp->windowTitleString(tr("Decode As" UTF8_HORIZONTAL_ELLIPSIS)));
|
setWindowTitle(wsApp->windowTitleString(tr("Decode As" UTF8_HORIZONTAL_ELLIPSIS)));
|
||||||
|
|
||||||
|
QString abs_path = gchar_free_to_qstring(get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE));
|
||||||
|
if (file_exists(abs_path.toUtf8().constData())) {
|
||||||
|
ui->pathLabel->setText(abs_path);
|
||||||
|
ui->pathLabel->setUrl(QUrl::fromLocalFile(abs_path).toString());
|
||||||
|
ui->pathLabel->setToolTip(tr("Open ") + DECODE_AS_ENTRIES_FILE_NAME);
|
||||||
|
ui->pathLabel->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
fillTable();
|
fillTable();
|
||||||
|
|
||||||
connect(model_, SIGNAL(modelReset()), this, SLOT(modelRowsReset()));
|
connect(model_, SIGNAL(modelReset()), this, SLOT(modelRowsReset()));
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0,1">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="newToolButton">
|
<widget class="QToolButton" name="newToolButton">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -89,6 +89,25 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="ElidedLabel" name="pathLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
|
#include <ui/qt/utils/qt_ui_utils.h>
|
||||||
#include <ui/qt/widgets/capture_filter_edit.h>
|
#include <ui/qt/widgets/capture_filter_edit.h>
|
||||||
//#include "capture_filter_syntax_worker.h"
|
//#include "capture_filter_syntax_worker.h"
|
||||||
#include <ui/qt/widgets/display_filter_edit.h>
|
#include <ui/qt/widgets/display_filter_edit.h>
|
||||||
|
@ -51,13 +53,22 @@ FilterDialog::FilterDialog(QWidget *parent, FilterType filter_type, const QStrin
|
||||||
if (parent) loadGeometry(parent->width() * 2 / 3, parent->height() * 2 / 3);
|
if (parent) loadGeometry(parent->width() * 2 / 3, parent->height() * 2 / 3);
|
||||||
setWindowIcon(wsApp->normalIcon());
|
setWindowIcon(wsApp->normalIcon());
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
ui->newToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
ui->deleteToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
ui->copyToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
ui->pathLabel->setAttribute(Qt::WA_MacSmallSize, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
ui->filterTreeWidget->setDragEnabled(true);
|
ui->filterTreeWidget->setDragEnabled(true);
|
||||||
ui->filterTreeWidget->viewport()->setAcceptDrops(true);
|
ui->filterTreeWidget->viewport()->setAcceptDrops(true);
|
||||||
ui->filterTreeWidget->setDropIndicatorShown(true);
|
ui->filterTreeWidget->setDropIndicatorShown(true);
|
||||||
ui->filterTreeWidget->setDragDropMode(QAbstractItemView::InternalMove);
|
ui->filterTreeWidget->setDragDropMode(QAbstractItemView::InternalMove);
|
||||||
|
|
||||||
|
const gchar * filename = NULL;
|
||||||
if (filter_type == CaptureFilter) {
|
if (filter_type == CaptureFilter) {
|
||||||
setWindowTitle(wsApp->windowTitleString(tr("Capture Filters")));
|
setWindowTitle(wsApp->windowTitleString(tr("Capture Filters")));
|
||||||
|
filename = CFILTER_FILE_NAME;
|
||||||
|
|
||||||
// QThread *syntax_thread = new QThread;
|
// QThread *syntax_thread = new QThread;
|
||||||
// syntax_worker_ = new CaptureFilterSyntaxWorker;
|
// syntax_worker_ = new CaptureFilterSyntaxWorker;
|
||||||
|
@ -70,6 +81,15 @@ FilterDialog::FilterDialog(QWidget *parent, FilterType filter_type, const QStrin
|
||||||
// syntax_thread->start();
|
// syntax_thread->start();
|
||||||
} else {
|
} else {
|
||||||
setWindowTitle(wsApp->windowTitleString(tr("Display Filters")));
|
setWindowTitle(wsApp->windowTitleString(tr("Display Filters")));
|
||||||
|
filename = DFILTER_FILE_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString abs_path = gchar_free_to_qstring(get_persconffile_path(filename, TRUE));
|
||||||
|
if (file_exists(abs_path.toUtf8().constData())) {
|
||||||
|
ui->pathLabel->setText(abs_path);
|
||||||
|
ui->pathLabel->setUrl(QUrl::fromLocalFile(abs_path).toString());
|
||||||
|
ui->pathLabel->setToolTip(tr("Open ") + filename);
|
||||||
|
ui->pathLabel->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->filterTreeWidget->setItemDelegateForColumn(filter_col_, filter_tree_delegate_);
|
ui->filterTreeWidget->setItemDelegateForColumn(filter_col_, filter_tree_delegate_);
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,1">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="newToolButton">
|
<widget class="QToolButton" name="newToolButton">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -100,6 +100,25 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="ElidedLabel" name="pathLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
Loading…
Reference in New Issue