Clang-Tidy and Clazy fixes
This commit is contained in:
@@ -32,7 +32,7 @@ const int PlaylistGenerator::kDefaultLimit = 20;
|
||||
const int PlaylistGenerator::kDefaultDynamicHistory = 5;
|
||||
const int PlaylistGenerator::kDefaultDynamicFuture = 15;
|
||||
|
||||
PlaylistGenerator::PlaylistGenerator() : QObject(nullptr), backend_(nullptr) {}
|
||||
PlaylistGenerator::PlaylistGenerator(QObject *parent) : QObject(parent), backend_(nullptr) {}
|
||||
|
||||
PlaylistGeneratorPtr PlaylistGenerator::Create(const Type type) {
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class PlaylistGenerator : public QObject, public std::enable_shared_from_this<Pl
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PlaylistGenerator();
|
||||
explicit PlaylistGenerator(QObject *parent = nullptr);
|
||||
|
||||
static const int kDefaultLimit;
|
||||
static const int kDefaultDynamicHistory;
|
||||
|
||||
@@ -33,7 +33,7 @@ class PlaylistGeneratorMimeData : public MimeData {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PlaylistGeneratorMimeData(PlaylistGeneratorPtr generator) : generator_(generator) {}
|
||||
PlaylistGeneratorMimeData(PlaylistGeneratorPtr generator, QObject* = nullptr) : generator_(generator) {}
|
||||
|
||||
PlaylistGeneratorPtr generator_;
|
||||
};
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
#include "playlistquerygenerator.h"
|
||||
#include "collection/collectionbackend.h"
|
||||
|
||||
PlaylistQueryGenerator::PlaylistQueryGenerator() : dynamic_(false), current_pos_(0) {}
|
||||
PlaylistQueryGenerator::PlaylistQueryGenerator(QObject *parent) : PlaylistGenerator(parent), dynamic_(false), current_pos_(0) {}
|
||||
|
||||
PlaylistQueryGenerator::PlaylistQueryGenerator(const QString &name, const SmartPlaylistSearch &search, const bool dynamic)
|
||||
: search_(search), dynamic_(dynamic), current_pos_(0) {
|
||||
PlaylistQueryGenerator::PlaylistQueryGenerator(const QString &name, const SmartPlaylistSearch &search, const bool dynamic, QObject *parent)
|
||||
: PlaylistGenerator(parent), search_(search), dynamic_(dynamic), current_pos_(0) {
|
||||
|
||||
set_name(name);
|
||||
|
||||
@@ -88,6 +88,7 @@ PlaylistItemList PlaylistQueryGenerator::GenerateMore(const int count) {
|
||||
|
||||
SongList songs = backend_->FindSongs(search_copy);
|
||||
PlaylistItemList items;
|
||||
items.reserve(songs.count());
|
||||
for (const Song &song : songs) {
|
||||
items << PlaylistItemPtr(PlaylistItem::NewFromSong(song));
|
||||
previous_ids_ << song.id();
|
||||
|
||||
@@ -31,9 +31,11 @@
|
||||
#include "smartplaylistsearch.h"
|
||||
|
||||
class PlaylistQueryGenerator : public PlaylistGenerator {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PlaylistQueryGenerator();
|
||||
explicit PlaylistQueryGenerator(const QString &name, const SmartPlaylistSearch &search, const bool dynamic = false);
|
||||
explicit PlaylistQueryGenerator(QObject *parent = nullptr);
|
||||
explicit PlaylistQueryGenerator(const QString &name, const SmartPlaylistSearch &search, const bool dynamic = false, QObject *parent = nullptr);
|
||||
|
||||
Type type() const { return Type_Query; }
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@
|
||||
#include "ui_smartplaylistquerysearchpage.h"
|
||||
#include "ui_smartplaylistquerysortpage.h"
|
||||
|
||||
class SmartPlaylistQueryWizardPlugin::SearchPage : public QWizardPage {
|
||||
class SmartPlaylistQueryWizardPlugin::SearchPage : public QWizardPage { // clazy:exclude=missing-qobject-macro
|
||||
|
||||
friend class SmartPlaylistQueryWizardPlugin;
|
||||
|
||||
public:
|
||||
SearchPage(QWidget *parent = 0)
|
||||
explicit SearchPage(QWidget *parent = nullptr)
|
||||
: QWizardPage(parent), ui_(new Ui_SmartPlaylistQuerySearchPage) {
|
||||
ui_->setupUi(this);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class SmartPlaylistQueryWizardPlugin::SearchPage : public QWizardPage {
|
||||
std::unique_ptr<Ui_SmartPlaylistQuerySearchPage> ui_;
|
||||
};
|
||||
|
||||
class SmartPlaylistQueryWizardPlugin::SortPage : public QWizardPage {
|
||||
class SmartPlaylistQueryWizardPlugin::SortPage : public QWizardPage { // clazy:exclude=missing-qobject-macro
|
||||
public:
|
||||
SortPage(SmartPlaylistQueryWizardPlugin *plugin, QWidget *parent, int next_id)
|
||||
: QWizardPage(parent), next_id_(next_id), plugin_(plugin) {}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
SmartPlaylistSearch::SmartPlaylistSearch() { Reset(); }
|
||||
|
||||
SmartPlaylistSearch::SmartPlaylistSearch(const SearchType type, const TermList terms, const SortType sort_type, const SmartPlaylistSearchTerm::Field sort_field, const int limit)
|
||||
SmartPlaylistSearch::SmartPlaylistSearch(const SearchType type, const TermList &terms, const SortType sort_type, const SmartPlaylistSearchTerm::Field sort_field, const int limit)
|
||||
: search_type_(type),
|
||||
terms_(terms),
|
||||
sort_type_(sort_type),
|
||||
@@ -58,6 +58,7 @@ QString SmartPlaylistSearch::ToSql(const QString &songs_table) const {
|
||||
// Add search terms
|
||||
QStringList where_clauses;
|
||||
QStringList term_where_clauses;
|
||||
term_where_clauses.reserve(terms_.count());
|
||||
for (const SmartPlaylistSearchTerm &term : terms_) {
|
||||
term_where_clauses << term.ToSql();
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class SmartPlaylistSearch {
|
||||
enum SortType { Sort_Random = 0, Sort_FieldAsc, Sort_FieldDesc, };
|
||||
|
||||
explicit SmartPlaylistSearch();
|
||||
explicit SmartPlaylistSearch(const SearchType type, const TermList terms, const SortType sort_type, const SmartPlaylistSearchTerm::Field sort_field, const int limit = PlaylistGenerator::kDefaultLimit);
|
||||
explicit SmartPlaylistSearch(const SearchType type, const TermList &terms, const SortType sort_type, const SmartPlaylistSearchTerm::Field sort_field, const int limit = PlaylistGenerator::kDefaultLimit);
|
||||
|
||||
bool is_valid() const;
|
||||
bool operator==(const SmartPlaylistSearch &other) const;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
// Exported by QtGui
|
||||
void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0);
|
||||
|
||||
class SmartPlaylistSearchTermWidget::Overlay : public QWidget {
|
||||
class SmartPlaylistSearchTermWidget::Overlay : public QWidget { // clazy:exclude=missing-qobject-macro
|
||||
public:
|
||||
explicit Overlay(SmartPlaylistSearchTermWidget *parent);
|
||||
void Grab();
|
||||
@@ -377,31 +377,31 @@ SmartPlaylistSearchTerm SmartPlaylistSearchTermWidget::Term() const {
|
||||
// The value depends on the data type
|
||||
const QWidget *value_page = ui_->value_stack->currentWidget();
|
||||
if (value_page == ui_->page_text) {
|
||||
ret.value_ = ui_->value_text->text();
|
||||
ret.value_ = ui_->value_text->text(); // clazy:exclude=qt6-deprecated-api-fixes
|
||||
}
|
||||
else if (value_page == ui_->page_empty) {
|
||||
ret.value_ = "";
|
||||
ret.value_ = ""; // clazy:exclude=qt6-deprecated-api-fixes
|
||||
}
|
||||
else if (value_page == ui_->page_number) {
|
||||
ret.value_ = ui_->value_number->value();
|
||||
ret.value_ = ui_->value_number->value(); // clazy:exclude=qt6-deprecated-api-fixes
|
||||
}
|
||||
else if (value_page == ui_->page_date) {
|
||||
ret.value_ = ui_->value_date->dateTime().toSecsSinceEpoch();
|
||||
ret.value_ = ui_->value_date->dateTime().toSecsSinceEpoch(); // clazy:exclude=qt6-deprecated-api-fixes
|
||||
}
|
||||
else if (value_page == ui_->page_time) {
|
||||
ret.value_ = QTime(0, 0).secsTo(ui_->value_time->time());
|
||||
ret.value_ = QTime(0, 0).secsTo(ui_->value_time->time()); // clazy:exclude=qt6-deprecated-api-fixes
|
||||
}
|
||||
else if (value_page == ui_->page_date_numeric) {
|
||||
ret.date_ = SmartPlaylistSearchTerm::DateType(ui_->date_type->currentIndex());
|
||||
ret.value_ = ui_->value_date_numeric->value();
|
||||
ret.value_ = ui_->value_date_numeric->value(); // clazy:exclude=qt6-deprecated-api-fixes
|
||||
}
|
||||
else if (value_page == ui_->page_date_relative) {
|
||||
ret.date_ = SmartPlaylistSearchTerm::DateType(ui_->date_type_relative->currentIndex());
|
||||
ret.value_ = ui_->value_date_numeric1->value();
|
||||
ret.second_value_ = ui_->value_date_numeric2->value();
|
||||
ret.value_ = ui_->value_date_numeric1->value(); // clazy:exclude=qt6-deprecated-api-fixes
|
||||
ret.second_value_ = ui_->value_date_numeric2->value(); // clazy:exclude=qt6-deprecated-api-fixes
|
||||
}
|
||||
else if (value_page == ui_->page_rating) {
|
||||
ret.value_ = ui_->value_rating->rating();
|
||||
ret.value_ = ui_->value_rating->rating(); // clazy:exclude=qt6-deprecated-api-fixes
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -499,7 +499,7 @@ void SmartPlaylistSearchTermWidget::Overlay::paintEvent(QPaintEvent*) {
|
||||
// Icon and text
|
||||
p.setPen(palette().color(QPalette::Text));
|
||||
p.drawPixmap(icon, icon_);
|
||||
p.drawText(text, Qt::TextDontClip | Qt::AlignVCenter, text_);
|
||||
p.drawText(text, Qt::TextDontClip | Qt::AlignVCenter, text_); // NOLINT(bugprone-suspicious-enum-usage)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ class SmartPlaylistsItem : public SimpleTreeItem<SmartPlaylistsItem> {
|
||||
|
||||
PlaylistGenerator::Type smart_playlist_type;
|
||||
QByteArray smart_playlist_data;
|
||||
|
||||
Q_DISABLE_COPY(SmartPlaylistsItem)
|
||||
};
|
||||
|
||||
#endif // SMARTPLAYLISTSITEM_H
|
||||
|
||||
@@ -138,7 +138,7 @@ void SmartPlaylistsModel::Init() {
|
||||
// Append the new ones
|
||||
s.beginWriteArray(backend_->songs_table(), playlist_index + unwritten_defaults);
|
||||
for (; version < default_smart_playlists_.count(); ++version) {
|
||||
for (PlaylistGeneratorPtr gen : default_smart_playlists_[version]) {
|
||||
for (PlaylistGeneratorPtr gen : default_smart_playlists_[version]) { // clazy:exclude=range-loop
|
||||
SaveGenerator(&s, playlist_index++, gen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ void SmartPlaylistsViewContainer::ItemsSelectedChanged() {
|
||||
|
||||
}
|
||||
|
||||
void SmartPlaylistsViewContainer::RightClicked(const QPoint &global_pos, const QModelIndex &idx) {
|
||||
void SmartPlaylistsViewContainer::RightClicked(const QPoint global_pos, const QModelIndex &idx) {
|
||||
|
||||
context_menu_index_ = idx;
|
||||
if (context_menu_index_.isValid()) {
|
||||
|
||||
@@ -53,7 +53,7 @@ class SmartPlaylistsViewContainer : public QWidget {
|
||||
void ItemsSelectedChanged();
|
||||
void ItemDoubleClicked(const QModelIndex &idx);
|
||||
|
||||
void RightClicked(const QPoint &global_pos, const QModelIndex &idx);
|
||||
void RightClicked(const QPoint global_pos, const QModelIndex &idx);
|
||||
|
||||
void AppendToPlaylist();
|
||||
void ReplaceCurrentPlaylist();
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "smartplaylistwizardplugin.h"
|
||||
#include "ui_smartplaylistwizardfinishpage.h"
|
||||
|
||||
class SmartPlaylistWizard::TypePage : public QWizardPage {
|
||||
class SmartPlaylistWizard::TypePage : public QWizardPage { // clazy:exclude=missing-qobject-macro
|
||||
public:
|
||||
explicit TypePage(QWidget *parent) : QWizardPage(parent), next_id_(-1) {}
|
||||
|
||||
@@ -42,7 +42,7 @@ class SmartPlaylistWizard::TypePage : public QWizardPage {
|
||||
int next_id_;
|
||||
};
|
||||
|
||||
class SmartPlaylistWizard::FinishPage : public QWizardPage {
|
||||
class SmartPlaylistWizard::FinishPage : public QWizardPage { // clazy:exclude=missing-qobject-macro
|
||||
public:
|
||||
explicit FinishPage(QWidget *parent) : QWizardPage(parent), ui_(new Ui_SmartPlaylistWizardFinishPage) {
|
||||
ui_->setupUi(this);
|
||||
|
||||
Reference in New Issue
Block a user