File indexing completed on 2021-12-21 13:27:54

0001 /**
0002  * Copyright (C) 2003-2004 Scott Wheeler <wheeler@kde.org>
0003  *
0004  * This program is free software; you can redistribute it and/or modify it under
0005  * the terms of the GNU General Public License as published by the Free Software
0006  * Foundation; either version 2 of the License, or (at your option) any later
0007  * version.
0008  *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.
0012  *
0013  * You should have received a copy of the GNU General Public License along with
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.
0015  */
0016 
0017 #ifndef JUK_HISTORYPLAYLIST_H
0018 #define JUK_HISTORYPLAYLIST_H
0019 
0020 #include <QDateTime>
0021 
0022 #include "playlist.h"
0023 #include "playlistitem.h"
0024 
0025 class HistoryPlaylistItem : public PlaylistItem
0026 {
0027 public:
0028     HistoryPlaylistItem(CollectionListItem *item, Playlist *parent, QTreeWidgetItem *after = nullptr);
0029 
0030     QDateTime dateTime() const { return m_dateTime; }
0031     void setDateTime(const QDateTime &dt);
0032 
0033 private:
0034     QDateTime m_dateTime;
0035 };
0036 
0037 class HistoryPlaylist : public Playlist
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     explicit HistoryPlaylist(PlaylistCollection *collection);
0043     virtual ~HistoryPlaylist();
0044 
0045     virtual HistoryPlaylistItem *createItem(const FileHandle &file, QTreeWidgetItem *after = nullptr) override;
0046     virtual void createItems(const PlaylistItemList &siblings);
0047     virtual int columnOffset() const override { return 1; }
0048     virtual bool readOnly() const override { return true; }
0049 
0050     static int delay() { return 5000; }
0051 
0052 public slots:
0053     virtual void cut() override {}
0054     virtual void clear() override {}
0055     void appendProposedItem(const FileHandle &file);
0056 
0057 private slots:
0058     void slotCreateNewItem();
0059 
0060 private:
0061     using Playlist::createItems;
0062 
0063     FileHandle m_file;
0064     QTimer *m_timer;
0065 };
0066 
0067 QDataStream &operator<<(QDataStream &s, const HistoryPlaylist &p);
0068 QDataStream &operator>>(QDataStream &s, HistoryPlaylist &p);
0069 
0070 #endif
0071 
0072 // vim: set et sw=4 tw=0 sta: