summaryrefslogtreecommitdiff
authordwmw2 <dwmw2>2002-05-09 12:28:20 (UTC)
committer dwmw2 <dwmw2>2002-05-09 12:28:20 (UTC)
commitb187f240c52da0f63de4036f40246c7ea7e5f7a2 (patch) (unidiff)
tree8a8b6116fecd78882e310bc35b7ea794cb32d541
parent67077883f382bd73bf4bdceda8994fa4e47ee5e6 (diff)
downloadopie-b187f240c52da0f63de4036f40246c7ea7e5f7a2.zip
opie-b187f240c52da0f63de4036f40246c7ea7e5f7a2.tar.gz
opie-b187f240c52da0f63de4036f40246c7ea7e5f7a2.tar.bz2
#include <qcursor.h>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 2118051..038b371 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1,228 +1,229 @@
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#define QTOPIA_INTERNAL_FSLP 21#define QTOPIA_INTERNAL_FSLP
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23 23
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/fileselector.h> 26#include <qpe/fileselector.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/lnkproperties.h> 28#include <qpe/lnkproperties.h>
29#include <qpe/storage.h> 29#include <qpe/storage.h>
30 30
31#include <qpe/applnk.h> 31#include <qpe/applnk.h>
32#include <qpe/config.h> 32#include <qpe/config.h>
33#include <qpe/global.h> 33#include <qpe/global.h>
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35 35
36#include <qaction.h> 36#include <qaction.h>
37#include <qcursor.h>
37#include <qimage.h> 38#include <qimage.h>
38#include <qfile.h> 39#include <qfile.h>
39#include <qdir.h> 40#include <qdir.h>
40#include <qlayout.h> 41#include <qlayout.h>
41#include <qlabel.h> 42#include <qlabel.h>
42#include <qlist.h> 43#include <qlist.h>
43#include <qlistbox.h> 44#include <qlistbox.h>
44#include <qmainwindow.h> 45#include <qmainwindow.h>
45#include <qmessagebox.h> 46#include <qmessagebox.h>
46#include <qtoolbutton.h> 47#include <qtoolbutton.h>
47#include <qtabwidget.h> 48#include <qtabwidget.h>
48#include <qlistview.h> 49#include <qlistview.h>
49#include <qpoint.h> 50#include <qpoint.h>
50#include <qlineedit.h> 51#include <qlineedit.h>
51#include <qpushbutton.h> 52#include <qpushbutton.h>
52#include <qregexp.h> 53#include <qregexp.h>
53 54
54//#include <qtimer.h> 55//#include <qtimer.h>
55 56
56#include "playlistselection.h" 57#include "playlistselection.h"
57#include "playlistwidget.h" 58#include "playlistwidget.h"
58#include "mediaplayerstate.h" 59#include "mediaplayerstate.h"
59 60
60#include "inputDialog.h" 61#include "inputDialog.h"
61 62
62#include <stdlib.h> 63#include <stdlib.h>
63#include "audiowidget.h" 64#include "audiowidget.h"
64#include "videowidget.h" 65#include "videowidget.h"
65 66
66#include <unistd.h> 67#include <unistd.h>
67#include <sys/file.h> 68#include <sys/file.h>
68#include <sys/ioctl.h> 69#include <sys/ioctl.h>
69#include <sys/soundcard.h> 70#include <sys/soundcard.h>
70 71
71// for setBacklight() 72// for setBacklight()
72#include <linux/fb.h> 73#include <linux/fb.h>
73#include <sys/types.h> 74#include <sys/types.h>
74#include <sys/stat.h> 75#include <sys/stat.h>
75#include <stdlib.h> 76#include <stdlib.h>
76 77
77#define BUTTONS_ON_TOOLBAR 78#define BUTTONS_ON_TOOLBAR
78#define SIDE_BUTTONS 79#define SIDE_BUTTONS
79#define CAN_SAVE_LOAD_PLAYLISTS 80#define CAN_SAVE_LOAD_PLAYLISTS
80 81
81extern AudioWidget *audioUI; 82extern AudioWidget *audioUI;
82extern VideoWidget *videoUI; 83extern VideoWidget *videoUI;
83extern MediaPlayerState *mediaPlayerState; 84extern MediaPlayerState *mediaPlayerState;
84 85
85// class myFileSelector { 86// class myFileSelector {
86 87
87// }; 88// };
88class PlayListWidgetPrivate { 89class PlayListWidgetPrivate {
89public: 90public:
90 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 91 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
91 QFrame *playListFrame; 92 QFrame *playListFrame;
92 FileSelector *files; 93 FileSelector *files;
93 PlayListSelection *selectedFiles; 94 PlayListSelection *selectedFiles;
94 bool setDocumentUsed; 95 bool setDocumentUsed;
95 DocLnk *current; 96 DocLnk *current;
96}; 97};
97 98
98 99
99class ToolButton : public QToolButton { 100class ToolButton : public QToolButton {
100public: 101public:
101 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 102 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
102 : QToolButton( parent, name ) { 103 : QToolButton( parent, name ) {
103 setTextLabel( name ); 104 setTextLabel( name );
104 setPixmap( Resource::loadPixmap( icon ) ); 105 setPixmap( Resource::loadPixmap( icon ) );
105 setAutoRaise( TRUE ); 106 setAutoRaise( TRUE );
106 setFocusPolicy( QWidget::NoFocus ); 107 setFocusPolicy( QWidget::NoFocus );
107 setToggleButton( t ); 108 setToggleButton( t );
108 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 109 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
109 QPEMenuToolFocusManager::manager()->addWidget( this ); 110 QPEMenuToolFocusManager::manager()->addWidget( this );
110 } 111 }
111}; 112};
112 113
113 114
114class MenuItem : public QAction { 115class MenuItem : public QAction {
115public: 116public:
116 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 117 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
117 : QAction( text, QString::null, 0, 0 ) { 118 : QAction( text, QString::null, 0, 0 ) {
118 connect( this, SIGNAL( activated() ), handler, slot ); 119 connect( this, SIGNAL( activated() ), handler, slot );
119 addTo( parent ); 120 addTo( parent );
120 } 121 }
121}; 122};
122 123
123 124
124PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 125PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
125 : QMainWindow( parent, name, fl ) { 126 : QMainWindow( parent, name, fl ) {
126 127
127 d = new PlayListWidgetPrivate; 128 d = new PlayListWidgetPrivate;
128 d->setDocumentUsed = FALSE; 129 d->setDocumentUsed = FALSE;
129 d->current = NULL; 130 d->current = NULL;
130 fromSetDocument = FALSE; 131 fromSetDocument = FALSE;
131 insanityBool=FALSE; 132 insanityBool=FALSE;
132// menuTimer = new QTimer( this ,"menu timer"), 133// menuTimer = new QTimer( this ,"menu timer"),
133// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); 134// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
134 135
135 setBackgroundMode( PaletteButton ); 136 setBackgroundMode( PaletteButton );
136 137
137 setCaption( tr("OpiePlayer") ); 138 setCaption( tr("OpiePlayer") );
138 setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); 139 setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) );
139 140
140 setToolBarsMovable( FALSE ); 141 setToolBarsMovable( FALSE );
141 142
142 // Create Toolbar 143 // Create Toolbar
143 QPEToolBar *toolbar = new QPEToolBar( this ); 144 QPEToolBar *toolbar = new QPEToolBar( this );
144 toolbar->setHorizontalStretchable( TRUE ); 145 toolbar->setHorizontalStretchable( TRUE );
145 146
146 // Create Menubar 147 // Create Menubar
147 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 148 QPEMenuBar *menu = new QPEMenuBar( toolbar );
148 menu->setMargin( 0 ); 149 menu->setMargin( 0 );
149 150
150 QPEToolBar *bar = new QPEToolBar( this ); 151 QPEToolBar *bar = new QPEToolBar( this );
151 bar->setLabel( tr( "Play Operations" ) ); 152 bar->setLabel( tr( "Play Operations" ) );
152// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", 153// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list",
153// this , SLOT( addSelected()) ); 154// this , SLOT( addSelected()) );
154 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); 155 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
155 tbDeletePlaylist->setFlat(TRUE); 156 tbDeletePlaylist->setFlat(TRUE);
156 tbDeletePlaylist->setFixedSize(20,20); 157 tbDeletePlaylist->setFixedSize(20,20);
157 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 158 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
158 159
159 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", 160 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist",
160 this , SLOT(addSelected()) ); 161 this , SLOT(addSelected()) );
161 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", 162 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist",
162 this , SLOT(removeSelected()) ); 163 this , SLOT(removeSelected()) );
163// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); 164// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE );
164 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", 165 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play",
165 this , SLOT( btnPlay(bool) ), TRUE ); 166 this , SLOT( btnPlay(bool) ), TRUE );
166 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", 167 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle",
167 mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); 168 mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
168 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", 169 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop",
169 mediaPlayerState, SLOT(setLooping(bool)), TRUE ); 170 mediaPlayerState, SLOT(setLooping(bool)), TRUE );
170 tbDeletePlaylist->hide(); 171 tbDeletePlaylist->hide();
171 172
172 QPopupMenu *pmPlayList = new QPopupMenu( this ); 173 QPopupMenu *pmPlayList = new QPopupMenu( this );
173 menu->insertItem( tr( "File" ), pmPlayList ); 174 menu->insertItem( tr( "File" ), pmPlayList );
174 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 175 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
175 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 176 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
176 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 177 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
177 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 178 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
178// pmPlayList->insertSeparator(-1); 179// pmPlayList->insertSeparator(-1);
179 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 180 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
180 pmPlayList->insertSeparator(-1); 181 pmPlayList->insertSeparator(-1);
181 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); 182 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
182 183
183 QPopupMenu *pmView = new QPopupMenu( this ); 184 QPopupMenu *pmView = new QPopupMenu( this );
184 menu->insertItem( tr( "View" ), pmView ); 185 menu->insertItem( tr( "View" ), pmView );
185 186
186 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); 187 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
187 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); 188 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
188 fullScreenButton->addTo(pmView); 189 fullScreenButton->addTo(pmView);
189 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); 190 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0);
190 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); 191 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
191 scaleButton->addTo(pmView); 192 scaleButton->addTo(pmView);
192 193
193 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 194 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
194 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 195 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
195 196
196 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 197 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
197 198
198 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 199 tabWidget = new QTabWidget( hbox6, "tabWidget" );
199 tabWidget->setTabShape(QTabWidget::Triangular); 200 tabWidget->setTabShape(QTabWidget::Triangular);
200 201
201 QWidget *pTab; 202 QWidget *pTab;
202 pTab = new QWidget( tabWidget, "pTab" ); 203 pTab = new QWidget( tabWidget, "pTab" );
203// playlistView = new QListView( pTab, "playlistview" ); 204// playlistView = new QListView( pTab, "playlistview" );
204// playlistView->setMinimumSize(236,260); 205// playlistView->setMinimumSize(236,260);
205 tabWidget->insertTab( pTab,"Playlist"); 206 tabWidget->insertTab( pTab,"Playlist");
206 207
207 208
208 // Add the playlist area 209 // Add the playlist area
209 210
210 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 211 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
211 d->playListFrame = vbox3; 212 d->playListFrame = vbox3;
212 d->playListFrame ->setMinimumSize(235,260); 213 d->playListFrame ->setMinimumSize(235,260);
213 214
214 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 215 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
215 216
216 d->selectedFiles = new PlayListSelection( hbox2); 217 d->selectedFiles = new PlayListSelection( hbox2);
217 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 218 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
218 219
219 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); 220 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
220 221
221 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 222 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
222 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 223 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
223 224
224 225
225 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 226 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
226 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); 227 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
227 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); 228 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
228 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); 229 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );