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);
115
MyAction * playPrevAct() { return prevAct; };
116
MyAction * playNextAct() { return nextAct; };
120
void playlistEnded();
121
void visibilityChanged();
122
void modifiedChanged(bool);
126
void setCurrentItem(int current);
127
void clearPlayedTag();
128
int chooseRandomItem();
129
void swapItems(int item1, int item2 );
132
virtual void dragEnterEvent( QDragEnterEvent * ) ;
133
virtual void dropEvent ( QDropEvent * );
134
virtual void hideEvent ( QHideEvent * );
135
virtual void showEvent ( QShowEvent * );
136
virtual void closeEvent( QCloseEvent * e );
139
virtual void languageChange();
141
virtual void playCurrent();
142
virtual void itemDoubleClicked(int row);
143
virtual void showPopup(int row, int col, const QPoint & pos);
144
virtual void upItem();
145
virtual void downItem();
146
virtual void editCurrentItem();
147
virtual void editItem(int item);
149
virtual void saveSettings();
150
virtual void loadSettings();
152
virtual void maybeSaveSettings();
156
void createActions();
157
void createToolbar();
160
typedef QValueList <PlaylistItem> PlaylistItemList;
164
QString playlist_path;
168
QPopupMenu * add_menu;
169
QPopupMenu * remove_menu;
175
QToolButton * add_button;
176
QToolButton * remove_button;
183
MyAction * repeatAct;
184
MyAction * shuffleAct;
185
MyAction * moveUpAct;
186
MyAction * moveDownAct;
189
MyAction * addCurrentAct;
190
MyAction * addFilesAct;
191
MyAction * addDirectoryAct;
193
MyAction * removeSelectedAct;
194
MyAction * removeAllAct;