-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 77e2095..83161ec 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -78,193 +78,193 @@ 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 | audioScan = FALSE; | 110 | audioScan = FALSE; |
111 | videoScan = FALSE; | 111 | videoScan = FALSE; |
112 | 112 | ||
113 | setBackgroundMode( PaletteButton ); | 113 | setBackgroundMode( PaletteButton ); |
114 | 114 | ||
115 | setCaption( tr("OpiePlayer") ); | 115 | setCaption( tr("OpiePlayer") ); |
116 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); | 116 | setIcon( Resource::loadPixmap( "opieplayer/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 | 130 | ||
131 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 131 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
132 | tbDeletePlaylist->setFlat(TRUE); | 132 | tbDeletePlaylist->setFlat(TRUE); |
133 | tbDeletePlaylist->setFixedSize(20,20); | 133 | tbDeletePlaylist->setFixedSize(20,20); |
134 | 134 | ||
135 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", | 135 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", |
136 | this , SLOT(addSelected()) ); | 136 | this , SLOT(addSelected()) ); |
137 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", | 137 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", |
138 | this , SLOT(removeSelected()) ); | 138 | this , SLOT(removeSelected()) ); |
139 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", | 139 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", |
140 | this , SLOT( btnPlay(bool) ), TRUE ); | 140 | this , SLOT( btnPlay(bool) ), TRUE ); |
141 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", | 141 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", |
142 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 142 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
143 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", | 143 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", |
144 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 144 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
145 | tbDeletePlaylist->hide(); | 145 | tbDeletePlaylist->hide(); |
146 | 146 | ||
147 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 147 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
148 | menu->insertItem( tr( "File" ), pmPlayList ); | 148 | menu->insertItem( tr( "File" ), pmPlayList ); |
149 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 149 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
150 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 150 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
151 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 151 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
152 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 152 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
153 | pmPlayList->insertSeparator(-1); | 153 | pmPlayList->insertSeparator(-1); |
154 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 154 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
155 | new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); | 155 | new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); |
156 | pmPlayList->insertSeparator(-1); | 156 | pmPlayList->insertSeparator(-1); |
157 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 157 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
158 | pmPlayList->insertSeparator(-1); | 158 | pmPlayList->insertSeparator(-1); |
159 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 159 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
160 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 160 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
161 | 161 | ||
162 | 162 | ||
163 | pmView = new QPopupMenu( this ); | 163 | pmView = new QPopupMenu( this ); |
164 | menu->insertItem( tr( "View" ), pmView ); | 164 | menu->insertItem( tr( "View" ), pmView ); |
165 | pmView->isCheckable(); | 165 | pmView->isCheckable(); |
166 | 166 | ||
167 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) ); | 167 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) ); |
168 | 168 | ||
169 | Config cfg( "OpiePlayer" ); | 169 | Config cfg( "OpiePlayer" ); |
170 | bool b= cfg.readBoolEntry("FullScreen", 0); | 170 | bool b= cfg.readBoolEntry("FullScreen", 0); |
171 | mediaPlayerState->setFullscreen( b ); | 171 | mediaPlayerState->setFullscreen( b ); |
172 | pmView->setItemChecked( -16, b ); | 172 | pmView->setItemChecked( -16, b ); |
173 | 173 | ||
174 | pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), mediaPlayerState, SLOT(toggleScaled() ) ); | 174 | // pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), mediaPlayerState, SLOT(toggleScaled() ) ); |
175 | 175 | ||
176 | pmView->insertSeparator(-1); | 176 | pmView->insertSeparator(-1); |
177 | 177 | ||
178 | skinsMenu = new QPopupMenu( this ); | 178 | skinsMenu = new QPopupMenu( this ); |
179 | pmView->insertItem( tr( "Skins" ), skinsMenu ); | 179 | pmView->insertItem( tr( "Skins" ), skinsMenu ); |
180 | skinsMenu->isCheckable(); | 180 | skinsMenu->isCheckable(); |
181 | populateSkinsMenu(); | 181 | populateSkinsMenu(); |
182 | 182 | ||
183 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 183 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
184 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 184 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
185 | 185 | ||
186 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 186 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
187 | 187 | ||
188 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 188 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
189 | // tabWidget->setTabShape(QTabWidget::Triangular); | 189 | // tabWidget->setTabShape(QTabWidget::Triangular); |
190 | 190 | ||
191 | QWidget *pTab; | 191 | QWidget *pTab; |
192 | pTab = new QWidget( tabWidget, "pTab" ); | 192 | pTab = new QWidget( tabWidget, "pTab" ); |
193 | tabWidget->insertTab( pTab,"Playlist"); | 193 | tabWidget->insertTab( pTab,"Playlist"); |
194 | 194 | ||
195 | 195 | ||
196 | // Add the playlist area | 196 | // Add the playlist area |
197 | 197 | ||
198 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 198 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
199 | d->playListFrame = vbox3; | 199 | d->playListFrame = vbox3; |
200 | d->playListFrame ->setMinimumSize(235,260); | 200 | d->playListFrame ->setMinimumSize(235,260); |
201 | 201 | ||
202 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 202 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
203 | 203 | ||
204 | d->selectedFiles = new PlayListSelection( hbox2); | 204 | d->selectedFiles = new PlayListSelection( hbox2); |
205 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 205 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
206 | 206 | ||
207 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 207 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
208 | 208 | ||
209 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 209 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
210 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 210 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
211 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 211 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
212 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 212 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
213 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 213 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
214 | 214 | ||
215 | QWidget *aTab; | 215 | QWidget *aTab; |
216 | aTab = new QWidget( tabWidget, "aTab" ); | 216 | aTab = new QWidget( tabWidget, "aTab" ); |
217 | audioView = new QListView( aTab, "Audioview" ); | 217 | audioView = new QListView( aTab, "Audioview" ); |
218 | audioView->setMinimumSize(233,260); | 218 | audioView->setMinimumSize(233,260); |
219 | audioView->addColumn( tr("Title"),140); | 219 | audioView->addColumn( tr("Title"),140); |
220 | audioView->addColumn(tr("Size"), -1); | 220 | audioView->addColumn(tr("Size"), -1); |
221 | audioView->addColumn(tr("Media"),-1); | 221 | audioView->addColumn(tr("Media"),-1); |
222 | audioView->setColumnAlignment(1, Qt::AlignRight); | 222 | audioView->setColumnAlignment(1, Qt::AlignRight); |
223 | audioView->setColumnAlignment(2, Qt::AlignRight); | 223 | audioView->setColumnAlignment(2, Qt::AlignRight); |
224 | audioView->setAllColumnsShowFocus(TRUE); | 224 | audioView->setAllColumnsShowFocus(TRUE); |
225 | 225 | ||
226 | audioView->setMultiSelection( TRUE ); | 226 | audioView->setMultiSelection( TRUE ); |
227 | audioView->setSelectionMode( QListView::Extended); | 227 | audioView->setSelectionMode( QListView::Extended); |
228 | 228 | ||
229 | tabWidget->insertTab(aTab,tr("Audio")); | 229 | tabWidget->insertTab(aTab,tr("Audio")); |
230 | 230 | ||
231 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | 231 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); |
232 | 232 | ||
233 | QWidget *vTab; | 233 | QWidget *vTab; |
234 | vTab = new QWidget( tabWidget, "vTab" ); | 234 | vTab = new QWidget( tabWidget, "vTab" ); |
235 | videoView = new QListView( vTab, "Videoview" ); | 235 | videoView = new QListView( vTab, "Videoview" ); |
236 | videoView->setMinimumSize(233,260); | 236 | videoView->setMinimumSize(233,260); |
237 | 237 | ||
238 | videoView->addColumn(tr("Title"),140); | 238 | videoView->addColumn(tr("Title"),140); |
239 | videoView->addColumn(tr("Size"),-1); | 239 | videoView->addColumn(tr("Size"),-1); |
240 | videoView->addColumn(tr("Media"),-1); | 240 | videoView->addColumn(tr("Media"),-1); |
241 | videoView->setColumnAlignment(1, Qt::AlignRight); | 241 | videoView->setColumnAlignment(1, Qt::AlignRight); |
242 | videoView->setColumnAlignment(2, Qt::AlignRight); | 242 | videoView->setColumnAlignment(2, Qt::AlignRight); |
243 | videoView->setAllColumnsShowFocus(TRUE); | 243 | videoView->setAllColumnsShowFocus(TRUE); |
244 | videoView->setMultiSelection( TRUE ); | 244 | videoView->setMultiSelection( TRUE ); |
245 | videoView->setSelectionMode( QListView::Extended); | 245 | videoView->setSelectionMode( QListView::Extended); |
246 | 246 | ||
247 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 247 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
248 | 248 | ||
249 | tabWidget->insertTab( vTab,tr("Video")); | 249 | tabWidget->insertTab( vTab,tr("Video")); |
250 | 250 | ||
251 | //playlists list | 251 | //playlists list |
252 | QWidget *LTab; | 252 | QWidget *LTab; |
253 | LTab = new QWidget( tabWidget, "LTab" ); | 253 | LTab = new QWidget( tabWidget, "LTab" ); |
254 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | 254 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy |
255 | playLists->setMinimumSize(233,260); | 255 | playLists->setMinimumSize(233,260); |
256 | tabWidget->insertTab(LTab,tr("Lists")); | 256 | tabWidget->insertTab(LTab,tr("Lists")); |
257 | 257 | ||
258 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 258 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
259 | 259 | ||
260 | connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); | 260 | connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); |
261 | 261 | ||
262 | connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) ); | 262 | connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) ); |
263 | 263 | ||
264 | // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); | 264 | // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); |
265 | 265 | ||
266 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 266 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
267 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 267 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); |
268 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 268 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
269 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 269 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
270 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), | 270 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), |