Fix minor code issues

This commit is contained in:
Jonas Kvinge
2019-09-15 20:27:32 +02:00
parent 83e10aac27
commit 2d67279180
147 changed files with 644 additions and 329 deletions

View File

@@ -373,6 +373,8 @@ void Playlist::MoodbarUpdated(const QModelIndex& index) {
bool Playlist::setData(const QModelIndex &index, const QVariant &value, int role) {
Q_UNUSED(role);
int row = index.row();
PlaylistItemPtr item = item_at(row);
Song song = item->Metadata();

View File

@@ -66,8 +66,8 @@ class SortItems;
}
typedef QMap<int, Qt::Alignment> ColumnAlignmentMap;
Q_DECLARE_METATYPE(Qt::Alignment);
Q_DECLARE_METATYPE(ColumnAlignmentMap);
Q_DECLARE_METATYPE(Qt::Alignment)
Q_DECLARE_METATYPE(ColumnAlignmentMap)
// Objects that may prevent a song being added to the playlist.
// When there is something about to be inserted into it,
@@ -198,7 +198,7 @@ class Playlist : public QAbstractListModel {
void set_special_type(const QString &v) { special_type_ = v; }
const PlaylistItemPtr &item_at(int index) const { return items_[index]; }
const bool has_item_at(int index) const { return index >= 0 && index < rowCount(); }
bool has_item_at(int index) const { return index >= 0 && index < rowCount(); }
PlaylistItemPtr current_item() const;

View File

@@ -319,6 +319,8 @@ QString SizeItemDelegate::displayText(const QVariant &value, const QLocale&) con
QString DateItemDelegate::displayText(const QVariant &value, const QLocale &locale) const {
Q_UNUSED(locale);
bool ok = false;
int time = value.toInt(&ok);
@@ -343,6 +345,8 @@ QString LastPlayedItemDelegate::displayText(const QVariant &value, const QLocale
QString FileTypeItemDelegate::displayText(const QVariant &value, const QLocale &locale) const {
Q_UNUSED(locale);
bool ok = false;
Song::FileType type = Song::FileType(value.toInt(&ok));
@@ -352,7 +356,9 @@ QString FileTypeItemDelegate::displayText(const QVariant &value, const QLocale &
}
QWidget *TextItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const {
QWidget *TextItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &idx) const {
Q_UNUSED(option);
Q_UNUSED(idx);
return new QLineEdit(parent);
}
@@ -446,6 +452,7 @@ QString NativeSeparatorsDelegate::displayText(const QVariant &value, const QLoca
SongSourceDelegate::SongSourceDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
QString SongSourceDelegate::displayText(const QVariant &value, const QLocale&) const {
Q_UNUSED(value);
return QString();
}

View File

@@ -51,7 +51,7 @@ 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 { return true; }
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; }
};

View File

@@ -62,7 +62,7 @@ class PlaylistItem : public std::enable_shared_from_this<PlaylistItem> {
// Disables the seek slider.
SeekDisabled = 0x04,
};
Q_DECLARE_FLAGS(Options, Option);
Q_DECLARE_FLAGS(Options, Option)
virtual Song::Source source() const { return source_; }

View File

@@ -47,7 +47,7 @@ class PlaylistManagerInterface : public QObject {
Q_OBJECT
public:
PlaylistManagerInterface(Application *app, QObject *parent) : QObject(parent) {}
PlaylistManagerInterface(Application *app, QObject *parent) : QObject(parent) { Q_UNUSED(app); }
virtual int current_id() const = 0;
virtual int active_id() const = 0;

View File

@@ -119,11 +119,13 @@ void ReOrderItems::undo() { playlist_->ReOrderWithoutUndo(old_items_); }
void ReOrderItems::redo() { playlist_->ReOrderWithoutUndo(new_items_); }
SortItems::SortItems(Playlist* playlist, int column, Qt::SortOrder order, const PlaylistItemList &new_items)
: ReOrderItems(playlist, new_items)
//column_(column),
//order_(order)
{
: ReOrderItems(playlist, new_items) {
Q_UNUSED(column);
Q_UNUSED(order);
setText(tr("sort songs"));
}

View File

@@ -40,7 +40,7 @@ namespace PlaylistUndoCommands {
};
class Base : public QUndoCommand {
Q_DECLARE_TR_FUNCTIONS(PlaylistUndoCommands);
Q_DECLARE_TR_FUNCTIONS(PlaylistUndoCommands)
public:
Base(Playlist *playlist);
@@ -116,9 +116,6 @@ namespace PlaylistUndoCommands {
public:
SortItems(Playlist *playlist, int column, Qt::SortOrder order, const PlaylistItemList &new_items);
private:
//int column_;
//Qt::SortOrder order_;
};
class ShuffleItems : public ReOrderItems {

View File

@@ -1243,6 +1243,8 @@ void PlaylistView::Stopped() {
void PlaylistView::AlbumCoverLoaded(const Song &song, const QUrl &cover_url, const QImage &song_art) {
Q_UNUSED(cover_url);
if ((song != Song() && song_playing_ == Song()) || song_art == current_song_cover_art_) return;
current_song_cover_art_ = song_art;