Use override

This commit is contained in:
Jonas Kvinge
2020-06-15 21:55:05 +02:00
parent 72ede666d4
commit 651020388d
271 changed files with 1199 additions and 1231 deletions

View File

@@ -94,7 +94,7 @@ class Playlist : public QAbstractListModel {
public:
explicit Playlist(PlaylistBackend *backend, TaskManager *task_manager, CollectionBackend *collection, int id, const QString &special_type = QString(), bool favorite = false, QObject *parent = nullptr);
~Playlist();
~Playlist() override;
void SkipTracks(const QModelIndexList &source_indexes);
@@ -263,18 +263,18 @@ class Playlist : public QAbstractListModel {
#endif
// QAbstractListModel
int rowCount(const QModelIndex& = QModelIndex()) const { return items_.count(); }
int columnCount(const QModelIndex& = QModelIndex()) const { return ColumnCount; }
QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QStringList mimeTypes() const;
Qt::DropActions supportedDropActions() const;
QMimeData *mimeData(const QModelIndexList &indexes) const;
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
void sort(int column, Qt::SortOrder order);
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
int rowCount(const QModelIndex& = QModelIndex()) const override { return items_.count(); }
int columnCount(const QModelIndex& = QModelIndex()) const override { return ColumnCount; }
QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
QStringList mimeTypes() const override;
Qt::DropActions supportedDropActions() const override;
QMimeData *mimeData(const QModelIndexList &indexes) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
void sort(int column, Qt::SortOrder order) override;
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
static bool ComparePathDepths(Qt::SortOrder, PlaylistItemPtr, PlaylistItemPtr);

View File

@@ -67,8 +67,6 @@ PlaylistBackend::PlaylistBackend(Application *app, QObject *parent)
}
PlaylistBackend::~PlaylistBackend() {}
void PlaylistBackend::Close() {
if (db_) {

View File

@@ -46,8 +46,7 @@ class PlaylistBackend : public QObject {
Q_OBJECT
public:
Q_INVOKABLE PlaylistBackend(Application *app, QObject *parent = nullptr);
~PlaylistBackend();
Q_INVOKABLE explicit PlaylistBackend(Application *app, QObject *parent = nullptr);
struct Playlist {
Playlist() : id(-1), favorite(false), last_played(0) {}

View File

@@ -48,7 +48,7 @@ class PlaylistContainer : public QWidget {
public:
explicit PlaylistContainer(QWidget *parent = nullptr);
~PlaylistContainer();
~PlaylistContainer() override;
static const char *kSettingsGroup;
@@ -58,9 +58,9 @@ class PlaylistContainer : public QWidget {
PlaylistView *view() const;
bool eventFilter(QObject *objectWatched, QEvent *event);
bool eventFilter(QObject *objectWatched, QEvent *event) override;
signals:
signals:
void TabChanged(int id);
void Rename(int id, const QString &new_name);
@@ -69,7 +69,7 @@ signals:
protected:
// QWidget
void resizeEvent(QResizeEvent*);
void resizeEvent(QResizeEvent*) override;
private slots:
void NewPlaylist();

View File

@@ -58,12 +58,13 @@ class Player;
class QueuedItemDelegate : public QStyledItemDelegate {
public:
QueuedItemDelegate(QObject *parent, int indicator_column = Playlist::Column_Title);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
void DrawBox(QPainter *painter, const QRect &line_rect, const QFont &font, const QString &text, int width = -1) const;
int queue_indicator_size(const QModelIndex &index) const;
private:
private:
static const int kQueueBoxBorder;
static const int kQueueBoxCornerRadius;
static const int kQueueBoxLength;
@@ -77,18 +78,20 @@ private:
class PlaylistDelegateBase : public QueuedItemDelegate {
Q_OBJECT
public:
explicit PlaylistDelegateBase(QObject *parent, const QString &suffix = QString());
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QString displayText(const QVariant &value, const QLocale &locale) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QString displayText(const QVariant &value, const QLocale &locale) const override;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QStyleOptionViewItem Adjusted(const QStyleOptionViewItem &option, const QModelIndex &index) const;
static const int kMinHeight;
public slots:
bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index);
bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index) override;
protected:
QTreeView *view_;
@@ -98,44 +101,44 @@ class PlaylistDelegateBase : public QueuedItemDelegate {
class LengthItemDelegate : public PlaylistDelegateBase {
public:
explicit LengthItemDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
QString displayText(const QVariant &value, const QLocale &locale) const;
QString displayText(const QVariant &value, const QLocale &locale) const override;
};
class SizeItemDelegate : public PlaylistDelegateBase {
public:
explicit SizeItemDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
QString displayText(const QVariant &value, const QLocale &locale) const;
QString displayText(const QVariant &value, const QLocale &locale) const override;
};
class DateItemDelegate : public PlaylistDelegateBase {
public:
explicit DateItemDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
QString displayText(const QVariant &value, const QLocale &locale) const;
QString displayText(const QVariant &value, const QLocale &locale) const override;
};
class LastPlayedItemDelegate : public PlaylistDelegateBase {
public:
public:
LastPlayedItemDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
QString displayText(const QVariant &value, const QLocale &locale) const;
QString displayText(const QVariant &value, const QLocale &locale) const override;
};
class FileTypeItemDelegate : public PlaylistDelegateBase {
public:
FileTypeItemDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
QString displayText(const QVariant &value, const QLocale &locale) const;
QString displayText(const QVariant &value, const QLocale &locale) const override;
};
class TextItemDelegate : public PlaylistDelegateBase {
public:
explicit TextItemDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &idx) const;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &idx) const override;
};
class TagCompletionModel : public QStringListModel {
public:
public:
explicit TagCompletionModel(CollectionBackend *backend, Playlist::Column column);
private:
private:
static QString database_column(Playlist::Column column);
};
@@ -144,7 +147,7 @@ class TagCompleter : public QCompleter {
public:
explicit TagCompleter(CollectionBackend *backend, Playlist::Column column, QLineEdit *editor);
~TagCompleter();
~TagCompleter() override;
private slots:
void ModelReady(QFuture<TagCompletionModel*> future);
@@ -157,7 +160,7 @@ class TagCompletionItemDelegate : public PlaylistDelegateBase {
public:
explicit TagCompletionItemDelegate(QObject *parent, CollectionBackend *backend, Playlist::Column column) : PlaylistDelegateBase(parent), backend_(backend), column_(column) {};
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
private:
CollectionBackend *backend_;
@@ -167,14 +170,14 @@ class TagCompletionItemDelegate : public PlaylistDelegateBase {
class NativeSeparatorsDelegate : public PlaylistDelegateBase {
public:
explicit NativeSeparatorsDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
QString displayText(const QVariant &value, const QLocale &locale) const;
QString displayText(const QVariant &value, const QLocale &locale) const override;
};
class SongSourceDelegate : public PlaylistDelegateBase {
public:
explicit SongSourceDelegate(QObject *parent);
QString displayText(const QVariant &value, const QLocale &locale) const;
void paint(QPainter *paint, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QString displayText(const QVariant &value, const QLocale &locale) const override;
void paint(QPainter *paint, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
private:
QPixmap LookupPixmap(const Song::Source &source, const QSize &size) const;

View File

@@ -38,14 +38,14 @@ class PlaylistFilter : public QSortFilterProxyModel {
public:
explicit PlaylistFilter(QObject *parent = nullptr);
~PlaylistFilter();
~PlaylistFilter() override;
// QAbstractItemModel
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
// QSortFilterProxyModel
// public so Playlist::NextVirtualIndex and friends can get at it
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
private:
// Mutable because they're modified from filterAcceptsRow() const

View File

@@ -43,7 +43,7 @@ class SearchTermComparator {
class DefaultComparator : public SearchTermComparator {
public:
explicit DefaultComparator(const QString &value) : search_term_(value) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
return element.contains(search_term_);
}
private:
@@ -53,7 +53,7 @@ class DefaultComparator : public SearchTermComparator {
class EqComparator : public SearchTermComparator {
public:
explicit EqComparator(const QString &value) : search_term_(value) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
return search_term_ == element;
}
private:
@@ -63,7 +63,7 @@ class EqComparator : public SearchTermComparator {
class NeComparator : public SearchTermComparator {
public:
explicit NeComparator(const QString &value) : search_term_(value) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
return search_term_ != element;
}
private:
@@ -73,7 +73,7 @@ class NeComparator : public SearchTermComparator {
class LexicalGtComparator : public SearchTermComparator {
public:
explicit LexicalGtComparator(const QString &value) : search_term_(value) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
return element > search_term_;
}
private:
@@ -83,7 +83,7 @@ class LexicalGtComparator : public SearchTermComparator {
class LexicalGeComparator : public SearchTermComparator {
public:
explicit LexicalGeComparator(const QString &value) : search_term_(value) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
return element >= search_term_;
}
private:
@@ -93,7 +93,7 @@ class LexicalGeComparator : public SearchTermComparator {
class LexicalLtComparator : public SearchTermComparator {
public:
explicit LexicalLtComparator(const QString &value) : search_term_(value) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
return element < search_term_;
}
private:
@@ -103,7 +103,7 @@ class LexicalLtComparator : public SearchTermComparator {
class LexicalLeComparator : public SearchTermComparator {
public:
explicit LexicalLeComparator(const QString &value) : search_term_(value) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
return element <= search_term_;
}
private:
@@ -113,7 +113,7 @@ class LexicalLeComparator : public SearchTermComparator {
class GtComparator : public SearchTermComparator {
public:
explicit GtComparator(int value) : search_term_(value) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
return element.toInt() > search_term_;
}
private:
@@ -123,7 +123,7 @@ class GtComparator : public SearchTermComparator {
class GeComparator : public SearchTermComparator {
public:
explicit GeComparator(int value) : search_term_(value) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
return element.toInt() >= search_term_;
}
private:
@@ -133,7 +133,7 @@ class GeComparator : public SearchTermComparator {
class LtComparator : public SearchTermComparator {
public:
explicit LtComparator(int value) : search_term_(value) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
return element.toInt() < search_term_;
}
private:
@@ -143,7 +143,7 @@ class LtComparator : public SearchTermComparator {
class LeComparator : public SearchTermComparator {
public:
explicit LeComparator(int value) : search_term_(value) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
return element.toInt() <= search_term_;
}
private:
@@ -157,7 +157,7 @@ class DropTailComparatorDecorator : public SearchTermComparator {
public:
explicit DropTailComparatorDecorator(SearchTermComparator *cmp) : cmp_(cmp) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
if (element.length() > 9)
return cmp_->Matches(element.left(element.length() - 9));
else
@@ -170,7 +170,7 @@ class DropTailComparatorDecorator : public SearchTermComparator {
class RatingComparatorDecorator : public SearchTermComparator {
public:
explicit RatingComparatorDecorator(SearchTermComparator *cmp) : cmp_(cmp) {}
virtual bool Matches(const QString &element) const {
bool Matches(const QString &element) const override {
return cmp_->Matches(
QString::number(static_cast<int>(element.toDouble() * 10.0 + 0.5)));
}
@@ -183,14 +183,14 @@ class FilterTerm : public FilterTree {
public:
explicit FilterTerm(SearchTermComparator *comparator, const QList<int> &columns) : cmp_(comparator), columns_(columns) {}
virtual bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const {
bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const override {
for (int i : columns_) {
QModelIndex idx(model->index(row, i, parent));
if (cmp_->Matches(idx.data().toString().toLower())) return true;
}
return false;
}
virtual FilterType type() { return Term; }
FilterType type() override { return Term; }
private:
QScopedPointer<SearchTermComparator> cmp_;
QList<int> columns_;
@@ -201,11 +201,11 @@ class FilterColumnTerm : public FilterTree {
public:
FilterColumnTerm(int column, SearchTermComparator *comparator) : col(column), cmp_(comparator) {}
virtual bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const {
bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const override {
QModelIndex idx(model->index(row, col, parent));
return cmp_->Matches(idx.data().toString().toLower());
}
virtual FilterType type() { return Column; }
FilterType type() override { return Column; }
private:
int col;
QScopedPointer<SearchTermComparator> cmp_;
@@ -215,40 +215,40 @@ class NotFilter : public FilterTree {
public:
explicit NotFilter(const FilterTree *inv) : child_(inv) {}
virtual bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const {
bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const override {
return !child_->accept(row, parent, model);
}
virtual FilterType type() { return Not; }
FilterType type() override { return Not; }
private:
QScopedPointer<const FilterTree> child_;
};
class OrFilter : public FilterTree {
public:
~OrFilter() { qDeleteAll(children_); }
~OrFilter() override { qDeleteAll(children_); }
virtual void add(FilterTree *child) { children_.append(child); }
virtual bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const {
bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const override {
for (FilterTree *child : children_) {
if (child->accept(row, parent, model)) return true;
}
return false;
}
FilterType type() { return Or; }
FilterType type() override { return Or; }
private:
QList<FilterTree*> children_;
};
class AndFilter : public FilterTree {
public:
virtual ~AndFilter() { qDeleteAll(children_); }
~AndFilter() override { qDeleteAll(children_); }
virtual void add(FilterTree *child) { children_.append(child); }
virtual bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const {
bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const override {
for (FilterTree *child : children_) {
if (!child->accept(row, parent, model)) return false;
}
return true;
}
FilterType type() { return And; }
FilterType type() override { return And; }
private:
QList<FilterTree*> children_;
};

View File

@@ -49,8 +49,8 @@ class FilterTree {
// trivial filter that accepts *anything*
class NopFilter : public FilterTree {
public:
virtual bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const { Q_UNUSED(row); Q_UNUSED(parent); Q_UNUSED(model); return true; }
virtual FilterType type() { return Nop; }
bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const override { Q_UNUSED(row); Q_UNUSED(parent); Q_UNUSED(model); return true; }
FilterType type() override { return Nop; }
};

View File

@@ -43,8 +43,8 @@ class PlaylistHeader : public StretchHeaderView {
explicit PlaylistHeader(Qt::Orientation orientation, PlaylistView *view, QWidget *parent = nullptr);
// QWidget
void contextMenuEvent(QContextMenuEvent *e);
void enterEvent(QEvent *);
void contextMenuEvent(QContextMenuEvent *e) override;
void enterEvent(QEvent *) override;
signals:
void SectionVisibilityChanged(int logical, bool visible);

View File

@@ -64,7 +64,7 @@ public:
: QSortFilterProxyModel(parent) {
}
bool lessThan(const QModelIndex &left, const QModelIndex &right) const {
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override {
// Compare the display text first.
const int ret = left.data().toString().localeAwareCompare(right.data().toString());
if (ret < 0) return true;

View File

@@ -49,15 +49,15 @@ class PlaylistListContainer : public QWidget {
public:
explicit PlaylistListContainer(QWidget *parent = nullptr);
~PlaylistListContainer();
~PlaylistListContainer() override;
void SetApplication(Application *app);
protected:
void showEvent(QShowEvent *e);
void contextMenuEvent(QContextMenuEvent *e);
protected:
void showEvent(QShowEvent *e) override;
void contextMenuEvent(QContextMenuEvent *e) override;
private slots:
private slots:
// From the UI
void NewFolderClicked();
void DeleteClicked();

View File

@@ -49,7 +49,7 @@ class PlaylistListModel : public QStandardItemModel {
Role_PlaylistId
};
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
// These icons will be used for newly created playlists and folders.
// The caller will need to set these icons on existing items if there are any.
@@ -77,7 +77,7 @@ class PlaylistListModel : public QStandardItemModel {
QStandardItem *NewPlaylist(const QString &name, int id) const;
// QStandardItemModel
bool setData(const QModelIndex &index, const QVariant &value, int role);
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
signals:
void PlaylistPathChanged(int id, const QString &new_path);

View File

@@ -36,11 +36,10 @@ class PlaylistListView : public AutoExpandingTreeView {
public:
explicit PlaylistListView(QWidget *parent = nullptr);
~PlaylistListView() {}
protected:
// QWidget
void paintEvent(QPaintEvent *event);
void paintEvent(QPaintEvent *event) override;
};
#endif // PLAYLISTVIEW_H

View File

@@ -133,72 +133,72 @@ class PlaylistManager : public PlaylistManagerInterface {
public:
explicit PlaylistManager(Application *app, QObject *parent = nullptr);
~PlaylistManager();
~PlaylistManager() override;
int current_id() const { return current_; }
int active_id() const { return active_; }
int current_id() const override { return current_; }
int active_id() const override { return active_; }
Playlist *playlist(int id) const { return playlists_[id].p; }
Playlist *current() const { return playlist(current_id()); }
Playlist *active() const { return playlist(active_id()); }
Playlist *playlist(int id) const override { return playlists_[id].p; }
Playlist *current() const override { return playlist(current_id()); }
Playlist *active() const override { return playlist(active_id()); }
// Returns the collection of playlists managed by this PlaylistManager.
QList<Playlist*> GetAllPlaylists() const;
QList<Playlist*> GetAllPlaylists() const override;
// Grays out and reloads all deleted songs in all playlists.
void InvalidateDeletedSongs();
void InvalidateDeletedSongs() override;
// Removes all deleted songs from all playlists.
void RemoveDeletedSongs();
void RemoveDeletedSongs() override;
// Returns true if the playlist is open
bool IsPlaylistOpen(int id);
// Returns a pretty automatic name for playlist created from the given list of songs.
static QString GetNameForNewPlaylist(const SongList& songs);
QItemSelection selection(int id) const;
QItemSelection current_selection() const { return selection(current_id()); }
QItemSelection active_selection() const { return selection(active_id()); }
QItemSelection selection(int id) const override;
QItemSelection current_selection() const override { return selection(current_id()); }
QItemSelection active_selection() const override { return selection(active_id()); }
QString GetPlaylistName(int index) const { return playlists_[index].name; }
QString GetPlaylistName(int index) const override { return playlists_[index].name; }
bool IsPlaylistFavorite(int index) const { return playlists_[index].p->is_favorite(); }
void Init(CollectionBackend *collection_backend, PlaylistBackend *playlist_backend, PlaylistSequence *sequence, PlaylistContainer *playlist_container);
CollectionBackend *collection_backend() const { return collection_backend_; }
PlaylistBackend *playlist_backend() const { return playlist_backend_; }
PlaylistSequence *sequence() const { return sequence_; }
PlaylistParser *parser() const { return parser_; }
PlaylistContainer *playlist_container() const { return playlist_container_; }
CollectionBackend *collection_backend() const override { return collection_backend_; }
PlaylistBackend *playlist_backend() const override { return playlist_backend_; }
PlaylistSequence *sequence() const override { return sequence_; }
PlaylistParser *parser() const override { return parser_; }
PlaylistContainer *playlist_container() const override { return playlist_container_; }
public slots:
void New(const QString &name, const SongList &songs = SongList(), const QString &special_type = QString());
void Load(const QString &filename);
void Save(int id, const QString &filename, Playlist::Path path_type);
void New(const QString &name, const SongList &songs = SongList(), const QString &special_type = QString()) override;
void Load(const QString &filename) override;
void Save(int id, const QString &filename, Playlist::Path path_type) override;
// Display a file dialog to let user choose a file before saving the file
void SaveWithUI(int id, const QString &playlist_name);
void Rename(int id, const QString &new_name);
void Rename(int id, const QString &new_name) override;
void Favorite(int id, bool favorite);
void Delete(int id);
bool Close(int id);
void Open(int id);
void ChangePlaylistOrder(const QList<int>& ids);
void Delete(int id) override;
bool Close(int id) override;
void Open(int id) override;
void ChangePlaylistOrder(const QList<int>& ids) override;
void SetCurrentPlaylist(int id);
void SetActivePlaylist(int id);
void SetActiveToCurrent();
void SetCurrentPlaylist(int id) override;
void SetActivePlaylist(int id) override;
void SetActiveToCurrent() override;
void SelectionChanged(const QItemSelection &selection);
void SelectionChanged(const QItemSelection &selection) override;
// Makes a playlist current if it's open already, or opens it and makes it current if it is hidden.
void SetCurrentOrOpen(int id);
// Convenience slots that defer to either current() or active()
void ClearCurrent();
void ShuffleCurrent();
void RemoveDuplicatesCurrent();
void RemoveUnavailableCurrent();
void ClearCurrent() override;
void ShuffleCurrent() override;
void RemoveDuplicatesCurrent() override;
void RemoveUnavailableCurrent() override;
//void SetActiveStreamMetadata(const QUrl& url, const Song& song);
void SongChangeRequestProcessed(const QUrl& url, bool valid);
void SongChangeRequestProcessed(const QUrl& url, bool valid) override;
void InsertUrls(int id, const QList<QUrl>& urls, int pos = -1, bool play_now = false, bool enqueue = false);
void InsertSongs(int id, const SongList& songs, int pos = -1, bool play_now = false, bool enqueue = false);
@@ -208,9 +208,9 @@ class PlaylistManager : public PlaylistManagerInterface {
void RemoveCurrentSong();
private slots:
void SetActivePlaying();
void SetActivePaused();
void SetActiveStopped();
void SetActivePlaying() override;
void SetActivePaused() override;
void SetActiveStopped() override;
void OneOfPlaylistsChanged();
void UpdateSummaryText();

View File

@@ -40,9 +40,9 @@ class PlaylistSaveOptionsDialog : public QDialog {
public:
explicit PlaylistSaveOptionsDialog(QWidget *parent = 0);
~PlaylistSaveOptionsDialog();
~PlaylistSaveOptionsDialog() override;
void accept();
void accept() override;
Playlist::Path path_type() const;
private:

View File

@@ -41,8 +41,8 @@ class PlaylistSequence : public QWidget {
Q_OBJECT
public:
explicit PlaylistSequence(QWidget *parent = nullptr, SettingsProvider *settings = 0);
~PlaylistSequence();
explicit PlaylistSequence(QWidget *parent = nullptr, SettingsProvider *settings = nullptr);
~PlaylistSequence() override;
enum RepeatMode {
Repeat_Off = 0,

View File

@@ -79,15 +79,15 @@ class PlaylistTabBar : public QTabBar {
void PlaylistFavorited(int id, bool favorite);
protected:
void contextMenuEvent(QContextMenuEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void mouseDoubleClickEvent(QMouseEvent *e);
void dragEnterEvent(QDragEnterEvent *e);
void dragMoveEvent(QDragMoveEvent *e);
void dragLeaveEvent(QDragLeaveEvent *e);
void dropEvent(QDropEvent *e);
void timerEvent(QTimerEvent *e);
bool event(QEvent *e);
void contextMenuEvent(QContextMenuEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void mouseDoubleClickEvent(QMouseEvent *e) override;
void dragEnterEvent(QDragEnterEvent *e) override;
void dragMoveEvent(QDragMoveEvent *e) override;
void dragLeaveEvent(QDragLeaveEvent *e) override;
void dropEvent(QDropEvent *e) override;
void timerEvent(QTimerEvent *e) override;
bool event(QEvent *e) override;
private slots:
void CurrentIndexChanged(int index);

View File

@@ -51,8 +51,8 @@ namespace PlaylistUndoCommands {
public:
explicit InsertItems(Playlist *playlist, const PlaylistItemList &items, int pos, bool enqueue = false, bool enqueue_next = false);
void undo();
void redo();
void undo() override;
void redo() override;
// When load is async, items have already been pushed, so we need to update them.
// This function try to find the equivalent item, and replace it with the new (completely loaded) one.
// Return true if the was found (and updated), false otherwise
@@ -69,11 +69,11 @@ namespace PlaylistUndoCommands {
public:
explicit RemoveItems(Playlist *playlist, int pos, int count);
int id() const { return Type_RemoveItems; }
int id() const override { return Type_RemoveItems; }
void undo();
void redo();
bool mergeWith(const QUndoCommand *other);
void undo() override;
void redo() override;
bool mergeWith(const QUndoCommand *other) override;
private:
struct Range {
@@ -90,8 +90,8 @@ namespace PlaylistUndoCommands {
public:
explicit MoveItems(Playlist *playlist, const QList<int> &source_rows, int pos);
void undo();
void redo();
void undo() override;
void redo() override;
private:
QList<int> source_rows_;
@@ -102,8 +102,8 @@ namespace PlaylistUndoCommands {
public:
explicit ReOrderItems(Playlist *playlist, const PlaylistItemList &new_items);
void undo();
void redo();
void undo() override;
void redo() override;
private:
PlaylistItemList old_items_;

View File

@@ -82,8 +82,8 @@ class PlaylistProxyStyle : public QProxyStyle {
public:
explicit PlaylistProxyStyle();
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override;
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override;
private:
std::unique_ptr<QCommonStyle> common_style_;
@@ -91,10 +91,10 @@ class PlaylistProxyStyle : public QProxyStyle {
class PlaylistView : public QTreeView {
Q_OBJECT
public:
public:
explicit PlaylistView(QWidget *parent = nullptr);
~PlaylistView();
~PlaylistView() override;
static ColumnAlignmentMap DefaultColumnAlignment();
@@ -109,13 +109,11 @@ class PlaylistView : public QTreeView {
AppearanceSettingsPage::BackgroundImageType background_image_type() const { return background_image_type_; }
Qt::Alignment column_alignment(int section) const;
// QTreeView
void drawTree(QPainter *painter, const QRegion &region) const;
void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void setModel(QAbstractItemModel *model);
void ResetColumns();
// QTreeView
void setModel(QAbstractItemModel *model) override;
public slots:
void ReloadSettings();
void SaveGeometry();
@@ -136,29 +134,33 @@ class PlaylistView : public QTreeView {
protected:
// QWidget
void keyPressEvent(QKeyEvent *event);
void contextMenuEvent(QContextMenuEvent *e);
void hideEvent(QHideEvent *event);
void showEvent(QShowEvent *event);
void timerEvent(QTimerEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void leaveEvent(QEvent*);
void paintEvent(QPaintEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dragLeaveEvent(QDragLeaveEvent *event);
void dropEvent(QDropEvent *event);
bool eventFilter(QObject *object, QEvent *event);
void focusInEvent(QFocusEvent *event);
void keyPressEvent(QKeyEvent *event) override;
void contextMenuEvent(QContextMenuEvent *e) override;
void hideEvent(QHideEvent *event) override;
void showEvent(QShowEvent *event) override;
void timerEvent(QTimerEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void leaveEvent(QEvent*) override;
void paintEvent(QPaintEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
void dragLeaveEvent(QDragLeaveEvent *event) override;
void dropEvent(QDropEvent *event) override;
bool eventFilter(QObject *object, QEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
// QTreeView
void drawTree(QPainter *painter, const QRegion &region) const;
void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
// QAbstractScrollArea
void scrollContentsBy(int dx, int dy);
void scrollContentsBy(int dx, int dy) override;
// QAbstractItemView
void rowsInserted(const QModelIndex &parent, int start, int end);
bool edit(const QModelIndex &index, QAbstractItemView::EditTrigger trigger, QEvent *event);
void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint);
void rowsInserted(const QModelIndex &parent, int start, int end) override;
bool edit(const QModelIndex &index, QAbstractItemView::EditTrigger trigger, QEvent *event) override;
void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint) override;
private slots:
void InhibitAutoscrollTimeout();

View File

@@ -41,7 +41,7 @@ class SongLoaderInserter : public QObject {
public:
explicit SongLoaderInserter(TaskManager *task_manager, CollectionBackendInterface *collection, const Player *player);
~SongLoaderInserter();
~SongLoaderInserter() override;
void Load(Playlist *destination, int row, bool play_now, bool enqueue, bool enqueue_next, const QList<QUrl> &urls);
void LoadAudioCD(Playlist *destination, int row, bool play_now, bool enqueue, bool enqueue_next);

View File

@@ -37,15 +37,15 @@ class SongPlaylistItem : public PlaylistItem {
// Restores a stream- or file-related playlist item using query row.
// If it's a file related playlist item, this will restore it's CUE attributes (if any) but won't parse the CUE!
bool InitFromQuery(const SqlRow& query);
void Reload();
bool InitFromQuery(const SqlRow& query) override;
void Reload() override;
Song Metadata() const;
Song Metadata() const override;
QUrl Url() const;
QUrl Url() const override;
Song DatabaseSongMetadata() const { return song_; }
void SetArtManual(const QUrl &cover_url);
Song DatabaseSongMetadata() const override { return song_; }
void SetArtManual(const QUrl &cover_url) override;
private:
Song song_;