aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2020-05-28 11:40:08 -0700
committerAnders Broman <a.broman58@gmail.com>2020-05-30 06:45:07 +0000
commit76d92ba7e76ef0714090770ff1ee79861716388c (patch)
treee8c9bf03c20164eab7f890d0b63606e057f6f337 /ui
parent3605bdc3232515d7e79c8ada86589ba518425870 (diff)
Qt: Updates for 5.15.
Fix the following deprecation issues for Qt 5.15: Use Qt::WindowFlags() instead of 0 in Qt >= 5.6. Pass Qt::SkipEmptyParts instead of QString::SkipEmptyParts to QString::split() in Qt >= 5.15. Use QMultiMap instead of QMap where we were using QMap::uniqeKeys(). Use QCP::Interactions() instead of 0. Use '\n' instead of QTextStream::endl. Use QWheelEvent::angleDelta() instead of QWheelEvent::angle(). Change-Id: Ie2d69d3a396c0821c2c34f506ddad6f8e22f7049 Reviewed-on: https://code.wireshark.org/review/37334 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>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/extcap_argument_multiselect.cpp4
-rw-r--r--ui/qt/funnel_statistics.cpp2
-rw-r--r--ui/qt/geometry_state_dialog.h10
-rw-r--r--ui/qt/io_graph_dialog.cpp6
-rw-r--r--ui/qt/lte_rlc_graph_dialog.cpp4
-rw-r--r--ui/qt/lte_rlc_graph_dialog.h2
-rw-r--r--ui/qt/main_window_slots.cpp4
-rw-r--r--ui/qt/protocol_hierarchy_dialog.cpp8
-rw-r--r--ui/qt/rtp_stream_dialog.cpp8
-rw-r--r--ui/qt/sequence_diagram.cpp2
-rw-r--r--ui/qt/sequence_diagram.h2
-rw-r--r--ui/qt/sequence_dialog.cpp18
-rw-r--r--ui/qt/simple_dialog.cpp4
-rw-r--r--ui/qt/tcp_stream_dialog.cpp4
-rw-r--r--ui/qt/tcp_stream_dialog.h2
-rw-r--r--ui/qt/traffic_table_dialog.cpp8
-rw-r--r--ui/qt/voip_calls_dialog.cpp8
-rw-r--r--ui/qt/widgets/wireless_timeline.cpp8
-rw-r--r--ui/qt/wireless_frame.cpp2
-rw-r--r--ui/qt/wireshark_application.cpp6
20 files changed, 69 insertions, 43 deletions
diff --git a/ui/qt/extcap_argument_multiselect.cpp b/ui/qt/extcap_argument_multiselect.cpp
index 5b4688930f..6ec87504f0 100644
--- a/ui/qt/extcap_argument_multiselect.cpp
+++ b/ui/qt/extcap_argument_multiselect.cpp
@@ -112,7 +112,11 @@ QWidget * ExtArgMultiSelect::createEditor(QWidget * parent)
if (_argument->pref_valptr && *_argument->pref_valptr)
{
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+ checked = QString(*_argument->pref_valptr).split(",", Qt::SkipEmptyParts);
+#else
checked = QString(*_argument->pref_valptr).split(",", QString::SkipEmptyParts);
+#endif
}
viewModel = new QStandardItemModel();
diff --git a/ui/qt/funnel_statistics.cpp b/ui/qt/funnel_statistics.cpp
index b7a75bb8e1..cc9dbc0156 100644
--- a/ui/qt/funnel_statistics.cpp
+++ b/ui/qt/funnel_statistics.cpp
@@ -323,7 +323,7 @@ static void register_menu_cb(const char *name,
static void deregister_menu_cb(funnel_menu_callback callback)
{
- foreach (int group, funnel_actions_.uniqueKeys()) {
+ foreach (int group, funnel_actions_.keys()) {
QList<FunnelAction *>::iterator it = funnel_actions_[group].begin();
while (it != funnel_actions_[group].end()) {
FunnelAction *funnel_action = *it;
diff --git a/ui/qt/geometry_state_dialog.h b/ui/qt/geometry_state_dialog.h
index ca4d20494b..0d813ce620 100644
--- a/ui/qt/geometry_state_dialog.h
+++ b/ui/qt/geometry_state_dialog.h
@@ -49,10 +49,16 @@ public:
//
// Pass in the parent on macOS and NULL elsewhere so that we have an
// independent window that un-maximizes correctly.
+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+#define DEFAULT_WINDOW_FLAGS Qt::WindowFlags()
+#else
+#define DEFAULT_WINDOW_FLAGS 0
+#endif
+
#ifdef Q_OS_MAC
- explicit GeometryStateDialog(QWidget *parent, Qt::WindowFlags f = 0) : QDialog(parent, f) {}
+ explicit GeometryStateDialog(QWidget *parent, Qt::WindowFlags f = DEFAULT_WINDOW_FLAGS) : QDialog(parent, f) {}
#else
- explicit GeometryStateDialog(QWidget *, Qt::WindowFlags f = 0) : QDialog(NULL, f) {}
+ explicit GeometryStateDialog(QWidget *, Qt::WindowFlags f = DEFAULT_WINDOW_FLAGS) : QDialog(NULL, f) {}
#endif
~GeometryStateDialog();
diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp
index 612b092df9..160376abc6 100644
--- a/ui/qt/io_graph_dialog.cpp
+++ b/ui/qt/io_graph_dialog.cpp
@@ -1345,7 +1345,7 @@ void IOGraphDialog::on_dragRadioButton_toggled(bool checked)
void IOGraphDialog::on_zoomRadioButton_toggled(bool checked)
{
if (checked) mouse_drags_ = false;
- ui->ioPlot->setInteractions(0);
+ ui->ioPlot->setInteractions(QCP::Interactions());
}
void IOGraphDialog::on_logCheckBox_toggled(bool checked)
@@ -1530,7 +1530,7 @@ void IOGraphDialog::makeCsv(QTextStream &stream) const
}
}
- stream << endl;
+ stream << '\n';
for (int interval = 0; interval <= max_interval; interval++) {
double interval_start = (double)interval * ((double)ui_interval / 1000.0);
@@ -1542,7 +1542,7 @@ void IOGraphDialog::makeCsv(QTextStream &stream) const
}
stream << "," << value;
}
- stream << endl;
+ stream << '\n';
}
}
diff --git a/ui/qt/lte_rlc_graph_dialog.cpp b/ui/qt/lte_rlc_graph_dialog.cpp
index b93bb4e1f6..294088d668 100644
--- a/ui/qt/lte_rlc_graph_dialog.cpp
+++ b/ui/qt/lte_rlc_graph_dialog.cpp
@@ -259,7 +259,7 @@ void LteRlcGraphDialog::fillGraph()
}
double ts = seg->rel_secs + seg->rel_usecs / 1000000.0;
- time_stamp_map_.insertMulti(ts, seg);
+ time_stamp_map_.insert(ts, seg);
}
// Now sequence numbers.
@@ -826,7 +826,7 @@ void LteRlcGraphDialog::on_dragRadioButton_toggled(bool checked)
void LteRlcGraphDialog::on_zoomRadioButton_toggled(bool checked)
{
if (checked) mouse_drags_ = false;
- ui->rlcPlot->setInteractions(0);
+ ui->rlcPlot->setInteractions(QCP::Interactions());
}
void LteRlcGraphDialog::on_resetButton_clicked()
diff --git a/ui/qt/lte_rlc_graph_dialog.h b/ui/qt/lte_rlc_graph_dialog.h
index 5c867760bf..0175ace458 100644
--- a/ui/qt/lte_rlc_graph_dialog.h
+++ b/ui/qt/lte_rlc_graph_dialog.h
@@ -55,7 +55,7 @@ private:
struct rlc_graph graph_;
// Data
- QMap<double, struct rlc_segment *> time_stamp_map_;
+ QMultiMap<double, struct rlc_segment *> time_stamp_map_;
QMap<double, struct rlc_segment *> sequence_num_map_;
QCPGraph *base_graph_; // Clickable packets
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index ab0f49a443..61a95bba57 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -1562,7 +1562,11 @@ void MainWindow::addStatsPluginsToMenu() {
parent_menu = main_ui_->menuStatistics;
// gtk/main_menubar.c compresses double slashes, hence SkipEmptyParts
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+ QStringList cfg_name_parts = QString(cfg->name).split("/", Qt::SkipEmptyParts);
+#else
QStringList cfg_name_parts = QString(cfg->name).split("/", QString::SkipEmptyParts);
+#endif
if (cfg_name_parts.isEmpty()) continue;
QString stat_name = cfg_name_parts.takeLast();
diff --git a/ui/qt/protocol_hierarchy_dialog.cpp b/ui/qt/protocol_hierarchy_dialog.cpp
index ea7e306def..156970477c 100644
--- a/ui/qt/protocol_hierarchy_dialog.cpp
+++ b/ui/qt/protocol_hierarchy_dialog.cpp
@@ -337,7 +337,7 @@ void ProtocolHierarchyDialog::on_actionCopyAsCsv_triggered()
separated_value << v.toString();
}
}
- stream << separated_value.join(",") << endl;
+ stream << separated_value.join(",") << '\n';
if (!first) ++iter;
first = false;
@@ -352,13 +352,13 @@ void ProtocolHierarchyDialog::on_actionCopyAsYaml_triggered()
QTreeWidgetItemIterator iter(ui->hierStatsTreeWidget);
bool first = true;
- stream << "---" << endl;
+ stream << "---" << '\n';
while (*iter) {
QTreeWidgetItem *item = first ? NULL : (*iter);
- stream << "-" << endl;
+ stream << "-" << '\n';
foreach (QVariant v, protoHierRowData(item)) {
- stream << " - " << v.toString() << endl;
+ stream << " - " << v.toString() << '\n';
}
if (!first) ++iter;
first = false;
diff --git a/ui/qt/rtp_stream_dialog.cpp b/ui/qt/rtp_stream_dialog.cpp
index 368af73f8f..d56f6eaf7b 100644
--- a/ui/qt/rtp_stream_dialog.cpp
+++ b/ui/qt/rtp_stream_dialog.cpp
@@ -470,7 +470,7 @@ void RtpStreamDialog::on_actionCopyAsCsv_triggered()
rdsl << v.toString();
}
}
- stream << rdsl.join(",") << endl;
+ stream << rdsl.join(",") << '\n';
}
wsApp->clipboard()->setText(stream.readAll());
}
@@ -479,11 +479,11 @@ void RtpStreamDialog::on_actionCopyAsYaml_triggered()
{
QString yaml;
QTextStream stream(&yaml, QIODevice::Text);
- stream << "---" << endl;
+ stream << "---" << '\n';
for (int row = -1; row < ui->streamTreeWidget->topLevelItemCount(); row ++) {
- stream << "-" << endl;
+ stream << "-" << '\n';
foreach (QVariant v, streamRowData(row)) {
- stream << " - " << v.toString() << endl;
+ stream << " - " << v.toString() << '\n';
}
}
wsApp->clipboard()->setText(stream.readAll());
diff --git a/ui/qt/sequence_diagram.cpp b/ui/qt/sequence_diagram.cpp
index ed4d49e280..b51aa1185e 100644
--- a/ui/qt/sequence_diagram.cpp
+++ b/ui/qt/sequence_diagram.cpp
@@ -156,7 +156,7 @@ void SequenceDiagram::setData(_seq_analysis_info *sainfo)
new_data.key = cur_key;
new_data.value = sai;
- data_->insertMulti(new_data.key, new_data);
+ data_->insert(new_data.key, new_data);
key_ticks.append(cur_key);
key_labels.append(sai->time_str);
diff --git a/ui/qt/sequence_diagram.h b/ui/qt/sequence_diagram.h
index 91d5074567..f343195600 100644
--- a/ui/qt/sequence_diagram.h
+++ b/ui/qt/sequence_diagram.h
@@ -33,7 +33,7 @@ public:
struct _seq_analysis_item *value;
};
-typedef QMap<double, WSCPSeqData> WSCPSeqDataMap;
+typedef QMultiMap<double, WSCPSeqData> WSCPSeqDataMap;
class SequenceDiagram : public QCPAbstractPlottable
{
diff --git a/ui/qt/sequence_dialog.cpp b/ui/qt/sequence_dialog.cpp
index 73699917d3..d727c0652e 100644
--- a/ui/qt/sequence_dialog.cpp
+++ b/ui/qt/sequence_dialog.cpp
@@ -347,14 +347,18 @@ void SequenceDialog::mouseMoved(QMouseEvent *event)
void SequenceDialog::mouseWheeled(QWheelEvent *event)
{
- int scroll_delta = event->delta() * -1 / 15;
- if (event->orientation() == Qt::Vertical) {
- scroll_delta *= ui->verticalScrollBar->singleStep();
- ui->verticalScrollBar->setValue(ui->verticalScrollBar->value() + scroll_delta);
- } else {
- scroll_delta *= ui->horizontalScrollBar->singleStep();
- ui->horizontalScrollBar->setValue(ui->horizontalScrollBar->value() + scroll_delta);
+ int scroll_x = event->angleDelta().x() * -1 / 8;
+ scroll_x *= ui->horizontalScrollBar->singleStep();
+ if (scroll_x) {
+ ui->horizontalScrollBar->setValue(ui->horizontalScrollBar->value() + scroll_x);
+ }
+
+ int scroll_y = event->angleDelta().ry() * -1 / 8;
+ scroll_y *= ui->verticalScrollBar->singleStep();
+ if (scroll_y) {
+ ui->verticalScrollBar->setValue(ui->verticalScrollBar->value() + scroll_y);
}
+
event->accept();
}
diff --git a/ui/qt/simple_dialog.cpp b/ui/qt/simple_dialog.cpp
index 7579fc01b1..212770291e 100644
--- a/ui/qt/simple_dialog.cpp
+++ b/ui/qt/simple_dialog.cpp
@@ -429,7 +429,11 @@ void SimpleDialog::show()
const MessagePair SimpleDialog::splitMessage(QString &message) const
{
if (message.startsWith(primary_delimiter_)) {
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+ QStringList parts = message.split(primary_delimiter_, Qt::SkipEmptyParts);
+#else
QStringList parts = message.split(primary_delimiter_, QString::SkipEmptyParts);
+#endif
switch (parts.length()) {
case 0:
return MessagePair(QString(), QString());
diff --git a/ui/qt/tcp_stream_dialog.cpp b/ui/qt/tcp_stream_dialog.cpp
index f889746399..b0b0f9c9ad 100644
--- a/ui/qt/tcp_stream_dialog.cpp
+++ b/ui/qt/tcp_stream_dialog.cpp
@@ -588,7 +588,7 @@ void TCPStreamDialog::fillGraph(bool reset_axes, bool set_focus)
first = false;
}
if (insert) {
- time_stamp_map_.insertMulti(ts - ts_offset_, seg);
+ time_stamp_map_.insert(ts - ts_offset_, seg);
}
}
@@ -1938,7 +1938,7 @@ void TCPStreamDialog::on_zoomRadioButton_toggled(bool checked)
{
if (checked) {
mouse_drags_ = false;
- ui->streamPlot->setInteractions(0);
+ ui->streamPlot->setInteractions(QCP::Interactions());
}
}
diff --git a/ui/qt/tcp_stream_dialog.h b/ui/qt/tcp_stream_dialog.h
index 6cd5bb4fec..339330798c 100644
--- a/ui/qt/tcp_stream_dialog.h
+++ b/ui/qt/tcp_stream_dialog.h
@@ -67,7 +67,7 @@ protected:
private:
Ui::TCPStreamDialog *ui;
capture_file *cap_file_;
- QMap<double, struct segment *> time_stamp_map_;
+ QMultiMap<double, struct segment *> time_stamp_map_;
double ts_offset_;
bool ts_origin_conn_;
QMap<double, struct segment *> sequence_num_map_;
diff --git a/ui/qt/traffic_table_dialog.cpp b/ui/qt/traffic_table_dialog.cpp
index 4d3f4aab63..d147787b4a 100644
--- a/ui/qt/traffic_table_dialog.cpp
+++ b/ui/qt/traffic_table_dialog.cpp
@@ -316,7 +316,7 @@ void TrafficTableDialog::copyAsCsv()
rdsl << v.toString();
}
}
- stream << rdsl.join(",") << endl;
+ stream << rdsl.join(",") << '\n';
}
wsApp->clipboard()->setText(stream.readAll());
}
@@ -330,11 +330,11 @@ void TrafficTableDialog::copyAsYaml()
QString yaml;
QTextStream stream(&yaml, QIODevice::Text);
- stream << "---" << endl;
+ stream << "---" << '\n';
for (int row = -1; row < cur_tree->topLevelItemCount(); row ++) {
- stream << "-" << endl;
+ stream << "-" << '\n';
foreach (QVariant v, curTreeRowData(row)) {
- stream << " - " << v.toString() << endl;
+ stream << " - " << v.toString() << '\n';
}
}
wsApp->clipboard()->setText(stream.readAll());
diff --git a/ui/qt/voip_calls_dialog.cpp b/ui/qt/voip_calls_dialog.cpp
index c854296f0f..051cfda3be 100644
--- a/ui/qt/voip_calls_dialog.cpp
+++ b/ui/qt/voip_calls_dialog.cpp
@@ -485,7 +485,7 @@ void VoipCallsDialog::copyAsCSV()
// XXX should quotes (") in strval be stripped/sanitized?
rdsl << QString("\"%1\"").arg(strval);
}
- stream << rdsl.join(",") << endl;
+ stream << rdsl.join(",") << '\n';
}
wsApp->clipboard()->setText(stream.readAll());
}
@@ -494,11 +494,11 @@ void VoipCallsDialog::copyAsYAML()
{
QString yaml;
QTextStream stream(&yaml, QIODevice::Text);
- stream << "---" << endl;
+ stream << "---" << '\n';
for (int row = -1; row < sorted_model_->rowCount(); row++) {
- stream << "-" << endl;
+ stream << "-" << '\n';
foreach (QVariant v, streamRowData(row)) {
- stream << " - " << v.toString() << endl;
+ stream << " - " << v.toString() << '\n';
}
}
wsApp->clipboard()->setText(stream.readAll());
diff --git a/ui/qt/widgets/wireless_timeline.cpp b/ui/qt/widgets/wireless_timeline.cpp
index b57ff672d4..787fb36452 100644
--- a/ui/qt/widgets/wireless_timeline.cpp
+++ b/ui/qt/widgets/wireless_timeline.cpp
@@ -398,12 +398,16 @@ void WirelessTimeline::wheelEvent(QWheelEvent *event)
{
// "Most mouse types work in steps of 15 degrees, in which case the delta
// value is a multiple of 120; i.e., 120 units * 1/8 = 15 degrees"
- double steps = event->delta() / 120.0;
+ double steps = event->angleDelta().y() / 120.0;
if (steps != 0.0) {
zoom_level += steps;
if (zoom_level < 0) zoom_level = 0;
if (zoom_level > TIMELINE_MAX_ZOOM) zoom_level = TIMELINE_MAX_ZOOM;
- zoom((float)event->pos().x() / width());
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+ zoom(event->position().x() / width());
+#else
+ zoom(event->posF().x() / width());
+#endif
}
}
diff --git a/ui/qt/wireless_frame.cpp b/ui/qt/wireless_frame.cpp
index d812a6eb3e..0a5fb7b125 100644
--- a/ui/qt/wireless_frame.cpp
+++ b/ui/qt/wireless_frame.cpp
@@ -205,7 +205,7 @@ void WirelessFrame::on_helperToolButton_clicked()
if (helper_path.isEmpty()) return;
QString command = QString("\"%1\"").arg(helper_path);
- QProcess::startDetached(command);
+ QProcess::startDetached(command, QStringList());
}
void WirelessFrame::on_prefsToolButton_clicked()
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 5f187b099c..35daf14f69 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -883,7 +883,7 @@ void WiresharkApplication::removeDynamicMenuGroupItem(int group, QAction *sg_act
void WiresharkApplication::clearDynamicMenuGroupItems()
{
- foreach (int group, dynamic_menu_groups_.uniqueKeys()) {
+ foreach (int group, dynamic_menu_groups_.keys()) {
dynamic_menu_groups_[group].clear();
}
}
@@ -936,14 +936,14 @@ QList<QAction *> WiresharkApplication::removedMenuGroupItems(int group)
void WiresharkApplication::clearAddedMenuGroupItems()
{
- foreach (int group, added_menu_groups_.uniqueKeys()) {
+ foreach (int group, added_menu_groups_.keys()) {
added_menu_groups_[group].clear();
}
}
void WiresharkApplication::clearRemovedMenuGroupItems()
{
- foreach (int group, removed_menu_groups_.uniqueKeys()) {
+ foreach (int group, removed_menu_groups_.keys()) {
foreach (QAction *action, removed_menu_groups_[group]) {
delete action;
}