aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-01-25 14:36:03 +0100
committerAnders Broman <a.broman58@gmail.com>2018-01-26 05:25:57 +0000
commit4398a92be20289e900bbf229f209b718af1ec668 (patch)
tree59d0ef526979937b22f001461bd72631893c9be0
parent0d5cbc7303dec4c7239b1df8fd152b58ce99a098 (diff)
Qt: Simplify files column in about dialog
HTMLTextDelegate fails to build in Qt 4.8, partially because QStyleOptionViewItem.text is introduced with Qt 5. Another issue with the current implementation is that the "Copy" action includes the HTML tags for italics. To fix these, just remove the italics formatting. Change-Id: I63aed7c3d0da3d9829d410d75fc18daa4049c0ca Fixes: v2.5.0rc0-1822-g73c01d6d05 ("Qt: Rewrite the About dialog to use models") Reviewed-on: https://code.wireshark.org/review/25470 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--ui/qt/CMakeLists.txt2
-rw-r--r--ui/qt/Makefile.am2
-rw-r--r--ui/qt/about_dialog.cpp8
-rw-r--r--ui/qt/models/html_text_delegate.cpp66
-rw-r--r--ui/qt/models/html_text_delegate.h48
5 files changed, 3 insertions, 123 deletions
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index 69847c3c4d..799ae3e547 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -82,7 +82,6 @@ set(WIRESHARK_MODEL_HEADERS
models/expert_info_proxy_model.h
models/export_objects_model.h
models/fileset_entry_model.h
- models/html_text_delegate.h
models/info_proxy_model.h
models/interface_sort_filter_model.h
models/interface_tree_cache_model.h
@@ -306,7 +305,6 @@ set(WIRESHARK_MODEL_SRCS
models/expert_info_proxy_model.cpp
models/export_objects_model.cpp
models/fileset_entry_model.cpp
- models/html_text_delegate.cpp
models/info_proxy_model.cpp
models/interface_sort_filter_model.cpp
models/interface_tree_cache_model.cpp
diff --git a/ui/qt/Makefile.am b/ui/qt/Makefile.am
index d060b163f9..e1eaba1f6b 100644
--- a/ui/qt/Makefile.am
+++ b/ui/qt/Makefile.am
@@ -219,7 +219,6 @@ MOC_MODELS_HDRS = \
models/expert_info_proxy_model.h \
models/export_objects_model.h \
models/fileset_entry_model.h \
- models/html_text_delegate.h \
models/info_proxy_model.h \
models/interface_sort_filter_model.h \
models/interface_tree_cache_model.h \
@@ -568,7 +567,6 @@ WIRESHARK_QT_MODELS_SRCS = \
models/expert_info_proxy_model.cpp \
models/export_objects_model.cpp \
models/fileset_entry_model.cpp \
- models/html_text_delegate.cpp \
models/info_proxy_model.cpp \
models/interface_sort_filter_model.cpp \
models/interface_tree_cache_model.cpp \
diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp
index 1b747fb2be..25f740f53f 100644
--- a/ui/qt/about_dialog.cpp
+++ b/ui/qt/about_dialog.cpp
@@ -47,7 +47,6 @@
#include <ui/qt/utils/variant_pointer.h>
#include <ui/qt/models/astringlist_list_model.h>
#include <ui/qt/models/url_link_delegate.h>
-#include <ui/qt/models/html_text_delegate.h>
#include <QFontMetrics>
#include <QKeySequence>
@@ -206,17 +205,17 @@ FolderListModel::FolderListModel(QObject * parent):
/* pers conf */
appendRow( QStringList() << "Personal configuration"
<< gchar_free_to_qstring(get_persconffile_path("", FALSE))
- << "<i>dfilters</i>, <i>preferences</i>, <i>ethers</i>, " UTF8_HORIZONTAL_ELLIPSIS);
+ << "dfilters, preferences, ethers, " UTF8_HORIZONTAL_ELLIPSIS);
/* global conf */
QString dirPath = get_datafile_dir();
if (! dirPath.isEmpty()) {
appendRow ( QStringList() << "Global configuration" << dirPath
- << "<i>dfilters</i>, <i>preferences</i>, <i>manuf</i>, " UTF8_HORIZONTAL_ELLIPSIS);
+ << "dfilters, preferences, manuf, " UTF8_HORIZONTAL_ELLIPSIS);
}
/* system */
- appendRow( QStringList() << "System" << get_systemfile_dir() << "<i>ethers</i>, <i>ipxnets</i>");
+ appendRow( QStringList() << "System" << get_systemfile_dir() << "ethers, ipxnets");
/* program */
appendRow( QStringList() << "Program" << get_progfile_dir() << "program files");
@@ -333,7 +332,6 @@ AboutDialog::AboutDialog(QWidget *parent) :
ui->tblFolders->setModel(folderDisplayModel);
ui->tblFolders->setRootIsDecorated(false);
ui->tblFolders->setItemDelegateForColumn(1, new UrlLinkDelegate(this));
- ui->tblFolders->setItemDelegateForColumn(2, new HTMLTextDelegate(this));
ui->tblFolders->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->tblFolders, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(handleCopyMenu(QPoint)));
connect(ui->searchFolders, SIGNAL(textChanged(QString)), folderProxyModel, SLOT(setFilter(QString)));
diff --git a/ui/qt/models/html_text_delegate.cpp b/ui/qt/models/html_text_delegate.cpp
deleted file mode 100644
index b906ac2d17..0000000000
--- a/ui/qt/models/html_text_delegate.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/* html_text_delegate.cpp
- * Delegates for displaying links as links, including elide model
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <ui/qt/models/html_text_delegate.h>
-
-#include <QComboBox>
-#include <QEvent>
-#include <QLineEdit>
-#include <QPainter>
-#include <QTextDocument>
-#include <QRect>
-#include <QStyledItemDelegate>
-#include <QStyleOptionViewItem>
-#include <QString>
-
-HTMLTextDelegate::HTMLTextDelegate(QObject *parent)
- : QStyledItemDelegate(parent)
-{}
-
-void HTMLTextDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
- QStyleOptionViewItem options = option;
- initStyleOption(&options, index);
-
- painter->save();
-
- QTextDocument doc;
- doc.setHtml(options.text);
-
- options.text = QStringLiteral("");
- options.widget->style()->drawControl(QStyle::CE_ItemViewItem, &option, painter);
-
- painter->translate(options.rect.left(), options.rect.top());
- QRect clip(0, 0, options.rect.width(), options.rect.height());
- doc.drawContents(painter, clip);
-
- painter->restore();
-}
-
-QSize HTMLTextDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const {
- QStyleOptionViewItem options = option;
- initStyleOption(&options, index);
-
- QTextDocument doc;
- doc.setHtml(options.text);
- doc.setTextWidth(options.rect.width());
- return QSize(doc.idealWidth(), doc.size().height());
-}
-
-/* * 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/models/html_text_delegate.h b/ui/qt/models/html_text_delegate.h
deleted file mode 100644
index e8e2ffd308..0000000000
--- a/ui/qt/models/html_text_delegate.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* html_text_delegate.h
- * Delegates for displaying links as links, including elide model
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#ifndef HTML_TEXT_DELEGATE_H
-#define HTML_TEXT_DELEGATE_H
-
-#include <config.h>
-
-#include <QWidget>
-#include <QStyledItemDelegate>
-#include <QStyleOptionViewItem>
-#include <QModelIndex>
-#include <QAbstractItemModel>
-
-class HTMLTextDelegate : public QStyledItemDelegate
-{
- Q_OBJECT
-
-public:
- explicit HTMLTextDelegate(QObject *parent = Q_NULLPTR);
-
-protected:
- void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
-
-
-};
-#endif // HTML_TEXT_DELEGATE_H
-
-/*
- * 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:
- */