* Get the path for the file that would have their filters, and
* 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 (errno != ENOENT) {
/* Error trying to open the file; give up. */
* Get the path for the file that would have the global filters, and
* try to open it.
*/
- path = get_datafile_path("colorfilters");
+ path = get_datafile_path(COLORFILTERS_FILE_NAME);
if ((f = ws_fopen(path, "r")) == NULL) {
if (errno != ENOENT) {
/* Error trying to open the file; give up. */
return FALSE;
}
- path = get_persconffile_path("colorfilters", TRUE);
+ path = get_persconffile_path(COLORFILTERS_FILE_NAME, TRUE);
if ((f = ws_fopen(path, "w+")) == NULL) {
*err_msg = g_strdup_printf("Could not open\n%s\nfor writing: %s.",
path, g_strerror(errno));
struct epan_dissect;
+#define COLORFILTERS_FILE_NAME "colorfilters"
+
#define CONVERSATION_COLOR_PREFIX "___conversation_color_filter___"
/** @file
* Color filters.
#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.
*/
extern "C" {
#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.
*/
#include "wsutil/filesystem.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/wireshark_file_dialog.h"
#include <QColorDialog>
#include <QMessageBox>
#include <QPushButton>
+#include <QUrl>
/*
* @file Coloring Rules dialog
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 &)),
this, SLOT(colorRuleSelectionChanged(const QItemSelection &, const QItemSelection &)));
connect(&colorRuleDelegate_, SIGNAL(invalidField(const QModelIndex&, const QString&)),
export_button_->setToolTip(tr("Save filters in a file."));
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->setToolTip(tr("Copy coloring rules from another profile."));
copy_button->setEnabled(copy_from_menu_->haveProfiles());
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()) {
colorRuleModel_.addColor(false, add_filter, palette().color(QPalette::Text), palette().color(QPalette::Base));
</widget>
</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>
<widget class="QToolButton" name="newToolButton">
<property name="toolTip">
</property>
</spacer>
</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>
</item>
<item>
<extends>QTreeView</extends>
<header>widgets/tabnav_tree_view.h</header>
</customwidget>
+ <customwidget>
+ <class>ElidedLabel</class>
+ <extends>QLabel</extends>
+ <header>widgets/elided_label.h</header>
+ </customwidget>
</customwidgets>
<resources>
<include location="../../image/stock_icons.qrc"/>
#include "ui/decode_as_utils.h"
#include "ui/simple_dialog.h"
+#include "wsutil/filesystem.h"
#include <wsutil/utf8_entities.h>
#include <ui/qt/utils/qt_ui_utils.h>
#include <QFont>
#include <QFontMetrics>
#include <QLineEdit>
+#include <QUrl>
+
#include <QDebug>
// To do:
ui->decodeAsTreeView->setModel(model_);
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)));
+ 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();
connect(model_, SIGNAL(modelReset()), this, SLOT(modelRowsReset()));
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0,1">
<item>
<widget class="QToolButton" name="newToolButton">
<property name="toolTip">
</property>
</spacer>
</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>
</item>
<item>
#include <QMessageBox>
#include <QThread>
+#include <QUrl>
+#include <ui/qt/utils/qt_ui_utils.h>
#include <ui/qt/widgets/capture_filter_edit.h>
//#include "capture_filter_syntax_worker.h"
#include <ui/qt/widgets/display_filter_edit.h>
if (parent) loadGeometry(parent->width() * 2 / 3, parent->height() * 2 / 3);
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->viewport()->setAcceptDrops(true);
ui->filterTreeWidget->setDropIndicatorShown(true);
ui->filterTreeWidget->setDragDropMode(QAbstractItemView::InternalMove);
+ const gchar * filename = NULL;
if (filter_type == CaptureFilter) {
setWindowTitle(wsApp->windowTitleString(tr("Capture Filters")));
+ filename = CFILTER_FILE_NAME;
// QThread *syntax_thread = new QThread;
// syntax_worker_ = new CaptureFilterSyntaxWorker;
// syntax_thread->start();
} else {
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_);
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,1">
<item>
<widget class="QToolButton" name="newToolButton">
<property name="toolTip">
</property>
</spacer>
</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>
</item>
<item>