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:
{
}
virtual void updateData() { m_parent->slotSetDirty(); }
virtual void updateCurrent() {}
virtual void playlistItemDataHasChanged() Q_DECL_FINAL
{
m_parent->slotSetDirty();
}
private:
DynamicPlaylist *m_parent;
......
/**
* 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
* the terms of the GNU General Public License as published by the Free Software
......@@ -173,8 +173,8 @@ void JuK::setupLayout()
setCentralWidget(m_splitter);
m_statusLabel = new StatusLabel(m_splitter->playlist(), statusBar());
connect(CollectionList::instance(), SIGNAL(signalCollectionChanged()),
m_statusLabel, SLOT(updateData()));
connect(CollectionList::instance(), &CollectionList::signalCollectionChanged,
m_statusLabel, &StatusLabel::playlistItemDataHasChanged);
statusBar()->addWidget(m_statusLabel, 1);
m_player->setStatusLabel(m_statusLabel);
......
......@@ -22,7 +22,6 @@
#include "playermanager.h"
#include <QKeyEvent>
class KToggleAction;
class KGlobalAccel;
......
......@@ -59,8 +59,10 @@ private:
Observer(NowPlaying *parent, PlaylistInterface *playlist) :
PlaylistObserver(playlist),
m_parent(parent) {}
virtual void updateCurrent() {}
virtual void updateData() { m_parent->slotReloadCurrentItem(); }
virtual void playlistItemDataHasChanged() Q_DECL_FINAL
{
m_parent->slotReloadCurrentItem();
}
NowPlaying *m_parent;
};
friend struct Observer;
......
......@@ -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();
}
......
......@@ -180,10 +180,10 @@ protected:
// Reimplemented from PlaylistObserver
//
virtual void updateCurrent();
virtual void playingItemHasChanged() Q_DECL_FINAL;
// Used to post a timer in PlaylistBox to save playlists.
virtual void updateData();
virtual void playlistItemDataHasChanged() Q_DECL_FINAL;
protected slots:
......
......@@ -23,13 +23,13 @@
void Watched::currentPlayingItemChanged()
{
foreach(PlaylistObserver *observer, m_observers)
observer->updateCurrent();
observer->playingItemHasChanged();
}
void Watched::playlistItemsChanged()
{
foreach(PlaylistObserver *observer, m_observers)
observer->updateData();
observer->playlistItemDataHasChanged();
}
void Watched::addObserver(PlaylistObserver *observer)
......
......@@ -84,20 +84,21 @@ public:
virtual ~PlaylistObserver();
/**
* This method must be implemented in concrete implementations; it should
* define what action should be taken in the observer when the currently
* playing item changes.
* This method is called when the item which is currently playing
* in the given playlist changes.
* @todo TODO: Move to PlayerManager...
*/
virtual void updateCurrent() = 0;
virtual void playingItemHasChanged()
{ ; }
/**
* This method must be implemented in concrete implementations; it should
* define what action should be taken when the data of the PlaylistItems in
* the playlist changes.
* This method is called when the data of a PlaylistItem in the playlist
* being watched changes.
*/
virtual void updateData() = 0;
virtual void playlistItemDataHasChanged()
{ ; }
void clearWatched() { m_playlist = 0; }
void clearWatched() { m_playlist = nullptr; }
protected:
PlaylistObserver(PlaylistInterface *playlist);
......
......@@ -103,10 +103,10 @@ StatusLabel::StatusLabel(PlaylistInterface *playlist, QWidget *parent) :
installEventFilter(this);
updateData();
playlistItemDataHasChanged();
}
void StatusLabel::updateCurrent()
void StatusLabel::playingItemHasChanged()
{
if(!playlist()->playing()) {
return;
......@@ -123,9 +123,9 @@ void StatusLabel::updateCurrent()
m_playlistLabel->setText(playlist()->name().simplified());
}
void StatusLabel::updateData()
void StatusLabel::playlistItemDataHasChanged()
{
updateCurrent();
playingItemHasChanged();
if(!playlist()->playing()) {
return;
......
......@@ -31,7 +31,7 @@ class StatusLabel : public QWidget, public PlaylistObserver
public:
explicit StatusLabel(PlaylistInterface *playlist, QWidget *parent = nullptr);
virtual void updateCurrent();
virtual void playingItemHasChanged() Q_DECL_FINAL;
public slots:
/**
......@@ -40,7 +40,7 @@ public slots:
*/
void setItemTotalTime(int time) { m_itemTotalTime = time; }
void setItemCurrentTime(int time) { m_itemCurrentTime = time; updateTime(); }
virtual void updateData();
virtual void playlistItemDataHasChanged() Q_DECL_FINAL;
signals:
void jumpButtonClicked();
......
......@@ -114,14 +114,12 @@ public:
{
}
virtual void updateData()
virtual void playlistItemDataHasChanged() Q_DECL_FINAL
{
if(m_parent && m_parent->m_currentPlaylist && m_parent->isVisible())
m_parent->slotSetItems(m_parent->m_currentPlaylist->selectedItems());
}
virtual void updateCurrent() {}
private:
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