5 files changed, 10 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index bf3590b..40e20e1 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -103,97 +103,97 @@ MediaButton audioButtons[] = { | |||
103 | { FALSE, FALSE, FALSE }, // stop | 103 | { FALSE, FALSE, FALSE }, // stop |
104 | { FALSE, FALSE, FALSE }, // next | 104 | { FALSE, FALSE, FALSE }, // next |
105 | { FALSE, FALSE, FALSE }, // previous | 105 | { FALSE, FALSE, FALSE }, // previous |
106 | { FALSE, FALSE, FALSE }, // volume up | 106 | { FALSE, FALSE, FALSE }, // volume up |
107 | { FALSE, FALSE, FALSE }, // volume down | 107 | { FALSE, FALSE, FALSE }, // volume down |
108 | { TRUE, FALSE, FALSE }, // repeat/loop | 108 | { TRUE, FALSE, FALSE }, // repeat/loop |
109 | { FALSE, FALSE, FALSE }, // playlist | 109 | { FALSE, FALSE, FALSE }, // playlist |
110 | { FALSE, FALSE, FALSE }, // forward | 110 | { FALSE, FALSE, FALSE }, // forward |
111 | { FALSE, FALSE, FALSE } // back | 111 | { FALSE, FALSE, FALSE } // back |
112 | }; | 112 | }; |
113 | 113 | ||
114 | const char *skin_mask_file_names[10] = { | 114 | const char *skin_mask_file_names[10] = { |
115 | "play", "stop", "next", "prev", "up", | 115 | "play", "stop", "next", "prev", "up", |
116 | "down", "loop", "playlist", "forward", "back" | 116 | "down", "loop", "playlist", "forward", "back" |
117 | }; | 117 | }; |
118 | 118 | ||
119 | 119 | ||
120 | static void changeTextColor( QWidget *w ) { | 120 | static void changeTextColor( QWidget *w ) { |
121 | QPalette p = w->palette(); | 121 | QPalette p = w->palette(); |
122 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 122 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
123 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 123 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
124 | w->setPalette( p ); | 124 | w->setPalette( p ); |
125 | } | 125 | } |
126 | 126 | ||
127 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 127 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
128 | 128 | ||
129 | 129 | ||
130 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 130 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
131 | 131 | ||
132 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { | 132 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { |
133 | 133 | ||
134 | setCaption( tr("OpiePlayer") ); | 134 | setCaption( tr("OpiePlayer") ); |
135 | 135 | ||
136 | Config cfg("OpiePlayer"); | 136 | Config cfg("OpiePlayer"); |
137 | cfg.setGroup("Options"); | 137 | cfg.setGroup("Options"); |
138 | skin = cfg.readEntry("Skin","default"); | 138 | skin = cfg.readEntry("Skin","default"); |
139 | //skin = "scaleTest"; | 139 | //skin = "scaleTest"; |
140 | // color of background, frame, degree of transparency | 140 | // color of background, frame, degree of transparency |
141 | 141 | ||
142 | QString skinPath = "opieplayer2/skins/" + skin; | 142 | QString skinPath = "opieplayer2/skins/" + skin; |
143 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 143 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
144 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 144 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
145 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 145 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
146 | 146 | ||
147 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 147 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
148 | imgButtonMask->fill( 0 ); | 148 | imgButtonMask->fill( 0 ); |
149 | 149 | ||
150 | for ( int i = 0; i < 10; i++ ) { | 150 | for ( int i = 0; i < 10; i++ ) { |
151 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; | 151 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); |
152 | masks[i] = new QBitmap( filename ); | 152 | masks[i] = new QBitmap( filename ); |
153 | 153 | ||
154 | if ( !masks[i]->isNull() ) { | 154 | if ( !masks[i]->isNull() ) { |
155 | QImage imgMask = masks[i]->convertToImage(); | 155 | QImage imgMask = masks[i]->convertToImage(); |
156 | uchar **dest = imgButtonMask->jumpTable(); | 156 | uchar **dest = imgButtonMask->jumpTable(); |
157 | for ( int y = 0; y < imgUp->height(); y++ ) { | 157 | for ( int y = 0; y < imgUp->height(); y++ ) { |
158 | uchar *line = dest[y]; | 158 | uchar *line = dest[y]; |
159 | for ( int x = 0; x < imgUp->width(); x++ ) | 159 | for ( int x = 0; x < imgUp->width(); x++ ) |
160 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 160 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
161 | line[x] = i + 1; | 161 | line[x] = i + 1; |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | } | 165 | } |
166 | 166 | ||
167 | for ( int i = 0; i < 10; i++ ) { | 167 | for ( int i = 0; i < 10; i++ ) { |
168 | buttonPixUp[i] = NULL; | 168 | buttonPixUp[i] = NULL; |
169 | buttonPixDown[i] = NULL; | 169 | buttonPixDown[i] = NULL; |
170 | } | 170 | } |
171 | 171 | ||
172 | setBackgroundPixmap( *pixBg ); | 172 | setBackgroundPixmap( *pixBg ); |
173 | 173 | ||
174 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 174 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
175 | changeTextColor( &songInfo ); | 175 | changeTextColor( &songInfo ); |
176 | 176 | ||
177 | slider.setFixedHeight( 20 ); | 177 | slider.setFixedHeight( 20 ); |
178 | slider.setMinValue( 0 ); | 178 | slider.setMinValue( 0 ); |
179 | slider.setMaxValue( 1 ); | 179 | slider.setMaxValue( 1 ); |
180 | slider.setFocusPolicy( QWidget::NoFocus ); | 180 | slider.setFocusPolicy( QWidget::NoFocus ); |
181 | slider.setBackgroundPixmap( *pixBg ); | 181 | slider.setBackgroundPixmap( *pixBg ); |
182 | 182 | ||
183 | time.setFocusPolicy( QWidget::NoFocus ); | 183 | time.setFocusPolicy( QWidget::NoFocus ); |
184 | time.setAlignment( Qt::AlignCenter ); | 184 | time.setAlignment( Qt::AlignCenter ); |
185 | time.setFrame(FALSE); | 185 | time.setFrame(FALSE); |
186 | changeTextColor( &time ); | 186 | changeTextColor( &time ); |
187 | 187 | ||
188 | resizeEvent( NULL ); | 188 | resizeEvent( NULL ); |
189 | 189 | ||
190 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 190 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
191 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 191 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
192 | 192 | ||
193 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 193 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
194 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 194 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
195 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 195 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
196 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 196 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
197 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 197 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
198 | 198 | ||
199 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 199 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro index 8cbac06..3a47c06 100644 --- a/noncore/multimedia/opieplayer2/opieplayer2.pro +++ b/noncore/multimedia/opieplayer2/opieplayer2.pro | |||
@@ -1,23 +1,23 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | #CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | CONFIG = qt warn_on debug | 3 | #CONFIG = qt warn_on debug |
4 | DESTDIR = $(OPIEDIR)/bin | 4 | DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ | 5 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ |
6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ | 6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ |
7 | frame.h lib.h xinevideowidget.h volumecontrol.h\ | 7 | frame.h lib.h xinevideowidget.h volumecontrol.h\ |
8 | alphablend.h yuv2rgb.h | 8 | alphablend.h yuv2rgb.h |
9 | SOURCES = main.cpp \ | 9 | SOURCES = main.cpp \ |
10 | playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ | 10 | playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ |
11 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ | 11 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ |
12 | frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp\ | 12 | frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp\ |
13 | alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S | 13 | alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S |
14 | TARGET = opieplayer2 | 14 | TARGET = opieplayer2 |
15 | INCLUDEPATH += $(OPIEDIR)/include | 15 | INCLUDEPATH += $(OPIEDIR)/include |
16 | DEPENDPATH += $(OPIEDIR)/include | 16 | DEPENDPATH += $(OPIEDIR)/include |
17 | LIBS += -lqpe -lpthread -lopie -lxine -lxineutils | 17 | LIBS += -lqpe -lpthread -lopie -lxine -lxineutils |
18 | MOC_DIR=qpeobj | 18 | MOC_DIR=qpeobj |
19 | OBJECTS_DIR=qpeobj | 19 | OBJECTS_DIR=qpeobj |
20 | 20 | ||
21 | INCLUDEPATH += $(OPIEDIR)/include | 21 | INCLUDEPATH += $(OPIEDIR)/include |
22 | DEPENDPATH += $(OPIEDIR)/include | 22 | DEPENDPATH += $(OPIEDIR)/include |
23 | 23 | ||
diff --git a/noncore/multimedia/opieplayer2/playlistselection.cpp b/noncore/multimedia/opieplayer2/playlistselection.cpp index 85228a9..975dec3 100644 --- a/noncore/multimedia/opieplayer2/playlistselection.cpp +++ b/noncore/multimedia/opieplayer2/playlistselection.cpp | |||
@@ -139,77 +139,77 @@ void PlayListSelection::moveSelectedDown() { | |||
139 | 139 | ||
140 | bool PlayListSelection::prev() { | 140 | bool PlayListSelection::prev() { |
141 | QListViewItem *item = selectedItem(); | 141 | QListViewItem *item = selectedItem(); |
142 | if ( item && item->itemAbove() ) | 142 | if ( item && item->itemAbove() ) |
143 | setSelected( item->itemAbove(), TRUE ); | 143 | setSelected( item->itemAbove(), TRUE ); |
144 | else | 144 | else |
145 | return FALSE; | 145 | return FALSE; |
146 | ensureItemVisible( selectedItem() ); | 146 | ensureItemVisible( selectedItem() ); |
147 | return TRUE; | 147 | return TRUE; |
148 | } | 148 | } |
149 | 149 | ||
150 | bool PlayListSelection::next() { | 150 | bool PlayListSelection::next() { |
151 | QListViewItem *item = selectedItem(); | 151 | QListViewItem *item = selectedItem(); |
152 | if ( item && item->itemBelow() ) | 152 | if ( item && item->itemBelow() ) |
153 | setSelected( item->itemBelow(), TRUE ); | 153 | setSelected( item->itemBelow(), TRUE ); |
154 | else | 154 | else |
155 | return FALSE; | 155 | return FALSE; |
156 | ensureItemVisible( selectedItem() ); | 156 | ensureItemVisible( selectedItem() ); |
157 | return TRUE; | 157 | return TRUE; |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | bool PlayListSelection::first() { | 161 | bool PlayListSelection::first() { |
162 | QListViewItem *item = firstChild(); | 162 | QListViewItem *item = firstChild(); |
163 | if ( item ) | 163 | if ( item ) |
164 | setSelected( item, TRUE ); | 164 | setSelected( item, TRUE ); |
165 | else | 165 | else |
166 | return FALSE; | 166 | return FALSE; |
167 | ensureItemVisible( selectedItem() ); | 167 | ensureItemVisible( selectedItem() ); |
168 | return TRUE; | 168 | return TRUE; |
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
172 | bool PlayListSelection::last() { | 172 | bool PlayListSelection::last() { |
173 | QListViewItem *prevItem = NULL; | 173 | QListViewItem *prevItem = NULL; |
174 | QListViewItem *item = firstChild(); | 174 | QListViewItem *item = firstChild(); |
175 | while ( ( item = item->nextSibling() ) ) | 175 | while ( ( item = item->nextSibling() ) ) |
176 | prevItem = item; | 176 | prevItem = item; |
177 | if ( prevItem ) | 177 | if ( prevItem ) |
178 | setSelected( prevItem, TRUE ); | 178 | setSelected( prevItem, TRUE ); |
179 | else | 179 | else |
180 | return FALSE; | 180 | return FALSE; |
181 | ensureItemVisible( selectedItem() ); | 181 | ensureItemVisible( selectedItem() ); |
182 | return TRUE; | 182 | return TRUE; |
183 | } | 183 | } |
184 | 184 | ||
185 | void PlayListSelection::unSelect() | 185 | void PlayListSelection::unSelect() |
186 | { | 186 | { |
187 | QListViewItem *item = selectedItem(); | 187 | //QListViewItem *item = selectedItem(); |
188 | setSelected( currentItem(), FALSE); | 188 | setSelected( currentItem(), FALSE); |
189 | } | 189 | } |
190 | 190 | ||
191 | void PlayListSelection::writeCurrent( Config& cfg ) { | 191 | void PlayListSelection::writeCurrent( Config& cfg ) { |
192 | cfg.setGroup("PlayList"); | 192 | cfg.setGroup("PlayList"); |
193 | QListViewItem *item = selectedItem(); | 193 | QListViewItem *item = selectedItem(); |
194 | if ( item ) | 194 | if ( item ) |
195 | cfg.writeEntry("current", item->text(0) ); | 195 | cfg.writeEntry("current", item->text(0) ); |
196 | qDebug(item->text(0)); | 196 | qDebug(item->text(0)); |
197 | 197 | ||
198 | } | 198 | } |
199 | 199 | ||
200 | void PlayListSelection::setSelectedItem(const QString &strk ) { | 200 | void PlayListSelection::setSelectedItem(const QString &strk ) { |
201 | 201 | ||
202 | unSelect(); | 202 | unSelect(); |
203 | QListViewItemIterator it( this ); | 203 | QListViewItemIterator it( this ); |
204 | for ( ; it.current(); ++it ) { | 204 | for ( ; it.current(); ++it ) { |
205 | // qDebug( it.current()->text(0)); | 205 | // qDebug( it.current()->text(0)); |
206 | if( strk == it.current()->text(0)) { | 206 | if( strk == it.current()->text(0)) { |
207 | // qDebug( "We have a match "+strk); | 207 | // qDebug( "We have a match "+strk); |
208 | setSelected( it.current(), TRUE); | 208 | setSelected( it.current(), TRUE); |
209 | ensureItemVisible( it.current() ); | 209 | ensureItemVisible( it.current() ); |
210 | return; | 210 | return; |
211 | } | 211 | } |
212 | } | 212 | } |
213 | // setSelected( item, TRUE ); | 213 | // setSelected( item, TRUE ); |
214 | // ensureItemVisible( selectedItem() ); | 214 | // ensureItemVisible( selectedItem() ); |
215 | } | 215 | } |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 262b685..6299328 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -101,97 +101,96 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
101 | 101 | ||
102 | setCaption( tr("OpiePlayer") ); | 102 | setCaption( tr("OpiePlayer") ); |
103 | setIcon( Resource::loadPixmap( "opieplayer2/MPEGPlayer" ) ); | 103 | setIcon( Resource::loadPixmap( "opieplayer2/MPEGPlayer" ) ); |
104 | 104 | ||
105 | setToolBarsMovable( FALSE ); | 105 | setToolBarsMovable( FALSE ); |
106 | 106 | ||
107 | // Create Toolbar | 107 | // Create Toolbar |
108 | QPEToolBar *toolbar = new QPEToolBar( this ); | 108 | QPEToolBar *toolbar = new QPEToolBar( this ); |
109 | toolbar->setHorizontalStretchable( TRUE ); | 109 | toolbar->setHorizontalStretchable( TRUE ); |
110 | 110 | ||
111 | // Create Menubar | 111 | // Create Menubar |
112 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 112 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
113 | menu->setMargin( 0 ); | 113 | menu->setMargin( 0 ); |
114 | 114 | ||
115 | QPEToolBar *bar = new QPEToolBar( this ); | 115 | QPEToolBar *bar = new QPEToolBar( this ); |
116 | bar->setLabel( tr( "Play Operations" ) ); | 116 | bar->setLabel( tr( "Play Operations" ) ); |
117 | 117 | ||
118 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 118 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
119 | tbDeletePlaylist->setFlat(TRUE); | 119 | tbDeletePlaylist->setFlat(TRUE); |
120 | tbDeletePlaylist->setFixedSize(20,20); | 120 | tbDeletePlaylist->setFixedSize(20,20); |
121 | 121 | ||
122 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", | 122 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", |
123 | this , SLOT(addSelected()) ); | 123 | this , SLOT(addSelected()) ); |
124 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", | 124 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", |
125 | this , SLOT(removeSelected()) ); | 125 | this , SLOT(removeSelected()) ); |
126 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", | 126 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", |
127 | this , SLOT( btnPlay(bool) ), TRUE ); | 127 | this , SLOT( btnPlay(bool) ), TRUE ); |
128 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", | 128 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", |
129 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 129 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
130 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer2/loop", | 130 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer2/loop", |
131 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 131 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
132 | tbDeletePlaylist->hide(); | 132 | tbDeletePlaylist->hide(); |
133 | 133 | ||
134 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 134 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
135 | menu->insertItem( tr( "File" ), pmPlayList ); | 135 | menu->insertItem( tr( "File" ), pmPlayList ); |
136 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 136 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
137 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 137 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
138 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 138 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
139 | (void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 139 | (void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
140 | pmPlayList->insertSeparator(-1); | 140 | pmPlayList->insertSeparator(-1); |
141 | (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 141 | (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
142 | (void)new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); | 142 | (void)new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); |
143 | pmPlayList->insertSeparator(-1); | 143 | pmPlayList->insertSeparator(-1); |
144 | (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 144 | (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
145 | pmPlayList->insertSeparator(-1); | 145 | pmPlayList->insertSeparator(-1); |
146 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 146 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
147 | (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 147 | (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
148 | 148 | ||
149 | |||
150 | pmView = new QPopupMenu( this ); | 149 | pmView = new QPopupMenu( this ); |
151 | menu->insertItem( tr( "View" ), pmView ); | 150 | menu->insertItem( tr( "View" ), pmView ); |
152 | pmView->isCheckable(); | 151 | pmView->isCheckable(); |
153 | 152 | ||
154 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) ); | 153 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) ); |
155 | 154 | ||
156 | Config cfg( "OpiePlayer" ); | 155 | Config cfg( "OpiePlayer" ); |
157 | bool b= cfg.readBoolEntry("FullScreen", 0); | 156 | bool b= cfg.readBoolEntry("FullScreen", 0); |
158 | mediaPlayerState->setFullscreen( b ); | 157 | mediaPlayerState->setFullscreen( b ); |
159 | pmView->setItemChecked( -16, b ); | 158 | pmView->setItemChecked( -16, b ); |
160 | 159 | ||
161 | // pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), mediaPlayerState, SLOT(toggleScaled() ) ); | 160 | // pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), mediaPlayerState, SLOT(toggleScaled() ) ); |
162 | 161 | ||
163 | pmView->insertSeparator(-1); | 162 | pmView->insertSeparator(-1); |
164 | 163 | ||
165 | skinsMenu = new QPopupMenu( this ); | 164 | skinsMenu = new QPopupMenu( this ); |
166 | pmView->insertItem( tr( "Skins" ), skinsMenu ); | 165 | pmView->insertItem( tr( "Skins" ), skinsMenu ); |
167 | skinsMenu->isCheckable(); | 166 | skinsMenu->isCheckable(); |
168 | populateSkinsMenu(); | 167 | populateSkinsMenu(); |
169 | 168 | ||
170 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 169 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
171 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 170 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
172 | 171 | ||
173 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 172 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
174 | 173 | ||
175 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 174 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
176 | // tabWidget->setTabShape(QTabWidget::Triangular); | 175 | // tabWidget->setTabShape(QTabWidget::Triangular); |
177 | 176 | ||
178 | QWidget *pTab; | 177 | QWidget *pTab; |
179 | pTab = new QWidget( tabWidget, "pTab" ); | 178 | pTab = new QWidget( tabWidget, "pTab" ); |
180 | tabWidget->insertTab( pTab,"Playlist"); | 179 | tabWidget->insertTab( pTab,"Playlist"); |
181 | 180 | ||
182 | 181 | ||
183 | QGridLayout *Playout = new QGridLayout( pTab ); | 182 | QGridLayout *Playout = new QGridLayout( pTab ); |
184 | Playout->setSpacing( 2); | 183 | Playout->setSpacing( 2); |
185 | Playout->setMargin( 2); | 184 | Playout->setMargin( 2); |
186 | 185 | ||
187 | // Add the playlist area | 186 | // Add the playlist area |
188 | 187 | ||
189 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 188 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
190 | d->playListFrame = vbox3; | 189 | d->playListFrame = vbox3; |
191 | 190 | ||
192 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 191 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
193 | 192 | ||
194 | d->selectedFiles = new PlayListSelection( hbox2); | 193 | d->selectedFiles = new PlayListSelection( hbox2); |
195 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 194 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
196 | 195 | ||
197 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 196 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
@@ -539,97 +538,97 @@ bool PlayListWidget::prev() { | |||
539 | } | 538 | } |
540 | return TRUE; | 539 | return TRUE; |
541 | } | 540 | } |
542 | } else { | 541 | } else { |
543 | return mediaPlayerState->looping(); | 542 | return mediaPlayerState->looping(); |
544 | } | 543 | } |
545 | } | 544 | } |
546 | 545 | ||
547 | 546 | ||
548 | bool PlayListWidget::next() { | 547 | bool PlayListWidget::next() { |
549 | if ( mediaPlayerState->playlist() ) { | 548 | if ( mediaPlayerState->playlist() ) { |
550 | if ( mediaPlayerState->shuffled() ) { | 549 | if ( mediaPlayerState->shuffled() ) { |
551 | return prev(); | 550 | return prev(); |
552 | } else { | 551 | } else { |
553 | if ( !d->selectedFiles->next() ) { | 552 | if ( !d->selectedFiles->next() ) { |
554 | if ( mediaPlayerState->looping() ) { | 553 | if ( mediaPlayerState->looping() ) { |
555 | return d->selectedFiles->first(); | 554 | return d->selectedFiles->first(); |
556 | } else { | 555 | } else { |
557 | return FALSE; | 556 | return FALSE; |
558 | } | 557 | } |
559 | } | 558 | } |
560 | return TRUE; | 559 | return TRUE; |
561 | } | 560 | } |
562 | } else { | 561 | } else { |
563 | return mediaPlayerState->looping(); | 562 | return mediaPlayerState->looping(); |
564 | } | 563 | } |
565 | } | 564 | } |
566 | 565 | ||
567 | 566 | ||
568 | bool PlayListWidget::first() { | 567 | bool PlayListWidget::first() { |
569 | if ( mediaPlayerState->playlist() ) | 568 | if ( mediaPlayerState->playlist() ) |
570 | return d->selectedFiles->first(); | 569 | return d->selectedFiles->first(); |
571 | else | 570 | else |
572 | return mediaPlayerState->looping(); | 571 | return mediaPlayerState->looping(); |
573 | } | 572 | } |
574 | 573 | ||
575 | 574 | ||
576 | bool PlayListWidget::last() { | 575 | bool PlayListWidget::last() { |
577 | if ( mediaPlayerState->playlist() ) | 576 | if ( mediaPlayerState->playlist() ) |
578 | return d->selectedFiles->last(); | 577 | return d->selectedFiles->last(); |
579 | else | 578 | else |
580 | return mediaPlayerState->looping(); | 579 | return mediaPlayerState->looping(); |
581 | } | 580 | } |
582 | 581 | ||
583 | 582 | ||
584 | void PlayListWidget::saveList() { | 583 | void PlayListWidget::saveList() { |
585 | 584 | ||
586 | QString filename; | 585 | QString filename; |
587 | InputDialog *fileDlg; | 586 | InputDialog *fileDlg = 0l; |
588 | fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); | 587 | fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); |
589 | fileDlg->exec(); | 588 | fileDlg->exec(); |
590 | if( fileDlg->result() == 1 ) { | 589 | if( fileDlg->result() == 1 ) { |
591 | if ( d->current ) | 590 | if ( d->current ) |
592 | delete d->current; | 591 | delete d->current; |
593 | filename = fileDlg->LineEdit1->text();//+".playlist"; | 592 | filename = fileDlg->LineEdit1->text();//+".playlist"; |
594 | // qDebug("saving playlist "+filename+".playlist"); | 593 | // qDebug("saving playlist "+filename+".playlist"); |
595 | Config cfg( filename +".playlist"); | 594 | Config cfg( filename +".playlist"); |
596 | writeConfig( cfg ); | 595 | writeConfig( cfg ); |
597 | 596 | ||
598 | DocLnk lnk; | 597 | DocLnk lnk; |
599 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property | 598 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property |
600 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D | 599 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D |
601 | lnk.setIcon("opieplayer2/playlist2"); | 600 | lnk.setIcon("opieplayer2/playlist2"); |
602 | lnk.setName( filename); //sets file name | 601 | lnk.setName( filename); //sets file name |
603 | // qDebug(filename); | 602 | // qDebug(filename); |
604 | if(!lnk.writeLink()) { | 603 | if(!lnk.writeLink()) { |
605 | qDebug("Writing doclink did not work"); | 604 | qDebug("Writing doclink did not work"); |
606 | } | 605 | } |
607 | } | 606 | } |
608 | Config config( "OpiePlayer" ); | 607 | Config config( "OpiePlayer" ); |
609 | config.writeEntry("CurrentPlaylist",filename); | 608 | config.writeEntry("CurrentPlaylist",filename); |
610 | setCaption(tr("OpiePlayer: ")+filename); | 609 | setCaption(tr("OpiePlayer: ")+filename); |
611 | d->selectedFiles->first(); | 610 | d->selectedFiles->first(); |
612 | if(fileDlg) { | 611 | if(fileDlg) { |
613 | delete fileDlg; | 612 | delete fileDlg; |
614 | } | 613 | } |
615 | } | 614 | } |
616 | 615 | ||
617 | void PlayListWidget::loadList( const DocLnk & lnk) { | 616 | void PlayListWidget::loadList( const DocLnk & lnk) { |
618 | QString name= lnk.name(); | 617 | QString name= lnk.name(); |
619 | // qDebug("currentList is "+name); | 618 | // qDebug("currentList is "+name); |
620 | if( name.length()>1) { | 619 | if( name.length()>1) { |
621 | setCaption("OpiePlayer: "+name); | 620 | setCaption("OpiePlayer: "+name); |
622 | // qDebug("load list "+ name+".playlist"); | 621 | // qDebug("load list "+ name+".playlist"); |
623 | clearList(); | 622 | clearList(); |
624 | Config cfg( name+".playlist"); | 623 | Config cfg( name+".playlist"); |
625 | readConfig(cfg); | 624 | readConfig(cfg); |
626 | 625 | ||
627 | tabWidget->setCurrentPage(0); | 626 | tabWidget->setCurrentPage(0); |
628 | 627 | ||
629 | Config config( "OpiePlayer" ); | 628 | Config config( "OpiePlayer" ); |
630 | config.writeEntry("CurrentPlaylist", name); | 629 | config.writeEntry("CurrentPlaylist", name); |
631 | // d->selectedFiles->first(); | 630 | // d->selectedFiles->first(); |
632 | } | 631 | } |
633 | 632 | ||
634 | } | 633 | } |
635 | 634 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 60a3563..5b53568 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -1,234 +1,235 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <qpe/qpeapplication.h> | ||
34 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
35 | #include <qpe/mediaplayerplugininterface.h> | 36 | #include <qpe/mediaplayerplugininterface.h> |
36 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
37 | 38 | ||
38 | 39 | ||
39 | #include <qwidget.h> | 40 | #include <qwidget.h> |
40 | #include <qpainter.h> | 41 | #include <qpainter.h> |
41 | #include <qpixmap.h> | 42 | #include <qpixmap.h> |
42 | #include <qslider.h> | 43 | #include <qslider.h> |
43 | #include <qdrawutil.h> | 44 | #include <qdrawutil.h> |
44 | #include "videowidget.h" | 45 | #include "videowidget.h" |
45 | #include "mediaplayerstate.h" | 46 | #include "mediaplayerstate.h" |
46 | 47 | ||
47 | 48 | ||
48 | #ifdef Q_WS_QWS | 49 | #ifdef Q_WS_QWS |
49 | # define USE_DIRECT_PAINTER | 50 | # define USE_DIRECT_PAINTER |
50 | # include <qdirectpainter_qws.h> | 51 | # include <qdirectpainter_qws.h> |
51 | # include <qgfxraster_qws.h> | 52 | # include <qgfxraster_qws.h> |
52 | #endif | 53 | #endif |
53 | 54 | ||
54 | 55 | ||
55 | extern MediaPlayerState *mediaPlayerState; | 56 | extern MediaPlayerState *mediaPlayerState; |
56 | 57 | ||
57 | 58 | ||
58 | static const int xo = 2; // movable x offset | 59 | static const int xo = 2; // movable x offset |
59 | static const int yo = 0; // movable y offset | 60 | static const int yo = 0; // movable y offset |
60 | 61 | ||
61 | 62 | ||
62 | struct MediaButton { | 63 | struct MediaButton { |
63 | bool isToggle, isHeld, isDown; | 64 | bool isToggle, isHeld, isDown; |
64 | }; | 65 | }; |
65 | 66 | ||
66 | MediaButton videoButtons[] = { | 67 | MediaButton videoButtons[] = { |
67 | { FALSE, FALSE, FALSE }, // stop | 68 | { FALSE, FALSE, FALSE }, // stop |
68 | { TRUE, FALSE, FALSE }, // play | 69 | { TRUE, FALSE, FALSE }, // play |
69 | { FALSE, FALSE, FALSE }, // previous | 70 | { FALSE, FALSE, FALSE }, // previous |
70 | { FALSE, FALSE, FALSE }, // next | 71 | { FALSE, FALSE, FALSE }, // next |
71 | { FALSE, FALSE, FALSE }, // volUp | 72 | { FALSE, FALSE, FALSE }, // volUp |
72 | { FALSE, FALSE, FALSE }, // volDown | 73 | { FALSE, FALSE, FALSE }, // volDown |
73 | { TRUE, FALSE, FALSE } // fullscreen | 74 | { TRUE, FALSE, FALSE } // fullscreen |
74 | }; | 75 | }; |
75 | 76 | ||
76 | const char *skinV_mask_file_names[7] = { | 77 | const char *skinV_mask_file_names[7] = { |
77 | "stop","play","back","fwd","up","down","full" | 78 | "stop","play","back","fwd","up","down","full" |
78 | }; | 79 | }; |
79 | 80 | ||
80 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 81 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
81 | 82 | ||
82 | 83 | ||
83 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 84 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
84 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 85 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { |
85 | 86 | ||
86 | 87 | ||
87 | setCaption( tr("OpiePlayer - Video") ); | 88 | setCaption( tr("OpiePlayer - Video") ); |
88 | 89 | ||
89 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 90 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
90 | 91 | ||
91 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 92 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
92 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 93 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
93 | 94 | ||
94 | Config cfg("OpiePlayer"); | 95 | Config cfg("OpiePlayer"); |
95 | cfg.setGroup("Options"); | 96 | cfg.setGroup("Options"); |
96 | skin = cfg.readEntry("Skin","default"); | 97 | skin = cfg.readEntry("Skin","default"); |
97 | 98 | ||
98 | QString skinPath = "opieplayer2/skins/" + skin; | 99 | QString skinPath = "opieplayer2/skins/" + skin; |
99 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 100 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
100 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 101 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
101 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 102 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
102 | 103 | ||
103 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 104 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
104 | imgButtonMask->fill( 0 ); | 105 | imgButtonMask->fill( 0 ); |
105 | 106 | ||
106 | for ( int i = 0; i < 7; i++ ) { | 107 | for ( int i = 0; i < 7; i++ ) { |
107 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png"; | 108 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
108 | masks[i] = new QBitmap( filename ); | 109 | masks[i] = new QBitmap( filename ); |
109 | 110 | ||
110 | if ( !masks[i]->isNull() ) { | 111 | if ( !masks[i]->isNull() ) { |
111 | QImage imgMask = masks[i]->convertToImage(); | 112 | QImage imgMask = masks[i]->convertToImage(); |
112 | uchar **dest = imgButtonMask->jumpTable(); | 113 | uchar **dest = imgButtonMask->jumpTable(); |
113 | for ( int y = 0; y < imgUp->height(); y++ ) { | 114 | for ( int y = 0; y < imgUp->height(); y++ ) { |
114 | uchar *line = dest[y]; | 115 | uchar *line = dest[y]; |
115 | for ( int x = 0; x < imgUp->width(); x++ ) { | 116 | for ( int x = 0; x < imgUp->width(); x++ ) { |
116 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 117 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
117 | line[x] = i + 1; | 118 | line[x] = i + 1; |
118 | } | 119 | } |
119 | } | 120 | } |
120 | } | 121 | } |
121 | } | 122 | } |
122 | 123 | ||
123 | for ( int i = 0; i < 7; i++ ) { | 124 | for ( int i = 0; i < 7; i++ ) { |
124 | buttonPixUp[i] = NULL; | 125 | buttonPixUp[i] = NULL; |
125 | buttonPixDown[i] = NULL; | 126 | buttonPixDown[i] = NULL; |
126 | } | 127 | } |
127 | 128 | ||
128 | setBackgroundPixmap( *pixBg ); | 129 | setBackgroundPixmap( *pixBg ); |
129 | 130 | ||
130 | slider = new QSlider( Qt::Horizontal, this ); | 131 | slider = new QSlider( Qt::Horizontal, this ); |
131 | slider->setMinValue( 0 ); | 132 | slider->setMinValue( 0 ); |
132 | slider->setMaxValue( 1 ); | 133 | slider->setMaxValue( 1 ); |
133 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 134 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
134 | slider->setFocusPolicy( QWidget::NoFocus ); | 135 | slider->setFocusPolicy( QWidget::NoFocus ); |
135 | 136 | ||
136 | resizeEvent( NULL ); | 137 | resizeEvent( NULL ); |
137 | 138 | ||
138 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 139 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
139 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 140 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
140 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 141 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
141 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 142 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
142 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 143 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
143 | 144 | ||
144 | setLength( mediaPlayerState->length() ); | 145 | setLength( mediaPlayerState->length() ); |
145 | setPosition( mediaPlayerState->position() ); | 146 | setPosition( mediaPlayerState->position() ); |
146 | setFullscreen( mediaPlayerState->fullscreen() ); | 147 | setFullscreen( mediaPlayerState->fullscreen() ); |
147 | setPlaying( mediaPlayerState->playing() ); | 148 | setPlaying( mediaPlayerState->playing() ); |
148 | } | 149 | } |
149 | 150 | ||
150 | 151 | ||
151 | VideoWidget::~VideoWidget() { | 152 | VideoWidget::~VideoWidget() { |
152 | 153 | ||
153 | for ( int i = 0; i < 7; i++ ) { | 154 | for ( int i = 0; i < 7; i++ ) { |
154 | delete buttonPixUp[i]; | 155 | delete buttonPixUp[i]; |
155 | delete buttonPixDown[i]; | 156 | delete buttonPixDown[i]; |
156 | } | 157 | } |
157 | 158 | ||
158 | delete pixBg; | 159 | delete pixBg; |
159 | delete imgUp; | 160 | delete imgUp; |
160 | delete imgDn; | 161 | delete imgDn; |
161 | delete imgButtonMask; | 162 | delete imgButtonMask; |
162 | for ( int i = 0; i < 7; i++ ) { | 163 | for ( int i = 0; i < 7; i++ ) { |
163 | delete masks[i]; | 164 | delete masks[i]; |
164 | } | 165 | } |
165 | 166 | ||
166 | } | 167 | } |
167 | 168 | ||
168 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 169 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
169 | QPixmap pix( img.width(), img.height() ); | 170 | QPixmap pix( img.width(), img.height() ); |
170 | QPainter p( &pix ); | 171 | QPainter p( &pix ); |
171 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 172 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
172 | p.drawImage( 0, 0, img ); | 173 | p.drawImage( 0, 0, img ); |
173 | return new QPixmap( pix ); | 174 | return new QPixmap( pix ); |
174 | } | 175 | } |
175 | 176 | ||
176 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { | 177 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { |
177 | QPixmap *pixmap = new QPixmap( pix ); | 178 | QPixmap *pixmap = new QPixmap( pix ); |
178 | pixmap->setMask( mask ); | 179 | pixmap->setMask( mask ); |
179 | return pixmap; | 180 | return pixmap; |
180 | } | 181 | } |
181 | 182 | ||
182 | void VideoWidget::resizeEvent( QResizeEvent * ) { | 183 | void VideoWidget::resizeEvent( QResizeEvent * ) { |
183 | int h = height(); | 184 | int h = height(); |
184 | int w = width(); | 185 | int w = width(); |
185 | int Vh = 160; | 186 | //int Vh = 160; |
186 | int Vw = 220; | 187 | //int Vw = 220; |
187 | 188 | ||
188 | slider->setFixedWidth( w - 20 ); | 189 | slider->setFixedWidth( w - 20 ); |
189 | slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); | 190 | slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); |
190 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 191 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
191 | slider->setFocusPolicy( QWidget::NoFocus ); | 192 | slider->setFocusPolicy( QWidget::NoFocus ); |
192 | slider->setBackgroundPixmap( *pixBg ); | 193 | slider->setBackgroundPixmap( *pixBg ); |
193 | 194 | ||
194 | xoff = 0;// ( imgUp->width() ) / 2; | 195 | xoff = 0;// ( imgUp->width() ) / 2; |
195 | yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; | 196 | yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; |
196 | QPoint p( xoff, yoff ); | 197 | QPoint p( xoff, yoff ); |
197 | 198 | ||
198 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); | 199 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); |
199 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); | 200 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); |
200 | 201 | ||
201 | for ( int i = 0; i < 7; i++ ) { | 202 | for ( int i = 0; i < 7; i++ ) { |
202 | if ( !masks[i]->isNull() ) { | 203 | if ( !masks[i]->isNull() ) { |
203 | delete buttonPixUp[i]; | 204 | delete buttonPixUp[i]; |
204 | delete buttonPixDown[i]; | 205 | delete buttonPixDown[i]; |
205 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); | 206 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); |
206 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); | 207 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); |
207 | } | 208 | } |
208 | } | 209 | } |
209 | 210 | ||
210 | delete pixUp; | 211 | delete pixUp; |
211 | delete pixDn; | 212 | delete pixDn; |
212 | } | 213 | } |
213 | 214 | ||
214 | static bool videoSliderBeingMoved = FALSE; | 215 | static bool videoSliderBeingMoved = FALSE; |
215 | 216 | ||
216 | void VideoWidget::sliderPressed() { | 217 | void VideoWidget::sliderPressed() { |
217 | videoSliderBeingMoved = TRUE; | 218 | videoSliderBeingMoved = TRUE; |
218 | } | 219 | } |
219 | 220 | ||
220 | void VideoWidget::sliderReleased() { | 221 | void VideoWidget::sliderReleased() { |
221 | videoSliderBeingMoved = FALSE; | 222 | videoSliderBeingMoved = FALSE; |
222 | if ( slider->width() == 0 ) { | 223 | if ( slider->width() == 0 ) { |
223 | return; | 224 | return; |
224 | } | 225 | } |
225 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); | 226 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); |
226 | mediaPlayerState->setPosition( val ); | 227 | mediaPlayerState->setPosition( val ); |
227 | } | 228 | } |
228 | 229 | ||
229 | void VideoWidget::setPosition( long i ) { | 230 | void VideoWidget::setPosition( long i ) { |
230 | updateSlider( i, mediaPlayerState->length() ); | 231 | updateSlider( i, mediaPlayerState->length() ); |
231 | } | 232 | } |
232 | 233 | ||
233 | 234 | ||
234 | void VideoWidget::setLength( long max ) { | 235 | void VideoWidget::setLength( long max ) { |