Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index db2bf1b..c0a0029 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -19,27 +19,29 @@ | |||
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 | 22 | ||
23 | #include "playlistselection.h" | 23 | #include "playlistselection.h" |
24 | #include "playlistwidget.h" | 24 | #include "playlistwidget.h" |
25 | #include "mediaplayerstate.h" | 25 | #include "mediaplayerstate.h" |
26 | #include "inputDialog.h" | 26 | #include "inputDialog.h" |
27 | #include "audiowidget.h" | 27 | #include "audiowidget.h" |
28 | #include "videowidget.h" | 28 | #include "videowidget.h" |
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | #include <qpe/qpeapplication.h> | ||
31 | #include <qpe/qpemenubar.h> | 32 | #include <qpe/qpemenubar.h> |
32 | #include <qpe/lnkproperties.h> | 33 | #include <qpe/lnkproperties.h> |
33 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | #include <opie2/oresource.h> | ||
34 | 36 | ||
35 | /* QT */ | 37 | /* QT */ |
36 | #include <qtoolbar.h> | 38 | #include <qtoolbar.h> |
37 | #include <qaction.h> | 39 | #include <qaction.h> |
38 | #include <qlayout.h> | 40 | #include <qlayout.h> |
39 | #include <qmessagebox.h> | 41 | #include <qmessagebox.h> |
40 | //#include <qtimer.h> | 42 | //#include <qtimer.h> |
41 | 43 | ||
42 | /* STD */ | 44 | /* STD */ |
43 | #include <stdlib.h> | 45 | #include <stdlib.h> |
44 | 46 | ||
45 | #include <unistd.h> | 47 | #include <unistd.h> |
@@ -79,26 +81,27 @@ public: | |||
79 | FileSelector *files; | 81 | FileSelector *files; |
80 | PlayListSelection *selectedFiles; | 82 | PlayListSelection *selectedFiles; |
81 | bool setDocumentUsed; | 83 | bool setDocumentUsed; |
82 | DocLnk *current; | 84 | DocLnk *current; |
83 | }; | 85 | }; |
84 | 86 | ||
85 | 87 | ||
86 | class ToolButton : public QToolButton { | 88 | class ToolButton : public QToolButton { |
87 | public: | 89 | public: |
88 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 90 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
89 | : QToolButton( parent, name ) { | 91 | : QToolButton( parent, name ) { |
90 | setTextLabel( name ); | 92 | setTextLabel( name ); |
91 | setPixmap( Resource::loadPixmap( icon ) ); | 93 | setPixmap( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ); |
92 | setAutoRaise( TRUE ); | 94 | setAutoRaise( TRUE ); |
95 | setUsesBigPixmap( qApp->desktop()->size().width() > 330 ); | ||
93 | setFocusPolicy( QWidget::NoFocus ); | 96 | setFocusPolicy( QWidget::NoFocus ); |
94 | setToggleButton( t ); | 97 | setToggleButton( t ); |
95 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 98 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
96 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 99 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
97 | } | 100 | } |
98 | }; | 101 | }; |
99 | 102 | ||
100 | 103 | ||
101 | class MenuItem : public QAction { | 104 | class MenuItem : public QAction { |
102 | public: | 105 | public: |
103 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 106 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
104 | : QAction( text, QString::null, 0, 0 ) { | 107 | : QAction( text, QString::null, 0, 0 ) { |
@@ -118,41 +121,41 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
118 | insanityBool=FALSE; | 121 | insanityBool=FALSE; |
119 | audioScan = FALSE; | 122 | audioScan = FALSE; |
120 | videoScan = FALSE; | 123 | videoScan = FALSE; |
121 | // menuTimer = new QTimer( this ,"menu timer"), | 124 | // menuTimer = new QTimer( this ,"menu timer"), |
122 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 125 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
123 | channel = new QCopChannel( "QPE/Application/opieplayer", this ); | 126 | channel = new QCopChannel( "QPE/Application/opieplayer", this ); |
124 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), | 127 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
125 | this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); | 128 | this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); |
126 | 129 | ||
127 | setBackgroundMode( PaletteButton ); | 130 | setBackgroundMode( PaletteButton ); |
128 | 131 | ||
129 | setCaption( tr("OpiePlayer") ); | 132 | setCaption( tr("OpiePlayer") ); |
130 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); | 133 | setIcon( Opie::Core::OResource::loadPixmap( "opieplayer/MPEGPlayer", Opie::Core::OResource::SmallIcon ) ); |
131 | 134 | ||
132 | setToolBarsMovable( FALSE ); | 135 | setToolBarsMovable( FALSE ); |
133 | 136 | ||
134 | // Create Toolbar | 137 | // Create Toolbar |
135 | QToolBar *toolbar = new QToolBar( this ); | 138 | QToolBar *toolbar = new QToolBar( this ); |
136 | toolbar->setHorizontalStretchable( TRUE ); | 139 | toolbar->setHorizontalStretchable( TRUE ); |
137 | 140 | ||
138 | // Create Menubar | 141 | // Create Menubar |
139 | QMenuBar *menu = new QMenuBar( toolbar ); | 142 | QMenuBar *menu = new QMenuBar( toolbar ); |
140 | menu->setMargin( 0 ); | 143 | menu->setMargin( 0 ); |
141 | 144 | ||
142 | QToolBar *bar = new QToolBar( this ); | 145 | QToolBar *bar = new QToolBar( this ); |
143 | bar->setLabel( tr( "Play Operations" ) ); | 146 | bar->setLabel( tr( "Play Operations" ) ); |
144 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", | 147 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", |
145 | // this , SLOT( addSelected()) ); | 148 | // this , SLOT( addSelected()) ); |
146 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 149 | tbDeletePlaylist = new QPushButton( Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon),"",bar,"close"); |
147 | tbDeletePlaylist->setFlat(TRUE); | 150 | tbDeletePlaylist->setFlat(TRUE); |
148 | 151 | ||
149 | tbDeletePlaylist->setFixedSize(20,20); | 152 | tbDeletePlaylist->setFixedSize(20,20); |
150 | 153 | ||
151 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", | 154 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", |
152 | this , SLOT(addSelected()) ); | 155 | this , SLOT(addSelected()) ); |
153 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", | 156 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", |
154 | this , SLOT(removeSelected()) ); | 157 | this , SLOT(removeSelected()) ); |
155 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool)/*btnPlay()*/), TRUE ); | 158 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool)/*btnPlay()*/), TRUE ); |
156 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", | 159 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", |
157 | this , SLOT( btnPlay(bool) ), TRUE ); | 160 | this , SLOT( btnPlay(bool) ), TRUE ); |
158 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", | 161 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", |
@@ -168,27 +171,29 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
168 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 171 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
169 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 172 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
170 | pmPlayList->insertSeparator(-1); | 173 | pmPlayList->insertSeparator(-1); |
171 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 174 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
172 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 175 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
173 | pmPlayList->insertSeparator(-1); | 176 | pmPlayList->insertSeparator(-1); |
174 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 177 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
175 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 178 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
176 | 179 | ||
177 | QPopupMenu *pmView = new QPopupMenu( this ); | 180 | QPopupMenu *pmView = new QPopupMenu( this ); |
178 | menu->insertItem( tr( "View" ), pmView ); | 181 | menu->insertItem( tr( "View" ), pmView ); |
179 | 182 | ||
180 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 183 | fullScreenButton = new QAction(tr("Full Screen"), Opie::Core::OResource::loadPixmap("fullscreen", Opie::Core::OResource::SmallIcon), |
184 | QString::null, 0, this, 0); | ||
181 | fullScreenButton->addTo(pmView); | 185 | fullScreenButton->addTo(pmView); |
182 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); | 186 | scaleButton = new QAction(tr("Scale"), Opie::Core::OResource::loadPixmap("opieplayer/scale", Opie::Core::OResource::SmallIcon), |
187 | QString::null, 0, this, 0); | ||
183 | scaleButton->addTo(pmView); | 188 | scaleButton->addTo(pmView); |
184 | 189 | ||
185 | 190 | ||
186 | skinsMenu = new QPopupMenu( this ); | 191 | skinsMenu = new QPopupMenu( this ); |
187 | menu->insertItem( tr( "Skins" ), skinsMenu ); | 192 | menu->insertItem( tr( "Skins" ), skinsMenu ); |
188 | skinsMenu->isCheckable(); | 193 | skinsMenu->isCheckable(); |
189 | connect( skinsMenu, SIGNAL( activated(int) ) , | 194 | connect( skinsMenu, SIGNAL( activated(int) ) , |
190 | this, SLOT( skinsMenuActivated(int) ) ); | 195 | this, SLOT( skinsMenuActivated(int) ) ); |
191 | populateSkinsMenu(); | 196 | populateSkinsMenu(); |
192 | 197 | ||
193 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 198 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
194 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 199 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
@@ -992,25 +997,25 @@ void PlayListWidget::populateAudioView() { | |||
992 | } | 997 | } |
993 | 998 | ||
994 | QListViewItem * newItem; | 999 | QListViewItem * newItem; |
995 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { | 1000 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { |
996 | long size; | 1001 | long size; |
997 | if( dit.current()->file().left(4) == "http" ) | 1002 | if( dit.current()->file().left(4) == "http" ) |
998 | size=0; | 1003 | size=0; |
999 | else | 1004 | else |
1000 | size = QFile( dit.current()->file() ).size(); | 1005 | size = QFile( dit.current()->file() ).size(); |
1001 | // odebug << dit.current()->name() << oendl; | 1006 | // odebug << dit.current()->name() << oendl; |
1002 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 1007 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
1003 | QString::number(size ), storage, dit.current()->file()); | 1008 | QString::number(size ), storage, dit.current()->file()); |
1004 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); | 1009 | newItem->setPixmap(0, Opie::Core::OResource::loadPixmap( "opieplayer/musicfile", Opie::Core::OResource::SmallIcon )); |
1005 | } | 1010 | } |
1006 | } | 1011 | } |
1007 | 1012 | ||
1008 | } | 1013 | } |
1009 | 1014 | ||
1010 | void PlayListWidget::populateVideoView() { | 1015 | void PlayListWidget::populateVideoView() { |
1011 | videoView->clear(); | 1016 | videoView->clear(); |
1012 | StorageInfo storageInfo; | 1017 | StorageInfo storageInfo; |
1013 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 1018 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
1014 | 1019 | ||
1015 | if(!videoScan ) scanForVideo(); | 1020 | if(!videoScan ) scanForVideo(); |
1016 | 1021 | ||
@@ -1021,25 +1026,25 @@ void PlayListWidget::populateVideoView() { | |||
1021 | for ( ; Vdit.current(); ++Vdit ) { | 1026 | for ( ; Vdit.current(); ++Vdit ) { |
1022 | for( ; it.current(); ++it ){ | 1027 | for( ; it.current(); ++it ){ |
1023 | const QString name = (*it)->name(); | 1028 | const QString name = (*it)->name(); |
1024 | const QString path = (*it)->path(); | 1029 | const QString path = (*it)->path(); |
1025 | if( Vdit.current()->file().find(path) != -1 ) storage=name; | 1030 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
1026 | } | 1031 | } |
1027 | 1032 | ||
1028 | QListViewItem * newItem; | 1033 | QListViewItem * newItem; |
1029 | if ( QFile( Vdit.current()->file()).exists() ) { | 1034 | if ( QFile( Vdit.current()->file()).exists() ) { |
1030 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 1035 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
1031 | QString::number( QFile( Vdit.current()->file() ).size() ), | 1036 | QString::number( QFile( Vdit.current()->file() ).size() ), |
1032 | storage, Vdit.current()->file()); | 1037 | storage, Vdit.current()->file()); |
1033 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); | 1038 | newItem->setPixmap(0, Opie::Core::OResource::loadPixmap( "opieplayer/videofile", Opie::Core::OResource::SmallIcon )); |
1034 | } | 1039 | } |
1035 | } | 1040 | } |
1036 | } | 1041 | } |
1037 | 1042 | ||
1038 | void PlayListWidget::openFile() { | 1043 | void PlayListWidget::openFile() { |
1039 | QString filename, name; | 1044 | QString filename, name; |
1040 | InputDialog *fileDlg; | 1045 | InputDialog *fileDlg; |
1041 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1046 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1042 | fileDlg->exec(); | 1047 | fileDlg->exec(); |
1043 | if( fileDlg->result() == 1 ) { | 1048 | if( fileDlg->result() == 1 ) { |
1044 | filename = fileDlg->text(); | 1049 | filename = fileDlg->text(); |
1045 | // odebug << "Selected filename is " + filename << oendl; | 1050 | // odebug << "Selected filename is " + filename << oendl; |