📄 qmplaylist.h
字号:
/* ;-*-c++-*- * qmplaylist.h * * $Id: qmplaylist.h,v 1.60 2002/03/31 23:52:42 kyllingstad Exp $ * * Apollo sound player: http://www.apolloplayer.org * Copyright(C) 2000-2002 Apollo Team. See CREDITS file. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * The GNU General Public License is also available online at: * * http://www.gnu.org/copyleft/gpl.html */#ifndef QMPLAYLIST_H_INCLUDED#define QMPLAYLIST_H_INCLUDED#include <qlist.h>#include <qpopupmenu.h>#include <qdragobject.h>#include <qtimer.h>#include <cassert>#include <vector>#include "qmlistview.h"/*! \file qmplaylist.h Definition of QmPlayList class which represents the playlist.*/class QDomNode;class QmDirItem;class QmPlayListItem;class QmSongInfoPropertyPage;class QmPropertyDialog;class QmPlayList : public QmListView{ Q_OBJECTpublic: QmPlayList(QWidget *parent = 0, const char *name = 0); virtual ~QmPlayList(); virtual void initMenu(); virtual bool isEmpty() const; // adding to the list virtual void appendDir(const QString &dir); virtual void prependDir(const QString &dir); virtual void appendList(const QString &filename); virtual void prependList(const QString &filename); virtual void appendSong(const QString &filename); virtual void prependSong(const QString &filename); virtual QmSongItem* prevSong(bool wrap=false) ; virtual QmSongItem* prevSong(QmSongItem *curSong, bool wrap=false) ; virtual QmSongItem* nextSong(bool wrap=false) ; virtual QmSongItem* nextSong(QmSongItem *curSong, bool wrap=false) ; virtual QmSongItem* findSong(const QString &filePath) ; virtual QmSongItem* removeSelected(bool *stop_playing); virtual QmSongItem* currentSong(); virtual QmSongItem* song(int no=-1); static int count(); virtual bool atBeginning(); virtual bool atEnd(); virtual int position(); virtual void deletePosition(unsigned int pos); virtual void viewportResizeEvent(QResizeEvent *e); virtual void setDisplayFormat(const QString &format, const QString &formatMulti); virtual void dragEnterEvent(QDragEnterEvent *event); virtual void dropEvent(QDropEvent *event); virtual bool isDirty() const; virtual QmPlayListItem* loadPlayList(const QString &filename = QString::null, QmPlayListItem *above = 0);// virtual void savePlayList(const QString &filename = QString::null); const QString& filename() const; virtual long reCalculate(); virtual void saveAsXml(const QString &filename); virtual void saveAsM3u(const QString &filename); virtual QmSongItem* randomSong(); virtual bool isSelected(QListViewItem *item) const; virtual bool add(const QString &filename, QListViewItem *reference, bool below = true); virtual long playLength(); virtual int playLengthNotCounted(); virtual int noSongs(); virtual QString status() const { return m_Status; } virtual void setColumnWidth(int col, int w);signals: void disableNext(); void enableNext(); void disablePrev(); void enablePrev(); void statusUpdate(const QString &status);public slots: virtual void setCurrent(QmSongItem *song); virtual void mouseClick(int button, QListViewItem * item, const QPoint & pos, int c ); virtual void flatten(); virtual void clear(); void search(const QString& s);protected slots: void showPopup(QListViewItem *current, const QPoint &pos, int); void continueHere(); void reGroup(); void expandFirstLevel(); void expandAll(); void collapseAll(); void readSongInfo(); void generatePlayListForEachArtistAndAlbum(int alsoPlayListTree=0); void newSelection(); void newSelectionHandler(); void showItemProperties();protected: void setDefaultStatus(); void setDirty(); void updateSongIndex(bool force=false) ; void updateColumnWidths(); bool canDecode(QDragMoveEvent *e); QPopupMenu *getMenu() { return m_pMenu; }private: QPopupMenu *m_pMenu; QmPlayListItem *m_PlayListSelected; int m_ContinueHereId; int m_PlayFirstId; int m_FlattenId; int m_ReGroupId; int m_GenerateId; int m_GenerateTreeId; bool m_Dirty; /*! SongIndex has pointers to non-bad songs, used for index'ed access in random mode, iteration of songs, temporary storage when flattening/grouping and sorting. */ mutable std::vector<QmSongItem*> m_SongIndex; typedef std::vector<QmSongItem*>::iterator SongIndexIterator; typedef std::vector<QmSongItem*>::reverse_iterator SongIndexIteratorR; mutable bool m_SongIndexDirty; bool m_DeletingItems; QmSongItem* getSong(int index); long m_PlayLength; int m_PlayLengthNotCounted; QTimer m_Delay;#if defined(_WS_WIN_) #define m_LengthWidth 50#else static const int m_LengthWidth = 50;#endif static int s_PlayListCounter; QmSongItem *m_pCurrentSong; QString m_Filename; QString m_Status; QmSongInfoPropertyPage *m_pSongInfoPage; QmPropertyDialog *m_pPropertyDlg;};#ifndef DOXYGEN_SKIP_THIS/*! compare function used for sorting songs */template<typename t1=QString, typename t2=QString, typename t3=QString>struct compareSongs { int depth; // how many attributes to sort on (crude, yes) t1 QmSongItem::* sort_on1; t2 QmSongItem::* sort_on2; t3 QmSongItem::* sort_on3; compareSongs(t1 QmSongItem::* _sort_on) : depth(1), sort_on1(_sort_on) {}; compareSongs(t1 QmSongItem::* _sort_on1, t2 QmSongItem::* _sort_on2) : depth(2), sort_on1(_sort_on1), sort_on2(_sort_on2) {}; compareSongs(t1 QmSongItem::* _sort_on1, t2 QmSongItem::* _sort_on2, t3 QmSongItem::* _sort_on3) : depth(3), sort_on1(_sort_on1), sort_on2(_sort_on2), sort_on3(_sort_on3) {}; bool operator() (const QmSongItem *, const QmSongItem *) const;};#endif // DOXYGEN_SKIP_THIS#endif // QMPLAYLIST_H_INCLUDED
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -