aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2019-11-17 20:02:20 +0100
committerRoland Knall <rknall@gmail.com>2019-11-17 20:43:10 +0000
commita51c58fa1b1605a6088d82baf832f4fd7df49a75 (patch)
treed2f4bc0bddebd7ccfb4ad072a5114005d190b41c /ui/qt
parent1ddd30856d59b138861def6bff407f035c8babee (diff)
Qt: Cleanup space inside parentheses
Remove randomly used space inside parentheses to make the coding style uniform. Add space after if, for and while. Change-Id: I519f5994b6f73d8a57a5004d51ca460276c618fe Reviewed-on: https://code.wireshark.org/review/35112 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/about_dialog.cpp80
-rw-r--r--ui/qt/byte_view_tab.cpp42
-rw-r--r--ui/qt/capture_file_dialog.cpp16
-rw-r--r--ui/qt/capture_interfaces_dialog.cpp2
-rw-r--r--ui/qt/coloring_rules_dialog.cpp20
-rw-r--r--ui/qt/column_preferences_frame.cpp4
-rw-r--r--ui/qt/enabled_protocols_dialog.cpp4
-rw-r--r--ui/qt/export_object_action.cpp8
-rw-r--r--ui/qt/extcap_argument.cpp224
-rw-r--r--ui/qt/extcap_argument.h2
-rw-r--r--ui/qt/extcap_argument_file.cpp20
-rw-r--r--ui/qt/extcap_argument_multiselect.cpp42
-rw-r--r--ui/qt/extcap_options_dialog.cpp166
-rw-r--r--ui/qt/file_set_dialog.cpp2
-rw-r--r--ui/qt/filter_action.cpp28
-rw-r--r--ui/qt/filter_dialog.cpp30
-rw-r--r--ui/qt/filter_expression_frame.cpp10
-rw-r--r--ui/qt/follow_stream_dialog.cpp14
-rw-r--r--ui/qt/import_text_dialog.cpp8
-rw-r--r--ui/qt/interface_frame.cpp44
-rw-r--r--ui/qt/io_graph_dialog.cpp18
-rw-r--r--ui/qt/lte_rlc_graph_dialog.cpp4
-rw-r--r--ui/qt/main.cpp4
-rw-r--r--ui/qt/main_status_bar.cpp60
-rw-r--r--ui/qt/main_window.cpp10
-rw-r--r--ui/qt/main_window_layout.cpp2
-rw-r--r--ui/qt/main_window_slots.cpp34
-rw-r--r--ui/qt/manage_interfaces_dialog.cpp6
-rw-r--r--ui/qt/manager/preference_manager.cpp10
-rw-r--r--ui/qt/models/astringlist_list_model.cpp56
-rw-r--r--ui/qt/models/coloring_rules_model.cpp16
-rw-r--r--ui/qt/models/column_list_model.cpp102
-rw-r--r--ui/qt/models/decode_as_delegate.cpp2
-rw-r--r--ui/qt/models/decode_as_model.cpp2
-rw-r--r--ui/qt/models/dissector_tables_model.cpp2
-rw-r--r--ui/qt/models/enabled_protocols_model.cpp56
-rw-r--r--ui/qt/models/expert_info_model.cpp2
-rw-r--r--ui/qt/models/expert_info_proxy_model.cpp2
-rw-r--r--ui/qt/models/fileset_entry_model.cpp4
-rw-r--r--ui/qt/models/filter_list_model.cpp62
-rw-r--r--ui/qt/models/info_proxy_model.cpp20
-rw-r--r--ui/qt/models/interface_sort_filter_model.cpp70
-rw-r--r--ui/qt/models/interface_tree_cache_model.cpp146
-rw-r--r--ui/qt/models/interface_tree_model.cpp144
-rw-r--r--ui/qt/models/numeric_value_chooser_delegate.cpp6
-rw-r--r--ui/qt/models/packet_list_model.cpp4
-rw-r--r--ui/qt/models/path_chooser_delegate.cpp16
-rw-r--r--ui/qt/models/pref_delegate.cpp6
-rw-r--r--ui/qt/models/pref_models.cpp8
-rw-r--r--ui/qt/models/profile_model.cpp352
-rw-r--r--ui/qt/models/proto_tree_model.cpp14
-rw-r--r--ui/qt/models/related_packet_delegate.cpp8
-rw-r--r--ui/qt/models/resolved_addresses_models.cpp6
-rw-r--r--ui/qt/models/sparkline_delegate.cpp2
-rw-r--r--ui/qt/models/uat_delegate.cpp4
-rw-r--r--ui/qt/models/uat_model.cpp4
-rw-r--r--ui/qt/packet_dialog.cpp2
-rw-r--r--ui/qt/packet_list.cpp94
-rw-r--r--ui/qt/packet_range_group_box.cpp2
-rw-r--r--ui/qt/preferences_dialog.cpp4
-rw-r--r--ui/qt/profile_dialog.cpp144
-rw-r--r--ui/qt/proto_tree.cpp72
-rw-r--r--ui/qt/resolved_addresses_dialog.cpp12
-rw-r--r--ui/qt/rpc_service_response_time_dialog.cpp2
-rw-r--r--ui/qt/rtp_analysis_dialog.cpp12
-rw-r--r--ui/qt/sctp_chunk_statistics_dialog.cpp2
-rw-r--r--ui/qt/sctp_graph_dialog.cpp2
-rw-r--r--ui/qt/tcp_stream_dialog.cpp6
-rw-r--r--ui/qt/utils/color_utils.cpp14
-rw-r--r--ui/qt/utils/data_printer.cpp24
-rw-r--r--ui/qt/utils/field_information.cpp20
-rw-r--r--ui/qt/utils/frame_information.cpp8
-rw-r--r--ui/qt/utils/proto_node.cpp10
-rw-r--r--ui/qt/utils/wireshark_zip_helper.cpp60
-rw-r--r--ui/qt/utils/wireshark_zip_helper.h2
-rw-r--r--ui/qt/voip_calls_dialog.cpp6
-rw-r--r--ui/qt/widgets/additional_toolbar.cpp140
-rw-r--r--ui/qt/widgets/apply_line_edit.cpp16
-rw-r--r--ui/qt/widgets/byte_view_text.cpp4
-rw-r--r--ui/qt/widgets/capture_filter_edit.cpp18
-rw-r--r--ui/qt/widgets/clickable_label.cpp4
-rw-r--r--ui/qt/widgets/clickable_label.h2
-rw-r--r--ui/qt/widgets/copy_from_profile_button.cpp38
-rw-r--r--ui/qt/widgets/display_filter_edit.cpp78
-rw-r--r--ui/qt/widgets/drag_drop_toolbar.cpp54
-rw-r--r--ui/qt/widgets/editor_file_dialog.cpp2
-rw-r--r--ui/qt/widgets/filter_expression_toolbar.cpp34
-rw-r--r--ui/qt/widgets/packet_list_header.cpp36
-rw-r--r--ui/qt/widgets/profile_tree_view.cpp20
-rw-r--r--ui/qt/widgets/qcustomplot.cpp20
-rw-r--r--ui/qt/widgets/wireless_timeline.cpp4
-rw-r--r--ui/qt/wireshark_application.cpp14
-rw-r--r--ui/qt/wireshark_dialog.cpp2
-rw-r--r--ui/qt/wlan_statistics_dialog.cpp2
94 files changed, 1508 insertions, 1508 deletions
diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp
index 3f35683cec..d4af61e2da 100644
--- a/ui/qt/about_dialog.cpp
+++ b/ui/qt/about_dialog.cpp
@@ -80,20 +80,20 @@ AStringListListModel(parent)
while (!ReadFile_authors.atEnd()) {
QString line = ReadFile_authors.readLine();
- if ( ! readAck && line.trimmed().length() == 0 )
+ if (! readAck && line.trimmed().length() == 0)
continue;
- if ( line.startsWith("------") )
+ if (line.startsWith("------"))
continue;
- if ( line.contains("Acknowledgements") )
+ if (line.contains("Acknowledgements"))
{
readAck = true;
continue;
}
- else if ( rx.indexIn(line) != -1 )
- appendRow( QStringList() << rx.cap(1).trimmed() << rx.cap(2).trimmed());
+ else if (rx.indexIn(line) != -1)
+ appendRow(QStringList() << rx.cap(1).trimmed() << rx.cap(2).trimmed());
- if ( readAck && (!line.isEmpty() || !acknowledgement_.isEmpty()) )
+ if (readAck && (!line.isEmpty() || !acknowledgement_.isEmpty()))
acknowledgement_.append(QString("%1\n").arg(line));
}
f_authors.close();
@@ -193,54 +193,54 @@ FolderListModel::FolderListModel(QObject * parent):
AStringListListModel(parent)
{
/* "file open" */
- appendRow( QStringList() << tr("\"File\" dialogs") << get_last_open_dir() << tr("capture files"));
+ appendRow(QStringList() << tr("\"File\" dialogs") << get_last_open_dir() << tr("capture files"));
/* temp */
- appendRow( QStringList() << tr("Temp") << g_get_tmp_dir() << tr("untitled capture files"));
+ appendRow(QStringList() << tr("Temp") << g_get_tmp_dir() << tr("untitled capture files"));
/* pers conf */
- appendRow( QStringList() << tr("Personal configuration")
+ appendRow(QStringList() << tr("Personal configuration")
<< gchar_free_to_qstring(get_persconffile_path("", FALSE))
<< tr("dfilters, preferences, ethers, " UTF8_HORIZONTAL_ELLIPSIS));
/* global conf */
QString dirPath = get_datafile_dir();
if (! dirPath.isEmpty()) {
- appendRow ( QStringList() << tr("Global configuration") << dirPath
+ appendRow (QStringList() << tr("Global configuration") << dirPath
<< tr("dfilters, preferences, manuf, " UTF8_HORIZONTAL_ELLIPSIS));
}
/* system */
- appendRow( QStringList() << tr("System") << get_systemfile_dir() << tr("ethers, ipxnets"));
+ appendRow(QStringList() << tr("System") << get_systemfile_dir() << tr("ethers, ipxnets"));
/* program */
- appendRow( QStringList() << tr("Program") << get_progfile_dir() << tr("program files"));
+ appendRow(QStringList() << tr("Program") << get_progfile_dir() << tr("program files"));
#ifdef HAVE_PLUGINS
/* pers plugins */
- appendRow( QStringList() << tr("Personal Plugins") << get_plugins_pers_dir_with_version() << tr("binary plugins"));
+ appendRow(QStringList() << tr("Personal Plugins") << get_plugins_pers_dir_with_version() << tr("binary plugins"));
/* global plugins */
- appendRow( QStringList() << tr("Global Plugins") << get_plugins_dir_with_version() << tr("binary plugins"));
+ appendRow(QStringList() << tr("Global Plugins") << get_plugins_dir_with_version() << tr("binary plugins"));
#endif
#ifdef HAVE_LUA
/* pers plugins */
- appendRow( QStringList() << tr("Personal Lua Plugins") << get_plugins_pers_dir() << tr("lua scripts"));
+ appendRow(QStringList() << tr("Personal Lua Plugins") << get_plugins_pers_dir() << tr("lua scripts"));
/* global plugins */
- appendRow( QStringList() << tr("Global Lua Plugins") << get_plugins_dir() << tr("lua scripts"));
+ appendRow(QStringList() << tr("Global Lua Plugins") << get_plugins_dir() << tr("lua scripts"));
#endif
/* Extcap */
- appendRow( QStringList() << tr("Personal Extcap path") << QString(get_persconffile_path("extcap", FALSE)).trimmed() << tr("Extcap Plugins search path"));
- appendRow( QStringList() << tr("Global Extcap path") << QString(get_extcap_dir()).trimmed() << tr("Extcap Plugins search path"));
+ appendRow(QStringList() << tr("Personal Extcap path") << QString(get_persconffile_path("extcap", FALSE)).trimmed() << tr("Extcap Plugins search path"));
+ appendRow(QStringList() << tr("Global Extcap path") << QString(get_extcap_dir()).trimmed() << tr("Extcap Plugins search path"));
#ifdef HAVE_MAXMINDDB
/* MaxMind DB */
QStringList maxMindDbPaths = QString(maxmind_db_get_paths()).split(G_SEARCHPATH_SEPARATOR_S);
foreach(QString path, maxMindDbPaths)
- appendRow( QStringList() << tr("MaxMind DB path") << path.trimmed() << tr("MaxMind DB database search path"));
+ appendRow(QStringList() << tr("MaxMind DB path") << path.trimmed() << tr("MaxMind DB database search path"));
#endif
#ifdef HAVE_LIBSMI
@@ -249,13 +249,13 @@ FolderListModel::FolderListModel(QObject * parent):
QStringList smiPaths = QString(default_mib_path).split(G_SEARCHPATH_SEPARATOR_S);
g_free(default_mib_path);
foreach(QString path, smiPaths)
- appendRow( QStringList() << tr("MIB/PIB path") << path.trimmed() << tr("SMI MIB/PIB search path"));
+ appendRow(QStringList() << tr("MIB/PIB path") << path.trimmed() << tr("SMI MIB/PIB search path"));
#endif
#ifdef Q_OS_MAC
/* Mac Extras */
QString extras_path = wsApp->applicationDirPath() + "/../Resources/Extras";
- appendRow( QStringList() << tr("macOS Extras") << QDir::cleanPath(extras_path) << tr("Extra macOS packages"));
+ appendRow(QStringList() << tr("macOS Extras") << QDir::cleanPath(extras_path) << tr("Extra macOS packages"));
#endif
}
@@ -473,19 +473,19 @@ void AboutDialog::urlDoubleClicked(const QModelIndex &idx)
return;
}
QTreeView * table = qobject_cast<QTreeView *>(sender());
- if ( ! table )
+ if (! table)
return;
QString urlText = table->model()->data(idx).toString();
- if ( urlText.isEmpty() )
+ if (urlText.isEmpty())
return;
- if ( ! QDir(urlText).exists() )
+ if (! QDir(urlText).exists())
{
- if ( QMessageBox::question(this, tr("The directory does not exist"),
- QString(tr("Should the directory %1 be created?").arg(urlText)) ) == QMessageBox::Yes )
+ if (QMessageBox::question(this, tr("The directory does not exist"),
+ QString(tr("Should the directory %1 be created?").arg(urlText))) == QMessageBox::Yes)
{
- if ( ! QDir().mkdir(urlText) )
+ if (! QDir().mkdir(urlText))
{
QMessageBox::warning(this, tr("The directory could not be created"),
QString(tr("The directory %1 could not be created!").arg(urlText)));
@@ -493,10 +493,10 @@ void AboutDialog::urlDoubleClicked(const QModelIndex &idx)
}
}
- if ( QDir(urlText).exists() )
+ if (QDir(urlText).exists())
{
QUrl url = QUrl::fromLocalFile(urlText);
- if ( url.isValid() )
+ if (url.isValid())
QDesktopServices::openUrl(url);
}
}
@@ -504,11 +504,11 @@ void AboutDialog::urlDoubleClicked(const QModelIndex &idx)
void AboutDialog::handleCopyMenu(QPoint pos)
{
QTreeView * tree = qobject_cast<QTreeView *>(sender());
- if ( ! tree )
+ if (! tree)
return;
QModelIndex index = tree->indexAt(pos);
- if ( ! index.isValid() )
+ if (! index.isValid())
return;
QMenu * menu = new QMenu(this);
@@ -561,7 +561,7 @@ void AboutDialog::copyRowActionTriggered()
void AboutDialog::copyActionTriggered(bool copyRow)
{
QAction * sendingAction = qobject_cast<QAction *>(sender());
- if ( ! sendingAction )
+ if (! sendingAction)
return;
QTreeView * tree = VariantPointer<QTreeView>::asPtr(sendingAction->data());
@@ -569,33 +569,33 @@ void AboutDialog::copyActionTriggered(bool copyRow)
QModelIndexList selIndeces = tree->selectionModel()->selectedIndexes();
int copyColumn = -1;
- if ( ! copyRow )
+ if (! copyRow)
{
QMenu * menu = qobject_cast<QMenu *>(sendingAction->parentWidget());
- if ( menu )
+ if (menu)
{
QPoint menuPosOnTable = tree->mapFromGlobal(menu->pos());
QModelIndex clickedIndex = tree->indexAt(menuPosOnTable);
- if ( clickedIndex.isValid() )
+ if (clickedIndex.isValid())
copyColumn = clickedIndex.column();
}
}
QString clipdata;
- if ( selIndeces.count() > 0 )
+ if (selIndeces.count() > 0)
{
int columnCount = tree->model()->columnCount();
QList<int> visitedRows;
foreach(QModelIndex index, selIndeces)
{
- if ( visitedRows.contains(index.row()) )
+ if (visitedRows.contains(index.row()))
continue;
QStringList row;
- if ( copyRow )
+ if (copyRow)
{
- for ( int cnt = 0; cnt < columnCount; cnt++ )
+ for (int cnt = 0; cnt < columnCount; cnt++)
{
QModelIndex dataIdx = tree->model()->index(index.row(), cnt);
row << tree->model()->data(dataIdx).toString();
@@ -603,7 +603,7 @@ void AboutDialog::copyActionTriggered(bool copyRow)
}
else
{
- if ( copyColumn < 0 )
+ if (copyColumn < 0)
copyColumn = index.column();
QModelIndex dataIdx = tree->model()->index(index.row(), copyColumn);
diff --git a/ui/qt/byte_view_tab.cpp b/ui/qt/byte_view_tab.cpp
index bb9a321e2a..a5279afc4e 100644
--- a/ui/qt/byte_view_tab.cpp
+++ b/ui/qt/byte_view_tab.cpp
@@ -68,15 +68,15 @@ void ByteViewTab::connectToMainWindow()
void ByteViewTab::captureActive(int cap)
{
- if ( cap == 0 )
+ if (cap == 0)
{
QList<ByteViewText *> allBVTs = findChildren<ByteViewText *>();
- if ( allBVTs.count() > 0 )
+ if (allBVTs.count() > 0)
{
ByteViewText * bvt = allBVTs.at(0);
tvbuff_t * stored = VariantPointer<tvbuff_t>::asPtr(bvt->property(tvb_data_property));
- if ( ! stored )
+ if (! stored)
selectedFrameChanged(-1);
}
}
@@ -89,11 +89,11 @@ void ByteViewTab::addTab(const char *name, tvbuff_t *tvb) {
}
packet_char_enc encoding = PACKET_CHAR_ENC_CHAR_ASCII;
- if ( cap_file_ && cap_file_->current_frame )
+ if (cap_file_ && cap_file_->current_frame)
encoding = (packet_char_enc)cap_file_->current_frame->encoding;
QByteArray data;
- if ( tvb ) {
+ if (tvb) {
int data_len = (int) tvb_captured_length(tvb);
if (data_len > 0) {
// Note: this does not copy the data and will be invalidated when
@@ -106,7 +106,7 @@ void ByteViewTab::addTab(const char *name, tvbuff_t *tvb) {
byte_view_text->setAccessibleName(name);
byte_view_text->setMonospaceFont(wsApp->monospaceFont(true));
- if ( tvb )
+ if (tvb)
{
byte_view_text->setProperty(tvb_data_property, VariantPointer<tvbuff_t>::asQVariant(tvb));
@@ -124,15 +124,15 @@ void ByteViewTab::addTab(const char *name, tvbuff_t *tvb) {
void ByteViewTab::byteViewTextHovered(int idx)
{
- if ( idx >= 0 && edt_ )
+ if (idx >= 0 && edt_)
{
tvbuff_t * tvb = VariantPointer<tvbuff_t>::asPtr(sender()->property(tvb_data_property));
proto_tree * tree = edt_->tree;
- if ( tvb && tree )
+ if (tvb && tree)
{
field_info * fi = proto_find_field_from_offset(tree, idx, tvb);
- if ( fi )
+ if (fi)
{
FieldInformation finfo(fi, this);
highlightedFieldChanged(&finfo);
@@ -147,15 +147,15 @@ void ByteViewTab::byteViewTextHovered(int idx)
void ByteViewTab::byteViewTextMarked(int idx)
{
- if ( idx >= 0 && edt_ )
+ if (idx >= 0 && edt_)
{
tvbuff_t * tvb = VariantPointer<tvbuff_t>::asPtr(sender()->property(tvb_data_property));
proto_tree * tree = edt_->tree;
- if ( tvb && tree )
+ if (tvb && tree)
{
field_info * fi = proto_find_field_from_offset(tree, idx, tvb);
- if ( fi )
+ if (fi)
{
FieldInformation finfo(fi, this);
emit fieldSelected(&finfo);
@@ -171,7 +171,7 @@ ByteViewText * ByteViewTab::findByteViewTextForTvb(tvbuff_t * search_tvb, int *
{
ByteViewText * item = 0;
- if ( ! search_tvb )
+ if (! search_tvb)
return item;
bool found = false;
@@ -182,13 +182,13 @@ ByteViewText * ByteViewTab::findByteViewTextForTvb(tvbuff_t * search_tvb, int *
{
ByteViewText * bvt = allBVTs.at(i);
tvbuff_t * stored = VariantPointer<tvbuff_t>::asPtr(bvt->property(tvb_data_property));
- if ( stored == search_tvb )
+ if (stored == search_tvb)
{
found = true;
}
- else if ( stored )
+ else if (stored)
{
- if ( stored->length >= length && tvb_memeql(search_tvb, 0, tvb_get_ptr(stored, 0, length), length ) == 0 )
+ if (stored->length >= length && tvb_memeql(search_tvb, 0, tvb_get_ptr(stored, 0, length), length) == 0)
{
/* In packetDialog we do not match, because we came from different data sources.
* Assuming the capture files match, this should be a sufficient enough difference */
@@ -196,10 +196,10 @@ ByteViewText * ByteViewTab::findByteViewTextForTvb(tvbuff_t * search_tvb, int *
}
}
- if ( found )
+ if (found)
{
int wdgIdx = bvt->property("tab_index").toInt();
- if ( idx )
+ if (idx)
{
*idx = wdgIdx;
}
@@ -246,9 +246,9 @@ void ByteViewTab::selectedFrameChanged(int frameNum)
}
}
- if ( frameNum >= 0 )
+ if (frameNum >= 0)
{
- if ( ! cap_file_ || ! cap_file_->edt )
+ if (! cap_file_ || ! cap_file_->edt)
return;
/* This code relies on a dissection, which had happened somewhere else. It also does not
@@ -286,7 +286,7 @@ void ByteViewTab::selectedFieldChanged(FieldInformation *selected)
const field_info *fi = selected->fieldInfo();
int idx = 0;
- if ( fi )
+ if (fi)
byte_view_text = findByteViewTextForTvb(fi->ds_tvb, &idx);
if (cap_file_->search_in_progress && (cap_file_->hex || (cap_file_->string && cap_file_->packet_data))) {
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index 95bb78e335..6bdc06e5c8 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -296,7 +296,7 @@ check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name,
GString *fname = g_string_new(file_name.toUtf8().constData());
gboolean wespf_status;
- if ( selRange.length() > 0 )
+ if (selRange.length() > 0)
{
packet_range_convert_selection_str(range, selRange.toUtf8().constData());
}
@@ -870,7 +870,7 @@ void CaptureFileDialog::preview(const QString & path)
wth = wtap_open_offline(path.toUtf8().data(), WTAP_TYPE_AUTO, &err, &err_info, TRUE);
if (wth == NULL) {
- if(err == WTAP_ERR_FILE_UNKNOWN_FORMAT) {
+ if (err == WTAP_ERR_FILE_UNKNOWN_FORMAT) {
preview_format_.setText(tr("unknown file format"));
} else {
preview_format_.setText(tr("error opening file"));
@@ -893,7 +893,7 @@ void CaptureFileDialog::preview(const QString & path)
status = get_stats_for_preview(wth, &stats, &err, &err_info);
- if(status == PREVIEW_READ_ERROR) {
+ if (status == PREVIEW_READ_ERROR) {
// XXX - give error details?
g_free(err_info);
preview_size_.setText(tr("%1, error after %Ln data record(s)", "", stats.records)
@@ -902,7 +902,7 @@ void CaptureFileDialog::preview(const QString & path)
}
// Packet count
- if(status == PREVIEW_TIMED_OUT) {
+ if (status == PREVIEW_TIMED_OUT) {
preview_size_.setText(tr("%1, timed out at %Ln data record(s)", "", stats.data_records)
.arg(size_str));
} else {
@@ -912,7 +912,7 @@ void CaptureFileDialog::preview(const QString & path)
// First packet + elapsed time
QString first_elapsed;
- if(stats.have_times) {
+ if (stats.have_times) {
//
// We saw at least one record with a time stamp, so we can give
// a start time (if we have a mix of records with and without
@@ -922,7 +922,7 @@ void CaptureFileDialog::preview(const QString & path)
ti_time = (long)stats.start_time;
ti_tm = localtime(&ti_time);
first_elapsed = "?";
- if(ti_tm) {
+ if (ti_tm) {
first_elapsed = QString().sprintf(
"%04d-%02d-%02d %02d:%02d:%02d",
ti_tm->tm_year + 1900,
@@ -939,7 +939,7 @@ void CaptureFileDialog::preview(const QString & path)
// Elapsed time
first_elapsed += " / ";
- if(status == PREVIEW_SUCCEEDED && stats.have_times) {
+ if (status == PREVIEW_SUCCEEDED && stats.have_times) {
//
// We didn't time out, so we looked at all packets, and we got
// at least one packet with a time stamp, so we can calculate
@@ -949,7 +949,7 @@ void CaptureFileDialog::preview(const QString & path)
// the last one with a time stamp, this may be inaccurate).
//
elapsed_time = (unsigned int)(stats.stop_time-stats.start_time);
- if(elapsed_time/86400) {
+ if (elapsed_time/86400) {
first_elapsed += QString().sprintf("%02u days %02u:%02u:%02u",
elapsed_time/86400, elapsed_time%86400/3600, elapsed_time%3600/60, elapsed_time%60);
} else {
diff --git a/ui/qt/capture_interfaces_dialog.cpp b/ui/qt/capture_interfaces_dialog.cpp
index c238c98897..0b407a79b7 100644
--- a/ui/qt/capture_interfaces_dialog.cpp
+++ b/ui/qt/capture_interfaces_dialog.cpp
@@ -537,7 +537,7 @@ void CaptureInterfacesDialog::on_buttonBox_helpRequested()
void CaptureInterfacesDialog::updateInterfaces()
{
- if(prefs.capture_pcap_ng) {
+ if (prefs.capture_pcap_ng) {
ui->rbPcapng->setChecked(true);
} else {
ui->rbPcap->setChecked(true);
diff --git a/ui/qt/coloring_rules_dialog.cpp b/ui/qt/coloring_rules_dialog.cpp
index 4d16f9a35e..16f2ab8df9 100644
--- a/ui/qt/coloring_rules_dialog.cpp
+++ b/ui/qt/coloring_rules_dialog.cpp
@@ -80,7 +80,7 @@ ColoringRulesDialog::ColoringRulesDialog(QWidget *parent, QString add_filter) :
this, SLOT(invalidField(const QModelIndex&, const QString&)));
connect(&colorRuleDelegate_, SIGNAL(validField(const QModelIndex&)),
this, SLOT(validField(const QModelIndex&)));
- connect(ui->coloringRulesTreeView, &QTreeView::clicked, this, &ColoringRulesDialog::treeItemClicked );
+ connect(ui->coloringRulesTreeView, &QTreeView::clicked, this, &ColoringRulesDialog::treeItemClicked);
connect(&colorRuleModel_, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(rowCountChanged()));
connect(&colorRuleModel_, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(rowCountChanged()));
@@ -185,7 +185,7 @@ bool ColoringRulesDialog::isValidFilter(QString filter, QString * error)
}
dfilter_free(dfp);
- if ( err_msg )
+ if (err_msg)
{
error->append(err_msg);
g_free(err_msg);
@@ -208,16 +208,16 @@ void ColoringRulesDialog::treeItemClicked(const QModelIndex &index)
{
QList<QModelIndex> keys = errors_.keys();
bool update = false;
- foreach ( QModelIndex key, keys )
+ foreach (QModelIndex key, keys)
{
- if ( key.row() == index.row() )
+ if (key.row() == index.row())
{
errors_.remove(key);
update = true;
}
}
- if ( update )
+ if (update)
updateHint(index);
}
}
@@ -232,16 +232,16 @@ void ColoringRulesDialog::validField(const QModelIndex &index)
{
QList<QModelIndex> keys = errors_.keys();
bool update = false;
- foreach ( QModelIndex key, keys )
+ foreach (QModelIndex key, keys)
{
- if ( key.row() == index.row() )
+ if (key.row() == index.row())
{
errors_.remove(key);
update = true;
}
}
- if ( update )
+ if (update)
updateHint(index);
}
@@ -268,10 +268,10 @@ void ColoringRulesDialog::updateHint(QModelIndex idx)
hint += tr("Double click to edit. Drag to move. Rules are processed in order until a match is found.");
} else {
hint += error_text;
- if ( idx.isValid() )
+ if (idx.isValid())
{
QModelIndex fiIdx = ui->coloringRulesTreeView->model()->index(idx.row(), ColoringRulesModel::colName);
- if ( fiIdx.data(Qt::CheckStateRole).toInt() == Qt::Checked )
+ if (fiIdx.data(Qt::CheckStateRole).toInt() == Qt::Checked)
enable_save = false;
}
else
diff --git a/ui/qt/column_preferences_frame.cpp b/ui/qt/column_preferences_frame.cpp
index aad81540ba..a98c0f8a96 100644
--- a/ui/qt/column_preferences_frame.cpp
+++ b/ui/qt/column_preferences_frame.cpp
@@ -90,7 +90,7 @@ void ColumnPreferencesFrame::on_newToolButton_clicked()
void ColumnPreferencesFrame::on_deleteToolButton_clicked()
{
- if ( ui->columnTreeView->selectionModel()->selectedIndexes().count() > 0 )
+ if (ui->columnTreeView->selectionModel()->selectedIndexes().count() > 0)
{
QModelIndex selIndex = ui->columnTreeView->selectionModel()->selectedIndexes().at(0);
model_->deleteEntry(proxyModel_->mapToSource(selIndex).row());
@@ -100,7 +100,7 @@ void ColumnPreferencesFrame::on_deleteToolButton_clicked()
void ColumnPreferencesFrame::selectionChanged(const QItemSelection &/*selected*/,
const QItemSelection &/*deselected*/)
{
- ui->deleteToolButton->setEnabled( ui->columnTreeView->selectionModel()->selectedIndexes().count() > 0 );
+ ui->deleteToolButton->setEnabled(ui->columnTreeView->selectionModel()->selectedIndexes().count() > 0);
}
void ColumnPreferencesFrame::on_chkShowDisplayedOnly_stateChanged(int /*state*/)
diff --git a/ui/qt/enabled_protocols_dialog.cpp b/ui/qt/enabled_protocols_dialog.cpp
index 7cb7b85223..5eb9abbc84 100644
--- a/ui/qt/enabled_protocols_dialog.cpp
+++ b/ui/qt/enabled_protocols_dialog.cpp
@@ -87,10 +87,10 @@ void EnabledProtocolsDialog::searchFilterChange()
EnabledProtocolItem::EnableProtocolType protocol = EnabledProtocolItem::Any;
QString search_re = ui->search_line_edit_->text();
- if ( ui->cmbSearchType->currentData().canConvert<EnabledProtocolsProxyModel::SearchType>() )
+ if (ui->cmbSearchType->currentData().canConvert<EnabledProtocolsProxyModel::SearchType>())
type = ui->cmbSearchType->currentData().value<EnabledProtocolsProxyModel::SearchType>();
- if ( ui->cmbProtocolType->currentData().canConvert<EnabledProtocolItem::EnableProtocolType>() )
+ if (ui->cmbProtocolType->currentData().canConvert<EnabledProtocolItem::EnableProtocolType>())
protocol = ui->cmbProtocolType->currentData().value<EnabledProtocolItem::EnableProtocolType>();
proxyModel_->setFilter(search_re, type, protocol);
diff --git a/ui/qt/export_object_action.cpp b/ui/qt/export_object_action.cpp
index e1beb5471d..a19b6aaef4 100644
--- a/ui/qt/export_object_action.cpp
+++ b/ui/qt/export_object_action.cpp
@@ -25,17 +25,17 @@ ExportObjectAction::ExportObjectAction(QObject *parent, register_eo_t *eo) :
eo_(eo)
{
if (eo_) {
- setText( QString("%1%2").arg(proto_get_protocol_short_name(find_protocol_by_id(get_eo_proto_id(eo)))).arg(UTF8_HORIZONTAL_ELLIPSIS));
+ setText(QString("%1%2").arg(proto_get_protocol_short_name(find_protocol_by_id(get_eo_proto_id(eo)))).arg(UTF8_HORIZONTAL_ELLIPSIS));
}
}
void ExportObjectAction::captureFileEvent(CaptureEvent e)
{
- if ( e.captureContext() == CaptureEvent::File )
+ if (e.captureContext() == CaptureEvent::File)
{
- if ( e.eventType() == CaptureEvent::Opened )
+ if (e.eventType() == CaptureEvent::Opened)
setEnabled(true);
- else if ( e.eventType() == CaptureEvent::Closed )
+ else if (e.eventType() == CaptureEvent::Closed)
setEnabled(false);
}
}
diff --git a/ui/qt/extcap_argument.cpp b/ui/qt/extcap_argument.cpp
index e06cbbbc90..0e274435f7 100644
--- a/ui/qt/extcap_argument.cpp
+++ b/ui/qt/extcap_argument.cpp
@@ -53,11 +53,11 @@ QWidget * ExtArgTimestamp::createEditor(QWidget * parent)
QDateTimeEdit * tsBox;
QString text = defaultValue();
- if ( _argument->pref_valptr && *_argument->pref_valptr)
+ if (_argument->pref_valptr && *_argument->pref_valptr)
{
QString storeValue(*_argument->pref_valptr);
- if ( storeValue.length() > 0 && storeValue.compare(text) != 0 )
+ if (storeValue.length() > 0 && storeValue.compare(text) != 0)
text = storeValue.trimmed();
}
@@ -66,7 +66,7 @@ QWidget * ExtArgTimestamp::createEditor(QWidget * parent)
tsBox->setDisplayFormat(QLocale::system().dateTimeFormat());
tsBox->setCalendarPopup(true);
- if ( _argument->tooltip != NULL )
+ if (_argument->tooltip != NULL)
tsBox->setToolTip(QString().fromUtf8(_argument->tooltip));
connect(tsBox, SIGNAL(dateTimeChanged(QDateTime)), SLOT(onDateTimeChanged(QDateTime)));
@@ -89,7 +89,7 @@ bool ExtArgTimestamp::isValid()
{
bool valid = true;
- if ( value().length() == 0 && isRequired() )
+ if (value().length() == 0 && isRequired())
valid = false;
return valid;
@@ -123,31 +123,31 @@ QWidget * ExtArgSelector::createEditor(QWidget * parent)
boxSelection = new QComboBox(parent);
layout->addWidget(boxSelection);
- if ( values.length() > 0 )
+ if (values.length() > 0)
{
ExtcapValueList::const_iterator iter = values.constBegin();
- while ( iter != values.constEnd() )
+ while (iter != values.constEnd())
{
boxSelection->addItem((*iter).value(), (*iter).call());
- if ( !prefval && (*iter).isDefault() )
+ if (!prefval && (*iter).isDefault())
selected = counter;
- else if ( prefval && stored.compare((*iter).call()) == 0 )
+ else if (prefval && stored.compare((*iter).call()) == 0)
selected = counter;
counter++;
++iter;
}
- if ( selected > -1 && selected < boxSelection->count() )
+ if (selected > -1 && selected < boxSelection->count())
boxSelection->setCurrentIndex(selected);
}
- if ( reload() )
+ if (reload())
{
QString btnText(tr("Reload data"));
- if ( _argument->placeholder )
+ if (_argument->placeholder)
btnText = QString(_argument->placeholder);
QPushButton * reloadButton = new QPushButton(btnText, editor);
@@ -158,7 +158,7 @@ QWidget * ExtArgSelector::createEditor(QWidget * parent)
connect(reloadButton, SIGNAL(clicked()), this, SLOT(onReloadTriggered()));
}
- connect ( boxSelection, SIGNAL(currentIndexChanged(int)), SLOT(onIntChanged(int)) );
+ connect (boxSelection, SIGNAL(currentIndexChanged(int)), SLOT(onIntChanged(int)));
editor->setLayout(layout);
@@ -173,29 +173,29 @@ void ExtArgSelector::onReloadTriggered()
QString call = boxSelection->currentData().toString();
const char *prefval = _argument->pref_valptr ? *_argument->pref_valptr : NULL;
QString stored(prefval ? prefval : "");
- if ( call != stored )
+ if (call != stored)
stored = call;
- if ( reloadValues() && values.length() > 0 )
+ if (reloadValues() && values.length() > 0)
{
boxSelection->clear();
ExtcapValueList::const_iterator iter = values.constBegin();
- while ( iter != values.constEnd() )
+ while (iter != values.constEnd())
{
boxSelection->addItem((*iter).value(), (*iter).call());
- if ( stored.compare((*iter).call()) == 0 )
+ if (stored.compare((*iter).call()) == 0)
selected = counter;
- else if ( (*iter).isDefault() && selected == -1 )
+ else if ((*iter).isDefault() && selected == -1)
selected = counter;
counter++;
++iter;
}
- if ( selected > -1 && selected < boxSelection->count() )
+ if (selected > -1 && selected < boxSelection->count())
boxSelection->setCurrentIndex(selected);
}
}
@@ -204,14 +204,14 @@ bool ExtArgSelector::isValid()
{
bool valid = true;
- if ( value().length() == 0 && isRequired() )
+ if (value().length() == 0 && isRequired())
valid = false;
- if ( boxSelection )
+ if (boxSelection)
{
QString lblInvalidColor = ColorUtils::fromColorT(prefs.gui_text_invalid).name();
QString cmbBoxStyle("QComboBox { background-color: %1; } ");
- boxSelection->setStyleSheet( cmbBoxStyle.arg(valid ? QString("") : lblInvalidColor) );
+ boxSelection->setStyleSheet(cmbBoxStyle.arg(valid ? QString("") : lblInvalidColor));
}
return valid;
@@ -219,7 +219,7 @@ bool ExtArgSelector::isValid()
QString ExtArgSelector::value()
{
- if ( boxSelection == 0 )
+ if (boxSelection == 0)
return QString();
QVariant data = boxSelection->currentData();
@@ -241,22 +241,22 @@ QWidget * ExtArgRadio::createEditor(QWidget * parent)
QVBoxLayout * vrLayout = new QVBoxLayout();
QMargins margins = vrLayout->contentsMargins();
vrLayout->setContentsMargins(0, 0, 0, margins.bottom());
- if ( callStrings != 0 )
+ if (callStrings != 0)
delete callStrings;
callStrings = new QList<QString>();
- if ( values.length() > 0 )
+ if (values.length() > 0 )
{
ExtcapValueList::const_iterator iter = values.constBegin();
- while ( iter != values.constEnd() )
+ while (iter != values.constEnd())
{
QRadioButton * radio = new QRadioButton((*iter).value());
QString callString = (*iter).call();
callStrings->append(callString);
- if ( (*iter).isDefault() )
+ if ((*iter).isDefault())
{
radio->setChecked(true);
anyChecked = true;
@@ -273,7 +273,7 @@ QWidget * ExtArgRadio::createEditor(QWidget * parent)
}
/* No default was provided, and not saved value exists */
- if ( anyChecked == false && count > 0 )
+ if (anyChecked == false && count > 0)
((QRadioButton*)(selectorGroup->button(0)))->setChecked(true);
radioButtons->setLayout(vrLayout);
@@ -284,11 +284,11 @@ QWidget * ExtArgRadio::createEditor(QWidget * parent)
QString ExtArgRadio::value()
{
int idx = 0;
- if ( selectorGroup == 0 || callStrings == 0 )
+ if (selectorGroup == 0 || callStrings == 0)
return QString();
idx = selectorGroup->checkedId();
- if ( idx > -1 && callStrings->length() > idx )
+ if (idx > -1 && callStrings->length() > idx)
return callStrings->takeAt(idx);
return QString();
@@ -299,14 +299,14 @@ bool ExtArgRadio::isValid()
bool valid = true;
int idx = 0;
- if ( isRequired() )
+ if (isRequired())
{
- if ( selectorGroup == 0 || callStrings == 0 )
+ if (selectorGroup == 0 || callStrings == 0)
valid = false;
else
{
idx = selectorGroup->checkedId();
- if ( idx == -1 || callStrings->length() <= idx )
+ if (idx == -1 || callStrings->length() <= idx)
valid = false;
}
}
@@ -314,7 +314,7 @@ bool ExtArgRadio::isValid()
/* If nothing is selected, but a selection is required, the only thing that
* can be marked is the label */
QString lblInvalidColor = ColorUtils::fromColorT(prefs.gui_text_invalid).name();
- _label->setStyleSheet ( label_style.arg(valid ? QString("") : lblInvalidColor) );
+ _label->setStyleSheet (label_style.arg(valid ? QString("") : lblInvalidColor));
return valid;
}
@@ -332,20 +332,20 @@ QWidget * ExtArgBool::createEditor(QWidget * parent)
bool state = defaultBool();
boolBox = new QCheckBox(QString().fromUtf8(_argument->display), parent);
- if ( _argument->tooltip != NULL )
+ if (_argument->tooltip != NULL)
boolBox->setToolTip(QString().fromUtf8(_argument->tooltip));
const char *prefval = _argument->pref_valptr ? *_argument->pref_valptr : NULL;
- if ( prefval )
+ if (prefval)
{
QRegExp regexp(EXTCAP_BOOLEAN_REGEX);
- bool savedstate = ( regexp.indexIn(QString(prefval[0]), 0) != -1 );
- if ( savedstate != state )
+ bool savedstate = (regexp.indexIn(QString(prefval[0]), 0) != -1);
+ if (savedstate != state)
state = savedstate;
}
- boolBox->setCheckState(state ? Qt::Checked : Qt::Unchecked );
+ boolBox->setCheckState(state ? Qt::Checked : Qt::Unchecked);
connect (boolBox, SIGNAL(stateChanged(int)), SLOT(onIntChanged(int)));
@@ -354,10 +354,10 @@ QWidget * ExtArgBool::createEditor(QWidget * parent)
QString ExtArgBool::call()
{
- if ( boolBox == NULL )
+ if (boolBox == NULL)
return QString("");
- if ( _argument->arg_type == EXTCAP_ARG_BOOLEAN )
+ if (_argument->arg_type == EXTCAP_ARG_BOOLEAN)
return ExtcapArgument::call();
return QString(boolBox->checkState() == Qt::Checked ? _argument->call : "");
@@ -365,14 +365,14 @@ QString ExtArgBool::call()
QString ExtArgBool::value()
{
- if ( boolBox == NULL || _argument->arg_type == EXTCAP_ARG_BOOLFLAG )
+ if (boolBox == NULL || _argument->arg_type == EXTCAP_ARG_BOOLFLAG)
return QString();
return QString(boolBox->checkState() == Qt::Checked ? "true" : "false");
}
QString ExtArgBool::prefValue()
{
- if ( boolBox == NULL )
+ if (boolBox == NULL)
return QString("false");
return QString(boolBox->checkState() == Qt::Checked ? "true" : "false");
}
@@ -388,9 +388,9 @@ bool ExtArgBool::defaultBool()
{
bool result = false;
- if ( _argument )
+ if (_argument)
{
- if ( extcap_complex_get_bool(_argument->default_complex) == (gboolean)TRUE )
+ if (extcap_complex_get_bool(_argument->default_complex) == (gboolean)TRUE)
result = true;
}
@@ -411,20 +411,20 @@ QWidget * ExtArgText::createEditor(QWidget * parent)
{
QString text = defaultValue();
- if ( _argument->pref_valptr && *_argument->pref_valptr)
+ if (_argument->pref_valptr && *_argument->pref_valptr)
{
QString storeValue(*_argument->pref_valptr);
- if ( storeValue.length() > 0 && storeValue.compare(text) != 0 )
+ if (storeValue.length() > 0 && storeValue.compare(text) != 0)
text = storeValue.trimmed();
}
textBox = new QLineEdit(text, parent);
- if ( _argument->tooltip != NULL )
+ if (_argument->tooltip != NULL)
textBox->setToolTip(QString().fromUtf8(_argument->tooltip));
- if ( _argument->placeholder != NULL )
+ if (_argument->placeholder != NULL)
textBox->setPlaceholderText(QString().fromUtf8(_argument->placeholder));
if (_argument->arg_type == EXTCAP_ARG_PASSWORD)
@@ -437,7 +437,7 @@ QWidget * ExtArgText::createEditor(QWidget * parent)
QString ExtArgText::value()
{
- if ( textBox == 0 )
+ if (textBox == 0)
return QString();
return textBox->text();
@@ -447,25 +447,25 @@ bool ExtArgText::isValid()
{
bool valid = true;
- if ( isRequired() && value().length() == 0 )
+ if (isRequired() && value().length() == 0)
valid = false;
/* validation should only be checked if there is a value. if the argument
* must be present (isRequired) the check above will handle that */
- if ( valid && _argument->regexp != NULL && value().length() > 0)
+ if (valid && _argument->regexp != NULL && value().length() > 0)
{
QString regexp = QString().fromUtf8(_argument->regexp);
- if ( regexp.length() > 0 )
+ if (regexp.length() > 0)
{
QRegExp expr(regexp);
- if ( ! expr.isValid() || expr.indexIn(value(), 0) == -1 )
+ if (! expr.isValid() || expr.indexIn(value(), 0) == -1)
valid = false;
}
}
QString lblInvalidColor = ColorUtils::fromColorT(prefs.gui_text_invalid).name();
QString txtStyle("QLineEdit { background-color: %1; } ");
- textBox->setStyleSheet( txtStyle.arg(valid ? QString("") : lblInvalidColor) );
+ textBox->setStyleSheet(txtStyle.arg(valid ? QString("") : lblInvalidColor));
return valid;
}
@@ -477,31 +477,31 @@ QWidget * ExtArgNumber::createEditor(QWidget * parent)
{
QString text = defaultValue();
- if ( _argument->pref_valptr && *_argument->pref_valptr)
+ if (_argument->pref_valptr && *_argument->pref_valptr)
{
QString storeValue(*_argument->pref_valptr);
- if ( storeValue.length() > 0 && storeValue.compare(text) != 0 )
+ if (storeValue.length() > 0 && storeValue.compare(text) != 0)
text = storeValue;
}
textBox = (QLineEdit *)ExtArgText::createEditor(parent);
textBox->disconnect(SIGNAL(textChanged(QString)));
- if ( _argument->arg_type == EXTCAP_ARG_INTEGER || _argument->arg_type == EXTCAP_ARG_UNSIGNED )
+ if (_argument->arg_type == EXTCAP_ARG_INTEGER || _argument->arg_type == EXTCAP_ARG_UNSIGNED)
{
QIntValidator * textValidator = new QIntValidator(parent);
- if ( _argument->range_start != NULL )
+ if (_argument->range_start != NULL)
{
int val = 0;
- if ( _argument->arg_type == EXTCAP_ARG_INTEGER )
+ if (_argument->arg_type == EXTCAP_ARG_INTEGER)
val = extcap_complex_get_int(_argument->range_start);
- else if ( _argument->arg_type == EXTCAP_ARG_UNSIGNED )
+ else if (_argument->arg_type == EXTCAP_ARG_UNSIGNED)
{
guint tmp = extcap_complex_get_uint(_argument->range_start);
- if ( tmp > G_MAXINT )
+ if (tmp > G_MAXINT)
{
- g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Defined value for range_start of %s exceeds valid integer range", _argument->call );
+ g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Defined value for range_start of %s exceeds valid integer range", _argument->call);
val = G_MAXINT;
}
else
@@ -510,23 +510,23 @@ QWidget * ExtArgNumber::createEditor(QWidget * parent)
textValidator->setBottom(val);
}
- if ( _argument->arg_type == EXTCAP_ARG_UNSIGNED && textValidator->bottom() < 0 )
+ if (_argument->arg_type == EXTCAP_ARG_UNSIGNED && textValidator->bottom() < 0)
{
- g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "%s sets negative bottom range for unsigned value, setting to 0", _argument->call );
+ g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "%s sets negative bottom range for unsigned value, setting to 0", _argument->call);
textValidator->setBottom(0);
}
- if ( _argument->range_end != NULL )
+ if (_argument->range_end != NULL)
{
int val = 0;
- if ( _argument->arg_type == EXTCAP_ARG_INTEGER )
+ if (_argument->arg_type == EXTCAP_ARG_INTEGER)
val = extcap_complex_get_int(_argument->range_end);
- else if ( _argument->arg_type == EXTCAP_ARG_UNSIGNED )
+ else if (_argument->arg_type == EXTCAP_ARG_UNSIGNED)
{
guint tmp = extcap_complex_get_uint(_argument->range_end);
- if ( tmp > G_MAXINT )
+ if (tmp > G_MAXINT)
{
- g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Defined value for range_end of %s exceeds valid integer range", _argument->call );
+ g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Defined value for range_end of %s exceeds valid integer range", _argument->call);
val = G_MAXINT;
}
else
@@ -537,12 +537,12 @@ QWidget * ExtArgNumber::createEditor(QWidget * parent)
}
textBox->setValidator(textValidator);
}
- else if ( _argument->arg_type == EXTCAP_ARG_DOUBLE )
+ else if (_argument->arg_type == EXTCAP_ARG_DOUBLE)
{
QDoubleValidator * textValidator = new QDoubleValidator(parent);
- if ( _argument->range_start != NULL )
+ if (_argument->range_start != NULL)
textValidator->setBottom(extcap_complex_get_double(_argument->range_start));
- if ( _argument->range_end != NULL )
+ if (_argument->range_end != NULL)
textValidator->setTop(extcap_complex_get_double(_argument->range_end));
textBox->setValidator(textValidator);
@@ -559,15 +559,15 @@ QString ExtArgNumber::defaultValue()
{
QString result;
- if ( _argument != 0 )
+ if (_argument != 0)
{
- if ( _argument->arg_type == EXTCAP_ARG_DOUBLE )
+ if (_argument->arg_type == EXTCAP_ARG_DOUBLE)
result = QString::number(extcap_complex_get_double(_argument->default_complex));
- else if ( _argument->arg_type == EXTCAP_ARG_INTEGER )
+ else if (_argument->arg_type == EXTCAP_ARG_INTEGER)
result = QString::number(extcap_complex_get_int(_argument->default_complex));
- else if ( _argument->arg_type == EXTCAP_ARG_UNSIGNED )
+ else if (_argument->arg_type == EXTCAP_ARG_UNSIGNED)
result = QString::number(extcap_complex_get_uint(_argument->default_complex));
- else if ( _argument->arg_type == EXTCAP_ARG_LONG )
+ else if (_argument->arg_type == EXTCAP_ARG_LONG)
result = QString::number(extcap_complex_get_long(_argument->default_complex));
else
{
@@ -584,7 +584,7 @@ ExtcapValue::~ExtcapValue() {}
void ExtcapValue::setChildren(ExtcapValueList children)
{
ExtcapValueList::iterator iter = children.begin();
- while ( iter != children.end() )
+ while (iter != children.end())
{
(*iter)._depth = _depth + 1;
++iter;
@@ -605,10 +605,10 @@ ExtcapArgument::ExtcapArgument(extcap_arg * argument, QObject *parent) :
{
_number = argument->arg_num;
- if ( _argument->values != 0 )
+ if (_argument->values != 0)
{
ExtcapValueList elements = loadValues(QString(""));
- if ( elements.length() > 0 )
+ if (elements.length() > 0)
values.append(elements);
}
}
@@ -619,17 +619,17 @@ ExtcapArgument::ExtcapArgument(const ExtcapArgument &obj) :
{
_number = obj._argument->arg_num;
- if ( _argument->values != 0 )
+ if (_argument->values != 0)
{
ExtcapValueList elements = loadValues(QString(""));
- if ( elements.length() > 0 )
+ if (elements.length() > 0)
values.append(elements);
}
}
ExtcapValueList ExtcapArgument::loadValues(QString parent)
{
- if (_argument == 0 || _argument->values == 0 )
+ if (_argument == 0 || _argument->values == 0)
return ExtcapValueList();
GList * walker = 0;
@@ -639,12 +639,12 @@ ExtcapValueList ExtcapArgument::loadValues(QString parent)
for (walker = g_list_first((GList *)(_argument->values)); walker != NULL ; walker = walker->next)
{
v = (extcap_value *) walker->data;
- if (v == NULL || v->display == NULL || v->call == NULL )
+ if (v == NULL || v->display == NULL || v->call == NULL)
break;
QString valParent = QString().fromUtf8(v->parent);
- if ( parent.compare(valParent) == 0 )
+ if (parent.compare(valParent) == 0)
{
QString display = QString().fromUtf8(v->display);
@@ -665,13 +665,13 @@ ExtcapValueList ExtcapArgument::loadValues(QString parent)
bool ExtcapArgument::reloadValues()
{
- if ( ! qobject_cast<ExtcapOptionsDialog*> ( parent() ) )
+ if (! qobject_cast<ExtcapOptionsDialog*> (parent()) )
return false;
ExtcapOptionsDialog * dialog = qobject_cast<ExtcapOptionsDialog*>(parent());
ExtcapValueList list = dialog->loadValuesFor(_argument->arg_num, _argument->call);
- if ( list.size() > 0 )
+ if (list.size() > 0)
{
values.clear();
values << list;
@@ -687,23 +687,23 @@ ExtcapArgument::~ExtcapArgument() {
QWidget * ExtcapArgument::createLabel(QWidget * parent)
{
- if ( _argument == 0 || _argument->display == 0 )
+ if (_argument == 0 || _argument->display == 0)
return 0;
QString lblInvalidColor = ColorUtils::fromColorT(prefs.gui_text_invalid).name();
QString text = QString().fromUtf8(_argument->display);
- if ( _label == 0 )
+ if (_label == 0)
_label = new QLabel(text, parent);
else
_label->setText(text);
_label->setProperty("isRequired", QString(isRequired() ? "true" : "false"));
- _label->setStyleSheet ( label_style.arg(QString("")) );
+ _label->setStyleSheet (label_style.arg(QString("")));
- if ( _argument->tooltip != 0 )
+ if (_argument->tooltip != 0)
_label->setToolTip(QString().fromUtf8(_argument->tooltip));
return (QWidget *)_label;
@@ -741,7 +741,7 @@ bool ExtcapArgument::isValid()
{
/* Unrequired arguments are always valid, except if validity checks fail,
* which must be checked in an derived class, not here */
- if ( ! isRequired() )
+ if (! isRequired())
return true;
return value().length() > 0;
@@ -749,10 +749,10 @@ bool ExtcapArgument::isValid()
QString ExtcapArgument::defaultValue()
{
- if ( _argument != 0 && _argument->default_complex != 0)
+ if (_argument != 0 && _argument->default_complex != 0)
{
gchar * str = extcap_get_complex_as_string(_argument->default_complex);
- if ( str != 0 )
+ if (str != 0)
return QString(str);
}
return QString();
@@ -760,7 +760,7 @@ QString ExtcapArgument::defaultValue()
QString ExtcapArgument::group() const
{
- if ( _argument != 0 && _argument->group != 0 )
+ if (_argument != 0 && _argument->group != 0)
return QString(_argument->group);
return QString();
@@ -775,11 +775,11 @@ QString ExtcapArgument::prefKey(const QString & device_name)
{
struct preference * pref = NULL;
- if ( _argument == 0 || ! _argument->save )
+ if (_argument == 0 || ! _argument->save)
return QString();
pref = extcap_pref_for_argument(device_name.toStdString().c_str(), _argument);
- if ( pref != NULL )
+ if (pref != NULL)
return QString(prefs_get_name(pref));
return QString();
@@ -787,7 +787,7 @@ QString ExtcapArgument::prefKey(const QString & device_name)
bool ExtcapArgument::isRequired()
{
- if ( _argument != NULL )
+ if (_argument != NULL)
return _argument->is_required;
return FALSE;
@@ -795,7 +795,7 @@ bool ExtcapArgument::isRequired()
bool ExtcapArgument::reload()
{
- if ( _argument != NULL )
+ if (_argument != NULL)
return _argument->reload;
return false;
@@ -803,7 +803,7 @@ bool ExtcapArgument::reload()
bool ExtcapArgument::fileExists()
{
- if ( _argument != NULL )
+ if (_argument != NULL)
return _argument->fileexists;
return FALSE;
@@ -811,7 +811,7 @@ bool ExtcapArgument::fileExists()
bool ExtcapArgument::isDefault()
{
- if ( value().compare(defaultValue()) == 0 )
+ if (value().compare(defaultValue()) == 0)
return true;
return false;
@@ -819,27 +819,27 @@ bool ExtcapArgument::isDefault()
ExtcapArgument * ExtcapArgument::create(extcap_arg * argument, QObject *parent)
{
- if ( argument == 0 || argument->display == 0 )
+ if (argument == 0 || argument->display == 0)
return 0;
ExtcapArgument * result = 0;
- if ( argument->arg_type == EXTCAP_ARG_STRING || argument->arg_type == EXTCAP_ARG_PASSWORD )
+ if (argument->arg_type == EXTCAP_ARG_STRING || argument->arg_type == EXTCAP_ARG_PASSWORD)
result = new ExtArgText(argument, parent);
- else if ( argument->arg_type == EXTCAP_ARG_INTEGER || argument->arg_type == EXTCAP_ARG_LONG ||
- argument->arg_type == EXTCAP_ARG_UNSIGNED || argument->arg_type == EXTCAP_ARG_DOUBLE )
+ else if (argument->arg_type == EXTCAP_ARG_INTEGER || argument->arg_type == EXTCAP_ARG_LONG ||
+ argument->arg_type == EXTCAP_ARG_UNSIGNED || argument->arg_type == EXTCAP_ARG_DOUBLE)
result = new ExtArgNumber(argument, parent);
- else if ( argument->arg_type == EXTCAP_ARG_BOOLEAN || argument->arg_type == EXTCAP_ARG_BOOLFLAG )
+ else if (argument->arg_type == EXTCAP_ARG_BOOLEAN || argument->arg_type == EXTCAP_ARG_BOOLFLAG)
result = new ExtArgBool(argument, parent);
- else if ( argument->arg_type == EXTCAP_ARG_SELECTOR )
+ else if (argument->arg_type == EXTCAP_ARG_SELECTOR)
result = new ExtArgSelector(argument, parent);
- else if ( argument->arg_type == EXTCAP_ARG_RADIO )
+ else if (argument->arg_type == EXTCAP_ARG_RADIO)
result = new ExtArgRadio(argument, parent);
- else if ( argument->arg_type == EXTCAP_ARG_FILESELECT )
+ else if (argument->arg_type == EXTCAP_ARG_FILESELECT)
result = new ExtcapArgumentFileSelection(argument, parent);
- else if ( argument->arg_type == EXTCAP_ARG_MULTICHECK )
+ else if (argument->arg_type == EXTCAP_ARG_MULTICHECK)
result = new ExtArgMultiSelect(argument, parent);
- else if ( argument->arg_type == EXTCAP_ARG_TIMESTAMP )
+ else if (argument->arg_type == EXTCAP_ARG_TIMESTAMP)
result = new ExtArgTimestamp(argument, parent);
else
{
@@ -858,7 +858,7 @@ void ExtcapArgument::onStringChanged(QString)
void ExtcapArgument::onIntChanged(int)
{
- if ( isValid() )
+ if (isValid())
emit valueChanged();
}
diff --git a/ui/qt/extcap_argument.h b/ui/qt/extcap_argument.h
index 07813f9f2a..163fe87e68 100644
--- a/ui/qt/extcap_argument.h
+++ b/ui/qt/extcap_argument.h
@@ -41,7 +41,7 @@ public:
void setChildren(ExtcapValueList children);
ExtcapValueList children()
{
- if ( _children.length() == 0 )
+ if (_children.length() == 0)
return ExtcapValueList();
return _children;
}
diff --git a/ui/qt/extcap_argument_file.cpp b/ui/qt/extcap_argument_file.cpp
index b0eb2d5b32..cc3bc6fa12 100644
--- a/ui/qt/extcap_argument_file.cpp
+++ b/ui/qt/extcap_argument_file.cpp
@@ -38,7 +38,7 @@ ExtcapArgumentFileSelection::ExtcapArgumentFileSelection (extcap_arg * argument,
ExtcapArgumentFileSelection::~ExtcapArgumentFileSelection()
{
- if ( textBox != NULL )
+ if (textBox != NULL)
delete textBox;
}
@@ -62,12 +62,12 @@ QWidget * ExtcapArgumentFileSelection::createEditor(QWidget * parent)
{
QString storeValue(prefval);
- if ( storeValue.length() > 0 && storeValue.compare(text) != 0 )
+ if (storeValue.length() > 0 && storeValue.compare(text) != 0)
text = storeValue.trimmed();
}
textBox->setText(text);
- if ( _argument->tooltip != NULL )
+ if (_argument->tooltip != NULL)
{
textBox->setToolTip(QString().fromUtf8(_argument->tooltip));
button->setToolTip(QString().fromUtf8(_argument->tooltip));
@@ -85,7 +85,7 @@ QWidget * ExtcapArgumentFileSelection::createEditor(QWidget * parent)
QString ExtcapArgumentFileSelection::value()
{
- if ( textBox == 0 )
+ if (textBox == 0)
return QString();
return textBox->text();
}
@@ -100,10 +100,10 @@ void ExtcapArgumentFileSelection::openFileDialog()
workingDir = QFileInfo(filename).dir();
QString fileExt(tr("All Files (" ALL_FILES_WILDCARD ")"));
- if ( _argument->fileextension != NULL )
+ if (_argument->fileextension != NULL)
{
QString givenExt = QString().fromUtf8(_argument->fileextension);
- if ( givenExt.length() != 0 )
+ if (givenExt.length() != 0)
fileExt.prepend(";;").prepend(givenExt);
}
@@ -111,7 +111,7 @@ void ExtcapArgumentFileSelection::openFileDialog()
QString().fromUtf8(_argument->display) + " " + tr("Open File"),
workingDir.absolutePath(), fileExt);
- if ( ! fileExists() || QFileInfo(filename).exists() )
+ if (! fileExists() || QFileInfo(filename).exists())
{
textBox->setText(filename);
emit valueChanged();
@@ -122,19 +122,19 @@ bool ExtcapArgumentFileSelection::isValid()
{
bool valid = false;
- if ( textBox->text().length() > 0 )
+ if (textBox->text().length() > 0)
{
if (_argument->fileexists)
valid = QFileInfo(textBox->text()).exists();
else
valid = true;
}
- else if ( ! isRequired() )
+ else if (! isRequired())
valid = true;
QString lblInvalidColor = ColorUtils::fromColorT(prefs.gui_text_invalid).name();
QString txtStyle("QLineEdit { background-color: %1; } ");
- textBox->setStyleSheet( txtStyle.arg(valid ? QString("") : lblInvalidColor) );
+ textBox->setStyleSheet(txtStyle.arg(valid ? QString("") : lblInvalidColor));
return valid;
}
diff --git a/ui/qt/extcap_argument_multiselect.cpp b/ui/qt/extcap_argument_multiselect.cpp
index 787f976353..5b4688930f 100644
--- a/ui/qt/extcap_argument_multiselect.cpp
+++ b/ui/qt/extcap_argument_multiselect.cpp
@@ -31,9 +31,9 @@ ExtArgMultiSelect::ExtArgMultiSelect(extcap_arg * argument, QObject *parent) :
ExtArgMultiSelect::~ExtArgMultiSelect()
{
- if ( treeView != 0 )
+ if (treeView != 0)
delete treeView;
- if ( viewModel != 0 )
+ if (viewModel != 0)
delete viewModel;
}
@@ -42,10 +42,10 @@ QList<QStandardItem *> ExtArgMultiSelect::valueWalker(ExtcapValueList list, QStr
ExtcapValueList::iterator iter = list.begin();
QList<QStandardItem *> items;
- while ( iter != list.end() )
+ while (iter != list.end())
{
QStandardItem * item = new QStandardItem((*iter).value());
- if ( (*iter).enabled() == false )
+ if ((*iter).enabled() == false)
{
item->setCheckable(false);
}
@@ -61,7 +61,7 @@ QList<QStandardItem *> ExtArgMultiSelect::valueWalker(ExtcapValueList list, QStr
item->setSelectable(false);
item->setEditable(false);
QList<QStandardItem *> childs = valueWalker((*iter).children(), defaults);
- if ( childs.length() > 0 )
+ if (childs.length() > 0)
item->appendRows(childs);
items << item;
@@ -76,12 +76,12 @@ void ExtArgMultiSelect::checkItemsWalker(QStandardItem * item, QStringList defau
QModelIndexList results;
QModelIndex index;
- if ( item->hasChildren() )
+ if (item->hasChildren())
{
for (int row = 0; row < item->rowCount(); row++)
{
QStandardItem * child = item->child(row);
- if ( child != 0 )
+ if (child != 0)
{
checkItemsWalker(child, defaults);
}
@@ -90,11 +90,11 @@ void ExtArgMultiSelect::checkItemsWalker(QStandardItem * item, QStringList defau
QString data = item->data(Qt::UserRole).toString();
- if ( defaults.contains(data) )
+ if (defaults.contains(data))
{
item->setCheckState(Qt::Checked);
index = item->index();
- while ( index.isValid() )
+ while (index.isValid())
{
treeView->setExpanded(index, true);
index = index.parent();
@@ -110,14 +110,14 @@ QWidget * ExtArgMultiSelect::createEditor(QWidget * parent)
if (items.length() == 0)
return new QWidget();
- if ( _argument->pref_valptr && *_argument->pref_valptr )
+ if (_argument->pref_valptr && *_argument->pref_valptr)
{
checked = QString(*_argument->pref_valptr).split(",", QString::SkipEmptyParts);
}
viewModel = new QStandardItemModel();
QList<QStandardItem *>::const_iterator iter = items.constBegin();
- while ( iter != items.constEnd() )
+ while (iter != items.constEnd())
{
((QStandardItemModel *)viewModel)->appendRow((*iter));
++iter;
@@ -132,10 +132,10 @@ QWidget * ExtArgMultiSelect::createEditor(QWidget * parent)
treeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
- for (int row = 0; row < viewModel->rowCount(); row++ )
+ for (int row = 0; row < viewModel->rowCount(); row++)
checkItemsWalker(((QStandardItemModel*)viewModel)->item(row), checked);
- connect ( viewModel,
+ connect (viewModel,
SIGNAL(itemChanged(QStandardItem *)),
SLOT(itemChanged(QStandardItem *)));
@@ -144,16 +144,16 @@ QWidget * ExtArgMultiSelect::createEditor(QWidget * parent)
QString ExtArgMultiSelect::value()
{
- if ( viewModel == 0 )
+ if (viewModel == 0)
return QString();
QStringList result;
QModelIndexList checked = viewModel->match(viewModel->index(0, 0), Qt::CheckStateRole, Qt::Checked, -1, Qt::MatchExactly | Qt::MatchRecursive);
- if ( checked.size() <= 0 )
+ if (checked.size() <= 0)
return QString();
QModelIndexList::const_iterator iter = checked.constBegin();
- while ( iter != checked.constEnd() )
+ while (iter != checked.constEnd())
{
QModelIndex index = (QModelIndex)(*iter);
@@ -174,22 +174,22 @@ bool ExtArgMultiSelect::isValid()
{
bool valid = true;
- if ( isRequired() )
+ if (isRequired())
{
- if ( viewModel == 0 )
+ if (viewModel == 0)
valid = false;
else
{
QModelIndexList checked = viewModel->match(viewModel->index(0, 0), Qt::CheckStateRole, Qt::Checked, -1, Qt::MatchExactly | Qt::MatchRecursive);
- if ( checked.size() <= 0 )
+ if (checked.size() <= 0)
valid = false;
}
}
QString lblInvalidColor = ColorUtils::fromColorT(prefs.gui_text_invalid).name();
QString txtStyle("QTreeView { background-color: %1; } ");
- if ( viewModel != 0 )
- treeView->setStyleSheet( txtStyle.arg(valid ? QString("") : lblInvalidColor) );
+ if (viewModel != 0)
+ treeView->setStyleSheet(txtStyle.arg(valid ? QString("") : lblInvalidColor));
return valid;
}
diff --git a/ui/qt/extcap_options_dialog.cpp b/ui/qt/extcap_options_dialog.cpp
index c26a6863a1..107f375e8a 100644
--- a/ui/qt/extcap_options_dialog.cpp
+++ b/ui/qt/extcap_options_dialog.cpp
@@ -76,7 +76,7 @@ ExtcapOptionsDialog * ExtcapOptionsDialog::createForDevice(QString &dev_name, QW
bool dev_found = false;
guint if_idx;
- if ( dev_name.length() == 0 )
+ if (dev_name.length() == 0)
return NULL;
for (if_idx = 0; if_idx < global_capture_opts.all_ifaces->len; if_idx++)
@@ -89,7 +89,7 @@ ExtcapOptionsDialog * ExtcapOptionsDialog::createForDevice(QString &dev_name, QW
}
}
- if ( ! dev_found )
+ if (! dev_found)
return NULL;
resultDialog = new ExtcapOptionsDialog(parent);
@@ -118,7 +118,7 @@ void ExtcapOptionsDialog::on_buttonBox_accepted()
/* Starting a new capture with those values */
prefs.extcap_save_on_start = ui->checkSaveOnStart->checkState() == Qt::Checked;
- if ( prefs.extcap_save_on_start )
+ if (prefs.extcap_save_on_start)
storeValues();
accept();
@@ -132,54 +132,54 @@ void ExtcapOptionsDialog::anyValueChanged()
ExtcapArgumentList::const_iterator iter;
/* All arguments are being iterated, to ensure, that any error handling catches all arguments */
- for(iter = extcapArguments.constBegin(); iter != extcapArguments.constEnd(); ++iter)
+ for (iter = extcapArguments.constBegin(); iter != extcapArguments.constEnd(); ++iter)
{
/* The dynamic casts are necessary, because we come here using the Signal/Slot system
* of Qt, and -in short- Q_OBJECT classes cannot be multiple inherited. Another possibility
* would be to use Q_INTERFACE, but this causes way more nightmares, and we really just
* need here an explicit cast for the check functionality */
- if ( dynamic_cast<ExtArgBool *>((*iter)) != NULL)
+ if (dynamic_cast<ExtArgBool *>((*iter)) != NULL)
{
- if ( ! ((ExtArgBool *)*iter)->isValid() )
+ if (! ((ExtArgBool *)*iter)->isValid())
allowStart = false;
}
- else if ( dynamic_cast<ExtArgRadio *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtArgRadio *>((*iter)) != NULL)
{
- if ( ! ((ExtArgRadio *)*iter)->isValid() )
+ if (! ((ExtArgRadio *)*iter)->isValid())
allowStart = false;
}
- else if ( dynamic_cast<ExtArgSelector *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtArgSelector *>((*iter)) != NULL)
{
- if ( ! ((ExtArgSelector *)*iter)->isValid() )
+ if (! ((ExtArgSelector *)*iter)->isValid())
allowStart = false;
}
- else if ( dynamic_cast<ExtArgMultiSelect *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtArgMultiSelect *>((*iter)) != NULL)
{
- if ( ! ((ExtArgMultiSelect *)*iter)->isValid() )
+ if (! ((ExtArgMultiSelect *)*iter)->isValid())
allowStart = false;
}
- else if ( dynamic_cast<ExtcapArgumentFileSelection *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtcapArgumentFileSelection *>((*iter)) != NULL)
{
- if ( ! ((ExtcapArgumentFileSelection *)*iter)->isValid() )
+ if (! ((ExtcapArgumentFileSelection *)*iter)->isValid())
allowStart = false;
}
- else if ( dynamic_cast<ExtArgNumber *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtArgNumber *>((*iter)) != NULL)
{
- if ( ! ((ExtArgNumber *)*iter)->isValid() )
+ if (! ((ExtArgNumber *)*iter)->isValid())
allowStart = false;
}
- else if ( dynamic_cast<ExtArgText *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtArgText *>((*iter)) != NULL)
{
- if ( ! ((ExtArgText *)*iter)->isValid() )
+ if (! ((ExtArgText *)*iter)->isValid())
allowStart = false;
}
- else if ( dynamic_cast<ExtArgTimestamp *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtArgTimestamp *>((*iter)) != NULL)
{
- if ( ! ((ExtArgTimestamp *)*iter)->isValid() )
+ if (! ((ExtArgTimestamp *)*iter)->isValid())
allowStart = false;
}
else
- if ( ! (*iter)->isValid() )
+ if (! (*iter)->isValid())
allowStart = false;
}
@@ -191,7 +191,7 @@ void ExtcapOptionsDialog::loadArguments()
GList * arguments = Q_NULLPTR, * walker = Q_NULLPTR, * item = Q_NULLPTR;
ExtcapArgument * argument = Q_NULLPTR;
- if ( device_name.length() == 0 )
+ if (device_name.length() == 0 )
return;
extcapArguments.clear();
@@ -202,15 +202,15 @@ void ExtcapOptionsDialog::loadArguments()
ExtcapArgumentList optional;
walker = arguments;
- while ( walker != Q_NULLPTR )
+ while (walker != Q_NULLPTR)
{
item = g_list_first(gxx_list_data(GList *, walker));
- while ( item != Q_NULLPTR )
+ while (item != Q_NULLPTR)
{
argument = ExtcapArgument::create(gxx_list_data(extcap_arg *, item), this);
- if ( argument != Q_NULLPTR )
+ if (argument != Q_NULLPTR)
{
- if ( argument->isRequired() )
+ if (argument->isRequired())
required << argument;
else
optional << argument;
@@ -221,10 +221,10 @@ void ExtcapOptionsDialog::loadArguments()
walker = gxx_list_next(walker);
}
- if ( required.length() > 0 )
+ if (required.length() > 0)
extcapArguments << required;
- if ( optional.length() > 0 )
+ if (optional.length() > 0)
extcapArguments << optional;
/* argument items are now owned by ExtcapArgument. Only free the lists */
@@ -239,7 +239,7 @@ void ExtcapOptionsDialog::updateWidgets()
unsigned int counter = 0;
- if ( device_name.length() == 0 )
+ if (device_name.length() == 0 )
return;
/* find existing layout */
@@ -247,7 +247,7 @@ void ExtcapOptionsDialog::updateWidgets()
{
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
QWidget * item = ui->verticalLayout->itemAt(0)->widget();
- if ( item )
+ if (item)
{
ui->verticalLayout->removeItem(ui->verticalLayout->itemAt(0));
delete item;
@@ -261,7 +261,7 @@ void ExtcapOptionsDialog::updateWidgets()
/* exit if no arguments have been found. This is a precaution, it should
* never happen, that this dialog get's called without any arguments */
- if ( extcapArguments.count() == 0 )
+ if (extcapArguments.count() == 0)
{
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
return;
@@ -275,22 +275,22 @@ void ExtcapOptionsDialog::updateWidgets()
/* Look for all necessary tabs */
ExtcapArgumentList::iterator iter = extcapArguments.begin();
- while ( iter != extcapArguments.end() )
+ while (iter != extcapArguments.end())
{
argument = (ExtcapArgument *)(*iter);
QString groupKey = argument->group();
- if ( groupKey.length() > 0 )
+ if (groupKey.length() > 0)
{
- if ( ! groups.values().contains(groupKey) )
+ if (! groups.values().contains(groupKey))
groups.insert(argument->argNr(), groupKey);
}
- else if ( ! groups.keys().contains(0) )
+ else if (! groups.keys().contains(0))
{
groups.insert(0, defaultKeyName);
groupKey = defaultKeyName;
}
- if ( ! layouts.keys().contains(groupKey) )
+ if (! layouts.keys().contains(groupKey))
{
QWidget * tabWidget = new QWidget(this);
QGridLayout * tabLayout = new QGridLayout(tabWidget);
@@ -309,15 +309,15 @@ void ExtcapOptionsDialog::updateWidgets()
* 3. add both to the layout for the tab widget
*/
iter = extcapArguments.begin();
- while ( iter != extcapArguments.end() )
+ while (iter != extcapArguments.end())
{
argument = (ExtcapArgument *)(*iter);
QString groupKey = defaultKeyName;
- if ( argument->group().length() > 0 )
+ if (argument->group().length() > 0)
groupKey = argument->group();
/* Skip non-assigned group keys, this happens if the configuration of the extcap is faulty */
- if ( ! layouts.keys().contains(groupKey) )
+ if (! layouts.keys().contains(groupKey))
{
++iter;
continue;
@@ -325,17 +325,17 @@ void ExtcapOptionsDialog::updateWidgets()
QGridLayout * layout = ((QGridLayout *)layouts[groupKey]->layout());
lblWidget = argument->createLabel((QWidget *)this);
- if ( lblWidget != NULL )
+ if (lblWidget != NULL)
{
layout->addWidget(lblWidget, counter, 0, Qt::AlignVCenter);
editWidget = argument->createEditor((QWidget *) this);
- if ( editWidget != NULL )
+ if (editWidget != NULL)
{
editWidget->setProperty(QString("extcap").toLocal8Bit(), VariantPointer<ExtcapArgument>::asQVariant(argument));
layout->addWidget(editWidget, counter, 1, Qt::AlignVCenter);
}
- if ( argument->isRequired() && ! argument->isValid() )
+ if (argument->isRequired() && ! argument->isValid())
allowStart = false;
connect(argument, SIGNAL(valueChanged()), this, SLOT(anyValueChanged()));
@@ -345,9 +345,9 @@ void ExtcapOptionsDialog::updateWidgets()
++iter;
}
- if ( counter > 0 )
+ if (counter > 0)
{
- setStyleSheet ( "QLabel[isRequired=\"true\"] { font-weight: bold; } ");
+ setStyleSheet ("QLabel[isRequired=\"true\"] { font-weight: bold; } ");
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(allowStart);
@@ -356,10 +356,10 @@ void ExtcapOptionsDialog::updateWidgets()
/* We should never display the dialog, if no settings are present */
Q_ASSERT(layouts.count() > 0);
- if ( layouts.count() > 1 )
+ if (layouts.count() > 1)
{
QTabWidget * tabs = new QTabWidget(this);
- foreach ( QString key, groupKeys )
+ foreach (QString key, groupKeys)
{
layouts[key]->layout()->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding));
tabs->addTab(layouts[key], key);
@@ -368,7 +368,7 @@ void ExtcapOptionsDialog::updateWidgets()
tabs->setCurrentIndex(0);
mainWidget = tabs;
}
- else if ( layouts.count() == 1 )
+ else if (layouts.count() == 1)
mainWidget = layouts[layouts.keys().at(0)];
ui->verticalLayout->addWidget(mainWidget);
@@ -377,7 +377,7 @@ void ExtcapOptionsDialog::updateWidgets()
else
{
QList<QString> keys = layouts.keys();
- foreach ( QString key, keys )
+ foreach (QString key, keys)
delete(layouts[key]);
}
}
@@ -429,7 +429,7 @@ bool ExtcapOptionsDialog::saveOptionToCaptureInfo()
ExtcapArgumentList::const_iterator iter;
- for(iter = extcapArguments.constBegin(); iter != extcapArguments.constEnd(); ++iter)
+ for (iter = extcapArguments.constBegin(); iter != extcapArguments.constEnd(); ++iter)
{
QString call = (*iter)->call();
QString value = (*iter)->value();
@@ -437,10 +437,10 @@ bool ExtcapOptionsDialog::saveOptionToCaptureInfo()
if ((*iter)->argument()->arg_type != EXTCAP_ARG_BOOLFLAG && value.length() == 0)
continue;
- if ( call.length() <= 0 )
+ if (call.length() <= 0)
continue;
- if ( value.compare((*iter)->defaultValue()) == 0 )
+ if (value.compare((*iter)->defaultValue()) == 0)
continue;
gchar * call_string = g_strdup(call.toStdString().c_str());
@@ -448,7 +448,7 @@ bool ExtcapOptionsDialog::saveOptionToCaptureInfo()
if (value.length() > 0)
value_string = g_strdup(value.toStdString().c_str());
- g_hash_table_insert(ret_args, call_string, value_string );
+ g_hash_table_insert(ret_args, call_string, value_string);
}
if (device->external_cap_args_settings != NULL)
@@ -460,7 +460,7 @@ bool ExtcapOptionsDialog::saveOptionToCaptureInfo()
void ExtcapOptionsDialog::on_buttonBox_clicked(QAbstractButton *button)
{
/* Only the save button has the ActionRole */
- if ( ui->buttonBox->buttonRole(button) == QDialogButtonBox::ResetRole )
+ if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::ResetRole)
resetValues();
}
@@ -474,10 +474,10 @@ void ExtcapOptionsDialog::resetValues()
if (count > 0)
{
QList<QLayout *> layouts;
- if ( qobject_cast<QTabWidget *>(ui->verticalLayout->itemAt(0)->widget()) )
+ if (qobject_cast<QTabWidget *>(ui->verticalLayout->itemAt(0)->widget()))
{
QTabWidget * tabs = qobject_cast<QTabWidget *>(ui->verticalLayout->itemAt(0)->widget());
- for ( int cnt = 0; cnt < tabs->count(); cnt++ )
+ for (int cnt = 0; cnt < tabs->count(); cnt++)
{
layouts.append(tabs->widget(cnt)->layout());
}
@@ -485,25 +485,25 @@ void ExtcapOptionsDialog::resetValues()
else
layouts.append(ui->verticalLayout->itemAt(0)->layout());
- for ( int cnt = 0; cnt < layouts.count(); cnt++ )
+ for (int cnt = 0; cnt < layouts.count(); cnt++)
{
QGridLayout * layout = qobject_cast<QGridLayout *>(layouts.at(cnt));
- if ( ! layout )
+ if (! layout)
continue;
- for ( int row = 0; row < layout->rowCount(); row++ )
+ for (int row = 0; row < layout->rowCount(); row++)
{
QWidget * child = Q_NULLPTR;
- if ( layout->itemAtPosition(row, 1) )
+ if (layout->itemAtPosition(row, 1))
child = qobject_cast<QWidget *>(layout->itemAtPosition(row, 1)->widget());
- if ( child )
+ if (child)
{
/* Don't need labels, the edit widget contains the extcapargument property value */
ExtcapArgument * arg = 0;
QVariant prop = child->property(QString("extcap").toLocal8Bit());
- if ( prop.isValid() )
+ if (prop.isValid())
{
arg = VariantPointer<ExtcapArgument>::asPtr(prop);
@@ -514,11 +514,11 @@ void ExtcapOptionsDialog::resetValues()
/* replacing the edit widget after resetting will lead to default value */
QWidget * newWidget = arg->createEditor((QWidget *) this);
- if ( newWidget != NULL )
+ if (newWidget != NULL)
{
newWidget->setProperty(QString("extcap").toLocal8Bit(), VariantPointer<ExtcapArgument>::asQVariant(arg));
QLayoutItem * oldItem = layout->replaceWidget(child, newWidget);
- if ( oldItem )
+ if (oldItem)
{
delete child;
delete oldItem;
@@ -534,7 +534,7 @@ void ExtcapOptionsDialog::resetValues()
}
/* this stores all values to the preferences */
- if ( doStore )
+ if (doStore)
{
storeValues();
anyValueChanged();
@@ -550,7 +550,7 @@ GHashTable *ExtcapOptionsDialog::getArgumentSettings(bool useCallsAsKey, bool in
QString value;
/* All arguments are being iterated, to ensure, that any error handling catches all arguments */
- for(iter = extcapArguments.constBegin(); iter != extcapArguments.constEnd(); ++iter)
+ for (iter = extcapArguments.constBegin(); iter != extcapArguments.constEnd(); ++iter)
{
ExtcapArgument * argument = (ExtcapArgument *)(*iter);
bool isBoolflag = false;
@@ -559,36 +559,36 @@ GHashTable *ExtcapOptionsDialog::getArgumentSettings(bool useCallsAsKey, bool in
* of Qt, and -in short- Q_OBJECT classes cannot be multiple inherited. Another possibility
* would be to use Q_INTERFACE, but this causes way more nightmares, and we really just
* need here an explicit cast for the check functionality */
- if ( dynamic_cast<ExtArgBool *>((*iter)) != NULL)
+ if (dynamic_cast<ExtArgBool *>((*iter)) != NULL)
{
value = ((ExtArgBool *)*iter)->prefValue();
isBoolflag = true;
}
- else if ( dynamic_cast<ExtArgRadio *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtArgRadio *>((*iter)) != NULL)
{
value = ((ExtArgRadio *)*iter)->prefValue();
}
- else if ( dynamic_cast<ExtArgSelector *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtArgSelector *>((*iter)) != NULL)
{
value = ((ExtArgSelector *)*iter)->prefValue();
}
- else if ( dynamic_cast<ExtArgMultiSelect *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtArgMultiSelect *>((*iter)) != NULL)
{
value = ((ExtArgMultiSelect *)*iter)->prefValue();
}
- else if ( dynamic_cast<ExtcapArgumentFileSelection *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtcapArgumentFileSelection *>((*iter)) != NULL)
{
value = ((ExtcapArgumentFileSelection *)*iter)->prefValue();
}
- else if ( dynamic_cast<ExtArgNumber *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtArgNumber *>((*iter)) != NULL)
{
value = ((ExtArgNumber *)*iter)->prefValue();
}
- else if ( dynamic_cast<ExtArgText *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtArgText *>((*iter)) != NULL)
{
value = ((ExtArgText *)*iter)->prefValue();
}
- else if ( dynamic_cast<ExtArgTimestamp *>((*iter)) != NULL)
+ else if (dynamic_cast<ExtArgTimestamp *>((*iter)) != NULL)
{
value = ((ExtArgTimestamp *)*iter)->prefValue();
}
@@ -596,10 +596,10 @@ GHashTable *ExtcapOptionsDialog::getArgumentSettings(bool useCallsAsKey, bool in
value = (*iter)->prefValue();
QString key = argument->prefKey(device_name);
- if ( useCallsAsKey )
+ if (useCallsAsKey)
key = argument->call();
- if ( ( key.length() > 0 ) && ( includeEmptyValues || isBoolflag || value.length() > 0 ) )
+ if ((key.length() > 0) && (includeEmptyValues || isBoolflag || value.length() > 0) )
{
gchar * val = g_strdup(value.toStdString().c_str());
@@ -614,9 +614,9 @@ void ExtcapOptionsDialog::storeValues()
{
GHashTable * entries = getArgumentSettings();
- if ( g_hash_table_size(entries) > 0 )
+ if (g_hash_table_size(entries) > 0)
{
- if ( prefs_store_ext_multiple("extcap", entries) )
+ if (prefs_store_ext_multiple("extcap", entries))
wsApp->emitAppSignal(WiresharkApplication::PreferencesChanged);
}
@@ -629,11 +629,11 @@ ExtcapValueList ExtcapOptionsDialog::loadValuesFor(int argNum, QString argumentN
extcap_value * v;
QList<QWidget *> children = findChildren<QWidget *>();
- foreach ( QWidget * child, children )
+ foreach (QWidget * child, children)
child->setEnabled(false);
QString argcall = argumentName;
- if ( argcall.startsWith("--") )
+ if (argcall.startsWith("--"))
argcall = argcall.right(argcall.size()-2);
GHashTable * entries = getArgumentSettings(true, false);
@@ -643,16 +643,16 @@ ExtcapValueList ExtcapOptionsDialog::loadValuesFor(int argNum, QString argumentN
for (walker = g_list_first((GList *)(values)); walker != NULL ; walker = walker->next)
{
v = (extcap_value *) walker->data;
- if (v == NULL || v->display == NULL || v->call == NULL )
+ if (v == NULL || v->display == NULL || v->call == NULL)
break;
/* Only accept values for this argument */
- if ( v->arg_num != argNum )
+ if (v->arg_num != argNum)
break;
QString valParent = QString().fromUtf8(v->parent);
- if ( parent.compare(valParent) == 0 )
+ if (parent.compare(valParent) == 0)
{
QString display = QString().fromUtf8(v->display);
@@ -672,7 +672,7 @@ ExtcapValueList ExtcapOptionsDialog::loadValuesFor(int argNum, QString argumentN
}
}
- foreach ( QWidget * child, children )
+ foreach (QWidget * child, children)
child->setEnabled(true);
return elements;
diff --git a/ui/qt/file_set_dialog.cpp b/ui/qt/file_set_dialog.cpp
index 7f21892700..447b679d99 100644
--- a/ui/qt/file_set_dialog.cpp
+++ b/ui/qt/file_set_dialog.cpp
@@ -125,7 +125,7 @@ void FileSetDialog::endAddFile()
fs_ui_->directoryLabel->setUrl(QUrl::fromLocalFile(dir_name).toString());
fs_ui_->directoryLabel->setEnabled(true);
- if(cur_idx_ >= 0) {
+ if (cur_idx_ >= 0) {
fs_ui_->fileSetTree->setCurrentIndex(fileset_entry_model_->index(cur_idx_, 0));
}
diff --git a/ui/qt/filter_action.cpp b/ui/qt/filter_action.cpp
index 7ac3daf217..a03b44c63f 100644
--- a/ui/qt/filter_action.cpp
+++ b/ui/qt/filter_action.cpp
@@ -183,14 +183,14 @@ const QString FilterAction::actionDirectionName(ActionDirection direction) {
QActionGroup * FilterAction::createFilterGroup(QString filter, bool prepare, bool enabled, QWidget * parent)
{
- if ( filter.isEmpty() )
+ if (filter.isEmpty())
enabled = false;
bool filterEmpty = false;
- if ( wsApp )
+ if (wsApp)
{
QWidget * mainWin = wsApp->mainWindow();
- if ( qobject_cast<MainWindow *>(mainWin) )
+ if (qobject_cast<MainWindow *>(mainWin))
filterEmpty = qobject_cast<MainWindow *>(mainWin)->getFilter().isEmpty();
}
@@ -216,7 +216,7 @@ QActionGroup * FilterAction::createFilterGroup(QString filter, bool prepare, boo
action->setProperty("filterType", FilterAction::ActionTypeOrNot);
action->setEnabled(!filterEmpty);
group->setEnabled(enabled);
- if ( ! filter.isEmpty() )
+ if (! filter.isEmpty())
connect(group, &QActionGroup::triggered, filterAction, &FilterAction::groupTriggered);
return group;
@@ -224,11 +224,11 @@ QActionGroup * FilterAction::createFilterGroup(QString filter, bool prepare, boo
QMenu * FilterAction::createFilterMenu(FilterAction::Action act, QString filter, bool enabled, QWidget * par)
{
- QString title = ( act == FilterAction::ActionApply) ? QObject::tr("Apply as Filter") : QObject::tr("Prepare as Filter");
- bool prepare = ( act == FilterAction::ActionApply) ? false : true;
+ QString title = (act == FilterAction::ActionApply) ? QObject::tr("Apply as Filter") : QObject::tr("Prepare as Filter");
+ bool prepare = (act == FilterAction::ActionApply) ? false : true;
QMenu * submenu = new QMenu(title, par);
- if ( filter.length() > 0 )
+ if (filter.length() > 0)
{
QAction * comment = submenu->addAction(QString("%1: %2").arg(title).arg(filter));
comment->setEnabled(false);
@@ -242,17 +242,17 @@ QMenu * FilterAction::createFilterMenu(FilterAction::Action act, QString filter,
void FilterAction::groupTriggered(QAction * action)
{
- if ( action && wsApp )
+ if (action && wsApp)
{
- if ( action->property("filterType").canConvert<FilterAction::ActionType>() &&
- sender()->property("filterAction").canConvert<FilterAction::Action>() )
+ if (action->property("filterType").canConvert<FilterAction::ActionType>() &&
+ sender()->property("filterAction").canConvert<FilterAction::Action>())
{
FilterAction::Action act = sender()->property("filterAction").value<FilterAction::Action>();
FilterAction::ActionType type = action->property("filterType").value<FilterAction::ActionType>();
QString filter = sender()->property("filter").toString();
QWidget * mainWin = wsApp->mainWindow();
- if ( qobject_cast<MainWindow *>(mainWin) )
+ if (qobject_cast<MainWindow *>(mainWin))
{
MainWindow * mw = qobject_cast<MainWindow *>(mainWin);
mw->setDisplayFilter(filter, act, type);
@@ -268,7 +268,7 @@ QAction * FilterAction::copyFilterAction(QString filter, QWidget *par)
action->setProperty("filter", qVariantFromValue(filter));
connect(action, &QAction::triggered, filterAction, &FilterAction::copyActionTriggered);
- if ( filter.isEmpty() )
+ if (filter.isEmpty())
action->setEnabled(false);
return action;
@@ -277,11 +277,11 @@ QAction * FilterAction::copyFilterAction(QString filter, QWidget *par)
void FilterAction::copyActionTriggered()
{
QAction * sendAction = qobject_cast<QAction *>(sender());
- if ( ! sendAction )
+ if (! sendAction)
return;
QString filter = sendAction->property("filter").toString();
- if ( filter.length() > 0 )
+ if (filter.length() > 0)
wsApp->clipboard()->setText(filter);
}
diff --git a/ui/qt/filter_dialog.cpp b/ui/qt/filter_dialog.cpp
index 33a83b4121..7f9c8fcad5 100644
--- a/ui/qt/filter_dialog.cpp
+++ b/ui/qt/filter_dialog.cpp
@@ -76,7 +76,7 @@ FilterDialog::FilterDialog(QWidget *parent, FilterType filter_type, QString new_
model_ = new FilterListModel(FilterListModel::Display, this);
}
- if ( new_filter_.length() > 0 )
+ if (new_filter_.length() > 0)
model_->addFilter(newFilterText, new_filter_);
ui->filterTreeView->setModel(model_);
@@ -85,7 +85,7 @@ FilterDialog::FilterDialog(QWidget *parent, FilterType filter_type, QString new_
ui->filterTreeView->resizeColumnToContents(FilterListModel::ColumnName);
- connect( ui->filterTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &FilterDialog::selectionChanged );
+ connect(ui->filterTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &FilterDialog::selectionChanged);
QString abs_path = gchar_free_to_qstring(get_persconffile_path(filename, TRUE));
if (file_exists(abs_path.toUtf8().constData())) {
@@ -103,17 +103,17 @@ FilterDialog::~FilterDialog()
void FilterDialog::addFilter(QString name, QString filter, bool start_editing)
{
- if ( model_ )
+ if (model_)
{
QModelIndex idx = model_->addFilter(name, filter);
- if ( start_editing )
+ if (start_editing)
ui->filterTreeView->edit(idx);
}
}
void FilterDialog::updateWidgets()
{
- if ( ! ui->filterTreeView->selectionModel() )
+ if (! ui->filterTreeView->selectionModel())
return;
int num_selected = ui->filterTreeView->selectionModel()->selectedRows().count();
@@ -149,9 +149,9 @@ void FilterDialog::on_deleteToolButton_clicked()
{
QModelIndexList selected = ui->filterTreeView->selectionModel()->selectedRows();
QList<int> rows;
- foreach ( QModelIndex idx, selected )
+ foreach (QModelIndex idx, selected)
{
- if ( idx.isValid() && ! rows.contains(idx.row()) )
+ if (idx.isValid() && ! rows.contains(idx.row()))
{
rows << idx.row();
model_->removeFilter(idx);
@@ -162,7 +162,7 @@ void FilterDialog::on_deleteToolButton_clicked()
void FilterDialog::on_copyToolButton_clicked()
{
QModelIndexList selected = ui->filterTreeView->selectionModel()->selectedRows();
- if ( selected.count() <= 0 )
+ if (selected.count() <= 0)
return;
int rowNr = selected.at(0).row();
@@ -204,7 +204,7 @@ FilterTreeDelegate::FilterTreeDelegate(QObject *parent, FilterDialog::FilterType
QWidget *FilterTreeDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QWidget * w = Q_NULLPTR;
- if ( index.column() != FilterListModel::ColumnExpression ) {
+ if (index.column() != FilterListModel::ColumnExpression) {
w = QStyledItemDelegate::createEditor(parent, option, index);
}
else
@@ -216,7 +216,7 @@ QWidget *FilterTreeDelegate::createEditor(QWidget *parent, const QStyleOptionVie
}
}
- if ( qobject_cast<QLineEdit *>(w) && index.column() == FilterListModel::ColumnName )
+ if (qobject_cast<QLineEdit *>(w) && index.column() == FilterListModel::ColumnName)
qobject_cast<QLineEdit *>(w)->setValidator(new FilterValidator());
return w;
@@ -224,12 +224,12 @@ QWidget *FilterTreeDelegate::createEditor(QWidget *parent, const QStyleOptionVie
void FilterTreeDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
- if ( ! editor || ! index.isValid() )
+ if (! editor || ! index.isValid())
return;
QStyledItemDelegate::setEditorData(editor, index);
- if ( qobject_cast<QLineEdit *>(editor) )
+ if (qobject_cast<QLineEdit *>(editor))
qobject_cast<QLineEdit *>(editor)->setText(index.data().toString());
}
@@ -238,11 +238,11 @@ QValidator::State FilterValidator::validate(QString & input, int & /*pos*/) cons
/* Making this a list to be able to easily add additional values in the future */
QStringList invalidKeys = QStringList() << "\"";
- if ( input.length() <= 0 )
+ if (input.length() <= 0)
return QValidator::Intermediate;
- foreach ( QString key, invalidKeys )
- if ( input.indexOf(key) >= 0 )
+ foreach (QString key, invalidKeys)
+ if (input.indexOf(key) >= 0)
return QValidator::Invalid;
return QValidator::Acceptable;
diff --git a/ui/qt/filter_expression_frame.cpp b/ui/qt/filter_expression_frame.cpp
index ea78449ebf..62f181d720 100644
--- a/ui/qt/filter_expression_frame.cpp
+++ b/ui/qt/filter_expression_frame.cpp
@@ -69,7 +69,7 @@ void FilterExpressionFrame::editExpression(int exprIdx)
}
UatModel * uatModel = new UatModel(this, "Display expressions");
- if ( ! uatModel->index(exprIdx, 1).isValid() )
+ if (! uatModel->index(exprIdx, 1).isValid())
return;
editExpression_ = exprIdx;
@@ -126,16 +126,16 @@ void FilterExpressionFrame::on_buttonBox_accepted()
QByteArray expr_ba = ui->displayFilterLineEdit->text().toUtf8();
QByteArray comment_ba = ui->commentLineEdit->text().toUtf8();
- if ( ui->labelLineEdit->text().length() == 0 || ui->displayFilterLineEdit->text().length() == 0 )
+ if (ui->labelLineEdit->text().length() == 0 || ui->displayFilterLineEdit->text().length() == 0)
return;
- if ( ! ui->displayFilterLineEdit->checkFilter() )
+ if (! ui->displayFilterLineEdit->checkFilter())
return;
- if ( editExpression_ >= 0 )
+ if (editExpression_ >= 0)
{
UatModel * uatModel = new UatModel(this, "Display expressions");
- if ( ! uatModel->index(editExpression_, 1).isValid() )
+ if (! uatModel->index(editExpression_, 1).isValid())
return;
uatModel->setData(uatModel->index(editExpression_, 1), QVariant::fromValue(label_ba));
diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp
index cf6e08e559..794906d1f6 100644
--- a/ui/qt/follow_stream_dialog.cpp
+++ b/ui/qt/follow_stream_dialog.cpp
@@ -410,7 +410,7 @@ void FollowStreamDialog::on_subStreamNumberSpinBox_valueChanged(int sub_stream_n
sub_stream_num_new = 0;
ok = TRUE;
} else if (follow_type_ == FOLLOW_HTTP2) {
- if (previous_sub_stream_num_ < sub_stream_num){
+ if (previous_sub_stream_num_ < sub_stream_num) {
ok = http2_get_stream_id_ge(static_cast<guint>(stream_num), sub_stream_num_new, &sub_stream_num_new);
} else {
ok = http2_get_stream_id_le(static_cast<guint>(stream_num), sub_stream_num_new, &sub_stream_num_new);
@@ -460,7 +460,7 @@ void FollowStreamDialog::resetStream()
}
for (cur = follow_info_.payload; cur; cur = gxx_list_next(cur)) {
follow_record = gxx_list_data(follow_record_t *, cur);
- if(follow_record->data) {
+ if (follow_record->data) {
g_byte_array_free(follow_record->data, TRUE);
}
g_free(follow_record);
@@ -471,7 +471,7 @@ void FollowStreamDialog::resetStream()
if (follow_type_ == FOLLOW_TCP) {
for (cur = follow_info_.fragments[0]; cur; cur = gxx_list_next(cur)) {
follow_record = gxx_list_data(follow_record_t *, cur);
- if(follow_record->data) {
+ if (follow_record->data) {
g_byte_array_free(follow_record->data, TRUE);
}
g_free(follow_record);
@@ -479,7 +479,7 @@ void FollowStreamDialog::resetStream()
follow_info_.fragments[0] = Q_NULLPTR;
for (cur = follow_info_.fragments[1]; cur; cur = gxx_list_next(cur)) {
follow_record = gxx_list_data(follow_record_t *, cur);
- if(follow_record->data) {
+ if (follow_record->data) {
g_byte_array_free(follow_record->data, TRUE);
}
g_free(follow_record);
@@ -888,7 +888,7 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_stream_index,
previous_filter_ = previous_filter;
/* append the negation */
- if(!previous_filter.isEmpty()) {
+ if (!previous_filter.isEmpty()) {
filter_out_filter_ = QString("%1 and !(%2)")
.arg(previous_filter).arg(follow_filter);
}
@@ -1105,7 +1105,7 @@ FollowStreamDialog::readFollowStream()
skip = FALSE;
if (!follow_record->is_server) {
global_pos = &global_client_pos;
- if(follow_info_.show_stream == FROM_SERVER) {
+ if (follow_info_.show_stream == FROM_SERVER) {
skip = TRUE;
}
} else {
@@ -1127,7 +1127,7 @@ FollowStreamDialog::readFollowStream()
follow_record->is_server,
follow_record->packet_num,
global_pos);
- if(frs_return == FRS_PRINT_ERROR)
+ if (frs_return == FRS_PRINT_ERROR)
return frs_return;
if (elapsed_timer.elapsed() > info_update_freq_) {
fillHintLabel(ui->teStreamContent->textCursor().position());
diff --git a/ui/qt/import_text_dialog.cpp b/ui/qt/import_text_dialog.cpp
index 65e3c0fcc9..92f178363f 100644
--- a/ui/qt/import_text_dialog.cpp
+++ b/ui/qt/import_text_dialog.cpp
@@ -255,13 +255,13 @@ int ImportTextDialog::exec() {
import_info_.dummy_header_type = HEADER_ETH;
} else if (ti_ui_->ipv4Button->isChecked()) {
import_info_.dummy_header_type = HEADER_IPV4;
- } else if(ti_ui_->udpButton->isChecked()) {
+ } else if (ti_ui_->udpButton->isChecked()) {
import_info_.dummy_header_type = HEADER_UDP;
- } else if(ti_ui_->tcpButton->isChecked()) {
+ } else if (ti_ui_->tcpButton->isChecked()) {
import_info_.dummy_header_type = HEADER_TCP;
- } else if(ti_ui_->sctpButton->isChecked()) {
+ } else if (ti_ui_->sctpButton->isChecked()) {
import_info_.dummy_header_type = HEADER_SCTP;
- } else if(ti_ui_->sctpDataButton->isChecked()) {
+ } else if (ti_ui_->sctpDataButton->isChecked()) {
import_info_.dummy_header_type = HEADER_SCTP_DATA;
} else if (ti_ui_->exportPduButton->isChecked()) {
import_info_.dummy_header_type = HEADER_EXPORT_PDU;
diff --git a/ui/qt/interface_frame.cpp b/ui/qt/interface_frame.cpp
index dae64bf025..1cee3a3ce6 100644
--- a/ui/qt/interface_frame.cpp
+++ b/ui/qt/interface_frame.cpp
@@ -125,11 +125,11 @@ QMenu * InterfaceFrame::getSelectionMenu()
QList<int> typesDisplayed = proxy_model_.typesDisplayed();
QMap<int, QString>::const_iterator it = ifTypeDescription.constBegin();
- while(it != ifTypeDescription.constEnd())
+ while (it != ifTypeDescription.constEnd())
{
int ifType = it.key();
- if ( typesDisplayed.contains(ifType) )
+ if (typesDisplayed.contains(ifType))
{
QAction *endp_action = new QAction(it.value(), this);
endp_action->setData(QVariant::fromValue(ifType));
@@ -142,7 +142,7 @@ QMenu * InterfaceFrame::getSelectionMenu()
}
#ifdef HAVE_PCAP_REMOTE
- if ( proxy_model_.remoteInterfacesExist() )
+ if (proxy_model_.remoteInterfacesExist())
{
QAction * toggleRemoteAction = new QAction(tr("Remote interfaces"), this);
toggleRemoteAction->setCheckable(true);
@@ -208,7 +208,7 @@ void InterfaceFrame::showEvent(QShowEvent *) {
void InterfaceFrame::actionButton_toggled(bool checked)
{
QVariant ifType = sender()->property(BTN_IFTYPE_PROPERTY);
- if ( ifType.isValid() )
+ if (ifType.isValid())
{
proxy_model_.setInterfaceTypeVisible(ifType.toInt(), checked);
}
@@ -219,7 +219,7 @@ void InterfaceFrame::actionButton_toggled(bool checked)
void InterfaceFrame::triggeredIfTypeButton()
{
QAction *sender = qobject_cast<QAction *>(QObject::sender());
- if ( sender )
+ if (sender)
{
int ifType = sender->data().value<int>();
proxy_model_.toggleTypeVisibility(ifType);
@@ -232,7 +232,7 @@ void InterfaceFrame::triggeredIfTypeButton()
void InterfaceFrame::interfaceListChanged()
{
info_model_.clearInfos();
- if ( prefs.capture_no_extcap )
+ if (prefs.capture_no_extcap)
info_model_.appendInfo(tr("External capture interfaces disabled."));
resetInterfaceTreeDisplay();
@@ -270,12 +270,12 @@ void InterfaceFrame::resetInterfaceTreeDisplay()
ui->warningLabel->setText(tr("No interfaces found"));
ui->warningLabel->hide();
- if ( proxy_model_.rowCount() == 0 )
+ if (proxy_model_.rowCount() == 0)
{
ui->interfaceTree->hide();
ui->warningLabel->show();
ui->warningLabel->setText(proxy_model_.interfaceError());
- if ( prefs.capture_no_interface_load ) {
+ if (prefs.capture_no_interface_load) {
ui->warningLabel->setText(tr("Interfaces not loaded (due to preference). Go to Capture " UTF8_RIGHTWARDS_ARROW " Refresh Interfaces to load."));
}
}
@@ -309,14 +309,14 @@ bool InterfaceFrame::haveCapturePermissions() const
void InterfaceFrame::updateSelectedInterfaces()
{
- if ( source_model_.rowCount() == 0 )
+ if (source_model_.rowCount() == 0)
return;
#ifdef HAVE_LIBPCAP
QItemSelection sourceSelection = source_model_.selectedDevices();
QItemSelection mySelection = info_model_.mapSelectionFromSource(proxy_model_.mapSelectionFromSource(sourceSelection));
ui->interfaceTree->selectionModel()->clearSelection();
- ui->interfaceTree->selectionModel()->select(mySelection, QItemSelectionModel::SelectCurrent );
+ ui->interfaceTree->selectionModel()->select(mySelection, QItemSelectionModel::SelectCurrent);
#endif
}
@@ -324,7 +324,7 @@ void InterfaceFrame::interfaceTreeSelectionChanged(const QItemSelection & select
{
if (selected.count() == 0 && deselected.count() == 0)
return;
- if ( source_model_.rowCount() == 0 )
+ if (source_model_.rowCount() == 0)
return;
#ifdef HAVE_LIBPCAP
@@ -332,7 +332,7 @@ void InterfaceFrame::interfaceTreeSelectionChanged(const QItemSelection & select
QItemSelection allSelected = ui->interfaceTree->selectionModel()->selection();
QItemSelection sourceSelection = proxy_model_.mapSelectionToSource(info_model_.mapSelectionToSource(allSelected));
- if ( source_model_.updateSelectedDevices(sourceSelection) )
+ if (source_model_.updateSelectedDevices(sourceSelection))
emit itemSelectionChanged();
#endif
}
@@ -341,7 +341,7 @@ void InterfaceFrame::on_interfaceTree_doubleClicked(const QModelIndex &index)
{
QModelIndex realIndex = proxy_model_.mapToSource(info_model_.mapToSource(index));
- if ( ! realIndex.isValid() )
+ if (! realIndex.isValid())
return;
#ifdef HAVE_LIBPCAP
@@ -351,10 +351,10 @@ void InterfaceFrame::on_interfaceTree_doubleClicked(const QModelIndex &index)
/* We trust the string here. If this interface is really extcap, the string is
* being checked immediatly before the dialog is being generated */
- if ( extcap_string.length() > 0 )
+ if (extcap_string.length() > 0)
{
/* this checks if configuration is required and not yet provided or saved via prefs */
- if ( extcap_has_configuration((const char *)(device_name.toStdString().c_str()), TRUE) )
+ if (extcap_has_configuration((const char *)(device_name.toStdString().c_str()), TRUE))
{
emit showExtcapOptions(device_name);
return;
@@ -367,11 +367,11 @@ void InterfaceFrame::on_interfaceTree_doubleClicked(const QModelIndex &index)
#ifdef HAVE_LIBPCAP
void InterfaceFrame::on_interfaceTree_clicked(const QModelIndex &index)
{
- if ( index.column() == 0 )
+ if (index.column() == 0)
{
QModelIndex realIndex = proxy_model_.mapToSource(info_model_.mapToSource(index));
- if ( ! realIndex.isValid() )
+ if (! realIndex.isValid())
return;
QString device_name = source_model_.getColumnContent(realIndex.row(), IFTREE_COL_NAME).toString();
@@ -379,10 +379,10 @@ void InterfaceFrame::on_interfaceTree_clicked(const QModelIndex &index)
/* We trust the string here. If this interface is really extcap, the string is
* being checked immediatly before the dialog is being generated */
- if ( extcap_string.length() > 0 )
+ if (extcap_string.length() > 0)
{
/* this checks if configuration is required and not yet provided or saved via prefs */
- if ( extcap_has_configuration((const char *)(device_name.toStdString().c_str()), FALSE) )
+ if (extcap_has_configuration((const char *)(device_name.toStdString().c_str()), FALSE))
{
emit showExtcapOptions(device_name);
return;
@@ -394,17 +394,17 @@ void InterfaceFrame::on_interfaceTree_clicked(const QModelIndex &index)
void InterfaceFrame::updateStatistics(void)
{
- if ( source_model_.rowCount() == 0 )
+ if (source_model_.rowCount() == 0)
return;
#ifdef HAVE_LIBPCAP
- for( int idx = 0; idx < proxy_model_.rowCount(); idx++ )
+ for (int idx = 0; idx < proxy_model_.rowCount(); idx++)
{
QModelIndex selectIndex = info_model_.mapFromSource(proxy_model_.mapFromSource(source_model_.index(idx, 0)));
/* Proxy model has not masked out the interface */
- if ( selectIndex.isValid() )
+ if (selectIndex.isValid())
source_model_.updateStatistic(idx);
}
diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp
index f13131a3d8..b377d7e82f 100644
--- a/ui/qt/io_graph_dialog.cpp
+++ b/ui/qt/io_graph_dialog.cpp
@@ -181,7 +181,7 @@ static void io_graph_sma_period_set_cb(void* rec, const char* buf, guint len, co
}
}
- for(i=0; ( cstr = ((const value_string*)vs)[i].strptr ) ;i++) {
+ for (i=0; (cstr = ((const value_string*)vs)[i].strptr) ;i++) {
if (g_str_equal(cstr,str)) {
((io_graph_settings_t*)rec)->sma_period = (guint32)((const value_string*)vs)[i].value;
g_free(str);
@@ -194,8 +194,8 @@ static void io_graph_sma_period_set_cb(void* rec, const char* buf, guint len, co
static void io_graph_sma_period_tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* vs, const void* u2 _U_)
{
guint i;
- for(i=0;((const value_string*)vs)[i].strptr;i++) {
- if ( ((const value_string*)vs)[i].value == ((io_graph_settings_t*)rec)->sma_period ) {
+ for (i=0;((const value_string*)vs)[i].strptr;i++) {
+ if (((const value_string*)vs)[i].value == ((io_graph_settings_t*)rec)->sma_period) {
*out_ptr = g_strdup(((const value_string*)vs)[i].strptr);
*out_len = (unsigned)strlen(*out_ptr);
return;
@@ -223,7 +223,7 @@ static gboolean sma_period_chk_enum(void* u1 _U_, const char* strptr, guint len,
}
}
- for(i=0;vs[i].strptr;i++) {
+ for (i=0;vs[i].strptr;i++) {
if (g_strcmp0(vs[i].strptr,str) == 0) {
*err = NULL;
g_free(str);
@@ -397,16 +397,16 @@ IOGraphDialog::IOGraphDialog(QWidget &parent, CaptureFile &cf, QString displayFi
if (num_io_graphs_ > 0) {
for (guint i = 0; i < num_io_graphs_; i++) {
createIOGraph(i);
- if ( ioGraphs_.at(i)->filter().compare(displayFilter) == 0 )
+ if (ioGraphs_.at(i)->filter().compare(displayFilter) == 0)
filterExists = true;
}
- if ( ! filterExists && displayFilter.length() > 0 )
+ if (! filterExists && displayFilter.length() > 0)
addGraph(true, tr("Filtered packets"), displayFilter, ColorUtils::graphColor(num_io_graphs_),
IOGraph::psLine, IOG_ITEM_UNIT_PACKETS, QString(), DEFAULT_MOVING_AVERAGE);
} else {
addDefaultGraph(true, 0);
addDefaultGraph(true, 1);
- if ( displayFilter.length() > 0 )
+ if (displayFilter.length() > 0)
addGraph(true, tr("Filtered packets"), displayFilter, ColorUtils::graphColor(num_io_graphs_),
IOGraph::psLine, IOG_ITEM_UNIT_PACKETS, QString(), DEFAULT_MOVING_AVERAGE);
}
@@ -647,14 +647,14 @@ void IOGraphDialog::keyPressEvent(QKeyEvent *event)
zoomAxes(true);
break;
case Qt::Key_X: // Zoom X axis only
- if(event->modifiers() & Qt::ShiftModifier){
+ if (event->modifiers() & Qt::ShiftModifier) {
zoomXAxis(false); // upper case X -> Zoom out
} else {
zoomXAxis(true); // lower case x -> Zoom in
}
break;
case Qt::Key_Y: // Zoom Y axis only
- if(event->modifiers() & Qt::ShiftModifier){
+ if (event->modifiers() & Qt::ShiftModifier) {
zoomYAxis(false); // upper case Y -> Zoom out
} else {
zoomYAxis(true); // lower case y -> Zoom in
diff --git a/ui/qt/lte_rlc_graph_dialog.cpp b/ui/qt/lte_rlc_graph_dialog.cpp
index 5ae97fd631..a54483fd12 100644
--- a/ui/qt/lte_rlc_graph_dialog.cpp
+++ b/ui/qt/lte_rlc_graph_dialog.cpp
@@ -336,14 +336,14 @@ void LteRlcGraphDialog::keyPressEvent(QKeyEvent *event)
break;
case Qt::Key_X: // Zoom X axis only
- if(event->modifiers() & Qt::ShiftModifier){
+ if (event->modifiers() & Qt::ShiftModifier) {
zoomXAxis(false); // upper case X -> Zoom out
} else {
zoomXAxis(true); // lower case x -> Zoom in
}
break;
case Qt::Key_Y: // Zoom Y axis only
- if(event->modifiers() & Qt::ShiftModifier){
+ if (event->modifiers() & Qt::ShiftModifier) {
zoomYAxis(false); // upper case Y -> Zoom out
} else {
zoomYAxis(true); // lower case y -> Zoom in
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index 2086f81c2d..9ba20799f3 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -504,7 +504,7 @@ int main(int argc, char *qt_argv[])
/* load the airpcap interfaces */
g_airpcap_if_list = get_airpcap_interface_list(&err, &err_str);
- if (g_airpcap_if_list == NULL || g_list_length(g_airpcap_if_list) == 0){
+ if (g_airpcap_if_list == NULL || g_list_length(g_airpcap_if_list) == 0) {
if (err == CANT_GET_AIRPCAP_INTERFACE_LIST && err_str != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", "Failed to open Airpcap Adapters.");
g_free(err_str);
@@ -886,7 +886,7 @@ int main(int argc, char *qt_argv[])
filter. */
start_requested_stats();
- if(global_commandline_info.go_to_packet != 0) {
+ if (global_commandline_info.go_to_packet != 0) {
/* Jump to the specified frame number, kept for backward
compatibility. */
cf_goto_frame(CaptureFile::globalCapFile(), global_commandline_info.go_to_packet);
diff --git a/ui/qt/main_status_bar.cpp b/ui/qt/main_status_bar.cpp
index 5ca66d8cf1..955b6667d9 100644
--- a/ui/qt/main_status_bar.cpp
+++ b/ui/qt/main_status_bar.cpp
@@ -261,16 +261,16 @@ void MainStatusBar::selectedFieldChanged(FieldInformation * finfo)
{
QString item_info;
- if ( ! finfo ) {
+ if (! finfo) {
pushGenericStatus(STATUS_CTX_FIELD, item_info);
return;
}
FieldInformation::HeaderInfo hInfo = finfo->headerInfo();
- if ( hInfo.isValid )
+ if (hInfo.isValid)
{
- if ( hInfo.description.length() > 0 ) {
+ if (hInfo.description.length() > 0) {
item_info.append(hInfo.description);
} else {
item_info.append(hInfo.name);
@@ -279,7 +279,7 @@ void MainStatusBar::selectedFieldChanged(FieldInformation * finfo)
if (!item_info.isEmpty()) {
int finfo_length;
- if ( hInfo.isValid )
+ if (hInfo.isValid)
item_info.append(" (" + hInfo.abbreviation + ")");
finfo_length = finfo->position().length + finfo->appendix().length;
@@ -295,7 +295,7 @@ void MainStatusBar::highlightedFieldChanged(FieldInformation * finfo)
{
QString hint;
- if ( finfo )
+ if (finfo)
{
FieldInformation::Position pos = finfo->position();
QString field_str;
@@ -317,20 +317,20 @@ void MainStatusBar::pushGenericStatus(StatusContext status, const QString &messa
{
LabelStack * stack = &info_status_;
- if ( status == STATUS_CTX_MAIN )
+ if (status == STATUS_CTX_MAIN)
stack = &packet_status_;
- if ( message.isEmpty() && status != STATUS_CTX_FILE && status != STATUS_CTX_TEMPORARY && status != STATUS_CTX_PROGRESS )
+ if (message.isEmpty() && status != STATUS_CTX_FILE && status != STATUS_CTX_TEMPORARY && status != STATUS_CTX_PROGRESS)
popGenericStatus(status);
else
stack->pushText(message, status);
stack->setToolTip(messagetip);
- if ( status == STATUS_CTX_FILTER || status == STATUS_CTX_FILE )
+ if (status == STATUS_CTX_FILTER || status == STATUS_CTX_FILE)
expertUpdate();
- if ( status == STATUS_CTX_PROGRESS )
+ if (status == STATUS_CTX_PROGRESS)
progress_frame_.showBusy(true, false, NULL);
}
@@ -338,14 +338,14 @@ void MainStatusBar::popGenericStatus(StatusContext status)
{
LabelStack * stack = &info_status_;
- if ( status == STATUS_CTX_MAIN )
+ if (status == STATUS_CTX_MAIN)
stack = &packet_status_;
stack->setToolTip(QString());
stack->popText(status);
- if ( status == STATUS_CTX_PROGRESS )
+ if (status == STATUS_CTX_PROGRESS)
progress_frame_.hide();
}
@@ -376,7 +376,7 @@ void MainStatusBar::showCaptureStatistics()
QList<int> rows;
MainWindow * mw = qobject_cast<MainWindow *>(wsApp->mainWindow());
- if ( mw )
+ if (mw)
rows = mw->selectedRows(true);
#ifdef HAVE_LIBPCAP
@@ -401,25 +401,25 @@ void MainStatusBar::showCaptureStatistics()
.arg(cap_file_->displayed_count)
.arg((100.0*cap_file_->displayed_count)/cap_file_->count, 0, 'f', 1)
.arg(UTF8_MIDDLE_DOT));
- if(rows.count() > 1) {
+ if (rows.count() > 1) {
packets_str.append(QString(tr(" %1 Selected: %2 (%3%)"))
.arg(UTF8_MIDDLE_DOT)
.arg(rows.count())
.arg((100.0*rows.count())/cap_file_->count, 0, 'f', 1));
}
- if(cap_file_->marked_count > 0) {
+ if (cap_file_->marked_count > 0) {
packets_str.append(QString(tr(" %1 Marked: %2 (%3%)"))
.arg(UTF8_MIDDLE_DOT)
.arg(cap_file_->marked_count)
.arg((100.0*cap_file_->marked_count)/cap_file_->count, 0, 'f', 1));
}
- if(cap_file_->drops_known) {
+ if (cap_file_->drops_known) {
packets_str.append(QString(tr(" %1 Dropped: %2 (%3%)"))
.arg(UTF8_MIDDLE_DOT)
.arg(cap_file_->drops)
.arg((100.0*cap_file_->drops)/cap_file_->count, 0, 'f', 1));
}
- if(cap_file_->ignored_count > 0) {
+ if (cap_file_->ignored_count > 0) {
packets_str.append(QString(tr(" %1 Ignored: %2 (%3%)"))
.arg(UTF8_MIDDLE_DOT)
.arg(cap_file_->ignored_count)
@@ -430,7 +430,7 @@ void MainStatusBar::showCaptureStatistics()
.arg(UTF8_MIDDLE_DOT)
.arg(cap_file_->packet_comment_count));
}
- if(prefs.gui_qt_show_file_load_time && !cap_file_->is_tempfile) {
+ if (prefs.gui_qt_show_file_load_time && !cap_file_->is_tempfile) {
/* Loading an existing file */
gulong computed_elapsed = cf_get_computed_elapsed(cap_file_);
packets_str.append(QString(tr(" %1 Load time: %2:%3.%4"))
@@ -493,33 +493,33 @@ void MainStatusBar::showProfileMenu(const QPoint &global_pos, Qt::MouseButton bu
QActionGroup global(this);
QActionGroup user(this);
- for(int cnt = 0; cnt < model.rowCount(); cnt++)
+ for (int cnt = 0; cnt < model.rowCount(); cnt++)
{
QModelIndex idx = model.index(cnt, ProfileModel::COL_NAME);
- if ( ! idx.isValid() )
+ if (! idx.isValid())
continue;
QAction * pa = Q_NULLPTR;
QString name = idx.data().toString();
- if ( idx.data(ProfileModel::DATA_IS_DEFAULT).toBool() )
+ if (idx.data(ProfileModel::DATA_IS_DEFAULT).toBool())
{
pa = profile_menu_.addAction(name);
}
- else if ( idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() )
+ else if (idx.data(ProfileModel::DATA_IS_GLOBAL).toBool())
{
/* Check if this profile does not exist as user */
- if ( cnt == model.findByName(name) )
+ if (cnt == model.findByName(name))
pa = global.addAction(name);
}
else
pa = user.addAction(name);
- if ( ! pa )
+ if (! pa)
continue;
pa->setCheckable(true);
- if ( idx.data(ProfileModel::DATA_IS_SELECTED).toBool() )
+ if (idx.data(ProfileModel::DATA_IS_SELECTED).toBool())
pa->setChecked(true);
pa->setFont(idx.data(Qt::FontRole).value<QFont>());
@@ -540,7 +540,7 @@ void MainStatusBar::showProfileMenu(const QPoint &global_pos, Qt::MouseButton bu
bool enable_edit = false;
QModelIndex idx = model.activeProfile();
- if ( ! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool() && ! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() )
+ if (! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool() && ! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool())
enable_edit = true;
profile_menu_.setTitle(tr("Switch to"));
@@ -567,10 +567,10 @@ void MainStatusBar::showProfileMenu(const QPoint &global_pos, Qt::MouseButton bu
action->setProperty("dialog_action_", (int)ProfileDialog::ImportDirProfile);
ctx_menu_.addMenu(importMenu);
- if ( model.userProfilesExist() )
+ if (model.userProfilesExist())
{
QMenu * exportMenu = new QMenu(tr("Export"));
- if ( enable_edit )
+ if (enable_edit)
{
action = exportMenu->addAction(tr("selected personal profile"), this, SLOT(manageProfile()));
action->setProperty("dialog_action_", (int)ProfileDialog::ExportSingleProfile);
@@ -636,7 +636,7 @@ void MainStatusBar::captureEventHandler(CaptureEvent ev)
{
#ifdef HAVE_LIBPCAP
case CaptureEvent::Update:
- switch ( ev.eventType() )
+ switch (ev.eventType())
{
case CaptureEvent::Continued:
updateCaptureStatistics(ev.capSession());
@@ -646,7 +646,7 @@ void MainStatusBar::captureEventHandler(CaptureEvent ev)
}
break;
case CaptureEvent::Fixed:
- switch ( ev.eventType() )
+ switch (ev.eventType())
{
case CaptureEvent::Continued:
updateCaptureFixedStatistics(ev.capSession());
@@ -657,7 +657,7 @@ void MainStatusBar::captureEventHandler(CaptureEvent ev)
break;
#endif
case CaptureEvent::Save:
- switch ( ev.eventType() )
+ switch (ev.eventType())
{
case CaptureEvent::Finished:
case CaptureEvent::Failed:
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 972e986707..b4ccaef11d 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -208,7 +208,7 @@ static void plugin_if_mainwindow_get_ws_info(GHashTable * data_set)
QList<int> rows = gbl_cur_main_window_->selectedRows();
frame_data * fdata = NULL;
- if ( rows.count() > 0 )
+ if (rows.count() > 0)
fdata = gbl_cur_main_window_->frameDataForRow(rows.at(0));
if (cf->state == FILE_READ_DONE && fdata) {
@@ -1505,7 +1505,7 @@ void MainWindow::exportSelectedPackets() {
QList<int> rows = packet_list_->selectedRows(true);
QStringList entries;
- foreach ( int row, rows )
+ foreach (int row, rows)
entries << QString::number(row);
QString selRange = entries.join(",");
@@ -1623,7 +1623,7 @@ void MainWindow::exportDissections(export_type_e export_type) {
QList<int> rows = packet_list_->selectedRows(true);
QStringList entries;
- foreach ( int row, rows )
+ foreach (int row, rows)
entries << QString::number(row);
QString selRange = entries.join(",");
@@ -2891,14 +2891,14 @@ void MainWindow::setMwFileName(QString fileName)
QList<int> MainWindow::selectedRows(bool useFrameNum)
{
- if ( packet_list_ )
+ if (packet_list_)
return packet_list_->selectedRows(useFrameNum);
return QList<int>();
}
frame_data * MainWindow::frameDataForRow(int row) const
{
- if ( packet_list_ )
+ if (packet_list_)
return packet_list_->getFDataForRow(row);
return Q_NULLPTR;
diff --git a/ui/qt/main_window_layout.cpp b/ui/qt/main_window_layout.cpp
index 22244ac7d9..a465a3cde3 100644
--- a/ui/qt/main_window_layout.cpp
+++ b/ui/qt/main_window_layout.cpp
@@ -43,7 +43,7 @@ void MainWindow::showWelcome()
void MainWindow::showCapture()
{
- main_ui_->mainStack->setCurrentWidget( &master_split_);
+ main_ui_->mainStack->setCurrentWidget(&master_split_);
}
QWidget* MainWindow::getLayoutWidget(layout_pane_content_e type) {
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index d843f84037..751653be01 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -1163,11 +1163,11 @@ void MainWindow::setMenusForSelectedPacket()
QList<int> rows = selectedRows();
frame_data * current_frame = 0;
- if ( rows.count() > 0 )
+ if (rows.count() > 0)
current_frame = frameDataForRow(rows.at(0));
frame_selected = rows.count() == 1;
- if ( packet_list_->multiSelectActive() )
+ if (packet_list_->multiSelectActive())
{
frame_selected = false;
multi_selection = true;
@@ -1896,7 +1896,7 @@ void MainWindow::on_actionFilePrint_triggered()
QList<int> rows = packet_list_->selectedRows(true);
QStringList entries;
- foreach ( int row, rows )
+ foreach (int row, rows)
entries << QString::number(row);
QString selRange = entries.join(",");
@@ -1947,26 +1947,26 @@ void MainWindow::actionEditCopyTriggered(MainWindow::CopySelected selection_type
case CopyListAsText:
case CopyListAsCSV:
case CopyListAsYAML:
- if ( packet_list_->selectedRows().count() > 0 )
+ if (packet_list_->selectedRows().count() > 0)
{
QList<int> rows = packet_list_->selectedRows();
QStringList content;
- foreach ( int row, rows )
+ foreach (int row, rows)
{
QModelIndex idx = packet_list_->model()->index(row, 0);
- if ( ! idx.isValid() )
+ if (! idx.isValid())
continue;
PacketList::SummaryCopyType copyType = PacketList::CopyAsText;
- if ( selection_type == CopyListAsCSV )
+ if (selection_type == CopyListAsCSV)
copyType = PacketList::CopyAsCSV;
- else if ( selection_type == CopyListAsYAML )
+ else if (selection_type == CopyListAsYAML)
copyType = PacketList::CopyAsYAML;
QString entry = packet_list_->createSummaryText(idx, copyType);
content << entry;
}
- if ( content.count() > 0 )
+ if (content.count() > 0)
clip = content.join("\n");
}
break;
@@ -2164,11 +2164,11 @@ void MainWindow::editTimeShiftFinished(int)
void MainWindow::on_actionEditPacketComment_triggered()
{
QList<int> rows = selectedRows();
- if ( rows.count() != 1 )
+ if (rows.count() != 1)
return;
frame_data * fdata = frameDataForRow(rows.at(0));
- if ( ! fdata )
+ if (! fdata)
return;
PacketCommentDialog* pc_dialog;
@@ -2556,7 +2556,7 @@ void MainWindow::on_actionViewResetLayout_triggered()
void MainWindow::on_actionViewResizeColumns_triggered()
{
- if ( ! packet_list_->model() )
+ if (! packet_list_->model())
return;
for (int col = 0; col < packet_list_->model()->columnCount(); col++) {
packet_list_->resizeColumnToContents(col);
@@ -2575,9 +2575,9 @@ void MainWindow::openPacketDialog(bool from_reference)
return;
fdata = frame_data_sequence_find(capture_file_.capFile()->provider.frames, framenum);
- } else if ( selectedRows().count() == 1 ) {
+ } else if (selectedRows().count() == 1) {
fdata = frameDataForRow(selectedRows().at(0));
- } else if ( selectedRows().count() > 1 )
+ } else if (selectedRows().count() > 1)
return;
/* If we have a frame, pop up the dialog */
@@ -3204,7 +3204,7 @@ void MainWindow::statCommandIOGraph(const char *, void *)
{
const DisplayFilterEdit *df_edit = qobject_cast<DisplayFilterEdit *>(df_combo_box_->lineEdit());
QString displayFilter;
- if ( df_edit )
+ if (df_edit)
displayFilter = df_edit->text();
IOGraphDialog *iog_dialog = new IOGraphDialog(*this, capture_file_, displayFilter);
@@ -3716,7 +3716,7 @@ void MainWindow::on_actionStatisticsResolvedAddresses_triggered()
{
QString capFileName;
wtap* wth = Q_NULLPTR;
- if ( capture_file_.isValid() )
+ if (capture_file_.isValid())
{
capFileName = capture_file_.capFile()->filename;
wth = capture_file_.capFile()->provider.wth;
@@ -3839,7 +3839,7 @@ void MainWindow::showExtcapOptionsDialog(QString &device_name)
void MainWindow::insertColumn(QString name, QString abbrev, gint pos)
{
gint colnr = 0;
- if ( name.length() > 0 && abbrev.length() > 0 )
+ if (name.length() > 0 && abbrev.length() > 0)
{
colnr = column_prefs_add_custom(COL_CUSTOM, name.toStdString().c_str(), abbrev.toStdString().c_str(), pos);
packet_list_->columnsChanged();
diff --git a/ui/qt/manage_interfaces_dialog.cpp b/ui/qt/manage_interfaces_dialog.cpp
index efbf0b13f0..3aaad7a2f5 100644
--- a/ui/qt/manage_interfaces_dialog.cpp
+++ b/ui/qt/manage_interfaces_dialog.cpp
@@ -210,7 +210,7 @@ ManageInterfacesDialog::~ManageInterfacesDialog()
void ManageInterfacesDialog::onSelectionChanged(const QItemSelection &sel, const QItemSelection &)
{
- ui->delPipe->setEnabled( sel.count() > 0 );
+ ui->delPipe->setEnabled(sel.count() > 0);
}
void ManageInterfacesDialog::updateWidgets()
@@ -300,7 +300,7 @@ void ManageInterfacesDialog::on_delPipe_clicked()
* to only select single items. */
QModelIndex selIndex = ui->pipeView->selectionModel()->selectedIndexes().at(0);
- sourceModel->deleteDevice( pipeProxyModel->mapToSource(selIndex) );
+ sourceModel->deleteDevice(pipeProxyModel->mapToSource(selIndex));
updateWidgets();
}
#endif
@@ -502,7 +502,7 @@ void ManageInterfacesDialog::remoteAccepted()
{
QTreeWidgetItemIterator it(ui->remoteList);
- while(*it) {
+ while (*it) {
for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, i);
if ((*it)->text(col_r_host_dev_).compare(device->name))
diff --git a/ui/qt/manager/preference_manager.cpp b/ui/qt/manager/preference_manager.cpp
index 54c2cfb7b0..3e249e249e 100644
--- a/ui/qt/manager/preference_manager.cpp
+++ b/ui/qt/manager/preference_manager.cpp
@@ -35,7 +35,7 @@ PreferenceManager::~PreferenceManager()
PreferenceManager * PreferenceManager::instance()
{
static PreferenceManager* _inst = 0;
- if ( ! _inst )
+ if (! _inst)
_inst = new PreferenceManager();
return _inst;
@@ -45,7 +45,7 @@ void PreferenceManager::registerType(int pref, PreferenceFactory * factory)
{
Q_ASSERT(pref >= 0);
- if ( PreferenceManager::factories().contains(pref) || ! factory )
+ if (PreferenceManager::factories().contains(pref) || ! factory)
return;
PreferenceManager::factories()[pref] = factory;
@@ -53,16 +53,16 @@ void PreferenceManager::registerType(int pref, PreferenceFactory * factory)
WiresharkPreference * PreferenceManager::getPreference(PrefsItem * pref)
{
- if ( ! pref )
+ if (! pref)
return Q_NULLPTR;
int key = pref->getPrefType();
- if ( ! PreferenceManager::factories().contains(key) )
+ if (! PreferenceManager::factories().contains(key))
return Q_NULLPTR;
/* All actions are parented with this manager, to clear the objects together with the manager */
WiresharkPreference * wspref = qobject_cast<WiresharkPreference *>(PreferenceManager::factories()[key]->create(this));
- if ( wspref )
+ if (wspref)
wspref->setPrefsItem(pref);
return wspref;
diff --git a/ui/qt/models/astringlist_list_model.cpp b/ui/qt/models/astringlist_list_model.cpp
index 752bf11952..9d91fea9b3 100644
--- a/ui/qt/models/astringlist_list_model.cpp
+++ b/ui/qt/models/astringlist_list_model.cpp
@@ -26,7 +26,7 @@ AStringListListModel::~AStringListListModel() { display_data_.clear(); }
void AStringListListModel::appendRow(const QStringList & display_strings, const QString & row_tooltip, const QModelIndex &parent)
{
QStringList columns = headerColumns();
- if ( display_strings.count() != columns.count() )
+ if (display_strings.count() != columns.count())
return;
emit beginInsertRows(parent, rowCount(), rowCount());
@@ -42,7 +42,7 @@ int AStringListListModel::rowCount(const QModelIndex &) const
int AStringListListModel::columnCount(const QModelIndex &parent) const
{
- if ( rowCount(parent) == 0 )
+ if (rowCount(parent) == 0)
return 0;
return headerColumns().count();
@@ -50,11 +50,11 @@ int AStringListListModel::columnCount(const QModelIndex &parent) const
QVariant AStringListListModel::headerData(int section, Qt::Orientation orientation, int role) const
{
- if ( orientation == Qt::Vertical )
+ if (orientation == Qt::Vertical)
return QVariant();
QStringList columns = headerColumns();
- if ( role == Qt::DisplayRole && section < columns.count() )
+ if (role == Qt::DisplayRole && section < columns.count())
return QVariant::fromValue(columns[section]);
return QVariant();
@@ -62,17 +62,17 @@ QVariant AStringListListModel::headerData(int section, Qt::Orientation orientati
QVariant AStringListListModel::data(const QModelIndex &index, int role) const
{
- if ( ! index.isValid() || index.row() >= rowCount() )
+ if (! index.isValid() || index.row() >= rowCount())
return QVariant();
- if ( role == Qt::DisplayRole )
+ if (role == Qt::DisplayRole)
{
QStringList data = display_data_.at(index.row());
- if ( index.column() < columnCount() )
+ if (index.column() < columnCount())
return QVariant::fromValue(data.at(index.column()));
}
- else if ( role == Qt::ToolTipRole )
+ else if (role == Qt::ToolTipRole)
{
QString tooltip = tooltip_data_.at(index.row());
if (!tooltip.isEmpty()) {
@@ -95,7 +95,7 @@ bool AStringListListSortFilterProxyModel::lessThan(const QModelIndex &left, cons
QString leftData = left.data().toString();
QString rightData = right.data().toString();
- if ( numericColumns_.contains(left.column()) || numericColumns_.contains(right.column() ) )
+ if (numericColumns_.contains(left.column()) || numericColumns_.contains(right.column()) )
{
float leftD = leftData.toFloat();
float rightD = rightData.toFloat();
@@ -114,14 +114,14 @@ void AStringListListSortFilterProxyModel::setFilter(const QString & filter)
static bool AContainsB(const QVariant &a, const QVariant &b, Qt::CaseSensitivity cs)
{
- if ( ! a.canConvert(QVariant::String) || ! b.canConvert(QVariant::String) )
+ if (! a.canConvert(QVariant::String) || ! b.canConvert(QVariant::String))
return false;
return a.toString().contains(b.toString(), cs);
}
static bool AStartsWithB(const QVariant &a, const QVariant &b, Qt::CaseSensitivity cs)
{
- if ( ! a.canConvert(QVariant::String) || ! b.canConvert(QVariant::String) )
+ if (! a.canConvert(QVariant::String) || ! b.canConvert(QVariant::String))
return false;
return a.toString().startsWith(b.toString(), cs);
}
@@ -133,12 +133,12 @@ static bool AIsEquivalentToB(const QVariant &a, const QVariant &b, Qt::CaseSensi
bool AStringListListSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
- if ( columnsToFilter_.count() == 0 )
+ if (columnsToFilter_.count() == 0)
return true;
foreach(int column, columnsToFilter_)
{
- if ( column >= columnCount() )
+ if (column >= columnCount())
continue;
QModelIndex chkIdx = sourceModel()->index(sourceRow, column, sourceParent);
@@ -146,7 +146,7 @@ bool AStringListListSortFilterProxyModel::filterAcceptsRow(int sourceRow, const
/* Default is filter by string a contains string b */
bool (*compareFunc)(const QVariant&, const QVariant&, Qt::CaseSensitivity) = AContainsB;
- if ( types_.keys().contains(column) )
+ if (types_.keys().contains(column))
{
switch (types_.value(column, FilterByContains))
{
@@ -165,7 +165,7 @@ bool AStringListListSortFilterProxyModel::filterAcceptsRow(int sourceRow, const
}
}
- if ( compareFunc(dataString, filter_, filterCaseSensitivity()) )
+ if (compareFunc(dataString, filter_, filterCaseSensitivity()))
return true;
}
@@ -174,14 +174,14 @@ bool AStringListListSortFilterProxyModel::filterAcceptsRow(int sourceRow, const
void AStringListListSortFilterProxyModel::setFilterType(AStringListListFilterType type, int column)
{
- if ( column >= -1 && column < columnCount() )
+ if (column >= -1 && column < columnCount())
{
- if ( ! types_.keys().contains(column) )
+ if (! types_.keys().contains(column))
{
types_.insert(column, type);
invalidateFilter();
}
- else if ( types_.keys().contains(column) && type != types_[column] )
+ else if (types_.keys().contains(column) && type != types_[column])
{
types_[column] = type;
invalidateFilter();
@@ -191,7 +191,7 @@ void AStringListListSortFilterProxyModel::setFilterType(AStringListListFilterTyp
void AStringListListSortFilterProxyModel::setColumnToFilter(int column)
{
- if ( column < columnCount() && ! columnsToFilter_.contains(column) )
+ if (column < columnCount() && ! columnsToFilter_.contains(column))
{
columnsToFilter_.append(column);
invalidateFilter();
@@ -212,7 +212,7 @@ void AStringListListSortFilterProxyModel::clearHiddenColumns()
void AStringListListSortFilterProxyModel::setColumnToHide(int col)
{
- if ( ! hiddenColumns_.contains(col) && col > -1 && sourceModel() && sourceModel()->columnCount() > col )
+ if (! hiddenColumns_.contains(col) && col > -1 && sourceModel() && sourceModel()->columnCount() > col)
{
hiddenColumns_ << col;
invalidateFilter();
@@ -223,10 +223,10 @@ bool AStringListListSortFilterProxyModel::filterAcceptsColumn(int sourceColumn,
{
QModelIndex realIndex = sourceModel()->index(0, sourceColumn, sourceParent);
- if ( ! realIndex.isValid() )
+ if (! realIndex.isValid())
return false;
- if ( hiddenColumns_.contains(sourceColumn) )
+ if (hiddenColumns_.contains(sourceColumn))
return false;
return true;
@@ -240,7 +240,7 @@ void AStringListListSortFilterProxyModel::clearNumericColumns()
void AStringListListSortFilterProxyModel::setColumnAsNumeric(int col)
{
- if ( ! numericColumns_.contains(col) && col > -1 && sourceModel() && sourceModel()->columnCount() > col )
+ if (! numericColumns_.contains(col) && col > -1 && sourceModel() && sourceModel()->columnCount() > col)
{
numericColumns_ << col;
invalidateFilter();
@@ -253,7 +253,7 @@ AStringListListUrlProxyModel::AStringListListUrlProxyModel(QObject * parent):
void AStringListListUrlProxyModel::setUrlColumn(int column)
{
- if ( column < columnCount() && ! urls_.contains(column) )
+ if (column < columnCount() && ! urls_.contains(column))
urls_ << column;
}
@@ -266,17 +266,17 @@ QVariant AStringListListUrlProxyModel::data(const QModelIndex &index, int role)
{
QVariant result = QIdentityProxyModel::data(index, role);
- if ( urls_.contains(index.column()) )
+ if (urls_.contains(index.column()))
{
- if ( role == Qt::ForegroundRole )
+ if (role == Qt::ForegroundRole)
{
- if ( result.canConvert(QVariant::Brush) )
+ if (result.canConvert(QVariant::Brush))
{
QBrush selected = result.value<QBrush>();
selected.setColor(ColorUtils::themeLinkBrush().color());
return selected;
}
- } else if ( role == Qt::TextColorRole ) {
+ } else if (role == Qt::TextColorRole) {
return QApplication::palette().link().color();
}
}
diff --git a/ui/qt/models/coloring_rules_model.cpp b/ui/qt/models/coloring_rules_model.cpp
index 6dbe77943f..6651f43374 100644
--- a/ui/qt/models/coloring_rules_model.cpp
+++ b/ui/qt/models/coloring_rules_model.cpp
@@ -123,7 +123,7 @@ void ColoringRulesModel::addColor(color_filter_t* colorf)
{
if (!colorf) return;
- if(strstr(colorf->filter_name, CONVERSATION_COLOR_PREFIX) != NULL) {
+ if (strstr(colorf->filter_name, CONVERSATION_COLOR_PREFIX) != NULL) {
conversation_colors_ = g_slist_append(conversation_colors_, colorf);
} else {
int count = root_->childCount();
@@ -193,7 +193,7 @@ bool ColoringRulesModel::writeColors(QString& err)
bool ColoringRulesModel::insertRows(int row, int count, const QModelIndex& parent)
{
// sanity check insertion
- if (row < 0 )
+ if (row < 0)
return false;
beginInsertRows(parent, row, row+(count-1));
@@ -210,7 +210,7 @@ bool ColoringRulesModel::insertRows(int row, int count, const QModelIndex& paren
bool ColoringRulesModel::removeRows(int row, int count, const QModelIndex& parent)
{
- if (row < 0 )
+ if (row < 0)
return false;
beginRemoveRows(parent, row, row+(count-1));
@@ -413,9 +413,9 @@ QMimeData* ColoringRulesModel::mimeData(const QModelIndexList &indexes) const
QMimeData *mimeData = new QMimeData();
QJsonArray data;
- foreach ( const QModelIndex & index, indexes )
+ foreach (const QModelIndex & index, indexes)
{
- if ( index.column() == 0 )
+ if (index.column() == 0)
{
ColoringRuleItem * item = root_->child(index.row());
QJsonObject entry;
@@ -459,16 +459,16 @@ bool ColoringRulesModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
QList<QVariant> rules;
QJsonDocument encodedData = QJsonDocument::fromJson(data->data(WiresharkMimeData::ColoringRulesMimeType));
- if ( ! encodedData.isObject() || ! encodedData.object().contains("coloringrules") )
+ if (! encodedData.isObject() || ! encodedData.object().contains("coloringrules"))
return false;
QJsonArray dataArray = encodedData.object()["coloringrules"].toArray();
- for ( int datarow = 0; datarow < dataArray.count(); datarow++ )
+ for (int datarow = 0; datarow < dataArray.count(); datarow++)
{
QJsonObject entry = dataArray.at(datarow).toObject();
- if ( ! entry.contains("foreground") || ! entry.contains("background") || ! entry.contains("filter") )
+ if (! entry.contains("foreground") || ! entry.contains("background") || ! entry.contains("filter"))
continue;
QColor fgColor = entry["foreground"].toVariant().value<QColor>();
diff --git a/ui/qt/models/column_list_model.cpp b/ui/qt/models/column_list_model.cpp
index 8854363718..48cf4e2757 100644
--- a/ui/qt/models/column_list_model.cpp
+++ b/ui/qt/models/column_list_model.cpp
@@ -46,11 +46,11 @@ ColumnProxyModel::ColumnProxyModel(QObject * parent) :
bool ColumnProxyModel::filterAcceptsRow(int source_row, const QModelIndex &/*source_parent*/) const
{
bool displayed = false;
- if ( sourceModel() &&
- sourceModel()->index(source_row, ColumnListModel::COL_DISPLAYED).data(ColumnListModel::DisplayedState).toBool() )
+ if (sourceModel() &&
+ sourceModel()->index(source_row, ColumnListModel::COL_DISPLAYED).data(ColumnListModel::DisplayedState).toBool())
displayed = true;
- if ( showDisplayedOnly_ && ! displayed )
+ if (showDisplayedOnly_ && ! displayed)
return false;
return true;
@@ -70,14 +70,14 @@ QWidget *ColumnTypeDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
- if ( index.column() == ColumnListModel::COL_TYPE )
+ if (index.column() == ColumnListModel::COL_TYPE)
{
QComboBox *editor = new QComboBox(parent);
for (int i = 0; i < NUM_COL_FMTS; i++)
{
editor->addItem(col_format_desc(i), QVariant(i));
- if ( i == index.data().toInt() )
+ if (i == index.data().toInt())
editor->setCurrentIndex(i);
}
@@ -85,13 +85,13 @@ QWidget *ColumnTypeDelegate::createEditor(QWidget *parent,
return editor;
}
- else if ( index.column() == ColumnListModel::COL_FIELDS )
+ else if (index.column() == ColumnListModel::COL_FIELDS)
{
FieldFilterEdit * editor = new FieldFilterEdit(parent);
editor->setText(index.data().toString());
return editor;
}
- else if ( index.column() == ColumnListModel::COL_OCCURRENCE )
+ else if (index.column() == ColumnListModel::COL_OCCURRENCE)
{
SyntaxLineEdit * editor = new SyntaxLineEdit(parent);
connect(editor, &SyntaxLineEdit::textChanged, editor, &SyntaxLineEdit::checkInteger);
@@ -106,24 +106,24 @@ void ColumnTypeDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
QVariant data = index.model()->data(index);
- if ( index.column() == ColumnListModel::COL_TYPE )
+ if (index.column() == ColumnListModel::COL_TYPE)
{
QComboBox *comboBox = static_cast<QComboBox*>(editor);
comboBox->setCurrentText(data.toString());
}
- else if ( index.column() == ColumnListModel::COL_FIELDS )
+ else if (index.column() == ColumnListModel::COL_FIELDS)
{
- if ( qobject_cast<FieldFilterEdit *>(editor) )
+ if (qobject_cast<FieldFilterEdit *>(editor))
qobject_cast<FieldFilterEdit *>(editor)->setText(data.toString());
}
- else if ( index.column() == ColumnListModel::COL_OCCURRENCE )
+ else if (index.column() == ColumnListModel::COL_OCCURRENCE)
{
- if ( qobject_cast<SyntaxLineEdit *>(editor) )
+ if (qobject_cast<SyntaxLineEdit *>(editor))
qobject_cast<SyntaxLineEdit *>(editor)->setText(data.toString());
}
else
{
- if ( qobject_cast<QLineEdit *>(editor) )
+ if (qobject_cast<QLineEdit *>(editor))
qobject_cast<QLineEdit *>(editor)->setText(data.toString());
}
}
@@ -131,19 +131,19 @@ void ColumnTypeDelegate::setEditorData(QWidget *editor,
void ColumnTypeDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
- if ( index.column() == ColumnListModel::COL_TYPE )
+ if (index.column() == ColumnListModel::COL_TYPE)
{
QComboBox *comboBox = static_cast<QComboBox*>(editor);
bool ok = false;
int value = comboBox->currentData().toInt(&ok);
- if ( ok )
+ if (ok)
model->setData(index, value, Qt::EditRole);
}
- else if ( index.column() == ColumnListModel::COL_FIELDS )
+ else if (index.column() == ColumnListModel::COL_FIELDS)
{
FieldFilterEdit * ffe = qobject_cast<FieldFilterEdit *>(editor);
- if ( ffe && ffe->checkFilter() )
+ if (ffe && ffe->checkFilter())
{
QModelIndex typeIndex = index.sibling(index.row(), ColumnListModel::COL_TYPE);
model->setData(typeIndex, COL_CUSTOM, Qt::EditRole);
@@ -152,25 +152,25 @@ void ColumnTypeDelegate::setModelData(QWidget *editor, QAbstractItemModel *model
else
ffe->setText(index.data().toString());
- if ( index.data().toString().length() == 0 )
+ if (index.data().toString().length() == 0)
{
QModelIndex typeIndex = index.sibling(index.row(), ColumnListModel::COL_TYPE);
model->setData(typeIndex, index.data(ColumnListModel::OriginalType).toInt(), Qt::EditRole);
}
}
- else if ( index.column() == ColumnListModel::COL_OCCURRENCE )
+ else if (index.column() == ColumnListModel::COL_OCCURRENCE)
{
SyntaxLineEdit * sle = qobject_cast<SyntaxLineEdit *>(editor);
bool ok = false;
- if ( sle )
+ if (sle)
{
sle->checkInteger(index.data().toString());
- if ( sle->syntaxState() == SyntaxLineEdit::Valid )
+ if (sle->syntaxState() == SyntaxLineEdit::Valid)
ok = true;
}
- if ( ok )
+ if (ok)
{
QModelIndex typeIndex = index.sibling(index.row(), ColumnListModel::COL_TYPE);
model->setData(typeIndex, COL_CUSTOM, Qt::EditRole);
@@ -179,7 +179,7 @@ void ColumnTypeDelegate::setModelData(QWidget *editor, QAbstractItemModel *model
else
sle->setText(index.data().toString());
- if ( index.data().toString().length() == 0 )
+ if (index.data().toString().length() == 0)
{
QModelIndex typeIndex = index.sibling(index.row(), ColumnListModel::COL_TYPE);
model->setData(typeIndex, index.data(ColumnListModel::OriginalType).toInt(), Qt::EditRole);
@@ -205,8 +205,8 @@ ColumnListModel::ColumnListModel(QObject * parent):
QVariant ColumnListModel::headerData(int section, Qt::Orientation orientation, int role) const
{
- if ( section > ColumnListModel::COL_OCCURRENCE || orientation != Qt::Horizontal ||
- role != Qt::DisplayRole )
+ if (section > ColumnListModel::COL_OCCURRENCE || orientation != Qt::Horizontal ||
+ role != Qt::DisplayRole)
return QVariant();
return headerTitle(section);
@@ -224,7 +224,7 @@ int ColumnListModel::columnCount(const QModelIndex &/*parent*/) const
QString ColumnListModel::headerTitle(int section) const
{
- switch ( section )
+ switch (section)
{
case ColumnListModel::COL_DISPLAYED:
return tr("Displayed");
@@ -264,12 +264,12 @@ void ColumnListModel::populate()
QVariant ColumnListModel::data(const QModelIndex &index, int role) const
{
- if ( ! index.isValid() || index.column() >= store_.count() )
+ if (! index.isValid() || index.column() >= store_.count())
return QVariant();
ListElement ne = store_.at(index.row());
- if ( role == Qt::DisplayRole )
+ if (role == Qt::DisplayRole)
{
switch (index.column())
{
@@ -285,16 +285,16 @@ QVariant ColumnListModel::data(const QModelIndex &index, int role) const
return ne.customFields.length() > 0 ? qVariantFromValue(ne.occurrence) : QVariant();
}
}
- else if ( role == Qt::CheckStateRole )
+ else if (role == Qt::CheckStateRole)
{
- if ( index.column() == COL_DISPLAYED )
+ if (index.column() == COL_DISPLAYED)
{
return ne.displayed ? Qt::Checked : Qt::Unchecked;
}
}
- else if ( role == OriginalType )
+ else if (role == OriginalType)
return qVariantFromValue(ne.originalType);
- else if ( role == DisplayedState )
+ else if (role == DisplayedState)
return qVariantFromValue(ne.displayed);
return QVariant();
@@ -303,13 +303,13 @@ QVariant ColumnListModel::data(const QModelIndex &index, int role) const
Qt::ItemFlags ColumnListModel::flags(const QModelIndex &index) const
{
Qt::ItemFlags defaultFlags = QAbstractTableModel::flags(index);
- if ( index.isValid() && index.row() < store_.count() )
+ if (index.isValid() && index.row() < store_.count())
{
ListElement ne = store_.at(index.row());
Qt::ItemFlags flags = Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags;
- if ( index.column() == COL_DISPLAYED )
+ if (index.column() == COL_DISPLAYED)
flags |= Qt::ItemIsUserCheckable;
flags |= Qt::ItemIsEditable;
@@ -330,7 +330,7 @@ QMimeData *ColumnListModel::mimeData(const QModelIndexList &indexes) const
QMimeData *mimeData = new QMimeData;
int row = -1;
- if ( indexes.count() > 0 )
+ if (indexes.count() > 0)
row = indexes.at(0).row();
mimeData->setData(WiresharkMimeData::ColumnListMimeType, QString::number(row).toUtf8());
@@ -340,7 +340,7 @@ QMimeData *ColumnListModel::mimeData(const QModelIndexList &indexes) const
bool ColumnListModel::canDropMimeData(const QMimeData *data,
Qt::DropAction /* action */, int /* row */, int /* column */, const QModelIndex &parent) const
{
- if (parent.isValid() || ! data->hasFormat(WiresharkMimeData::ColumnListMimeType) )
+ if (parent.isValid() || ! data->hasFormat(WiresharkMimeData::ColumnListMimeType))
return false;
return true;
@@ -354,7 +354,7 @@ bool ColumnListModel::dropMimeData(const QMimeData *data,
if (!canDropMimeData(data, action, row, column, parent))
return false;
- if (action == Qt::IgnoreAction || parent.isValid() )
+ if (action == Qt::IgnoreAction || parent.isValid())
return true;
if (row != -1)
@@ -364,13 +364,13 @@ bool ColumnListModel::dropMimeData(const QMimeData *data,
bool ok = false;
int moveFrom = QString(data->data(WiresharkMimeData::ColumnListMimeType)).toInt(&ok);
- if ( ! ok )
+ if (! ok)
return false;
- if ( moveFrom < moveTo )
+ if (moveFrom < moveTo)
moveTo = moveTo - 1;
- if ( moveTo >= store_.count() )
+ if (moveTo >= store_.count())
moveTo = store_.count() - 1;
emit beginResetModel();
@@ -387,39 +387,39 @@ Qt::DropActions ColumnListModel::supportedDropActions() const
bool ColumnListModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
- if ( !index.isValid() || ! value.isValid() )
+ if (!index.isValid() || ! value.isValid())
return false;
bool change = false;
- if ( role == Qt::CheckStateRole && index.column() == ColumnListModel::COL_DISPLAYED )
+ if (role == Qt::CheckStateRole && index.column() == ColumnListModel::COL_DISPLAYED)
{
store_[index.row()].displayed = value.toInt() == Qt::Checked ? true : false;
change = true;
}
- else if ( index.column() == ColumnListModel::COL_TYPE )
+ else if (index.column() == ColumnListModel::COL_TYPE)
{
bool ok = false;
int val = value.toInt(&ok);
- if ( ok )
+ if (ok)
store_[index.row()].type = val;
}
- else if ( index.column() == ColumnListModel::COL_TITLE )
+ else if (index.column() == ColumnListModel::COL_TITLE)
{
store_[index.row()].title = value.toString();
}
- else if ( index.column() == ColumnListModel::COL_FIELDS )
+ else if (index.column() == ColumnListModel::COL_FIELDS)
{
store_[index.row()].customFields = value.toString();
}
- else if ( index.column() == ColumnListModel::COL_OCCURRENCE )
+ else if (index.column() == ColumnListModel::COL_OCCURRENCE)
{
bool ok = false;
int val = value.toInt(&ok);
- if ( ok )
+ if (ok)
store_[index.row()].occurrence = val;
}
- if ( change )
+ if (change)
emit dataChanged(index, index);
return change;
@@ -429,7 +429,7 @@ void ColumnListModel::saveColumns()
{
GList *new_col_list = Q_NULLPTR;
- for ( int row = 0; row < store_.count(); row++ )
+ for (int row = 0; row < store_.count(); row++)
{
fmt_data * cfmt = g_new0(fmt_data, 1);
ListElement elem = store_.at(row);
@@ -438,7 +438,7 @@ void ColumnListModel::saveColumns()
cfmt->visible = elem.displayed;
cfmt->fmt = elem.type;
cfmt->resolved = TRUE;
- if ( cfmt->fmt == COL_CUSTOM )
+ if (cfmt->fmt == COL_CUSTOM)
{
cfmt->custom_fields = qstring_strdup(elem.customFields);
cfmt->custom_occurrence = elem.occurrence;
diff --git a/ui/qt/models/decode_as_delegate.cpp b/ui/qt/models/decode_as_delegate.cpp
index db83b6750a..4cbcbd111e 100644
--- a/ui/qt/models/decode_as_delegate.cpp
+++ b/ui/qt/models/decode_as_delegate.cpp
@@ -267,7 +267,7 @@ QWidget* DecodeAsDelegate::createEditor(QWidget *parentWidget, const QStyleOptio
//QMap already sorts the keys (protocols) alphabetically
QMap<QString, dissector_info_t*>::iterator protocol;
- for(protocol = protocols.begin(); protocol != protocols.end(); ++protocol)
+ for (protocol = protocols.begin(); protocol != protocols.end(); ++protocol)
{
editor->addItem(protocol.key(), VariantPointer<dissector_info_t>::asQVariant(protocol.value()));
}
diff --git a/ui/qt/models/decode_as_model.cpp b/ui/qt/models/decode_as_model.cpp
index 3851357856..0fde78eb82 100644
--- a/ui/qt/models/decode_as_model.cpp
+++ b/ui/qt/models/decode_as_model.cpp
@@ -421,7 +421,7 @@ bool DecodeAsModel::copyRow(int dst_row, int src_row)
QVector<int> roles;
roles << Qt::EditRole << Qt::BackgroundRole;
- emit dataChanged(index(dst_row, 0), index(dst_row, columnCount()), roles );
+ emit dataChanged(index(dst_row, 0), index(dst_row, columnCount()), roles);
return true;
}
diff --git a/ui/qt/models/dissector_tables_model.cpp b/ui/qt/models/dissector_tables_model.cpp
index 5eb0bed17e..2fec38dde4 100644
--- a/ui/qt/models/dissector_tables_model.cpp
+++ b/ui/qt/models/dissector_tables_model.cpp
@@ -352,7 +352,7 @@ bool DissectorTablesProxyModel::lessThan(const QModelIndex &left, const QModelIn
bool DissectorTablesProxyModel::filterAcceptItem(DissectorTablesItem& item) const
{
- if ( filter_.isEmpty() )
+ if (filter_.isEmpty())
return true;
if (item.tableName().contains(filter_, Qt::CaseInsensitive) || item.shortName().contains(filter_, Qt::CaseInsensitive))
diff --git a/ui/qt/models/enabled_protocols_model.cpp b/ui/qt/models/enabled_protocols_model.cpp
index c6d8445442..668a4eccbf 100644
--- a/ui/qt/models/enabled_protocols_model.cpp
+++ b/ui/qt/models/enabled_protocols_model.cpp
@@ -355,9 +355,9 @@ bool EnabledProtocolsProxyModel::lessThan(const QModelIndex &left, const QModelI
int compare_ret = 0;
- if (left.column() == EnabledProtocolsModel::colProtocol )
+ if (left.column() == EnabledProtocolsModel::colProtocol)
compare_ret = left_item->name().compare(right_item->name(), Qt::CaseInsensitive);
- else if ( left.column() == EnabledProtocolsModel::colDescription )
+ else if (left.column() == EnabledProtocolsModel::colDescription)
compare_ret = left_item->description().compare(right_item->description(), Qt::CaseInsensitive);
if (compare_ret < 0)
@@ -370,10 +370,10 @@ bool EnabledProtocolsProxyModel::lessThan(const QModelIndex &left, const QModelI
Qt::ItemFlags EnabledProtocolsProxyModel::flags(const QModelIndex &index) const
{
Qt::ItemFlags flags = Qt::NoItemFlags;
- if ( index.isValid() )
+ if (index.isValid())
{
QModelIndex source = mapToSource(index);
- if ( filterAcceptsSelf(source.row(), source.parent() ) )
+ if (filterAcceptsSelf(source.row(), source.parent()) )
{
flags = Qt::ItemIsEnabled;
flags |= Qt::ItemIsSelectable;
@@ -386,20 +386,20 @@ Qt::ItemFlags EnabledProtocolsProxyModel::flags(const QModelIndex &index) const
bool EnabledProtocolsProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
- if ( filterAcceptsSelf(sourceRow, sourceParent) )
+ if (filterAcceptsSelf(sourceRow, sourceParent))
return true;
#if 0
QModelIndex parent = sourceParent;
- while ( parent.isValid() )
+ while (parent.isValid())
{
- if ( filterAcceptsSelf(parent.row(), parent.parent()) )
+ if (filterAcceptsSelf(parent.row(), parent.parent()))
return true;
parent = parent.parent();
}
#endif
- if ( filterAcceptsChild(sourceRow, sourceParent) )
+ if (filterAcceptsChild(sourceRow, sourceParent))
return true;
return false;
@@ -408,7 +408,7 @@ bool EnabledProtocolsProxyModel::filterAcceptsRow(int sourceRow, const QModelInd
bool EnabledProtocolsProxyModel::filterAcceptsSelf(int sourceRow, const QModelIndex &sourceParent) const
{
QModelIndex nameIdx = sourceModel()->index(sourceRow, EnabledProtocolsModel::colProtocol, sourceParent);
- if ( ! nameIdx.isValid() )
+ if (! nameIdx.isValid())
return false;
EnabledProtocolItem* item = static_cast<EnabledProtocolItem*>(nameIdx.internalPointer());
if (! item)
@@ -416,12 +416,12 @@ bool EnabledProtocolsProxyModel::filterAcceptsSelf(int sourceRow, const QModelIn
QRegExp regex(filter_, Qt::CaseInsensitive);
- if ( ( type_ != EnabledProtocolsProxyModel::EnabledItems && type_ != EnabledProtocolsProxyModel::DisabledItems ) &&
- ( protocolType_ == EnabledProtocolItem::Any || protocolType_ == item->type() ) )
+ if ((type_ != EnabledProtocolsProxyModel::EnabledItems && type_ != EnabledProtocolsProxyModel::DisabledItems) &&
+ (protocolType_ == EnabledProtocolItem::Any || protocolType_ == item->type()) )
{
- if ( ! filter_.isEmpty() )
+ if (! filter_.isEmpty())
{
- if ( item->name().contains(regex) && type_ != OnlyDescription)
+ if (item->name().contains(regex) && type_ != OnlyDescription)
return true;
if (item->description().contains(regex) && type_ != OnlyProtocol)
@@ -430,9 +430,9 @@ bool EnabledProtocolsProxyModel::filterAcceptsSelf(int sourceRow, const QModelIn
else
return true;
}
- else if ( type_ == EnabledProtocolsProxyModel::EnabledItems && item->enabled() )
+ else if (type_ == EnabledProtocolsProxyModel::EnabledItems && item->enabled())
return true;
- else if ( type_ == EnabledProtocolsProxyModel::DisabledItems && ! item->enabled() )
+ else if (type_ == EnabledProtocolsProxyModel::DisabledItems && ! item->enabled())
return true;
return false;
@@ -441,20 +441,20 @@ bool EnabledProtocolsProxyModel::filterAcceptsSelf(int sourceRow, const QModelIn
bool EnabledProtocolsProxyModel::filterAcceptsChild(int sourceRow, const QModelIndex &sourceParent) const
{
QModelIndex item = sourceModel()->index(sourceRow, EnabledProtocolsModel::colProtocol, sourceParent);
- if ( ! item.isValid() )
+ if (! item.isValid())
return false;
int childCount = item.model()->rowCount(item);
- if ( childCount == 0 )
+ if (childCount == 0)
return false;
- for ( int i = 0; i < childCount; i++ )
+ for (int i = 0; i < childCount; i++)
{
- if ( filterAcceptsSelf(i, item) )
+ if (filterAcceptsSelf(i, item))
return true;
#if 0
/* Recursive search disabled for performance reasons */
- if ( filterAcceptsChild(i, item) )
+ if (filterAcceptsChild(i, item))
return true;
#endif
}
@@ -473,26 +473,26 @@ void EnabledProtocolsProxyModel::setFilter(const QString& filter, EnabledProtoco
void EnabledProtocolsProxyModel::setItemsEnable(EnabledProtocolsProxyModel::EnableType enableType, QModelIndex parent)
{
- if ( ! sourceModel() )
+ if (! sourceModel())
return;
- if ( ! parent.isValid() )
+ if (! parent.isValid())
emit beginResetModel();
- for ( int row = 0; row < rowCount(parent); row++ )
+ for (int row = 0; row < rowCount(parent); row++)
{
QModelIndex idx = index(row, EnabledProtocolsModel::colProtocol, parent);
QModelIndex sIdx = mapToSource(idx);
- if ( sIdx.isValid() )
+ if (sIdx.isValid())
{
EnabledProtocolItem* item = static_cast<EnabledProtocolItem*>(sIdx.internalPointer());
- if ( item && ( protocolType_ == EnabledProtocolItem::Any || protocolType_ == item->type() ) )
+ if (item && (protocolType_ == EnabledProtocolItem::Any || protocolType_ == item->type()) )
{
Qt::CheckState enable = idx.data(Qt::CheckStateRole).value<Qt::CheckState>();
- if ( enableType == Enable )
+ if (enableType == Enable)
enable = Qt::Checked;
- else if ( enableType == Disable )
+ else if (enableType == Disable)
enable = Qt::Unchecked;
else
enable = enable == Qt::Checked ? Qt::Unchecked : Qt::Checked;
@@ -505,7 +505,7 @@ void EnabledProtocolsProxyModel::setItemsEnable(EnabledProtocolsProxyModel::Enab
}
- if ( ! parent.isValid() )
+ if (! parent.isValid())
emit endResetModel();
}
diff --git a/ui/qt/models/expert_info_model.cpp b/ui/qt/models/expert_info_model.cpp
index 8ccb07898e..ec6ddc3db1 100644
--- a/ui/qt/models/expert_info_model.cpp
+++ b/ui/qt/models/expert_info_model.cpp
@@ -333,7 +333,7 @@ int ExpertInfoModel::rowCount(const QModelIndex &parent) const
return 0;
}
-int ExpertInfoModel::columnCount(const QModelIndex& ) const
+int ExpertInfoModel::columnCount(const QModelIndex&) const
{
return colLast;
}
diff --git a/ui/qt/models/expert_info_proxy_model.cpp b/ui/qt/models/expert_info_proxy_model.cpp
index 3960d7b041..34d551ae52 100644
--- a/ui/qt/models/expert_info_proxy_model.cpp
+++ b/ui/qt/models/expert_info_proxy_model.cpp
@@ -219,7 +219,7 @@ QVariant ExpertInfoProxyModel::headerData(int section, Qt::Orientation orientati
return QVariant();
}
-int ExpertInfoProxyModel::columnCount(const QModelIndex& ) const
+int ExpertInfoProxyModel::columnCount(const QModelIndex&) const
{
return colProxyLast;
}
diff --git a/ui/qt/models/fileset_entry_model.cpp b/ui/qt/models/fileset_entry_model.cpp
index 194a87fe32..512fe4bd90 100644
--- a/ui/qt/models/fileset_entry_model.cpp
+++ b/ui/qt/models/fileset_entry_model.cpp
@@ -35,7 +35,7 @@ int FilesetEntryModel::rowCount(const QModelIndex &) const
QVariant FilesetEntryModel::data(const QModelIndex &index, int role) const
{
- if ( ! index.isValid() || index.row() >= rowCount() )
+ if (! index.isValid() || index.row() >= rowCount())
return QVariant();
const fileset_entry *entry = static_cast<fileset_entry*>(index.internalPointer());
@@ -46,7 +46,7 @@ QVariant FilesetEntryModel::data(const QModelIndex &index, int role) const
case Created:
{
QString created = nameToDate(entry->name);
- if(created.length() < 1) {
+ if (created.length() < 1) {
/* if this file doesn't follow the file set pattern, */
/* use the creation time of that file if available */
/* https://en.wikipedia.org/wiki/ISO_8601 */
diff --git a/ui/qt/models/filter_list_model.cpp b/ui/qt/models/filter_list_model.cpp
index b65e11f5b9..08e0f1ab5e 100644
--- a/ui/qt/models/filter_list_model.cpp
+++ b/ui/qt/models/filter_list_model.cpp
@@ -60,16 +60,16 @@ void FilterListModel::reload()
/* Try personal config file first */
QString fileName = gchar_free_to_qstring(get_persconffile_path(cfile, TRUE));
- if ( fileName.length() <= 0 || ! QFileInfo::exists(fileName) )
+ if (fileName.length() <= 0 || ! QFileInfo::exists(fileName))
fileName = gchar_free_to_qstring(get_persconffile_path(FILTER_FILE_NAME, TRUE));
- if ( fileName.length() <= 0 || ! QFileInfo::exists(fileName) )
+ if (fileName.length() <= 0 || ! QFileInfo::exists(fileName))
fileName = gchar_free_to_qstring(get_datafile_path(cfile));
- if ( fileName.length() <= 0 || ! QFileInfo::exists(fileName) )
+ if (fileName.length() <= 0 || ! QFileInfo::exists(fileName))
return;
QFile file(fileName);
/* Still can use the model, just have to start from an empty set */
- if ( ! file.open(QIODevice::ReadOnly | QIODevice::Text) )
+ if (! file.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QTextStream in(&file);
@@ -77,12 +77,12 @@ void FilterListModel::reload()
while (!in.atEnd())
{
QString line = in.readLine().trimmed();
- if ( line.startsWith("#") || line.indexOf("\"") <= -1 )
+ if (line.startsWith("#") || line.indexOf("\"") <= -1)
continue;
rx.indexIn(line);
QStringList groups = rx.capturedTexts();
- if ( groups.count() != 3 )
+ if (groups.count() != 3)
continue;
addFilter(groups.at(1), groups.at(2));
}
@@ -111,12 +111,12 @@ int FilterListModel::columnCount(const QModelIndex &/* parent */) const
QVariant FilterListModel::headerData(int section, Qt::Orientation orientation, int role) const
{
- if ( section >= columnCount() || section < 0 || orientation != Qt::Horizontal )
+ if (section >= columnCount() || section < 0 || orientation != Qt::Horizontal)
return QVariant();
- if ( role == Qt::DisplayRole )
+ if (role == Qt::DisplayRole)
{
- switch ( section ) {
+ switch (section) {
case ColumnName:
return tr("Filter Name");
break;
@@ -131,11 +131,11 @@ QVariant FilterListModel::headerData(int section, Qt::Orientation orientation, i
QVariant FilterListModel::data(const QModelIndex &index, int role) const
{
- if ( ! index.isValid() || index.row() >= rowCount() )
+ if (! index.isValid() || index.row() >= rowCount())
return QVariant();
QStringList row = storage.at(index.row()).split("\n");
- if ( role == Qt::DisplayRole )
+ if (role == Qt::DisplayRole)
return row.at(index.column());
return QVariant();
@@ -143,14 +143,14 @@ QVariant FilterListModel::data(const QModelIndex &index, int role) const
bool FilterListModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
- if ( ! index.isValid() || index.row() >= rowCount() || role != Qt::EditRole )
+ if (! index.isValid() || index.row() >= rowCount() || role != Qt::EditRole)
return false;
QStringList row = storage.at(index.row()).split("\n");
- if ( row.count() <= index.column() )
+ if (row.count() <= index.column())
return false;
- if ( index.column() == FilterListModel::ColumnName && value.toString().contains("\"") )
+ if (index.column() == FilterListModel::ColumnName && value.toString().contains("\""))
return false;
row[index.column()] = value.toString();
@@ -164,7 +164,7 @@ Qt::ItemFlags FilterListModel::flags(const QModelIndex &index) const
Qt::ItemFlags fl = QAbstractListModel::flags(index);
fl |= Qt::ItemIsDropEnabled;
- if ( ! index.isValid() || index.row() >= rowCount() )
+ if (! index.isValid() || index.row() >= rowCount())
return fl;
fl |= Qt::ItemIsEditable | Qt::ItemIsDragEnabled;
@@ -173,7 +173,7 @@ Qt::ItemFlags FilterListModel::flags(const QModelIndex &index) const
}
QModelIndex FilterListModel::addFilter(QString name, QString expression)
{
- if ( name.length() == 0 || expression.length() == 0 )
+ if (name.length() == 0 || expression.length() == 0)
return QModelIndex();
beginInsertRows(QModelIndex(), rowCount(), rowCount());
@@ -185,12 +185,12 @@ QModelIndex FilterListModel::addFilter(QString name, QString expression)
QModelIndex FilterListModel::findByName(QString name)
{
- if ( name.length() == 0 )
+ if (name.length() == 0)
return QModelIndex();
- for ( int cnt = 0; cnt < rowCount(); cnt++ )
+ for (int cnt = 0; cnt < rowCount(); cnt++)
{
- if ( storage.at(cnt).startsWith(QString("%1\n").arg(name)) )
+ if (storage.at(cnt).startsWith(QString("%1\n").arg(name)))
return index(cnt, 0);
}
@@ -199,12 +199,12 @@ QModelIndex FilterListModel::findByName(QString name)
QModelIndex FilterListModel::findByExpression(QString expression)
{
- if ( expression.length() == 0 )
+ if (expression.length() == 0)
return QModelIndex();
- for ( int cnt = 0; cnt < rowCount(); cnt++ )
+ for (int cnt = 0; cnt < rowCount(); cnt++)
{
- if ( storage.at(cnt).endsWith(QString("\n%1").arg(expression)) )
+ if (storage.at(cnt).endsWith(QString("\n%1").arg(expression)))
return index(cnt, 0);
}
@@ -213,7 +213,7 @@ QModelIndex FilterListModel::findByExpression(QString expression)
void FilterListModel::removeFilter(QModelIndex idx)
{
- if ( ! idx.isValid() || idx.row() >= rowCount() )
+ if (! idx.isValid() || idx.row() >= rowCount())
return;
beginRemoveRows(QModelIndex(), idx.row(), idx.row());
@@ -228,11 +228,11 @@ void FilterListModel::saveList()
filename = QString("%1%2%3").arg(ProfileModel::activeProfilePath()).arg(QDir::separator()).arg(filename);
QFile file(filename);
- if ( ! file.open(QIODevice::WriteOnly | QIODevice::Text) )
+ if (! file.open(QIODevice::WriteOnly | QIODevice::Text))
return;
QTextStream out(&file);
- for ( int row = 0; row < rowCount(); row++ )
+ for (int row = 0; row < rowCount(); row++)
{
QString line = QString("\"%1\"").arg(index(row, ColumnName).data().toString());
line.append(QString(" %1").arg(index(row, ColumnExpression).data().toString()));
@@ -265,7 +265,7 @@ QMimeData *FilterListModel::mimeData(const QModelIndexList &indexes) const
foreach (const QModelIndex &index, indexes)
{
- if ( ! rows.contains(QString::number(index.row())) )
+ if (! rows.contains(QString::number(index.row())))
rows << QString::number(index.row());
}
@@ -275,10 +275,10 @@ QMimeData *FilterListModel::mimeData(const QModelIndexList &indexes) const
bool FilterListModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int /* column */, const QModelIndex & parent)
{
- if ( action != Qt::MoveAction )
+ if (action != Qt::MoveAction)
return true;
- if ( ! data->hasFormat(WiresharkMimeData::FilterListMimeType) )
+ if (! data->hasFormat(WiresharkMimeData::FilterListMimeType))
return true;
QStringList rows = QString(data->data(WiresharkMimeData::FilterListMimeType)).split(",");
@@ -286,14 +286,14 @@ bool FilterListModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
int insertRow = parent.isValid() ? parent.row() : row;
/* for now, only single rows can be selected */
- if ( rows.count() > 0 )
+ if (rows.count() > 0)
{
bool ok = false;
int strow = rows[0].toInt(&ok);
- if ( ok )
+ if (ok)
{
int storeTo = insertRow;
- if ( storeTo < 0 || storeTo >= storage.count() )
+ if (storeTo < 0 || storeTo >= storage.count())
storeTo = storage.count() - 1;
beginResetModel();
diff --git a/ui/qt/models/info_proxy_model.cpp b/ui/qt/models/info_proxy_model.cpp
index 72b26f1a8a..00724fadfa 100644
--- a/ui/qt/models/info_proxy_model.cpp
+++ b/ui/qt/models/info_proxy_model.cpp
@@ -27,7 +27,7 @@ InfoProxyModel::~InfoProxyModel()
void InfoProxyModel::appendInfo(QString info)
{
- if ( ! infos_.contains(info) )
+ if (! infos_.contains(info))
infos_ << info;
}
@@ -43,17 +43,17 @@ int InfoProxyModel::rowCount(const QModelIndex &parent) const
QVariant InfoProxyModel::data (const QModelIndex &index, int role) const
{
- if ( ! index.isValid() )
+ if (! index.isValid())
return QVariant();
- if ( index.row() < sourceModel()->rowCount() )
+ if (index.row() < sourceModel()->rowCount())
return sourceModel()->data(mapToSource(index), role);
int ifIdx = index.row() - sourceModel()->rowCount();
- if ( index.column() != column_ || ifIdx < 0 || ifIdx >= infos_.count() )
+ if (index.column() != column_ || ifIdx < 0 || ifIdx >= infos_.count())
return QVariant();
- switch ( role )
+ switch (role)
{
case Qt::DisplayRole:
return infos_.at(ifIdx);
@@ -69,7 +69,7 @@ QVariant InfoProxyModel::data (const QModelIndex &index, int role) const
Qt::ItemFlags InfoProxyModel::flags(const QModelIndex &index) const
{
- if ( index.row() < sourceModel()->rowCount() )
+ if (index.row() < sourceModel()->rowCount())
return sourceModel()->flags(mapToSource(index));
return 0;
@@ -77,7 +77,7 @@ Qt::ItemFlags InfoProxyModel::flags(const QModelIndex &index) const
QModelIndex InfoProxyModel::index(int row, int column, const QModelIndex &parent) const
{
- if ( row >= sourceModel()->rowCount() && row < rowCount() )
+ if (row >= sourceModel()->rowCount() && row < rowCount())
return createIndex(row, column);
return QIdentityProxyModel::index(row, column, parent);
@@ -85,10 +85,10 @@ QModelIndex InfoProxyModel::index(int row, int column, const QModelIndex &parent
QModelIndex InfoProxyModel::mapToSource(const QModelIndex &proxyIndex) const
{
- if ( ! proxyIndex.isValid() )
+ if (! proxyIndex.isValid())
return QModelIndex();
- if ( proxyIndex.row() >= sourceModel()->rowCount() )
+ if (proxyIndex.row() >= sourceModel()->rowCount())
return QModelIndex();
return QIdentityProxyModel::mapToSource(proxyIndex);
@@ -109,7 +109,7 @@ void InfoProxyModel::setColumn(int column)
if (old_column >= 0) {
//Notify old column has changed
- emit dataChanged(index(0, old_column), index(rowCount(), old_column), roles );
+ emit dataChanged(index(0, old_column), index(rowCount(), old_column), roles);
}
if (column_ >= 0) {
diff --git a/ui/qt/models/interface_sort_filter_model.cpp b/ui/qt/models/interface_sort_filter_model.cpp
index 07a6228bfb..c6706195d3 100644
--- a/ui/qt/models/interface_sort_filter_model.cpp
+++ b/ui/qt/models/interface_sort_filter_model.cpp
@@ -39,7 +39,7 @@ void InterfaceSortFilterModel::resetAllFilter()
#endif
/* Adding all columns, to have a default setting */
- for ( int col = 0; col < IFTREE_COL_MAX; col++ )
+ for (int col = 0; col < IFTREE_COL_MAX; col++)
_columns.append((InterfaceTreeColumns)col);
invalidateFilter();
@@ -49,7 +49,7 @@ void InterfaceSortFilterModel::resetAllFilter()
void InterfaceSortFilterModel::setStoreOnChange(bool storeOnChange)
{
_storeOnChange = storeOnChange;
- if ( storeOnChange )
+ if (storeOnChange)
{
connect(wsApp, &WiresharkApplication::preferencesChanged, this, &InterfaceSortFilterModel::resetPreferenceData);
resetPreferenceData();
@@ -80,7 +80,7 @@ void InterfaceSortFilterModel::toggleRemoteDisplay()
{
_remoteDisplay = ! _remoteDisplay;
- if ( _storeOnChange )
+ if (_storeOnChange)
{
prefs.gui_interfaces_remote_display = ! _remoteDisplay;
@@ -95,7 +95,7 @@ bool InterfaceSortFilterModel::remoteInterfacesExist()
{
bool exist = false;
- if ( sourceModel()->rowCount() == 0 )
+ if (sourceModel()->rowCount() == 0)
return exist;
for (int idx = 0; idx < sourceModel()->rowCount() && ! exist; idx++)
@@ -117,14 +117,14 @@ void InterfaceSortFilterModel::resetPreferenceData()
{
displayHiddenTypes.clear();
QString stored_prefs(prefs.gui_interfaces_hide_types);
- if ( stored_prefs.length() > 0 )
+ if (stored_prefs.length() > 0)
{
QStringList ifTypesStored = stored_prefs.split(',');
QStringList::const_iterator it = ifTypesStored.constBegin();
- while(it != ifTypesStored.constEnd())
+ while (it != ifTypesStored.constEnd())
{
int i_val = (*it).toInt();
- if ( ! displayHiddenTypes.contains(i_val) )
+ if (! displayHiddenTypes.contains(i_val))
displayHiddenTypes.append(i_val);
++it;
}
@@ -150,7 +150,7 @@ void InterfaceSortFilterModel::toggleFilterHidden()
{
_filterHidden = ! _filterHidden;
- if ( _storeOnChange )
+ if (_storeOnChange)
{
prefs.gui_interfaces_show_hidden = ! _filterHidden;
@@ -169,7 +169,7 @@ bool InterfaceSortFilterModel::filterByType() const
int InterfaceSortFilterModel::interfacesHidden()
{
#ifdef HAVE_LIBPCAP
- if ( ! global_capture_opts.all_ifaces )
+ if (! global_capture_opts.all_ifaces)
return 0;
#endif
@@ -180,7 +180,7 @@ QList<int> InterfaceSortFilterModel::typesDisplayed()
{
QList<int> shownTypes;
- if ( sourceModel()->rowCount() == 0 )
+ if (sourceModel()->rowCount() == 0)
return shownTypes;
for (int idx = 0; idx < sourceModel()->rowCount(); idx++)
@@ -188,9 +188,9 @@ QList<int> InterfaceSortFilterModel::typesDisplayed()
int type = ((InterfaceTreeModel *)sourceModel())->getColumnContent(idx, IFTREE_COL_TYPE).toInt();
bool hidden = ((InterfaceTreeModel *)sourceModel())->getColumnContent(idx, IFTREE_COL_HIDDEN).toBool();
- if ( ! hidden )
+ if (! hidden)
{
- if ( ! shownTypes.contains(type) )
+ if (! shownTypes.contains(type))
shownTypes.append(type);
}
}
@@ -200,19 +200,19 @@ QList<int> InterfaceSortFilterModel::typesDisplayed()
void InterfaceSortFilterModel::setInterfaceTypeVisible(int ifType, bool visible)
{
- if ( visible && displayHiddenTypes.contains(ifType) )
+ if (visible && displayHiddenTypes.contains(ifType))
displayHiddenTypes.removeAll(ifType);
- else if ( ! visible && ! displayHiddenTypes.contains(ifType) )
+ else if (! visible && ! displayHiddenTypes.contains(ifType))
displayHiddenTypes.append(ifType);
else
/* Nothing should have changed */
return;
- if ( _storeOnChange )
+ if (_storeOnChange)
{
QString new_pref;
QList<int>::const_iterator it = displayHiddenTypes.constBegin();
- while( it != displayHiddenTypes.constEnd() )
+ while (it != displayHiddenTypes.constEnd())
{
new_pref.append(QString("%1,").arg(*it));
++it;
@@ -240,26 +240,26 @@ bool InterfaceSortFilterModel::isInterfaceTypeShown(int ifType) const
{
bool result = false;
- if ( displayHiddenTypes.size() == 0 )
+ if (displayHiddenTypes.size() == 0)
result = true;
- else if ( ! displayHiddenTypes.contains(ifType) )
+ else if (! displayHiddenTypes.contains(ifType))
result = true;
- return ( ( _invertTypeFilter && ! result ) || ( ! _invertTypeFilter && result ) );
+ return ((_invertTypeFilter && ! result) || (! _invertTypeFilter && result) );
}
bool InterfaceSortFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const
{
QModelIndex realIndex = sourceModel()->index(sourceRow, 0, sourceParent);
- if ( ! realIndex.isValid() )
+ if (! realIndex.isValid())
return false;
#ifdef HAVE_LIBPCAP
int idx = realIndex.row();
/* No data loaded, we do not display anything */
- if ( sourceModel()->rowCount() == 0 )
+ if (sourceModel()->rowCount() == 0)
return false;
int type = -1;
@@ -278,22 +278,22 @@ bool InterfaceSortFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex
else
return false;
- if ( hidden && _filterHidden )
+ if (hidden && _filterHidden)
return false;
- if ( _filterTypes && ! isInterfaceTypeShown(type) )
+ if (_filterTypes && ! isInterfaceTypeShown(type))
{
#ifdef HAVE_PCAP_REMOTE
/* Remote interfaces have the if type IF_WIRED, therefore would be filtered, if not explicitly checked here */
- if ( type != IF_WIRED || ! ((InterfaceTreeModel *)sourceModel())->isRemote(idx) )
+ if (type != IF_WIRED || ! ((InterfaceTreeModel *)sourceModel())->isRemote(idx))
#endif
return false;
}
#ifdef HAVE_PCAP_REMOTE
- if ( ((InterfaceTreeModel *)sourceModel())->isRemote(idx) )
+ if (((InterfaceTreeModel *)sourceModel())->isRemote(idx))
{
- if ( ! _remoteDisplay )
+ if (! _remoteDisplay)
return false;
}
#endif
@@ -307,10 +307,10 @@ bool InterfaceSortFilterModel::filterAcceptsColumn(int sourceColumn, const QMode
{
QModelIndex realIndex = sourceModel()->index(0, sourceColumn, sourceParent);
- if ( ! realIndex.isValid() )
+ if (! realIndex.isValid())
return false;
- if ( ! _columns.contains((InterfaceTreeColumns)sourceColumn) )
+ if (! _columns.contains((InterfaceTreeColumns)sourceColumn))
return false;
return true;
@@ -324,7 +324,7 @@ void InterfaceSortFilterModel::setColumns(QList<InterfaceTreeColumns> columns)
int InterfaceSortFilterModel::mapSourceToColumn(InterfaceTreeColumns mdlIndex)
{
- if ( ! _columns.contains(mdlIndex) )
+ if (! _columns.contains(mdlIndex))
return -1;
return _columns.indexOf(mdlIndex, 0);
@@ -332,10 +332,10 @@ int InterfaceSortFilterModel::mapSourceToColumn(InterfaceTreeColumns mdlIndex)
QModelIndex InterfaceSortFilterModel::mapToSource(const QModelIndex &proxyIndex) const
{
- if ( ! proxyIndex.isValid() )
+ if (! proxyIndex.isValid())
return QModelIndex();
- if ( ! sourceModel() )
+ if (! sourceModel())
return QModelIndex();
QModelIndex baseIndex = QSortFilterProxyModel::mapToSource(proxyIndex);
@@ -346,9 +346,9 @@ QModelIndex InterfaceSortFilterModel::mapToSource(const QModelIndex &proxyIndex)
QModelIndex InterfaceSortFilterModel::mapFromSource(const QModelIndex &sourceIndex) const
{
- if ( ! sourceIndex.isValid() )
+ if (! sourceIndex.isValid())
return QModelIndex();
- else if ( ! _columns.contains( (InterfaceTreeColumns) sourceIndex.column() ) )
+ else if (! _columns.contains((InterfaceTreeColumns) sourceIndex.column()) )
return QModelIndex();
QModelIndex newIndex = QSortFilterProxyModel::mapFromSource(sourceIndex);
@@ -361,10 +361,10 @@ QString InterfaceSortFilterModel::interfaceError()
QString result;
InterfaceTreeModel * sourceModel = dynamic_cast<InterfaceTreeModel *>(this->sourceModel());
- if ( sourceModel != NULL )
+ if (sourceModel != NULL)
result = sourceModel->interfaceError();
- if ( result.size() == 0 && rowCount() == 0 )
+ if (result.size() == 0 && rowCount() == 0)
result = tr("No interfaces to be displayed. %1 interfaces hidden.").arg(interfacesHidden());
return result;
diff --git a/ui/qt/models/interface_tree_cache_model.cpp b/ui/qt/models/interface_tree_cache_model.cpp
index 96f0432ded..ff084a3013 100644
--- a/ui/qt/models/interface_tree_cache_model.cpp
+++ b/ui/qt/models/interface_tree_cache_model.cpp
@@ -67,14 +67,14 @@ QVariant InterfaceTreeCacheModel::getColumnContent(int idx, int col, int role)
#ifdef HAVE_LIBPCAP
void InterfaceTreeCacheModel::reset(int row)
{
- if ( row < 0 )
+ if (row < 0)
{
delete storage;
storage = new QMap<int, QMap<InterfaceTreeColumns, QVariant> *>();
}
else
{
- if ( storage->count() > row )
+ if (storage->count() > row)
storage->remove(storage->keys().at(row));
}
}
@@ -95,17 +95,17 @@ void InterfaceTreeCacheModel::saveNewDevices()
QMap<InterfaceTreeColumns, QVariant> * dataField = storage->value(idx, 0);
/* When devices are being added, they are added using generic values. So only devices
* whose data have been changed should be used from here on out. */
- if ( dataField != 0 )
+ if (dataField != 0)
{
- if ( device->if_info.type != IF_PIPE )
+ if (device->if_info.type != IF_PIPE)
{
continue;
}
- if ( device->if_info.type == IF_PIPE )
+ if (device->if_info.type == IF_PIPE)
{
QVariant saveValue = dataField->value(IFTREE_COL_PIPE_PATH);
- if ( saveValue.isValid() )
+ if (saveValue.isValid())
{
g_free(device->if_info.name);
device->if_info.name = qstring_strdup(saveValue.toString());
@@ -119,7 +119,7 @@ void InterfaceTreeCacheModel::saveNewDevices()
}
}
- if ( useDevice )
+ if (useDevice)
g_array_append_val(global_capture_opts.all_ifaces, *device);
}
@@ -134,7 +134,7 @@ void InterfaceTreeCacheModel::saveNewDevices()
void InterfaceTreeCacheModel::save()
{
- if ( storage->count() == 0 )
+ if (storage->count() == 0)
return;
QMap<char**, QStringList> prefStorage;
@@ -146,21 +146,21 @@ void InterfaceTreeCacheModel::save()
saveNewDevices();
- for(unsigned int idx = 0; idx < global_capture_opts.all_ifaces->len; idx++)
+ for (unsigned int idx = 0; idx < global_capture_opts.all_ifaces->len; idx++)
{
interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, idx);
- if (! device->name )
+ if (! device->name)
continue;
/* Try to load a saved value row for this index */
QMap<InterfaceTreeColumns, QVariant> * dataField = storage->value(idx, 0);
/* Handle the storing of values for this device here */
- if ( dataField )
+ if (dataField)
{
QMap<InterfaceTreeColumns, QVariant>::const_iterator it = dataField->constBegin();
- while ( it != dataField->constEnd() )
+ while (it != dataField->constEnd())
{
InterfaceTreeColumns col = it.key();
QVariant saveValue = it.value();
@@ -170,30 +170,30 @@ void InterfaceTreeCacheModel::save()
* value has to be handled separately. Comments are stored only in the preference file
* and applied to the data name during loading. Therefore comments are not handled here */
- if ( col == IFTREE_COL_HIDDEN )
+ if (col == IFTREE_COL_HIDDEN)
{
device->hidden = saveValue.toBool();
}
- else if ( device->if_info.type == IF_EXTCAP )
+ else if (device->if_info.type == IF_EXTCAP)
{
/* extcap interfaces do not have the following columns.
* ATTENTION: all generic columns must be added, BEFORE this
* if-clause, or they will be ignored for extcap interfaces */
}
- else if ( col == IFTREE_COL_PROMISCUOUSMODE )
+ else if (col == IFTREE_COL_PROMISCUOUSMODE)
{
device->pmode = saveValue.toBool();
}
#ifdef HAVE_PCAP_CREATE
- else if ( col == IFTREE_COL_MONITOR_MODE )
+ else if (col == IFTREE_COL_MONITOR_MODE)
{
device->monitor_mode_enabled = saveValue.toBool();
}
#endif
- else if ( col == IFTREE_COL_SNAPLEN )
+ else if (col == IFTREE_COL_SNAPLEN)
{
int iVal = saveValue.toInt();
- if ( iVal != WTAP_MAX_PACKET_SIZE_STANDARD )
+ if (iVal != WTAP_MAX_PACKET_SIZE_STANDARD)
{
device->has_snaplen = true;
device->snaplen = iVal;
@@ -205,7 +205,7 @@ void InterfaceTreeCacheModel::save()
}
}
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
- else if ( col == IFTREE_COL_BUFFERLEN )
+ else if (col == IFTREE_COL_BUFFERLEN)
{
device->buffer = saveValue.toInt();
}
@@ -215,22 +215,22 @@ void InterfaceTreeCacheModel::save()
}
QVariant content = getColumnContent(idx, IFTREE_COL_HIDDEN, Qt::CheckStateRole);
- if ( content.isValid() && static_cast<Qt::CheckState>(content.toInt()) == Qt::Unchecked )
+ if (content.isValid() && static_cast<Qt::CheckState>(content.toInt()) == Qt::Unchecked)
prefStorage[&prefs.capture_devices_hide] << QString(device->name);
content = getColumnContent(idx, IFTREE_COL_COMMENT);
- if ( content.isValid() && content.toString().size() > 0 )
+ if (content.isValid() && content.toString().size() > 0)
prefStorage[&prefs.capture_devices_descr] << QString("%1(%2)").arg(device->name).arg(content.toString());
bool allowExtendedColumns = true;
- if ( device->if_info.type == IF_EXTCAP )
+ if (device->if_info.type == IF_EXTCAP)
allowExtendedColumns = false;
- if ( allowExtendedColumns )
+ if (allowExtendedColumns)
{
content = getColumnContent(idx, IFTREE_COL_PROMISCUOUSMODE, Qt::CheckStateRole);
- if ( content.isValid() )
+ if (content.isValid())
{
bool value = static_cast<Qt::CheckState>(content.toInt()) == Qt::Checked;
prefStorage[&prefs.capture_devices_pmode] << QString("%1(%2)").arg(device->name).arg(value ? 1 : 0);
@@ -238,12 +238,12 @@ void InterfaceTreeCacheModel::save()
#ifdef HAVE_PCAP_CREATE
content = getColumnContent(idx, IFTREE_COL_MONITOR_MODE, Qt::CheckStateRole);
- if ( content.isValid() && static_cast<Qt::CheckState>(content.toInt()) == Qt::Checked )
+ if (content.isValid() && static_cast<Qt::CheckState>(content.toInt()) == Qt::Checked)
prefStorage[&prefs.capture_devices_monitor_mode] << QString(device->name);
#endif
content = getColumnContent(idx, IFTREE_COL_SNAPLEN);
- if ( content.isValid() )
+ if (content.isValid())
{
int value = content.toInt();
prefStorage[&prefs.capture_devices_snaplen] <<
@@ -254,10 +254,10 @@ void InterfaceTreeCacheModel::save()
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
content = getColumnContent(idx, IFTREE_COL_BUFFERLEN);
- if ( content.isValid() )
+ if (content.isValid())
{
int value = content.toInt();
- if ( value != -1 )
+ if (value != -1)
{
prefStorage[&prefs.capture_devices_buffersize] <<
QString("%1(%2)").arg(device->name).
@@ -269,7 +269,7 @@ void InterfaceTreeCacheModel::save()
}
QMap<char**, QStringList>::const_iterator it = prefStorage.constBegin();
- while ( it != prefStorage.constEnd() )
+ while (it != prefStorage.constEnd())
{
char ** key = it.key();
@@ -294,7 +294,7 @@ int InterfaceTreeCacheModel::rowCount(const QModelIndex & parent) const
bool InterfaceTreeCacheModel::changeIsAllowed(InterfaceTreeColumns col) const
{
- if ( editableColumns.contains(col) || checkableColumns.contains(col) )
+ if (editableColumns.contains(col) || checkableColumns.contains(col))
return true;
return false;
}
@@ -304,15 +304,15 @@ const interface_t * InterfaceTreeCacheModel::lookup(const QModelIndex &index) co
{
const interface_t * result = 0;
- if ( ! index.isValid() || ! global_capture_opts.all_ifaces )
+ if (! index.isValid() || ! global_capture_opts.all_ifaces)
return result;
int idx = index.row();
- if ( (unsigned int) idx >= global_capture_opts.all_ifaces->len )
+ if ((unsigned int) idx >= global_capture_opts.all_ifaces->len)
{
idx = idx - global_capture_opts.all_ifaces->len;
- if ( idx < newDevices.size() )
+ if (idx < newDevices.size())
result = &newDevices[idx];
}
else
@@ -333,17 +333,17 @@ bool InterfaceTreeCacheModel::isAllowedToBeEdited(const QModelIndex &index) cons
Q_UNUSED(index);
#else
const interface_t * device = lookup(index);
- if ( device == 0 )
+ if (device == 0)
return false;
InterfaceTreeColumns col = (InterfaceTreeColumns) index.column();
- if ( device->if_info.type == IF_EXTCAP )
+ if (device->if_info.type == IF_EXTCAP)
{
/* extcap interfaces do not have those settings */
- if ( col == IFTREE_COL_PROMISCUOUSMODE || col == IFTREE_COL_SNAPLEN )
+ if (col == IFTREE_COL_PROMISCUOUSMODE || col == IFTREE_COL_SNAPLEN)
return false;
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
- if ( col == IFTREE_COL_BUFFERLEN )
+ if (col == IFTREE_COL_BUFFERLEN)
return false;
#endif
}
@@ -359,14 +359,14 @@ bool InterfaceTreeCacheModel::isAvailableField(const QModelIndex &index) const
#else
const interface_t * device = lookup(index);
- if ( device == 0 )
+ if (device == 0)
return false;
InterfaceTreeColumns col = (InterfaceTreeColumns) index.column();
- if ( col == IFTREE_COL_HIDDEN )
+ if (col == IFTREE_COL_HIDDEN)
{
// Do not allow default capture interface to be hidden.
- if ( ! g_strcmp0(prefs.capture_device, device->display_name) )
+ if (! g_strcmp0(prefs.capture_device, device->display_name))
return false;
}
#endif
@@ -376,16 +376,16 @@ bool InterfaceTreeCacheModel::isAvailableField(const QModelIndex &index) const
Qt::ItemFlags InterfaceTreeCacheModel::flags(const QModelIndex &index) const
{
- if ( ! index.isValid() )
+ if (! index.isValid())
return 0;
Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
InterfaceTreeColumns col = (InterfaceTreeColumns) index.column();
- if ( changeIsAllowed(col) && isAvailableField(index) && isAllowedToBeEdited(index) )
+ if (changeIsAllowed(col) && isAvailableField(index) && isAllowedToBeEdited(index))
{
- if ( checkableColumns.contains(col) )
+ if (checkableColumns.contains(col))
{
flags |= Qt::ItemIsUserCheckable;
}
@@ -400,25 +400,25 @@ Qt::ItemFlags InterfaceTreeCacheModel::flags(const QModelIndex &index) const
bool InterfaceTreeCacheModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
- if ( ! index.isValid() )
+ if (! index.isValid())
return false;
- if ( ! isAvailableField(index) )
+ if (! isAvailableField(index))
return false;
int row = index.row();
InterfaceTreeColumns col = (InterfaceTreeColumns)index.column();
- if ( role == Qt::CheckStateRole || role == Qt::EditRole )
+ if (role == Qt::CheckStateRole || role == Qt::EditRole)
{
- if ( changeIsAllowed( col ) )
+ if (changeIsAllowed(col) )
{
QVariant saveValue = value;
QMap<InterfaceTreeColumns, QVariant> * dataField = 0;
/* obtain the list of already stored changes for this row. If none exist
* create a new storage row for this entry */
- if ( ( dataField = storage->value(row, 0) ) == 0 )
+ if ((dataField = storage->value(row, 0)) == 0)
{
dataField = new QMap<InterfaceTreeColumns, QVariant>();
storage->insert(row, dataField);
@@ -435,22 +435,22 @@ bool InterfaceTreeCacheModel::setData(const QModelIndex &index, const QVariant &
QVariant InterfaceTreeCacheModel::data(const QModelIndex &index, int role) const
{
- if ( ! index.isValid() )
+ if (! index.isValid())
return QVariant();
int row = index.row();
InterfaceTreeColumns col = (InterfaceTreeColumns)index.column();
- if ( isAvailableField(index) && isAllowedToBeEdited(index) )
+ if (isAvailableField(index) && isAllowedToBeEdited(index))
{
- if ( ( ( role == Qt::DisplayRole || role == Qt::EditRole ) && editableColumns.contains(col) ) ||
- ( role == Qt::CheckStateRole && checkableColumns.contains(col) ) )
+ if (((role == Qt::DisplayRole || role == Qt::EditRole) && editableColumns.contains(col)) ||
+ (role == Qt::CheckStateRole && checkableColumns.contains(col)) )
{
QMap<InterfaceTreeColumns, QVariant> * dataField = 0;
- if ( ( dataField = storage->value(row, 0) ) != 0 )
+ if ((dataField = storage->value(row, 0)) != 0)
{
- if ( dataField->contains(col) )
+ if (dataField->contains(col))
{
return dataField->value(col, QVariant());
}
@@ -459,13 +459,13 @@ QVariant InterfaceTreeCacheModel::data(const QModelIndex &index, int role) const
}
else
{
- if ( role == Qt::CheckStateRole )
+ if (role == Qt::CheckStateRole)
return QVariant();
- else if ( role == Qt::DisplayRole )
+ else if (role == Qt::DisplayRole)
return QString(UTF8_EM_DASH);
}
- if ( row < sourceModel->rowCount() )
+ if (row < sourceModel->rowCount())
{
return sourceModel->data(index, role);
}
@@ -478,35 +478,35 @@ QVariant InterfaceTreeCacheModel::data(const QModelIndex &index, int role) const
* classify as new devices. */
const interface_t * device = lookup(index);
- if ( device != 0 )
+ if (device != 0)
{
- if ( role == Qt::DisplayRole || role == Qt::EditRole )
+ if (role == Qt::DisplayRole || role == Qt::EditRole)
{
- if ( col == IFTREE_COL_PIPE_PATH ||
+ if (col == IFTREE_COL_PIPE_PATH ||
col == IFTREE_COL_NAME ||
- col == IFTREE_COL_DESCRIPTION )
+ col == IFTREE_COL_DESCRIPTION)
{
QMap<InterfaceTreeColumns, QVariant> * dataField = 0;
- if ( ( dataField = storage->value(row, 0) ) != 0 &&
- dataField->contains(IFTREE_COL_PIPE_PATH) )
+ if ((dataField = storage->value(row, 0)) != 0 &&
+ dataField->contains(IFTREE_COL_PIPE_PATH))
{
return dataField->value(IFTREE_COL_PIPE_PATH, QVariant());
}
else
return QString(device->name);
}
- else if ( col == IFTREE_COL_TYPE )
+ else if (col == IFTREE_COL_TYPE)
{
return QVariant::fromValue((int)device->if_info.type);
}
}
- else if ( role == Qt::CheckStateRole )
+ else if (role == Qt::CheckStateRole)
{
- if ( col == IFTREE_COL_HIDDEN )
+ if (col == IFTREE_COL_HIDDEN)
{
// Do not allow default capture interface to be hidden.
- if ( ! g_strcmp0(prefs.capture_device, device->display_name) )
+ if (! g_strcmp0(prefs.capture_device, device->display_name))
return QVariant();
/* Hidden is a de-selection, therefore inverted logic here */
@@ -523,7 +523,7 @@ QVariant InterfaceTreeCacheModel::data(const QModelIndex &index, int role) const
#ifdef HAVE_LIBPCAP
QModelIndex InterfaceTreeCacheModel::index(int row, int column, const QModelIndex &parent) const
{
- if ( row >= sourceModel->rowCount() && ( row - sourceModel->rowCount() ) < newDevices.count() )
+ if (row >= sourceModel->rowCount() && (row - sourceModel->rowCount()) < newDevices.count())
{
return createIndex(row, column, (void *)0);
}
@@ -540,7 +540,7 @@ void InterfaceTreeCacheModel::addDevice(const interface_t * newDevice)
void InterfaceTreeCacheModel::deleteDevice(const QModelIndex &index)
{
- if ( ! index.isValid() )
+ if (! index.isValid())
return;
emit beginRemoveRows(QModelIndex(), index.row(), index.row());
@@ -548,12 +548,12 @@ void InterfaceTreeCacheModel::deleteDevice(const QModelIndex &index)
int row = index.row();
/* device is in newDevices */
- if ( row >= sourceModel->rowCount() )
+ if (row >= sourceModel->rowCount())
{
int newDeviceIdx = row - sourceModel->rowCount();
newDevices.removeAt(newDeviceIdx);
- if ( storage->contains(index.row()) )
+ if (storage->contains(index.row()))
storage->remove(index.row());
/* The storage array has to be resorted, if the index, that was removed
@@ -562,10 +562,10 @@ void InterfaceTreeCacheModel::deleteDevice(const QModelIndex &index)
* We must iterate using a list, not an iterator, otherwise the change
* will fold on itself. */
QList<int> storageKeys = storage->keys();
- for ( int i = 0; i < storageKeys.size(); ++i )
+ for (int i = 0; i < storageKeys.size(); ++i)
{
int key = storageKeys.at(i);
- if ( key > index.row() )
+ if (key > index.row())
{
storage->insert(key - 1, storage->value(key));
storage->remove(key);
diff --git a/ui/qt/models/interface_tree_model.cpp b/ui/qt/models/interface_tree_model.cpp
index 14e0944250..27a329b317 100644
--- a/ui/qt/models/interface_tree_model.cpp
+++ b/ui/qt/models/interface_tree_model.cpp
@@ -62,12 +62,12 @@ InterfaceTreeModel::~InterfaceTreeModel(void)
QString InterfaceTreeModel::interfaceError()
{
QString errorText;
- if ( rowCount() == 0 )
+ if (rowCount() == 0)
{
errorText = tr("No Interfaces found.");
}
#ifdef HAVE_LIBPCAP
- else if ( global_capture_opts.ifaces_err != 0 )
+ else if (global_capture_opts.ifaces_err != 0)
{
errorText = tr(global_capture_opts.ifaces_err_info);
}
@@ -76,7 +76,7 @@ QString InterfaceTreeModel::interfaceError()
return errorText;
}
-int InterfaceTreeModel::rowCount(const QModelIndex & ) const
+int InterfaceTreeModel::rowCount(const QModelIndex &) const
{
#ifdef HAVE_LIBPCAP
return (global_capture_opts.all_ifaces ? global_capture_opts.all_ifaces->len : 0);
@@ -86,7 +86,7 @@ int InterfaceTreeModel::rowCount(const QModelIndex & ) const
#endif
}
-int InterfaceTreeModel::columnCount(const QModelIndex & ) const
+int InterfaceTreeModel::columnCount(const QModelIndex &) const
{
/* IFTREE_COL_MAX is not being displayed, it is the definition for the maximum numbers of columns */
return ((int) IFTREE_COL_MAX);
@@ -96,71 +96,71 @@ QVariant InterfaceTreeModel::data(const QModelIndex &index, int role) const
{
#ifdef HAVE_LIBPCAP
bool interfacesLoaded = true;
- if ( ! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len == 0 )
+ if (! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len == 0)
interfacesLoaded = false;
- if ( !index.isValid() )
+ if (!index.isValid())
return QVariant();
int row = index.row();
InterfaceTreeColumns col = (InterfaceTreeColumns) index.column();
- if ( interfacesLoaded )
+ if (interfacesLoaded)
{
interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, row);
/* Data for display in cell */
- if ( role == Qt::DisplayRole )
+ if (role == Qt::DisplayRole)
{
/* Only the name is being displayed */
- if ( col == IFTREE_COL_NAME )
+ if (col == IFTREE_COL_NAME)
{
return QString(device->name);
}
- else if ( col == IFTREE_COL_DESCRIPTION )
+ else if (col == IFTREE_COL_DESCRIPTION)
{
return QString(device->friendly_name);
}
- else if ( col == IFTREE_COL_DISPLAY_NAME )
+ else if (col == IFTREE_COL_DISPLAY_NAME)
{
return QString(device->display_name);
}
- else if ( col == IFTREE_COL_PIPE_PATH )
+ else if (col == IFTREE_COL_PIPE_PATH)
{
return QString(device->if_info.name);
}
- else if ( col == IFTREE_COL_CAPTURE_FILTER )
+ else if (col == IFTREE_COL_CAPTURE_FILTER)
{
- if ( device->cfilter && strlen(device->cfilter) > 0 )
+ if (device->cfilter && strlen(device->cfilter) > 0)
return html_escape(QString(device->cfilter));
}
- else if ( col == IFTREE_COL_EXTCAP_PATH )
+ else if (col == IFTREE_COL_EXTCAP_PATH)
{
return QString(device->if_info.extcap);
}
- else if ( col == IFTREE_COL_SNAPLEN )
+ else if (col == IFTREE_COL_SNAPLEN)
{
return device->has_snaplen ? QString::number(device->snaplen) : DefaultNumericValue;
}
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
- else if ( col == IFTREE_COL_BUFFERLEN )
+ else if (col == IFTREE_COL_BUFFERLEN)
{
return QString::number(device->buffer);
}
#endif
- else if ( col == IFTREE_COL_TYPE )
+ else if (col == IFTREE_COL_TYPE)
{
return QVariant::fromValue((int)device->if_info.type);
}
- else if ( col == IFTREE_COL_COMMENT )
+ else if (col == IFTREE_COL_COMMENT)
{
QString comment = gchar_free_to_qstring(capture_dev_user_descr_find(device->name));
- if ( comment.length() > 0 )
+ if (comment.length() > 0)
return comment;
else
return QString(device->if_info.vendor_description);
}
- else if ( col == IFTREE_COL_DLT )
+ else if (col == IFTREE_COL_DLT)
{
// XXX - this is duplicated in
// InterfaceTreeWidgetItem::updateInterfaceColumns;
@@ -187,55 +187,55 @@ QVariant InterfaceTreeModel::data(const QModelIndex &index, int role) const
return QVariant();
}
}
- else if ( role == Qt::CheckStateRole )
+ else if (role == Qt::CheckStateRole)
{
- if ( col == IFTREE_COL_HIDDEN )
+ if (col == IFTREE_COL_HIDDEN)
{
/* Hidden is a de-selection, therefore inverted logic here */
return device->hidden ? Qt::Unchecked : Qt::Checked;
}
- else if ( col == IFTREE_COL_PROMISCUOUSMODE )
+ else if (col == IFTREE_COL_PROMISCUOUSMODE)
{
return device->pmode ? Qt::Checked : Qt::Unchecked;
}
#ifdef HAVE_PCAP_CREATE
- else if ( col == IFTREE_COL_MONITOR_MODE )
+ else if (col == IFTREE_COL_MONITOR_MODE)
{
return device->monitor_mode_enabled ? Qt::Checked : Qt::Unchecked;
}
#endif
}
/* Used by SparkLineDelegate for loading the data for the statistics line */
- else if ( role == Qt::UserRole )
+ else if (role == Qt::UserRole)
{
- if ( col == IFTREE_COL_STATS )
+ if (col == IFTREE_COL_STATS)
{
- if ( points.contains(device->name) )
+ if (points.contains(device->name))
return QVariant::fromValue(points[device->name]);
}
- else if ( col == IFTREE_COL_HIDDEN )
+ else if (col == IFTREE_COL_HIDDEN)
{
return QVariant::fromValue((bool)device->hidden);
}
}
/* Displays the configuration icon for extcap interfaces */
- else if ( role == Qt::DecorationRole )
+ else if (role == Qt::DecorationRole)
{
- if ( col == IFTREE_COL_EXTCAP )
+ if (col == IFTREE_COL_EXTCAP)
{
- if ( device->if_info.type == IF_EXTCAP )
+ if (device->if_info.type == IF_EXTCAP)
return QIcon(StockIcon("x-capture-options"));
}
}
- else if ( role == Qt::TextAlignmentRole )
+ else if (role == Qt::TextAlignmentRole)
{
- if ( col == IFTREE_COL_EXTCAP )
+ if (col == IFTREE_COL_EXTCAP)
{
return Qt::AlignRight;
}
}
/* Displays the tooltip for each row */
- else if ( role == Qt::ToolTipRole )
+ else if (role == Qt::ToolTipRole)
{
return toolTipForInterface(row);
}
@@ -250,59 +250,59 @@ QVariant InterfaceTreeModel::data(const QModelIndex &index, int role) const
QVariant InterfaceTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
{
- if ( orientation == Qt::Horizontal )
+ if (orientation == Qt::Horizontal)
{
- if ( role == Qt::DisplayRole )
+ if (role == Qt::DisplayRole)
{
- if ( section == IFTREE_COL_HIDDEN )
+ if (section == IFTREE_COL_HIDDEN)
{
return tr("Show");
}
- else if ( section == IFTREE_COL_NAME )
+ else if (section == IFTREE_COL_NAME)
{
return tr("Interface Name");
}
- else if ( section == IFTREE_COL_DESCRIPTION )
+ else if (section == IFTREE_COL_DESCRIPTION)
{
return tr("Friendly Name");
}
- else if ( section == IFTREE_COL_DISPLAY_NAME )
+ else if (section == IFTREE_COL_DISPLAY_NAME)
{
return tr("Friendly Name");
}
- else if ( section == IFTREE_COL_PIPE_PATH )
+ else if (section == IFTREE_COL_PIPE_PATH)
{
return tr("Local Pipe Path");
}
- else if ( section == IFTREE_COL_COMMENT )
+ else if (section == IFTREE_COL_COMMENT)
{
return tr("Comment");
}
- else if ( section == IFTREE_COL_DLT )
+ else if (section == IFTREE_COL_DLT)
{
return tr("Link-Layer Header");
}
- else if ( section == IFTREE_COL_PROMISCUOUSMODE )
+ else if (section == IFTREE_COL_PROMISCUOUSMODE)
{
return tr("Promiscuous");
}
- else if ( section == IFTREE_COL_SNAPLEN )
+ else if (section == IFTREE_COL_SNAPLEN)
{
return tr("Snaplen (B)");
}
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
- else if ( section == IFTREE_COL_BUFFERLEN )
+ else if (section == IFTREE_COL_BUFFERLEN)
{
return tr("Buffer (MB)");
}
#endif
#ifdef HAVE_PCAP_CREATE
- else if ( section == IFTREE_COL_MONITOR_MODE )
+ else if (section == IFTREE_COL_MONITOR_MODE)
{
return tr("Monitor Mode");
}
#endif
- else if ( section == IFTREE_COL_CAPTURE_FILTER )
+ else if (section == IFTREE_COL_CAPTURE_FILTER)
{
return tr("Capture Filter");
}
@@ -321,7 +321,7 @@ QVariant InterfaceTreeModel::getColumnContent(int idx, int col, int role)
bool InterfaceTreeModel::isRemote(int idx)
{
interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, idx);
- if ( device->remote_opts.src_type == CAPTURE_IFREMOTE )
+ if (device->remote_opts.src_type == CAPTURE_IFREMOTE)
return true;
return false;
}
@@ -347,20 +347,20 @@ void InterfaceTreeModel::interfaceListChanged()
QVariant InterfaceTreeModel::toolTipForInterface(int idx) const
{
#ifdef HAVE_LIBPCAP
- if ( ! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (guint) idx)
+ if (! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (guint) idx)
return QVariant();
interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, idx);
QString tt_str = "<p>";
- if ( device->no_addresses > 0 )
+ if (device->no_addresses > 0)
{
tt_str += QString("%1: %2")
.arg(device->no_addresses > 1 ? tr("Addresses") : tr("Address"))
.arg(html_escape(device->addresses))
.replace('\n', ", ");
}
- else if ( device->if_info.type == IF_EXTCAP )
+ else if (device->if_info.type == IF_EXTCAP)
{
tt_str = QString(tr("Extcap interface: %1")).arg(get_basename(device->if_info.extcap));
}
@@ -371,7 +371,7 @@ QVariant InterfaceTreeModel::toolTipForInterface(int idx) const
tt_str += "<br/>";
QString cfilter = device->cfilter;
- if ( cfilter.isEmpty() )
+ if (cfilter.isEmpty())
{
tt_str += tr("No capture filter");
}
@@ -394,7 +394,7 @@ QVariant InterfaceTreeModel::toolTipForInterface(int idx) const
#ifdef HAVE_LIBPCAP
void InterfaceTreeModel::stopStatistic()
{
- if ( stat_cache_ )
+ if (stat_cache_)
{
capture_stat_stop(stat_cache_);
stat_cache_ = NULL;
@@ -405,15 +405,15 @@ void InterfaceTreeModel::stopStatistic()
void InterfaceTreeModel::updateStatistic(unsigned int idx)
{
#ifdef HAVE_LIBPCAP
- if ( ! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (guint) idx )
+ if (! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (guint) idx)
return;
interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, idx);
- if ( device->if_info.type == IF_PIPE )
+ if (device->if_info.type == IF_PIPE)
return;
- if ( !stat_cache_ )
+ if (!stat_cache_)
{
// Start gathering statistics using dumpcap
// We crash (on macOS at least) if we try to do this from ::showEvent.
@@ -423,9 +423,9 @@ void InterfaceTreeModel::updateStatistic(unsigned int idx)
struct pcap_stat stats;
unsigned diff = 0;
- if ( capture_stats(stat_cache_, device->name, &stats) )
+ if (capture_stats(stat_cache_, device->name, &stats))
{
- if ( (int)(stats.ps_recv - device->last_packets) >= 0 )
+ if ((int)(stats.ps_recv - device->last_packets) >= 0)
{
diff = stats.ps_recv - device->last_packets;
device->packet_diff = diff;
@@ -443,11 +443,11 @@ void InterfaceTreeModel::updateStatistic(unsigned int idx)
void InterfaceTreeModel::getPoints(int idx, PointList *pts)
{
#ifdef HAVE_LIBPCAP
- if ( ! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (guint) idx )
+ if (! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (guint) idx)
return;
interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, idx);
- if ( points.contains(device->name) )
+ if (points.contains(device->name))
pts->append(points[device->name]);
#else
Q_UNUSED(idx)
@@ -459,15 +459,15 @@ QItemSelection InterfaceTreeModel::selectedDevices()
{
QItemSelection mySelection;
#ifdef HAVE_LIBPCAP
- for( int idx = 0; idx < rowCount(); idx++ )
+ for (int idx = 0; idx < rowCount(); idx++)
{
interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, idx);
- if ( device->selected )
+ if (device->selected)
{
QModelIndex selectIndex = index(idx, 0);
mySelection.merge(
- QItemSelection( selectIndex, index(selectIndex.row(), columnCount() - 1) ),
+ QItemSelection(selectIndex, index(selectIndex.row(), columnCount() - 1)),
QItemSelectionModel::SelectCurrent
);
}
@@ -483,15 +483,15 @@ bool InterfaceTreeModel::updateSelectedDevices(QItemSelection sourceSelection)
QList<int> selectedIndices;
QItemSelection::const_iterator it = sourceSelection.constBegin();
- while(it != sourceSelection.constEnd())
+ while (it != sourceSelection.constEnd())
{
QModelIndexList indeces = ((QItemSelectionRange) (*it)).indexes();
QModelIndexList::const_iterator cit = indeces.constBegin();
- while(cit != indeces.constEnd())
+ while (cit != indeces.constEnd())
{
QModelIndex index = (QModelIndex) (*cit);
- if ( ! selectedIndices.contains(index.row()) )
+ if (! selectedIndices.contains(index.row()))
{
selectedIndices.append(index.row());
}
@@ -502,17 +502,17 @@ bool InterfaceTreeModel::updateSelectedDevices(QItemSelection sourceSelection)
global_capture_opts.num_selected = 0;
- for ( unsigned int idx = 0; idx < global_capture_opts.all_ifaces->len; idx++ )
+ for (unsigned int idx = 0; idx < global_capture_opts.all_ifaces->len; idx++)
{
interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, idx);
- if ( selectedIndices.contains(idx) )
+ if (selectedIndices.contains(idx))
{
- if (! device->selected )
+ if (! device->selected)
selectionHasChanged = true;
device->selected = TRUE;
global_capture_opts.num_selected++;
} else {
- if ( device->selected )
+ if (device->selected)
selectionHasChanged = true;
device->selected = FALSE;
}
diff --git a/ui/qt/models/numeric_value_chooser_delegate.cpp b/ui/qt/models/numeric_value_chooser_delegate.cpp
index 06008aee88..975239ea74 100644
--- a/ui/qt/models/numeric_value_chooser_delegate.cpp
+++ b/ui/qt/models/numeric_value_chooser_delegate.cpp
@@ -62,11 +62,11 @@ QWidget* NumericValueChooserDelegate::createEditor(QWidget *parent, const QStyle
void NumericValueChooserDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
- if ( index.isValid() )
+ if (index.isValid())
{
bool canConvert = false;
int val = index.data().toInt(&canConvert);
- if ( ! canConvert )
+ if (! canConvert)
val = _default;
QSpinBox * spinBox = qobject_cast<QSpinBox *>(editor);
@@ -78,7 +78,7 @@ void NumericValueChooserDelegate::setEditorData(QWidget *editor, const QModelInd
void NumericValueChooserDelegate::setModelData(QWidget *editor, QAbstractItemModel * model, const QModelIndex &index) const
{
- if ( index.isValid() ) {
+ if (index.isValid()) {
QSpinBox * spinBox = qobject_cast<QSpinBox *>(editor);
model->setData(index, _default == spinBox->value() ? _defReturn : QVariant::fromValue(spinBox->value()));
} else {
diff --git a/ui/qt/models/packet_list_model.cpp b/ui/qt/models/packet_list_model.cpp
index 7eff718d59..e0d49f4158 100644
--- a/ui/qt/models/packet_list_model.cpp
+++ b/ui/qt/models/packet_list_model.cpp
@@ -61,7 +61,7 @@ packet_list_append(column_info *, frame_data *fdata)
void
packet_list_recreate_visible_rows(void)
{
- if ( glbl_plist_model )
+ if (glbl_plist_model)
glbl_plist_model->recreateVisibleRows();
}
@@ -101,7 +101,7 @@ PacketListModel::PacketListModel(QObject *parent, capture_file *cf) :
}
QWidget * wtWidget = mw->findChild<WirelessTimeline *>();
- if ( wtWidget && qobject_cast<WirelessTimeline *>(wtWidget) )
+ if (wtWidget && qobject_cast<WirelessTimeline *>(wtWidget))
{
WirelessTimeline * wt = qobject_cast<WirelessTimeline *>(wtWidget);
connect(this, SIGNAL(bgColorizationProgress(int, int)),
diff --git a/ui/qt/models/path_chooser_delegate.cpp b/ui/qt/models/path_chooser_delegate.cpp
index 06527bbfab..968df2b0ff 100644
--- a/ui/qt/models/path_chooser_delegate.cpp
+++ b/ui/qt/models/path_chooser_delegate.cpp
@@ -68,7 +68,7 @@ void PathChooserDelegate::browseButtonClicked()
{
char *open_dir = NULL;
- switch ( prefs.gui_fileopen_style )
+ switch (prefs.gui_fileopen_style)
{
case FO_STYLE_LAST_OPENED:
@@ -76,18 +76,18 @@ void PathChooserDelegate::browseButtonClicked()
break;
case FO_STYLE_SPECIFIED:
- if ( prefs.gui_fileopen_dir[0] != '\0' )
+ if (prefs.gui_fileopen_dir[0] != '\0')
open_dir = prefs.gui_fileopen_dir;
break;
}
QWidget * qw = new QWidget();
QString file_name = WiresharkFileDialog::getOpenFileName(qw, tr("Open Pipe"), open_dir);
- if ( !file_name.isEmpty() )
+ if (!file_name.isEmpty())
{
QWidget * parent = ((QPushButton *)sender())->parentWidget();
QLineEdit * lineEdit = parent->findChild<QLineEdit*>();
- if ( lineEdit )
+ if (lineEdit)
{
lineEdit->setText(file_name);
emit commitData(parent);
@@ -98,11 +98,11 @@ void PathChooserDelegate::browseButtonClicked()
void PathChooserDelegate::setEditorData(QWidget *editor, const QModelIndex &idx) const
{
- if ( idx.isValid() )
+ if (idx.isValid())
{
QString content = idx.data().toString();
QLineEdit * lineEdit = editor->findChild<QLineEdit*>();
- if ( lineEdit )
+ if (lineEdit)
{
lineEdit->setText(content);
}
@@ -113,10 +113,10 @@ void PathChooserDelegate::setEditorData(QWidget *editor, const QModelIndex &idx)
void PathChooserDelegate::setModelData(QWidget *editor, QAbstractItemModel * model, const QModelIndex &idx) const
{
- if ( idx.isValid() )
+ if (idx.isValid())
{
QLineEdit * lineEdit = editor->findChild<QLineEdit*>();
- if ( lineEdit )
+ if (lineEdit)
{
model->setData(idx, lineEdit->text());
}
diff --git a/ui/qt/models/pref_delegate.cpp b/ui/qt/models/pref_delegate.cpp
index 2d0669564e..8156f6992d 100644
--- a/ui/qt/models/pref_delegate.cpp
+++ b/ui/qt/models/pref_delegate.cpp
@@ -42,7 +42,7 @@ QWidget *AdvancedPrefDelegate::createEditor(QWidget *parent, const QStyleOptionV
case AdvancedPrefsModel::colValue:
pref = indexToPref(index);
WiresharkPreference * wspref = PreferenceManager::instance()->getPreference(pref);
- if ( wspref )
+ if (wspref)
return wspref->editor(parent, option, index);
break;
}
@@ -55,7 +55,7 @@ void AdvancedPrefDelegate::setEditorData(QWidget *editor, const QModelIndex &ind
PrefsItem* pref = indexToPref(index);
WiresharkPreference * wspref = PreferenceManager::instance()->getPreference(pref);
- if ( wspref )
+ if (wspref)
{
wspref->setData(editor, index);
return;
@@ -70,7 +70,7 @@ void AdvancedPrefDelegate::setModelData(QWidget *editor, QAbstractItemModel *mod
PrefsItem* pref = indexToPref(index);
WiresharkPreference * wspref = PreferenceManager::instance()->getPreference(pref);
- if ( wspref )
+ if (wspref)
{
wspref->setModelData(editor, model, index);
return;
diff --git a/ui/qt/models/pref_models.cpp b/ui/qt/models/pref_models.cpp
index a2f07a7cbf..a817c31556 100644
--- a/ui/qt/models/pref_models.cpp
+++ b/ui/qt/models/pref_models.cpp
@@ -29,14 +29,14 @@ pref_t *prefFromPrefPtr(void *pref_ptr)
static void prefInsertPrefPtr(void * pref_ptr, pref_t * pref)
{
- if ( ! pref_ptr_to_pref_ )
+ if (! pref_ptr_to_pref_)
pref_ptr_to_pref_ = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
gpointer key = (gpointer) pref_ptr;
gpointer val = (gpointer) pref;
/* Already existing entries will be ignored */
- if ( (pref = (pref_t *)g_hash_table_lookup(pref_ptr_to_pref_, key) ) == NULL )
+ if ((pref = (pref_t *)g_hash_table_lookup(pref_ptr_to_pref_, key)) == NULL)
g_hash_table_insert(pref_ptr_to_pref_, key, val);
}
@@ -269,11 +269,11 @@ fill_prefs(module_t *module, gpointer root_ptr)
// .uat is a void * so it wins the "useful key value" prize.
if (prefs_get_uat_value(pref)) {
- prefInsertPrefPtr( prefs_get_uat_value(pref), pref);
+ prefInsertPrefPtr(prefs_get_uat_value(pref), pref);
}
}
- if(prefs_module_has_submodules(module))
+ if (prefs_module_has_submodules(module))
return prefs_modules_foreach_submodules(module, fill_prefs, module_item);
return 0;
diff --git a/ui/qt/models/profile_model.cpp b/ui/qt/models/profile_model.cpp
index af0b913878..337668c5ea 100644
--- a/ui/qt/models/profile_model.cpp
+++ b/ui/qt/models/profile_model.cpp
@@ -38,11 +38,11 @@ ProfileSortModel::ProfileSortModel(QObject * parent):
bool ProfileSortModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
{
QModelIndex left = source_left;
- if ( source_left.column() != ProfileModel::COL_NAME )
+ if (source_left.column() != ProfileModel::COL_NAME)
left = source_left.sibling(source_left.row(), ProfileModel::COL_NAME);
QModelIndex right = source_right;
- if ( source_right.column() != ProfileModel::COL_NAME )
+ if (source_right.column() != ProfileModel::COL_NAME)
right = source_right.sibling(source_right.row(), ProfileModel::COL_NAME);
bool igL = left.data(ProfileModel::DATA_IS_GLOBAL).toBool();
@@ -53,17 +53,17 @@ bool ProfileSortModel::lessThan(const QModelIndex &source_left, const QModelInde
if (right.data(ProfileModel::DATA_STATUS).toInt() == PROF_STAT_DEFAULT)
igR = true;
- if ( igL && ! igR )
+ if (igL && ! igR)
return true;
- else if ( ! igL && igR )
+ else if (! igL && igR)
return false;
- else if ( igL && igR )
+ else if (igL && igR)
{
if (left.data(ProfileModel::DATA_STATUS) == PROF_STAT_DEFAULT)
return true;
}
- if ( left.data().toString().compare(right.data().toString()) <= 0 )
+ if (left.data().toString().compare(right.data().toString()) <= 0)
return true;
return false;
@@ -96,19 +96,19 @@ bool ProfileSortModel::filterAcceptsRow(int source_row, const QModelIndex &) con
bool accept = true;
QModelIndex idx = sourceModel()->index(source_row, ProfileModel::COL_NAME);
- if ( ft_ != ProfileSortModel::AllProfiles )
+ if (ft_ != ProfileSortModel::AllProfiles)
{
bool gl = idx.data(ProfileModel::DATA_IS_GLOBAL).toBool();
- if ( ft_ == ProfileSortModel::PersonalProfiles && gl )
+ if (ft_ == ProfileSortModel::PersonalProfiles && gl)
accept = false;
- else if ( ft_ == ProfileSortModel::GlobalProfiles && ! gl )
+ else if (ft_ == ProfileSortModel::GlobalProfiles && ! gl)
accept = false;
}
- if ( ftext_.length() > 0 )
+ if (ftext_.length() > 0)
{
QString name = idx.data().toString();
- if ( ! name.contains(ftext_, Qt::CaseInsensitive) )
+ if (! name.contains(ftext_, Qt::CaseInsensitive))
accept = false;
}
@@ -145,7 +145,7 @@ void ProfileModel::loadProfiles()
bool refresh = profiles_.count() > 0;
- if ( refresh )
+ if (refresh)
profiles_.clear();
else
init_profile_list();
@@ -166,10 +166,10 @@ GList * ProfileModel::entry(profile_def *ref) const
while (fl_entry && fl_entry->data)
{
profile_def *profile = reinterpret_cast<profile_def *>(fl_entry->data);
- if ( QString(ref->name).compare(profile->name) == 0 &&
+ if (QString(ref->name).compare(profile->name) == 0 &&
QString(ref->reference).compare(profile->reference) == 0 &&
ref->is_global == profile->is_global &&
- ref->status == profile->status )
+ ref->status == profile->status)
{
return fl_entry;
}
@@ -182,7 +182,7 @@ GList * ProfileModel::entry(profile_def *ref) const
GList *ProfileModel::at(int row) const
{
- if ( row < 0 || row >= profiles_.count() )
+ if (row < 0 || row >= profiles_.count())
return Q_NULLPTR;
profile_def * prof = profiles_.at(row);
@@ -191,17 +191,17 @@ GList *ProfileModel::at(int row) const
bool ProfileModel::changesPending() const
{
- if ( reset_default_ )
+ if (reset_default_)
return true;
- if ( g_list_length(edited_profile_list()) != g_list_length(current_profile_list()) )
+ if (g_list_length(edited_profile_list()) != g_list_length(current_profile_list()))
return true;
bool pending = false;
GList *fl_entry = edited_profile_list();
while (fl_entry && fl_entry->data && ! pending) {
profile_def *profile = reinterpret_cast<profile_def *>(fl_entry->data);
- pending = ( profile->status == PROF_STAT_NEW || profile->status == PROF_STAT_CHANGED || profile->status == PROF_STAT_COPY );
+ pending = (profile->status == PROF_STAT_NEW || profile->status == PROF_STAT_CHANGED || profile->status == PROF_STAT_COPY);
fl_entry = gxx_list_next(fl_entry);
}
@@ -216,10 +216,10 @@ bool ProfileModel::importPending() const
bool ProfileModel::userProfilesExist() const
{
bool user_exists = false;
- for ( int cnt = 0; cnt < rowCount() && ! user_exists; cnt++ )
+ for (int cnt = 0; cnt < rowCount() && ! user_exists; cnt++)
{
QModelIndex idx = index(cnt, ProfileModel::COL_NAME);
- if ( ! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool() )
+ if (! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool())
user_exists = true;
}
@@ -238,7 +238,7 @@ int ProfileModel::columnCount(const QModelIndex &) const
profile_def * ProfileModel::guard(const QModelIndex &index) const
{
- if ( ! index.isValid() )
+ if (! index.isValid())
return Q_NULLPTR;
return guard(index.row());
@@ -246,10 +246,10 @@ profile_def * ProfileModel::guard(const QModelIndex &index) const
profile_def * ProfileModel::guard(int row) const
{
- if ( row < 0 || profiles_.count() <= row )
+ if (row < 0 || profiles_.count() <= row)
return Q_NULLPTR;
- if ( ! edited_profile_list() )
+ if (! edited_profile_list())
{
static_cast<QList<profile_def *>>(profiles_).clear();
return Q_NULLPTR;
@@ -261,7 +261,7 @@ profile_def * ProfileModel::guard(int row) const
QVariant ProfileModel::dataDisplay(const QModelIndex &index) const
{
profile_def * prof = guard(index);
- if ( ! prof )
+ if (! prof)
return QVariant();
switch (index.column())
@@ -269,9 +269,9 @@ QVariant ProfileModel::dataDisplay(const QModelIndex &index) const
case COL_NAME:
return QString(prof->name);
case COL_TYPE:
- if ( prof->status == PROF_STAT_DEFAULT )
+ if (prof->status == PROF_STAT_DEFAULT)
return tr("Default");
- else if ( prof->is_global )
+ else if (prof->is_global)
return tr("Global");
else
return tr("Personal");
@@ -284,26 +284,26 @@ QVariant ProfileModel::dataDisplay(const QModelIndex &index) const
QVariant ProfileModel::dataFontRole(const QModelIndex &index) const
{
- if ( ! index.isValid() || profiles_.count() <= index.row() )
+ if (! index.isValid() || profiles_.count() <= index.row())
return QVariant();
profile_def * prof = guard(index.row());
- if ( ! prof )
+ if (! prof)
return QVariant();
QFont font;
- if ( prof->is_global )
+ if (prof->is_global)
font.setItalic(true);
- if ( ! prof->is_global && ! checkDuplicate(index) )
+ if (! prof->is_global && ! checkDuplicate(index))
{
- if ( ( set_profile_.compare(prof->name) == 0 && prof->status == PROF_STAT_EXISTS ) ||
- ( set_profile_.compare(prof->reference) == 0 && prof->status == PROF_STAT_CHANGED ) )
+ if ((set_profile_.compare(prof->name) == 0 && prof->status == PROF_STAT_EXISTS) ||
+ (set_profile_.compare(prof->reference) == 0 && prof->status == PROF_STAT_CHANGED) )
font.setBold(true);
}
- if ( prof->status == PROF_STAT_DEFAULT && reset_default_ )
+ if (prof->status == PROF_STAT_DEFAULT && reset_default_)
font.setStrikeOut(true);
return font;
@@ -318,7 +318,7 @@ bool ProfileModel::checkIfDeleted(int row) const
bool ProfileModel::checkIfDeleted(const QModelIndex &index) const
{
profile_def * prof = guard(index);
- if ( ! prof )
+ if (! prof)
return false;
QStringList deletedNames;
@@ -326,22 +326,22 @@ bool ProfileModel::checkIfDeleted(const QModelIndex &index) const
GList * current = current_profile_list();
/* search the current list as long as we have not found anything */
- while ( current )
+ while (current)
{
bool found = false;
GList * edited = edited_profile_list();
profile_def * profcurr = static_cast<profile_def *>(current->data);
- if ( ! profcurr->is_global && profcurr->status != PROF_STAT_DEFAULT )
+ if (! profcurr->is_global && profcurr->status != PROF_STAT_DEFAULT)
{
- while ( edited && ! found )
+ while (edited && ! found)
{
profile_def * profed = static_cast<profile_def *>(edited->data);
- if ( ! profed->is_global && profed->status != PROF_STAT_DEFAULT )
+ if (! profed->is_global && profed->status != PROF_STAT_DEFAULT)
{
- if ( g_strcmp0(profcurr->name, profed->name) == 0 || g_strcmp0(profcurr->name, profed->reference) == 0 )
+ if (g_strcmp0(profcurr->name, profed->name) == 0 || g_strcmp0(profcurr->name, profed->reference) == 0)
{
- if ( profed->status == profcurr->status && prof->status != PROF_STAT_NEW && prof->status != PROF_STAT_COPY )
+ if (profed->status == profcurr->status && prof->status != PROF_STAT_NEW && prof->status != PROF_STAT_COPY)
found = true;
}
}
@@ -350,14 +350,14 @@ bool ProfileModel::checkIfDeleted(const QModelIndex &index) const
}
/* profile has been deleted, check if it has the name we ask for */
- if ( ! found )
+ if (! found)
deletedNames << profcurr->name;
}
current = gxx_list_next(current);
}
- if ( deletedNames.contains(prof->name) )
+ if (deletedNames.contains(prof->name))
return true;
return false;
@@ -366,15 +366,15 @@ bool ProfileModel::checkIfDeleted(const QModelIndex &index) const
bool ProfileModel::checkInvalid(const QModelIndex &index) const
{
profile_def * prof = guard(index);
- if ( ! prof )
+ if (! prof)
return false;
int ref = this->findAsReference(prof->name);
- if ( ref == index.row() )
+ if (ref == index.row())
return false;
profile_def * pg = guard(ref);
- if ( pg && pg->status == PROF_STAT_CHANGED && g_strcmp0(pg->name, pg->reference) != 0 )
+ if (pg && pg->status == PROF_STAT_CHANGED && g_strcmp0(pg->name, pg->reference) != 0)
return true;
return false;
@@ -383,51 +383,51 @@ bool ProfileModel::checkInvalid(const QModelIndex &index) const
bool ProfileModel::checkDuplicate(const QModelIndex &index, bool isOriginalToDuplicate) const
{
profile_def * prof = guard(index);
- if ( ! prof || ( ! isOriginalToDuplicate && prof->status == PROF_STAT_EXISTS ) )
+ if (! prof || (! isOriginalToDuplicate && prof->status == PROF_STAT_EXISTS) )
return false;
QList<int> rows = this->findAllByNameAndVisibility(prof->name, prof->is_global, false);
int found = 0;
profile_def * check = Q_NULLPTR;
- for(int cnt = 0; cnt < rows.count(); cnt++)
+ for (int cnt = 0; cnt < rows.count(); cnt++)
{
int row = rows.at(cnt);
- if ( row == index.row() )
+ if (row == index.row())
continue;
check = guard(row);
- if ( ! check || ( isOriginalToDuplicate && check->status == PROF_STAT_EXISTS ) )
+ if (! check || (isOriginalToDuplicate && check->status == PROF_STAT_EXISTS) )
continue;
found++;
}
- if ( found > 0 )
+ if (found > 0)
return true;
return false;
}
QVariant ProfileModel::dataBackgroundRole(const QModelIndex &index) const
{
- if ( ! index.isValid() || profiles_.count() <= index.row() )
+ if (! index.isValid() || profiles_.count() <= index.row())
return QVariant();
profile_def * prof = guard(index.row());
- if ( ! prof )
+ if (! prof)
return QVariant();
- if ( prof->status == PROF_STAT_DEFAULT && reset_default_ )
+ if (prof->status == PROF_STAT_DEFAULT && reset_default_)
return ColorUtils::fromColorT(&prefs.gui_text_deprecated);
- if ( prof->status != PROF_STAT_DEFAULT && ! prof->is_global )
+ if (prof->status != PROF_STAT_DEFAULT && ! prof->is_global)
{
/* Highlights errorneous line */
- if ( checkInvalid(index) || checkIfDeleted(index) || checkDuplicate(index) || ! checkNameValidity(prof->name) )
+ if (checkInvalid(index) || checkIfDeleted(index) || checkDuplicate(index) || ! checkNameValidity(prof->name))
return ColorUtils::fromColorT(&prefs.gui_text_invalid);
/* Highlights line, which has been duplicated by another index */
- if ( checkDuplicate(index, true) )
+ if (checkDuplicate(index, true))
return ColorUtils::fromColorT(&prefs.gui_text_valid);
}
@@ -436,11 +436,11 @@ QVariant ProfileModel::dataBackgroundRole(const QModelIndex &index) const
QVariant ProfileModel::dataToolTipRole(const QModelIndex &idx) const
{
- if ( ! idx.isValid() || profiles_.count() <= idx.row() )
+ if (! idx.isValid() || profiles_.count() <= idx.row())
return QVariant();
profile_def * prof = guard(idx.row());
- if ( ! prof )
+ if (! prof)
return QVariant();
if (prof->is_global)
@@ -451,21 +451,21 @@ QVariant ProfileModel::dataToolTipRole(const QModelIndex &idx) const
QVariant ProfileModel::dataPath(const QModelIndex &index) const
{
- if ( ! index.isValid() || profiles_.count() <= index.row() )
+ if (! index.isValid() || profiles_.count() <= index.row())
return QVariant();
profile_def * prof = guard(index.row());
- if ( ! prof )
+ if (! prof)
return QVariant();
- if ( checkInvalid(index) )
+ if (checkInvalid(index))
{
int ref = this->findAsReference(prof->name);
- if ( ref != index.row() && ref >= 0 )
+ if (ref != index.row() && ref >= 0)
{
profile_def * prof = guard(ref);
QString msg = tr("A profile change for this name is pending");
- if ( prof )
+ if (prof)
msg.append(tr(" (See: %1)").arg(prof->name));
return msg;
}
@@ -473,15 +473,15 @@ QVariant ProfileModel::dataPath(const QModelIndex &index) const
return tr("This is an invalid profile definition");
}
- if ( ( prof->status == PROF_STAT_NEW || prof->status == PROF_STAT_CHANGED || prof->status == PROF_STAT_COPY ) && checkDuplicate(index) )
+ if ((prof->status == PROF_STAT_NEW || prof->status == PROF_STAT_CHANGED || prof->status == PROF_STAT_COPY) && checkDuplicate(index))
return tr("A profile already exists with this name");
- if ( checkIfDeleted(index) )
+ if (checkIfDeleted(index))
{
return tr("A profile with this name is being deleted");
}
- if ( prof->is_import )
+ if (prof->is_import)
return tr("Imported profile");
switch (prof->status)
@@ -506,7 +506,7 @@ QVariant ProfileModel::dataPath(const QModelIndex &index) const
{
QString errMsg;
- if ( ! checkNameValidity(prof->name, &errMsg) )
+ if (! checkNameValidity(prof->name, &errMsg))
return errMsg;
else
return tr("Created from default settings");
@@ -514,7 +514,7 @@ QVariant ProfileModel::dataPath(const QModelIndex &index) const
case PROF_STAT_CHANGED:
{
QString msg;
- if ( ! ProfileModel::checkNameValidity(QString(prof->name), &msg) )
+ if (! ProfileModel::checkNameValidity(QString(prof->name), &msg))
return msg;
if (prof->reference)
@@ -533,10 +533,10 @@ QVariant ProfileModel::dataPath(const QModelIndex &index) const
QString appendix;
/* A global profile is neither deleted or removed, only system provided is allowed as appendix */
- if ( profile_exists(prof->reference, TRUE) && prof->from_global )
+ if (profile_exists(prof->reference, TRUE) && prof->from_global)
appendix = tr("system provided");
/* A default model as reference can neither be deleted or renamed, so skip if the reference was one */
- else if ( ! index.data(ProfileModel::DATA_IS_DEFAULT).toBool() )
+ else if (! index.data(ProfileModel::DATA_IS_DEFAULT).toBool())
{
/* find a non-global, non-default profile which could be referenced by this one. Those are the only
* ones which could be renamed or deleted */
@@ -544,22 +544,22 @@ QVariant ProfileModel::dataPath(const QModelIndex &index) const
profile_def * ref = guard(row);
/* The reference is itself a copy of the original, therefore it is not accepted */
- if ( ref && ( ref->status == PROF_STAT_COPY || ref->status == PROF_STAT_NEW ) && QString(ref->name).compare(prof->reference) != 0 )
+ if (ref && (ref->status == PROF_STAT_COPY || ref->status == PROF_STAT_NEW) && QString(ref->name).compare(prof->reference) != 0)
ref = Q_NULLPTR;
/* found no other profile, original one had to be deleted */
- if ( ! ref || row == index.row() || checkIfDeleted(row) )
+ if (! ref || row == index.row() || checkIfDeleted(row))
{
appendix = tr("deleted");
}
/* found another profile, so the reference had been renamed, it the status is changed */
- else if ( ref && ref->status == PROF_STAT_CHANGED )
+ else if (ref && ref->status == PROF_STAT_CHANGED)
{
appendix = tr("renamed to %1").arg(ref->name);
}
}
- if ( appendix.length() > 0 )
+ if (appendix.length() > 0)
msg.append(QString(" (%1)").arg(appendix));
}
@@ -573,10 +573,10 @@ QVariant ProfileModel::dataPath(const QModelIndex &index) const
QVariant ProfileModel::data(const QModelIndex &index, int role) const
{
profile_def * prof = guard(index);
- if ( ! prof )
+ if (! prof)
return QVariant();
- switch ( role )
+ switch (role)
{
case Qt::DisplayRole:
return dataDisplay(index);
@@ -596,12 +596,12 @@ QVariant ProfileModel::data(const QModelIndex &index, int role) const
{
QModelIndex selected = activeProfile();
profile_def * selprof = guard(selected);
- if ( selprof )
+ if (selprof)
{
- if ( selprof && selprof->is_global != prof->is_global )
+ if (selprof && selprof->is_global != prof->is_global)
return qVariantFromValue(false);
- if ( selprof && strcmp(selprof->name, prof->name) == 0 )
+ if (selprof && strcmp(selprof->name, prof->name) == 0)
return qVariantFromValue(true);
}
return qVariantFromValue(false);
@@ -609,13 +609,13 @@ QVariant ProfileModel::data(const QModelIndex &index, int role) const
case ProfileModel::DATA_PATH:
return dataPath(index);
case ProfileModel::DATA_INDEX_VALUE_IS_URL:
- if ( index.column() <= ProfileModel::COL_TYPE )
+ if (index.column() <= ProfileModel::COL_TYPE)
return qVariantFromValue(false);
return qVariantFromValue(true);
case ProfileModel::DATA_PATH_IS_NOT_DESCRIPTION:
- if ( prof->status == PROF_STAT_NEW || prof->status == PROF_STAT_COPY
- || ( prof->status == PROF_STAT_DEFAULT && reset_default_ )
- || prof->status == PROF_STAT_CHANGED || prof->is_import )
+ if (prof->status == PROF_STAT_NEW || prof->status == PROF_STAT_COPY
+ || (prof->status == PROF_STAT_DEFAULT && reset_default_)
+ || prof->status == PROF_STAT_CHANGED || prof->is_import)
return qVariantFromValue(false);
else
return qVariantFromValue(true);
@@ -629,7 +629,7 @@ QVariant ProfileModel::data(const QModelIndex &index, int role) const
QVariant ProfileModel::headerData(int section, Qt::Orientation orientation, int role) const
{
- if ( orientation == Qt::Horizontal && role == Qt::DisplayRole )
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
{
switch (section)
{
@@ -650,10 +650,10 @@ Qt::ItemFlags ProfileModel::flags(const QModelIndex &index) const
Qt::ItemFlags fl = QAbstractTableModel::flags(index);
profile_def * prof = guard(index);
- if ( ! prof )
+ if (! prof)
return fl;
- if ( index.column() == ProfileModel::COL_NAME && prof->status != PROF_STAT_DEFAULT && ! prof->is_global )
+ if (index.column() == ProfileModel::COL_NAME && prof->status != PROF_STAT_DEFAULT && ! prof->is_global)
fl |= Qt::ItemIsEditable;
return fl;
@@ -662,7 +662,7 @@ Qt::ItemFlags ProfileModel::flags(const QModelIndex &index) const
int ProfileModel::findByName(QString name)
{
int row = findByNameAndVisibility(name, false);
- if ( row < 0 )
+ if (row < 0)
row = findByNameAndVisibility(name, true);
return row;
@@ -671,13 +671,13 @@ int ProfileModel::findByName(QString name)
int ProfileModel::findAsReference(QString reference) const
{
int found = -1;
- if ( reference.length() <= 0 )
+ if (reference.length() <= 0)
return found;
- for ( int cnt = 0; cnt < profiles_.count() && found < 0; cnt++ )
+ for (int cnt = 0; cnt < profiles_.count() && found < 0; cnt++)
{
profile_def * prof = guard(cnt);
- if ( prof && reference.compare(prof->reference) == 0 )
+ if (prof && reference.compare(prof->reference) == 0)
found = cnt;
}
@@ -694,12 +694,12 @@ QList<int> ProfileModel::findAllByNameAndVisibility(QString name, bool isGlobal,
{
QList<int> result;
- for ( int cnt = 0; cnt < profiles_.count(); cnt++ )
+ for (int cnt = 0; cnt < profiles_.count(); cnt++)
{
profile_def * prof = guard(cnt);
- if ( prof && static_cast<bool>(prof->is_global) == isGlobal )
+ if (prof && static_cast<bool>(prof->is_global) == isGlobal)
{
- if ( name.compare(prof->name) == 0 || ( searchReference && name.compare(prof->reference) == 0 ) )
+ if (name.compare(prof->name) == 0 || (searchReference && name.compare(prof->reference) == 0) )
result << cnt;
}
}
@@ -712,7 +712,7 @@ QModelIndex ProfileModel::addNewProfile(QString name)
{
int cnt = 1;
QString newName = name;
- while(findByNameAndVisibility(newName) >= 0)
+ while (findByNameAndVisibility(newName) >= 0)
{
newName = QString("%1 %2").arg(name).arg(QString::number(cnt));
cnt++;
@@ -727,21 +727,21 @@ QModelIndex ProfileModel::addNewProfile(QString name)
QModelIndex ProfileModel::duplicateEntry(QModelIndex idx, int new_status)
{
profile_def * prof = guard(idx);
- if ( ! prof )
+ if (! prof)
return QModelIndex();
/* only new and copied stati can be set */
- if ( new_status != PROF_STAT_NEW && new_status != PROF_STAT_COPY )
+ if (new_status != PROF_STAT_NEW && new_status != PROF_STAT_COPY)
new_status = PROF_STAT_COPY;
/* this is a copy from a personal profile, check if the original has been a
* new profile or a preexisting one. In the case of a new profile, restart
* with the state PROF_STAT_NEW */
- if ( prof->status == PROF_STAT_COPY && ! prof->from_global )
+ if (prof->status == PROF_STAT_COPY && ! prof->from_global)
{
int row = findByNameAndVisibility(prof->reference, false);
profile_def * copyParent = guard(row);
- if ( copyParent && copyParent->status == PROF_STAT_NEW )
+ if (copyParent && copyParent->status == PROF_STAT_NEW)
return duplicateEntry(index(row, ProfileModel::COL_NAME), PROF_STAT_NEW);
}
@@ -752,23 +752,23 @@ QModelIndex ProfileModel::duplicateEntry(QModelIndex idx, int new_status)
* If copy is non global and status of copy is != changed, use original parent name
*/
QString parent = prof->name;
- if ( prof->status == PROF_STAT_CHANGED )
+ if (prof->status == PROF_STAT_CHANGED)
parent = prof->reference;
- else if ( ! prof->is_global && prof->status != PROF_STAT_NEW && prof->status != PROF_STAT_CHANGED )
+ else if (! prof->is_global && prof->status != PROF_STAT_NEW && prof->status != PROF_STAT_CHANGED)
parent = get_profile_parent (prof->name);
- if ( parent.length() == 0 )
+ if (parent.length() == 0)
return QModelIndex();
/* parent references the parent profile to be used, parentName is the base for the new name */
QString parentName = parent;
/* the user has changed the profile name, therefore this is also the name to be used */
- if ( prof->status != PROF_STAT_EXISTS )
+ if (prof->status != PROF_STAT_EXISTS)
parentName = prof->name;
/* check to ensure we do not end up with (copy) (copy) (copy) ... */
QRegExp rx("\\s+(\\(\\s*" + tr("copy", "noun") + "\\s*\\d*\\))");
- if ( rx.indexIn(parentName) >= 0 )
+ if (rx.indexIn(parentName) >= 0)
parentName.replace(rx, "");
QString new_name;
@@ -780,14 +780,14 @@ QModelIndex ProfileModel::duplicateEntry(QModelIndex idx, int new_status)
/* check if copy already exists and iterate, until an unused version is found */
int cnt = 1;
- while(findByNameAndVisibility(new_name) >= 0)
+ while (findByNameAndVisibility(new_name) >= 0)
{
new_name = QString("%1 (%2 %3)").arg(parentName).arg(tr("copy", "noun")).arg(QString::number(cnt));
cnt++;
}
/* if this would be a copy, but the original is already a new one, this is a copy as well */
- if ( new_status == PROF_STAT_COPY && prof->status == PROF_STAT_NEW )
+ if (new_status == PROF_STAT_COPY && prof->status == PROF_STAT_NEW)
new_status = PROF_STAT_NEW;
/* add element */
@@ -798,7 +798,7 @@ QModelIndex ProfileModel::duplicateEntry(QModelIndex idx, int new_status)
int row = findByNameAndVisibility(new_name, false);
/* sanity check, if adding the profile went correctly */
- if ( row < 0 || row == idx.row() )
+ if (row < 0 || row == idx.row())
return QModelIndex();
/* return the index of the profile */
@@ -807,7 +807,7 @@ QModelIndex ProfileModel::duplicateEntry(QModelIndex idx, int new_status)
void ProfileModel::deleteEntry(QModelIndex idx)
{
- if ( ! idx.isValid() )
+ if (! idx.isValid())
return;
QModelIndexList temp;
@@ -820,31 +820,31 @@ void ProfileModel::deleteEntries(QModelIndexList idcs)
bool changes = false;
QList<int> indeces;
- foreach ( QModelIndex idx, idcs )
+ foreach (QModelIndex idx, idcs)
{
- if ( ! indeces.contains(idx.row()) && ! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() )
+ if (! indeces.contains(idx.row()) && ! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool())
indeces << idx.row();
}
/* Security blanket. This ensures, that we start deleting from the end and do not get any issues iterating the list */
std::sort(indeces.begin(), indeces.end(), std::less<int>());
- foreach ( int row, indeces )
+ foreach (int row, indeces)
{
profile_def * prof = guard(row);
- if ( ! prof )
+ if (! prof)
continue;
- if ( prof->is_global )
+ if (prof->is_global)
continue;
- if ( prof->status == PROF_STAT_DEFAULT )
+ if (prof->status == PROF_STAT_DEFAULT)
{
reset_default_ = ! reset_default_;
}
else
{
GList * fl_entry = entry(prof);
- if ( fl_entry )
+ if (fl_entry)
{
changes = true;
remove_from_profile_list(fl_entry);
@@ -852,10 +852,10 @@ void ProfileModel::deleteEntries(QModelIndexList idcs)
}
}
- if ( changes )
+ if (changes)
loadProfiles();
- if ( reset_default_ )
+ if (reset_default_)
{
emit layoutAboutToBeChanged();
emit dataChanged(index(0, 0), index(rowCount(), columnCount()));
@@ -871,7 +871,7 @@ bool ProfileModel::resetDefault() const
void ProfileModel::doResetModel(bool reset_import)
{
reset_default_ = false;
- if ( reset_import )
+ if (reset_import)
profiles_imported_ = false;
loadProfiles();
@@ -880,14 +880,14 @@ void ProfileModel::doResetModel(bool reset_import)
QModelIndex ProfileModel::activeProfile() const
{
QList<int> rows = this->findAllByNameAndVisibility(set_profile_, false, true);
- foreach ( int row, rows )
+ foreach (int row, rows)
{
profile_def * prof = profiles_.at(row);
- if ( prof->is_global || checkDuplicate(index(row, ProfileModel::COL_NAME) ) )
+ if (prof->is_global || checkDuplicate(index(row, ProfileModel::COL_NAME)) )
return QModelIndex();
- if ( ( set_profile_.compare(prof->name) == 0 && ( prof->status == PROF_STAT_EXISTS || prof->status == PROF_STAT_DEFAULT ) ) ||
- ( set_profile_.compare(prof->reference) == 0 && prof->status == PROF_STAT_CHANGED ) )
+ if ((set_profile_.compare(prof->name) == 0 && (prof->status == PROF_STAT_EXISTS || prof->status == PROF_STAT_DEFAULT) ) ||
+ (set_profile_.compare(prof->reference) == 0 && prof->status == PROF_STAT_CHANGED) )
return index(row, ProfileModel::COL_NAME);
}
@@ -898,23 +898,23 @@ bool ProfileModel::setData(const QModelIndex &idx, const QVariant &value, int ro
{
last_set_row_ = -1;
- if ( role != Qt::EditRole || ! value.isValid() || value.toString().isEmpty() )
+ if (role != Qt::EditRole || ! value.isValid() || value.toString().isEmpty())
return false;
QString newValue = value.toString();
profile_def * prof = guard(idx);
- if ( ! prof || prof->status == PROF_STAT_DEFAULT )
+ if (! prof || prof->status == PROF_STAT_DEFAULT)
return false;
last_set_row_ = idx.row();
QString current(prof->name);
- if ( current.compare(newValue) != 0 )
+ if (current.compare(newValue) != 0)
{
g_free(prof->name);
prof->name = qstring_strdup(newValue);
- if (prof->reference && g_strcmp0(prof->name, prof->reference) == 0 && ! ( prof->status == PROF_STAT_NEW || prof->status == PROF_STAT_COPY )) {
+ if (prof->reference && g_strcmp0(prof->name, prof->reference) == 0 && ! (prof->status == PROF_STAT_NEW || prof->status == PROF_STAT_COPY)) {
prof->status = PROF_STAT_EXISTS;
} else if (prof->status == PROF_STAT_EXISTS) {
prof->status = PROF_STAT_CHANGED;
@@ -937,38 +937,38 @@ bool ProfileModel::copyTempToProfile(QString tempPath, QString profilePath, bool
bool was_empty = true;
QDir profileDir(profilePath);
- if ( ! profileDir.mkpath(profilePath) || ! QFile::exists(tempPath) )
+ if (! profileDir.mkpath(profilePath) || ! QFile::exists(tempPath))
return false;
QDir tempProfile(tempPath);
tempProfile.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
QFileInfoList files = tempProfile.entryInfoList();
- if ( files.count() <= 0 )
+ if (files.count() <= 0)
return false;
int created = 0;
- foreach ( QFileInfo finfo, files)
+ foreach (QFileInfo finfo, files)
{
QString tempFile = finfo.absoluteFilePath();
QString profileFile = profilePath + QDir::separator() + finfo.fileName();
- if ( ! profile_files_.contains(finfo.fileName()) )
+ if (! profile_files_.contains(finfo.fileName()))
{
was_empty = false;
continue;
}
- if ( ! QFile::exists(tempFile) || QFile::exists(profileFile) )
+ if (! QFile::exists(tempFile) || QFile::exists(profileFile))
continue;
- if ( QFile::copy(tempFile, profileFile) )
+ if (QFile::copy(tempFile, profileFile))
created++;
}
- if ( wasEmpty )
+ if (wasEmpty)
*wasEmpty = was_empty;
- if ( created > 0 )
+ if (created > 0)
return true;
return false;
@@ -979,11 +979,11 @@ QFileInfoList ProfileModel::uniquePaths(QFileInfoList lst)
QStringList files;
QFileInfoList newLst;
- foreach ( QFileInfo entry, lst )
+ foreach (QFileInfo entry, lst)
{
- if ( ! files.contains(entry.absoluteFilePath()) )
+ if (! files.contains(entry.absoluteFilePath()))
{
- if ( entry.exists() && entry.isDir() )
+ if (entry.exists() && entry.isDir())
{
newLst << entry.absoluteFilePath();
files << entry.absoluteFilePath();
@@ -1001,28 +1001,28 @@ QFileInfoList ProfileModel::filterProfilePath(QString path, QFileInfoList ent, b
temp.setSorting(QDir::Name);
temp.setFilter(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
QFileInfoList entries = temp.entryInfoList();
- if ( ! fromZip )
+ if (! fromZip)
entries << QFileInfo(path);
- foreach ( QFileInfo entry, entries )
+ foreach (QFileInfo entry, entries)
{
QDir fPath(entry.absoluteFilePath());
fPath.setSorting(QDir::Name);
fPath.setFilter(QDir::Files | QDir::NoSymLinks);
QFileInfoList fEntries = fPath.entryInfoList();
bool found = false;
- for ( int cnt = 0; cnt < fEntries.count() && ! found; cnt++)
+ for (int cnt = 0; cnt < fEntries.count() && ! found; cnt++)
{
- if ( config_file_exists_with_entries(fEntries[cnt].absoluteFilePath().toUtf8().constData(), '#') )
+ if (config_file_exists_with_entries(fEntries[cnt].absoluteFilePath().toUtf8().constData(), '#'))
found = true;
}
- if ( found )
+ if (found)
{
result.append(entry);
}
else
{
- if ( path.compare(entry.absoluteFilePath()) != 0 )
+ if (path.compare(entry.absoluteFilePath()) != 0)
result.append(filterProfilePath(entry.absoluteFilePath(), result, fromZip));
}
}
@@ -1038,10 +1038,10 @@ QStringList ProfileModel::exportFileList(QModelIndexList items)
foreach(QModelIndex idx, items)
{
profile_def * prof = guard(idx);
- if ( ! prof || prof->is_global || QString(prof->name).compare(DEFAULT_PROFILE) == 0 )
+ if (! prof || prof->is_global || QString(prof->name).compare(DEFAULT_PROFILE) == 0)
continue;
- if ( ! idx.data(ProfileModel::DATA_PATH_IS_NOT_DESCRIPTION).toBool() )
+ if (! idx.data(ProfileModel::DATA_PATH_IS_NOT_DESCRIPTION).toBool())
continue;
QString path = idx.data(ProfileModel::DATA_PATH).toString();
@@ -1049,7 +1049,7 @@ QStringList ProfileModel::exportFileList(QModelIndexList items)
temp.setSorting(QDir::Name);
temp.setFilter(QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot);
QFileInfoList entries = temp.entryInfoList();
- foreach ( QFileInfo fi, entries )
+ foreach (QFileInfo fi, entries)
result << fi.absoluteFilePath();
}
@@ -1058,9 +1058,9 @@ QStringList ProfileModel::exportFileList(QModelIndexList items)
bool ProfileModel::exportProfiles(QString filename, QModelIndexList items, QString *err)
{
- if ( changesPending() )
+ if (changesPending())
{
- if ( err )
+ if (err)
err->append(tr("Exporting profiles while changes are pending is not allowed"));
return false;
}
@@ -1069,14 +1069,14 @@ bool ProfileModel::exportProfiles(QString filename, QModelIndexList items, QStri
write_profile_recent();
QStringList files = exportFileList(items);
- if ( files.count() == 0 )
+ if (files.count() == 0)
{
- if ( err )
+ if (err)
err->append((tr("No profiles found to export")));
return false;
}
- if ( WireSharkZipHelper::zip(filename, files, gchar_free_to_qstring(get_profiles_dir()) + QDir::separator() ) )
+ if (WireSharkZipHelper::zip(filename, files, gchar_free_to_qstring(get_profiles_dir()) + QDir::separator()) )
return true;
return false;
@@ -1085,10 +1085,10 @@ bool ProfileModel::exportProfiles(QString filename, QModelIndexList items, QStri
/* This check runs BEFORE the file has been unzipped! */
bool ProfileModel::acceptFile(QString fileName, int fileSize)
{
- if ( fileName.toLower().endsWith(".zip") )
+ if (fileName.toLower().endsWith(".zip"))
return false;
- if ( fileSize > 1024 * 512 )
+ if (fileSize > 1024 * 512)
return false;
return true;
@@ -1097,7 +1097,7 @@ bool ProfileModel::acceptFile(QString fileName, int fileSize)
QString ProfileModel::cleanName(QString fileName)
{
QStringList parts = fileName.split(QDir::separator());
- QString temp = parts[parts.count() - 1].replace( QRegExp( "[" + QRegExp::escape( illegalCharacters() ) + "]" ), QString( "_" ) );
+ QString temp = parts[parts.count() - 1].replace(QRegExp("[" + QRegExp::escape(illegalCharacters()) + "]"), QString("_") );
temp = parts.join(QDir::separator());
return temp;
}
@@ -1111,7 +1111,7 @@ int ProfileModel::importProfilesFromZip(QString filename, int * skippedCnt, QStr
#endif
int cnt = 0;
- if ( dir.isValid() )
+ if (dir.isValid())
{
WireSharkZipHelper::unzip(filename, dir.path(), &ProfileModel::acceptFile, &ProfileModel::cleanName);
cnt = importProfilesFromDir(dir.path(), skippedCnt, true, result);
@@ -1128,15 +1128,15 @@ int ProfileModel::importProfilesFromDir(QString dirname, int * skippedCnt, bool
QDir profileDir(gchar_free_to_qstring(get_profiles_dir()));
QDir dir(dirname);
- if ( skippedCnt )
+ if (skippedCnt)
*skippedCnt = 0;
- if ( dir.exists() )
+ if (dir.exists())
{
QFileInfoList entries = uniquePaths(filterProfilePath(dirname, QFileInfoList(), fromZip));
int entryCount = 0;
- foreach ( QFileInfo fentry, entries )
+ foreach (QFileInfo fentry, entries)
{
Q_ASSERT(fentry.fileName().length() > 0);
bool wasEmpty = true;
@@ -1147,22 +1147,22 @@ int ProfileModel::importProfilesFromDir(QString dirname, int * skippedCnt, bool
QString profilePath = profileDir.absolutePath() + QDir::separator() + fentry.fileName();
QString tempPath = fentry.absoluteFilePath();
- if ( fentry.fileName().compare(DEFAULT_PROFILE, Qt::CaseInsensitive) == 0 || QFile::exists(profilePath) )
+ if (fentry.fileName().compare(DEFAULT_PROFILE, Qt::CaseInsensitive) == 0 || QFile::exists(profilePath))
{
skipped++;
continue;
}
- if ( result )
+ if (result)
*result << fentry.fileName();
success = copyTempToProfile(tempPath, profilePath, &wasEmpty);
- if ( success )
+ if (success)
{
count++;
add_to_profile_list(fentry.fileName().toUtf8().constData(), fentry.fileName().toUtf8().constData(), PROF_STAT_NEW, FALSE, FALSE, TRUE);
}
- else if ( ! wasEmpty && QFile::exists(profilePath) )
+ else if (! wasEmpty && QFile::exists(profilePath))
{
QDir dh(profilePath);
dh.rmdir(profilePath);
@@ -1171,13 +1171,13 @@ int ProfileModel::importProfilesFromDir(QString dirname, int * skippedCnt, bool
}
- if ( count > 0 )
+ if (count > 0)
{
profiles_imported_ = true;
loadProfiles();
}
- if ( skippedCnt )
+ if (skippedCnt)
*skippedCnt = skipped;
return count;
@@ -1185,16 +1185,16 @@ int ProfileModel::importProfilesFromDir(QString dirname, int * skippedCnt, bool
void ProfileModel::markAsImported(QStringList importedItems)
{
- if ( importedItems.count() <= 0 )
+ if (importedItems.count() <= 0)
return;
profiles_imported_ = true;
- foreach ( QString item, importedItems )
+ foreach (QString item, importedItems)
{
int row = findByNameAndVisibility(item, false);
profile_def * prof = guard(row);
- if ( ! prof )
+ if (! prof)
continue;
prof->is_import = true;
@@ -1205,22 +1205,22 @@ bool ProfileModel::clearImported(QString *msg)
{
QList<int> rows;
bool result = true;
- for ( int cnt = 0; cnt < rowCount(); cnt++ )
+ for (int cnt = 0; cnt < rowCount(); cnt++)
{
profile_def * prof = guard(cnt);
- if ( prof && prof->is_import && ! rows.contains(cnt) )
+ if (prof && prof->is_import && ! rows.contains(cnt))
rows << cnt;
}
/* Security blanket. This ensures, that we start deleting from the end and do not get any issues iterating the list */
std::sort(rows.begin(), rows.end(), std::less<int>());
char * ret_path = Q_NULLPTR;
- for ( int cnt = 0; cnt < rows.count() && result; cnt++ )
+ for (int cnt = 0; cnt < rows.count() && result; cnt++)
{
int row = rows.at(cnt);
- if ( delete_persconffile_profile ( index(row, ProfileModel::COL_NAME).data().toString().toUtf8().constData(), &ret_path ) != 0 )
+ if (delete_persconffile_profile (index(row, ProfileModel::COL_NAME).data().toString().toUtf8().constData(), &ret_path) != 0)
{
- if ( msg )
+ if (msg)
{
QString errmsg = QString("%1\n\"%2\":\n%3").arg(tr("Can't delete profile directory")).arg(ret_path).arg(g_strerror(errno));
msg->append(errmsg);
@@ -1252,22 +1252,22 @@ bool ProfileModel::checkNameValidity(QString name, QString *msg)
QString invalid_dir_chars = illegalCharacters();
- for ( int cnt = 0; cnt < invalid_dir_chars.length() && ! invalid; cnt++ )
+ for (int cnt = 0; cnt < invalid_dir_chars.length() && ! invalid; cnt++)
{
msgChars += invalid_dir_chars[cnt] + " ";
- if ( name.contains(invalid_dir_chars[cnt]) )
+ if (name.contains(invalid_dir_chars[cnt]))
invalid = true;
}
#ifdef _WIN32
- if ( invalid )
+ if (invalid)
{
message = tr("A profile name cannot contain the following characters: %1").arg(msgChars);
}
- if ( message.isEmpty() && ( name.startsWith('.') || name.endsWith('.') ) )
+ if (message.isEmpty() && (name.startsWith('.') || name.endsWith('.')) )
message = tr("A profile cannot start or end with a period (.)");
#else
- if ( invalid )
+ if (invalid)
message = tr("A profile name cannot contain the '/' character");
#endif
diff --git a/ui/qt/models/proto_tree_model.cpp b/ui/qt/models/proto_tree_model.cpp
index f4179bb25e..df65ec4100 100644
--- a/ui/qt/models/proto_tree_model.cpp
+++ b/ui/qt/models/proto_tree_model.cpp
@@ -44,19 +44,19 @@ QModelIndex ProtoTreeModel::index(int row, int, const QModelIndex &parent) const
parent_node = protoNodeFromIndex(parent);
}
- if (! parent_node.isValid() )
+ if (! parent_node.isValid())
return QModelIndex();
int cur_row = 0;
ProtoNode::ChildIterator kids = parent_node.children();
- while ( kids.element().isValid() )
+ while (kids.element().isValid())
{
- if ( cur_row == row )
+ if (cur_row == row)
break;
cur_row++;
kids.next();
}
- if ( ! kids.element().isValid() ) {
+ if (! kids.element().isValid()) {
return QModelIndex();
}
@@ -112,20 +112,20 @@ QVariant ProtoTreeModel::data(const QModelIndex &index, int role) const
default:
g_warning("%s:%d Unhandled severity flag: %u", G_STRFUNC, __LINE__, finfo.flag(PI_SEVERITY_MASK));
}
- if(finfo.headerInfo().type == FT_PROTOCOL) {
+ if (finfo.headerInfo().type == FT_PROTOCOL) {
return QApplication::palette().window();
}
return QApplication::palette().base();
}
case Qt::ForegroundRole:
{
- if(finfo.flag(PI_SEVERITY_MASK)) {
+ if (finfo.flag(PI_SEVERITY_MASK)) {
return ColorUtils::expert_color_foreground;
}
if (finfo.isLink()) {
return ColorUtils::themeLinkBrush();
}
- if(finfo.headerInfo().type == FT_PROTOCOL) {
+ if (finfo.headerInfo().type == FT_PROTOCOL) {
return QApplication::palette().windowText();
}
return QApplication::palette().text();
diff --git a/ui/qt/models/related_packet_delegate.cpp b/ui/qt/models/related_packet_delegate.cpp
index 72784ea9be..d6d4d2c870 100644
--- a/ui/qt/models/related_packet_delegate.cpp
+++ b/ui/qt/models/related_packet_delegate.cpp
@@ -42,10 +42,10 @@ void RelatedPacketDelegate::paint(QPainter *painter, const QStyleOptionViewItem
{
/* This prevents the drawing of related objects, if multiple lines are being selected */
- if ( wsApp && wsApp->mainWindow() )
+ if (wsApp && wsApp->mainWindow())
{
MainWindow * mw = qobject_cast<MainWindow *>(wsApp->mainWindow());
- if ( mw && mw->selectedRows().count() > 1 )
+ if (mw && mw->selectedRows().count() > 1)
{
QStyledItemDelegate::paint(painter, option, index);
return;
@@ -220,10 +220,10 @@ QSize RelatedPacketDelegate::sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
/* This prevents the sizeHint for the delegate, if multiple lines are being selected */
- if ( wsApp && wsApp->mainWindow() )
+ if (wsApp && wsApp->mainWindow())
{
MainWindow * mw = qobject_cast<MainWindow *>(wsApp->mainWindow());
- if ( mw && mw->selectedRows().count() > 1 )
+ if (mw && mw->selectedRows().count() > 1)
return QStyledItemDelegate::sizeHint(option, index);
}
diff --git a/ui/qt/models/resolved_addresses_models.cpp b/ui/qt/models/resolved_addresses_models.cpp
index a802991118..377903a695 100644
--- a/ui/qt/models/resolved_addresses_models.cpp
+++ b/ui/qt/models/resolved_addresses_models.cpp
@@ -42,7 +42,7 @@ ipv4_hash_table_resolved_to_qstringlist(gpointer, gpointer value, gpointer sl_pt
QStringList *string_list = (QStringList *) sl_ptr;
hashipv4_t *ipv4_hash_table_entry = (hashipv4_t *) value;
- if((ipv4_hash_table_entry->flags & NAME_RESOLVED)) {
+ if ((ipv4_hash_table_entry->flags & NAME_RESOLVED)) {
QString entry = QString("%1\t%2")
.arg(ipv4_hash_table_entry->ip)
.arg(ipv4_hash_table_entry->name);
@@ -56,7 +56,7 @@ ipv6_hash_table_resolved_to_qstringlist(gpointer, gpointer value, gpointer sl_pt
QStringList *string_list = (QStringList *) sl_ptr;
hashipv6_t *ipv6_hash_table_entry = (hashipv6_t *) value;
- if((ipv6_hash_table_entry->flags & NAME_RESOLVED)) {
+ if ((ipv6_hash_table_entry->flags & NAME_RESOLVED)) {
QString entry = QString("%1\t%2")
.arg(ipv6_hash_table_entry->ip6)
.arg(ipv6_hash_table_entry->name);
@@ -231,7 +231,7 @@ void PortsModel::populate()
QStringList values;
wmem_map_t *serv_port_hashtable = get_serv_port_hashtable();
- if(serv_port_hashtable){
+ if (serv_port_hashtable) {
wmem_map_foreach(serv_port_hashtable, serv_port_hash_to_qstringlist, &values);
}
diff --git a/ui/qt/models/sparkline_delegate.cpp b/ui/qt/models/sparkline_delegate.cpp
index 1c86809d24..331674fd49 100644
--- a/ui/qt/models/sparkline_delegate.cpp
+++ b/ui/qt/models/sparkline_delegate.cpp
@@ -37,7 +37,7 @@ void SparkLineDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt
return;
}
- while((qreal) points.length() > steps) {
+ while ((qreal) points.length() > steps) {
points.removeFirst();
}
diff --git a/ui/qt/models/uat_delegate.cpp b/ui/qt/models/uat_delegate.cpp
index d992d9235d..debe7ba309 100644
--- a/ui/qt/models/uat_delegate.cpp
+++ b/ui/qt/models/uat_delegate.cpp
@@ -150,7 +150,7 @@ void UatDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
}
case PT_TXTMOD_COLOR:
{
- if ( qobject_cast<QColorDialog *>(editor) )
+ if (qobject_cast<QColorDialog *>(editor))
{
QColor color(index.model()->data(index, Qt::DecorationRole).toString());
qobject_cast<QColorDialog *>(editor)->setCurrentColor(color);
@@ -178,7 +178,7 @@ void UatDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
}
case PT_TXTMOD_COLOR:
//do nothing, dialog signals will update table
- if ( qobject_cast<QColorDialog *>(editor) )
+ if (qobject_cast<QColorDialog *>(editor))
{
QColor newColor = qobject_cast<QColorDialog *>(editor)->currentColor();
((QAbstractItemModel *)index.model())->setData(index, newColor.name(), Qt::EditRole);
diff --git a/ui/qt/models/uat_model.cpp b/ui/qt/models/uat_model.cpp
index 03760d4cfb..0743a3c3e0 100644
--- a/ui/qt/models/uat_model.cpp
+++ b/ui/qt/models/uat_model.cpp
@@ -190,10 +190,10 @@ QModelIndex UatModel::findRowForColumnContent(QVariant columnContent, int column
if (! columnContent.isValid())
return QModelIndex();
- for(int i = 0; i < rowCount(); i++)
+ for (int i = 0; i < rowCount(); i++)
{
QVariant r_expr = data(index(i, columnToCheckAgainst), role);
- if ( r_expr == columnContent )
+ if (r_expr == columnContent)
return index(i, columnToCheckAgainst);
}
diff --git a/ui/qt/packet_dialog.cpp b/ui/qt/packet_dialog.cpp
index 2b7697f73f..428fc5fb16 100644
--- a/ui/qt/packet_dialog.cpp
+++ b/ui/qt/packet_dialog.cpp
@@ -130,7 +130,7 @@ void PacketDialog::setHintText(FieldInformation * finfo)
{
QString hint;
- if ( finfo )
+ if (finfo)
{
FieldInformation::Position pos = finfo->position();
QString field_str;
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index 64c0266f7d..3b487272ed 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -118,12 +118,12 @@ packet_list_select_first_row(void)
gboolean
packet_list_select_row_from_data(frame_data *fdata_needle)
{
- if ( ! gbl_cur_packet_list || ! gbl_cur_packet_list->model())
+ if (! gbl_cur_packet_list || ! gbl_cur_packet_list->model())
return FALSE;
PacketListModel * model = qobject_cast<PacketListModel *>(gbl_cur_packet_list->model());
- if ( ! model )
+ if (! model)
return FALSE;
model->flushVisibleRows();
@@ -394,18 +394,18 @@ bool PacketList::multiSelectActive()
QList<int> PacketList::selectedRows(bool useFrameNum)
{
QList<int> rows;
- if ( selectionModel() && selectionModel()->selectedIndexes().count() > 0 )
+ if (selectionModel() && selectionModel()->selectedIndexes().count() > 0)
{
- foreach ( QModelIndex idx, selectionModel()->selectedIndexes() )
+ foreach (QModelIndex idx, selectionModel()->selectedIndexes())
{
- if ( idx.isValid() )
+ if (idx.isValid())
{
- if ( ! useFrameNum && ! rows.contains(idx.row()) )
+ if (! useFrameNum && ! rows.contains(idx.row()))
rows << idx.row();
- else if ( useFrameNum )
+ else if (useFrameNum)
{
frame_data * frame = getFDataForRow(idx.row());
- if ( frame && ! rows.contains(frame->num) )
+ if (frame && ! rows.contains(frame->num))
rows << frame->num;
}
}
@@ -413,14 +413,14 @@ QList<int> PacketList::selectedRows(bool useFrameNum)
std::sort(rows.begin(), rows.end(), std::less<int>());
}
- else if ( currentIndex().isValid() )
+ else if (currentIndex().isValid())
{
- if ( ! useFrameNum )
+ if (! useFrameNum)
rows << currentIndex().row();
else
{
frame_data *frame = getFDataForRow(currentIndex().row());
- if ( frame )
+ if (frame)
rows << frame->num;
}
}
@@ -437,14 +437,14 @@ void PacketList::selectionChanged (const QItemSelection & selected, const QItemS
int row = -1;
static bool multiSelect = false;
- if ( selectionModel() )
+ if (selectionModel())
{
- if ( selectionModel()->selectedRows(0).count() > 1 )
+ if (selectionModel()->selectedRows(0).count() > 1)
{
QList<int> rows;
- foreach ( QModelIndex idx, selectionModel()->selectedRows(0))
+ foreach (QModelIndex idx, selectionModel()->selectedRows(0))
{
- if ( idx.isValid() && ! rows.contains(idx.row()) )
+ if (idx.isValid() && ! rows.contains(idx.row()))
rows << idx.row();
}
@@ -454,7 +454,7 @@ void PacketList::selectionChanged (const QItemSelection & selected, const QItemS
cf_unselect_packet(cap_file_);
/* We have to repaint the content while changing state, as some delegates react to multi-select */
- if ( ! multiSelect )
+ if (! multiSelect)
{
related_packet_delegate_.clear();
viewport()->update();
@@ -464,14 +464,14 @@ void PacketList::selectionChanged (const QItemSelection & selected, const QItemS
return;
}
- else if ( selectionModel()->selectedIndexes().count() > 0 && selectionModel()->selectedIndexes().at(0).isValid() )
+ else if (selectionModel()->selectedIndexes().count() > 0 && selectionModel()->selectedIndexes().at(0).isValid())
{
multiSelect = false;
row = selectionModel()->selectedIndexes().at(0).row();
}
}
- if ( row < 0 )
+ if (row < 0)
cf_unselect_packet(cap_file_);
else
cf_select_packet(cap_file_, row);
@@ -562,7 +562,7 @@ void PacketList::contextMenuEvent(QContextMenuEvent *event)
QModelIndex ctxIndex = indexAt(event->pos());
- if ( selectionModel() && selectionModel()->selectedRows(0).count() > 1 )
+ if (selectionModel() && selectionModel()->selectedRows(0).count() > 1)
selectionModel()->select(ctxIndex, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
// frameData will be owned by one of the submenus, see below.
@@ -585,7 +585,7 @@ void PacketList::contextMenuEvent(QContextMenuEvent *event)
QString selectedfilter = getFilterFromRowAndColumn(currentIndex());
- if ( ! hasFocus() && cap_file_ && cap_file_->finfo_selected) {
+ if (! hasFocus() && cap_file_ && cap_file_->finfo_selected) {
char *tmp_field = proto_construct_match_selected_string(cap_file_->finfo_selected, cap_file_->edt);
selectedfilter = QString(tmp_field);
wmem_free(NULL, tmp_field);
@@ -659,7 +659,7 @@ void PacketList::contextMenuEvent(QContextMenuEvent *event)
// Set menu sensitivity for the current column and set action data.
- if ( frameData )
+ if (frameData)
emit framesSelected(QList<int>() << frameData->frameNum());
else
emit framesSelected(QList<int>());
@@ -670,7 +670,7 @@ void PacketList::contextMenuEvent(QContextMenuEvent *event)
void PacketList::ctxDecodeAsDialog()
{
QAction *da_action = qobject_cast<QAction*>(sender());
- if ( ! da_action )
+ if (! da_action)
return;
bool create_new = da_action->property("create_new").toBool();
@@ -726,7 +726,7 @@ void PacketList::mousePressEvent (QMouseEvent *event)
QModelIndex curIndex = indexAt(event->pos());
mouse_pressed_at_ = curIndex;
- bool midButton = ( event->buttons() & Qt::MidButton ) == Qt::MidButton;
+ bool midButton = (event->buttons() & Qt::MidButton) == Qt::MidButton;
if (midButton && cap_file_ && packet_list_model_)
{
packet_list_model_->toggleFrameMark(QModelIndexList() << curIndex);
@@ -744,7 +744,7 @@ void PacketList::mouseReleaseEvent(QMouseEvent *event) {
void PacketList::mouseMoveEvent (QMouseEvent *event)
{
QModelIndex curIndex = indexAt(event->pos());
- if ( event->buttons() & Qt::LeftButton && curIndex.isValid() && curIndex == mouse_pressed_at_ )
+ if (event->buttons() & Qt::LeftButton && curIndex.isValid() && curIndex == mouse_pressed_at_)
{
ctx_column_ = curIndex.column();
QMimeData * mimeData = new QMimeData();
@@ -752,28 +752,28 @@ void PacketList::mouseMoveEvent (QMouseEvent *event)
QString filter = getFilterFromRowAndColumn(curIndex);
QList<int> rows = selectedRows();
- if ( rows.count() > 1 )
+ if (rows.count() > 1)
{
QStringList content;
- foreach ( int row, rows )
+ foreach (int row, rows)
{
QModelIndex idx = model()->index(row, 0);
- if ( ! idx.isValid() )
+ if (! idx.isValid())
continue;
QString entry = createSummaryText(idx, CopyAsText);
content << entry;
}
- if ( content.count() > 0 )
+ if (content.count() > 0)
mimeData->setText(content.join("\n"));
}
- else if ( ! filter.isEmpty() )
+ else if (! filter.isEmpty())
{
QString abbrev;
QString name = model()->headerData(curIndex.column(), header()->orientation()).toString();
- if ( ! filter.isEmpty() )
+ if (! filter.isEmpty())
{
abbrev = filter.left(filter.indexOf(' '));
}
@@ -796,15 +796,15 @@ void PacketList::mouseMoveEvent (QMouseEvent *event)
else
{
QString text = model()->data(curIndex).toString();
- if ( ! text.isEmpty() )
+ if (! text.isEmpty())
mimeData->setText(text);
}
- if ( mimeData->hasText() || mimeData->hasFormat(WiresharkMimeData::DisplayFilterMimeType) )
+ if (mimeData->hasText() || mimeData->hasFormat(WiresharkMimeData::DisplayFilterMimeType))
{
QDrag * drag = new QDrag(this);
drag->setMimeData(mimeData);
- if ( content )
+ if (content)
{
qreal dpr = window()->windowHandle()->devicePixelRatio();
QPixmap pixmap= QPixmap(content->size() * dpr);
@@ -821,10 +821,10 @@ void PacketList::mouseMoveEvent (QMouseEvent *event)
void PacketList::keyPressEvent(QKeyEvent *event)
{
QTreeView::keyPressEvent(event);
- if ( event->matches(QKeySequence::Copy) )
+ if (event->matches(QKeySequence::Copy))
{
QStringList content;
- if ( model() && selectionModel() && selectionModel()->selectedRows(0).count() > 0 )
+ if (model() && selectionModel() && selectionModel()->selectedRows(0).count() > 0)
{
QList<int> rows;
foreach(QModelIndex row, selectionModel()->selectedRows(0))
@@ -833,7 +833,7 @@ void PacketList::keyPressEvent(QKeyEvent *event)
foreach(int row, rows)
{
QModelIndex idx = model()->index(row, 0);
- if ( ! idx.isValid() )
+ if (! idx.isValid())
continue;
QString entry = createSummaryText(idx, CopyAsText);
@@ -841,7 +841,7 @@ void PacketList::keyPressEvent(QKeyEvent *event)
}
}
- if ( content.count() > 0 )
+ if (content.count() > 0)
wsApp->clipboard()->setText(content.join('\n'), QClipboard::Clipboard);
}
}
@@ -1196,7 +1196,7 @@ QString PacketList::getFilterFromRowAndColumn(QModelIndex idx)
frame_data *fdata;
QString filter;
- if ( ! idx.isValid() )
+ if (! idx.isValid())
return filter;
int row = idx.row();
@@ -1317,7 +1317,7 @@ void PacketList::setPacketComment(QString new_comment)
if (!fdata) return;
/* Check if we are clearing the comment */
- if(new_comment.isEmpty()) {
+ if (new_comment.isEmpty()) {
new_packet_comment = NULL;
} else {
new_packet_comment = qstring_strdup(new_comment);
@@ -1498,12 +1498,12 @@ void PacketList::markFrame()
QModelIndexList frames;
- if ( selectionModel() && selectionModel()->selectedRows(0).count() > 1 )
+ if (selectionModel() && selectionModel()->selectedRows(0).count() > 1)
{
QList<int> rows;
- foreach ( QModelIndex idx, selectionModel()->selectedRows(0) )
+ foreach (QModelIndex idx, selectionModel()->selectedRows(0))
{
- if ( idx.isValid() && ! rows.contains(idx.row()) )
+ if (idx.isValid() && ! rows.contains(idx.row()))
{
frames << idx;
rows << idx.row();
@@ -1533,12 +1533,12 @@ void PacketList::ignoreFrame()
QModelIndexList frames;
- if ( selectionModel() && selectionModel()->selectedRows(0).count() > 1 )
+ if (selectionModel() && selectionModel()->selectedRows(0).count() > 1)
{
QList<int> rows;
- foreach ( QModelIndex idx, selectionModel()->selectedRows(0) )
+ foreach (QModelIndex idx, selectionModel()->selectedRows(0))
{
- if ( idx.isValid() && ! rows.contains(idx.row()) )
+ if (idx.isValid() && ! rows.contains(idx.row()))
{
frames << idx;
rows << idx.row();
@@ -1717,7 +1717,7 @@ void PacketList::updateRowHeights(const QModelIndex &ih_index)
QString PacketList::createSummaryText(QModelIndex idx, SummaryCopyType type)
{
- if ( ! idx.isValid() )
+ if (! idx.isValid())
return "";
QStringList col_parts;
@@ -1758,7 +1758,7 @@ void PacketList::copySummary()
if (!ca) return;
QVariant type = ca->data();
- if ( ! type.canConvert<SummaryCopyType>() )
+ if (! type.canConvert<SummaryCopyType>())
return;
SummaryCopyType copy_type = type.value<SummaryCopyType>();
diff --git a/ui/qt/packet_range_group_box.cpp b/ui/qt/packet_range_group_box.cpp
index 8f808a3971..00206af5ee 100644
--- a/ui/qt/packet_range_group_box.cpp
+++ b/ui/qt/packet_range_group_box.cpp
@@ -39,7 +39,7 @@ void PacketRangeGroupBox::initRange(packet_range_t *range, QString selRange) {
pr_ui_->capturedButton->setChecked(true);
}
- if ( selRange.length() > 0 )
+ if (selRange.length() > 0)
packet_range_convert_selection_str(range_, selRange.toUtf8().constData());
if (range_->user_range) {
diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp
index 816945903c..67ec0d9d4d 100644
--- a/ui/qt/preferences_dialog.cpp
+++ b/ui/qt/preferences_dialog.cpp
@@ -50,7 +50,7 @@ module_prefs_unstash(module_t *module, gpointer data)
could cause packets to be dissected differently. */
*must_redissect_p |= module->prefs_changed_flags;
- if(prefs_module_has_submodules(module))
+ if (prefs_module_has_submodules(module))
return prefs_modules_foreach_submodules(module, module_prefs_unstash, data);
return 0; /* Keep unstashing. */
@@ -67,7 +67,7 @@ module_prefs_clean_stash(module_t *module, gpointer)
pref_clean_stash(pref, Q_NULLPTR);
}
- if(prefs_module_has_submodules(module))
+ if (prefs_module_has_submodules(module))
return prefs_modules_foreach_submodules(module, module_prefs_clean_stash, Q_NULLPTR);
return 0; /* Keep cleaning modules */
diff --git a/ui/qt/profile_dialog.cpp b/ui/qt/profile_dialog.cpp
index 5076503429..2092132cc5 100644
--- a/ui/qt/profile_dialog.cpp
+++ b/ui/qt/profile_dialog.cpp
@@ -82,21 +82,21 @@ ProfileDialog::ProfileDialog(QWidget *parent) :
QMenu * importMenu = new QMenu(import_button_);
QAction * entry = importMenu->addAction(tr("from zip file"));
- connect( entry, &QAction::triggered, this, &ProfileDialog::importFromZip);
+ connect(entry, &QAction::triggered, this, &ProfileDialog::importFromZip);
entry = importMenu->addAction(tr("from directory"));
- connect( entry, &QAction::triggered, this, &ProfileDialog::importFromDirectory);
+ connect(entry, &QAction::triggered, this, &ProfileDialog::importFromDirectory);
import_button_->setMenu(importMenu);
QMenu * exportMenu = new QMenu(export_button_);
export_selected_entry_ = exportMenu->addAction(tr("%Ln selected personal profile(s)", "", 0));
export_selected_entry_->setProperty(PROFILE_EXPORT_PROPERTY, PROFILE_EXPORT_SELECTED);
- connect( export_selected_entry_, &QAction::triggered, this, &ProfileDialog::exportProfiles);
+ connect(export_selected_entry_, &QAction::triggered, this, &ProfileDialog::exportProfiles);
entry = exportMenu->addAction(tr("all personal profiles"));
entry->setProperty(PROFILE_EXPORT_PROPERTY, PROFILE_EXPORT_ALL);
- connect( entry, &QAction::triggered, this, &ProfileDialog::exportProfiles);
+ connect(entry, &QAction::triggered, this, &ProfileDialog::exportProfiles);
export_button_->setMenu(exportMenu);
#else
- connect( import_button_, &QPushButton::clicked, this, &ProfileDialog::importFromDirectory);
+ connect(import_button_, &QPushButton::clicked, this, &ProfileDialog::importFromDirectory);
#endif
resetTreeView();
@@ -124,19 +124,19 @@ ProfileDialog::~ProfileDialog()
void ProfileDialog::keyPressEvent(QKeyEvent *evt)
{
- if( pd_ui_->lineProfileFilter->hasFocus() && (evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return) )
+ if (pd_ui_->lineProfileFilter->hasFocus() && (evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return))
return;
QDialog::keyPressEvent(evt);
}
void ProfileDialog::selectProfile(QString profile)
{
- if ( profile.isEmpty() )
+ if (profile.isEmpty())
profile = QString(get_profile_name());
int row = model_->findByName(profile);
QModelIndex idx = sort_model_->mapFromSource(model_->index(row, ProfileModel::COL_NAME));
- if ( idx.isValid() )
+ if (idx.isValid())
pd_ui_->profileTreeView->selectRow(idx.row());
}
@@ -194,7 +194,7 @@ QModelIndexList ProfileDialog::selectedProfiles()
foreach (QModelIndex idx, pd_ui_->profileTreeView->selectionModel()->selectedIndexes())
{
QModelIndex temp = sort_model_->mapToSource(idx);
- if ( ! temp.isValid() || profiles.contains(temp) || temp.column() != ProfileModel::COL_NAME )
+ if (! temp.isValid() || profiles.contains(temp) || temp.column() != ProfileModel::COL_NAME)
continue;
profiles << temp;
@@ -205,7 +205,7 @@ QModelIndexList ProfileDialog::selectedProfiles()
void ProfileDialog::selectionChanged()
{
- if ( selectedProfiles().count() == 0 )
+ if (selectedProfiles().count() == 0)
pd_ui_->profileTreeView->selectRow(0);
updateWidgets();
@@ -224,47 +224,47 @@ void ProfileDialog::updateWidgets()
QModelIndexList profiles = selectedProfiles();
/* Ensure that the index is always the name column */
- if ( index.column() != ProfileModel::COL_NAME )
+ if (index.column() != ProfileModel::COL_NAME)
index = index.sibling(index.row(), ProfileModel::COL_NAME);
/* check if more than one viable profile is selected, and inform the sorting model */
- if ( profiles.count() > 1 )
+ if (profiles.count() > 1)
multiple = true;
/* Check if user profiles have been selected and allow export if it is so */
- for ( int cnt = 0; cnt < profiles.count(); cnt++ )
+ for (int cnt = 0; cnt < profiles.count(); cnt++)
{
- if ( ! profiles[cnt].data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! profiles[cnt].data(ProfileModel::DATA_IS_DEFAULT).toBool() )
+ if (! profiles[cnt].data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! profiles[cnt].data(ProfileModel::DATA_IS_DEFAULT).toBool())
user_profiles++;
}
- if ( model_->changesPending() )
+ if (model_->changesPending())
{
enable_import = false;
msg = tr("An import of profiles is not allowed, while changes are pending");
}
- else if ( model_->importPending() )
+ else if (model_->importPending())
{
enable_import = false;
msg = tr("An import is pending to be saved. Additional imports are not allowed");
}
- import_button_->setToolTip( msg );
- import_button_->setEnabled( enable_import );
+ import_button_->setToolTip(msg);
+ import_button_->setEnabled(enable_import);
#ifdef HAVE_MINIZIP
bool contains_user = false;
bool enable_export = false;
- if ( user_profiles > 0 )
+ if (user_profiles > 0)
contains_user = true;
/* enable export if no changes are pending */
- if ( ! model_->changesPending() )
+ if (! model_->changesPending())
enable_export = true;
- export_button_->setEnabled( enable_export );
- if ( ! enable_export )
+ export_button_->setEnabled(enable_export);
+ if (! enable_export)
{
- if ( ! contains_user )
+ if (! contains_user)
export_button_->setToolTip(tr("An export of profiles is only allowed for personal profiles"));
else
export_button_->setToolTip(tr("An export of profiles is not allowed, while changes are pending"));
@@ -273,22 +273,22 @@ void ProfileDialog::updateWidgets()
#endif
/* if the current profile is default with reset pending or a global one, deactivate delete */
- if ( ! multiple )
+ if (! multiple)
{
- if ( index.isValid() )
+ if (index.isValid())
{
- if ( index.data(ProfileModel::DATA_IS_GLOBAL).toBool() )
+ if (index.data(ProfileModel::DATA_IS_GLOBAL).toBool())
enable_del = false;
- else if ( index.data(ProfileModel::DATA_IS_DEFAULT).toBool() && model_->resetDefault())
+ else if (index.data(ProfileModel::DATA_IS_DEFAULT).toBool() && model_->resetDefault())
enable_del = false;
}
- else if ( ! index.isValid() )
+ else if (! index.isValid())
enable_del = false;
}
QString hintUrl;
msg.clear();
- if ( multiple )
+ if (multiple)
{
/* multiple profiles are being selected, copy is no longer allowed */
pd_ui_->copyToolButton->setEnabled(false);
@@ -302,15 +302,15 @@ void ProfileDialog::updateWidgets()
else
{
/* if only one profile is selected, display it's path in the hint label and activate link (if allowed) */
- if ( index.isValid() )
+ if (index.isValid())
{
QString temp = index.data(ProfileModel::DATA_PATH).toString();
- if ( index.data(ProfileModel::DATA_PATH_IS_NOT_DESCRIPTION).toBool() && QFileInfo(temp).isDir() )
+ if (index.data(ProfileModel::DATA_PATH_IS_NOT_DESCRIPTION).toBool() && QFileInfo(temp).isDir())
hintUrl = QUrl::fromLocalFile(temp).toString();
pd_ui_->hintLabel->setText(temp);
pd_ui_->hintLabel->setToolTip(index.data(Qt::ToolTipRole).toString());
- if ( ! index.data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! index.data(ProfileModel::DATA_IS_DEFAULT).toBool() )
+ if (! index.data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! index.data(ProfileModel::DATA_IS_DEFAULT).toBool())
msg = tr("%Ln selected personal profile(s)", "", 1);
}
@@ -324,14 +324,14 @@ void ProfileDialog::updateWidgets()
if (model_ && model_->rowCount() > 0)
{
msg.clear();
- for ( int row = 0; row < model_->rowCount() && enable_ok; row++ )
+ for (int row = 0; row < model_->rowCount() && enable_ok; row++)
{
QModelIndex idx = model_->index(row, ProfileModel::COL_NAME);
QString name = idx.data().toString();
- if ( ! ProfileModel::checkNameValidity(name, &msg) )
+ if (! ProfileModel::checkNameValidity(name, &msg))
{
- if ( idx == index || selectedProfiles().contains(idx) )
+ if (idx == index || selectedProfiles().contains(idx))
{
hintUrl.clear();
pd_ui_->hintLabel->setText(msg);
@@ -341,22 +341,22 @@ void ProfileDialog::updateWidgets()
continue;
}
- if ( model_->checkInvalid(idx) || ( ! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() && model_->checkIfDeleted(idx) ) )
+ if (model_->checkInvalid(idx) || (! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() && model_->checkIfDeleted(idx)) )
{
- if ( idx == index )
+ if (idx == index)
hintUrl.clear();
enable_ok = false;
continue;
}
- if ( idx != index && idx.data().toString().compare(index.data().toString()) == 0 )
+ if (idx != index && idx.data().toString().compare(index.data().toString()) == 0)
{
if (idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() == index.data(ProfileModel::DATA_IS_GLOBAL).toBool())
enable_ok = false;
}
QList<int> rows = model_->findAllByNameAndVisibility(name, idx.data(ProfileModel::DATA_IS_GLOBAL).toBool());
- if ( rows.count() > 1 )
+ if (rows.count() > 1)
enable_ok = false;
}
}
@@ -396,7 +396,7 @@ void ProfileDialog::on_newToolButton_clicked()
void ProfileDialog::on_deleteToolButton_clicked()
{
QModelIndexList profiles = selectedProfiles();
- if ( profiles.count() <= 0 )
+ if (profiles.count() <= 0)
return;
model_->deleteEntries(profiles);
@@ -404,10 +404,10 @@ void ProfileDialog::on_deleteToolButton_clicked()
bool isGlobal = model_->activeProfile().data(ProfileModel::DATA_IS_GLOBAL).toBool();
int row = model_->findByName(model_->activeProfile().data().toString());
/* If the active profile is deleted, the default is selected next */
- if ( row < 0 )
+ if (row < 0)
row = 0;
QModelIndex newIdx = sort_model_->mapFromSource(model_->index(row, 0));
- if ( newIdx.data(ProfileModel::DATA_IS_GLOBAL).toBool() != isGlobal )
+ if (newIdx.data(ProfileModel::DATA_IS_GLOBAL).toBool() != isGlobal)
newIdx = sort_model_->mapFromSource(model_->index(0, 0));
pd_ui_->profileTreeView->setCurrentIndex(newIdx);
@@ -418,7 +418,7 @@ void ProfileDialog::on_deleteToolButton_clicked()
void ProfileDialog::on_copyToolButton_clicked()
{
QModelIndexList profiles = selectedProfiles();
- if ( profiles.count() > 1 )
+ if (profiles.count() > 1)
return;
pd_ui_->lineProfileFilter->setText("");
@@ -426,7 +426,7 @@ void ProfileDialog::on_copyToolButton_clicked()
sort_model_->setFilterString();
QModelIndex current = pd_ui_->profileTreeView->currentIndex();
- if ( current.column() != ProfileModel::COL_NAME )
+ if (current.column() != ProfileModel::COL_NAME)
current = current.sibling(current.row(), ProfileModel::COL_NAME);
QModelIndex source = sort_model_->mapToSource(current);
@@ -452,7 +452,7 @@ void ProfileDialog::on_buttonBox_accepted()
pd_ui_->buttonBox->setFocus();
QModelIndexList profiles = selectedProfiles();
- if ( profiles.count() <= 0 )
+ if (profiles.count() <= 0)
index = QModelIndex();
QModelIndex default_item = sort_model_->mapFromSource(model_->index(0, ProfileModel::COL_NAME));
@@ -496,14 +496,14 @@ void ProfileDialog::on_buttonBox_accepted()
QString profileName;
- if ( ! index.isValid() && model_->lastSetRow() >= 0 )
+ if (! index.isValid() && model_->lastSetRow() >= 0)
{
QModelIndex original = model_->index(model_->lastSetRow(), ProfileModel::COL_NAME);
index = sort_model_->mapFromSource(original);
}
/* If multiple profiles are selected, do not change the selected profile */
- if ( index.isValid() && ! item_data_removed && profiles.count() <= 1 )
+ if (index.isValid() && ! item_data_removed && profiles.count() <= 1)
{
profileName = model_->data(index).toString();
}
@@ -521,7 +521,7 @@ void ProfileDialog::on_buttonBox_accepted()
void ProfileDialog::on_buttonBox_rejected()
{
QString msg;
- if ( ! model_->clearImported(&msg) )
+ if (! model_->clearImported(&msg))
QMessageBox::critical(this, tr("Error"), msg);
}
@@ -536,7 +536,7 @@ void ProfileDialog::dataChanged(const QModelIndex &idx)
pd_ui_->cmbProfileTypes->setCurrentIndex(ProfileSortModel::AllProfiles);
pd_ui_->profileTreeView->setFocus();
- if ( ! idx.isValid() && model_->lastSetRow() >= 0 )
+ if (! idx.isValid() && model_->lastSetRow() >= 0)
{
QModelIndex original = model_->index(model_->lastSetRow(), ProfileModel::COL_NAME);
pd_ui_->profileTreeView->setCurrentIndex(sort_model_->mapFromSource(original));
@@ -567,35 +567,35 @@ void ProfileDialog::filterChanged(const QString &text)
void ProfileDialog::exportProfiles(bool exportAllPersonalProfiles)
{
QAction * action = qobject_cast<QAction *>(sender());
- if ( action && action->property(PROFILE_EXPORT_PROPERTY).isValid() )
+ if (action && action->property(PROFILE_EXPORT_PROPERTY).isValid())
exportAllPersonalProfiles = action->property(PROFILE_EXPORT_PROPERTY).toString().compare(PROFILE_EXPORT_ALL) == 0;
QModelIndexList items;
int skipped = 0;
- if ( ! exportAllPersonalProfiles )
+ if (! exportAllPersonalProfiles)
{
- foreach ( QModelIndex idx, selectedProfiles() )
+ foreach (QModelIndex idx, selectedProfiles())
{
- if ( ! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool() )
+ if (! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool())
items << idx;
else
skipped++;
}
}
- else if ( exportAllPersonalProfiles )
+ else if (exportAllPersonalProfiles)
{
- for ( int cnt = 0; cnt < sort_model_->rowCount(); cnt++ )
+ for (int cnt = 0; cnt < sort_model_->rowCount(); cnt++)
{
QModelIndex idx = sort_model_->index(cnt, ProfileModel::COL_NAME);
- if ( ! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool() )
+ if (! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool())
items << sort_model_->mapToSource(idx);
}
}
- if ( items.count() == 0 )
+ if (items.count() == 0)
{
QString msg = tr("No profiles found for export");
- if ( skipped > 0 )
+ if (skipped > 0)
msg.append(tr(", %Ln profile(s) skipped", "", skipped));
QMessageBox::critical(this, tr("Exporting profiles"), msg);
return;
@@ -603,17 +603,17 @@ void ProfileDialog::exportProfiles(bool exportAllPersonalProfiles)
QString zipFile = QFileDialog::getSaveFileName(this, tr("Select zip file for export"), lastOpenDir(), tr("Zip File (*.zip)"));
- if ( zipFile.length() > 0 )
+ if (zipFile.length() > 0)
{
QFileInfo fi(zipFile);
- if ( fi.suffix().length() == 0 || fi.suffix().toLower().compare("zip") != 0 )
+ if (fi.suffix().length() == 0 || fi.suffix().toLower().compare("zip") != 0)
zipFile += ".zip";
QString err;
- if ( model_->exportProfiles(zipFile, items, &err) )
+ if (model_->exportProfiles(zipFile, items, &err))
{
QString msg = tr("%Ln profile(s) exported", "", items.count());
- if ( skipped > 0 )
+ if (skipped > 0)
msg.append(tr(", %Ln profile(s) skipped", "", skipped));
QMessageBox::information(this, tr("Exporting profiles"), msg);
@@ -623,7 +623,7 @@ void ProfileDialog::exportProfiles(bool exportAllPersonalProfiles)
else
{
QString msg = tr("An error has occurred while exporting profiles");
- if ( err.length() > 0 )
+ if (err.length() > 0)
msg.append(QString("\n\n%1: %3").arg(tr("Error")).arg(err));
QMessageBox::critical(this, tr("Exporting profiles"), msg);
}
@@ -635,7 +635,7 @@ void ProfileDialog::importFromZip()
QString zipFile = QFileDialog::getOpenFileName(this, tr("Select zip file for import"), lastOpenDir(), tr("Zip File (*.zip)"));
QFileInfo fi(zipFile);
- if ( ! fi.exists() )
+ if (! fi.exists())
return;
int skipped = 0;
@@ -651,7 +651,7 @@ void ProfileDialog::importFromDirectory()
QString importDir = QFileDialog::getExistingDirectory(this, tr("Select directory for import"), lastOpenDir());
QFileInfo fi(importDir);
- if ( ! fi.isDir() )
+ if (! fi.isDir())
return;
int skipped = 0;
@@ -666,7 +666,7 @@ void ProfileDialog::finishImport(QFileInfo fi, int count, int skipped, QStringLi
QString msg;
QMessageBox::Icon icon;
- if ( count == 0 && skipped == 0 )
+ if (count == 0 && skipped == 0)
{
icon = QMessageBox::Warning;
msg = tr("No profiles found for import in %1").arg(fi.fileName());
@@ -675,13 +675,13 @@ void ProfileDialog::finishImport(QFileInfo fi, int count, int skipped, QStringLi
{
icon = QMessageBox::Information;
msg = tr("%Ln profile(s) imported", "", count);
- if ( skipped > 0 )
+ if (skipped > 0)
msg.append(tr(", %Ln profile(s) skipped", "", skipped));
}
storeLastDir(fi.absolutePath());
- if ( count > 0 )
+ if (count > 0)
{
import.sort();
resetTreeView();
@@ -723,7 +723,7 @@ QString ProfileDialog::lastOpenDir()
}
QDir ld(result);
- if ( ld.exists() )
+ if (ld.exists())
return result;
return QString();
@@ -737,12 +737,12 @@ void ProfileDialog::storeLastDir(QString dir)
void ProfileDialog::resetTreeView()
{
- if ( model_ )
+ if (model_)
{
pd_ui_->profileTreeView->setModel(Q_NULLPTR);
sort_model_->setSourceModel(Q_NULLPTR);
model_->disconnect();
- if ( pd_ui_->profileTreeView->selectionModel() )
+ if (pd_ui_->profileTreeView->selectionModel())
pd_ui_->profileTreeView->selectionModel()->disconnect();
delete sort_model_;
delete model_;
@@ -762,7 +762,7 @@ void ProfileDialog::resetTreeView()
selectionChanged();
- if ( sort_model_->columnCount() <= 1 )
+ if (sort_model_->columnCount() <= 1)
pd_ui_->profileTreeView->header()->hide();
else
{
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp
index a8fcf2136f..9b44525c65 100644
--- a/ui/qt/proto_tree.cpp
+++ b/ui/qt/proto_tree.cpp
@@ -107,7 +107,7 @@ void ProtoTree::clear() {
void ProtoTree::connectToMainWindow()
{
- if ( wsApp->mainWindow() )
+ if (wsApp->mainWindow())
{
connect(wsApp->mainWindow(), SIGNAL(fieldSelected(FieldInformation *)),
this, SLOT(selectedFieldChanged(FieldInformation *)));
@@ -121,14 +121,14 @@ void ProtoTree::ctxCopyVisibleItems()
bool selected_tree = false;
QAction * send = qobject_cast<QAction *>(sender());
- if ( send && send->property("selected_tree").isValid() )
+ if (send && send->property("selected_tree").isValid())
selected_tree = true;
QString clip = toString();
- if ( selected_tree && selectionModel()->hasSelection() )
+ if (selected_tree && selectionModel()->hasSelection())
clip = toString(selectionModel()->selectedIndexes().first());
- if ( clip.length() > 0 )
+ if (clip.length() > 0)
wsApp->clipboard()->setText(clip);
}
@@ -136,14 +136,14 @@ void ProtoTree::ctxCopyAsFilter()
{
QModelIndex idx = selectionModel()->selectedIndexes().first();
FieldInformation finfo(proto_tree_model_->protoNodeFromIndex(idx).protoNode());
- if ( finfo.isValid() )
+ if (finfo.isValid())
{
epan_dissect_t *edt = cap_file_ ? cap_file_->edt : edt_;
char *field_filter = proto_construct_match_selected_string(finfo.fieldInfo(), edt);
QString filter(field_filter);
wmem_free(Q_NULLPTR, field_filter);
- if ( filter.length() > 0 )
+ if (filter.length() > 0)
wsApp->clipboard()->setText(filter);
}
}
@@ -153,12 +153,12 @@ void ProtoTree::ctxCopySelectedInfo()
int val = -1;
QString clip;
QAction * send = qobject_cast<QAction *>(sender());
- if ( send && send->property("field_type").isValid() )
+ if (send && send->property("field_type").isValid())
val = send->property("field_type").toInt();
QModelIndex idx = selectionModel()->selectedIndexes().first();
FieldInformation finfo(proto_tree_model_->protoNodeFromIndex(idx).protoNode());
- if ( ! finfo.isValid() )
+ if (! finfo.isValid())
return;
switch (val)
@@ -168,7 +168,7 @@ void ProtoTree::ctxCopySelectedInfo()
break;
case ProtoTree::Description:
- if ( finfo.fieldInfo()->rep && strlen(finfo.fieldInfo()->rep->representation) > 0 )
+ if (finfo.fieldInfo()->rep && strlen(finfo.fieldInfo()->rep->representation) > 0)
clip.append(finfo.fieldInfo()->rep->representation);
break;
@@ -184,7 +184,7 @@ void ProtoTree::ctxCopySelectedInfo()
break;
}
- if ( clip.length() > 0 )
+ if (clip.length() > 0)
wsApp->clipboard()->setText(clip);
}
@@ -193,14 +193,14 @@ void ProtoTree::ctxOpenUrlWiki()
QUrl url;
bool is_field_reference = false;
QAction * send = qobject_cast<QAction *>(sender());
- if ( send && send->property("field_reference").isValid() )
+ if (send && send->property("field_reference").isValid())
is_field_reference = send->property("field_reference").toBool();
QModelIndex idx = selectionModel()->selectedIndexes().first();
FieldInformation finfo(proto_tree_model_->protoNodeFromIndex(idx).protoNode());
const QString proto_abbrev = proto_registrar_get_abbrev(finfo.headerInfo().id);
- if ( ! is_field_reference )
+ if (! is_field_reference)
{
int ret = QMessageBox::question(this, wsApp->windowTitleString(tr("Wiki Page for %1").arg(proto_abbrev)),
tr("<p>The Wireshark Wiki is maintained by the community.</p>"
@@ -226,7 +226,7 @@ void ProtoTree::ctxOpenUrlWiki()
void ProtoTree::contextMenuEvent(QContextMenuEvent *event)
{
QModelIndex index = indexAt(event->pos());
- if ( ! index.isValid() )
+ if (! index.isValid())
return;
// We're in a PacketDialog
@@ -250,7 +250,7 @@ void ProtoTree::contextMenuEvent(QContextMenuEvent *event)
else if (! window()->findChild<QAction *>("actionViewExpandSubtrees"))
is_selected = true;
- if ( is_selected )
+ if (is_selected)
{
if (fi && fi->tree_type != -1) {
have_subtree = true;
@@ -265,7 +265,7 @@ void ProtoTree::contextMenuEvent(QContextMenuEvent *event)
ctx_menu.addAction(tr("Collapse All"), this, SLOT(collapseAll()));
ctx_menu.addSeparator();
- if ( ! buildForDialog )
+ if (! buildForDialog)
{
action = window()->findChild<QAction *>("actionAnalyzeCreateAColumn");
ctx_menu.addAction(action);
@@ -276,10 +276,10 @@ void ProtoTree::contextMenuEvent(QContextMenuEvent *event)
bool can_match_selected = proto_can_match_selected(finfo.fieldInfo(), edt);
ctx_menu.addMenu(FilterAction::createFilterMenu(FilterAction::ActionApply, selectedfilter, can_match_selected, &ctx_menu));
ctx_menu.addMenu(FilterAction::createFilterMenu(FilterAction::ActionPrepare, selectedfilter, can_match_selected, &ctx_menu));
- if ( selectedfilter )
+ if (selectedfilter)
wmem_free(Q_NULLPTR, selectedfilter);
- if ( ! buildForDialog )
+ if (! buildForDialog)
{
QMenu *main_conv_menu = window()->findChild<QMenu *>("menuConversationFilter");
conv_menu_.setTitle(main_conv_menu->title());
@@ -321,7 +321,7 @@ void ProtoTree::contextMenuEvent(QContextMenuEvent *event)
submenu->addActions(copyEntries->actions());
ctx_menu.addSeparator();
- if ( ! buildForDialog )
+ if (! buildForDialog)
{
action = window()->findChild<QAction *>("actionAnalyzeShowPacketBytes");
ctx_menu.addAction(action);
@@ -339,7 +339,7 @@ void ProtoTree::contextMenuEvent(QContextMenuEvent *event)
decode_as_ = window()->findChild<QAction *>("actionAnalyzeDecodeAs");
ctx_menu.addAction(decode_as_);
- if ( ! buildForDialog )
+ if (! buildForDialog)
{
ctx_menu.addAction(window()->findChild<QAction *>("actionGoGoToLinkedPacket"));
ctx_menu.addAction(window()->findChild<QAction *>("actionContextShowLinkedPacketInNewWindow"));
@@ -358,7 +358,7 @@ void ProtoTree::contextMenuEvent(QContextMenuEvent *event)
ctx_menu.exec(event->globalPos());
- if ( ! buildForDialog )
+ if (! buildForDialog)
decode_as_->setData(QVariant());
}
@@ -569,7 +569,7 @@ void ProtoTree::collapseSubtrees()
void ProtoTree::expandAll()
{
- for(int i = 0; i < num_tree_types; i++) {
+ for (int i = 0; i < num_tree_types; i++) {
tree_expanded_set(i, TRUE);
}
QTreeView::expandAll();
@@ -578,7 +578,7 @@ void ProtoTree::expandAll()
void ProtoTree::collapseAll()
{
- for(int i = 0; i < num_tree_types; i++) {
+ for (int i = 0; i < num_tree_types; i++) {
tree_expanded_set(i, FALSE);
}
QTreeView::collapseAll();
@@ -605,7 +605,7 @@ void ProtoTree::itemDoubleClicked(const QModelIndex &index) {
void ProtoTree::selectedFrameChanged(int frameNum)
{
- if ( frameNum < 0 )
+ if (frameNum < 0)
proto_tree_model_->setRootNode(Q_NULLPTR);
}
@@ -671,18 +671,18 @@ QString ProtoTree::traverseTree(const QModelIndex & travTree, int identLevel) co
{
QString result = "";
- if ( travTree.isValid() )
+ if (travTree.isValid())
{
result.append(QString(" ").repeated(identLevel));
result.append(travTree.data().toString());
result.append("\n");
/* if the element is expanded, we traverse one level down */
- if ( isExpanded(travTree) )
+ if (isExpanded(travTree))
{
int children = proto_tree_model_->rowCount(travTree);
identLevel++;
- for ( int child = 0; child < children; child++ )
+ for (int child = 0; child < children; child++)
result += traverseTree(proto_tree_model_->index(child, 0, travTree), identLevel);
}
}
@@ -693,12 +693,12 @@ QString ProtoTree::traverseTree(const QModelIndex & travTree, int identLevel) co
QString ProtoTree::toString(const QModelIndex &start_idx) const
{
QString tree_string = "";
- if ( start_idx.isValid() )
+ if (start_idx.isValid())
tree_string = traverseTree(start_idx, 0);
else
{
int children = proto_tree_model_->rowCount();
- for ( int child = 0; child < children; child++ )
+ for (int child = 0; child < children; child++)
tree_string += traverseTree(proto_tree_model_->index(child, 0, QModelIndex()), 0);
}
@@ -716,30 +716,30 @@ void ProtoTree::setCaptureFile(capture_file *cf)
bool ProtoTree::eventFilter(QObject * obj, QEvent * event)
{
- if ( event->type() != QEvent::MouseButtonPress && event->type() != QEvent::MouseMove )
+ if (event->type() != QEvent::MouseButtonPress && event->type() != QEvent::MouseMove)
return QTreeView::eventFilter(obj, event);
/* Mouse was over scrollbar, ignoring */
- if ( qobject_cast<QScrollBar *>(obj) )
+ if (qobject_cast<QScrollBar *>(obj))
return QTreeView::eventFilter(obj, event);
- if ( event->type() == QEvent::MouseButtonPress )
+ if (event->type() == QEvent::MouseButtonPress)
{
QMouseEvent * ev = (QMouseEvent *)event;
- if ( ev->buttons() & Qt::LeftButton )
+ if (ev->buttons() & Qt::LeftButton)
drag_start_position_ = ev->pos();
}
- else if ( event->type() == QEvent::MouseMove )
+ else if (event->type() == QEvent::MouseMove)
{
QMouseEvent * ev = (QMouseEvent *)event;
- if ( ( ev->buttons() & Qt::LeftButton ) && (ev->pos() - drag_start_position_).manhattanLength()
+ if ((ev->buttons() & Qt::LeftButton) && (ev->pos() - drag_start_position_).manhattanLength()
> QApplication::startDragDistance())
{
QModelIndex idx = indexAt(drag_start_position_);
FieldInformation finfo(proto_tree_model_->protoNodeFromIndex(idx).protoNode());
- if ( finfo.isValid() )
+ if (finfo.isValid())
{
/* Hack to prevent QItemSelection taking the item which has been dragged over at start
* of drag-drop operation. selectionModel()->blockSignals could have done the trick, but
@@ -752,7 +752,7 @@ bool ProtoTree::eventFilter(QObject * obj, QEvent * event)
QString filter(field_filter);
wmem_free(NULL, field_filter);
- if ( filter.length() > 0 )
+ if (filter.length() > 0)
{
QJsonObject filterData;
filterData["filter"] = filter;
diff --git a/ui/qt/resolved_addresses_dialog.cpp b/ui/qt/resolved_addresses_dialog.cpp
index 03f3bc624c..66cf39c3b8 100644
--- a/ui/qt/resolved_addresses_dialog.cpp
+++ b/ui/qt/resolved_addresses_dialog.cpp
@@ -115,11 +115,11 @@ ResolvedAddressesDialog::~ResolvedAddressesDialog()
void ResolvedAddressesDialog::on_cmbDataType_currentIndexChanged(QString)
{
- if ( ! ethSortModel )
+ if (! ethSortModel)
return;
QString filter = ui->cmbDataType->currentText();
- if ( ui->cmbDataType->currentIndex() == 0 )
+ if (ui->cmbDataType->currentIndex() == 0)
{
filter.clear();
ethTypeModel->setFilterType(AStringListListSortFilterProxyModel::FilterNone, 0);
@@ -131,7 +131,7 @@ void ResolvedAddressesDialog::on_cmbDataType_currentIndexChanged(QString)
void ResolvedAddressesDialog::on_txtSearchFilter_textChanged(QString)
{
- if ( ! ethSortModel || ui->txtSearchFilter->text().length() < 3 )
+ if (! ethSortModel || ui->txtSearchFilter->text().length() < 3)
return;
ethSortModel->setFilter(ui->txtSearchFilter->text());
@@ -139,11 +139,11 @@ void ResolvedAddressesDialog::on_txtSearchFilter_textChanged(QString)
void ResolvedAddressesDialog::on_cmbPortFilterType_currentIndexChanged(QString)
{
- if ( ! portSortModel )
+ if (! portSortModel)
return;
QString filter = ui->cmbPortFilterType->currentText();
- if ( ui->cmbPortFilterType->currentIndex() == 0 )
+ if (ui->cmbPortFilterType->currentIndex() == 0)
{
filter.clear();
portTypeModel->setFilterType(AStringListListSortFilterProxyModel::FilterNone, 2);
@@ -155,7 +155,7 @@ void ResolvedAddressesDialog::on_cmbPortFilterType_currentIndexChanged(QString)
void ResolvedAddressesDialog::on_txtPortFilter_textChanged(QString val)
{
- if ( ! portSortModel )
+ if (! portSortModel)
return;
portSortModel->setFilter(val);
diff --git a/ui/qt/rpc_service_response_time_dialog.cpp b/ui/qt/rpc_service_response_time_dialog.cpp
index b2b6a6d17a..bfcb723966 100644
--- a/ui/qt/rpc_service_response_time_dialog.cpp
+++ b/ui/qt/rpc_service_response_time_dialog.cpp
@@ -153,7 +153,7 @@ TapParameterDialog *RpcServiceResponseTimeDialog::createDceRpcSrtDialog(QWidget
if (args_l.length() > 1) {
// XXX Switch to QUuid.
unsigned d1, d2, d3, d4_0, d4_1, d4_2, d4_3, d4_4, d4_5, d4_6, d4_7;
- if(sscanf(args_l[0].toUtf8().constData(),
+ if (sscanf(args_l[0].toUtf8().constData(),
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
&d1, &d2, &d3,
&d4_0, &d4_1, &d4_2, &d4_3, &d4_4, &d4_5, &d4_6, &d4_7) == 11) {
diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp
index d31b99a2fa..c0878ee3c0 100644
--- a/ui/qt/rtp_analysis_dialog.cpp
+++ b/ui/qt/rtp_analysis_dialog.cpp
@@ -1051,7 +1051,7 @@ size_t RtpAnalysisDialog::convert_payload_to_samples(unsigned int payload_type,
if (payload_type == PT_PCMU) {
/* Output sample count is same as input sample count for G.711 */
sample_count = payload_len;
- for(size_t i = 0; i < payload_len; i++) {
+ for (size_t i = 0; i < payload_len; i++) {
tempfile->read((char *)&f_rawvalue, sizeof(f_rawvalue));
sample = ulaw2linear((unsigned char)f_rawvalue);
phton16(pd, sample);
@@ -1061,7 +1061,7 @@ size_t RtpAnalysisDialog::convert_payload_to_samples(unsigned int payload_type,
} else if (payload_type == PT_PCMA) {
/* Output sample count is same as input sample count for G.711 */
sample_count = payload_len;
- for(size_t i = 0; i < payload_len; i++) {
+ for (size_t i = 0; i < payload_len; i++) {
tempfile->read((char *)&f_rawvalue, sizeof(f_rawvalue));
sample = alaw2linear((unsigned char)f_rawvalue);
phton16(pd, sample);
@@ -1071,7 +1071,7 @@ size_t RtpAnalysisDialog::convert_payload_to_samples(unsigned int payload_type,
} else {
/* Read payload, but ignore it */
sample_count = 0;
- for(size_t i = 0; i < payload_len; i++) {
+ for (size_t i = 0; i < payload_len; i++) {
tempfile->read((char *)&f_rawvalue, sizeof(f_rawvalue));
}
}
@@ -1091,7 +1091,7 @@ gboolean RtpAnalysisDialog::saveAudioAUSilence(size_t total_len, QFile *save_fil
pd_out[0] = pd[0];
pd_out[1] = pd[1];
/* Fill whole file with silence */
- for(size_t i=0; i<total_len; i++) {
+ for (size_t i=0; i<total_len; i++) {
if (*stop_flag) {
return FALSE;
}
@@ -1122,7 +1122,7 @@ gboolean RtpAnalysisDialog::saveAudioAUUnidir(tap_rtp_stat_t &statinfo, QTempora
sample_count=convert_payload_to_samples(save_data.payload_type, tempfile ,pd_out, save_data.payload_len);
- if (sample_count > 0 ) {
+ if (sample_count > 0) {
nchars = 0;
/* Save payload samples with optional interleaving */
for (size_t i = 0; i < sample_count; i++) {
@@ -1342,7 +1342,7 @@ gboolean RtpAnalysisDialog::saveAudioRAW(StreamDirection direction, QFile *save_
ui->progressFrame->setValue(int(tempfile->pos() * 100 / fwd_tempfile_->size()));
if (save_data.payload_len > 0) {
- for(size_t i = 0; i < save_data.payload_len; i++) {
+ for (size_t i = 0; i < save_data.payload_len; i++) {
if (sizeof(f_rawvalue) != tempfile->read((char *)&f_rawvalue, sizeof(f_rawvalue))) {
return FALSE;
}
diff --git a/ui/qt/sctp_chunk_statistics_dialog.cpp b/ui/qt/sctp_chunk_statistics_dialog.cpp
index aa35c01207..8eab5b0014 100644
--- a/ui/qt/sctp_chunk_statistics_dialog.cpp
+++ b/ui/qt/sctp_chunk_statistics_dialog.cpp
@@ -155,7 +155,7 @@ void SCTPChunkStatisticsDialog::fillTable(bool all, const sctp_assoc_info_t *sel
continue;
temp.hide = 0;
temp.name[0] = '\0';
- while(token != NULL) {
+ while (token != NULL) {
token = strtok(NULL, ",");
if (token) {
if ((strstr(token, "Hide"))) {
diff --git a/ui/qt/sctp_graph_dialog.cpp b/ui/qt/sctp_graph_dialog.cpp
index e1a1ab6069..8d65aac9e8 100644
--- a/ui/qt/sctp_graph_dialog.cpp
+++ b/ui/qt/sctp_graph_dialog.cpp
@@ -165,7 +165,7 @@ void SCTPGraphDialog::drawSACKGraph(const sctp_assoc_info_t* selected_assoc)
dup_nr=g_ntohs(sack_header->nr_of_dups);
if (nr>0) { // Gap Reports green
gap = &sack_header->gaps[0];
- for(i=0;i<nr; i++) {
+ for (i=0;i<nr; i++) {
gap_start=g_ntohs(gap->start);
gap_end = g_ntohs(gap->end);
for (j=gap_start; j<=gap_end; j++) {
diff --git a/ui/qt/tcp_stream_dialog.cpp b/ui/qt/tcp_stream_dialog.cpp
index 884ef1d464..f20681b98f 100644
--- a/ui/qt/tcp_stream_dialog.cpp
+++ b/ui/qt/tcp_stream_dialog.cpp
@@ -377,14 +377,14 @@ void TCPStreamDialog::keyPressEvent(QKeyEvent *event)
zoomAxes(true);
break;
case Qt::Key_X: // Zoom X axis only
- if(event->modifiers() & Qt::ShiftModifier){
+ if (event->modifiers() & Qt::ShiftModifier) {
zoomXAxis(false); // upper case X -> Zoom out
} else {
zoomXAxis(true); // lower case x -> Zoom in
}
break;
case Qt::Key_Y: // Zoom Y axis only
- if(event->modifiers() & Qt::ShiftModifier){
+ if (event->modifiers() & Qt::ShiftModifier) {
zoomYAxis(false); // upper case Y -> Zoom out
} else {
zoomYAxis(true); // lower case y -> Zoom in
@@ -1224,7 +1224,7 @@ void TCPStreamDialog::fillThroughput()
last_ack = seg->th_ack;
#ifdef USE_SACKS_IN_GOODPUT_CALC
// copy any sack_ranges into new_sacks, and sort.
- for(int i = 0; i < seg->num_sack_ranges; ++i) {
+ for (int i = 0; i < seg->num_sack_ranges; ++i) {
new_sacks[i].first = seg->sack_left_edge[i];
new_sacks[i].second = seg->sack_right_edge[i];
}
diff --git a/ui/qt/utils/color_utils.cpp b/ui/qt/utils/color_utils.cpp
index d57511d583..4f584e4cee 100644
--- a/ui/qt/utils/color_utils.cpp
+++ b/ui/qt/utils/color_utils.cpp
@@ -21,13 +21,13 @@
// At some point we should probably make these configurable along with the
// graph and sequence colors.
-const QColor ColorUtils::expert_color_comment = QColor ( 0xb7, 0xf7, 0x74 ); /* Green */
-const QColor ColorUtils::expert_color_chat = QColor ( 0x80, 0xb7, 0xf7 ); /* Light blue */
-const QColor ColorUtils::expert_color_note = QColor ( 0xa0, 0xff, 0xff ); /* Bright turquoise */
-const QColor ColorUtils::expert_color_warn = QColor ( 0xf7, 0xf2, 0x53 ); /* Yellow */
-const QColor ColorUtils::expert_color_error = QColor ( 0xff, 0x5c, 0x5c ); /* Pale red */
-const QColor ColorUtils::expert_color_foreground = QColor ( 0x00, 0x00, 0x00 ); /* Black */
-const QColor ColorUtils::hidden_proto_item = QColor ( 0x44, 0x44, 0x44 ); /* Gray */
+const QColor ColorUtils::expert_color_comment = QColor (0xb7, 0xf7, 0x74); /* Green */
+const QColor ColorUtils::expert_color_chat = QColor (0x80, 0xb7, 0xf7); /* Light blue */
+const QColor ColorUtils::expert_color_note = QColor (0xa0, 0xff, 0xff); /* Bright turquoise */
+const QColor ColorUtils::expert_color_warn = QColor (0xf7, 0xf2, 0x53); /* Yellow */
+const QColor ColorUtils::expert_color_error = QColor (0xff, 0x5c, 0x5c); /* Pale red */
+const QColor ColorUtils::expert_color_foreground = QColor (0x00, 0x00, 0x00); /* Black */
+const QColor ColorUtils::hidden_proto_item = QColor (0x44, 0x44, 0x44); /* Gray */
ColorUtils::ColorUtils(QObject *parent) :
QObject(parent)
diff --git a/ui/qt/utils/data_printer.cpp b/ui/qt/utils/data_printer.cpp
index 260721ecad..39baab29a5 100644
--- a/ui/qt/utils/data_printer.cpp
+++ b/ui/qt/utils/data_printer.cpp
@@ -122,10 +122,10 @@ QString DataPrinter::hexTextDump(const QByteArray printData, bool showASCII)
QString dataStr;
int cnt = 0;
- while ( cnt < printData.length() )
+ while (cnt < printData.length())
{
byteStr += QString(" %1").arg((uint8_t) printData[cnt], 2, 16, QChar('0'));
- if ( showASCII )
+ if (showASCII)
{
QChar ch(printData[cnt]);
if (g_ascii_isprint(printData[cnt]))
@@ -137,23 +137,23 @@ QString DataPrinter::hexTextDump(const QByteArray printData, bool showASCII)
}
int lines = printData.length() / byteLineLength_;
- if ( printData.length() % byteLineLength_ > 0 )
+ if (printData.length() % byteLineLength_ > 0)
lines++;
- for ( cnt = 0; cnt < lines; cnt++ )
+ for (cnt = 0; cnt < lines; cnt++)
{
int offset = cnt * 0x10;
clipboard_text += QString("%1 ").arg(offset, 4, 16, QChar('0'));
clipboard_text += byteStr.mid(offset * 3, byteLineLength_ * 3);
- if ( showASCII )
+ if (showASCII)
{
/* separation bytes for byte and text */
clipboard_text += QString(3, ' ');
/* separation bytes last line */
- if ( cnt == ( lines - 1 ) )
+ if (cnt == (lines - 1) )
{
int remSpace = byteLineLength_ - dataStr.mid(offset, byteLineLength_).length();
clipboard_text += QString(remSpace * 3, ' ');
@@ -172,7 +172,7 @@ QString DataPrinter::hexTextDump(const QByteArray printData, bool showASCII)
DataPrinter * DataPrinter::instance()
{
static DataPrinter * inst = Q_NULLPTR;
- if ( inst == Q_NULLPTR )
+ if (inst == Q_NULLPTR)
inst = new DataPrinter();
return inst;
}
@@ -181,12 +181,12 @@ QActionGroup * DataPrinter::copyActions(QObject * copyClass, QObject * data)
{
QActionGroup * actions = new QActionGroup(copyClass);
- if ( ! data && ! dynamic_cast<IDataPrintable *>(copyClass) )
+ if (! data && ! dynamic_cast<IDataPrintable *>(copyClass))
return actions;
DataPrinter * dpi = DataPrinter::instance();
- if ( data )
+ if (data)
actions->setProperty("idataprintable", VariantPointer<QObject>::asQVariant(data));
else
actions->setProperty("idataprintable", VariantPointer<QObject>::asQVariant(copyClass));
@@ -227,15 +227,15 @@ QActionGroup * DataPrinter::copyActions(QObject * copyClass, QObject * data)
void DataPrinter::copyIDataBytes(bool /* state */)
{
- if ( ! dynamic_cast<QAction*>(sender()) )
+ if (! dynamic_cast<QAction*>(sender()))
return;
QAction * sendingAction = dynamic_cast<QAction *>(sender());
- if ( ! sendingAction->actionGroup() || ! sendingAction->actionGroup()->property("idataprintable").isValid() )
+ if (! sendingAction->actionGroup() || ! sendingAction->actionGroup()->property("idataprintable").isValid())
return;
QObject * dataObject = VariantPointer<QObject>::asPtr(sendingAction->actionGroup()->property("idataprintable"));
- if ( ! dataObject || ! dynamic_cast<IDataPrintable *>(dataObject) )
+ if (! dataObject || ! dynamic_cast<IDataPrintable *>(dataObject))
return;
int dump_type = sendingAction->property("printertype").toInt();
diff --git a/ui/qt/utils/field_information.cpp b/ui/qt/utils/field_information.cpp
index 876f8bdb6f..2648930c83 100644
--- a/ui/qt/utils/field_information.cpp
+++ b/ui/qt/utils/field_information.cpp
@@ -32,7 +32,7 @@ bool FieldInformation::isValid() const
{
bool ret = false;
- if ( fi_ && fi_->hfinfo )
+ if (fi_ && fi_->hfinfo)
{
if (fi_->hfinfo->blurb != NULL && fi_->hfinfo->blurb[0] != '\0') {
ret = true;
@@ -47,7 +47,7 @@ bool FieldInformation::isValid() const
bool FieldInformation::isLink() const
{
if (fi_ && fi_->hfinfo) {
- if((fi_->hfinfo->type == FT_FRAMENUM) ||
+ if ((fi_->hfinfo->type == FT_FRAMENUM) ||
(FI_GET_FLAG(fi_, FI_URL) && IS_FT_STRING(fi_->hfinfo->type))) {
return true;
}
@@ -78,7 +78,7 @@ FieldInformation::HeaderInfo FieldInformation::headerInfo() const
{
HeaderInfo header;
- if ( fi_ && fi_->hfinfo )
+ if (fi_ && fi_->hfinfo)
{
header.name = fi_->hfinfo->name;
header.description = fi_->hfinfo->blurb;
@@ -109,7 +109,7 @@ FieldInformation * FieldInformation::parentField() const
bool FieldInformation::tvbContains(FieldInformation *child)
{
- if ( fi_ && child && fi_->ds_tvb == child->fieldInfo()->ds_tvb )
+ if (fi_ && child && fi_->ds_tvb == child->fieldInfo()->ds_tvb)
return true;
return false;
@@ -153,7 +153,7 @@ QString FieldInformation::url()
FieldInformation::Position FieldInformation::position() const
{
Position pos = {-1, -1};
- if ( fi_ && fi_->ds_tvb )
+ if (fi_ && fi_->ds_tvb)
{
int len = (int) tvb_captured_length(fi_->ds_tvb);
@@ -162,7 +162,7 @@ FieldInformation::Position FieldInformation::position() const
if (pos.start < 0 || pos.length < 0 || pos.start >= len)
{
- if ( fi_->appendix_start >= 0 && fi_->appendix_length > 0 && fi_->appendix_start < len )
+ if (fi_->appendix_start >= 0 && fi_->appendix_length > 0 && fi_->appendix_start < len)
{
pos.start = fi_->appendix_start;
pos.length = fi_->appendix_length;
@@ -176,7 +176,7 @@ FieldInformation::Position FieldInformation::position() const
FieldInformation::Position FieldInformation::appendix() const
{
Position pos = {-1, -1};
- if ( fi_ && fi_->ds_tvb )
+ if (fi_ && fi_->ds_tvb)
{
pos.start = fi_->appendix_start;
pos.length = fi_->appendix_length;
@@ -189,15 +189,15 @@ const QByteArray FieldInformation::printableData()
{
QByteArray data;
- if ( fi_ && fi_->ds_tvb )
+ if (fi_ && fi_->ds_tvb)
{
FieldInformation::Position pos = position();
int rem_length = tvb_captured_length_remaining(fi_->ds_tvb, pos.start);
int length = pos.length;
- if ( length > rem_length )
+ if (length > rem_length)
length = rem_length;
- uint8_t * dataSet = (uint8_t *)tvb_memdup(wmem_file_scope(), fi_->ds_tvb, pos.start, length );
+ uint8_t * dataSet = (uint8_t *)tvb_memdup(wmem_file_scope(), fi_->ds_tvb, pos.start, length);
data = QByteArray::fromRawData((char *)dataSet, length);
}
diff --git a/ui/qt/utils/frame_information.cpp b/ui/qt/utils/frame_information.cpp
index dd34250441..3599d41aed 100644
--- a/ui/qt/utils/frame_information.cpp
+++ b/ui/qt/utils/frame_information.cpp
@@ -36,7 +36,7 @@ FrameInformation::FrameInformation(CaptureFile * capfile, frame_data * fi, QObje
void FrameInformation::loadFrameTree()
{
- if ( ! fi_ || ! cap_file_ || !cap_file_->capFile())
+ if (! fi_ || ! cap_file_ || !cap_file_->capFile())
return;
if (!cf_read_record(cap_file_->capFile(), fi_, &rec_, &buf_))
@@ -63,7 +63,7 @@ bool FrameInformation::isValid()
{
bool ret = false;
- if ( fi_ && cap_file_ && edt_.tvb )
+ if (fi_ && cap_file_ && edt_.tvb)
{
ret = true;
}
@@ -78,14 +78,14 @@ frame_data * FrameInformation::frameData() const
int FrameInformation::frameNum() const
{
- if ( ! fi_ )
+ if (! fi_)
return -1;
return fi_->num;
}
const QByteArray FrameInformation::printableData()
{
- if ( ! fi_ )
+ if (! fi_)
return QByteArray();
diff --git a/ui/qt/utils/proto_node.cpp b/ui/qt/utils/proto_node.cpp
index 75316401d4..a09a6ae8e6 100644
--- a/ui/qt/utils/proto_node.cpp
+++ b/ui/qt/utils/proto_node.cpp
@@ -73,7 +73,7 @@ int ProtoNode::childrenCount() const
int row_count = 0;
ChildIterator kids = children();
- while ( kids.element().isValid() )
+ while (kids.element().isValid())
{
row_count++;
kids.next();
@@ -90,15 +90,15 @@ int ProtoNode::row()
int cur_row = 0;
ProtoNode::ChildIterator kids = parentNode().children();
- while ( kids.element().isValid() )
+ while (kids.element().isValid())
{
- if ( kids.element().protoNode() == node_ ) {
+ if (kids.element().protoNode() == node_) {
break;
}
cur_row++;
kids.next();
}
- if ( ! kids.element().isValid() ) {
+ if (! kids.element().isValid()) {
return -1;
}
return cur_row;
@@ -134,7 +134,7 @@ ProtoNode::ChildIterator::ChildIterator(ProtoNode::ChildIterator::NodePtr n)
bool ProtoNode::ChildIterator::hasNext()
{
- if ( ! node || node->next == Q_NULLPTR )
+ if (! node || node->next == Q_NULLPTR)
return false;
return true;
}
diff --git a/ui/qt/utils/wireshark_zip_helper.cpp b/ui/qt/utils/wireshark_zip_helper.cpp
index 8d68f8f0a7..a32204d820 100644
--- a/ui/qt/utils/wireshark_zip_helper.cpp
+++ b/ui/qt/utils/wireshark_zip_helper.cpp
@@ -39,10 +39,10 @@ bool WireSharkZipHelper::unzip(QString zipFile, QString directory, bool (*fileCh
QDir di(directory);
int files = 0;
- if ( ! fi.exists() || ! di.exists() )
+ if (! fi.exists() || ! di.exists())
return false;
- if ( ( uf = unzOpen64(zipFile.toUtf8().constData()) ) == Q_NULLPTR )
+ if ((uf = unzOpen64(zipFile.toUtf8().constData())) == Q_NULLPTR)
return false;
unz_global_info64 gi;
@@ -54,35 +54,35 @@ bool WireSharkZipHelper::unzip(QString zipFile, QString directory, bool (*fileCh
QMap<QString, QString> cleanPaths;
- for ( unsigned int cnt = 0; cnt < nmbr; cnt++ )
+ for (unsigned int cnt = 0; cnt < nmbr; cnt++)
{
char filename_inzip[256];
unz_file_info64 file_info;
err = unzGetCurrentFileInfo64(uf, &file_info, filename_inzip, sizeof(filename_inzip),
Q_NULLPTR, 0, Q_NULLPTR, 0);
- if ( err == UNZ_OK )
+ if (err == UNZ_OK)
{
QString fileInZip(filename_inzip);
int fileSize = static_cast<int>(file_info.uncompressed_size);
/* Sanity check for the filen */
- if ( fileInZip.length() == 0 || ( fileCheck && ! fileCheck(fileInZip, fileSize) ) )
+ if (fileInZip.length() == 0 || (fileCheck && ! fileCheck(fileInZip, fileSize)) )
continue;
- if ( di.exists() )
+ if (di.exists())
{
QString fullPath = di.path() + QDir::separator() + fileInZip;
QFileInfo fi(fullPath);
QString dirPath = fi.absolutePath();
/* clean up name from import. e.g. illegal characters in name */
- if ( cleanName )
+ if (cleanName)
{
- if ( ! cleanPaths.keys().contains(dirPath) )
+ if (! cleanPaths.keys().contains(dirPath))
{
QString tempPath = cleanName(dirPath);
int cnt = 1;
- while ( QFile::exists(tempPath) )
+ while (QFile::exists(tempPath))
{
tempPath = cleanName(dirPath) + QString::number(cnt);
cnt++;
@@ -91,32 +91,32 @@ bool WireSharkZipHelper::unzip(QString zipFile, QString directory, bool (*fileCh
}
dirPath = cleanPaths[dirPath];
- if ( dirPath.length() == 0 )
+ if (dirPath.length() == 0)
continue;
fi = QFileInfo(dirPath + QDir::separator() + fi.fileName());
fullPath = fi.absoluteFilePath();
}
- if ( fullPath.length() == 0 )
+ if (fullPath.length() == 0)
continue;
QDir tP(fi.absolutePath());
- if ( ! tP.exists() )
+ if (! tP.exists())
di.mkpath(fi.absolutePath());
- if ( fileInZip.contains("/") )
+ if (fileInZip.contains("/"))
{
QString filePath = fi.absoluteFilePath();
QFile file(filePath);
- if ( ! file.exists() )
+ if (! file.exists())
{
err = unzOpenCurrentFile(uf);
- if ( err == UNZ_OK )
+ if (err == UNZ_OK)
{
char * buf = static_cast<char *>(malloc(IO_BUF_SIZE));
- if ( file.open(QIODevice::WriteOnly) )
+ if (file.open(QIODevice::WriteOnly))
{
- while ( ( err = unzReadCurrentFile(uf, buf, IO_BUF_SIZE) ) != UNZ_EOF )
+ while ((err = unzReadCurrentFile(uf, buf, IO_BUF_SIZE)) != UNZ_EOF)
file.write(buf, err);
file.close();
@@ -155,9 +155,9 @@ unsigned long qDateToDosDate(QDateTime time)
QDate ld = time.toLocalTime().date();
int year = ld.year() - 1900;
- if ( year >= 1980 )
+ if (year >= 1980)
year -= 1980;
- else if ( year >= 80 )
+ else if (year >= 80)
year -= 80;
else
year += 20;
@@ -165,7 +165,7 @@ unsigned long qDateToDosDate(QDateTime time)
int month = ld.month() - 1;
int day = ld.day();
- if ( year < 0 || year > 207 || month < 1 || month > 31 )
+ if (year < 0 || year > 207 || month < 1 || month > 31)
return 0;
QTime lt = time.toLocalTime().time();
@@ -189,23 +189,23 @@ void WireSharkZipHelper::addFileToZip(zipFile zf, QString filepath, QString file
QFile fh(filepath);
/* Checks if a large file block has to be written */
- bool isLarge = ( fh.size() > UINT32_MAX );
+ bool isLarge = (fh.size() > UINT32_MAX);
err = zipOpenNewFileInZip3_64(zf, fileInZip.toUtf8().constData(), &zi,
Q_NULLPTR, 0, Q_NULLPTR, 0, Q_NULLPTR, Z_DEFLATED, 9 , 0,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
Q_NULLPTR, 0, static_cast<int>(isLarge));
- if ( err != ZIP_OK )
+ if (err != ZIP_OK)
return;
- if ( fh.open(QIODevice::ReadOnly) )
+ if (fh.open(QIODevice::ReadOnly))
{
char * buf = static_cast<char *>(malloc(IO_BUF_SIZE));
- while ( ! fh.atEnd() && err == ZIP_OK )
+ while (! fh.atEnd() && err == ZIP_OK)
{
qint64 bytesIn = fh.read(buf, IO_BUF_SIZE);
- if ( bytesIn > 0 && bytesIn <= IO_BUF_SIZE)
+ if (bytesIn > 0 && bytesIn <= IO_BUF_SIZE)
{
err = zipWriteInFileInZip(zf, buf, (unsigned int) bytesIn);
}
@@ -221,27 +221,27 @@ bool WireSharkZipHelper::zip(QString fileName, QStringList files, QString relati
{
QFileInfo fi(fileName);
- if ( fi.exists() )
+ if (fi.exists())
QFile::remove(fileName);
zipFile zf = zipOpen(fileName.toUtf8().constData(), APPEND_STATUS_CREATE);
- if ( zf == Q_NULLPTR )
+ if (zf == Q_NULLPTR)
return false;
- for ( int cnt = 0; cnt < files.count(); cnt++ )
+ for (int cnt = 0; cnt < files.count(); cnt++)
{
QFileInfo sf(files.at(cnt));
QString fileInZip = sf.absoluteFilePath();
fileInZip.replace(relativeTo, "");
/* Windows cannot open zip files, if the filenames starts with a separator */
- while ( fileInZip.length() > 0 && fileInZip.startsWith(QDir::separator()) )
+ while (fileInZip.length() > 0 && fileInZip.startsWith(QDir::separator()))
fileInZip = fileInZip.right(fileInZip.length() - 1);
WireSharkZipHelper::addFileToZip(zf, sf.absoluteFilePath(), fileInZip);
}
- if ( zipClose(zf, Q_NULLPTR) )
+ if (zipClose(zf, Q_NULLPTR))
return false;
return true;
diff --git a/ui/qt/utils/wireshark_zip_helper.h b/ui/qt/utils/wireshark_zip_helper.h
index fb853eb65c..57e8751e16 100644
--- a/ui/qt/utils/wireshark_zip_helper.h
+++ b/ui/qt/utils/wireshark_zip_helper.h
@@ -24,7 +24,7 @@ class WireSharkZipHelper
{
public:
static bool zip(QString zipFile, QStringList files, QString relativeTo = QString());
- static bool unzip(QString zipFile, QString directory, bool (*fileCheck)(QString fileName, int fileSize) = Q_NULLPTR, QString (*cleanName)(QString name) = Q_NULLPTR );
+ static bool unzip(QString zipFile, QString directory, bool (*fileCheck)(QString fileName, int fileSize) = Q_NULLPTR, QString (*cleanName)(QString name) = Q_NULLPTR);
protected:
static void addFileToZip(zipFile zf, QString filepath, QString fileInZip);
diff --git a/ui/qt/voip_calls_dialog.cpp b/ui/qt/voip_calls_dialog.cpp
index dffe5deb98..09767b55c9 100644
--- a/ui/qt/voip_calls_dialog.cpp
+++ b/ui/qt/voip_calls_dialog.cpp
@@ -67,7 +67,7 @@ VoipCallsDialog::VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flow
sequence_button_ = ui->buttonBox->addButton(tr("Flow Sequence"), QDialogButtonBox::ApplyRole);
player_button_ = RtpPlayerDialog::addPlayerButton(ui->buttonBox);
- connect ( ui->todCheckBox, &QAbstractButton::toggled, this, &VoipCallsDialog::switchTimeOfDay);
+ connect (ui->todCheckBox, &QAbstractButton::toggled, this, &VoipCallsDialog::switchTimeOfDay);
copy_button_ = ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ApplyRole);
QMenu *copy_menu = new QMenu(copy_button_);
@@ -130,7 +130,7 @@ void VoipCallsDialog::contextMenuEvent(QContextMenuEvent *event)
{
bool selected = ui->callTreeView->selectionModel()->hasSelection();
- if ( ! selected )
+ if (! selected)
return;
QMenu popupMenu;
@@ -257,7 +257,7 @@ void VoipCallsDialog::prepareFilter()
/* Build a new filter based on frame numbers */
foreach (QModelIndex index, ui->callTreeView->selectionModel()->selectedIndexes()) {
- if ( index.isValid() && ! rows.contains(index.row()) )
+ if (index.isValid() && ! rows.contains(index.row()))
{
voip_calls_info_t *call_info = VoipCallsInfoModel::indexToCallInfo(index);
if (!call_info) {
diff --git a/ui/qt/widgets/additional_toolbar.cpp b/ui/qt/widgets/additional_toolbar.cpp
index 3afe079a13..38085afd3c 100644
--- a/ui/qt/widgets/additional_toolbar.cpp
+++ b/ui/qt/widgets/additional_toolbar.cpp
@@ -40,7 +40,7 @@ AdditionalToolBar::~AdditionalToolBar()
AdditionalToolBar * AdditionalToolBar::create(QWidget * parent, ext_toolbar_t * toolbar)
{
- if ( g_list_length( toolbar->children ) == 0 )
+ if (g_list_length(toolbar->children) == 0)
return NULL;
AdditionalToolBar * result = new AdditionalToolBar(toolbar, parent);
@@ -52,16 +52,16 @@ AdditionalToolBar * AdditionalToolBar::create(QWidget * parent, ext_toolbar_t *
GList * walker = toolbar->children;
bool spacerNeeded = true;
- while ( walker && walker->data )
+ while (walker && walker->data)
{
ext_toolbar_t * item = gxx_list_data(ext_toolbar_t *, walker);
- if ( item->type == EXT_TOOLBAR_ITEM )
+ if (item->type == EXT_TOOLBAR_ITEM)
{
- if ( item->item_type == EXT_TOOLBAR_STRING )
+ if (item->item_type == EXT_TOOLBAR_STRING)
spacerNeeded = false;
QAction * newAction = new AdditionalToolbarWidgetAction(item, result);
- if ( newAction )
+ if (newAction)
{
result->addAction(newAction);
/* Necessary, because enable state is reset upon adding the action */
@@ -69,13 +69,13 @@ AdditionalToolBar * AdditionalToolBar::create(QWidget * parent, ext_toolbar_t *
}
}
- walker = gxx_list_next ( walker );
+ walker = gxx_list_next (walker);
}
- if ( result->children().count() == 0 )
+ if (result->children().count() == 0)
return Q_NULLPTR;
- if ( spacerNeeded )
+ if (spacerNeeded)
{
QWidget * empty = new QWidget();
empty->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
@@ -113,7 +113,7 @@ AdditionalToolbarWidgetAction::AdditionalToolbarWidgetAction(const AdditionalToo
void AdditionalToolbarWidgetAction::captureActive(int activeCaptures)
{
- if ( toolbar_item && toolbar_item->capture_only )
+ if (toolbar_item && toolbar_item->capture_only)
{
setEnabled(activeCaptures != 0);
}
@@ -126,10 +126,10 @@ QWidget * AdditionalToolbarWidgetAction::createWidget(QWidget * parent)
{
QWidget * barItem = 0;
- if ( toolbar_item->type != EXT_TOOLBAR_ITEM )
+ if (toolbar_item->type != EXT_TOOLBAR_ITEM)
return barItem;
- switch ( toolbar_item->item_type )
+ switch (toolbar_item->item_type)
{
case EXT_TOOLBAR_BUTTON:
barItem = createButton(toolbar_item, parent);
@@ -145,7 +145,7 @@ QWidget * AdditionalToolbarWidgetAction::createWidget(QWidget * parent)
break;
}
- if ( ! barItem )
+ if (! barItem)
return 0;
barItem->setToolTip(toolbar_item->tooltip);
@@ -161,17 +161,17 @@ QWidget * AdditionalToolbarWidgetAction::createWidget(QWidget * parent)
static void
toolbar_button_cb(gpointer item, gpointer item_data, gpointer user_data)
{
- if ( ! item || ! item_data || ! user_data )
+ if (! item || ! item_data || ! user_data)
return;
QPushButton * widget = (QPushButton *)(item_data);
ext_toolbar_update_t * update_entry = (ext_toolbar_update_t *)user_data;
- if ( widget )
+ if (widget)
{
- if ( update_entry->type == EXT_TOOLBAR_UPDATE_VALUE )
+ if (update_entry->type == EXT_TOOLBAR_UPDATE_VALUE)
widget->setText((gchar *)update_entry->user_data);
- else if ( update_entry->type == EXT_TOOLBAR_SET_ACTIVE )
+ else if (update_entry->type == EXT_TOOLBAR_SET_ACTIVE)
{
bool enableState = GPOINTER_TO_INT(update_entry->user_data) == 1;
widget->setEnabled(enableState);
@@ -182,7 +182,7 @@ toolbar_button_cb(gpointer item, gpointer item_data, gpointer user_data)
QWidget * AdditionalToolbarWidgetAction::createButton(ext_toolbar_t * item, QWidget * parent)
{
- if ( ! item || item->type != EXT_TOOLBAR_ITEM || item->item_type != EXT_TOOLBAR_BUTTON )
+ if (! item || item->type != EXT_TOOLBAR_ITEM || item->item_type != EXT_TOOLBAR_BUTTON)
return 0;
QPushButton * button = new QPushButton(item->name, parent);
@@ -197,25 +197,25 @@ QWidget * AdditionalToolbarWidgetAction::createButton(ext_toolbar_t * item, QWid
static void
toolbar_boolean_cb(gpointer item, gpointer item_data, gpointer user_data)
{
- if ( ! item || ! item_data || ! user_data )
+ if (! item || ! item_data || ! user_data)
return;
QCheckBox * widget = (QCheckBox *)(item_data);
ext_toolbar_update_t * update_entry = (ext_toolbar_update_t *)user_data;
- if ( update_entry->type == EXT_TOOLBAR_UPDATE_VALUE )
+ if (update_entry->type == EXT_TOOLBAR_UPDATE_VALUE)
{
bool oldState = false;
- if ( update_entry->silent )
+ if (update_entry->silent)
oldState = widget->blockSignals(true);
widget->setCheckState(GPOINTER_TO_INT(update_entry->user_data) == 1 ? Qt::Checked : Qt::Unchecked);
- if ( update_entry->silent )
+ if (update_entry->silent)
widget->blockSignals(oldState);
}
- else if ( update_entry->type == EXT_TOOLBAR_SET_ACTIVE )
+ else if (update_entry->type == EXT_TOOLBAR_SET_ACTIVE)
{
bool enableState = GPOINTER_TO_INT(update_entry->user_data) == 1;
widget->setEnabled(enableState);
@@ -224,7 +224,7 @@ toolbar_boolean_cb(gpointer item, gpointer item_data, gpointer user_data)
QWidget * AdditionalToolbarWidgetAction::createBoolean(ext_toolbar_t * item, QWidget * parent)
{
- if ( ! item || item->type != EXT_TOOLBAR_ITEM || item->item_type != EXT_TOOLBAR_BOOLEAN )
+ if (! item || item->type != EXT_TOOLBAR_ITEM || item->item_type != EXT_TOOLBAR_BOOLEAN)
return 0;
QString defValue = toolbar_item->defvalue;
@@ -242,7 +242,7 @@ QWidget * AdditionalToolbarWidgetAction::createBoolean(ext_toolbar_t * item, QWi
QWidget * AdditionalToolbarWidgetAction::createLabelFrame(ext_toolbar_t * item, QWidget * parent)
{
- if ( ! item )
+ if (! item)
return new QWidget();
QWidget * frame = new QWidget(parent);
@@ -269,25 +269,25 @@ QWidget * AdditionalToolbarWidgetAction::createLabelFrame(ext_toolbar_t * item,
static void
toolbar_string_cb(gpointer item, gpointer item_data, gpointer user_data)
{
- if ( ! item || ! item_data || ! user_data )
+ if (! item || ! item_data || ! user_data)
return;
ApplyLineEdit * edit = (ApplyLineEdit *)(item_data);
ext_toolbar_update_t * update_entry = (ext_toolbar_update_t *)user_data;
- if ( update_entry->type == EXT_TOOLBAR_UPDATE_VALUE )
+ if (update_entry->type == EXT_TOOLBAR_UPDATE_VALUE)
{
bool oldState = false;
- if ( update_entry->silent )
+ if (update_entry->silent)
oldState = edit->blockSignals(true);
edit->setText((gchar *)update_entry->user_data);
- if ( update_entry->silent )
+ if (update_entry->silent)
edit->blockSignals(oldState);
}
- else if ( update_entry->type == EXT_TOOLBAR_SET_ACTIVE )
+ else if (update_entry->type == EXT_TOOLBAR_SET_ACTIVE)
{
bool enableState = GPOINTER_TO_INT(update_entry->user_data) == 1;
edit->setEnabled(enableState);
@@ -296,7 +296,7 @@ toolbar_string_cb(gpointer item, gpointer item_data, gpointer user_data)
QWidget * AdditionalToolbarWidgetAction::createTextEditor(ext_toolbar_t * item, QWidget * parent)
{
- if ( ! item || item->type != EXT_TOOLBAR_ITEM || item->item_type != EXT_TOOLBAR_STRING )
+ if (! item || item->type != EXT_TOOLBAR_ITEM || item->item_type != EXT_TOOLBAR_STRING)
return 0;
QWidget * frame = createLabelFrame(toolbar_item, parent);
@@ -323,7 +323,7 @@ QWidget * AdditionalToolbarWidgetAction::createTextEditor(ext_toolbar_t * item,
static void
toolbar_selector_cb(gpointer item, gpointer item_data, gpointer user_data)
{
- if ( ! item || ! item_data || ! user_data )
+ if (! item || ! item_data || ! user_data)
return;
QComboBox * comboBox = (QComboBox *)(item_data);
@@ -331,43 +331,43 @@ toolbar_selector_cb(gpointer item, gpointer item_data, gpointer user_data)
bool oldState = false;
- if ( update_entry->silent )
+ if (update_entry->silent)
oldState = comboBox->blockSignals(true);
QStandardItemModel * sourceModel = (QStandardItemModel *)comboBox->model();
- if ( update_entry->type == EXT_TOOLBAR_SET_ACTIVE )
+ if (update_entry->type == EXT_TOOLBAR_SET_ACTIVE)
{
bool enableState = GPOINTER_TO_INT(update_entry->user_data) == 1;
comboBox->setEnabled(enableState);
}
- else if ( update_entry->type != EXT_TOOLBAR_UPDATE_DATA_REMOVE && ! update_entry->user_data )
+ else if (update_entry->type != EXT_TOOLBAR_UPDATE_DATA_REMOVE && ! update_entry->user_data)
return;
- if ( update_entry->type == EXT_TOOLBAR_UPDATE_VALUE )
+ if (update_entry->type == EXT_TOOLBAR_UPDATE_VALUE)
{
QString data = QString((gchar *)update_entry->user_data);
- for(int i = 0; i < sourceModel->rowCount(); i++)
+ for (int i = 0; i < sourceModel->rowCount(); i++)
{
QStandardItem * dataValue = ((QStandardItemModel *)sourceModel)->item(i, 0);
ext_toolbar_value_t * tbValue = VariantPointer<ext_toolbar_value_t>::asPtr(dataValue->data(Qt::UserRole));
- if ( tbValue && data.compare(QString(tbValue->value)) == 0 )
+ if (tbValue && data.compare(QString(tbValue->value)) == 0)
{
comboBox->setCurrentIndex(i);
break;
}
}
}
- else if ( update_entry->type == EXT_TOOLBAR_UPDATE_DATA )
+ else if (update_entry->type == EXT_TOOLBAR_UPDATE_DATA)
{
GList * walker = (GList *)update_entry->user_data;
- if ( g_list_length(walker) == 0 )
+ if (g_list_length(walker) == 0)
return;
sourceModel->clear();
- while ( walker && walker->data )
+ while (walker && walker->data)
{
ext_toolbar_value_t * listvalue = gxx_list_data(ext_toolbar_value_t *, walker);
@@ -378,23 +378,23 @@ toolbar_selector_cb(gpointer item, gpointer item_data, gpointer user_data)
walker = gxx_list_next(walker);
}
}
- else if ( update_entry->type == EXT_TOOLBAR_UPDATE_DATABYINDEX ||
+ else if (update_entry->type == EXT_TOOLBAR_UPDATE_DATABYINDEX ||
update_entry->type == EXT_TOOLBAR_UPDATE_DATA_ADD ||
- update_entry->type == EXT_TOOLBAR_UPDATE_DATA_REMOVE )
+ update_entry->type == EXT_TOOLBAR_UPDATE_DATA_REMOVE)
{
- if ( ! update_entry->data_index )
+ if (! update_entry->data_index)
return;
gchar * idx = (gchar *)update_entry->data_index;
gchar * display = (gchar *)update_entry->user_data;
- if ( update_entry->type == EXT_TOOLBAR_UPDATE_DATABYINDEX )
+ if (update_entry->type == EXT_TOOLBAR_UPDATE_DATABYINDEX)
{
- for ( int i = 0; i < sourceModel->rowCount(); i++ )
+ for (int i = 0; i < sourceModel->rowCount(); i++)
{
QStandardItem * dataValue = sourceModel->item(i, 0);
ext_toolbar_value_t * entry = VariantPointer<ext_toolbar_value_t>::asPtr(dataValue->data(Qt::UserRole));
- if ( entry && g_strcmp0( entry->value, idx) == 0 )
+ if (entry && g_strcmp0(entry->value, idx) == 0)
{
g_free(entry->display);
entry->display = g_strdup(display);
@@ -404,7 +404,7 @@ toolbar_selector_cb(gpointer item, gpointer item_data, gpointer user_data)
}
}
}
- else if ( update_entry->type == EXT_TOOLBAR_UPDATE_DATA_ADD )
+ else if (update_entry->type == EXT_TOOLBAR_UPDATE_DATA_ADD)
{
ext_toolbar_value_t * listvalue = g_new0(ext_toolbar_value_t, 1);
listvalue->display = g_strdup(display);
@@ -414,33 +414,33 @@ toolbar_selector_cb(gpointer item, gpointer item_data, gpointer user_data)
si->setData(VariantPointer<ext_toolbar_value_t>::asQVariant(listvalue), Qt::UserRole);
sourceModel->appendRow(si);
}
- else if ( update_entry->type == EXT_TOOLBAR_UPDATE_DATA_REMOVE )
+ else if (update_entry->type == EXT_TOOLBAR_UPDATE_DATA_REMOVE)
{
QList<QStandardItem *> entryList = sourceModel->findItems(display);
/* Search for index if display did not find anything */
- if ( entryList.size() == 0 )
+ if (entryList.size() == 0)
entryList = sourceModel->findItems(idx);
foreach(QStandardItem *entry, entryList)
{
QModelIndex index = sourceModel->indexFromItem(entry);
- if ( index.isValid() )
+ if (index.isValid())
sourceModel->removeRow(index.row());
}
}
}
- if ( update_entry->silent )
+ if (update_entry->silent)
comboBox->blockSignals(oldState);
}
QWidget * AdditionalToolbarWidgetAction::createSelector(ext_toolbar_t * item, QWidget * parent)
{
- if ( ! item || item->type != EXT_TOOLBAR_ITEM || item->item_type != EXT_TOOLBAR_SELECTOR )
+ if (! item || item->type != EXT_TOOLBAR_ITEM || item->item_type != EXT_TOOLBAR_SELECTOR)
return 0;
- if ( g_list_length(item->values) == 0 )
+ if (g_list_length(item->values) == 0)
return 0;
QWidget * frame = createLabelFrame(item, parent);
@@ -452,7 +452,7 @@ QWidget * AdditionalToolbarWidgetAction::createSelector(ext_toolbar_t * item, QW
GList * walker = item->values;
int selIndex = 0;
- while ( walker && walker->data )
+ while (walker && walker->data)
{
ext_toolbar_value_t * listvalue = gxx_list_data(ext_toolbar_value_t *, walker);
@@ -460,7 +460,7 @@ QWidget * AdditionalToolbarWidgetAction::createSelector(ext_toolbar_t * item, QW
si->setData(VariantPointer<ext_toolbar_value_t>::asQVariant(listvalue), Qt::UserRole);
sourceModel->appendRow(si);
- if ( listvalue->is_default )
+ if (listvalue->is_default)
selIndex = sourceModel->rowCount();
walker = gxx_list_next(walker);
@@ -486,22 +486,22 @@ QWidget * AdditionalToolbarWidgetAction::createSelector(ext_toolbar_t * item, QW
ext_toolbar_t * AdditionalToolbarWidgetAction::extractToolbarItemFromObject(QObject * object)
{
QWidget * widget = dynamic_cast<QWidget *>(object);
- if ( ! widget )
+ if (! widget)
return 0;
QVariant propValue = widget->property(propertyName);
/* If property is invalid, look if our parent has this property */
- if ( ! propValue.isValid() )
+ if (! propValue.isValid())
{
QWidget * frame = dynamic_cast<QWidget *>(widget->parent());
- if ( ! frame )
+ if (! frame)
return 0;
propValue = frame->property(propertyName);
}
- if ( ! propValue.isValid() )
+ if (! propValue.isValid())
return 0;
return VariantPointer<ext_toolbar_t>::asPtr(propValue);
@@ -510,7 +510,7 @@ ext_toolbar_t * AdditionalToolbarWidgetAction::extractToolbarItemFromObject(QObj
void AdditionalToolbarWidgetAction::onButtonClicked()
{
ext_toolbar_t * item = extractToolbarItemFromObject(sender());
- if ( ! item )
+ if (! item)
return;
item->callback(item, 0, item->user_data);
@@ -519,7 +519,7 @@ void AdditionalToolbarWidgetAction::onButtonClicked()
void AdditionalToolbarWidgetAction::onCheckBoxChecked(int checkState)
{
ext_toolbar_t * item = extractToolbarItemFromObject(sender());
- if ( ! item )
+ if (! item)
return;
gboolean value = checkState == Qt::Checked ? true : false;
@@ -530,26 +530,26 @@ void AdditionalToolbarWidgetAction::onCheckBoxChecked(int checkState)
void AdditionalToolbarWidgetAction::sendTextToCallback()
{
ext_toolbar_t * item = extractToolbarItemFromObject(sender());
- if ( ! item )
+ if (! item)
return;
- if (item->item_type != EXT_TOOLBAR_STRING )
+ if (item->item_type != EXT_TOOLBAR_STRING)
return;
ApplyLineEdit * editor = dynamic_cast<ApplyLineEdit *>(sender());
- if ( ! editor )
+ if (! editor)
{
/* Called from button, searching for acompanying line edit */
QWidget * parent = dynamic_cast<QWidget *>(sender()->parent());
- if ( parent )
+ if (parent)
{
QList<ApplyLineEdit *> children = parent->findChildren<ApplyLineEdit *>();
- if ( children.count() >= 0 )
+ if (children.count() >= 0)
editor = children.at(0);
}
}
- if ( editor )
+ if (editor)
item->callback(item, qstring_strdup(editor->text()), item->user_data);
}
@@ -557,16 +557,16 @@ void AdditionalToolbarWidgetAction::onSelectionInWidgetChanged(int idx)
{
QComboBox * editor = dynamic_cast<QComboBox *>(sender());
ext_toolbar_t * item = extractToolbarItemFromObject(editor);
- if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR )
+ if (! item || item->item_type != EXT_TOOLBAR_SELECTOR)
return;
QStandardItemModel * sourceModel = (QStandardItemModel *) editor->model();
- if ( sourceModel->rowCount() <= idx )
+ if (sourceModel->rowCount() <= idx)
return;
QModelIndex mdIdx = sourceModel->index(idx, 0);
QVariant dataSet = sourceModel->data(mdIdx, Qt::UserRole);
- if ( dataSet.isValid() )
+ if (dataSet.isValid())
{
ext_toolbar_value_t * value_entry = VariantPointer<ext_toolbar_value_t>::asPtr(dataSet);
item->callback(item, value_entry, item->user_data);
diff --git a/ui/qt/widgets/apply_line_edit.cpp b/ui/qt/widgets/apply_line_edit.cpp
index 83ed8d6b6a..c0d909cac2 100644
--- a/ui/qt/widgets/apply_line_edit.cpp
+++ b/ui/qt/widgets/apply_line_edit.cpp
@@ -80,21 +80,21 @@ bool ApplyLineEdit::emptyAllowed()
bool ApplyLineEdit::isValidText(QString & text, bool ignoreEmptyCheck)
{
- if ( text.length() == 0 )
+ if (text.length() == 0)
{
- if ( ! ignoreEmptyCheck && ! emptyAllowed_ )
+ if (! ignoreEmptyCheck && ! emptyAllowed_)
return false;
- else if ( ignoreEmptyCheck )
+ else if (ignoreEmptyCheck)
return true;
}
- if ( regex_.length() > 0 )
+ if (regex_.length() > 0)
{
- QRegExp rx ( regex_ );
+ QRegExp rx (regex_);
QRegExpValidator v(rx, 0);
int pos = 0;
- if ( ! rx.isValid() || v.validate(text, pos) != QValidator::Acceptable )
+ if (! rx.isValid() || v.validate(text, pos) != QValidator::Acceptable)
return false;
}
@@ -136,7 +136,7 @@ void ApplyLineEdit::resizeEvent(QResizeEvent *)
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
QSize apsz = apply_button_->sizeHint();
- apply_button_->move((contentsRect().right() + pos().x()) - ( frameWidth + apsz.width() ) - 2,
+ apply_button_->move((contentsRect().right() + pos().x()) - (frameWidth + apsz.width()) - 2,
contentsRect().top() + pos().y());
apply_button_->setMinimumHeight(height());
@@ -146,7 +146,7 @@ void ApplyLineEdit::resizeEvent(QResizeEvent *)
void ApplyLineEdit::onSubmitContent()
{
QString data = text();
- if ( ! isValidText(data) )
+ if (! isValidText(data))
return;
/* Freeze apply button to signal the text has been sent. Will be unfreezed, if the text in the textbox changes again */
diff --git a/ui/qt/widgets/byte_view_text.cpp b/ui/qt/widgets/byte_view_text.cpp
index 71fa7cf82d..70089ac56d 100644
--- a/ui/qt/widgets/byte_view_text.cpp
+++ b/ui/qt/widgets/byte_view_text.cpp
@@ -203,7 +203,7 @@ void ByteViewText::paintEvent(QPaintEvent *)
painter.fillRect(offset_rect, palette().window());
}
- if ( data_.isEmpty() ) {
+ if (data_.isEmpty()) {
return;
}
@@ -213,7 +213,7 @@ void ByteViewText::paintEvent(QPaintEvent *)
painter.save();
x_pos_to_column_.clear();
- while( (int) (row_y + line_height_) < widget_height && offset < (int) data_.count()) {
+ while ((int) (row_y + line_height_) < widget_height && offset < (int) data_.count()) {
drawLine(&painter, offset, row_y);
offset += row_width_;
row_y += line_height_ + leading;
diff --git a/ui/qt/widgets/capture_filter_edit.cpp b/ui/qt/widgets/capture_filter_edit.cpp
index 8c17062c55..90060e5721 100644
--- a/ui/qt/widgets/capture_filter_edit.cpp
+++ b/ui/qt/widgets/capture_filter_edit.cpp
@@ -315,7 +315,7 @@ QPair<const QString, bool> CaptureFilterEdit::getSelectedFilter()
void CaptureFilterEdit::checkFilter(const QString& filter)
{
- if ( text().length() == 0 && actions_ && actions_->checkedAction() )
+ if (text().length() == 0 && actions_ && actions_->checkedAction())
actions_->checkedAction()->setChecked(false);
setSyntaxState(Busy);
@@ -329,7 +329,7 @@ void CaptureFilterEdit::checkFilter(const QString& filter)
FilterListModel model(FilterListModel::Capture);
QModelIndex idx = model.findByExpression(text());
- if ( idx.isValid() ) {
+ if (idx.isValid()) {
match = true;
bookmark_button_->setStockIcon("x-filter-matching-bookmark");
@@ -391,10 +391,10 @@ void CaptureFilterEdit::updateBookmarkMenu()
int one_em = bb_menu->fontMetrics().height();
- if ( ! actions_ )
+ if (! actions_)
actions_ = new QActionGroup(this);
- for(int row = 0; row < model.rowCount(); row++)
+ for (int row = 0; row < model.rowCount(); row++)
{
QModelIndex nameIdx = model.index(row, FilterListModel::ColumnName);
QString name = nameIdx.data().toString();
@@ -404,7 +404,7 @@ void CaptureFilterEdit::updateBookmarkMenu()
prep_text = bb_menu->fontMetrics().elidedText(prep_text, Qt::ElideRight, one_em * 40);
QAction * prep_action = bb_menu->addAction(prep_text);
prep_action->setCheckable(true);
- if ( nameIdx == idx )
+ if (nameIdx == idx)
prep_action->setChecked(true);
actions_->addAction(prep_action);
@@ -509,18 +509,18 @@ void CaptureFilterEdit::saveFilter()
void CaptureFilterEdit::removeFilter()
{
- if ( ! actions_ && ! actions_->checkedAction() )
+ if (! actions_ && ! actions_->checkedAction())
return;
QAction *ra = actions_->checkedAction();
- if ( ra->property("capture_filter").toString().isEmpty() )
+ if (ra->property("capture_filter").toString().isEmpty())
return;
QString remove_filter = ra->property("capture_filter").toString();
FilterListModel model(FilterListModel::Capture);
QModelIndex idx = model.findByExpression(remove_filter);
- if ( idx.isValid() )
+ if (idx.isValid())
{
model.removeFilter(idx);
model.saveList();
@@ -540,7 +540,7 @@ void CaptureFilterEdit::showFilters()
void CaptureFilterEdit::prepareFilter()
{
QAction *pa = qobject_cast<QAction*>(sender());
- if ( ! pa || pa->property("capture_filter").toString().isEmpty() )
+ if (! pa || pa->property("capture_filter").toString().isEmpty())
return;
QString filter = pa->property("capture_filter").toString();
diff --git a/ui/qt/widgets/clickable_label.cpp b/ui/qt/widgets/clickable_label.cpp
index 1b7ca02537..e6b86cdaa6 100644
--- a/ui/qt/widgets/clickable_label.cpp
+++ b/ui/qt/widgets/clickable_label.cpp
@@ -31,9 +31,9 @@ void ClickableLabel::mouseReleaseEvent(QMouseEvent * event)
/* It has to be ensured, that if the user clicks on the label and then moves away out of
* the scope of the widget, the event does not fire. Otherwise this behavior differs from
* the way, the toolbar buttons work for instance */
- if ( event->pos().x() < 0 || event->pos().x() > size().width() )
+ if (event->pos().x() < 0 || event->pos().x() > size().width())
return;
- if ( event->pos().y() < 0 || event->pos().y() > size().height() )
+ if (event->pos().y() < 0 || event->pos().y() > size().height())
return;
emit clicked();
diff --git a/ui/qt/widgets/clickable_label.h b/ui/qt/widgets/clickable_label.h
index 1e2445ba06..eb69b484f8 100644
--- a/ui/qt/widgets/clickable_label.h
+++ b/ui/qt/widgets/clickable_label.h
@@ -18,7 +18,7 @@ class ClickableLabel : public QLabel
{
Q_OBJECT
public:
- explicit ClickableLabel( QWidget* parent=0 );
+ explicit ClickableLabel(QWidget* parent=0);
signals:
void clicked();
diff --git a/ui/qt/widgets/copy_from_profile_button.cpp b/ui/qt/widgets/copy_from_profile_button.cpp
index 1093439252..805d7e5b15 100644
--- a/ui/qt/widgets/copy_from_profile_button.cpp
+++ b/ui/qt/widgets/copy_from_profile_button.cpp
@@ -21,13 +21,13 @@ CopyFromProfileButton::CopyFromProfileButton(QWidget * parent, QString fileName,
buttonMenu_(Q_NULLPTR)
{
setText(tr("Copy from"));
- if ( toolTip.length() == 0 )
+ if (toolTip.length() == 0)
setToolTip(tr("Copy entries from another profile."));
else {
setToolTip(toolTip);
}
- if ( fileName.length() > 0 )
+ if (fileName.length() > 0)
setFilename(fileName);
}
@@ -35,7 +35,7 @@ void CopyFromProfileButton::setFilename(QString filename)
{
setEnabled(false);
- if ( filename.length() <= 0 )
+ if (filename.length() <= 0)
return;
ProfileModel model(this);
@@ -44,41 +44,41 @@ void CopyFromProfileButton::setFilename(QString filename)
QList<QAction *> user;
QAction * pa = systemDefault(filename);
- if ( pa )
+ if (pa)
global << pa;
- if ( ! buttonMenu_ )
+ if (! buttonMenu_)
buttonMenu_ = new QMenu();
- if ( buttonMenu_->actions().count() > 0 )
+ if (buttonMenu_->actions().count() > 0)
buttonMenu_->clear();
- for(int cnt = 0; cnt < model.rowCount(); cnt++)
+ for (int cnt = 0; cnt < model.rowCount(); cnt++)
{
QModelIndex idx = model.index(cnt, ProfileModel::COL_NAME);
QString profilePath = idx.data(ProfileModel::DATA_PATH).toString();
- if ( ! idx.isValid() || profilePath.isEmpty() )
+ if (! idx.isValid() || profilePath.isEmpty())
continue;
- if ( ! idx.data(ProfileModel::DATA_PATH_IS_NOT_DESCRIPTION).toBool() || idx.data(ProfileModel::DATA_IS_SELECTED).toBool() )
+ if (! idx.data(ProfileModel::DATA_PATH_IS_NOT_DESCRIPTION).toBool() || idx.data(ProfileModel::DATA_IS_SELECTED).toBool())
continue;
QDir profileDir(profilePath);
- if ( ! profileDir.exists() )
+ if (! profileDir.exists())
continue;
QFileInfo fi = profileDir.filePath(filename);
- if ( ! fi.exists() )
+ if (! fi.exists())
continue;
- if ( ! config_file_exists_with_entries(fi.absoluteFilePath().toUtf8().constData(), '#') )
+ if (! config_file_exists_with_entries(fi.absoluteFilePath().toUtf8().constData(), '#'))
continue;
QString name = idx.data().toString();
pa = new QAction(name, this);
- if ( idx.data(ProfileModel::DATA_IS_DEFAULT).toBool() )
+ if (idx.data(ProfileModel::DATA_IS_DEFAULT).toBool())
buttonMenu_->addAction(pa);
- else if ( idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() )
+ else if (idx.data(ProfileModel::DATA_IS_GLOBAL).toBool())
global << pa;
else
user << pa;
@@ -92,11 +92,11 @@ void CopyFromProfileButton::setFilename(QString filename)
buttonMenu_->addActions(user);
if (global.count() > 0)
{
- if ( actions().count() > 0 )
+ if (actions().count() > 0)
buttonMenu_->addSeparator();
buttonMenu_->addActions(global);
}
- if ( buttonMenu_->actions().count() <= 0 )
+ if (buttonMenu_->actions().count() <= 0)
return;
connect(buttonMenu_, &QMenu::triggered, this, &CopyFromProfileButton::menuActionTriggered);
@@ -112,7 +112,7 @@ QAction * CopyFromProfileButton::systemDefault(QString filename)
QDir dataDir(get_datafile_dir());
QString path = dataDir.filePath(filename);
- if ( QFile::exists(path) )
+ if (QFile::exists(path))
{
data = new QAction(tr("System default"), this);
data->setData(path);
@@ -126,10 +126,10 @@ QAction * CopyFromProfileButton::systemDefault(QString filename)
void CopyFromProfileButton::menuActionTriggered(QAction * action)
{
- if ( action->property("profile_filename").toString().length() > 0 )
+ if (action->property("profile_filename").toString().length() > 0)
{
QString filename = action->property("profile_filename").toString();
- if ( QFileInfo::exists(filename) )
+ if (QFileInfo::exists(filename))
emit copyProfile(filename);
}
}
diff --git a/ui/qt/widgets/display_filter_edit.cpp b/ui/qt/widgets/display_filter_edit.cpp
index a42f6ec1a0..31696b97a5 100644
--- a/ui/qt/widgets/display_filter_edit.cpp
+++ b/ui/qt/widgets/display_filter_edit.cpp
@@ -137,10 +137,10 @@ void DisplayFilterEdit::connectToMainWindow()
this, SLOT(displayFilterSuccess(bool)));
}
-void DisplayFilterEdit::contextMenuEvent(QContextMenuEvent *event){
+void DisplayFilterEdit::contextMenuEvent(QContextMenuEvent *event) {
QMenu *menu = this->createStandardContextMenu();
- if ( menu->actions().count() <= 0 )
+ if (menu->actions().count() <= 0)
return;
QAction * first = menu->actions().at(0);
@@ -164,7 +164,7 @@ void DisplayFilterEdit::contextMenuEvent(QContextMenuEvent *event){
void DisplayFilterEdit::triggerAlignementAction()
{
leftAlignActions_ = ! leftAlignActions_;
- if ( qobject_cast<QAction *>(sender()) )
+ if (qobject_cast<QAction *>(sender()))
qobject_cast<QAction *>(sender())->setChecked(leftAlignActions_);
recent.gui_geometry_leftalign_actions = leftAlignActions_;
@@ -188,7 +188,7 @@ void DisplayFilterEdit::alignActionButtons()
apply_button_->setMinimumHeight(contentsRect().height());
apply_button_->setMaximumHeight(contentsRect().height());
- if ( clear_button_->isVisible() )
+ if (clear_button_->isVisible())
{
cbsz = clear_button_->sizeHint();
clear_button_->setMinimumHeight(contentsRect().height());
@@ -199,7 +199,7 @@ void DisplayFilterEdit::alignActionButtons()
int leftPadding = frameWidth + 1;
int leftMargin = bksz.width();
int rightMargin = cbsz.width() + apsz.width() + frameWidth + 1;
- if ( leftAlignActions_ )
+ if (leftAlignActions_)
{
leftMargin = rightMargin + bksz.width() + 2;
rightMargin = 0;
@@ -218,7 +218,7 @@ void DisplayFilterEdit::alignActionButtons()
);
if (apply_button_) {
- if ( ! leftAlignActions_ )
+ if (! leftAlignActions_)
{
apply_button_->move(contentsRect().right() - frameWidth - apsz.width(),
contentsRect().top());
@@ -228,7 +228,7 @@ void DisplayFilterEdit::alignActionButtons()
}
if (clear_button_ && apply_button_) {
- if ( ! leftAlignActions_ )
+ if (! leftAlignActions_)
{
clear_button_->move(contentsRect().right() - frameWidth - cbsz.width() - apsz.width(),
contentsRect().top());
@@ -266,7 +266,7 @@ void DisplayFilterEdit::paintEvent(QPaintEvent *evt) {
if (bookmark_button_ && isEnabled()) {
- if ( ! bookmark_button_->isVisible() )
+ if (! bookmark_button_->isVisible())
{
bookmark_button_->setVisible(true);
apply_button_->setVisible(true);
@@ -286,10 +286,10 @@ void DisplayFilterEdit::paintEvent(QPaintEvent *evt) {
painter.setPen(divider_color);
QRect cr = contentsRect();
int xpos = 0;
- if ( leftAlignActions_ )
+ if (leftAlignActions_)
{
xpos = 1 + bookmark_button_->size().width() + apply_button_->size().width();
- if ( clear_button_->isVisible() )
+ if (clear_button_->isVisible())
xpos += clear_button_->size().width();
}
else
@@ -322,19 +322,19 @@ bool DisplayFilterEdit::checkFilter()
void DisplayFilterEdit::checkFilter(const QString& filter_text)
{
- if ( text().length() == 0 && actions_ && actions_->checkedAction() )
+ if (text().length() == 0 && actions_ && actions_->checkedAction())
actions_->checkedAction()->setChecked(false);
if (clear_button_) {
- if ( filter_text.length() > 0 )
+ if (filter_text.length() > 0)
clear_button_->setVisible(true);
- else if ( last_applied_.length() > 0 )
+ else if (last_applied_.length() > 0)
setPlaceholderText(tr("Current filter: %1").arg(last_applied_));
- else if ( filter_text.length() <= 0 && last_applied_.length() <= 0 )
+ else if (filter_text.length() <= 0 && last_applied_.length() <= 0)
clear_button_->setVisible(false);
- if ( filter_text.length() <= 0 )
+ if (filter_text.length() <= 0)
wsApp->popStatus(WiresharkApplication::FilterSyntax);
alignActionButtons();
@@ -365,20 +365,20 @@ void DisplayFilterEdit::checkFilter(const QString& filter_text)
if (bookmark_button_) {
bookmark_button_->setStockIcon("x-display-filter-bookmark");
- if ( remove_action_ && save_action_ )
+ if (remove_action_ && save_action_)
{
remove_action_->setEnabled(false);
save_action_->setEnabled(false);
}
- if ( filter_text.length() > 0 )
+ if (filter_text.length() > 0)
{
bool enable_save_action = false;
bool match = false;
FilterListModel model(FilterListModel::Display);
QModelIndex idx = model.findByExpression(filter_text);
- if ( idx.isValid() ) {
+ if (idx.isValid()) {
match = true;
bookmark_button_->setStockIcon("x-filter-matching-bookmark");
@@ -428,10 +428,10 @@ void DisplayFilterEdit::updateBookmarkMenu()
int one_em = bb_menu->fontMetrics().height();
- if ( ! actions_ )
+ if (! actions_)
actions_ = new QActionGroup(this);
- for(int row = 0; row < model.rowCount(); row++)
+ for (int row = 0; row < model.rowCount(); row++)
{
QModelIndex nameIdx = model.index(row, FilterListModel::ColumnName);
QString name = nameIdx.data().toString();
@@ -441,7 +441,7 @@ void DisplayFilterEdit::updateBookmarkMenu()
prep_text = bb_menu->fontMetrics().elidedText(prep_text, Qt::ElideRight, one_em * 40);
QAction * prep_action = bb_menu->addAction(prep_text);
prep_action->setCheckable(true);
- if ( nameIdx == idx )
+ if (nameIdx == idx)
prep_action->setChecked(true);
prep_action->setProperty("display_filter", expr);
@@ -559,7 +559,7 @@ void DisplayFilterEdit::applyDisplayFilter()
if (syntaxState() == Invalid)
return;
- if ( text().length() > 0 )
+ if (text().length() > 0)
last_applied_ = text();
updateClearButton();
@@ -576,7 +576,7 @@ void DisplayFilterEdit::updateClearButton()
void DisplayFilterEdit::displayFilterSuccess(bool success)
{
- if ( apply_button_ )
+ if (apply_button_)
apply_button_->setEnabled(!success);
}
@@ -606,11 +606,11 @@ void DisplayFilterEdit::saveFilter()
void DisplayFilterEdit::removeFilter()
{
- if ( ! actions_ && ! actions_->checkedAction() )
+ if (! actions_ && ! actions_->checkedAction())
return;
QAction *ra = actions_->checkedAction();
- if ( ra->property("display_filter").toString().isEmpty() )
+ if (ra->property("display_filter").toString().isEmpty())
return;
QString remove_filter = ra->property("display_filter").toString();
@@ -618,7 +618,7 @@ void DisplayFilterEdit::removeFilter()
FilterListModel model(FilterListModel::Display);
QModelIndex idx = model.findByExpression(remove_filter);
- if ( idx.isValid() )
+ if (idx.isValid())
{
model.removeFilter(idx);
model.saveList();
@@ -643,7 +643,7 @@ void DisplayFilterEdit::showExpressionPrefs()
void DisplayFilterEdit::applyOrPrepareFilter()
{
QAction *pa = qobject_cast<QAction*>(sender());
- if ( ! pa || pa->property("display_filter").toString().isEmpty() )
+ if (! pa || pa->property("display_filter").toString().isEmpty())
return;
QString filterText = pa->property("display_filter").toString();
@@ -658,12 +658,12 @@ void DisplayFilterEdit::applyOrPrepareFilter()
void DisplayFilterEdit::dragEnterEvent(QDragEnterEvent *event)
{
- if ( ! event || ! event->mimeData() )
+ if (! event || ! event->mimeData())
return;
if (qobject_cast<const ToolbarEntryMimeData *>(event->mimeData()) ||
event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType)) {
- if ( event->source() != this )
+ if (event->source() != this)
{
event->setDropAction(Qt::CopyAction);
event->accept();
@@ -677,12 +677,12 @@ void DisplayFilterEdit::dragEnterEvent(QDragEnterEvent *event)
void DisplayFilterEdit::dragMoveEvent(QDragMoveEvent *event)
{
- if ( ! event || ! event->mimeData() )
+ if (! event || ! event->mimeData())
return;
if (qobject_cast<const ToolbarEntryMimeData *>(event->mimeData()) ||
event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType)) {
- if ( event->source() != this )
+ if (event->source() != this)
{
event->setDropAction(Qt::CopyAction);
event->accept();
@@ -696,22 +696,22 @@ void DisplayFilterEdit::dragMoveEvent(QDragMoveEvent *event)
void DisplayFilterEdit::dropEvent(QDropEvent *event)
{
- if ( ! event || ! event->mimeData() )
+ if (! event || ! event->mimeData())
return;
QString filterText = "";
- if ( event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType) )
+ if (event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType))
{
QByteArray jsonData = event->mimeData()->data(WiresharkMimeData::DisplayFilterMimeType);
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
- if ( ! jsonDoc.isObject() )
+ if (! jsonDoc.isObject())
return;
QJsonObject data = jsonDoc.object();
if ((QApplication::keyboardModifiers() & Qt::AltModifier) && data.contains("field"))
filterText = data["field"].toString();
- else if ( data.contains("filter") )
+ else if (data.contains("filter"))
filterText = data["filter"].toString();
}
else if (qobject_cast<const ToolbarEntryMimeData *>(event->mimeData()))
@@ -723,14 +723,14 @@ void DisplayFilterEdit::dropEvent(QDropEvent *event)
/* Moving items around */
if (filterText.length() > 0) {
- if ( event->source() != this )
+ if (event->source() != this)
{
event->setDropAction(Qt::CopyAction);
event->accept();
bool prepare = QApplication::keyboardModifiers() & Qt::ShiftModifier;
- if ( text().length() > 0 || QApplication::keyboardModifiers() & Qt::MetaModifier)
+ if (text().length() > 0 || QApplication::keyboardModifiers() & Qt::MetaModifier)
{
createFilterTextDropMenu(event, prepare, filterText);
return;
@@ -740,7 +740,7 @@ void DisplayFilterEdit::dropEvent(QDropEvent *event)
setText(filterText);
// Holding down the Shift key will only prepare filter.
- if ( ! prepare ) {
+ if (! prepare) {
applyDisplayFilter();
}
@@ -755,7 +755,7 @@ void DisplayFilterEdit::dropEvent(QDropEvent *event)
void DisplayFilterEdit::createFilterTextDropMenu(QDropEvent *event, bool prepare, QString filterText)
{
- if ( filterText.isEmpty() )
+ if (filterText.isEmpty())
return;
FilterAction::Action filterAct = prepare ? FilterAction::ActionPrepare : FilterAction::ActionApply;
diff --git a/ui/qt/widgets/drag_drop_toolbar.cpp b/ui/qt/widgets/drag_drop_toolbar.cpp
index 705d3efb19..5d9c9fd37f 100644
--- a/ui/qt/widgets/drag_drop_toolbar.cpp
+++ b/ui/qt/widgets/drag_drop_toolbar.cpp
@@ -61,12 +61,12 @@ DragDropToolBar::~DragDropToolBar()
void DragDropToolBar::childEvent(QChildEvent * event)
{
/* New action has been added */
- if ( event->type() == QEvent::ChildAdded )
+ if (event->type() == QEvent::ChildAdded)
{
- if ( event->child()->isWidgetType() )
+ if (event->child()->isWidgetType())
{
/* Reset if it has moved underneath lower limit */
- if ( childCounter < 0 )
+ if (childCounter < 0)
childCounter = 0;
((QWidget *)event->child())->installEventFilter(this);
@@ -74,17 +74,17 @@ void DragDropToolBar::childEvent(QChildEvent * event)
childCounter++;
}
}
- else if ( event->type() == QEvent::ChildRemoved )
+ else if (event->type() == QEvent::ChildRemoved)
{
childCounter--;
}
- else if ( event->type() == QEvent::ChildPolished )
+ else if (event->type() == QEvent::ChildPolished)
{
/* Polish is called every time a child is added or removed. This is implemented by adding
* all childs again as hidden elements, and afterwards removing the existing ones. Therefore
* we have to reset child counter here, if a widget is being polished. If this is not being
* done, crashes will occur after an item has been removed and other items are moved afterwards */
- if ( event->child()->isWidgetType() )
+ if (event->child()->isWidgetType())
childCounter = 0;
}
}
@@ -102,27 +102,27 @@ WiresharkMimeData * DragDropToolBar::createMimeData(QString name, int position)
bool DragDropToolBar::eventFilter(QObject * obj, QEvent * event)
{
- if ( ! obj->isWidgetType() )
+ if (! obj->isWidgetType())
return QToolBar::eventFilter(obj, event);
QWidget * elem = qobject_cast<QWidget *>(obj);
- if ( ! elem || ( event->type() != QEvent::MouseButtonPress && event->type() != QEvent::MouseMove ) )
+ if (! elem || (event->type() != QEvent::MouseButtonPress && event->type() != QEvent::MouseMove) )
return QToolBar::eventFilter(obj, event);
QMouseEvent * ev = (QMouseEvent *)event;
- if ( event->type() == QEvent::MouseButtonPress )
+ if (event->type() == QEvent::MouseButtonPress)
{
- if ( ev->buttons() & Qt::LeftButton )
+ if (ev->buttons() & Qt::LeftButton)
dragStartPosition = ev->pos();
}
- else if ( event->type() == QEvent::MouseMove )
+ else if (event->type() == QEvent::MouseMove)
{
- if ( ( ev->buttons() & Qt::LeftButton ) && (ev->pos() - dragStartPosition).manhattanLength()
+ if ((ev->buttons() & Qt::LeftButton) && (ev->pos() - dragStartPosition).manhattanLength()
> QApplication::startDragDistance())
{
- if ( ! qobject_cast<QToolButton *>(elem) || ! elem->property(drag_drop_toolbar_action_).isValid() )
+ if (! qobject_cast<QToolButton *>(elem) || ! elem->property(drag_drop_toolbar_action_).isValid())
return QToolBar::eventFilter(obj, event);
WiresharkMimeData * temd = createMimeData(((QToolButton *)elem)->text(), elem->property(drag_drop_toolbar_action_).toInt());
@@ -148,7 +148,7 @@ bool DragDropToolBar::eventFilter(QObject * obj, QEvent * event)
void DragDropToolBar::dragEnterEvent(QDragEnterEvent *event)
{
- if ( ! event || ! event->mimeData() )
+ if (! event || ! event->mimeData())
return;
if (qobject_cast<const ToolbarEntryMimeData *>(event->mimeData()))
@@ -160,7 +160,7 @@ void DragDropToolBar::dragEnterEvent(QDragEnterEvent *event)
event->acceptProposedAction();
}
} else if (event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType)) {
- if ( event->source() != this )
+ if (event->source() != this)
{
event->setDropAction(Qt::CopyAction);
event->accept();
@@ -174,20 +174,20 @@ void DragDropToolBar::dragEnterEvent(QDragEnterEvent *event)
void DragDropToolBar::dragMoveEvent(QDragMoveEvent *event)
{
- if ( ! event || ! event->mimeData() )
+ if (! event || ! event->mimeData())
return;
if (qobject_cast<const ToolbarEntryMimeData *>(event->mimeData()))
{
- QAction * actionAtPos = actionAt(event->pos() );
- if ( actionAtPos )
+ QAction * actionAtPos = actionAt(event->pos());
+ if (actionAtPos)
{
QWidget * widget = widgetForAction(actionAtPos);
- if ( widget )
+ if (widget)
{
bool success = false;
widget->property(drag_drop_toolbar_action_).toInt(&success);
- if ( ! success )
+ if (! success)
{
event->ignore();
return;
@@ -202,7 +202,7 @@ void DragDropToolBar::dragMoveEvent(QDragMoveEvent *event)
event->acceptProposedAction();
}
} else if (event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType)) {
- if ( event->source() != this )
+ if (event->source() != this)
{
event->setDropAction(Qt::CopyAction);
event->accept();
@@ -216,7 +216,7 @@ void DragDropToolBar::dragMoveEvent(QDragMoveEvent *event)
void DragDropToolBar::dropEvent(QDropEvent *event)
{
- if ( ! event || ! event->mimeData() )
+ if (! event || ! event->mimeData())
return;
/* Moving items around */
@@ -227,7 +227,7 @@ void DragDropToolBar::dropEvent(QDropEvent *event)
int oldPos = data->position();
int newPos = -1;
QAction * action = actionAt(event->pos());
- if ( action && actions().at(oldPos) )
+ if (action && actions().at(oldPos))
{
widgetForAction(action)->setStyleSheet("QWidget { border: none; };");
newPos = widgetForAction(action)->property(drag_drop_toolbar_action_).toInt();
@@ -247,11 +247,11 @@ void DragDropToolBar::dropEvent(QDropEvent *event)
} else if (event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType)) {
QByteArray jsonData = event->mimeData()->data(WiresharkMimeData::DisplayFilterMimeType);
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
- if ( jsonDoc.isObject() )
+ if (jsonDoc.isObject())
{
QJsonObject data = jsonDoc.object();
- if ( event->source() != this && data.contains("description") && data.contains("filter") )
+ if (event->source() != this && data.contains("description") && data.contains("filter"))
{
event->setDropAction(Qt::CopyAction);
event->accept();
@@ -269,7 +269,7 @@ void DragDropToolBar::dropEvent(QDropEvent *event)
void DragDropToolBar::moveToolbarItems(int fromPos, int newPos)
{
- if ( fromPos == newPos )
+ if (fromPos == newPos)
return;
setUpdatesEnabled(false);
@@ -280,7 +280,7 @@ void DragDropToolBar::moveToolbarItems(int fromPos, int newPos)
childCounter = 0;
storedActions.move(fromPos, newPos);
- foreach ( QAction * action, storedActions )
+ foreach (QAction * action, storedActions)
addAction(action);
setUpdatesEnabled(true);
diff --git a/ui/qt/widgets/editor_file_dialog.cpp b/ui/qt/widgets/editor_file_dialog.cpp
index 397d091dc3..96a6ee2e5d 100644
--- a/ui/qt/widgets/editor_file_dialog.cpp
+++ b/ui/qt/widgets/editor_file_dialog.cpp
@@ -68,7 +68,7 @@ bool EditorFileDialog::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
QKeyEvent* key = static_cast<QKeyEvent*>(event);
- if ( (key->key() == Qt::Key_Tab) && !file_dialog_button_->hasFocus()) {
+ if ((key->key() == Qt::Key_Tab) && !file_dialog_button_->hasFocus()) {
file_dialog_button_->setFocus();
return true;
}
diff --git a/ui/qt/widgets/filter_expression_toolbar.cpp b/ui/qt/widgets/filter_expression_toolbar.cpp
index 9f7ab2ecc3..94f5dc665d 100644
--- a/ui/qt/widgets/filter_expression_toolbar.cpp
+++ b/ui/qt/widgets/filter_expression_toolbar.cpp
@@ -40,7 +40,7 @@ FilterExpressionToolBar::FilterExpressionToolBar(QWidget * parent) :
setContextMenuPolicy(Qt::CustomContextMenu);
- connect ( this, &QWidget::customContextMenuRequested, this, &FilterExpressionToolBar::onCustomMenuHandler );
+ connect (this, &QWidget::customContextMenuRequested, this, &FilterExpressionToolBar::onCustomMenuHandler);
connect(this, &DragDropToolBar::actionMoved, this, &FilterExpressionToolBar::onActionMoved);
connect(this, &DragDropToolBar::newFilterDropped, this, &FilterExpressionToolBar::onFilterDropped);
@@ -67,7 +67,7 @@ bool FilterExpressionToolBar::event(QEvent *event)
void FilterExpressionToolBar::onCustomMenuHandler(const QPoint& pos)
{
QAction * filterAction = actionAt(pos);
- if ( ! filterAction )
+ if (! filterAction)
return;
QMenu * filterMenu = new QMenu(this);
@@ -134,7 +134,7 @@ void FilterExpressionToolBar::removeFilter()
int idx = uatRowIndexForFilter(label, expr);
QModelIndex rowIndex = uatModel->index(idx, 0);
- if ( rowIndex.isValid() ) {
+ if (rowIndex.isValid()) {
uatModel->removeRow(rowIndex.row());
save_migrated_uat("Display expressions", &prefs.filter_expressions_old);
@@ -148,9 +148,9 @@ WiresharkMimeData * FilterExpressionToolBar::createMimeData(QString name, int po
UatModel * uatModel = new UatModel(this, "Display expressions");
QModelIndex rowIndex;
- for ( int cnt = 0; cnt < uatModel->rowCount() && ! rowIndex.isValid(); cnt++ )
+ for (int cnt = 0; cnt < uatModel->rowCount() && ! rowIndex.isValid(); cnt++)
{
- if ( uatModel->data(uatModel->index(cnt, 1), Qt::DisplayRole).toString().compare(name) == 0 )
+ if (uatModel->data(uatModel->index(cnt, 1), Qt::DisplayRole).toString().compare(name) == 0)
{
rowIndex = uatModel->index(cnt, 2);
element->setFilter(rowIndex.data().toString());
@@ -163,7 +163,7 @@ WiresharkMimeData * FilterExpressionToolBar::createMimeData(QString name, int po
void FilterExpressionToolBar::onActionMoved(QAction* action, int oldPos, int newPos)
{
gchar* err = NULL;
- if ( oldPos == newPos )
+ if (oldPos == newPos)
return;
QString label = action->property(dfe_property_label_).toString();
@@ -171,7 +171,7 @@ void FilterExpressionToolBar::onActionMoved(QAction* action, int oldPos, int new
int idx = uatRowIndexForFilter(label, expr);
- if ( idx > -1 && oldPos > -1 && newPos > -1 )
+ if (idx > -1 && oldPos > -1 && newPos > -1)
{
uat_t * table = uat_get_table_by_name("Display expressions");
uat_move_index(table, oldPos, newPos);
@@ -190,7 +190,7 @@ void FilterExpressionToolBar::disableFilter()
UatModel * uatModel = new UatModel(this, "Display expressions");
QModelIndex rowIndex = uatModel->index(idx, 0);
- if ( rowIndex.isValid() ) {
+ if (rowIndex.isValid()) {
uatModel->setData(rowIndex, QVariant::fromValue(false));
save_migrated_uat("Display expressions", &prefs.filter_expressions_old);
@@ -200,7 +200,7 @@ void FilterExpressionToolBar::disableFilter()
void FilterExpressionToolBar::editFilter()
{
- if ( ! sender() )
+ if (! sender())
return;
QString label = ((QAction *)sender())->property(dfe_property_label_).toString();
@@ -208,13 +208,13 @@ void FilterExpressionToolBar::editFilter()
int idx = uatRowIndexForFilter(label, expr);
- if ( idx > -1 )
+ if (idx > -1)
emit filterEdit(idx);
}
void FilterExpressionToolBar::onFilterDropped(QString description, QString filter)
{
- if ( filter.length() == 0 )
+ if (filter.length() == 0)
return;
filter_expression_new(qUtf8Printable(description),
@@ -249,19 +249,19 @@ int FilterExpressionToolBar::uatRowIndexForFilter(QString label, QString express
{
int result = -1;
- if ( expression.length() == 0 )
+ if (expression.length() == 0)
return result;
UatModel * uatModel = new UatModel(this, "Display expressions");
QModelIndex rowIndex;
- if ( label.length() > 0 )
+ if (label.length() > 0)
{
- for ( int cnt = 0; cnt < uatModel->rowCount() && ! rowIndex.isValid(); cnt++ )
+ for (int cnt = 0; cnt < uatModel->rowCount() && ! rowIndex.isValid(); cnt++)
{
- if ( uatModel->data(uatModel->index(cnt, 1), Qt::DisplayRole).toString().compare(label) == 0 &&
- uatModel->data(uatModel->index(cnt, 2), Qt::DisplayRole).toString().compare(expression) == 0 )
+ if (uatModel->data(uatModel->index(cnt, 1), Qt::DisplayRole).toString().compare(label) == 0 &&
+ uatModel->data(uatModel->index(cnt, 2), Qt::DisplayRole).toString().compare(expression) == 0)
{
rowIndex = uatModel->index(cnt, 2);
}
@@ -272,7 +272,7 @@ int FilterExpressionToolBar::uatRowIndexForFilter(QString label, QString express
rowIndex = uatModel->findRowForColumnContent(((QAction *)sender())->data(), 2);
}
- if ( rowIndex.isValid() )
+ if (rowIndex.isValid())
result = rowIndex.row();
delete uatModel;
diff --git a/ui/qt/widgets/packet_list_header.cpp b/ui/qt/widgets/packet_list_header.cpp
index 7d12440fdb..90dc6da001 100644
--- a/ui/qt/widgets/packet_list_header.cpp
+++ b/ui/qt/widgets/packet_list_header.cpp
@@ -42,12 +42,12 @@ PacketListHeader::PacketListHeader(Qt::Orientation orientation, capture_file * c
void PacketListHeader::dragEnterEvent(QDragEnterEvent *event)
{
- if ( ! event || ! event->mimeData() )
+ if (! event || ! event->mimeData())
return;
- if ( event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType) && event->source() != this->parent() )
+ if (event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType) && event->source() != this->parent())
{
- if ( event->source() != this )
+ if (event->source() != this)
{
event->setDropAction(Qt::CopyAction);
event->accept();
@@ -61,12 +61,12 @@ void PacketListHeader::dragEnterEvent(QDragEnterEvent *event)
void PacketListHeader::dragMoveEvent(QDragMoveEvent *event)
{
- if ( ! event || ! event->mimeData() )
+ if (! event || ! event->mimeData())
return;
- if ( event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType) )
+ if (event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType))
{
- if ( event->source() != this )
+ if (event->source() != this)
{
event->setDropAction(Qt::CopyAction);
event->accept();
@@ -80,26 +80,26 @@ void PacketListHeader::dragMoveEvent(QDragMoveEvent *event)
void PacketListHeader::dropEvent(QDropEvent *event)
{
- if ( ! event || ! event->mimeData() )
+ if (! event || ! event->mimeData())
return;
/* Moving items around */
- if ( event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType) )
+ if (event->mimeData()->hasFormat(WiresharkMimeData::DisplayFilterMimeType))
{
QByteArray jsonData = event->mimeData()->data(WiresharkMimeData::DisplayFilterMimeType);
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
- if ( ! jsonDoc.isObject() )
+ if (! jsonDoc.isObject())
return;
QJsonObject data = jsonDoc.object();
- if ( event->source() != this && data.contains("description") && data.contains("field") )
+ if (event->source() != this && data.contains("description") && data.contains("field"))
{
event->setDropAction(Qt::CopyAction);
event->accept();
MainWindow * mw = qobject_cast<MainWindow *>(wsApp->mainWindow());
- if ( mw )
+ if (mw)
{
int idx = logicalIndexAt(event->pos());
mw->insertColumn(data["description"].toString(), data["field"].toString(), idx);
@@ -115,7 +115,7 @@ void PacketListHeader::dropEvent(QDropEvent *event)
void PacketListHeader::mousePressEvent(QMouseEvent *e)
{
- if ( e->button() == Qt::LeftButton && sectionIdx < 0 )
+ if (e->button() == Qt::LeftButton && sectionIdx < 0)
{
/* No move happening yet */
int sectIdx = logicalIndexAt(e->localPos().x() - 4, e->localPos().y());
@@ -129,20 +129,20 @@ void PacketListHeader::mousePressEvent(QMouseEvent *e)
void PacketListHeader::mouseMoveEvent(QMouseEvent *e)
{
- if ( e->button() == Qt::NoButton || ! ( e->buttons() & Qt::LeftButton) )
+ if (e->button() == Qt::NoButton || ! (e->buttons() & Qt::LeftButton))
{
/* no move is happening */
sectionIdx = -1;
lastSize = -1;
}
- else if ( e->buttons() & Qt::LeftButton )
+ else if (e->buttons() & Qt::LeftButton)
{
/* section being moved */
int triggeredSection = logicalIndexAt(e->localPos().x() - 4, e->localPos().y());
- if ( sectionIdx < 0 )
+ if (sectionIdx < 0)
sectionIdx = triggeredSection;
- else if ( sectionIdx == triggeredSection )
+ else if (sectionIdx == triggeredSection)
{
/* Only run for the current moving section after a change */
QString headerName = model()->headerData(sectionIdx, orientation()).toString();
@@ -255,7 +255,7 @@ void PacketListHeader::setAlignment(QAction *action)
return;
int section = group->property("column").toInt();
- if ( section >= 0 )
+ if (section >= 0)
{
QChar data = action->data().toChar();
recent_set_column_xalign(section, action->isChecked() ? data.toLatin1() : COLUMN_XALIGN_DEFAULT);
@@ -316,7 +316,7 @@ void PacketListHeader::resizeToContent()
int section = menu->property("column").toInt();
PacketList * packetList = qobject_cast<PacketList *>(parent());
- if ( packetList )
+ if (packetList)
packetList->resizeColumnToContents(section);
}
diff --git a/ui/qt/widgets/profile_tree_view.cpp b/ui/qt/widgets/profile_tree_view.cpp
index 3782314239..89cd1404c5 100644
--- a/ui/qt/widgets/profile_tree_view.cpp
+++ b/ui/qt/widgets/profile_tree_view.cpp
@@ -22,7 +22,7 @@ ProfileUrlLinkDelegate::ProfileUrlLinkDelegate(QObject *parent) : UrlLinkDelegat
void ProfileUrlLinkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
/* Only paint links for valid paths */
- if ( index.data(ProfileModel::DATA_PATH_IS_NOT_DESCRIPTION).toBool() )
+ if (index.data(ProfileModel::DATA_PATH_IS_NOT_DESCRIPTION).toBool())
UrlLinkDelegate::paint(painter, option, index);
else
QStyledItemDelegate::paint(painter, option, index);
@@ -54,33 +54,33 @@ void ProfileTreeView::selectionChanged(const QItemSelection &selected, const QIt
{
QTreeView::selectionChanged(selected, deselected);
- if ( model() )
+ if (model())
{
int offColumn = model()->columnCount();
int idxCount = selectedIndexes().count() / offColumn;
int dselCount = deselected.count() > 0 ? deselected.at(0).indexes().count() / offColumn : 0;
/* Ensure, that the last selected row cannot be deselected */
- if ( idxCount == 0 && dselCount == 1 )
+ if (idxCount == 0 && dselCount == 1)
{
QModelIndex idx = deselected.at(0).indexes().at(0);
/* If the last item is no longer valid or the row is out of bounds, select default */
- if ( ! idx.isValid() || idx.row() >= model()->rowCount() )
+ if (! idx.isValid() || idx.row() >= model()->rowCount())
idx = model()->index(0, ProfileModel::COL_NAME);
selectRow(idx.row());
}
- else if ( selectedIndexes().count() == 0 )
+ else if (selectedIndexes().count() == 0)
selectRow(0);
}
}
void ProfileTreeView::clicked(const QModelIndex &index)
{
- if ( !index.isValid() )
+ if (!index.isValid())
return;
/* Only paint links for valid paths */
- if ( index.data(ProfileModel::DATA_INDEX_VALUE_IS_URL).toBool() )
+ if (index.data(ProfileModel::DATA_INDEX_VALUE_IS_URL).toBool())
{
QString path = QDir::toNativeSeparators(index.data().toString());
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
@@ -89,7 +89,7 @@ void ProfileTreeView::clicked(const QModelIndex &index)
void ProfileTreeView::selectRow(int row)
{
- if ( row < 0 )
+ if (row < 0)
return;
setCurrentIndex(model()->index(row, 0));
@@ -103,11 +103,11 @@ void ProfileTreeView::selectRow(int row)
void ProfileTreeView::mouseDoubleClickEvent(QMouseEvent *ev)
{
/* due to the fact, that we allow only row selection, selected rows are always added with all columns */
- if ( selectedIndexes().count() <= model()->columnCount() )
+ if (selectedIndexes().count() <= model()->columnCount())
QTreeView::mouseDoubleClickEvent(ev);
}
bool ProfileTreeView::activeEdit()
{
- return ( state() == QAbstractItemView::EditingState );
+ return (state() == QAbstractItemView::EditingState);
}
diff --git a/ui/qt/widgets/qcustomplot.cpp b/ui/qt/widgets/qcustomplot.cpp
index 4e1907237d..4323165332 100644
--- a/ui/qt/widgets/qcustomplot.cpp
+++ b/ui/qt/widgets/qcustomplot.cpp
@@ -2290,8 +2290,8 @@ QCPDataRange QCPDataRange::intersection(const QCPDataRange &other) const
*/
bool QCPDataRange::intersects(const QCPDataRange &other) const
{
- return !( (mBegin > other.mBegin && mBegin >= other.mEnd) ||
- (mEnd <= other.mBegin && mEnd < other.mEnd) );
+ return !((mBegin > other.mBegin && mBegin >= other.mEnd) ||
+ (mEnd <= other.mBegin && mEnd < other.mEnd));
}
/*!
@@ -10175,7 +10175,7 @@ void QCPScatterStyle::drawShape(QCPPainter *painter, double x, double y) const
case ssPlus:
{
painter->drawLine(QLineF(x-w, y, x+w, y));
- painter->drawLine(QLineF( x, y+w, x, y-w));
+ painter->drawLine(QLineF( x, y+w, x, y-w));
break;
}
case ssCircle:
@@ -10199,16 +10199,16 @@ void QCPScatterStyle::drawShape(QCPPainter *painter, double x, double y) const
case ssDiamond:
{
QPointF lineArray[4] = {QPointF(x-w, y),
- QPointF( x, y-w),
+ QPointF( x, y-w),
QPointF(x+w, y),
- QPointF( x, y+w)};
+ QPointF( x, y+w)};
painter->drawPolygon(lineArray, 4);
break;
}
case ssStar:
{
painter->drawLine(QLineF(x-w, y, x+w, y));
- painter->drawLine(QLineF( x, y+w, x, y-w));
+ painter->drawLine(QLineF( x, y+w, x, y-w));
painter->drawLine(QLineF(x-w*0.707, y-w*0.707, x+w*0.707, y+w*0.707));
painter->drawLine(QLineF(x-w*0.707, y+w*0.707, x+w*0.707, y-w*0.707));
break;
@@ -10217,7 +10217,7 @@ void QCPScatterStyle::drawShape(QCPPainter *painter, double x, double y) const
{
QPointF lineArray[3] = {QPointF(x-w, y+0.755*w),
QPointF(x+w, y+0.755*w),
- QPointF( x, y-0.977*w)};
+ QPointF( x, y-0.977*w)};
painter->drawPolygon(lineArray, 3);
break;
}
@@ -10225,7 +10225,7 @@ void QCPScatterStyle::drawShape(QCPPainter *painter, double x, double y) const
{
QPointF lineArray[3] = {QPointF(x-w, y-0.755*w),
QPointF(x+w, y-0.755*w),
- QPointF( x, y+0.977*w)};
+ QPointF( x, y+0.977*w)};
painter->drawPolygon(lineArray, 3);
break;
}
@@ -10240,7 +10240,7 @@ void QCPScatterStyle::drawShape(QCPPainter *painter, double x, double y) const
{
painter->drawRect(QRectF(x-w, y-w, mSize, mSize));
painter->drawLine(QLineF(x-w, y, x+w*0.95, y));
- painter->drawLine(QLineF( x, y+w, x, y-w));
+ painter->drawLine(QLineF( x, y+w, x, y-w));
break;
}
case ssCrossCircle:
@@ -10254,7 +10254,7 @@ void QCPScatterStyle::drawShape(QCPPainter *painter, double x, double y) const
{
painter->drawEllipse(QPointF(x, y), w, w);
painter->drawLine(QLineF(x-w, y, x+w, y));
- painter->drawLine(QLineF( x, y+w, x, y-w));
+ painter->drawLine(QLineF( x, y+w, x, y-w));
break;
}
case ssPeace:
diff --git a/ui/qt/widgets/wireless_timeline.cpp b/ui/qt/widgets/wireless_timeline.cpp
index c11000d299..3f31e6351a 100644
--- a/ui/qt/widgets/wireless_timeline.cpp
+++ b/ui/qt/widgets/wireless_timeline.cpp
@@ -67,7 +67,7 @@ public:
inline pcolor(float red, float green, float blue) : QColor(
(int) (255*(red * fraction + base)),
(int) (255*(green * fraction + base)),
- (int) (255*(blue * fraction + base)) ) { }
+ (int) (255*(blue * fraction + base))) { }
};
static void reset_rgb(float rgb[TIMELINE_HEIGHT][3])
@@ -498,7 +498,7 @@ WirelessTimeline::paintEvent(QPaintEvent *qpe)
frame_data * topData = packet_list->getFDataForRow(top);
frame_data * botData = packet_list->getFDataForRow(bottom);
- if ( ! topData || ! botData )
+ if (! topData || ! botData)
return;
int x1 = top == -1 ? 0 : position(get_wlan_radio(topData->num)->start_tsf, ratio);
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index ae00b84867..2036ff654b 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -283,7 +283,7 @@ void WiresharkApplication::helpTopicAction(topic_action_e action)
{
QString url = gchar_free_to_qstring(topic_action_url(action));
- if(!url.isEmpty()) {
+ if (!url.isEmpty()) {
QDesktopServices::openUrl(QUrl(url));
}
}
@@ -1337,7 +1337,7 @@ void WiresharkApplication::captureEventHandler(CaptureEvent ev)
#ifdef HAVE_LIBPCAP
case CaptureEvent::Update:
case CaptureEvent::Fixed:
- switch ( ev.eventType() )
+ switch (ev.eventType())
{
case CaptureEvent::Started:
active_captures_++;
@@ -1355,7 +1355,7 @@ void WiresharkApplication::captureEventHandler(CaptureEvent ev)
case CaptureEvent::File:
case CaptureEvent::Reload:
case CaptureEvent::Rescan:
- switch ( ev.eventType() )
+ switch (ev.eventType())
{
case CaptureEvent::Started:
QTimer::singleShot(TAP_UPDATE_DEFAULT_INTERVAL / 5, this, SLOT(updateTaps()));
@@ -1375,11 +1375,11 @@ void WiresharkApplication::captureEventHandler(CaptureEvent ev)
void WiresharkApplication::pushStatus(StatusInfo status, const QString &message, const QString &messagetip)
{
- if ( ! mainWindow() || ! qobject_cast<MainWindow *>(mainWindow()) )
+ if (! mainWindow() || ! qobject_cast<MainWindow *>(mainWindow()))
return;
MainWindow * mw = qobject_cast<MainWindow *>(mainWindow());
- if ( ! mw->main_ui_ || ! mw->main_ui_->statusBar )
+ if (! mw->main_ui_ || ! mw->main_ui_->statusBar)
return;
MainStatusBar * bar = mw->main_ui_->statusBar;
@@ -1409,11 +1409,11 @@ void WiresharkApplication::pushStatus(StatusInfo status, const QString &message,
void WiresharkApplication::popStatus(StatusInfo status)
{
- if ( ! mainWindow() || ! qobject_cast<MainWindow *>(mainWindow()) )
+ if (! mainWindow() || ! qobject_cast<MainWindow *>(mainWindow()))
return;
MainWindow * mw = qobject_cast<MainWindow *>(mainWindow());
- if ( ! mw->main_ui_ || ! mw->main_ui_->statusBar )
+ if (! mw->main_ui_ || ! mw->main_ui_->statusBar)
return;
MainStatusBar * bar = mw->main_ui_->statusBar;
diff --git a/ui/qt/wireshark_dialog.cpp b/ui/qt/wireshark_dialog.cpp
index f545f3e72c..a15a615f8a 100644
--- a/ui/qt/wireshark_dialog.cpp
+++ b/ui/qt/wireshark_dialog.cpp
@@ -77,7 +77,7 @@ void WiresharkDialog::setWindowSubtitle(const QString &subtitle)
void WiresharkDialog::dialogCleanup(bool closeDialog)
{
- if ( closeDialog )
+ if (closeDialog)
{
// Cancel any taps in progress?
// cap_file_.setCaptureStopFlag();
diff --git a/ui/qt/wlan_statistics_dialog.cpp b/ui/qt/wlan_statistics_dialog.cpp
index 3459b6f453..ae93f7904e 100644
--- a/ui/qt/wlan_statistics_dialog.cpp
+++ b/ui/qt/wlan_statistics_dialog.cpp
@@ -116,7 +116,7 @@ public:
if (wlan_hdr->type != MGT_BEACON) packets_++;
}
void draw(address *bssid, int num_packets) {
- if(packets_ && num_packets > 0) {
+ if (packets_ && num_packets > 0) {
setData(col_pct_packets_, Qt::UserRole, QVariant::fromValue<double>(packets_ * 100.0 / num_packets));
setData(col_pct_retry_, Qt::UserRole, QVariant::fromValue<double>(retry_ * 100.0 / packets_));
} else {