Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit c8e8d5f3 authored by Michael Pyne's avatar Michael Pyne

Add final markers for virtual functions in Playlist observer iface.

parent be2d6495
...@@ -30,8 +30,10 @@ public: ...@@ -30,8 +30,10 @@ public:
{ {
} }
virtual void updateData() { m_parent->slotSetDirty(); } virtual void playlistItemDataHasChanged() Q_DECL_FINAL
virtual void updateCurrent() {} {
m_parent->slotSetDirty();
}
private: private:
DynamicPlaylist *m_parent; DynamicPlaylist *m_parent;
......
/** /**
* Copyright (C) 2002-2004 Scott Wheeler <wheeler@kde.org> * Copyright (C) 2002-2004 Scott Wheeler <wheeler@kde.org>
* Copyright (C) 2008, 2009 Michael Pyne <mpyne@kde.org> * Copyright (C) 2008, 2009, 2017 Michael Pyne <mpyne@kde.org>
* *
* This program is free software; you can redistribute it and/or modify it under * This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software * the terms of the GNU General Public License as published by the Free Software
...@@ -173,8 +173,8 @@ void JuK::setupLayout() ...@@ -173,8 +173,8 @@ void JuK::setupLayout()
setCentralWidget(m_splitter); setCentralWidget(m_splitter);
m_statusLabel = new StatusLabel(m_splitter->playlist(), statusBar()); m_statusLabel = new StatusLabel(m_splitter->playlist(), statusBar());
connect(CollectionList::instance(), SIGNAL(signalCollectionChanged()), connect(CollectionList::instance(), &CollectionList::signalCollectionChanged,
m_statusLabel, SLOT(updateData())); m_statusLabel, &StatusLabel::playlistItemDataHasChanged);
statusBar()->addWidget(m_statusLabel, 1); statusBar()->addWidget(m_statusLabel, 1);
m_player->setStatusLabel(m_statusLabel); m_player->setStatusLabel(m_statusLabel);
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "playermanager.h" #include "playermanager.h"
#include <QKeyEvent> #include <QKeyEvent>
class KToggleAction; class KToggleAction;
class KGlobalAccel; class KGlobalAccel;
......
...@@ -59,8 +59,10 @@ private: ...@@ -59,8 +59,10 @@ private:
Observer(NowPlaying *parent, PlaylistInterface *playlist) : Observer(NowPlaying *parent, PlaylistInterface *playlist) :
PlaylistObserver(playlist), PlaylistObserver(playlist),
m_parent(parent) {} m_parent(parent) {}
virtual void updateCurrent() {} virtual void playlistItemDataHasChanged() Q_DECL_FINAL
virtual void updateData() { m_parent->slotReloadCurrentItem(); } {
m_parent->slotReloadCurrentItem();
}
NowPlaying *m_parent; NowPlaying *m_parent;
}; };
friend struct Observer; friend struct Observer;
......
...@@ -716,11 +716,11 @@ void PlaylistBox::Item::slotSetName(const QString &name) ...@@ -716,11 +716,11 @@ void PlaylistBox::Item::slotSetName(const QString &name)
} }
} }
void PlaylistBox::Item::updateCurrent() void PlaylistBox::Item::playingItemHasChanged()
{ {
} }
void PlaylistBox::Item::updateData() void PlaylistBox::Item::playlistItemDataHasChanged()
{ {
listView()->slotPlaylistDataChanged(); listView()->slotPlaylistDataChanged();
} }
......
...@@ -180,10 +180,10 @@ protected: ...@@ -180,10 +180,10 @@ protected:
// Reimplemented from PlaylistObserver // Reimplemented from PlaylistObserver
// //
virtual void updateCurrent(); virtual void playingItemHasChanged() Q_DECL_FINAL;
// Used to post a timer in PlaylistBox to save playlists. // Used to post a timer in PlaylistBox to save playlists.
virtual void updateData(); virtual void playlistItemDataHasChanged() Q_DECL_FINAL;
protected slots: protected slots:
......
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
void Watched::currentPlayingItemChanged() void Watched::currentPlayingItemChanged()
{ {
foreach(PlaylistObserver *observer, m_observers) foreach(PlaylistObserver *observer, m_observers)
observer->updateCurrent(); observer->playingItemHasChanged();
} }
void Watched::playlistItemsChanged() void Watched::playlistItemsChanged()
{ {
foreach(PlaylistObserver *observer, m_observers) foreach(PlaylistObserver *observer, m_observers)
observer->updateData(); observer->playlistItemDataHasChanged();
} }
void Watched::addObserver(PlaylistObserver *observer) void Watched::addObserver(PlaylistObserver *observer)
......
...@@ -84,20 +84,21 @@ public: ...@@ -84,20 +84,21 @@ public:
virtual ~PlaylistObserver(); virtual ~PlaylistObserver();
/** /**
* This method must be implemented in concrete implementations; it should * This method is called when the item which is currently playing
* define what action should be taken in the observer when the currently * in the given playlist changes.
* playing item changes. * @todo TODO: Move to PlayerManager...
*/ */
virtual void updateCurrent() = 0; virtual void playingItemHasChanged()
{ ; }
/** /**
* This method must be implemented in concrete implementations; it should * This method is called when the data of a PlaylistItem in the playlist
* define what action should be taken when the data of the PlaylistItems in * being watched changes.
* the playlist changes.
*/ */
virtual void updateData() = 0; virtual void playlistItemDataHasChanged()
{ ; }
void clearWatched() { m_playlist = 0; } void clearWatched() { m_playlist = nullptr; }
protected: protected:
PlaylistObserver(PlaylistInterface *playlist); PlaylistObserver(PlaylistInterface *playlist);
......
...@@ -103,10 +103,10 @@ StatusLabel::StatusLabel(PlaylistInterface *playlist, QWidget *parent) : ...@@ -103,10 +103,10 @@ StatusLabel::StatusLabel(PlaylistInterface *playlist, QWidget *parent) :
installEventFilter(this); installEventFilter(this);
updateData(); playlistItemDataHasChanged();
} }
void StatusLabel::updateCurrent() void StatusLabel::playingItemHasChanged()
{ {
if(!playlist()->playing()) { if(!playlist()->playing()) {
return; return;
...@@ -123,9 +123,9 @@ void StatusLabel::updateCurrent() ...@@ -123,9 +123,9 @@ void StatusLabel::updateCurrent()
m_playlistLabel->setText(playlist()->name().simplified()); m_playlistLabel->setText(playlist()->name().simplified());
} }
void StatusLabel::updateData() void StatusLabel::playlistItemDataHasChanged()
{ {
updateCurrent(); playingItemHasChanged();
if(!playlist()->playing()) { if(!playlist()->playing()) {
return; return;
......
...@@ -31,7 +31,7 @@ class StatusLabel : public QWidget, public PlaylistObserver ...@@ -31,7 +31,7 @@ class StatusLabel : public QWidget, public PlaylistObserver
public: public:
explicit StatusLabel(PlaylistInterface *playlist, QWidget *parent = nullptr); explicit StatusLabel(PlaylistInterface *playlist, QWidget *parent = nullptr);
virtual void updateCurrent(); virtual void playingItemHasChanged() Q_DECL_FINAL;
public slots: public slots:
/** /**
...@@ -40,7 +40,7 @@ public slots: ...@@ -40,7 +40,7 @@ public slots:
*/ */
void setItemTotalTime(int time) { m_itemTotalTime = time; } void setItemTotalTime(int time) { m_itemTotalTime = time; }
void setItemCurrentTime(int time) { m_itemCurrentTime = time; updateTime(); } void setItemCurrentTime(int time) { m_itemCurrentTime = time; updateTime(); }
virtual void updateData(); virtual void playlistItemDataHasChanged() Q_DECL_FINAL;
signals: signals:
void jumpButtonClicked(); void jumpButtonClicked();
......
...@@ -114,14 +114,12 @@ public: ...@@ -114,14 +114,12 @@ public:
{ {
} }
virtual void updateData() virtual void playlistItemDataHasChanged() Q_DECL_FINAL
{ {
if(m_parent && m_parent->m_currentPlaylist && m_parent->isVisible()) if(m_parent && m_parent->m_currentPlaylist && m_parent->isVisible())
m_parent->slotSetItems(m_parent->m_currentPlaylist->selectedItems()); m_parent->slotSetItems(m_parent->m_currentPlaylist->selectedItems());
} }
virtual void updateCurrent() {}
private: private:
TagEditor *m_parent; TagEditor *m_parent;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment