mirror of
https://github.com/transmission/transmission
synced 2025-01-30 19:03:04 +00:00
chore: remove extraneous/default class destructors (#1317)
* chore: remove extraneous/default class destructors * fixup! chore: remove extraneous/default class destructors
This commit is contained in:
parent
0a897cb3aa
commit
fcda077cdd
32 changed files with 47 additions and 97 deletions
|
@ -80,7 +80,7 @@ static void clearMetainfo(tr_ctor* ctor)
|
|||
setSourceFile(ctor, NULL);
|
||||
}
|
||||
|
||||
int tr_ctorSetMetainfo(tr_ctor* ctor, uint8_t const* metainfo, size_t len)
|
||||
int tr_ctorSetMetainfo(tr_ctor* ctor, void const* metainfo, size_t len)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
|
|
@ -853,7 +853,7 @@ void tr_ctorSetDeleteSource(tr_ctor* ctor, bool doDelete);
|
|||
int tr_ctorSetMetainfoFromMagnetLink(tr_ctor* ctor, char const* magnet);
|
||||
|
||||
/** @brief Set the constructor's metainfo from a raw benc already in memory */
|
||||
int tr_ctorSetMetainfo(tr_ctor* ctor, uint8_t const* metainfo, size_t len);
|
||||
int tr_ctorSetMetainfo(tr_ctor* ctor, void const* metainfo, size_t len);
|
||||
|
||||
/** @brief Set the constructor's metainfo from a local .torrent file */
|
||||
int tr_ctorSetMetainfoFromFile(tr_ctor* ctor, char const* filename);
|
||||
|
|
|
@ -20,9 +20,7 @@ Checks: >
|
|||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
-cppcoreguidelines-pro-type-const-cast,
|
||||
-cppcoreguidelines-pro-type-cstyle-cast,
|
||||
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
-cppcoreguidelines-pro-type-static-cast-downcast,
|
||||
-cppcoreguidelines-special-member-functions,
|
||||
google-readability-*,
|
||||
google-runtime-operator,
|
||||
hicpp-*,
|
||||
|
|
|
@ -100,7 +100,7 @@ QString AddData::readableName() const
|
|||
tr_info inf;
|
||||
tr_ctor* ctor = tr_ctorNew(nullptr);
|
||||
|
||||
tr_ctorSetMetainfo(ctor, reinterpret_cast<quint8 const*>(metainfo.constData()), metainfo.size());
|
||||
tr_ctorSetMetainfo(ctor, metainfo.constData(), metainfo.size());
|
||||
|
||||
if (tr_torrentParse(ctor, &inf) == TR_PARSE_OK)
|
||||
{
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
#include <objbase.h>
|
||||
|
||||
#include <QAxFactory>
|
||||
#include <QAxObject>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
|
||||
#include "ComInteropHelper.h"
|
||||
#include "InteropObject.h"
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
|
||||
QAXFACTORY_BEGIN("{1e405fc2-1a3a-468b-8bd6-bfbb58770390}", "{792d1aac-53cc-4dc9-bc29-e5295fdb93a9}")
|
||||
QAXCLASS(InteropObject)
|
||||
QAXFACTORY_END()
|
||||
|
@ -32,8 +32,6 @@ ComInteropHelper::ComInteropHelper() :
|
|||
{
|
||||
}
|
||||
|
||||
ComInteropHelper::~ComInteropHelper() = default;
|
||||
|
||||
bool ComInteropHelper::isConnected() const
|
||||
{
|
||||
return !client_->isNull();
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
class QAxObject;
|
||||
#include <QAxObject>
|
||||
|
||||
class QObject;
|
||||
class QString;
|
||||
class QVariant;
|
||||
|
@ -19,7 +20,6 @@ class ComInteropHelper
|
|||
{
|
||||
public:
|
||||
ComInteropHelper();
|
||||
~ComInteropHelper();
|
||||
|
||||
bool isConnected() const;
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ class DBusInteropHelper
|
|||
{
|
||||
public:
|
||||
DBusInteropHelper() = default;
|
||||
~DBusInteropHelper() = default;
|
||||
|
||||
bool isConnected() const;
|
||||
|
||||
|
|
|
@ -99,8 +99,6 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
~PeerItem() override = default;
|
||||
|
||||
void refresh(Peer const& p)
|
||||
{
|
||||
if (p.address != peer_.address)
|
||||
|
|
|
@ -19,16 +19,11 @@
|
|||
***/
|
||||
|
||||
FaviconCache::FaviconCache() :
|
||||
nam_(new QNetworkAccessManager())
|
||||
nam_(new QNetworkAccessManager(this))
|
||||
{
|
||||
connect(nam_, SIGNAL(finished(QNetworkReply*)), this, SLOT(onRequestFinished(QNetworkReply*)));
|
||||
}
|
||||
|
||||
FaviconCache::~FaviconCache()
|
||||
{
|
||||
delete nam_;
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
|
|
@ -26,7 +26,6 @@ class FaviconCache : public QObject
|
|||
|
||||
public:
|
||||
FaviconCache();
|
||||
virtual ~FaviconCache();
|
||||
|
||||
// returns a cached pixmap, or a NULL pixmap if there's no match in the cache
|
||||
QPixmap find(QString const& key);
|
||||
|
|
|
@ -246,11 +246,6 @@ FilterBar::FilterBar(Prefs& prefs, TorrentModel const& torrents, TorrentFilter c
|
|||
}
|
||||
}
|
||||
|
||||
FilterBar::~FilterBar()
|
||||
{
|
||||
delete recount_timer_;
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
|
|
@ -28,7 +28,6 @@ class FilterBar : public QWidget
|
|||
|
||||
public:
|
||||
FilterBar(Prefs& prefs, TorrentModel const& torrents, TorrentFilter const& filter, QWidget* parent = nullptr);
|
||||
virtual ~FilterBar();
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
|
|
|
@ -26,8 +26,6 @@ class FreeSpaceLabel : public QLabel
|
|||
public:
|
||||
FreeSpaceLabel(QWidget* parent = nullptr);
|
||||
|
||||
virtual ~FreeSpaceLabel() = default;
|
||||
|
||||
void setSession(Session& session);
|
||||
void setPath(QString const& folder);
|
||||
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
#include "DBusInteropHelper.h"
|
||||
#endif
|
||||
|
||||
class QAxObject;
|
||||
class QString;
|
||||
class QVariant;
|
||||
|
||||
class InteropHelper
|
||||
{
|
||||
|
|
|
@ -19,8 +19,6 @@ class LicenseDialog : public BaseDialog
|
|||
public:
|
||||
LicenseDialog(QWidget* parent = nullptr);
|
||||
|
||||
virtual ~LicenseDialog() = default;
|
||||
|
||||
private:
|
||||
Ui::LicenseDialog ui_ = {};
|
||||
};
|
||||
|
|
|
@ -360,8 +360,6 @@ MainWindow::MainWindow(Session& session, Prefs& prefs, TorrentModel& model, bool
|
|||
refreshSoon();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() = default;
|
||||
|
||||
void MainWindow::onSessionSourceChanged()
|
||||
{
|
||||
model_.clear();
|
||||
|
|
|
@ -52,7 +52,6 @@ class MainWindow : public QMainWindow
|
|||
|
||||
public:
|
||||
MainWindow(Session&, Prefs&, TorrentModel&, bool minized);
|
||||
virtual ~MainWindow();
|
||||
|
||||
QSystemTrayIcon& trayIcon()
|
||||
{
|
||||
|
|
|
@ -258,8 +258,6 @@ MakeDialog::MakeDialog(Session& session, QWidget* parent) :
|
|||
onSourceChanged();
|
||||
}
|
||||
|
||||
MakeDialog::~MakeDialog() = default;
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
|
|
@ -29,7 +29,6 @@ class MakeDialog : public BaseDialog
|
|||
|
||||
public:
|
||||
MakeDialog(Session&, QWidget* parent = nullptr);
|
||||
virtual ~MakeDialog();
|
||||
|
||||
protected:
|
||||
// QWidget
|
||||
|
|
|
@ -160,7 +160,7 @@ void OptionsDialog::reload()
|
|||
break;
|
||||
|
||||
case AddData::METAINFO:
|
||||
tr_ctorSetMetainfo(ctor, reinterpret_cast<quint8 const*>(add_.metainfo.constData()), add_.metainfo.size());
|
||||
tr_ctorSetMetainfo(ctor, add_.metainfo.constData(), add_.metainfo.size());
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -649,8 +649,6 @@ PrefsDialog::PrefsDialog(Session& session, Prefs& prefs, QWidget* parent) :
|
|||
adjustSize();
|
||||
}
|
||||
|
||||
PrefsDialog::~PrefsDialog() = default;
|
||||
|
||||
void PrefsDialog::setPref(int key, QVariant const& v)
|
||||
{
|
||||
prefs_.set(key, v);
|
||||
|
|
|
@ -28,7 +28,6 @@ class PrefsDialog : public BaseDialog
|
|||
|
||||
public:
|
||||
PrefsDialog(Session&, Prefs&, QWidget* parent = nullptr);
|
||||
virtual ~PrefsDialog();
|
||||
|
||||
private:
|
||||
using key2widget_t = QMap<int, QWidget*>;
|
||||
|
|
|
@ -23,8 +23,6 @@ class RelocateDialog : public BaseDialog
|
|||
public:
|
||||
RelocateDialog(Session&, TorrentModel const&, torrent_ids_t ids, QWidget* parent = nullptr);
|
||||
|
||||
virtual ~RelocateDialog() = default;
|
||||
|
||||
private:
|
||||
QString newLocation() const;
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ class RpcClient : public QObject
|
|||
|
||||
public:
|
||||
RpcClient(QObject* parent = nullptr);
|
||||
virtual ~RpcClient() = default;
|
||||
|
||||
void stop();
|
||||
void start(tr_session* session);
|
||||
|
|
|
@ -38,8 +38,6 @@ StatsDialog::StatsDialog(Session& session, QWidget* parent) :
|
|||
session_.refreshSessionStats();
|
||||
}
|
||||
|
||||
StatsDialog::~StatsDialog() = default;
|
||||
|
||||
void StatsDialog::setVisible(bool visible)
|
||||
{
|
||||
timer_->stop();
|
||||
|
|
|
@ -22,7 +22,6 @@ class StatsDialog : public BaseDialog
|
|||
|
||||
public:
|
||||
StatsDialog(Session&, QWidget* parent = nullptr);
|
||||
~StatsDialog() override;
|
||||
|
||||
// QWidget
|
||||
void setVisible(bool visible) override;
|
||||
|
|
|
@ -127,11 +127,10 @@ ItemLayout::ItemLayout(QString name_text, QString status_text, QString progress_
|
|||
} // namespace
|
||||
|
||||
TorrentDelegate::TorrentDelegate(QObject* parent) :
|
||||
QStyledItemDelegate(parent),
|
||||
progress_bar_style_(new QStyleOptionProgressBar)
|
||||
QStyledItemDelegate(parent)
|
||||
{
|
||||
progress_bar_style_->minimum = 0;
|
||||
progress_bar_style_->maximum = 1000;
|
||||
progress_bar_style_.minimum = 0;
|
||||
progress_bar_style_.maximum = 1000;
|
||||
|
||||
green_brush = QColor("forestgreen");
|
||||
green_back = QColor("darkseagreen");
|
||||
|
@ -143,11 +142,6 @@ TorrentDelegate::TorrentDelegate(QObject* parent) :
|
|||
silver_back = QColor("grey");
|
||||
}
|
||||
|
||||
TorrentDelegate::~TorrentDelegate()
|
||||
{
|
||||
delete progress_bar_style_;
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
@ -452,15 +446,15 @@ void TorrentDelegate::setProgressBarPercentDone(QStyleOptionViewItem const& opti
|
|||
if (tor.isSeeding() && tor.getSeedRatio(seed_ratio_limit))
|
||||
{
|
||||
double const seed_rate_ratio = tor.ratio() / seed_ratio_limit;
|
||||
int const scaled_progress = seed_rate_ratio * (progress_bar_style_->maximum - progress_bar_style_->minimum);
|
||||
progress_bar_style_->progress = progress_bar_style_->minimum + scaled_progress;
|
||||
int const scaled_progress = seed_rate_ratio * (progress_bar_style_.maximum - progress_bar_style_.minimum);
|
||||
progress_bar_style_.progress = progress_bar_style_.minimum + scaled_progress;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool const is_magnet(!tor.hasMetadata());
|
||||
progress_bar_style_->direction = option.direction;
|
||||
progress_bar_style_->progress = static_cast<int>(progress_bar_style_->minimum + (is_magnet ? tor.metadataPercentDone() :
|
||||
tor.percentDone()) * (progress_bar_style_->maximum - progress_bar_style_->minimum));
|
||||
progress_bar_style_.direction = option.direction;
|
||||
progress_bar_style_.progress = static_cast<int>(progress_bar_style_.minimum + (is_magnet ? tor.metadataPercentDone() :
|
||||
tor.percentDone()) * (progress_bar_style_.maximum - progress_bar_style_.minimum));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -578,31 +572,31 @@ void TorrentDelegate::drawTorrent(QPainter* painter, QStyleOptionViewItem const&
|
|||
painter->drawText(layout.status_rect, Qt::AlignLeft | Qt::AlignVCenter, layout.statusText());
|
||||
painter->setFont(layout.progress_font);
|
||||
painter->drawText(layout.progress_rect, Qt::AlignLeft | Qt::AlignVCenter, layout.progressText());
|
||||
progress_bar_style_->rect = layout.bar_rect;
|
||||
progress_bar_style_.rect = layout.bar_rect;
|
||||
|
||||
if (tor.isDownloading())
|
||||
{
|
||||
progress_bar_style_->palette.setBrush(QPalette::Highlight, blue_brush);
|
||||
progress_bar_style_->palette.setColor(QPalette::Base, blue_back);
|
||||
progress_bar_style_->palette.setColor(QPalette::Window, blue_back);
|
||||
progress_bar_style_.palette.setBrush(QPalette::Highlight, blue_brush);
|
||||
progress_bar_style_.palette.setColor(QPalette::Base, blue_back);
|
||||
progress_bar_style_.palette.setColor(QPalette::Window, blue_back);
|
||||
}
|
||||
else if (tor.isSeeding())
|
||||
{
|
||||
progress_bar_style_->palette.setBrush(QPalette::Highlight, green_brush);
|
||||
progress_bar_style_->palette.setColor(QPalette::Base, green_back);
|
||||
progress_bar_style_->palette.setColor(QPalette::Window, green_back);
|
||||
progress_bar_style_.palette.setBrush(QPalette::Highlight, green_brush);
|
||||
progress_bar_style_.palette.setColor(QPalette::Base, green_back);
|
||||
progress_bar_style_.palette.setColor(QPalette::Window, green_back);
|
||||
}
|
||||
else
|
||||
{
|
||||
progress_bar_style_->palette.setBrush(QPalette::Highlight, silver_brush);
|
||||
progress_bar_style_->palette.setColor(QPalette::Base, silver_back);
|
||||
progress_bar_style_->palette.setColor(QPalette::Window, silver_back);
|
||||
progress_bar_style_.palette.setBrush(QPalette::Highlight, silver_brush);
|
||||
progress_bar_style_.palette.setColor(QPalette::Base, silver_back);
|
||||
progress_bar_style_.palette.setColor(QPalette::Window, silver_back);
|
||||
}
|
||||
|
||||
progress_bar_style_->state = progress_bar_state;
|
||||
progress_bar_style_.state = progress_bar_state;
|
||||
setProgressBarPercentDone(option, tor);
|
||||
|
||||
style->drawControl(QStyle::CE_ProgressBar, progress_bar_style_, painter);
|
||||
style->drawControl(QStyle::CE_ProgressBar, &progress_bar_style_, painter);
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ class TorrentDelegate : public QStyledItemDelegate
|
|||
|
||||
public:
|
||||
explicit TorrentDelegate(QObject* parent = nullptr);
|
||||
virtual ~TorrentDelegate();
|
||||
|
||||
// QAbstractItemDelegate
|
||||
QSize sizeHint(QStyleOptionViewItem const& option, QModelIndex const& index) const override;
|
||||
|
@ -43,8 +42,6 @@ protected:
|
|||
static QString shortStatusString(Torrent const& tor);
|
||||
static QString shortTransferString(Torrent const& tor);
|
||||
|
||||
QStyleOptionProgressBar* progress_bar_style_ = {};
|
||||
|
||||
static QColor blue_brush;
|
||||
static QColor green_brush;
|
||||
static QColor silver_brush;
|
||||
|
@ -52,6 +49,8 @@ protected:
|
|||
static QColor green_back;
|
||||
static QColor silver_back;
|
||||
|
||||
mutable QStyleOptionProgressBar progress_bar_style_ = {};
|
||||
|
||||
private:
|
||||
mutable std::optional<int> height_hint_;
|
||||
mutable QFont height_font_;
|
||||
|
|
|
@ -251,33 +251,33 @@ void TorrentDelegateMin::drawTorrent(QPainter* painter, QStyleOptionViewItem con
|
|||
painter->drawText(layout.name_rect, Qt::AlignLeft | Qt::AlignVCenter, layout.nameText());
|
||||
painter->setFont(layout.status_font);
|
||||
painter->drawText(layout.status_rect, Qt::AlignLeft | Qt::AlignVCenter, layout.statusText());
|
||||
progress_bar_style_->rect = layout.bar_rect;
|
||||
progress_bar_style_.rect = layout.bar_rect;
|
||||
|
||||
if (tor.isDownloading())
|
||||
{
|
||||
progress_bar_style_->palette.setBrush(QPalette::Highlight, blue_brush);
|
||||
progress_bar_style_->palette.setColor(QPalette::Base, blue_back);
|
||||
progress_bar_style_->palette.setColor(QPalette::Window, blue_back);
|
||||
progress_bar_style_.palette.setBrush(QPalette::Highlight, blue_brush);
|
||||
progress_bar_style_.palette.setColor(QPalette::Base, blue_back);
|
||||
progress_bar_style_.palette.setColor(QPalette::Window, blue_back);
|
||||
}
|
||||
else if (tor.isSeeding())
|
||||
{
|
||||
progress_bar_style_->palette.setBrush(QPalette::Highlight, green_brush);
|
||||
progress_bar_style_->palette.setColor(QPalette::Base, green_back);
|
||||
progress_bar_style_->palette.setColor(QPalette::Window, green_back);
|
||||
progress_bar_style_.palette.setBrush(QPalette::Highlight, green_brush);
|
||||
progress_bar_style_.palette.setColor(QPalette::Base, green_back);
|
||||
progress_bar_style_.palette.setColor(QPalette::Window, green_back);
|
||||
}
|
||||
else
|
||||
{
|
||||
progress_bar_style_->palette.setBrush(QPalette::Highlight, silver_brush);
|
||||
progress_bar_style_->palette.setColor(QPalette::Base, silver_back);
|
||||
progress_bar_style_->palette.setColor(QPalette::Window, silver_back);
|
||||
progress_bar_style_.palette.setBrush(QPalette::Highlight, silver_brush);
|
||||
progress_bar_style_.palette.setColor(QPalette::Base, silver_back);
|
||||
progress_bar_style_.palette.setColor(QPalette::Window, silver_back);
|
||||
}
|
||||
|
||||
progress_bar_style_->state = progress_bar_state;
|
||||
progress_bar_style_->text = QStringLiteral("%1%").arg(static_cast<int>(tr_truncd(100.0 * tor.percentDone(), 0)));
|
||||
progress_bar_style_->textVisible = true;
|
||||
progress_bar_style_->textAlignment = Qt::AlignCenter;
|
||||
progress_bar_style_.state = progress_bar_state;
|
||||
progress_bar_style_.text = QStringLiteral("%1%").arg(static_cast<int>(tr_truncd(100.0 * tor.percentDone(), 0)));
|
||||
progress_bar_style_.textVisible = true;
|
||||
progress_bar_style_.textAlignment = Qt::AlignCenter;
|
||||
setProgressBarPercentDone(option, tor);
|
||||
style->drawControl(QStyle::CE_ProgressBar, progress_bar_style_, painter);
|
||||
style->drawControl(QStyle::CE_ProgressBar, &progress_bar_style_, painter);
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
|
|
@ -27,8 +27,6 @@ TorrentFilter::TorrentFilter(Prefs const& prefs) :
|
|||
refilter();
|
||||
}
|
||||
|
||||
TorrentFilter::~TorrentFilter() = default;
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
|
|
@ -35,7 +35,6 @@ public:
|
|||
|
||||
public:
|
||||
explicit TorrentFilter(Prefs const& prefs);
|
||||
virtual ~TorrentFilter();
|
||||
[[nodiscard]] std::array<int, FilterMode::NUM_MODES> countTorrentsPerMode() const;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -58,11 +58,11 @@ void addAssociatedFileIcon(QFileInfo const& file_info, UINT icon_size, QIcon& ic
|
|||
|
||||
if (!QPixmapCache::find(pixmap_cache_key, &pixmap))
|
||||
{
|
||||
QString const filename = file_info.fileName();
|
||||
auto const filename = file_info.fileName().toStdWString();
|
||||
|
||||
SHFILEINFO shell_file_info;
|
||||
|
||||
if (::SHGetFileInfoW(reinterpret_cast<wchar_t const*>(filename.utf16()), FILE_ATTRIBUTE_NORMAL, &shell_file_info,
|
||||
if (::SHGetFileInfoW(filename.data(), FILE_ATTRIBUTE_NORMAL, &shell_file_info,
|
||||
sizeof(shell_file_info), SHGFI_ICON | icon_size | SHGFI_USEFILEATTRIBUTES) != 0)
|
||||
{
|
||||
if (shell_file_info.hIcon != nullptr)
|
||||
|
|
Loading…
Reference in a new issue