-rw-r--r-- | core/multimedia/opieplayer/playlistselection.cpp | 6 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistselection.h | 1 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 8 |
3 files changed, 11 insertions, 4 deletions
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index 756e3b4..6259b3f 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp | |||
@@ -1,183 +1,187 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qpe/applnk.h> | 20 | #include <qpe/applnk.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpainter.h> | 22 | #include <qpainter.h> |
23 | #include <qimage.h> | 23 | #include <qimage.h> |
24 | #include <qheader.h> | 24 | #include <qheader.h> |
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qlist.h> | 26 | #include <qlist.h> |
27 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
28 | 28 | ||
29 | #include "playlistselection.h" | 29 | #include "playlistselection.h" |
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | 32 | ||
33 | class PlayListSelectionItem : public QListViewItem { | 33 | class PlayListSelectionItem : public QListViewItem { |
34 | public: | 34 | public: |
35 | PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { | 35 | PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { |
36 | setText( 0, f->name() ); | 36 | setText( 0, f->name() ); |
37 | setPixmap( 0, f->pixmap() ); | 37 | setPixmap( 0, f->pixmap() ); |
38 | } | 38 | } |
39 | 39 | ||
40 | ~PlayListSelectionItem() { | 40 | ~PlayListSelectionItem() { |
41 | }; | 41 | }; |
42 | 42 | ||
43 | const DocLnk *file() const { return fl; } | 43 | const DocLnk *file() const { return fl; } |
44 | 44 | ||
45 | private: | 45 | private: |
46 | const DocLnk *fl; | 46 | const DocLnk *fl; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | 49 | ||
50 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | 50 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) |
51 | : QListView( parent, name ) | 51 | : QListView( parent, name ) |
52 | { | 52 | { |
53 | qDebug("starting playlistselector"); | 53 | qDebug("starting playlistselector"); |
54 | // #ifdef USE_PLAYLIST_BACKGROUND | 54 | // #ifdef USE_PLAYLIST_BACKGROUND |
55 | // setStaticBackground( TRUE ); | 55 | // setStaticBackground( TRUE ); |
56 | // setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); | 56 | // setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); |
57 | 57 | ||
58 | // setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); | 58 | // setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); |
59 | // #endif | 59 | // #endif |
60 | // addColumn("Title",236); | 60 | // addColumn("Title",236); |
61 | // setAllColumnsShowFocus( TRUE ); | 61 | // setAllColumnsShowFocus( TRUE ); |
62 | addColumn( tr( "Playlist Selection" ) ); | 62 | addColumn( tr( "Playlist Selection" ) ); |
63 | header()->hide(); | 63 | header()->hide(); |
64 | setSorting( -1, FALSE ); | 64 | setSorting( -1, FALSE ); |
65 | } | 65 | } |
66 | 66 | ||
67 | 67 | ||
68 | PlayListSelection::~PlayListSelection() { | 68 | PlayListSelection::~PlayListSelection() { |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | // #ifdef USE_PLAYLIST_BACKGROUND | 72 | // #ifdef USE_PLAYLIST_BACKGROUND |
73 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { | 73 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { |
74 | // qDebug("drawBackground"); | 74 | // qDebug("drawBackground"); |
75 | p->fillRect( r, QBrush( white ) ); | 75 | p->fillRect( r, QBrush( white ) ); |
76 | // QImage logo = Resource::loadImage( "launcher/opielogo" ); | 76 | // QImage logo = Resource::loadImage( "launcher/opielogo" ); |
77 | // if ( !logo.isNull() ) | 77 | // if ( !logo.isNull() ) |
78 | // p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); | 78 | // p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); |
79 | } | 79 | } |
80 | // #endif | 80 | // #endif |
81 | 81 | ||
82 | 82 | ||
83 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { | 83 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { |
84 | if ( event->state() == QMouseEvent::LeftButton ) { | 84 | if ( event->state() == QMouseEvent::LeftButton ) { |
85 | QListViewItem *currentItem = selectedItem(); | 85 | QListViewItem *currentItem = selectedItem(); |
86 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); | 86 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); |
87 | if ( currentItem && currentItem->itemAbove() == itemUnder ) | 87 | if ( currentItem && currentItem->itemAbove() == itemUnder ) |
88 | moveSelectedUp(); | 88 | moveSelectedUp(); |
89 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) | 89 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) |
90 | moveSelectedDown(); | 90 | moveSelectedDown(); |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
95 | const DocLnk *PlayListSelection::current() { | 95 | const DocLnk *PlayListSelection::current() { |
96 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); | 96 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); |
97 | if ( item ) | 97 | if ( item ) |
98 | return item->file(); | 98 | return item->file(); |
99 | return NULL; | 99 | return NULL; |
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | void PlayListSelection::addToSelection( const DocLnk &lnk ) { | 103 | void PlayListSelection::addToSelection( const DocLnk &lnk ) { |
104 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); | 104 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); |
105 | QListViewItem *current = selectedItem(); | 105 | QListViewItem *current = selectedItem(); |
106 | if ( current ) | 106 | if ( current ) |
107 | item->moveItem( current ); | 107 | item->moveItem( current ); |
108 | setSelected( item, TRUE ); | 108 | setSelected( item, TRUE ); |
109 | ensureItemVisible( selectedItem() ); | 109 | ensureItemVisible( selectedItem() ); |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | void PlayListSelection::removeSelected() { | 113 | void PlayListSelection::removeSelected() { |
114 | QListViewItem *item = selectedItem(); | 114 | QListViewItem *item = selectedItem(); |
115 | if ( item ) | 115 | if ( item ) |
116 | delete item; | 116 | delete item; |
117 | setSelected( currentItem(), TRUE ); | 117 | setSelected( currentItem(), TRUE ); |
118 | ensureItemVisible( selectedItem() ); | 118 | ensureItemVisible( selectedItem() ); |
119 | } | 119 | } |
120 | 120 | ||
121 | 121 | ||
122 | void PlayListSelection::moveSelectedUp() { | 122 | void PlayListSelection::moveSelectedUp() { |
123 | QListViewItem *item = selectedItem(); | 123 | QListViewItem *item = selectedItem(); |
124 | if ( item && item->itemAbove() ) | 124 | if ( item && item->itemAbove() ) |
125 | item->itemAbove()->moveItem( item ); | 125 | item->itemAbove()->moveItem( item ); |
126 | ensureItemVisible( selectedItem() ); | 126 | ensureItemVisible( selectedItem() ); |
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | void PlayListSelection::moveSelectedDown() { | 130 | void PlayListSelection::moveSelectedDown() { |
131 | QListViewItem *item = selectedItem(); | 131 | QListViewItem *item = selectedItem(); |
132 | if ( item && item->itemBelow() ) | 132 | if ( item && item->itemBelow() ) |
133 | item->moveItem( item->itemBelow() ); | 133 | item->moveItem( item->itemBelow() ); |
134 | ensureItemVisible( selectedItem() ); | 134 | ensureItemVisible( selectedItem() ); |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | bool PlayListSelection::prev() { | 138 | bool PlayListSelection::prev() { |
139 | QListViewItem *item = selectedItem(); | 139 | QListViewItem *item = selectedItem(); |
140 | if ( item && item->itemAbove() ) | 140 | if ( item && item->itemAbove() ) |
141 | setSelected( item->itemAbove(), TRUE ); | 141 | setSelected( item->itemAbove(), TRUE ); |
142 | else | 142 | else |
143 | return FALSE; | 143 | return FALSE; |
144 | ensureItemVisible( selectedItem() ); | 144 | ensureItemVisible( selectedItem() ); |
145 | return TRUE; | 145 | return TRUE; |
146 | } | 146 | } |
147 | 147 | ||
148 | |||
149 | bool PlayListSelection::next() { | 148 | bool PlayListSelection::next() { |
150 | QListViewItem *item = selectedItem(); | 149 | QListViewItem *item = selectedItem(); |
151 | if ( item && item->itemBelow() ) | 150 | if ( item && item->itemBelow() ) |
152 | setSelected( item->itemBelow(), TRUE ); | 151 | setSelected( item->itemBelow(), TRUE ); |
153 | else | 152 | else |
154 | return FALSE; | 153 | return FALSE; |
155 | ensureItemVisible( selectedItem() ); | 154 | ensureItemVisible( selectedItem() ); |
156 | return TRUE; | 155 | return TRUE; |
157 | } | 156 | } |
158 | 157 | ||
159 | 158 | ||
160 | bool PlayListSelection::first() { | 159 | bool PlayListSelection::first() { |
161 | QListViewItem *item = firstChild(); | 160 | QListViewItem *item = firstChild(); |
162 | if ( item ) | 161 | if ( item ) |
163 | setSelected( item, TRUE ); | 162 | setSelected( item, TRUE ); |
164 | else | 163 | else |
165 | return FALSE; | 164 | return FALSE; |
166 | ensureItemVisible( selectedItem() ); | 165 | ensureItemVisible( selectedItem() ); |
167 | return TRUE; | 166 | return TRUE; |
168 | } | 167 | } |
169 | 168 | ||
170 | 169 | ||
171 | bool PlayListSelection::last() { | 170 | bool PlayListSelection::last() { |
172 | QListViewItem *prevItem = NULL; | 171 | QListViewItem *prevItem = NULL; |
173 | QListViewItem *item = firstChild(); | 172 | QListViewItem *item = firstChild(); |
174 | while ( ( item = item->nextSibling() ) ) | 173 | while ( ( item = item->nextSibling() ) ) |
175 | prevItem = item; | 174 | prevItem = item; |
176 | if ( prevItem ) | 175 | if ( prevItem ) |
177 | setSelected( prevItem, TRUE ); | 176 | setSelected( prevItem, TRUE ); |
178 | else | 177 | else |
179 | return FALSE; | 178 | return FALSE; |
180 | ensureItemVisible( selectedItem() ); | 179 | ensureItemVisible( selectedItem() ); |
181 | return TRUE; | 180 | return TRUE; |
182 | } | 181 | } |
183 | 182 | ||
183 | void PlayListSelection::unSelect() | ||
184 | { | ||
185 | QListViewItem *item = selectedItem(); | ||
186 | setSelected( currentItem(), FALSE); | ||
187 | } \ No newline at end of file | ||
diff --git a/core/multimedia/opieplayer/playlistselection.h b/core/multimedia/opieplayer/playlistselection.h index b0d249c..ba37271 100644 --- a/core/multimedia/opieplayer/playlistselection.h +++ b/core/multimedia/opieplayer/playlistselection.h | |||
@@ -1,60 +1,61 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef PLAY_LIST_SELECTION_H | 20 | #ifndef PLAY_LIST_SELECTION_H |
21 | #define PLAY_LIST_SELECTION_H | 21 | #define PLAY_LIST_SELECTION_H |
22 | 22 | ||
23 | #include <qlist.h> | 23 | #include <qlist.h> |
24 | #include <qlistview.h> | 24 | #include <qlistview.h> |
25 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
26 | 26 | ||
27 | 27 | ||
28 | class PlayListSelection : public QListView { | 28 | class PlayListSelection : public QListView { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | PlayListSelection( QWidget *parent, const char *name=0 ); | 31 | PlayListSelection( QWidget *parent, const char *name=0 ); |
32 | ~PlayListSelection(); | 32 | ~PlayListSelection(); |
33 | 33 | ||
34 | const DocLnk *current(); // retrieve the current playlist entry (media file link) | 34 | const DocLnk *current(); // retrieve the current playlist entry (media file link) |
35 | public slots: | 35 | public slots: |
36 | void addToSelection( const DocLnk & ); // Add a media file to the playlist | 36 | void addToSelection( const DocLnk & ); // Add a media file to the playlist |
37 | void removeSelected(); // Remove a media file from the playlist | 37 | void removeSelected(); // Remove a media file from the playlist |
38 | void moveSelectedUp(); // Move the media file up the playlist so it is played earlier | 38 | void moveSelectedUp(); // Move the media file up the playlist so it is played earlier |
39 | void moveSelectedDown(); // Move the media file down the playlist so it is played later | 39 | void moveSelectedDown(); // Move the media file down the playlist so it is played later |
40 | void unSelect(); | ||
40 | bool prev(); | 41 | bool prev(); |
41 | bool next(); | 42 | bool next(); |
42 | bool first(); | 43 | bool first(); |
43 | bool last(); | 44 | bool last(); |
44 | 45 | ||
45 | protected: | 46 | protected: |
46 | virtual void contentsMouseMoveEvent(QMouseEvent *); | 47 | virtual void contentsMouseMoveEvent(QMouseEvent *); |
47 | /* #ifdef USE_PLAYLIST_BACKGROUND */ | 48 | /* #ifdef USE_PLAYLIST_BACKGROUND */ |
48 | virtual void drawBackground( QPainter *p, const QRect &r ); | 49 | virtual void drawBackground( QPainter *p, const QRect &r ); |
49 | virtual void paintEmptyArea( QPainter *p, const QRect &r ) { drawBackground( p, r ); }; | 50 | virtual void paintEmptyArea( QPainter *p, const QRect &r ) { drawBackground( p, r ); }; |
50 | /* #endif */ | 51 | /* #endif */ |
51 | 52 | ||
52 | private: | 53 | private: |
53 | QList<DocLnk> selectedList; | 54 | QList<DocLnk> selectedList; |
54 | const DocLnk *lnk; | 55 | const DocLnk *lnk; |
55 | }; | 56 | }; |
56 | 57 | ||
57 | 58 | ||
58 | #endif // PLAY_LIST_SELECTION_H | 59 | #endif // PLAY_LIST_SELECTION_H |
59 | 60 | ||
60 | 61 | ||
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index cf665c8..db6533a 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1,889 +1,891 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 | 20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 |
21 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
22 | #include <qpe/qpetoolbar.h> | 22 | #include <qpe/qpetoolbar.h> |
23 | #include <qpe/fileselector.h> | 23 | #include <qpe/fileselector.h> |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | 25 | ||
26 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #include <qpe/global.h> | 28 | #include <qpe/global.h> |
29 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
30 | #include <qaction.h> | 30 | #include <qaction.h> |
31 | #include <qimage.h> | 31 | #include <qimage.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qdir.h> | 33 | #include <qdir.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qlist.h> | 36 | #include <qlist.h> |
37 | #include <qlistbox.h> | 37 | #include <qlistbox.h> |
38 | #include <qmainwindow.h> | 38 | #include <qmainwindow.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
41 | #include <qtabwidget.h> | 41 | #include <qtabwidget.h> |
42 | #include <qlistview.h> | 42 | #include <qlistview.h> |
43 | #include <qpoint.h> | 43 | #include <qpoint.h> |
44 | #include <qlineedit.h> | 44 | #include <qlineedit.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | 46 | ||
47 | //#include <qtimer.h> | 47 | //#include <qtimer.h> |
48 | 48 | ||
49 | #include "playlistselection.h" | 49 | #include "playlistselection.h" |
50 | #include "playlistwidget.h" | 50 | #include "playlistwidget.h" |
51 | #include "mediaplayerstate.h" | 51 | #include "mediaplayerstate.h" |
52 | 52 | ||
53 | #include "inputDialog.h" | 53 | #include "inputDialog.h" |
54 | 54 | ||
55 | #include <stdlib.h> | 55 | #include <stdlib.h> |
56 | 56 | ||
57 | #define BUTTONS_ON_TOOLBAR | 57 | #define BUTTONS_ON_TOOLBAR |
58 | #define SIDE_BUTTONS | 58 | #define SIDE_BUTTONS |
59 | #define CAN_SAVE_LOAD_PLAYLISTS | 59 | #define CAN_SAVE_LOAD_PLAYLISTS |
60 | 60 | ||
61 | extern MediaPlayerState *mediaPlayerState; | 61 | extern MediaPlayerState *mediaPlayerState; |
62 | 62 | ||
63 | // class myFileSelector { | 63 | // class myFileSelector { |
64 | 64 | ||
65 | // }; | 65 | // }; |
66 | class PlayListWidgetPrivate { | 66 | class PlayListWidgetPrivate { |
67 | public: | 67 | public: |
68 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 68 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
69 | QFrame *playListFrame; | 69 | QFrame *playListFrame; |
70 | FileSelector *files; | 70 | FileSelector *files; |
71 | PlayListSelection *selectedFiles; | 71 | PlayListSelection *selectedFiles; |
72 | bool setDocumentUsed; | 72 | bool setDocumentUsed; |
73 | DocLnk *current; | 73 | DocLnk *current; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | 76 | ||
77 | class ToolButton : public QToolButton { | 77 | class ToolButton : public QToolButton { |
78 | public: | 78 | public: |
79 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 79 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
80 | : QToolButton( parent, name ) { | 80 | : QToolButton( parent, name ) { |
81 | setTextLabel( name ); | 81 | setTextLabel( name ); |
82 | setPixmap( Resource::loadPixmap( icon ) ); | 82 | setPixmap( Resource::loadPixmap( icon ) ); |
83 | setAutoRaise( TRUE ); | 83 | setAutoRaise( TRUE ); |
84 | setFocusPolicy( QWidget::NoFocus ); | 84 | setFocusPolicy( QWidget::NoFocus ); |
85 | setToggleButton( t ); | 85 | setToggleButton( t ); |
86 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 86 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
87 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 87 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
88 | } | 88 | } |
89 | }; | 89 | }; |
90 | 90 | ||
91 | 91 | ||
92 | class MenuItem : public QAction { | 92 | class MenuItem : public QAction { |
93 | public: | 93 | public: |
94 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 94 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
95 | : QAction( text, QString::null, 0, 0 ) { | 95 | : QAction( text, QString::null, 0, 0 ) { |
96 | connect( this, SIGNAL( activated() ), handler, slot ); | 96 | connect( this, SIGNAL( activated() ), handler, slot ); |
97 | addTo( parent ); | 97 | addTo( parent ); |
98 | } | 98 | } |
99 | }; | 99 | }; |
100 | 100 | ||
101 | 101 | ||
102 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 102 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
103 | : QMainWindow( parent, name, fl ) { | 103 | : QMainWindow( parent, name, fl ) { |
104 | 104 | ||
105 | d = new PlayListWidgetPrivate; | 105 | d = new PlayListWidgetPrivate; |
106 | d->setDocumentUsed = FALSE; | 106 | d->setDocumentUsed = FALSE; |
107 | d->current = NULL; | 107 | d->current = NULL; |
108 | fromSetDocument = FALSE; | 108 | fromSetDocument = FALSE; |
109 | insanityBool=FALSE; | 109 | insanityBool=FALSE; |
110 | // menuTimer = new QTimer( this ,"menu timer"), | 110 | // menuTimer = new QTimer( this ,"menu timer"), |
111 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 111 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
112 | 112 | ||
113 | setBackgroundMode( PaletteButton ); | 113 | setBackgroundMode( PaletteButton ); |
114 | 114 | ||
115 | setCaption( tr("OpiePlayer") ); | 115 | setCaption( tr("OpiePlayer") ); |
116 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); | 116 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); |
117 | 117 | ||
118 | setToolBarsMovable( FALSE ); | 118 | setToolBarsMovable( FALSE ); |
119 | 119 | ||
120 | // Create Toolbar | 120 | // Create Toolbar |
121 | QPEToolBar *toolbar = new QPEToolBar( this ); | 121 | QPEToolBar *toolbar = new QPEToolBar( this ); |
122 | toolbar->setHorizontalStretchable( TRUE ); | 122 | toolbar->setHorizontalStretchable( TRUE ); |
123 | 123 | ||
124 | // Create Menubar | 124 | // Create Menubar |
125 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 125 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
126 | menu->setMargin( 0 ); | 126 | menu->setMargin( 0 ); |
127 | 127 | ||
128 | QPEToolBar *bar = new QPEToolBar( this ); | 128 | QPEToolBar *bar = new QPEToolBar( this ); |
129 | bar->setLabel( tr( "Play Operations" ) ); | 129 | bar->setLabel( tr( "Play Operations" ) ); |
130 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "mpegplayer/play_current_list", | 130 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "mpegplayer/play_current_list", |
131 | // this , SLOT( addSelected()) ); | 131 | // this , SLOT( addSelected()) ); |
132 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 132 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
133 | tbDeletePlaylist->setFlat(TRUE); | 133 | tbDeletePlaylist->setFlat(TRUE); |
134 | tbDeletePlaylist->setFixedSize(20,20); | 134 | tbDeletePlaylist->setFixedSize(20,20); |
135 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 135 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
136 | 136 | ||
137 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", | 137 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", |
138 | this , SLOT(addSelected()) ); | 138 | this , SLOT(addSelected()) ); |
139 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", | 139 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", |
140 | this , SLOT(removeSelected()) ); | 140 | this , SLOT(removeSelected()) ); |
141 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); | 141 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); |
142 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", | 142 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", |
143 | this , SLOT( btnPlay(bool) ), TRUE ); | 143 | this , SLOT( btnPlay(bool) ), TRUE ); |
144 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle", | 144 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle", |
145 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 145 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
146 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", | 146 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", |
147 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 147 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
148 | tbDeletePlaylist->hide(); | 148 | tbDeletePlaylist->hide(); |
149 | 149 | ||
150 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 150 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
151 | menu->insertItem( tr( "File" ), pmPlayList ); | 151 | menu->insertItem( tr( "File" ), pmPlayList ); |
152 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 152 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
153 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 153 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
154 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 154 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
155 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 155 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
156 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 156 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
157 | // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); | 157 | // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); |
158 | 158 | ||
159 | QPopupMenu *pmView = new QPopupMenu( this ); | 159 | QPopupMenu *pmView = new QPopupMenu( this ); |
160 | menu->insertItem( tr( "View" ), pmView ); | 160 | menu->insertItem( tr( "View" ), pmView ); |
161 | 161 | ||
162 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 162 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); |
163 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | 163 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); |
164 | fullScreenButton->addTo(pmView); | 164 | fullScreenButton->addTo(pmView); |
165 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); | 165 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); |
166 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | 166 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); |
167 | scaleButton->addTo(pmView); | 167 | scaleButton->addTo(pmView); |
168 | 168 | ||
169 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 169 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
170 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 170 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
171 | 171 | ||
172 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 172 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
173 | 173 | ||
174 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 174 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
175 | tabWidget->setTabShape(QTabWidget::Triangular); | 175 | tabWidget->setTabShape(QTabWidget::Triangular); |
176 | 176 | ||
177 | QWidget *pTab; | 177 | QWidget *pTab; |
178 | pTab = new QWidget( tabWidget, "pTab" ); | 178 | pTab = new QWidget( tabWidget, "pTab" ); |
179 | // playlistView = new QListView( pTab, "playlistview" ); | 179 | // playlistView = new QListView( pTab, "playlistview" ); |
180 | // playlistView->setMinimumSize(236,260); | 180 | // playlistView->setMinimumSize(236,260); |
181 | tabWidget->insertTab( pTab,"Playlist"); | 181 | tabWidget->insertTab( pTab,"Playlist"); |
182 | 182 | ||
183 | 183 | ||
184 | // Add the playlist area | 184 | // Add the playlist area |
185 | 185 | ||
186 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 186 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
187 | d->playListFrame = vbox3; | 187 | d->playListFrame = vbox3; |
188 | d->playListFrame ->setMinimumSize(235,260); | 188 | d->playListFrame ->setMinimumSize(235,260); |
189 | 189 | ||
190 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 190 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
191 | 191 | ||
192 | d->selectedFiles = new PlayListSelection( hbox2); | 192 | d->selectedFiles = new PlayListSelection( hbox2); |
193 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 193 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
194 | 194 | ||
195 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 195 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
196 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 196 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
197 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 197 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); |
198 | 198 | ||
199 | 199 | ||
200 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 200 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
201 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 201 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
202 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 202 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
203 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 203 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
204 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 204 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
205 | 205 | ||
206 | QWidget *aTab; | 206 | QWidget *aTab; |
207 | aTab = new QWidget( tabWidget, "aTab" ); | 207 | aTab = new QWidget( tabWidget, "aTab" ); |
208 | audioView = new QListView( aTab, "Audioview" ); | 208 | audioView = new QListView( aTab, "Audioview" ); |
209 | audioView->setMinimumSize(233,260); | 209 | audioView->setMinimumSize(233,260); |
210 | audioView->addColumn( "Title",140); | 210 | audioView->addColumn( "Title",140); |
211 | audioView->addColumn("Size", -1); | 211 | audioView->addColumn("Size", -1); |
212 | audioView->addColumn("Media",-1); | 212 | audioView->addColumn("Media",-1); |
213 | audioView->setColumnAlignment(1, Qt::AlignRight); | 213 | audioView->setColumnAlignment(1, Qt::AlignRight); |
214 | audioView->setColumnAlignment(2, Qt::AlignRight); | 214 | audioView->setColumnAlignment(2, Qt::AlignRight); |
215 | audioView->setAllColumnsShowFocus(TRUE); | 215 | audioView->setAllColumnsShowFocus(TRUE); |
216 | tabWidget->insertTab(aTab,"Audio"); | 216 | tabWidget->insertTab(aTab,"Audio"); |
217 | 217 | ||
218 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | 218 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); |
219 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 219 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
220 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 220 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
221 | 221 | ||
222 | 222 | ||
223 | // audioView | 223 | // audioView |
224 | Global::findDocuments(&files, "audio/*"); | 224 | Global::findDocuments(&files, "audio/*"); |
225 | QListIterator<DocLnk> dit( files.children() ); | 225 | QListIterator<DocLnk> dit( files.children() ); |
226 | QString storage; | 226 | QString storage; |
227 | for ( ; dit.current(); ++dit ) { | 227 | for ( ; dit.current(); ++dit ) { |
228 | QListViewItem * newItem; | 228 | QListViewItem * newItem; |
229 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | 229 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; |
230 | else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | 230 | else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; |
231 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | 231 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; |
232 | else storage="RAM"; | 232 | else storage="RAM"; |
233 | if ( QFile( dit.current()->file()).exists() ) { | 233 | if ( QFile( dit.current()->file()).exists() ) { |
234 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); | 234 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); |
235 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); | 235 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); |
236 | } | 236 | } |
237 | } | 237 | } |
238 | // videowidget | 238 | // videowidget |
239 | 239 | ||
240 | QWidget *vTab; | 240 | QWidget *vTab; |
241 | vTab = new QWidget( tabWidget, "vTab" ); | 241 | vTab = new QWidget( tabWidget, "vTab" ); |
242 | videoView = new QListView( vTab, "Videoview" ); | 242 | videoView = new QListView( vTab, "Videoview" ); |
243 | videoView->setMinimumSize(233,260); | 243 | videoView->setMinimumSize(233,260); |
244 | 244 | ||
245 | videoView->addColumn("Title",140); | 245 | videoView->addColumn("Title",140); |
246 | videoView->addColumn("Size",-1); | 246 | videoView->addColumn("Size",-1); |
247 | videoView->addColumn("Media",-1); | 247 | videoView->addColumn("Media",-1); |
248 | videoView->setColumnAlignment(1, Qt::AlignRight); | 248 | videoView->setColumnAlignment(1, Qt::AlignRight); |
249 | videoView->setColumnAlignment(2, Qt::AlignRight); | 249 | videoView->setColumnAlignment(2, Qt::AlignRight); |
250 | videoView->setAllColumnsShowFocus(TRUE); | 250 | videoView->setAllColumnsShowFocus(TRUE); |
251 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 251 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
252 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 252 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
253 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 253 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
254 | 254 | ||
255 | tabWidget->insertTab( vTab,"Video"); | 255 | tabWidget->insertTab( vTab,"Video"); |
256 | 256 | ||
257 | Global::findDocuments(&vFiles, "video/*"); | 257 | Global::findDocuments(&vFiles, "video/*"); |
258 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 258 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
259 | for ( ; Vdit.current(); ++Vdit ) { | 259 | for ( ; Vdit.current(); ++Vdit ) { |
260 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | 260 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; |
261 | else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | 261 | else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; |
262 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | 262 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; |
263 | else storage="RAM"; | 263 | else storage="RAM"; |
264 | QListViewItem * newItem; | 264 | QListViewItem * newItem; |
265 | if ( QFile( Vdit.current()->file()).exists() ) { | 265 | if ( QFile( Vdit.current()->file()).exists() ) { |
266 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); | 266 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); |
267 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); | 267 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
271 | //playlists list | 271 | //playlists list |
272 | QWidget *LTab; | 272 | QWidget *LTab; |
273 | LTab = new QWidget( tabWidget, "LTab" ); | 273 | LTab = new QWidget( tabWidget, "LTab" ); |
274 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | 274 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy |
275 | playLists->setMinimumSize(233,260);; | 275 | playLists->setMinimumSize(233,260);; |
276 | tabWidget->insertTab(LTab,"Lists"); | 276 | tabWidget->insertTab(LTab,"Lists"); |
277 | 277 | ||
278 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 278 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
279 | // connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | 279 | // connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); |
280 | 280 | ||
281 | 281 | ||
282 | // add the library area | 282 | // add the library area |
283 | 283 | ||
284 | // connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | 284 | // connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
285 | // this, SLOT( fauxPlay( QListViewItem *) ) ); | 285 | // this, SLOT( fauxPlay( QListViewItem *) ) ); |
286 | // connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | 286 | // connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
287 | // this, SLOT( fauxPlay( QListViewItem *)) ); | 287 | // this, SLOT( fauxPlay( QListViewItem *)) ); |
288 | 288 | ||
289 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); | 289 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); |
290 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); | 290 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); |
291 | 291 | ||
292 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 292 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
293 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 293 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
294 | 294 | ||
295 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 295 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
296 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 296 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
297 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 297 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
298 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 298 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
299 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 299 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
300 | 300 | ||
301 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 301 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
302 | // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | 302 | // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); |
303 | 303 | ||
304 | setCentralWidget( vbox5 ); | 304 | setCentralWidget( vbox5 ); |
305 | 305 | ||
306 | Config cfg( "MediaPlayer" ); | 306 | Config cfg( "MediaPlayer" ); |
307 | readConfig( cfg ); | 307 | readConfig( cfg ); |
308 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 308 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
309 | // qDebug("currentList is "+currentPlaylist); | 309 | // qDebug("currentList is "+currentPlaylist); |
310 | loadList(DocLnk( currentPlaylist)); | 310 | loadList(DocLnk( currentPlaylist)); |
311 | setCaption("OpiePlayer: "+ currentPlaylist ); | 311 | setCaption("OpiePlayer: "+ currentPlaylist ); |
312 | 312 | ||
313 | initializeStates(); | 313 | initializeStates(); |
314 | } | 314 | } |
315 | 315 | ||
316 | 316 | ||
317 | PlayListWidget::~PlayListWidget() { | 317 | PlayListWidget::~PlayListWidget() { |
318 | Config cfg( "MediaPlayer" ); | 318 | Config cfg( "MediaPlayer" ); |
319 | writeConfig( cfg ); | 319 | writeConfig( cfg ); |
320 | 320 | ||
321 | 321 | ||
322 | if ( d->current ) | 322 | if ( d->current ) |
323 | delete d->current; | 323 | delete d->current; |
324 | delete d; | 324 | delete d; |
325 | } | 325 | } |
326 | 326 | ||
327 | 327 | ||
328 | void PlayListWidget::initializeStates() { | 328 | void PlayListWidget::initializeStates() { |
329 | 329 | ||
330 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 330 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
331 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 331 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
332 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 332 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
333 | // d->tbFull->setOn( mediaPlayerState->fullscreen() ); | 333 | // d->tbFull->setOn( mediaPlayerState->fullscreen() ); |
334 | // d->tbScale->setOn( mediaPlayerState->scaled() ); | 334 | // d->tbScale->setOn( mediaPlayerState->scaled() ); |
335 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); | 335 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); |
336 | // setPlaylist( mediaPlayerState->playlist() ); | 336 | // setPlaylist( mediaPlayerState->playlist() ); |
337 | setPlaylist( true); | 337 | setPlaylist( true); |
338 | d->selectedFiles->first(); | 338 | d->selectedFiles->first(); |
339 | } | 339 | } |
340 | 340 | ||
341 | 341 | ||
342 | void PlayListWidget::readConfig( Config& cfg ) { | 342 | void PlayListWidget::readConfig( Config& cfg ) { |
343 | cfg.setGroup("PlayList"); | 343 | cfg.setGroup("PlayList"); |
344 | 344 | ||
345 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 345 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
346 | 346 | ||
347 | for ( int i = 0; i < noOfFiles; i++ ) { | 347 | for ( int i = 0; i < noOfFiles; i++ ) { |
348 | QString entryName; | 348 | QString entryName; |
349 | entryName.sprintf( "File%i", i + 1 ); | 349 | entryName.sprintf( "File%i", i + 1 ); |
350 | QString linkFile = cfg.readEntry( entryName ); | 350 | QString linkFile = cfg.readEntry( entryName ); |
351 | DocLnk lnk( linkFile ); | 351 | DocLnk lnk( linkFile ); |
352 | if ( lnk.isValid() ) | 352 | if ( lnk.isValid() ) |
353 | d->selectedFiles->addToSelection( lnk ); | 353 | d->selectedFiles->addToSelection( lnk ); |
354 | } | 354 | } |
355 | } | 355 | } |
356 | 356 | ||
357 | 357 | ||
358 | void PlayListWidget::writeConfig( Config& cfg ) const { | 358 | void PlayListWidget::writeConfig( Config& cfg ) const { |
359 | cfg.setGroup("PlayList"); | 359 | cfg.setGroup("PlayList"); |
360 | 360 | ||
361 | int noOfFiles = 0; | 361 | int noOfFiles = 0; |
362 | 362 | ||
363 | d->selectedFiles->first(); | 363 | d->selectedFiles->first(); |
364 | do { | 364 | do { |
365 | const DocLnk *lnk = d->selectedFiles->current(); | 365 | const DocLnk *lnk = d->selectedFiles->current(); |
366 | if ( lnk ) { | 366 | if ( lnk ) { |
367 | QString entryName; | 367 | QString entryName; |
368 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 368 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
369 | cfg.writeEntry( entryName, lnk->linkFile() ); | 369 | cfg.writeEntry( entryName, lnk->linkFile() ); |
370 | // if this link does exist, add it so we have the file | 370 | // if this link does exist, add it so we have the file |
371 | // next time... | 371 | // next time... |
372 | if ( !QFile::exists( lnk->linkFile() ) ) { | 372 | if ( !QFile::exists( lnk->linkFile() ) ) { |
373 | // the way writing lnks doesn't really check for out | 373 | // the way writing lnks doesn't really check for out |
374 | // of disk space, but check it anyway. | 374 | // of disk space, but check it anyway. |
375 | if ( !lnk->writeLink() ) { | 375 | if ( !lnk->writeLink() ) { |
376 | QMessageBox::critical( 0, tr("Out of space"), | 376 | QMessageBox::critical( 0, tr("Out of space"), |
377 | tr( "There was a problem saving " | 377 | tr( "There was a problem saving " |
378 | "the playlist.\n" | 378 | "the playlist.\n" |
379 | "Your playlist " | 379 | "Your playlist " |
380 | "may be missing some entries\n" | 380 | "may be missing some entries\n" |
381 | "the next time you start it." ) | 381 | "the next time you start it." ) |
382 | ); | 382 | ); |
383 | } | 383 | } |
384 | } | 384 | } |
385 | noOfFiles++; | 385 | noOfFiles++; |
386 | } | 386 | } |
387 | } while ( d->selectedFiles->next() ); | 387 | } while ( d->selectedFiles->next() ); |
388 | 388 | ||
389 | cfg.writeEntry("NumberOfFiles", noOfFiles ); | 389 | cfg.writeEntry("NumberOfFiles", noOfFiles ); |
390 | 390 | ||
391 | 391 | ||
392 | } | 392 | } |
393 | 393 | ||
394 | 394 | ||
395 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 395 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
396 | // qDebug("add"); | 396 | // qDebug("add"); |
397 | d->setDocumentUsed = FALSE; | 397 | d->setDocumentUsed = FALSE; |
398 | if ( mediaPlayerState->playlist() ) | 398 | if ( mediaPlayerState->playlist() ) |
399 | d->selectedFiles->addToSelection( lnk ); | 399 | d->selectedFiles->addToSelection( lnk ); |
400 | else | 400 | else |
401 | mediaPlayerState->setPlaying( TRUE ); | 401 | mediaPlayerState->setPlaying( TRUE ); |
402 | } | 402 | } |
403 | 403 | ||
404 | 404 | ||
405 | void PlayListWidget::clearList() { | 405 | void PlayListWidget::clearList() { |
406 | while ( first() ) | 406 | while ( first() ) |
407 | d->selectedFiles->removeSelected(); | 407 | d->selectedFiles->removeSelected(); |
408 | } | 408 | } |
409 | 409 | ||
410 | 410 | ||
411 | void PlayListWidget::addAllToList() { | 411 | void PlayListWidget::addAllToList() { |
412 | DocLnkSet files; | 412 | DocLnkSet files; |
413 | Global::findDocuments(&files, "video/*;audio/*"); | 413 | Global::findDocuments(&files, "video/*;audio/*"); |
414 | QListIterator<DocLnk> dit( files.children() ); | 414 | QListIterator<DocLnk> dit( files.children() ); |
415 | for ( ; dit.current(); ++dit ) | 415 | for ( ; dit.current(); ++dit ) |
416 | d->selectedFiles->addToSelection( **dit ); | 416 | d->selectedFiles->addToSelection( **dit ); |
417 | } | 417 | } |
418 | 418 | ||
419 | 419 | ||
420 | void PlayListWidget::addAllMusicToList() { | 420 | void PlayListWidget::addAllMusicToList() { |
421 | DocLnkSet files; | 421 | DocLnkSet files; |
422 | Global::findDocuments(&files, "audio/*"); | 422 | Global::findDocuments(&files, "audio/*"); |
423 | QListIterator<DocLnk> dit( files.children() ); | 423 | QListIterator<DocLnk> dit( files.children() ); |
424 | for ( ; dit.current(); ++dit ) | 424 | for ( ; dit.current(); ++dit ) |
425 | d->selectedFiles->addToSelection( **dit ); | 425 | d->selectedFiles->addToSelection( **dit ); |
426 | } | 426 | } |
427 | 427 | ||
428 | 428 | ||
429 | void PlayListWidget::addAllVideoToList() { | 429 | void PlayListWidget::addAllVideoToList() { |
430 | DocLnkSet files; | 430 | DocLnkSet files; |
431 | Global::findDocuments(&files, "video/*"); | 431 | Global::findDocuments(&files, "video/*"); |
432 | QListIterator<DocLnk> dit( files.children() ); | 432 | QListIterator<DocLnk> dit( files.children() ); |
433 | for ( ; dit.current(); ++dit ) | 433 | for ( ; dit.current(); ++dit ) |
434 | d->selectedFiles->addToSelection( **dit ); | 434 | d->selectedFiles->addToSelection( **dit ); |
435 | } | 435 | } |
436 | 436 | ||
437 | 437 | ||
438 | void PlayListWidget::setDocument(const QString& fileref) { | 438 | void PlayListWidget::setDocument(const QString& fileref) { |
439 | fromSetDocument = TRUE; | 439 | fromSetDocument = TRUE; |
440 | if ( fileref.isNull() ) { | 440 | if ( fileref.isNull() ) { |
441 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); | 441 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); |
442 | return; | 442 | return; |
443 | } | 443 | } |
444 | // qDebug("setDocument "+fileref); | 444 | // qDebug("setDocument "+fileref); |
445 | if(fileref.find("playlist",0,TRUE) == -1) { | 445 | if(fileref.find("playlist",0,TRUE) == -1) { |
446 | clearList(); | 446 | clearList(); |
447 | addToSelection( DocLnk( fileref ) ); | 447 | addToSelection( DocLnk( fileref ) ); |
448 | d->setDocumentUsed = TRUE; | 448 | d->setDocumentUsed = TRUE; |
449 | mediaPlayerState->setPlaying( FALSE ); | 449 | mediaPlayerState->setPlaying( FALSE ); |
450 | qApp->processEvents(); | 450 | qApp->processEvents(); |
451 | mediaPlayerState->setPlaying( TRUE ); | 451 | mediaPlayerState->setPlaying( TRUE ); |
452 | qApp->processEvents(); | 452 | qApp->processEvents(); |
453 | setCaption("OpiePlayer"); | 453 | setCaption("OpiePlayer"); |
454 | 454 | ||
455 | } else { //is playlist | 455 | } else { //is playlist |
456 | clearList(); | 456 | clearList(); |
457 | loadList(DocLnk(fileref)); | 457 | loadList(DocLnk(fileref)); |
458 | d->selectedFiles->first(); | 458 | d->selectedFiles->first(); |
459 | } | 459 | } |
460 | } | 460 | } |
461 | 461 | ||
462 | 462 | ||
463 | void PlayListWidget::setActiveWindow() { | 463 | void PlayListWidget::setActiveWindow() { |
464 | // When we get raised we need to ensure that it switches views | 464 | // When we get raised we need to ensure that it switches views |
465 | char origView = mediaPlayerState->view(); | 465 | char origView = mediaPlayerState->view(); |
466 | mediaPlayerState->setView( 'l' ); // invalidate | 466 | mediaPlayerState->setView( 'l' ); // invalidate |
467 | mediaPlayerState->setView( origView ); // now switch back | 467 | mediaPlayerState->setView( origView ); // now switch back |
468 | } | 468 | } |
469 | 469 | ||
470 | 470 | ||
471 | void PlayListWidget::useSelectedDocument() { | 471 | void PlayListWidget::useSelectedDocument() { |
472 | d->setDocumentUsed = FALSE; | 472 | d->setDocumentUsed = FALSE; |
473 | } | 473 | } |
474 | 474 | ||
475 | 475 | ||
476 | const DocLnk *PlayListWidget::current() { // this is fugly | 476 | const DocLnk *PlayListWidget::current() { // this is fugly |
477 | 477 | ||
478 | // if( fromSetDocument) { | 478 | // if( fromSetDocument) { |
479 | // qDebug("from setDoc"); | 479 | // qDebug("from setDoc"); |
480 | // DocLnkSet files; | 480 | // DocLnkSet files; |
481 | // Global::findDocuments(&files, "video/*;audio/*"); | 481 | // Global::findDocuments(&files, "video/*;audio/*"); |
482 | // QListIterator<DocLnk> dit( files.children() ); | 482 | // QListIterator<DocLnk> dit( files.children() ); |
483 | // for ( ; dit.current(); ++dit ) { | 483 | // for ( ; dit.current(); ++dit ) { |
484 | // if(dit.current()->linkFile() == setDocFileRef) { | 484 | // if(dit.current()->linkFile() == setDocFileRef) { |
485 | // qDebug(setDocFileRef); | 485 | // qDebug(setDocFileRef); |
486 | // return dit; | 486 | // return dit; |
487 | // } | 487 | // } |
488 | // } | 488 | // } |
489 | // } else | 489 | // } else |
490 | // qDebug("current"); | 490 | // qDebug("current"); |
491 | // switch (tabWidget->currentPageIndex()) { | 491 | // switch (tabWidget->currentPageIndex()) { |
492 | // case 0: //playlist | 492 | // case 0: //playlist |
493 | // { | 493 | // { |
494 | qDebug("playlist"); | 494 | qDebug("playlist"); |
495 | if ( mediaPlayerState->playlist() ) { | 495 | if ( mediaPlayerState->playlist() ) { |
496 | return d->selectedFiles->current(); | 496 | return d->selectedFiles->current(); |
497 | } | 497 | } |
498 | else if ( d->setDocumentUsed && d->current ) { | 498 | else if ( d->setDocumentUsed && d->current ) { |
499 | return d->current; | 499 | return d->current; |
500 | } else { | 500 | } else { |
501 | return d->files->selected(); | 501 | return d->files->selected(); |
502 | } | 502 | } |
503 | // } | 503 | // } |
504 | // break; | 504 | // break; |
505 | // case 1://audio | 505 | // case 1://audio |
506 | // { | 506 | // { |
507 | // qDebug("audioView"); | 507 | // qDebug("audioView"); |
508 | // Global::findDocuments(&files, "audio/*"); | 508 | // Global::findDocuments(&files, "audio/*"); |
509 | // QListIterator<DocLnk> dit( files.children() ); | 509 | // QListIterator<DocLnk> dit( files.children() ); |
510 | // for ( ; dit.current(); ++dit ) { | 510 | // for ( ; dit.current(); ++dit ) { |
511 | // if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { | 511 | // if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { |
512 | // qDebug("here"); | 512 | // qDebug("here"); |
513 | // insanityBool=TRUE; | 513 | // insanityBool=TRUE; |
514 | // return dit; | 514 | // return dit; |
515 | // } | 515 | // } |
516 | // } | 516 | // } |
517 | // } | 517 | // } |
518 | // break; | 518 | // break; |
519 | // case 2: // video | 519 | // case 2: // video |
520 | // { | 520 | // { |
521 | // qDebug("videoView"); | 521 | // qDebug("videoView"); |
522 | // Global::findDocuments(&vFiles, "video/*"); | 522 | // Global::findDocuments(&vFiles, "video/*"); |
523 | // QListIterator<DocLnk> Vdit( vFiles.children() ); | 523 | // QListIterator<DocLnk> Vdit( vFiles.children() ); |
524 | // for ( ; Vdit.current(); ++Vdit ) { | 524 | // for ( ; Vdit.current(); ++Vdit ) { |
525 | // if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { | 525 | // if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { |
526 | // insanityBool=TRUE; | 526 | // insanityBool=TRUE; |
527 | // return Vdit; | 527 | // return Vdit; |
528 | // } | 528 | // } |
529 | // } | 529 | // } |
530 | // } | 530 | // } |
531 | // break; | 531 | // break; |
532 | // }; | 532 | // }; |
533 | // return 0; | 533 | // return 0; |
534 | } | 534 | } |
535 | 535 | ||
536 | bool PlayListWidget::prev() { | 536 | bool PlayListWidget::prev() { |
537 | if ( mediaPlayerState->playlist() ) { | 537 | if ( mediaPlayerState->playlist() ) { |
538 | if ( mediaPlayerState->shuffled() ) { | 538 | if ( mediaPlayerState->shuffled() ) { |
539 | const DocLnk *cur = current(); | 539 | const DocLnk *cur = current(); |
540 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); | 540 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); |
541 | for ( int i = 0; i < j; i++ ) { | 541 | for ( int i = 0; i < j; i++ ) { |
542 | if ( !d->selectedFiles->next() ) | 542 | if ( !d->selectedFiles->next() ) |
543 | d->selectedFiles->first(); | 543 | d->selectedFiles->first(); |
544 | } | 544 | } |
545 | if ( cur == current() ) | 545 | if ( cur == current() ) |
546 | if ( !d->selectedFiles->next() ) | 546 | if ( !d->selectedFiles->next() ) |
547 | d->selectedFiles->first(); | 547 | d->selectedFiles->first(); |
548 | return TRUE; | 548 | return TRUE; |
549 | } else { | 549 | } else { |
550 | if ( !d->selectedFiles->prev() ) { | 550 | if ( !d->selectedFiles->prev() ) { |
551 | if ( mediaPlayerState->looping() ) { | 551 | if ( mediaPlayerState->looping() ) { |
552 | return d->selectedFiles->last(); | 552 | return d->selectedFiles->last(); |
553 | } else { | 553 | } else { |
554 | return FALSE; | 554 | return FALSE; |
555 | } | 555 | } |
556 | } | 556 | } |
557 | return TRUE; | 557 | return TRUE; |
558 | } | 558 | } |
559 | } else { | 559 | } else { |
560 | return mediaPlayerState->looping(); | 560 | return mediaPlayerState->looping(); |
561 | } | 561 | } |
562 | } | 562 | } |
563 | 563 | ||
564 | 564 | ||
565 | bool PlayListWidget::next() { | 565 | bool PlayListWidget::next() { |
566 | if ( mediaPlayerState->playlist() ) { | 566 | if ( mediaPlayerState->playlist() ) { |
567 | if ( mediaPlayerState->shuffled() ) { | 567 | if ( mediaPlayerState->shuffled() ) { |
568 | return prev(); | 568 | return prev(); |
569 | } else { | 569 | } else { |
570 | if ( !d->selectedFiles->next() ) { | 570 | if ( !d->selectedFiles->next() ) { |
571 | if ( mediaPlayerState->looping() ) { | 571 | if ( mediaPlayerState->looping() ) { |
572 | return d->selectedFiles->first(); | 572 | return d->selectedFiles->first(); |
573 | } else { | 573 | } else { |
574 | return FALSE; | 574 | return FALSE; |
575 | } | 575 | } |
576 | } | 576 | } |
577 | return TRUE; | 577 | return TRUE; |
578 | } | 578 | } |
579 | } else { | 579 | } else { |
580 | return mediaPlayerState->looping(); | 580 | return mediaPlayerState->looping(); |
581 | } | 581 | } |
582 | } | 582 | } |
583 | 583 | ||
584 | 584 | ||
585 | bool PlayListWidget::first() { | 585 | bool PlayListWidget::first() { |
586 | if ( mediaPlayerState->playlist() ) | 586 | if ( mediaPlayerState->playlist() ) |
587 | return d->selectedFiles->first(); | 587 | return d->selectedFiles->first(); |
588 | else | 588 | else |
589 | return mediaPlayerState->looping(); | 589 | return mediaPlayerState->looping(); |
590 | } | 590 | } |
591 | 591 | ||
592 | 592 | ||
593 | bool PlayListWidget::last() { | 593 | bool PlayListWidget::last() { |
594 | if ( mediaPlayerState->playlist() ) | 594 | if ( mediaPlayerState->playlist() ) |
595 | return d->selectedFiles->last(); | 595 | return d->selectedFiles->last(); |
596 | else | 596 | else |
597 | return mediaPlayerState->looping(); | 597 | return mediaPlayerState->looping(); |
598 | } | 598 | } |
599 | 599 | ||
600 | 600 | ||
601 | void PlayListWidget::saveList() { | 601 | void PlayListWidget::saveList() { |
602 | 602 | ||
603 | QString filename; | 603 | QString filename; |
604 | InputDialog *fileDlg; | 604 | InputDialog *fileDlg; |
605 | fileDlg = new InputDialog(this,"Save Playlist",TRUE, 0); | 605 | fileDlg = new InputDialog(this,"Save Playlist",TRUE, 0); |
606 | fileDlg->exec(); | 606 | fileDlg->exec(); |
607 | if( fileDlg->result() == 1 ) { | 607 | if( fileDlg->result() == 1 ) { |
608 | if ( d->current ) | 608 | if ( d->current ) |
609 | delete d->current; | 609 | delete d->current; |
610 | filename = fileDlg->LineEdit1->text();//+".playlist"; | 610 | filename = fileDlg->LineEdit1->text();//+".playlist"; |
611 | // qDebug("saving playlist "+filename+".playlist"); | 611 | // qDebug("saving playlist "+filename+".playlist"); |
612 | Config cfg( filename +".playlist"); | 612 | Config cfg( filename +".playlist"); |
613 | writeConfig( cfg ); | 613 | writeConfig( cfg ); |
614 | if( playLists->selected()->name() == filename) { | 614 | if( playLists->selected()->name() == filename) { |
615 | // qDebug("same name so delete lnk"); | 615 | // qDebug("same name so delete lnk"); |
616 | QFile().remove(playLists->selected()->file()); | 616 | QFile().remove(playLists->selected()->file()); |
617 | QFile().remove(playLists->selected()->linkFile()); | 617 | QFile().remove(playLists->selected()->linkFile()); |
618 | playLists->reread(); | 618 | playLists->reread(); |
619 | } | 619 | } |
620 | 620 | ||
621 | DocLnk lnk; | 621 | DocLnk lnk; |
622 | // lnk.setComment( ""); | 622 | // lnk.setComment( ""); |
623 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property | 623 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property |
624 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D | 624 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D |
625 | lnk.setIcon("mpegplayer/playlist2"); | 625 | lnk.setIcon("mpegplayer/playlist2"); |
626 | lnk.setName( filename); //sets file name | 626 | lnk.setName( filename); //sets file name |
627 | if(!lnk.writeLink()) | 627 | if(!lnk.writeLink()) |
628 | qDebug("Writing doclink did not work"); | 628 | qDebug("Writing doclink did not work"); |
629 | } | 629 | } |
630 | Config config( "MediaPlayer" ); | 630 | Config config( "MediaPlayer" ); |
631 | config.writeEntry("CurrentPlaylist",filename); | 631 | config.writeEntry("CurrentPlaylist",filename); |
632 | setCaption("OpiePlayer: "+filename); | 632 | setCaption("OpiePlayer: "+filename); |
633 | d->selectedFiles->first(); | 633 | d->selectedFiles->first(); |
634 | if(fileDlg) | 634 | if(fileDlg) |
635 | delete fileDlg; | 635 | delete fileDlg; |
636 | } | 636 | } |
637 | 637 | ||
638 | void PlayListWidget::loadList( const DocLnk & lnk) { | 638 | void PlayListWidget::loadList( const DocLnk & lnk) { |
639 | QString name= lnk.name(); | 639 | QString name= lnk.name(); |
640 | // qDebug("currentList is "+name); | 640 | // qDebug("currentList is "+name); |
641 | if( name.length()>1) { | 641 | if( name.length()>1) { |
642 | setCaption("OpiePlayer: "+name); | 642 | setCaption("OpiePlayer: "+name); |
643 | // qDebug("load list "+ name+".playlist"); | 643 | // qDebug("load list "+ name+".playlist"); |
644 | clearList(); | 644 | clearList(); |
645 | Config cfg( name+".playlist"); | 645 | Config cfg( name+".playlist"); |
646 | readConfig(cfg); | 646 | readConfig(cfg); |
647 | tabWidget->setCurrentPage(0); | 647 | tabWidget->setCurrentPage(0); |
648 | Config config( "MediaPlayer" ); | 648 | Config config( "MediaPlayer" ); |
649 | config.writeEntry("CurrentPlaylist", name); | 649 | config.writeEntry("CurrentPlaylist", name); |
650 | d->selectedFiles->first(); | 650 | d->selectedFiles->first(); |
651 | } | 651 | } |
652 | } | 652 | } |
653 | 653 | ||
654 | void PlayListWidget::setPlaylist( bool shown ) { | 654 | void PlayListWidget::setPlaylist( bool shown ) { |
655 | if ( shown ) | 655 | if ( shown ) |
656 | d->playListFrame->show(); | 656 | d->playListFrame->show(); |
657 | else | 657 | else |
658 | d->playListFrame->hide(); | 658 | d->playListFrame->hide(); |
659 | } | 659 | } |
660 | 660 | ||
661 | void PlayListWidget::setView( char view ) { | 661 | void PlayListWidget::setView( char view ) { |
662 | if ( view == 'l' ) | 662 | if ( view == 'l' ) |
663 | showMaximized(); | 663 | showMaximized(); |
664 | else | 664 | else |
665 | hide(); | 665 | hide(); |
666 | } | 666 | } |
667 | 667 | ||
668 | void PlayListWidget::addSelected() { | 668 | void PlayListWidget::addSelected() { |
669 | 669 | ||
670 | Config cfg( "MediaPlayer" ); | 670 | Config cfg( "MediaPlayer" ); |
671 | cfg.setGroup("PlayList"); | 671 | cfg.setGroup("PlayList"); |
672 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 672 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
673 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 673 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
674 | 674 | ||
675 | switch (tabWidget->currentPageIndex()) { | 675 | switch (tabWidget->currentPageIndex()) { |
676 | case 0: //playlist | 676 | case 0: //playlist |
677 | break; | 677 | break; |
678 | case 1: { //audio | 678 | case 1: { //audio |
679 | for ( int i = 0; i < noOfFiles; i++ ) { | 679 | for ( int i = 0; i < noOfFiles; i++ ) { |
680 | QString entryName; | 680 | QString entryName; |
681 | entryName.sprintf( "File%i", i + 1 ); | 681 | entryName.sprintf( "File%i", i + 1 ); |
682 | QString linkFile = cfg.readEntry( entryName ); | 682 | QString linkFile = cfg.readEntry( entryName ); |
683 | if( DocLnk( linkFile).name() == audioView->selectedItem()->text(0) ) { | 683 | if( DocLnk( linkFile).name() == audioView->selectedItem()->text(0) ) { |
684 | int result= QMessageBox::warning(this,"OpiePlayer", | 684 | int result= QMessageBox::warning(this,"OpiePlayer", |
685 | tr("This is all ready in your playlist.\nContinue?"), | 685 | tr("This is all ready in your playlist.\nContinue?"), |
686 | tr("Yes"),tr("No"),0,0,1); | 686 | tr("Yes"),tr("No"),0,0,1); |
687 | if (result !=0) | 687 | if (result !=0) |
688 | return; | 688 | return; |
689 | } | 689 | } |
690 | } | 690 | } |
691 | addToSelection( audioView->selectedItem() ); | 691 | addToSelection( audioView->selectedItem() ); |
692 | tabWidget->setCurrentPage(1); | 692 | tabWidget->setCurrentPage(1); |
693 | } | 693 | } |
694 | break; | 694 | break; |
695 | case 2: { // video | 695 | case 2: { // video |
696 | for ( int i = 0; i < noOfFiles; i++ ) { | 696 | for ( int i = 0; i < noOfFiles; i++ ) { |
697 | QString entryName; | 697 | QString entryName; |
698 | entryName.sprintf( "File%i", i + 1 ); | 698 | entryName.sprintf( "File%i", i + 1 ); |
699 | QString linkFile = cfg.readEntry( entryName ); | 699 | QString linkFile = cfg.readEntry( entryName ); |
700 | if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { | 700 | if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { |
701 | int result= QMessageBox::warning(this,"OpiePlayer", | 701 | int result= QMessageBox::warning(this,"OpiePlayer", |
702 | tr("This is all ready in your playlist.\nContinue?"), | 702 | tr("This is all ready in your playlist.\nContinue?"), |
703 | tr("Yes"),tr("No"),0,0,1); | 703 | tr("Yes"),tr("No"),0,0,1); |
704 | if (result !=0) | 704 | if (result !=0) |
705 | return; | 705 | return; |
706 | } | 706 | } |
707 | } | 707 | } |
708 | addToSelection( videoView->selectedItem() ); | 708 | addToSelection( videoView->selectedItem() ); |
709 | tabWidget->setCurrentPage(2); | 709 | tabWidget->setCurrentPage(2); |
710 | } | 710 | } |
711 | break; | 711 | break; |
712 | }; | 712 | }; |
713 | } | 713 | } |
714 | 714 | ||
715 | void PlayListWidget::removeSelected() { | 715 | void PlayListWidget::removeSelected() { |
716 | d->selectedFiles->removeSelected( ); | 716 | d->selectedFiles->removeSelected( ); |
717 | } | 717 | } |
718 | 718 | ||
719 | 719 | ||
720 | void PlayListWidget::playIt( QListViewItem *it) { | 720 | void PlayListWidget::playIt( QListViewItem *it) { |
721 | // d->setDocumentUsed = FALSE; | 721 | // d->setDocumentUsed = FALSE; |
722 | mediaPlayerState->setPlaying(TRUE); | 722 | mediaPlayerState->setPlaying(TRUE); |
723 | } | 723 | } |
724 | 724 | ||
725 | void PlayListWidget::addToSelection( QListViewItem *it) { | 725 | void PlayListWidget::addToSelection( QListViewItem *it) { |
726 | d->setDocumentUsed = FALSE; | 726 | d->setDocumentUsed = FALSE; |
727 | 727 | ||
728 | if(it) { | 728 | if(it) { |
729 | // qDebug("add to selection"); | 729 | // qDebug("add to selection"); |
730 | switch (tabWidget->currentPageIndex()) { | 730 | switch (tabWidget->currentPageIndex()) { |
731 | case 1: { | 731 | case 1: { |
732 | // qDebug("case 1"); | 732 | // qDebug("case 1"); |
733 | QListIterator<DocLnk> dit( files.children() ); | 733 | QListIterator<DocLnk> dit( files.children() ); |
734 | for ( ; dit.current(); ++dit ) { | 734 | for ( ; dit.current(); ++dit ) { |
735 | // qDebug(dit.current()->name()); | 735 | // qDebug(dit.current()->name()); |
736 | if( dit.current()->name() == it->text(0)) { | 736 | if( dit.current()->name() == it->text(0)) { |
737 | d->selectedFiles->addToSelection( **dit ); | 737 | d->selectedFiles->addToSelection( **dit ); |
738 | } | 738 | } |
739 | } | 739 | } |
740 | } | 740 | } |
741 | break; | 741 | break; |
742 | case 2: { | 742 | case 2: { |
743 | // qDebug("case 2"); | 743 | // qDebug("case 2"); |
744 | QListIterator<DocLnk> dit( vFiles.children() ); | 744 | QListIterator<DocLnk> dit( vFiles.children() ); |
745 | for ( ; dit.current(); ++dit ) { | 745 | for ( ; dit.current(); ++dit ) { |
746 | // qDebug(dit.current()->name()); | 746 | // qDebug(dit.current()->name()); |
747 | if( dit.current()->name() == it->text(0)) { | 747 | if( dit.current()->name() == it->text(0)) { |
748 | d->selectedFiles->addToSelection( **dit ); | 748 | d->selectedFiles->addToSelection( **dit ); |
749 | } | 749 | } |
750 | } | 750 | } |
751 | } | 751 | } |
752 | break; | 752 | break; |
753 | case 0: | 753 | case 0: |
754 | break; | 754 | break; |
755 | }; | 755 | }; |
756 | tabWidget->setCurrentPage(0); | 756 | tabWidget->setCurrentPage(0); |
757 | // mediaPlayerState->setPlaying( TRUE ); | 757 | // mediaPlayerState->setPlaying( TRUE ); |
758 | } | 758 | } |
759 | } | 759 | } |
760 | 760 | ||
761 | void PlayListWidget::tabChanged(QWidget *widg) { | 761 | void PlayListWidget::tabChanged(QWidget *widg) { |
762 | 762 | ||
763 | switch ( tabWidget->currentPageIndex()) { | 763 | switch ( tabWidget->currentPageIndex()) { |
764 | case 0: | 764 | case 0: |
765 | { | 765 | { |
766 | if( !tbDeletePlaylist->isHidden()) | 766 | if( !tbDeletePlaylist->isHidden()) |
767 | tbDeletePlaylist->hide(); | 767 | tbDeletePlaylist->hide(); |
768 | d->tbRemoveFromList->setEnabled(TRUE); | 768 | d->tbRemoveFromList->setEnabled(TRUE); |
769 | d->tbAddToList->setEnabled(FALSE); | 769 | d->tbAddToList->setEnabled(FALSE); |
770 | } | 770 | } |
771 | break; | 771 | break; |
772 | case 1: | 772 | case 1: |
773 | { | 773 | { |
774 | if( !tbDeletePlaylist->isHidden()) | 774 | if( !tbDeletePlaylist->isHidden()) |
775 | tbDeletePlaylist->hide(); | 775 | tbDeletePlaylist->hide(); |
776 | d->tbRemoveFromList->setEnabled(FALSE); | 776 | d->tbRemoveFromList->setEnabled(FALSE); |
777 | d->tbAddToList->setEnabled(TRUE); | 777 | d->tbAddToList->setEnabled(TRUE); |
778 | } | 778 | } |
779 | break; | 779 | break; |
780 | case 2: | 780 | case 2: |
781 | { | 781 | { |
782 | if( !tbDeletePlaylist->isHidden()) | 782 | if( !tbDeletePlaylist->isHidden()) |
783 | tbDeletePlaylist->hide(); | 783 | tbDeletePlaylist->hide(); |
784 | d->tbRemoveFromList->setEnabled(FALSE); | 784 | d->tbRemoveFromList->setEnabled(FALSE); |
785 | d->tbAddToList->setEnabled(TRUE); | 785 | d->tbAddToList->setEnabled(TRUE); |
786 | } | 786 | } |
787 | break; | 787 | break; |
788 | case 3: | 788 | case 3: |
789 | { | 789 | { |
790 | if( tbDeletePlaylist->isHidden()) | 790 | if( tbDeletePlaylist->isHidden()) |
791 | tbDeletePlaylist->show(); | 791 | tbDeletePlaylist->show(); |
792 | playLists->reread(); | 792 | playLists->reread(); |
793 | } | 793 | } |
794 | break; | 794 | break; |
795 | }; | 795 | }; |
796 | } | 796 | } |
797 | 797 | ||
798 | 798 | ||
799 | /* | 799 | /* |
800 | play button is pressed*/ | 800 | play button is pressed*/ |
801 | void PlayListWidget::btnPlay(bool b) { | 801 | void PlayListWidget::btnPlay(bool b) { |
802 | // mediaPlayerState->setPlaying(b); | 802 | // mediaPlayerState->setPlaying(b); |
803 | switch ( tabWidget->currentPageIndex()) { | 803 | switch ( tabWidget->currentPageIndex()) { |
804 | case 0: | 804 | case 0: |
805 | { | 805 | { |
806 | mediaPlayerState->setPlaying(b); | 806 | mediaPlayerState->setPlaying(b); |
807 | } | 807 | } |
808 | break; | 808 | break; |
809 | case 1: | 809 | case 1: |
810 | { | 810 | { |
811 | addToSelection( audioView->selectedItem() ); | 811 | addToSelection( audioView->selectedItem() ); |
812 | mediaPlayerState->setPlaying(b); | 812 | mediaPlayerState->setPlaying(b); |
813 | // qApp->processEvents(); | 813 | // qApp->processEvents(); |
814 | d->selectedFiles->removeSelected( ); | 814 | d->selectedFiles->removeSelected( ); |
815 | tabWidget->setCurrentPage(1); | 815 | tabWidget->setCurrentPage(1); |
816 | d->selectedFiles->unSelect(); | ||
816 | // mediaPlayerState->setPlaying(FALSE); | 817 | // mediaPlayerState->setPlaying(FALSE); |
817 | } | 818 | } |
818 | break; | 819 | break; |
819 | case 2: | 820 | case 2: |
820 | { | 821 | { |
821 | addToSelection( videoView->selectedItem() ); | 822 | addToSelection( videoView->selectedItem() ); |
822 | mediaPlayerState->setPlaying(b); | 823 | mediaPlayerState->setPlaying(b); |
823 | qApp->processEvents(); | 824 | qApp->processEvents(); |
824 | d->selectedFiles->removeSelected( ); | 825 | d->selectedFiles->removeSelected( ); |
825 | tabWidget->setCurrentPage(2); | 826 | tabWidget->setCurrentPage(2); |
827 | d->selectedFiles->unSelect(); | ||
826 | // mediaPlayerState->setPlaying(FALSE); | 828 | // mediaPlayerState->setPlaying(FALSE); |
827 | } | 829 | } |
828 | break; | 830 | break; |
829 | }; | 831 | }; |
830 | 832 | ||
831 | 833 | ||
832 | 834 | ||
833 | 835 | ||
834 | } | 836 | } |
835 | 837 | ||
836 | void PlayListWidget::deletePlaylist() { | 838 | void PlayListWidget::deletePlaylist() { |
837 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 839 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
838 | (tr("You really want to delete\nthis playlist?")), | 840 | (tr("You really want to delete\nthis playlist?")), |
839 | (tr("Yes")), (tr("No")), 0 )){ | 841 | (tr("Yes")), (tr("No")), 0 )){ |
840 | case 0: // Yes clicked, | 842 | case 0: // Yes clicked, |
841 | QFile().remove(playLists->selected()->file()); | 843 | QFile().remove(playLists->selected()->file()); |
842 | QFile().remove(playLists->selected()->linkFile()); | 844 | QFile().remove(playLists->selected()->linkFile()); |
843 | playLists->reread(); | 845 | playLists->reread(); |
844 | break; | 846 | break; |
845 | case 1: // Cancel | 847 | case 1: // Cancel |
846 | break; | 848 | break; |
847 | }; | 849 | }; |
848 | 850 | ||
849 | } | 851 | } |
850 | 852 | ||
851 | void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | 853 | void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) |
852 | { | 854 | { |
853 | switch (mouse) { | 855 | switch (mouse) { |
854 | case 1: | 856 | case 1: |
855 | break; | 857 | break; |
856 | case 2:{ | 858 | case 2:{ |
857 | QPopupMenu m; | 859 | QPopupMenu m; |
858 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 860 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
859 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 861 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
860 | // m.insertSeparator(); | 862 | // m.insertSeparator(); |
861 | // m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 863 | // m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
862 | m.exec( QCursor::pos() ); | 864 | m.exec( QCursor::pos() ); |
863 | } | 865 | } |
864 | break; | 866 | break; |
865 | }; | 867 | }; |
866 | 868 | ||
867 | } | 869 | } |
868 | 870 | ||
869 | void PlayListWidget::playSelected() | 871 | void PlayListWidget::playSelected() |
870 | { | 872 | { |
871 | btnPlay( TRUE); | 873 | btnPlay( TRUE); |
872 | } | 874 | } |
873 | 875 | ||
874 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | 876 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) |
875 | { | 877 | { |
876 | switch (mouse) { | 878 | switch (mouse) { |
877 | case 1: | 879 | case 1: |
878 | break; | 880 | break; |
879 | case 2:{ | 881 | case 2:{ |
880 | QPopupMenu m; | 882 | QPopupMenu m; |
881 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 883 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
882 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 884 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
883 | // m.insertSeparator(); | 885 | // m.insertSeparator(); |
884 | m.exec( QCursor::pos() ); | 886 | m.exec( QCursor::pos() ); |
885 | } | 887 | } |
886 | break; | 888 | break; |
887 | }; | 889 | }; |
888 | 890 | ||
889 | } | 891 | } |