~ubuntu-branches/debian/sid/smplayer/sid

« back to all changes in this revision

Viewing changes to src/playlist2.h

  • Committer: Bazaar Package Importer
  • Author(s): Breuil Cyril
  • Date: 2007-06-24 16:35:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070624163529-hhckbmd24uicada7
Tags: 0.5.20-0ubuntu1
* New upstream release
* Change Maintainer Email

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  smplayer, GUI front-end for mplayer.
2
 
    Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
3
 
 
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.
8
 
 
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.
13
 
 
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
17
 
*/
18
 
 
19
 
 
20
 
#ifndef _PLAYLIST2_H_
21
 
#define _PLAYLIST2_H_
22
 
 
23
 
#include <qvaluelist.h>
24
 
#include <qstringlist.h>
25
 
#include <qmainwindow.h>
26
 
 
27
 
class PlaylistItem {
28
 
 
29
 
public:
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; };
35
 
        ~PlaylistItem() {};
36
 
 
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; };
42
 
 
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; };
48
 
 
49
 
private:
50
 
        QString _filename, _name;
51
 
        double _duration;
52
 
        bool _played, _deleted;
53
 
};
54
 
 
55
 
 
56
 
class QTable;
57
 
class QToolBar;
58
 
class MyAction;
59
 
class Core;
60
 
class QPopupMenu;
61
 
class QSettings;
62
 
class QToolButton;
63
 
class QTimer;
64
 
 
65
 
class Playlist : public QMainWindow
66
 
{
67
 
        Q_OBJECT
68
 
 
69
 
public:
70
 
        Playlist( Core *c, QWidget * parent = 0, const char * name = 0, WFlags f = WType_TopLevel );
71
 
        ~Playlist();
72
 
 
73
 
        void clear();
74
 
        void list();
75
 
        int count();
76
 
        bool isEmpty();
77
 
 
78
 
        bool isModified() { return modified; };
79
 
 
80
 
public slots:
81
 
        void addItem(QString filename, QString name, double duration);
82
 
 
83
 
        // Start playing, from item 0 if shuffle is off, or from
84
 
        // a random item otherwise
85
 
        void startPlay();
86
 
 
87
 
        void playItem(int n);
88
 
 
89
 
        virtual void playNext();
90
 
        virtual void playPrev();
91
 
 
92
 
        virtual void removeSelected();
93
 
        virtual void removeAll();
94
 
 
95
 
        virtual void addCurrentFile();
96
 
        virtual void addFiles();
97
 
        virtual void addDirectory();
98
 
 
99
 
        virtual void addFiles(QStringList files);
100
 
        virtual void addDirectory(QString dir);
101
 
 
102
 
        virtual bool maybeSave();
103
 
    virtual void load();
104
 
    virtual bool save();
105
 
 
106
 
        virtual void load_m3u(QString file);
107
 
        virtual bool save_m3u(QString file);
108
 
 
109
 
        virtual void getMediaInfo();
110
 
 
111
 
        void setModified(bool);
112
 
 
113
 
public:
114
 
        MyAction * playPrevAct() { return prevAct; };
115
 
        MyAction * playNextAct() { return nextAct; };
116
 
 
117
 
signals:
118
 
        void playlistEnded();
119
 
        void visibilityChanged();
120
 
        void modifiedChanged(bool);
121
 
 
122
 
protected:
123
 
        void updateView();
124
 
        void setCurrentItem(int current);
125
 
        void clearPlayedTag();
126
 
        int chooseRandomItem();
127
 
        void swapItems(int item1, int item2 );
128
 
        QString lastDir();
129
 
 
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 );
135
 
 
136
 
protected slots:
137
 
        virtual void languageChange();
138
 
 
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);
146
 
 
147
 
        virtual void saveSettings();
148
 
        virtual void loadSettings();
149
 
 
150
 
        virtual void maybeSaveSettings();
151
 
 
152
 
protected:
153
 
        void createTable();
154
 
        void createActions();
155
 
        void createToolbar();
156
 
 
157
 
protected:
158
 
        typedef QValueList <PlaylistItem> PlaylistItemList;
159
 
        PlaylistItemList pl;
160
 
        int current_item;
161
 
 
162
 
        QString playlist_path;
163
 
        QString latest_dir;
164
 
 
165
 
        Core * core;
166
 
        QPopupMenu * add_menu;
167
 
        QPopupMenu * remove_menu;
168
 
        QPopupMenu * popup;
169
 
 
170
 
        QTable * listView;
171
 
 
172
 
        QToolBar * toolbar;
173
 
        QToolButton * add_button;
174
 
        QToolButton * remove_button;
175
 
 
176
 
        MyAction * openAct;
177
 
        MyAction * saveAct;
178
 
        MyAction * playAct;
179
 
        MyAction * prevAct;
180
 
        MyAction * nextAct;
181
 
        MyAction * repeatAct;
182
 
        MyAction * shuffleAct;
183
 
        MyAction * moveUpAct;
184
 
        MyAction * moveDownAct;
185
 
        MyAction * editAct;
186
 
 
187
 
        MyAction * addCurrentAct;
188
 
        MyAction * addFilesAct;
189
 
        MyAction * addDirectoryAct;
190
 
 
191
 
        MyAction * removeSelectedAct;
192
 
        MyAction * removeAllAct;
193
 
 
194
 
private:
195
 
        bool modified;
196
 
        QTimer * save_timer;
197
 
};
198
 
 
199
 
 
200
 
#endif
201