1
/* smplayer, GUI front-end for mplayer.
2
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
#include <qvaluelist.h>
24
#include <qstringlist.h>
25
#include <qmainwindow.h>
30
PlaylistItem() { _filename=""; _name=""; _duration=0;
31
_played = FALSE; _deleted=FALSE; };
32
PlaylistItem(QString filename, QString name, double duration) {
33
_filename = filename; _name = name; _duration = duration;
34
_played = FALSE; _deleted = FALSE; };
37
void setFilename(QString filename) { _filename = filename; };
38
void setName(QString name) { _name = name; };
39
void setDuration(double duration) { _duration = duration; };
40
void setPlayed(bool b) { _played = b; };
41
void setMarkForDeletion(bool b) { _deleted = b; };
43
QString filename() { return _filename; };
44
QString name() { return _name; };
45
double duration() { return _duration; };
46
bool played() { return _played; };
47
bool markedForDeletion() { return _deleted; };
50
QString _filename, _name;
52
bool _played, _deleted;
65
class Playlist : public QMainWindow
70
Playlist( Core *c, QWidget * parent = 0, const char * name = 0, WFlags f = WType_TopLevel );
78
bool isModified() { return modified; };
81
void addItem(QString filename, QString name, double duration);
83
// Start playing, from item 0 if shuffle is off, or from
84
// a random item otherwise
89
virtual void playNext();
90
virtual void playPrev();
92
virtual void removeSelected();
93
virtual void removeAll();
95
virtual void addCurrentFile();
96
virtual void addFiles();
97
virtual void addDirectory();
99
virtual void addFiles(QStringList files);
100
virtual void addDirectory(QString dir);
102
virtual bool maybeSave();
106
virtual void load_m3u(QString file);
107
virtual bool save_m3u(QString file);
109
virtual void getMediaInfo();
111
void setModified(bool);
114
MyAction * playPrevAct() { return prevAct; };
115
MyAction * playNextAct() { return nextAct; };
118
void playlistEnded();
119
void visibilityChanged();
120
void modifiedChanged(bool);
124
void setCurrentItem(int current);
125
void clearPlayedTag();
126
int chooseRandomItem();
127
void swapItems(int item1, int item2 );
130
virtual void dragEnterEvent( QDragEnterEvent * ) ;
131
virtual void dropEvent ( QDropEvent * );
132
virtual void hideEvent ( QHideEvent * );
133
virtual void showEvent ( QShowEvent * );
134
virtual void closeEvent( QCloseEvent * e );
137
virtual void languageChange();
139
virtual void playCurrent();
140
virtual void itemDoubleClicked(int row);
141
virtual void showPopup(int row, int col, const QPoint & pos);
142
virtual void upItem();
143
virtual void downItem();
144
virtual void editCurrentItem();
145
virtual void editItem(int item);
147
virtual void saveSettings();
148
virtual void loadSettings();
150
virtual void maybeSaveSettings();
154
void createActions();
155
void createToolbar();
158
typedef QValueList <PlaylistItem> PlaylistItemList;
162
QString playlist_path;
166
QPopupMenu * add_menu;
167
QPopupMenu * remove_menu;
173
QToolButton * add_button;
174
QToolButton * remove_button;
181
MyAction * repeatAct;
182
MyAction * shuffleAct;
183
MyAction * moveUpAct;
184
MyAction * moveDownAct;
187
MyAction * addCurrentAct;
188
MyAction * addFilesAct;
189
MyAction * addDirectoryAct;
191
MyAction * removeSelectedAct;
192
MyAction * removeAllAct;