historyplaylist.h 1.97 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/**
 * Copyright (C) 2003-2004 Scott Wheeler <wheeler@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
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 */
16

17 18
#ifndef JUK_HISTORYPLAYLIST_H
#define JUK_HISTORYPLAYLIST_H
19

20
#include <QDateTime>
21

22 23 24
#include "playlist.h"
#include "playlistitem.h"

25 26 27
class HistoryPlaylistItem : public PlaylistItem
{
public:
28
    HistoryPlaylistItem(CollectionListItem *item, Playlist *parent, QTreeWidgetItem *after = nullptr);
29 30 31 32 33 34 35

    QDateTime dateTime() const { return m_dateTime; }
    void setDateTime(const QDateTime &dt);

private:
    QDateTime m_dateTime;
};
36 37 38

class HistoryPlaylist : public Playlist
{
39 40
    Q_OBJECT

41
public:
42
    HistoryPlaylist(PlaylistCollection *collection);
43 44
    virtual ~HistoryPlaylist();

45
    virtual HistoryPlaylistItem *createItem(const FileHandle &file, QTreeWidgetItem *after = nullptr);
46
    virtual void createItems(const PlaylistItemList &siblings);
47 48
    virtual int columnOffset() const { return 1; }
    virtual bool readOnly() const { return true; }
49 50 51

    static int delay() { return 5000; }

52 53 54
public slots:
    void cut() {}
    void clear() {}
55
    void appendProposedItem(const FileHandle &file);
56

57
private slots:
58 59 60
    void slotCreateNewItem();

private:
61 62
    using Playlist::createItems;

63 64
    FileHandle m_file;
    QTimer *m_timer;
65 66
};

67 68 69
QDataStream &operator<<(QDataStream &s, const HistoryPlaylist &p);
QDataStream &operator>>(QDataStream &s, HistoryPlaylist &p);

70
#endif
71 72

// vim: set et sw=4 tw=0 sta: