(r.args.get(), TR_KEY_name).value_or(QStringLiteral("(unknown)"));
- auto* d = new QMessageBox(
+ auto* d = new QMessageBox{
QMessageBox::Information,
tr("Error Renaming Path"),
tr(R"(Unable to rename "%1" as "%2": %3.
Please correct the errors and try again.
)")
@@ -508,7 +508,8 @@ void Session::torrentRenamePath(torrent_ids_t const& torrent_ids, QString const&
.arg(name)
.arg(r.result),
QMessageBox::Close,
- QApplication::activeWindow());
+ QApplication::activeWindow()
+ };
QObject::connect(d, &QMessageBox::rejected, d, &QMessageBox::deleteLater);
d->show();
});
@@ -661,7 +662,7 @@ void Session::refreshTorrents(torrent_ids_t const& torrent_ids, TorrentPropertie
dictAdd(&args, TR_KEY_fields, getKeyNames(props));
addOptionalIds(&args, torrent_ids);
- auto* q = new RpcQueue();
+ auto* q = new RpcQueue{};
q->add([this, &args]() { return exec(TR_KEY_torrent_get, &args); });
@@ -702,7 +703,7 @@ void Session::sendTorrentRequest(std::string_view request, torrent_ids_t const&
tr_variantInitDict(&args, 1);
addOptionalIds(&args, torrent_ids);
- auto* q = new RpcQueue();
+ auto* q = new RpcQueue{};
q->add([this, request, &args]() { return exec(request, &args); });
@@ -766,7 +767,7 @@ void Session::initTorrents(torrent_ids_t const& ids)
void Session::refreshSessionStats()
{
- auto* q = new RpcQueue();
+ auto* q = new RpcQueue{};
q->add([this]() { return exec("session-stats", nullptr); });
@@ -777,7 +778,7 @@ void Session::refreshSessionStats()
void Session::refreshSessionInfo()
{
- auto* q = new RpcQueue();
+ auto* q = new RpcQueue{};
q->add([this]() { return exec("session-get", nullptr); });
@@ -788,7 +789,7 @@ void Session::refreshSessionInfo()
void Session::updateBlocklist()
{
- auto* q = new RpcQueue();
+ auto* q = new RpcQueue{};
q->add([this]() { return exec("blocklist-update", nullptr); });
@@ -1023,18 +1024,17 @@ void Session::addTorrent(AddData add_me, tr_variant* args_dict, bool trash_origi
break;
}
- auto* q = new RpcQueue();
+ auto* q = new RpcQueue{};
q->add(
[this, args_dict]() { return exec("torrent-add", args_dict); },
[add_me](RpcResponse const& r)
{
- auto* d = new QMessageBox(
- QMessageBox::Warning,
- tr("Error Adding Torrent"),
- QStringLiteral("%1
%2
").arg(r.result).arg(add_me.readableName()),
- QMessageBox::Close,
- QApplication::activeWindow());
+ auto* d = new QMessageBox{ QMessageBox::Warning,
+ tr("Error Adding Torrent"),
+ QStringLiteral("%1
%2
").arg(r.result).arg(add_me.readableName()),
+ QMessageBox::Close,
+ QApplication::activeWindow() };
QObject::connect(d, &QMessageBox::rejected, d, &QMessageBox::deleteLater);
d->show();
});
@@ -1100,7 +1100,7 @@ void Session::onDuplicatesTimer()
auto const use_detail = lines.size() > 1;
auto const text = use_detail ? detail_text : detail;
- auto* d = new QMessageBox(QMessageBox::Warning, title, text, QMessageBox::Close, QApplication::activeWindow());
+ auto* d = new QMessageBox{ QMessageBox::Warning, title, text, QMessageBox::Close, QApplication::activeWindow() };
if (use_detail)
{
d->setDetailedText(detail);
diff --git a/qt/SessionDialog.cc b/qt/SessionDialog.cc
index 043504a92..6158976f0 100644
--- a/qt/SessionDialog.cc
+++ b/qt/SessionDialog.cc
@@ -44,9 +44,9 @@ void SessionDialog::resensitize() const
***/
SessionDialog::SessionDialog(Session& session, Prefs& prefs, QWidget* parent)
- : BaseDialog(parent)
- , session_(session)
- , prefs_(prefs)
+ : BaseDialog{ parent }
+ , session_{ session }
+ , prefs_{ prefs }
{
ui_.setupUi(this);
diff --git a/qt/SqueezeLabel.cc b/qt/SqueezeLabel.cc
index 49bcd54db..9d935d118 100644
--- a/qt/SqueezeLabel.cc
+++ b/qt/SqueezeLabel.cc
@@ -46,12 +46,12 @@
#include "SqueezeLabel.h"
SqueezeLabel::SqueezeLabel(QString const& text, QWidget* parent)
- : QLabel(text, parent)
+ : QLabel{ text, parent }
{
}
SqueezeLabel::SqueezeLabel(QWidget* parent)
- : QLabel(parent)
+ : QLabel{ parent }
{
}
@@ -62,9 +62,9 @@ void SqueezeLabel::paintEvent(QPaintEvent* paint_event)
return QLabel::paintEvent(paint_event);
}
- QPainter painter(this);
- QFontMetrics const fm = fontMetrics();
- QStyleOption opt;
+ auto painter = QPainter{ this };
+ auto const fm = fontMetrics();
+ auto opt = QStyleOption{};
opt.initFrom(this);
auto const full_text = text();
auto const elided_text = fm.elidedText(full_text, Qt::ElideRight, width());
diff --git a/qt/StatsDialog.cc b/qt/StatsDialog.cc
index 3fe46b76c..2912bd165 100644
--- a/qt/StatsDialog.cc
+++ b/qt/StatsDialog.cc
@@ -16,12 +16,12 @@ enum
};
StatsDialog::StatsDialog(Session& session, QWidget* parent)
- : BaseDialog(parent)
- , session_(session)
+ : BaseDialog{ parent }
+ , session_{ session }
{
ui_.setupUi(this);
- auto* cr = new ColumnResizer(this);
+ auto* cr = new ColumnResizer{ this };
cr->addLayout(ui_.currentSessionSectionLayout);
cr->addLayout(ui_.totalSectionLayout);
cr->update();
diff --git a/qt/Torrent.cc b/qt/Torrent.cc
index 62bf9f73a..9b11b41e3 100644
--- a/qt/Torrent.cc
+++ b/qt/Torrent.cc
@@ -23,8 +23,8 @@
using ::trqt::variant_helpers::change;
Torrent::Torrent(Prefs const& prefs, int id)
- : id_(id)
- , prefs_(prefs)
+ : id_{ id }
+ , prefs_{ prefs }
{
}
diff --git a/qt/TorrentDelegate.cc b/qt/TorrentDelegate.cc
index 62fdc20c7..a1fb9d6bb 100644
--- a/qt/TorrentDelegate.cc
+++ b/qt/TorrentDelegate.cc
@@ -84,7 +84,7 @@ public:
private:
[[nodiscard]] QString elidedText(QFont const& font, QString const& text, int width) const
{
- return QFontMetrics(font).elidedText(text, Qt::ElideRight, width);
+ return QFontMetrics{ font }.elidedText(text, Qt::ElideRight, width);
}
};
@@ -97,29 +97,29 @@ ItemLayout::ItemLayout(
Qt::LayoutDirection direction,
QPoint const& top_left,
int width)
- : name_text_(std::move(name_text))
- , status_text_(std::move(status_text))
- , progress_text_(std::move(progress_text))
- , name_font(base_font)
- , status_font(base_font)
- , progress_font(base_font)
+ : name_text_{ std::move(name_text) }
+ , status_text_{ std::move(status_text) }
+ , progress_text_{ std::move(progress_text) }
+ , name_font{ base_font }
+ , status_font{ base_font }
+ , progress_font{ base_font }
{
QStyle const* style = QApplication::style();
int const icon_size(style->pixelMetric(QStyle::PM_LargeIconSize));
name_font.setWeight(QFont::Bold);
- QFontMetrics const name_fm(name_font);
- QSize const name_size(name_fm.size(0, name_text_));
+ auto const name_fm = QFontMetrics{ name_font };
+ auto const name_size = name_fm.size(0, name_text_);
status_font.setPointSize(static_cast(status_font.pointSize() * 0.9));
- QFontMetrics const status_fm(status_font);
- QSize const status_size(status_fm.size(0, status_text_));
+ auto const status_fm = QFontMetrics{ status_font };
+ auto const status_size = status_fm.size(0, status_text_);
progress_font.setPointSize(static_cast(progress_font.pointSize() * 0.9));
- QFontMetrics const progress_fm(progress_font);
- QSize const progress_size(progress_fm.size(0, progress_text_));
+ auto const progress_fm = QFontMetrics{ progress_font };
+ auto const progress_size = progress_fm.size(0, progress_text_);
- QRect base_rect(top_left, QSize(width, 0));
+ auto base_rect = QRect{ top_left, QSize{ width, 0 } };
Utils::narrowRect(base_rect, icon_size + GUI_PAD, 0, direction);
name_rect = base_rect.adjusted(0, 0, 0, name_size.height());
@@ -129,8 +129,8 @@ ItemLayout::ItemLayout(
icon_rect = QStyle::alignedRect(
direction,
Qt::AlignLeft | Qt::AlignVCenter,
- QSize(icon_size, icon_size),
- QRect(top_left, QSize(width, progress_rect.bottom() - name_rect.top())));
+ QSize{ icon_size, icon_size },
+ QRect{ top_left, QSize{ width, progress_rect.bottom() - name_rect.top() } });
emblem_rect = QStyle::alignedRect(
direction,
Qt::AlignRight | Qt::AlignBottom,
@@ -400,15 +400,8 @@ QString TorrentDelegate::statusString(Torrent const& tor)
QSize TorrentDelegate::sizeHint(QStyleOptionViewItem const& option, Torrent const& tor) const
{
auto const m = margin(*QApplication::style());
- auto const layout = ItemLayout(
- tor.name(),
- progressString(tor),
- statusString(tor),
- QIcon(),
- option.font,
- option.direction,
- QPoint(0, 0),
- option.rect.width() - m.width() * 2);
+ auto const layout = ItemLayout{ tor.name(), progressString(tor), statusString(tor), QIcon{},
+ option.font, option.direction, QPoint(0, 0), option.rect.width() - m.width() * 2 };
return layout.size() + m * 2;
}
@@ -538,21 +531,14 @@ void TorrentDelegate::drawTorrent(QPainter* painter, QStyleOptionViewItem const&
progress_bar_state |= QStyle::State_Small | QStyle::State_Horizontal;
- QIcon::Mode const emblem_im = is_item_selected ? QIcon::Selected : QIcon::Normal;
- QIcon const emblem_icon = tor.hasError() ? getWarningEmblem() : QIcon();
+ auto const emblem_im = is_item_selected ? QIcon::Selected : QIcon::Normal;
+ auto const emblem_icon = tor.hasError() ? getWarningEmblem() : QIcon{};
// layout
- QSize const m(margin(*style));
- QRect const content_rect(option.rect.adjusted(m.width(), m.height(), -m.width(), -m.height()));
- ItemLayout const layout(
- tor.name(),
- progressString(tor),
- statusString(tor),
- emblem_icon,
- option.font,
- option.direction,
- content_rect.topLeft(),
- content_rect.width());
+ auto const m = margin(*style);
+ auto const content_rect = QRect{ option.rect.adjusted(m.width(), m.height(), -m.width(), -m.height()) };
+ auto const layout = ItemLayout{ tor.name(), progressString(tor), statusString(tor), emblem_icon,
+ option.font, option.direction, content_rect.topLeft(), content_rect.width() };
// render
if (tor.hasError() && !is_item_selected)
diff --git a/qt/TorrentDelegateMin.cc b/qt/TorrentDelegateMin.cc
index ee5e53f60..bc2ee0042 100644
--- a/qt/TorrentDelegateMin.cc
+++ b/qt/TorrentDelegateMin.cc
@@ -88,7 +88,7 @@ private:
[[nodiscard]] QString elidedText(QFont const& font, QString const& text, int width) const
{
- return QFontMetrics(font).elidedText(text, Qt::ElideRight, width);
+ return QFontMetrics{ font }.elidedText(text, Qt::ElideRight, width);
}
};
@@ -100,23 +100,23 @@ ItemLayout::ItemLayout(
Qt::LayoutDirection direction,
QPoint const& top_left,
int width)
- : name_font(base_font)
- , status_font(base_font)
- , name_text_(std::move(name_text))
- , status_text_(std::move(status_text))
+ : name_font{ base_font }
+ , status_font{ base_font }
+ , name_text_{ std::move(name_text) }
+ , status_text_{ std::move(status_text) }
{
auto const* style = QApplication::style();
int const icon_size = style->pixelMetric(QStyle::PM_SmallIconSize);
- auto const name_fm = QFontMetrics(name_font);
+ auto const name_fm = QFontMetrics{ name_font };
auto const name_size = name_fm.size(0, name_text_);
status_font.setPointSize(static_cast(status_font.pointSize() * 0.85));
- QFontMetrics const status_fm(status_font);
+ auto const status_fm = QFontMetrics{ status_font };
QSize const status_size(status_fm.size(0, status_text_));
QStyleOptionProgressBar bar_style;
- bar_style.rect = QRect(0, 0, BAR_WIDTH, BAR_HEIGHT);
+ bar_style.rect = QRect{ 0, 0, BAR_WIDTH, BAR_HEIGHT };
bar_style.maximum = 100;
bar_style.progress = 100;
bar_style.textVisible = true;
@@ -124,11 +124,10 @@ ItemLayout::ItemLayout(
bar_style.rect.width() * 2 - style->subElementRect(QStyle::SE_ProgressBarGroove, &bar_style).width(),
bar_style.rect.height());
- QRect base_rect(
- top_left,
- QSize(width, std::max({ icon_size, name_size.height(), status_size.height(), bar_size.height() })));
+ QRect base_rect{ top_left,
+ QSize{ width, std::max({ icon_size, name_size.height(), status_size.height(), bar_size.height() }) } };
- icon_rect = QStyle::alignedRect(direction, Qt::AlignLeft | Qt::AlignVCenter, QSize(icon_size, icon_size), base_rect);
+ icon_rect = QStyle::alignedRect(direction, Qt::AlignLeft | Qt::AlignVCenter, QSize{ icon_size, icon_size }, base_rect);
emblem_rect = QStyle::alignedRect(
direction,
Qt::AlignRight | Qt::AlignBottom,
@@ -139,7 +138,7 @@ ItemLayout::ItemLayout(
status_rect = QStyle::alignedRect(
direction,
Qt::AlignRight | Qt::AlignVCenter,
- QSize(status_size.width(), base_rect.height()),
+ QSize{ status_size.width(), base_rect.height() },
base_rect);
Utils::narrowRect(base_rect, 0, status_rect.width() + GUI_PAD, direction);
name_rect = base_rect;
@@ -225,7 +224,7 @@ void TorrentDelegateMin::drawTorrent(QPainter* painter, QStyleOptionViewItem con
progress_bar_state |= QStyle::State_Small | QStyle::State_Horizontal;
QIcon::Mode const emblem_im = is_item_selected ? QIcon::Selected : QIcon::Normal;
- QIcon const emblem_icon = tor.hasError() ? getWarningEmblem() : QIcon();
+ QIcon const emblem_icon = tor.hasError() ? getWarningEmblem() : QIcon{};
// layout
QSize const m(margin(*style));
diff --git a/qt/TorrentModel.cc b/qt/TorrentModel.cc
index 3ccd519ef..c7e3d04a8 100644
--- a/qt/TorrentModel.cc
+++ b/qt/TorrentModel.cc
@@ -242,7 +242,7 @@ void TorrentModel::updateTorrents(tr_variant* torrent_list, bool is_complete_lis
if (tor == nullptr)
{
- tor = new Torrent(prefs_, *id);
+ tor = new Torrent{ prefs_, *id };
instantiated.push_back(tor);
is_new = true;
}
@@ -433,9 +433,9 @@ void TorrentModel::rowsAdd(torrents_t const& torrents)
if (torrents_.empty())
{
- beginInsertRows(QModelIndex(), 0, torrents.size() - 1);
+ beginInsertRows(QModelIndex{}, 0, torrents.size() - 1);
torrents_ = torrents;
- std::sort(torrents_.begin(), torrents_.end(), TorrentIdLessThan());
+ std::sort(torrents_.begin(), torrents_.end(), TorrentIdLessThan{});
endInsertRows();
}
else
@@ -445,7 +445,7 @@ void TorrentModel::rowsAdd(torrents_t const& torrents)
auto const it = std::lower_bound(torrents_.begin(), torrents_.end(), tor, compare);
auto const row = static_cast(std::distance(torrents_.begin(), it));
- beginInsertRows(QModelIndex(), row, row);
+ beginInsertRows(QModelIndex{}, row, row);
torrents_.insert(it, tor);
endInsertRows();
}
@@ -460,7 +460,7 @@ void TorrentModel::rowsRemove(torrents_t const& torrents)
{
auto const& [first, last] = *it;
- beginRemoveRows(QModelIndex(), first, last);
+ beginRemoveRows(QModelIndex{}, first, last);
torrents_.erase(torrents_.begin() + first, torrents_.begin() + last + 1);
endRemoveRows();
}
diff --git a/qt/TorrentModel.h b/qt/TorrentModel.h
index df725200a..c8552f82c 100644
--- a/qt/TorrentModel.h
+++ b/qt/TorrentModel.h
@@ -52,7 +52,7 @@ public:
}
// QAbstractItemModel
- int rowCount(QModelIndex const& parent = QModelIndex()) const override;
+ int rowCount(QModelIndex const& parent = QModelIndex{}) const override;
QVariant data(QModelIndex const& index, int role = Qt::DisplayRole) const override;
public slots:
diff --git a/qt/TorrentView.cc b/qt/TorrentView.cc
index 4c47a30e6..a4874745a 100644
--- a/qt/TorrentView.cc
+++ b/qt/TorrentView.cc
@@ -13,7 +13,7 @@ class TorrentView::HeaderWidget : public QWidget
{
public:
explicit HeaderWidget(TorrentView* parent)
- : QWidget(parent)
+ : QWidget{ parent }
{
setFont(QApplication::font("QMiniFont"));
}
@@ -28,7 +28,7 @@ public:
[[nodiscard]] QSize sizeHint() const override
{
QStyleOptionHeader option;
- option.rect = QRect(0, 0, 100, 100);
+ option.rect = QRect{ 0, 0, 100, 100 };
QRect const label_rect = style()->subElementRect(QStyle::SE_HeaderLabel, &option, this);
@@ -44,7 +44,7 @@ protected:
option.state = QStyle::State_Enabled;
option.position = QStyleOptionHeader::OnlyOneSection;
- QStylePainter painter(this);
+ QStylePainter painter{ this };
painter.drawControl(QStyle::CE_HeaderSection, option);
option.rect = style()->subElementRect(QStyle::SE_HeaderLabel, &option, this);
diff --git a/qt/TrackerDelegate.cc b/qt/TrackerDelegate.cc
index 0705d93df..11f84b25a 100644
--- a/qt/TrackerDelegate.cc
+++ b/qt/TrackerDelegate.cc
@@ -60,7 +60,7 @@ ItemLayout::ItemLayout(
{
auto const icon_size = QSize{ FaviconCache::Width, FaviconCache::Height };
- QRect base_rect(top_left, QSize(width, 0));
+ QRect base_rect{ top_left, QSize{ width, 0 } };
icon_rect = QStyle::alignedRect(direction, Qt::AlignLeft | Qt::AlignTop, icon_size, base_rect);
Utils::narrowRect(base_rect, icon_size.width() + Spacing, 0, direction);
@@ -91,7 +91,7 @@ ItemLayout::ItemLayout(
QSize TrackerDelegate::sizeHint(QStyleOptionViewItem const& option, TrackerInfo const& info) const
{
- ItemLayout const layout(getText(info), true, option.direction, QPoint(0, 0), option.rect.width() - Margin.width() * 2);
+ ItemLayout const layout{ getText(info), true, option.direction, QPoint(0, 0), option.rect.width() - Margin.width() * 2 };
return layout.size() + Margin * 2;
}
diff --git a/qt/TrackerModel.cc b/qt/TrackerModel.cc
index 7e35532af..447d4bb34 100644
--- a/qt/TrackerModel.cc
+++ b/qt/TrackerModel.cc
@@ -78,7 +78,7 @@ struct CompareTrackers
void TrackerModel::refresh(TorrentModel const& torrent_model, torrent_ids_t const& ids)
{
// build a list of the TrackerInfos
- std::vector trackers;
+ auto trackers = std::vector{};
for (int const id : ids)
{
@@ -99,8 +99,8 @@ void TrackerModel::refresh(TorrentModel const& torrent_model, torrent_ids_t cons
}
// sort 'em
- CompareTrackers const comp;
- std::sort(trackers.begin(), trackers.end(), comp);
+ static auto constexpr Comp = CompareTrackers{};
+ std::sort(trackers.begin(), trackers.end(), Comp);
// merge 'em with the existing list
unsigned int old_index = 0;
@@ -111,19 +111,19 @@ void TrackerModel::refresh(TorrentModel const& torrent_model, torrent_ids_t cons
bool const is_end_of_old = old_index == rows_.size();
bool const is_end_of_new = new_index == trackers.size();
- if (is_end_of_old || (!is_end_of_new && comp(trackers.at(new_index), rows_.at(old_index))))
+ if (is_end_of_old || (!is_end_of_new && Comp(trackers.at(new_index), rows_.at(old_index))))
{
// add this new row
- beginInsertRows(QModelIndex(), old_index, old_index);
+ beginInsertRows(QModelIndex{}, old_index, old_index);
rows_.insert(rows_.begin() + old_index, trackers.at(new_index));
endInsertRows();
++old_index;
++new_index;
}
- else if (is_end_of_new || (!is_end_of_old && comp(rows_.at(old_index), trackers.at(new_index))))
+ else if (is_end_of_new || (!is_end_of_old && Comp(rows_.at(old_index), trackers.at(new_index))))
{
// remove this old row
- beginRemoveRows(QModelIndex(), old_index, old_index);
+ beginRemoveRows(QModelIndex{}, old_index, old_index);
rows_.erase(rows_.begin() + old_index);
endRemoveRows();
}
diff --git a/qt/TrackerModel.h b/qt/TrackerModel.h
index 495f9b7b7..4a968e323 100644
--- a/qt/TrackerModel.h
+++ b/qt/TrackerModel.h
@@ -41,7 +41,7 @@ public:
int find(int torrent_id, QString const& url) const;
// QAbstractItemModel
- int rowCount(QModelIndex const& parent = QModelIndex()) const override;
+ int rowCount(QModelIndex const& parent = QModelIndex{}) const override;
QVariant data(QModelIndex const& index, int role = Qt::DisplayRole) const override;
private:
diff --git a/qt/Utils.cc b/qt/Utils.cc
index d3005d5a9..83f9a3789 100644
--- a/qt/Utils.cc
+++ b/qt/Utils.cc
@@ -82,7 +82,7 @@ int Utils::measureViewItem(QAbstractItemView const* view, QString const& text)
option.font = view->font();
return view->style()
- ->sizeFromContents(QStyle::CT_ItemViewItem, &option, QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX), view)
+ ->sizeFromContents(QStyle::CT_ItemViewItem, &option, QSize{ QWIDGETSIZE_MAX, QWIDGETSIZE_MAX }, view)
.width();
}
@@ -93,7 +93,7 @@ int Utils::measureHeaderItem(QHeaderView const* view, QString const& text)
option.text = text;
option.sortIndicator = view->isSortIndicatorShown() ? QStyleOptionHeader::SortDown : QStyleOptionHeader::None;
- return view->style()->sizeFromContents(QStyle::CT_HeaderSection, &option, QSize(), view).width();
+ return view->style()->sizeFromContents(QStyle::CT_HeaderSection, &option, QSize{}, view).width();
}
QColor Utils::getFadedColor(QColor const& color)
diff --git a/qt/Utils.h b/qt/Utils.h
index 12521062f..1071f0ba1 100644
--- a/qt/Utils.h
+++ b/qt/Utils.h
@@ -64,7 +64,7 @@ public:
{
if (dialog.isNull())
{
- dialog = new DialogT(std::forward(args)...); // NOLINT clang-analyzer-cplusplus.NewDelete
+ dialog = new DialogT{ std::forward(args)... }; // NOLINT clang-analyzer-cplusplus.NewDelete
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
}
diff --git a/qt/WatchDir.cc b/qt/WatchDir.cc
index 193d872fa..3bb30b3c0 100644
--- a/qt/WatchDir.cc
+++ b/qt/WatchDir.cc
@@ -22,7 +22,7 @@
***/
WatchDir::WatchDir(TorrentModel const& model)
- : model_(model)
+ : model_{ model }
{
}
@@ -76,7 +76,7 @@ void WatchDir::setPath(QString const& path, bool is_enabled)
void WatchDir::watcherActivated(QString const& path)
{
- QDir const dir(path);
+ auto const dir = QDir{ path };
// get the list of files currently in the watch directory
QSet files;
@@ -108,7 +108,7 @@ void WatchDir::watcherActivated(QString const& path)
case AddResult::Error:
{
// give the torrent a few seconds to finish downloading
- auto* t = new QTimer(this);
+ auto* t = new QTimer{ this };
t->setObjectName(dir.absoluteFilePath(name));
t->setSingleShot(true);
connect(t, &QTimer::timeout, this, &WatchDir::onTimeout);