Commit f10458fa authored by Michael Pyne's avatar Michael Pyne

Merge branch 'Applications/19.04'

parents 3e9a54d6 dc2d9c8e
......@@ -267,11 +267,6 @@ void CollectionList::saveItemsToCache() const
// public slots
////////////////////////////////////////////////////////////////////////////////
void CollectionList::paste()
{
decode(QApplication::clipboard()->mimeData());
}
void CollectionList::clear()
{
int result = KMessageBox::warningContinueCancel(this,
......
......@@ -63,7 +63,7 @@ class CollectionListItem : public PlaylistItem
friend class PlaylistItem;
public:
virtual void refresh();
virtual void refresh() override;
PlaylistItem *itemForPlaylist(const Playlist *playlist);
void updateCollectionDict(const QString &oldPath, const QString &newPath);
void repaint() const;
......@@ -82,7 +82,7 @@ protected:
*/
bool checkCurrent();
virtual CollectionListItem *collectionItem() { return this; }
virtual CollectionListItem *collectionItem() override { return this; }
private:
bool m_shuttingDown;
......@@ -113,19 +113,19 @@ public:
CollectionListItem *lookup(const QString &file) const;
virtual CollectionListItem *createItem(const FileHandle &file,
QTreeWidgetItem * = nullptr);
QTreeWidgetItem * = nullptr) override;
virtual void clearItems(const PlaylistItemList &items);
virtual void clearItems(const PlaylistItemList &items) override;
void setupTreeViewEntries(ViewMode *viewMode) const;
virtual bool canReload() const { return true; }
virtual bool canReload() const override { return true; }
void saveItemsToCache() const;
public slots:
virtual void paste();
virtual void clear();
virtual void clear() override;
void slotCheckCache();
void slotRemoveItem(const QString &file);
......@@ -139,8 +139,8 @@ protected:
CollectionList(PlaylistCollection *collection);
virtual ~CollectionList();
virtual void dropEvent(QDropEvent *e);
virtual void dragMoveEvent(QDragMoveEvent *e);
virtual void dropEvent(QDropEvent *e) override;
virtual void dragMoveEvent(QDragMoveEvent *e) override;
// These methods are used by CollectionListItem, which is a friend class.
......@@ -156,7 +156,7 @@ protected:
void addWatched(const QString &file);
void removeWatched(const QString &file);
virtual bool hasItem(const QString &file) const { return m_itemsDict.contains(file); }
virtual bool hasItem(const QString &file) const override { return m_itemsDict.contains(file); }
signals:
void signalCollectionChanged();
......
......@@ -38,7 +38,7 @@ public:
{
}
bool operator< (const QListWidgetItem& other) const
bool operator< (const QListWidgetItem& other) const override
{
Q_UNUSED(other);
return true; // Always be at the top.
......@@ -53,7 +53,7 @@ public:
{
}
bool operator< (const QListWidgetItem& other) const
bool operator< (const QListWidgetItem& other) const override
{
return text().toLower().localeAwareCompare(other.text().toLower());
}
......
......@@ -78,8 +78,8 @@ struct CoverPopup : public QWidget
show();
}
virtual void leaveEvent(QEvent *) { close(); }
virtual void mouseReleaseEvent(QMouseEvent *) { close(); }
virtual void leaveEvent(QEvent *) override { close(); }
virtual void mouseReleaseEvent(QMouseEvent *) override { close(); }
};
////////////////////////////////////////////////////////////////////////////////
......
......@@ -66,7 +66,7 @@ public:
bool shouldDelete() const { return m_widget->shouldDelete(); }
protected slots:
virtual void accept();
virtual void accept() override;
void slotShouldDelete(bool shouldDelete);
private:
......
......@@ -57,7 +57,7 @@ public:
Result dialogResult() const { return m_result; }
public slots:
int exec();
int exec() override;
signals:
void signalDirectoryAdded(const QString &directory);
......
......@@ -30,7 +30,8 @@ public:
{
}
virtual void playlistItemDataHasChanged() Q_DECL_FINAL
virtual void playlistItemDataHasChanged() Q_DECL_FINAL override
{
m_parent->slotSetDirty();
}
......
......@@ -41,7 +41,7 @@ public:
virtual ~DynamicPlaylist();
virtual bool canReload() const { return false; }
virtual bool canReload() const override { return false; }
void setPlaylists(const PlaylistList &playlists);
......@@ -50,7 +50,7 @@ public slots:
* Reimplemented so that it will reload all of the playlists that are
* associated with the dynamic list.
*/
virtual void slotReload();
virtual void slotReload() override;
void slotSetDirty() { m_dirty = true; }
/**
......@@ -72,15 +72,15 @@ protected:
* list this should return only the matched items. By default it returns
* all of the items in the playlists associated with this dynamic list.
*/
virtual PlaylistItemList items();
virtual PlaylistItemList items() override;
/**
* Reimplemented from QWidget. Here it updates the list of items (when
* appropriate) as the widget is shown.
*/
virtual void showEvent(QShowEvent *e);
virtual void showEvent(QShowEvent *e) override;
virtual void paintEvent(QPaintEvent *e);
virtual void paintEvent(QPaintEvent *e) override;
/**
* Updates the items (unconditionally). This should be reimplemented in
......
......@@ -49,8 +49,8 @@ public:
const ExampleOptions *widget() const { return m_options; }
protected:
virtual void hideEvent(QHideEvent *);
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *) override;
virtual void showEvent(QShowEvent *) override;
protected slots:
void fileModeSelected();
......
......@@ -22,7 +22,7 @@
/*
* These ugly macros make possible a property registration system that makes it
* easy to add properties to the FileHandle that can be accessed via the DCOP
* easy to add properties to the FileHandle that can be accessed via the DBus
* interface.
*
* Properties should actually be added to the filehandle.cpp file. This file
......@@ -34,7 +34,7 @@
{ \
struct name##Property : public Property \
{ \
virtual QString value(const FileHandle &f) const \
virtual QString value(const FileHandle &f) const override final \
{ \
return f.method; \
} \
......@@ -49,7 +49,7 @@
{ \
struct name##Property : public Property \
{ \
virtual QString value(const FileHandle &f) const \
virtual QString value(const FileHandle &f) const override final \
{ \
return QString::number(f.method); \
} \
......
......@@ -102,17 +102,17 @@ public:
// CategoryReaderInterface reimplementations
virtual QString categoryValue(TagType type) const;
virtual QString prefix(const CategoryID &category) const;
virtual QString suffix(const CategoryID &category) const;
virtual TagRenamerOptions::EmptyActions emptyAction(const CategoryID &category) const;
virtual QString emptyText(const CategoryID &category) const;
virtual QList<CategoryID> categoryOrder() const;
virtual QString separator() const;
virtual QString musicFolder() const;
virtual int trackWidth(int categoryNum) const;
virtual bool hasFolderSeparator(int index) const;
virtual bool isDisabled(const CategoryID &category) const;
virtual QString categoryValue(TagType type) const override;
virtual QString prefix(const CategoryID &category) const override;
virtual QString suffix(const CategoryID &category) const override;
virtual TagRenamerOptions::EmptyActions emptyAction(const CategoryID &category) const override;
virtual QString emptyText(const CategoryID &category) const override;
virtual QList<CategoryID> categoryOrder() const override;
virtual QString separator() const override;
virtual QString musicFolder() const override;
virtual int trackWidth(int categoryNum) const override;
virtual bool hasFolderSeparator(int index) const override;
virtual bool isDisabled(const CategoryID &category) const override;
private:
const PlaylistItem *m_currentItem;
......@@ -246,7 +246,7 @@ private:
* @param category the category to retrieve the value for.
* @return the string representation of the value for \p category.
*/
virtual QString categoryValue(TagType category) const;
virtual QString categoryValue(TagType category) const override;
/**
* Returns the user-specified prefix string for \p category.
......@@ -254,7 +254,7 @@ private:
* @param category the category to retrieve the value for.
* @return user-specified prefix string for \p category.
*/
virtual QString prefix(const CategoryID &category) const
virtual QString prefix(const CategoryID &category) const override
{
return m_rows[findIdentifier(category)].options.prefix();
}
......@@ -265,7 +265,7 @@ private:
* @param category the category to retrieve the value for.
* @return user-specified suffix string for \p category.
*/
virtual QString suffix(const CategoryID &category) const
virtual QString suffix(const CategoryID &category) const override
{
return m_rows[findIdentifier(category)].options.suffix();
}
......@@ -276,7 +276,7 @@ private:
* @param category the category to retrieve the value for.
* @return user-specified empty action for \p category.
*/
virtual TagRenamerOptions::EmptyActions emptyAction(const CategoryID &category) const
virtual TagRenamerOptions::EmptyActions emptyAction(const CategoryID &category) const override
{
return m_rows[findIdentifier(category)].options.emptyAction();
}
......@@ -288,7 +288,7 @@ private:
* @param category the category to retrieve the value for.
* @return the user-specified empty text for \p category.
*/
virtual QString emptyText(const CategoryID &category) const
virtual QString emptyText(const CategoryID &category) const override
{
return m_rows[findIdentifier(category)].options.emptyText();
}
......@@ -296,23 +296,23 @@ private:
/**
* @return list of CategoryIDs corresponding to the user-specified category order.
*/
virtual QList<CategoryID> categoryOrder() const;
virtual QList<CategoryID> categoryOrder() const override;
/**
* @return string that separates the tag values in the file name.
*/
virtual QString separator() const;
virtual QString separator() const override;
/**
* @return local path to the music folder used to store renamed files.
*/
virtual QString musicFolder() const;
virtual QString musicFolder() const override;
/**
* @param categoryNum Zero-based number of category to get results for (if more than one).
* @return the minimum width of the track category.
*/
virtual int trackWidth(int categoryNum) const
virtual int trackWidth(int categoryNum) const override
{
CategoryID id(Track, categoryNum);
return m_rows[findIdentifier(id)].options.trackWidth();
......@@ -325,13 +325,13 @@ private:
* of this function, only categories that are required or non-empty
* should count.
*/
virtual bool hasFolderSeparator(int index) const;
virtual bool hasFolderSeparator(int index) const override;
/**
* @param category The category to get the status of.
* @return true if \p category is disabled by the user, and false otherwise.
*/
virtual bool isDisabled(const CategoryID &category) const
virtual bool isDisabled(const CategoryID &category) const override
{
return m_rows[findIdentifier(category)].options.disabled();
}
......
......@@ -29,7 +29,7 @@ public:
explicit FileRenamerConfigDlg(QWidget *parent);
protected slots:
virtual void accept();
virtual void accept() override;
private:
FileRenamerWidget *m_renamerWidget;
......
......@@ -59,7 +59,7 @@ public:
const TagRenamerOptions &options() const { return m_options; }
protected slots:
virtual void accept();
virtual void accept() override;
private:
......
......@@ -31,10 +31,10 @@ public:
QString folder() const;
void setFolder(const QString &s);
virtual bool canReload() const { return true; }
virtual bool canReload() const override { return true; }
public slots:
virtual void slotReload();
virtual void slotReload() override;
private:
QString m_folder;
......
......@@ -42,16 +42,16 @@ public:
explicit HistoryPlaylist(PlaylistCollection *collection);
virtual ~HistoryPlaylist();
virtual HistoryPlaylistItem *createItem(const FileHandle &file, QTreeWidgetItem *after = nullptr);
virtual HistoryPlaylistItem *createItem(const FileHandle &file, QTreeWidgetItem *after = nullptr) override;
virtual void createItems(const PlaylistItemList &siblings);
virtual int columnOffset() const { return 1; }
virtual bool readOnly() const { return true; }
virtual int columnOffset() const override { return 1; }
virtual bool readOnly() const override { return true; }
static int delay() { return 5000; }
public slots:
void cut() {}
void clear() {}
virtual void cut() override {}
virtual void clear() override {}
void appendProposedItem(const FileHandle &file);
private slots:
......
......@@ -25,9 +25,9 @@
* coding error which resulted in not setting a specific encoding for
* QDataStreams.
*/
class BICStreamException : public std::exception
class BICStreamException final : public std::exception
{
virtual const char *what() const throw()
virtual const char *what() const noexcept override
{
return "Read jibberish from a QDataStream, probably using an older protocol.";
}
......
......@@ -52,7 +52,7 @@ private:
void setupActions();
void setupGlobalAccels();
void keyPressEvent(QKeyEvent *);
void keyPressEvent(QKeyEvent *) override;
void activateScrobblerIfEnabled();
......@@ -64,7 +64,7 @@ private:
void readConfig();
void saveConfig();
virtual bool queryClose();
virtual bool queryClose() override;
private slots:
void slotSetupSystemTray();
......
......@@ -39,7 +39,7 @@ public Q_SLOTS:
void playing(const FileHandle &file);
protected:
virtual void showEvent(QShowEvent*);
virtual void showEvent(QShowEvent*) override;
private:
void makeLyricsRequest();
......@@ -49,7 +49,6 @@ private Q_SLOTS:
void receiveLyricsReply(QNetworkReply*);
void saveConfig();
private:
FileHandle m_playingFile;
QNetworkAccessManager *m_networkAccessManager;
......@@ -57,5 +56,4 @@ private:
bool m_lyricsCurrent;
};
#endif//LYRICSWIDGET_H
......@@ -54,12 +54,12 @@ signals:
void nowPlayingHidden();
private:
struct Observer : public PlaylistObserver
struct Observer final : public PlaylistObserver
{
Observer(NowPlaying *parent, PlaylistInterface *playlist) :
PlaylistObserver(playlist),
m_parent(parent) {}
virtual void playlistItemDataHasChanged() Q_DECL_FINAL
virtual void playlistItemDataHasChanged() override
{
m_parent->slotReloadCurrentItem();
}
......@@ -99,15 +99,15 @@ class CoverItem : public QLabel, public NowPlayingItem
{
public:
explicit CoverItem(NowPlaying *parent);
virtual void update(const FileHandle &file);
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void update(const FileHandle &file) override;
virtual void mouseReleaseEvent(QMouseEvent *event) override;
protected:
virtual void dragEnterEvent(QDragEnterEvent *e);
virtual void dropEvent(QDropEvent *e);
virtual void dragEnterEvent(QDragEnterEvent *e) override;
virtual void dropEvent(QDropEvent *e) override;
virtual void mousePressEvent(QMouseEvent *e);
virtual void mouseMoveEvent(QMouseEvent *e);
virtual void mousePressEvent(QMouseEvent *e) override;
virtual void mouseMoveEvent(QMouseEvent *e) override;
private:
FileHandle m_file;
......@@ -126,7 +126,7 @@ class TrackItem : public QWidget, public NowPlayingItem
public:
explicit TrackItem(NowPlaying *parent);
virtual void update(const FileHandle &file);
virtual void update(const FileHandle &file) override;
private slots:
void slotOpenLink(const QString &link);
......
......@@ -449,7 +449,9 @@ void Playlist::copy()
void Playlist::paste()
{
decode(QApplication::clipboard()->mimeData(), static_cast<PlaylistItem *>(currentItem()));
addFilesFromMimeData(
QApplication::clipboard()->mimeData(),
static_cast<PlaylistItem *>(currentItem()));
}
void Playlist::clear()
......@@ -723,31 +725,26 @@ void Playlist::synchronizeItemsTo(const PlaylistItemList &itemList)
void Playlist::dragEnterEvent(QDragEnterEvent *e)
{
if(CoverDrag::isCover(e->mimeData())) {
//setDropHighlighter(true);
setDropIndicatorShown(false);
e->accept();
return;
}
setDropIndicatorShown(true);
if(e->mimeData()->hasUrls() && !e->mimeData()->urls().isEmpty())
if(e->mimeData()->hasUrls() && !e->mimeData()->urls().isEmpty()) {
setDropIndicatorShown(true);
e->acceptProposedAction();
}
else
e->ignore();
}
bool Playlist::acceptDrag(QDropEvent *e) const
void Playlist::addFilesFromMimeData(const QMimeData *urls, PlaylistItem *after)
{
return CoverDrag::isCover(e->mimeData()) || e->mimeData()->hasUrls();
}
if(!urls->hasUrls()) {
return;
}
void Playlist::decode(const QMimeData *s, PlaylistItem *item)
{
Q_UNUSED(s);
Q_UNUSED(item);
// TODO Re-add drag-drop
addFiles(QUrl::toStringList(urls->urls(), QUrl::PreferLocalFile), after);
}
bool Playlist::eventFilter(QObject *watched, QEvent *e)
......@@ -902,7 +899,7 @@ void Playlist::dropEvent(QDropEvent *e)
}
}
else
decode(e->mimeData(), item);
addFilesFromMimeData(e->mimeData(), item);
m_blockDataChanged = false;
......
......@@ -77,13 +77,13 @@ public:
// The following group of functions implement the PlaylistInterface API.
virtual QString name() const;
virtual FileHandle currentFile() const;
virtual int count() const { return model()->rowCount(); }
virtual int time() const { return m_time; }
virtual void playNext();
virtual void playPrevious();
virtual void stop();
virtual QString name() const override;
virtual FileHandle currentFile() const override;
virtual int count() const override { return model()->rowCount(); }
virtual int time() const override { return m_time; }
virtual void playNext() override;
virtual void playPrevious() override;
virtual void stop() override;
/**
* Plays the top item of the playlist.
......@@ -239,7 +239,7 @@ public:
/**
* Returns true if this playlist is currently playing.
*/
bool playing() const;
bool playing() const override;
/**
* This forces an update of the left most visible column, but does not save
......@@ -402,7 +402,7 @@ public slots:
void slotColumnResizeModeChanged();
virtual void playlistItemsChanged();
virtual void playlistItemsChanged() override;
protected:
/**
......@@ -422,20 +422,18 @@ protected:
// the following are all reimplemented from base classes
virtual bool eventFilter(QObject *watched, QEvent *e);
virtual void keyPressEvent(QKeyEvent *e);
virtual void decode(const QMimeData *s, PlaylistItem *item = 0);
QStringList mimeTypes() const;
QMimeData* mimeData(const QList<QTreeWidgetItem *> items) const;
virtual bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action);
virtual void dropEvent(QDropEvent *e);
virtual void dragEnterEvent(QDragEnterEvent *e);
virtual void showEvent(QShowEvent *e);
virtual bool acceptDrag(QDropEvent *e) const;
virtual void paintEvent(QPaintEvent *pe);
virtual void resizeEvent(QResizeEvent *re);
virtual void drawRow(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const;
virtual bool eventFilter(QObject *watched, QEvent *e) override;
virtual void keyPressEvent(QKeyEvent *e) override;
QStringList mimeTypes() const override;
QMimeData* mimeData(const QList<QTreeWidgetItem *> items) const override;
virtual bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) override;
virtual void dropEvent(QDropEvent *e) override;
virtual void dragEnterEvent(QDragEnterEvent *e) override;
virtual void showEvent(QShowEvent *e) override;
virtual void paintEvent(QPaintEvent *pe) override;
virtual void resizeEvent(QResizeEvent *re) override;
virtual void drawRow(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
virtual void insertItem(QTreeWidgetItem *item);
virtual void takeItem(QTreeWidgetItem *item);
......@@ -549,6 +547,7 @@ private:
QFuture<void> addFilesFromDirectory(const QString &dirPath);
QFuture<void> addUntypedFile(const QString &file, PlaylistItem *after = nullptr);
void cleanupAfterAllFileLoadsCompleted();
void addFilesFromMimeData(const QMimeData *urls, PlaylistItem *after = nullptr);
void redisplaySearch() { setSearch(m_search); }
......
......@@ -38,7 +38,7 @@ typedef QVector<Playlist *> PlaylistList;
* JuK's main widget (PlaylistSplitter).
*/
class PlaylistBox : public QTreeWidget, public PlaylistCollection
class PlaylistBox final : public QTreeWidget, public PlaylistCollection
{
Q_OBJECT
......@@ -51,19 +51,19 @@ public:
PlaylistBox(PlayerManager *player, QWidget *parent, QStackedWidget *playlistStack);
virtual ~PlaylistBox();
virtual void raise(Playlist *playlist);
virtual void duplicate();
virtual void remove();
virtual void raise(Playlist *playlist) override;
virtual void duplicate() override;
virtual void remove() override;
// Called after files loaded to pickup any new files that might be present
// in managed directories.
virtual void scanFolders();
virtual void scanFolders() override;
/**
* For view modes that have dynamic playlists, this freezes them from
* removing playlists.
*/
virtual void setDynamicListsFrozen(bool frozen);
virtual void setDynamicListsFrozen(bool frozen) override;
Item *dropItem() const { return m_dropItem; }
......@@ -79,8 +79,8 @@ public slots:
void slotSetHistoryPlaylistEnabled(bool enable);
protected:
virtual void setupPlaylist(Playlist *playlist, const QString &iconName);
virtual void removePlaylist(Playlist *playlist);
virtual void setupPlaylist(Playlist *playlist, const QString &iconName) override;
virtual void removePlaylist(Playlist *playlist) override;
signals:
void signalPlaylistDestroyed(Playlist *);
......@@ -92,10 +92,10 @@ private:
void readConfig();
void saveConfig();
virtual void mousePressEvent(QMouseEvent *e);
virtual void mouseReleaseEvent(QMouseEvent *e);
virtual void keyPressEvent(QKeyEvent *e);
virtual void keyReleaseEvent(QKeyEvent *e);
virtual void mousePressEvent(QMouseEvent *e) override;
virtual void mouseReleaseEvent(QMouseEvent *e) override;
virtual void keyPressEvent(QKeyEvent *e) override;
virtual void keyReleaseEvent(QKeyEvent *e) override;
// selectedItems already used for something different
......@@ -139,7 +139,7 @@ private:
QTimer *m_savePlaylistTimer;
};
class PlaylistBox::Item : public QObject, public QTreeWidgetItem, public PlaylistObserver
class PlaylistBox::Item final : public QObject, public QTreeWidgetItem, public PlaylistObserver
{
friend class PlaylistBox;
friend class PlaylistSplitter;
......@@ -180,10 +180,10 @@ protected:
// Reimplemented from PlaylistObserver
//
virtual void playingItemHasChanged() Q_DECL_FINAL;
virtual void playingItemHasChanged() override;
// Used to post a timer in PlaylistBox to save playlists.
virtual void playlistItemDataHasChanged() Q_DECL_FINAL;
virtual void playlistItemDataHasChanged() override;
protected slots:
......
......@@ -58,14 +58,14 @@ public:
static PlaylistCollection *instance() { return m_instance; }
virtual QString name() const;
virtual FileHandle currentFile() const;
virtual int count() const;
virtual int time() const;
virtual void playNext();
virtual void playPrevious();
virtual void stop();
virtual bool playing() const;
virtual QString name() const override;
virtual FileHandle currentFile() const override;
virtual int count() const override;
virtual int time() const override;
virtual void playNext() override;
virtual void playPrevious() override;
virtual void stop() override;
virtual bool playing() const override;
void playFirst();
void playNextAlbum();
......
......@@ -176,7 +176,7 @@ protected:
virtual int compare(const QTreeWidgetItem *item, int column, bool ascending) const;
int compare(const PlaylistItem *firstItem, const PlaylistItem *secondItem, int column, bool ascending) const;
bool operator<(const QTreeWidgetItem &other) const;
bool operator<(const QTreeWidgetItem &other) const override;
bool isValid() const;
......
......@@ -31,13 +31,13 @@ public:
PlaylistSearch playlistSearch() const { return m_search; }
void setPlaylistSearch(const PlaylistSearch &s, bool update = true);
virtual bool searchIsEditable() const { return true; }
virtual bool searchIsEditable()<