aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-12-23 14:46:25 -0600
committerAnders Broman <a.broman58@gmail.com>2018-12-24 07:38:21 +0000
commit03eb0a4159bdfb1c484b985ec0a57374fc90be24 (patch)
treeec841fff608f96e63ad883b7489de6bfd18dbce6 /ui
parent35569d89f33d9480292e9c96c2558d02ce36e234 (diff)
Qt: Switch models and DataPrinter to new-style signals and slots.
Change-Id: I56ecf0486c19dbd7a330628f2fe36d0a2c11b5da Reviewed-on: https://code.wireshark.org/review/31187 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/models/cache_proxy_model.cpp8
-rw-r--r--ui/qt/models/coloring_rules_delegate.cpp2
-rw-r--r--ui/qt/models/interface_sort_filter_model.cpp2
-rw-r--r--ui/qt/models/interface_tree_model.cpp4
-rw-r--r--ui/qt/models/numeric_value_chooser_delegate.cpp3
-rw-r--r--ui/qt/models/packet_list_model.cpp4
-rw-r--r--ui/qt/models/path_chooser_delegate.cpp4
-rw-r--r--ui/qt/models/path_chooser_delegate.h2
-rw-r--r--ui/qt/models/uat_delegate.cpp6
-rw-r--r--ui/qt/utils/data_printer.cpp12
10 files changed, 24 insertions, 23 deletions
diff --git a/ui/qt/models/cache_proxy_model.cpp b/ui/qt/models/cache_proxy_model.cpp
index 3e2b31eb4a..9f136882b0 100644
--- a/ui/qt/models/cache_proxy_model.cpp
+++ b/ui/qt/models/cache_proxy_model.cpp
@@ -83,13 +83,13 @@ void CacheProxyModel::setSourceModel(QAbstractItemModel *newSourceModel)
if (newSourceModel) {
cache.clear();
QIdentityProxyModel::setSourceModel(newSourceModel);
- connect(newSourceModel, SIGNAL(modelReset()),
- this, SLOT(resetCacheModel()));
+ connect(newSourceModel, &QAbstractItemModel::modelReset,
+ this, &CacheProxyModel::resetCacheModel);
} else {
if (sourceModel()) {
// Prevent further updates to source model from invalidating cache.
- disconnect(sourceModel(), SIGNAL(modelReset()),
- this, SLOT(resetCacheModel()));
+ disconnect(sourceModel(), &QAbstractItemModel::modelReset,
+ this, &CacheProxyModel::resetCacheModel);
}
QIdentityProxyModel::setSourceModel(&cache);
}
diff --git a/ui/qt/models/coloring_rules_delegate.cpp b/ui/qt/models/coloring_rules_delegate.cpp
index b3aaa7b4db..b446604317 100644
--- a/ui/qt/models/coloring_rules_delegate.cpp
+++ b/ui/qt/models/coloring_rules_delegate.cpp
@@ -24,7 +24,7 @@ QWidget* ColoringRulesDelegate::createEditor(QWidget *parent, const QStyleOption
case ColoringRulesModel::colName:
{
SyntaxLineEdit *editor = new SyntaxLineEdit(parent);
- connect(editor, SIGNAL(textChanged(QString)), this, SLOT(ruleNameChanged(QString)));
+ connect(editor, &SyntaxLineEdit::textChanged, this, &ColoringRulesDelegate::ruleNameChanged);
return editor;
}
diff --git a/ui/qt/models/interface_sort_filter_model.cpp b/ui/qt/models/interface_sort_filter_model.cpp
index a693899d52..07a6228bfb 100644
--- a/ui/qt/models/interface_sort_filter_model.cpp
+++ b/ui/qt/models/interface_sort_filter_model.cpp
@@ -51,7 +51,7 @@ void InterfaceSortFilterModel::setStoreOnChange(bool storeOnChange)
_storeOnChange = storeOnChange;
if ( storeOnChange )
{
- connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(resetPreferenceData()));
+ connect(wsApp, &WiresharkApplication::preferencesChanged, this, &InterfaceSortFilterModel::resetPreferenceData);
resetPreferenceData();
}
}
diff --git a/ui/qt/models/interface_tree_model.cpp b/ui/qt/models/interface_tree_model.cpp
index ec4480cf02..ad71161dc5 100644
--- a/ui/qt/models/interface_tree_model.cpp
+++ b/ui/qt/models/interface_tree_model.cpp
@@ -45,8 +45,8 @@ InterfaceTreeModel::InterfaceTreeModel(QObject *parent) :
,stat_cache_(NULL)
#endif
{
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(interfaceListChanged()));
- connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(interfaceListChanged()));
+ connect(wsApp, &WiresharkApplication::appInitialized, this, &InterfaceTreeModel::interfaceListChanged);
+ connect(wsApp, &WiresharkApplication::localInterfaceListChanged, this, &InterfaceTreeModel::interfaceListChanged);
}
InterfaceTreeModel::~InterfaceTreeModel(void)
diff --git a/ui/qt/models/numeric_value_chooser_delegate.cpp b/ui/qt/models/numeric_value_chooser_delegate.cpp
index 7a02afbf77..06008aee88 100644
--- a/ui/qt/models/numeric_value_chooser_delegate.cpp
+++ b/ui/qt/models/numeric_value_chooser_delegate.cpp
@@ -54,7 +54,8 @@ QWidget* NumericValueChooserDelegate::createEditor(QWidget *parent, const QStyle
editor->setMaximum(_max);
editor->setWrapping(true);
- connect(editor, SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)));
+ connect(editor, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
+ &NumericValueChooserDelegate::onValueChanged);
return editor;
}
diff --git a/ui/qt/models/packet_list_model.cpp b/ui/qt/models/packet_list_model.cpp
index 26cff5216d..9e57c146f2 100644
--- a/ui/qt/models/packet_list_model.cpp
+++ b/ui/qt/models/packet_list_model.cpp
@@ -56,8 +56,8 @@ PacketListModel::PacketListModel(QObject *parent, capture_file *cf) :
new_visible_rows_.reserve(1000);
number_to_row_.reserve(reserved_packets_);
- connect(this, SIGNAL(maxLineCountChanged(QModelIndex)),
- this, SLOT(emitItemHeightChanged(QModelIndex)),
+ connect(this, &PacketListModel::maxLineCountChanged,
+ this, &PacketListModel::emitItemHeightChanged,
Qt::QueuedConnection);
idle_dissection_timer_ = new QElapsedTimer();
}
diff --git a/ui/qt/models/path_chooser_delegate.cpp b/ui/qt/models/path_chooser_delegate.cpp
index 8f97247c69..06527bbfab 100644
--- a/ui/qt/models/path_chooser_delegate.cpp
+++ b/ui/qt/models/path_chooser_delegate.cpp
@@ -50,7 +50,7 @@ QWidget* PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionVi
pathEditor->setFocusProxy(lineEdit);
pathEditor->setFocusPolicy(lineEdit->focusPolicy());
- connect(btnBrowse, SIGNAL(clicked()), this, SLOT(browse_button_clicked()));
+ connect(btnBrowse, &QPushButton::clicked, this, &PathChooserDelegate::browseButtonClicked);
return pathEditor;
}
@@ -64,7 +64,7 @@ void PathChooserDelegate::updateEditorGeometry(QWidget *editor, const QStyleOpti
editor->setGeometry(rect);
}
-void PathChooserDelegate::browse_button_clicked()
+void PathChooserDelegate::browseButtonClicked()
{
char *open_dir = NULL;
diff --git a/ui/qt/models/path_chooser_delegate.h b/ui/qt/models/path_chooser_delegate.h
index 34886c3cd9..60c197d313 100644
--- a/ui/qt/models/path_chooser_delegate.h
+++ b/ui/qt/models/path_chooser_delegate.h
@@ -27,7 +27,7 @@ protected:
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &idx) const;
private slots:
- void browse_button_clicked();
+ void browseButtonClicked();
};
#endif /* PATH_CHOOSER_DELEGATE_H_ */
diff --git a/ui/qt/models/uat_delegate.cpp b/ui/qt/models/uat_delegate.cpp
index fa52adb33b..b218edb672 100644
--- a/ui/qt/models/uat_delegate.cpp
+++ b/ui/qt/models/uat_delegate.cpp
@@ -49,7 +49,7 @@ QWidget *UatDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &
EditorFileDialog* fileDialog = new EditorFileDialog(index, EditorFileDialog::Directory, parent, QString(field->title), filename_old);
//Use signals to accept data from cell
- connect(fileDialog, SIGNAL(acceptEdit(const QModelIndex &)), this, SLOT(applyFilename(const QModelIndex&)));
+ connect(fileDialog, &EditorFileDialog::acceptEdit, this, &UatDelegate::applyFilename);
return fileDialog;
}
@@ -64,7 +64,7 @@ QWidget *UatDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &
fileDialog->setOption(QFileDialog::DontConfirmOverwrite);
//Use signals to accept data from cell
- connect(fileDialog, SIGNAL(acceptEdit(const QModelIndex &)), this, SLOT(applyFilename(const QModelIndex &)));
+ connect(fileDialog, &EditorFileDialog::acceptEdit, this, &UatDelegate::applyFilename);
return fileDialog;
}
@@ -77,7 +77,7 @@ QWidget *UatDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &
EditorColorDialog *colorDialog = new EditorColorDialog(index, color, parent);
//Use signals to accept data from cell
- connect(colorDialog, SIGNAL(acceptEdit(const QModelIndex &)), this, SLOT(applyColor(const QModelIndex &)));
+ connect(colorDialog, &EditorColorDialog::acceptEdit, this, &UatDelegate::applyColor);
return colorDialog;
}
diff --git a/ui/qt/utils/data_printer.cpp b/ui/qt/utils/data_printer.cpp
index cf2e2604ce..a0a233a40c 100644
--- a/ui/qt/utils/data_printer.cpp
+++ b/ui/qt/utils/data_printer.cpp
@@ -194,32 +194,32 @@ QActionGroup * DataPrinter::copyActions(QObject * copyClass, QObject * data)
QAction * action = new QAction(tr("Copy Bytes as Hex + ASCII Dump"), actions);
action->setToolTip(tr("Copy packet bytes as a hex and ASCII dump."));
action->setProperty("printertype", DataPrinter::DP_HexDump);
- connect(action, SIGNAL(triggered(bool)), dpi, SLOT(copyIDataBytes(bool)));
+ connect(action, &QAction::triggered, dpi, &DataPrinter::copyIDataBytes);
action = new QAction(tr(UTF8_HORIZONTAL_ELLIPSIS "as Hex Dump"), actions);
action->setToolTip(tr("Copy packet bytes as a hex dump."));
action->setProperty("printertype", DataPrinter::DP_HexOnly);
- connect(action, SIGNAL(triggered(bool)), dpi, SLOT(copyIDataBytes(bool)));
+ connect(action, &QAction::triggered, dpi, &DataPrinter::copyIDataBytes);
action = new QAction(tr(UTF8_HORIZONTAL_ELLIPSIS "as Printable Text"), actions);
action->setToolTip(tr("Copy only the printable text in the packet."));
action->setProperty("printertype", DataPrinter::DP_PrintableText);
- connect(action, SIGNAL(triggered(bool)), dpi, SLOT(copyIDataBytes(bool)));
+ connect(action, &QAction::triggered, dpi, &DataPrinter::copyIDataBytes);
action = new QAction(tr(UTF8_HORIZONTAL_ELLIPSIS "as a Hex Stream"), actions);
action->setToolTip(tr("Copy packet bytes as a stream of hex."));
action->setProperty("printertype", DataPrinter::DP_HexStream);
- connect(action, SIGNAL(triggered(bool)), dpi, SLOT(copyIDataBytes(bool)));
+ connect(action, &QAction::triggered, dpi, &DataPrinter::copyIDataBytes);
action = new QAction(tr(UTF8_HORIZONTAL_ELLIPSIS "as Raw Binary"), actions);
action->setToolTip(tr("Copy packet bytes as application/octet-stream MIME data."));
action->setProperty("printertype", DataPrinter::DP_Binary);
- connect(action, SIGNAL(triggered(bool)), dpi, SLOT(copyIDataBytes(bool)));
+ connect(action, &QAction::triggered, dpi, &DataPrinter::copyIDataBytes);
action = new QAction(tr(UTF8_HORIZONTAL_ELLIPSIS "as Escaped String"), actions);
action->setToolTip(tr("Copy packet bytes as an escaped string."));
action->setProperty("printertype", DataPrinter::DP_EscapedString);
- connect(action, SIGNAL(triggered(bool)), dpi, SLOT(copyIDataBytes(bool)));
+ connect(action, &QAction::triggered, dpi, &DataPrinter::copyIDataBytes);
return actions;
}