author | llornkcor <llornkcor> | 2002-08-10 17:41:15 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-10 17:41:15 (UTC) |
commit | b488752cf2149443dcebcc8f7ad21c1ba47070fa (patch) (side-by-side diff) | |
tree | 461adc8345f14d495466e5082f36651a844bde67 | |
parent | fb46a101bab9348ebfb68094b7c6cf54e56ea774 (diff) | |
download | opie-b488752cf2149443dcebcc8f7ad21c1ba47070fa.zip opie-b488752cf2149443dcebcc8f7ad21c1ba47070fa.tar.gz opie-b488752cf2149443dcebcc8f7ad21c1ba47070fa.tar.bz2 |
added skins to videowidget, fixed fullscreen menu. Still needs work on buttonmask.
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 41 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 226 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 15 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 1 |
7 files changed, 212 insertions, 82 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index dc90a62..2ee9383 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -92,97 +92,97 @@ void Ticker::drawContents( QPainter *p ) { p->drawPixmap( 0, 0, pm ); } struct MediaButton { bool isToggle, isHeld, isDown; }; //Layout information for the audioButtons (and if it is a toggle button or not) MediaButton audioButtons[] = { { TRUE, FALSE, FALSE }, // play { FALSE, FALSE, FALSE }, // stop { FALSE, FALSE, FALSE }, // pause { FALSE, FALSE, FALSE }, // next { FALSE, FALSE, FALSE }, // previous { FALSE, FALSE, FALSE }, // volume up { FALSE, FALSE, FALSE }, // volume down { TRUE, FALSE, FALSE }, // repeat/loop { FALSE, FALSE, FALSE }, // playlist { FALSE, FALSE, FALSE }, // forward { FALSE, FALSE, FALSE } // back }; const char *skin_mask_file_names[11] = { "play", "stop", "pause", "next", "prev", "up", "down", "loop", "playlist", "forward", "back" }; static void changeTextColor( QWidget *w ) { QPalette p = w->palette(); p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); w->setPalette( p ); } static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { setCaption( tr("OpiePlayer") ); Config cfg("OpiePlayer"); cfg.setGroup("AudioWidget"); skin = cfg.readEntry("Skin","default"); //skin = "scaleTest"; // color of background, frame, degree of transparency - QString skinPath = "opieplayer/skins/" + skin; + QString skinPath = "opieplayer2/skins/" + skin; pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); imgButtonMask->fill( 0 ); for ( int i = 0; i < 11; i++ ) { QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; masks[i] = new QBitmap( filename ); if ( !masks[i]->isNull() ) { QImage imgMask = masks[i]->convertToImage(); uchar **dest = imgButtonMask->jumpTable(); for ( int y = 0; y < imgUp->height(); y++ ) { uchar *line = dest[y]; for ( int x = 0; x < imgUp->width(); x++ ) if ( !qRed( imgMask.pixel( x, y ) ) ) line[x] = i + 1; } } } for ( int i = 0; i < 11; i++ ) { buttonPixUp[i] = NULL; buttonPixDown[i] = NULL; } setBackgroundPixmap( *pixBg ); songInfo.setFocusPolicy( QWidget::NoFocus ); changeTextColor( &songInfo ); slider.setFixedHeight( 20 ); slider.setMinValue( 0 ); slider.setMaxValue( 1 ); slider.setFocusPolicy( QWidget::NoFocus ); slider.setBackgroundPixmap( *pixBg ); time.setFocusPolicy( QWidget::NoFocus ); time.setAlignment( Qt::AlignCenter ); time.setFrame(FALSE); changeTextColor( &time ); resizeEvent( NULL ); connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 135c67c..57b1c81 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp @@ -114,96 +114,99 @@ void MediaPlayerState::setIsStreaming( bool b ) { return; } isStreaming = b; } void MediaPlayerState::setFullscreen( bool b ) { if ( isFullscreen == b ) { return; } isFullscreen = b; emit fullscreenToggled(b); } void MediaPlayerState::setScaled( bool b ) { if ( isScaled == b ) { return; } isScaled = b; emit scaledToggled(b); } void MediaPlayerState::setLooping( bool b ) { if ( isLooping == b ) { return; } isLooping = b; emit loopingToggled(b); } void MediaPlayerState::setShuffled( bool b ) { if ( isShuffled == b ) { return; } isShuffled = b; emit shuffledToggled(b); } void MediaPlayerState::setPlaylist( bool b ) { if ( usePlaylist == b ) { return; } usePlaylist = b; emit playlistToggled(b); } void MediaPlayerState::setPaused( bool b ) { +if(b) qDebug("setPaused true"); + else qDebug("setPaused false"); + if ( isPaused == b ) { return; } isPaused = b; emit pausedToggled(b); } void MediaPlayerState::setPlaying( bool b ) { if ( isPlaying == b ) { return; } isPlaying = b; isStoped = !b; emit playingToggled(b); } void MediaPlayerState::setStop( bool b ) { if ( isStoped == b ) { return; } isStoped = b; emit stopToggled(b); } void MediaPlayerState::setPosition( long p ) { if ( curPosition == p ) { return; } curPosition = p; emit positionChanged(p); } void MediaPlayerState::updatePosition( long p ){ if ( curPosition == p ) { return; } curPosition = p; emit positionUpdated(p); } void MediaPlayerState::setLength( long l ) { if ( curLength == l ) { return; } curLength = l; emit lengthChanged(l); } diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index b43d9f7..65458e7 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -1,60 +1,61 @@ #define QTOPIA_INTERNAL_FSLP #include <qpe/qcopenvelope_qws.h> #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/fileselector.h> #include <qpe/qpeapplication.h> #include <qpe/lnkproperties.h> #include <qpe/storage.h> #include <qpe/applnk.h> +#include <qpopupmenu.h> #include <qpe/config.h> #include <qpe/global.h> #include <qpe/resource.h> #include <qaction.h> #include <qcursor.h> #include <qimage.h> #include <qfile.h> #include <qdir.h> #include <qlayout.h> #include <qlabel.h> #include <qlist.h> #include <qlistbox.h> #include <qmainwindow.h> #include <qmessagebox.h> #include <qtoolbutton.h> #include <qtabwidget.h> #include <qlistview.h> #include <qpoint.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qregexp.h> #include <qtextstream.h> #include "playlistselection.h" #include "playlistwidget.h" #include "mediaplayerstate.h" #include "inputDialog.h" #include <stdlib.h> #include "audiowidget.h" #include "videowidget.h" #include <unistd.h> #include <sys/file.h> #include <sys/ioctl.h> #include <sys/soundcard.h> // for setBacklight() #include <linux/fb.h> #include <sys/types.h> #include <sys/stat.h> #include <stdlib.h> #define BUTTONS_ON_TOOLBAR #define SIDE_BUTTONS #define CAN_SAVE_LOAD_PLAYLISTS @@ -113,205 +114,213 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) setCaption( tr("OpiePlayer") ); setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); setToolBarsMovable( FALSE ); // Create Toolbar QPEToolBar *toolbar = new QPEToolBar( this ); toolbar->setHorizontalStretchable( TRUE ); // Create Menubar QPEMenuBar *menu = new QPEMenuBar( toolbar ); menu->setMargin( 0 ); QPEToolBar *bar = new QPEToolBar( this ); bar->setLabel( tr( "Play Operations" ) ); tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); tbDeletePlaylist->setFlat(TRUE); tbDeletePlaylist->setFixedSize(20,20); d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", this , SLOT(addSelected()) ); d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", this , SLOT(removeSelected()) ); d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", this , SLOT( btnPlay(bool) ), TRUE ); d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", mediaPlayerState, SLOT(setLooping(bool)), TRUE ); tbDeletePlaylist->hide(); QPopupMenu *pmPlayList = new QPopupMenu( this ); menu->insertItem( tr( "File" ), pmPlayList ); new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); pmPlayList->insertSeparator(-1); new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); pmPlayList->insertSeparator(-1); new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); pmPlayList->insertSeparator(-1); new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); - QPopupMenu *pmView = new QPopupMenu( this ); + + pmView = new QPopupMenu( this ); menu->insertItem( tr( "View" ), pmView ); + pmView->isCheckable(); + + pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), this, SLOT( toggleFull() ) ); + + Config cfg( "OpiePlayer" ); + bool b= cfg.readBoolEntry("FullScreen", 0); + mediaPlayerState->setFullscreen( b ); + pmView->setItemChecked( -16, b ); - fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); - fullScreenButton->addTo(pmView); - scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); - //scaleButton->addTo(pmView); + pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), this, SLOT(toggleScaled() ) ); QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); tabWidget = new QTabWidget( hbox6, "tabWidget" ); // tabWidget->setTabShape(QTabWidget::Triangular); QWidget *pTab; pTab = new QWidget( tabWidget, "pTab" ); tabWidget->insertTab( pTab,"Playlist"); // Add the playlist area QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); d->playListFrame = vbox3; d->playListFrame ->setMinimumSize(235,260); QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); d->selectedFiles = new PlayListSelection( hbox2); QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch QWidget *aTab; aTab = new QWidget( tabWidget, "aTab" ); audioView = new QListView( aTab, "Audioview" ); audioView->setMinimumSize(233,260); audioView->addColumn( tr("Title"),140); audioView->addColumn(tr("Size"), -1); audioView->addColumn(tr("Media"),-1); audioView->setColumnAlignment(1, Qt::AlignRight); audioView->setColumnAlignment(2, Qt::AlignRight); audioView->setAllColumnsShowFocus(TRUE); audioView->setMultiSelection( TRUE ); audioView->setSelectionMode( QListView::Extended); tabWidget->insertTab(aTab,tr("Audio")); QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); QWidget *vTab; vTab = new QWidget( tabWidget, "vTab" ); videoView = new QListView( vTab, "Videoview" ); videoView->setMinimumSize(233,260); videoView->addColumn(tr("Title"),140); videoView->addColumn(tr("Size"),-1); videoView->addColumn(tr("Media"),-1); videoView->setColumnAlignment(1, Qt::AlignRight); videoView->setColumnAlignment(2, Qt::AlignRight); videoView->setAllColumnsShowFocus(TRUE); videoView->setMultiSelection( TRUE ); videoView->setSelectionMode( QListView::Extended); QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); tabWidget->insertTab( vTab,tr("Video")); //playlists list QWidget *LTab; LTab = new QWidget( tabWidget, "LTab" ); playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy playLists->setMinimumSize(233,260); tabWidget->insertTab(LTab,tr("Lists")); connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); - connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); - connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); + +connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); + +// connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); + connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); connect( audioView, SIGNAL( returnPressed( QListViewItem *)), this,SLOT( playIt( QListViewItem *)) ); connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); connect( videoView, SIGNAL( returnPressed( QListViewItem *)), this,SLOT( playIt( QListViewItem *)) ); connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); setCentralWidget( vbox5 ); - Config cfg( "OpiePlayer" ); readConfig( cfg ); QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); loadList(DocLnk( currentPlaylist)); setCaption(tr("OpiePlayer: ")+ currentPlaylist ); initializeStates(); } PlayListWidget::~PlayListWidget() { Config cfg( "OpiePlayer" ); writeConfig( cfg ); if ( d->current ) { delete d->current; } delete d; } void PlayListWidget::initializeStates() { d->tbPlay->setOn( mediaPlayerState->playing() ); d->tbLoop->setOn( mediaPlayerState->looping() ); d->tbShuffle->setOn( mediaPlayerState->shuffled() ); setPlaylist( true); } void PlayListWidget::readConfig( Config& cfg ) { cfg.setGroup("PlayList"); QString currentString = cfg.readEntry("current", "" ); int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); for ( int i = 0; i < noOfFiles; i++ ) { QString entryName; entryName.sprintf( "File%i", i + 1 ); QString linkFile = cfg.readEntry( entryName ); DocLnk lnk( linkFile ); if ( lnk.isValid() ) { d->selectedFiles->addToSelection( lnk ); } } d->selectedFiles->setSelectedItem( currentString); } void PlayListWidget::writeConfig( Config& cfg ) const { @@ -1164,48 +1173,64 @@ void PlayListWidget::writem3u() { void PlayListWidget::readPls(const QString &filename) { qDebug("pls filename is "+filename); QFile f(filename); if(f.open(IO_ReadOnly)) { QTextStream t(&f); QString s;//, first, second; int i=0; while ( !t.atEnd()) { s=t.readLine(); if(s.left(4) == "File") { s=s.right(s.length() - 6); s.replace(QRegExp("%20")," "); qDebug("adding "+s+" to playlist"); // numberofentries=2 // File1=http // Title // Length // Version // File2=http s=s.replace( QRegExp("\\"),"/"); DocLnk lnk( s ); QFileInfo f(s); QString name = f.baseName(); if(name.left(4)=="http") name = s.right( s.length() - 7); else name=s; name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); lnk.setName( name); if(s.at(s.length()-4) == '.') // if this is probably a file lnk.setFile( s); else { //if its a url if( name.right(1).find('/') == -1) s+="/"; lnk.setFile( s); } lnk.setType("audio/x-mpegurl"); qDebug("DocLnk add "+name); d->selectedFiles->addToSelection( lnk); } } i++; } } +void PlayListWidget::pmViewActivated(int index) { +qDebug("%d", index); +switch(index) { + case -16: + { + + mediaPlayerState->toggleFullscreen(); + bool b=mediaPlayerState->fullscreen(); + pmView->setItemChecked( index,b); + Config cfg( "OpiePlayer" ); + cfg.writeEntry("FullScreen", b); + + } + break; +}; +} diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index e44096b..fdfa666 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -1,107 +1,111 @@ #ifndef PLAY_LIST_WIDGET_H #define PLAY_LIST_WIDGET_H #include <qmainwindow.h> #include <qpe/applnk.h> #include <qtabwidget.h> #include <qpe/fileselector.h> #include <qpushbutton.h> +#include <qpopupmenu.h> /* #include <qtimer.h> */ class PlayListWidgetPrivate; class Config; class QListViewItem; class QListView; class QPoint; class QAction; class QLabel; class PlayListWidget : public QMainWindow { Q_OBJECT public: PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); ~PlayListWidget(); QTabWidget * tabWidget; - QAction *fullScreenButton, *scaleButton; +// MenuItem *fullScreenButton, *scaleButton; +// QAction *fullScreenButton, *scaleButton; DocLnkSet files; DocLnkSet vFiles; QListView *audioView, *videoView, *playlistView; QLabel *libString; + QPopupMenu *pmView ; bool fromSetDocument; bool insanityBool; QString setDocFileRef; // retrieve the current playlist entry (media file link) const DocLnk *current(); void useSelectedDocument(); /* QTimer * menuTimer; */ FileSelector* playLists; QPushButton *tbDeletePlaylist; int fd, selected; public slots: bool first(); bool last(); bool next(); bool prev(); /* void setFullScreen(); */ /* void setScaled(); */ protected: /* void contentsMousePressEvent( QMouseEvent * e ); */ /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ void keyReleaseEvent( QKeyEvent *e); void keyPressEvent( QKeyEvent *e); private: bool audioScan, videoScan; void doBlank(); void doUnblank(); void readm3u(const QString &); void readPls(const QString &); void initializeStates(); void readConfig( Config& cfg ); void writeConfig( Config& cfg ) const; PlayListWidgetPrivate *d; // Private implementation data void populateAudioView(); void populateVideoView(); private slots: + void pmViewActivated(int); void writem3u(); void scanForAudio(); void scanForVideo(); void openFile(); void setDocument( const QString& fileref ); void addToSelection( const DocLnk& ); // Add a media file to the playlist void addToSelection( QListViewItem* ); // Add a media file to the playlist void setActiveWindow(); // need to handle this to show the right view void setPlaylist( bool ); // Show/Hide the playlist void setView( char ); void clearList(); void addAllToList(); void addAllMusicToList(); void addAllVideoToList(); void saveList(); // Save the playlist void loadList( const DocLnk &); // Load a playlist void playIt( QListViewItem *); void btnPlay(bool); void deletePlaylist(); void addSelected(); void removeSelected(); void tabChanged(QWidget*); void viewPressed( int, QListViewItem *, const QPoint&, int); void playlistViewPressed( int, QListViewItem *, const QPoint&, int); void playSelected(); void listDelete(); protected slots: /* void cancelMenuTimer(); */ /* void showFileMenu(); */ }; #endif // PLAY_LIST_WIDGET_H diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 188b18d..419c3ae 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -1,381 +1,463 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qpe/resource.h> +#include <qpe/mediaplayerplugininterface.h> #include <qpe/config.h> #include <qwidget.h> #include <qpainter.h> #include <qpixmap.h> #include <qslider.h> #include <qdrawutil.h> #include "videowidget.h" #include "mediaplayerstate.h" #ifdef Q_WS_QWS # define USE_DIRECT_PAINTER # include <qdirectpainter_qws.h> # include <qgfxraster_qws.h> #endif extern MediaPlayerState *mediaPlayerState; static const int xo = 2; // movable x offset static const int yo = 0; // movable y offset struct MediaButton { - int xPos, yPos; bool isToggle, isHeld, isDown; - int controlType; }; - -// Layout information for the videoButtons (and if it is a toggle button or not) MediaButton videoButtons[] = { - { 5+0*32+xo, 200+yo, FALSE, FALSE, FALSE, 4 }, // previous - { 5+1*32+xo, 200+yo, FALSE, FALSE, FALSE, 1 }, // stop - { 5+2*32+xo, 200+yo, TRUE, FALSE, FALSE, 0 }, // play - { 5+3*32+xo, 200+yo, TRUE, FALSE, FALSE, 2 }, // pause - { 5+4*32+xo, 200+yo, FALSE, FALSE, FALSE, 3 }, // next - { 5+5*32+xo, 200+yo, FALSE, FALSE, FALSE, 8 }, // playlist - { 5+6*32+xo, 200+yo, TRUE, FALSE, FALSE, 9 } // fullscreen + { FALSE, FALSE, FALSE }, // previous + { FALSE, FALSE, FALSE }, // stop + { TRUE, FALSE, FALSE }, // play + { TRUE, FALSE, FALSE }, // pause + { FALSE, FALSE, FALSE }, // next + { FALSE, FALSE, FALSE }, // playlist + { TRUE, FALSE, FALSE } // fullscreen }; +const char *skinV_mask_file_names[7] = { +"stop","play","back","fwd","up","down","full" +}; static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { setCaption( tr("OpiePlayer - Video") ); + + videoFrame = new XineVideoWidget ( this, "Video frame" ); + connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); + Config cfg("OpiePlayer"); cfg.setGroup("VideoWidget"); + skin = cfg.readEntry("Skin","default"); - QString Button0aPix, Button0bPix, controlsPix; - Button0aPix=cfg.readEntry( "Button0aPix", "opieplayer/mediaButton0a"); - Button0bPix=cfg.readEntry( "Button0bPix","opieplayer/mediaButton0b"); - controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls0" ); + QString skinPath = "opieplayer2/skins/" + skin; + pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); + imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); + imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); - cfg.setGroup("AudioWidget"); - QString skin = cfg.readEntry("Skin","default"); - QString skinPath = "opieplayer/skins/" + skin; - backgroundPix = QString("%1/background").arg(skinPath) ; + imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); + imgButtonMask->fill( 0 ); - setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); - pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) ); - pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) ); - pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) ); - currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); + for ( int i = 0; i < 7; i++ ) { + QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png"; + masks[i] = new QBitmap( filename ); + qDebug(filename); + if ( !masks[i]->isNull() ) { + QImage imgMask = masks[i]->convertToImage(); + uchar **dest = imgButtonMask->jumpTable(); + for ( int y = 0; y < imgUp->height(); y++ ) { + uchar *line = dest[y]; + for ( int x = 0; x < imgUp->width(); x++ ) { + if ( !qRed( imgMask.pixel( x, y ) ) ) + line[x] = i + 1; + } + } + } + + } + + for ( int i = 0; i < 7; i++ ) { + buttonPixUp[i] = NULL; + buttonPixDown[i] = NULL; + } + + setBackgroundPixmap( *pixBg ); slider = new QSlider( Qt::Horizontal, this ); slider->setMinValue( 0 ); slider->setMaxValue( 1 ); - - slider->setBackgroundPixmap( *this->backgroundPixmap () ); //Resource::loadPixmap( backgroundPix ) ); - slider->setBackgroundOrigin( QWidget::ParentOrigin); + slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); slider->setFocusPolicy( QWidget::NoFocus ); slider->setGeometry( QRect( 7, 250, 220, 20 ) ); - videoFrame = new XineVideoWidget ( this, "Video frame" ); - - connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); - connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); - // Intialise state setLength( mediaPlayerState->length() ); setPosition( mediaPlayerState->position() ); - setFullscreen( mediaPlayerState->fullscreen() ); + + ////////////////////////// FIXME +// setFullscreen( mediaPlayerState->fullscreen() ); setPaused( mediaPlayerState->paused() ); setPlaying( mediaPlayerState->playing() ); - + qDebug("finished videowidget"); } VideoWidget::~VideoWidget() { - for ( int i = 0; i < 3; i++ ) { - delete pixmaps[i]; + for ( int i = 0; i < 7; i++ ) { + delete buttonPixUp[i]; + delete buttonPixDown[i]; + } + + delete pixBg; + delete imgUp; + delete imgDn; + delete imgButtonMask; + for ( int i = 0; i < 7; i++ ) { + delete masks[i]; } - delete currentFrame; } +QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { + QPixmap pix( img.width(), img.height() ); + QPainter p( &pix ); + p.drawTiledPixmap( pix.rect(), bg, offset ); + p.drawImage( 0, 0, img ); + return new QPixmap( pix ); +} -static bool videoSliderBeingMoved = FALSE; +QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { + QPixmap *pixmap = new QPixmap( pix ); + pixmap->setMask( mask ); + return pixmap; +} + +void VideoWidget::resizeEvent( QResizeEvent * ) { + int h = height(); + int w = width(); + int Vh = 160; + //videoFrame->height(); + int Vw = 220; + //videoFrame->width(); +// songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); + + slider->setFixedWidth( w - 110 ); + slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); + slider->setBackgroundOrigin( QWidget::ParentOrigin ); +// time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); + xoff = 0;// ( imgUp->width() ) / 2; + yoff = 180;//(( Vh - imgUp->height() ) / 2) - 10; + QPoint p( xoff, yoff ); + + QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); + QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); + + for ( int i = 0; i < 7; i++ ) { + if ( !masks[i]->isNull() ) { + delete buttonPixUp[i]; + delete buttonPixDown[i]; + buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); + buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); + } + } + + delete pixUp; + delete pixDn; +} +static bool videoSliderBeingMoved = FALSE; void VideoWidget::sliderPressed() { videoSliderBeingMoved = TRUE; } - void VideoWidget::sliderReleased() { videoSliderBeingMoved = FALSE; if ( slider->width() == 0 ) { return; } long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); mediaPlayerState->setPosition( val ); } - void VideoWidget::setPosition( long i ) { updateSlider( i, mediaPlayerState->length() ); } void VideoWidget::setLength( long max ) { updateSlider( mediaPlayerState->position(), max ); } - void VideoWidget::setView( char view ) { if ( view == 'v' ) { makeVisible(); } else { // Effectively blank the view next time we show it so it looks nicer scaledWidth = 0; scaledHeight = 0; hide(); } } - void VideoWidget::updateSlider( long i, long max ) { // Will flicker too much if we don't do this if ( max == 0 ) { return; } int width = slider->width(); int val = int((double)i * width / max); if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { if ( slider->value() != val ) { slider->setValue( val ); } if ( slider->maxValue() != width ) { slider->setMaxValue( width ); } } } - void VideoWidget::setToggleButton( int i, bool down ) { if ( down != videoButtons[i].isDown ) { toggleButton( i ); } } - void VideoWidget::toggleButton( int i ) { videoButtons[i].isDown = !videoButtons[i].isDown; QPainter p(this); paintButton ( &p, i ); } - void VideoWidget::paintButton( QPainter *p, int i ) { - int x = videoButtons[i].xPos; - int y = videoButtons[i].yPos; - int offset = 10 + videoButtons[i].isDown; - p->drawPixmap( x, y, *pixmaps[videoButtons[i].isDown] ); - p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 ); -} + if ( videoButtons[i].isDown ) + p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); + else + p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); +} void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { for ( int i = 0; i < numButtons; i++ ) { - int x = videoButtons[i].xPos; - int y = videoButtons[i].yPos; if ( event->state() == QMouseEvent::LeftButton ) { - // The test to see if the mouse click is inside the circular button or not - // (compared with the radius squared to avoid a square-root of our distance) - int radius = 16; - QPoint center = QPoint( x + radius, y + radius ); - QPoint dXY = center - event->pos(); - int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); - bool isOnButton = dist <= (radius * radius); + // The test to see if the mouse click is inside the button or not + int x = event->pos().x() - xoff; + int y = event->pos().y() - yoff; + + bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() + && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); if ( isOnButton != videoButtons[i].isHeld ) { videoButtons[i].isHeld = isOnButton; toggleButton(i); } } else { if ( videoButtons[i].isHeld ) { videoButtons[i].isHeld = FALSE; if ( !videoButtons[i].isToggle ) setToggleButton( i, FALSE ); - qDebug("button toggled3 %d",i); } - } switch (i) { case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; case VideoStop: mediaPlayerState->setPlaying(FALSE); return; case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; case VideoNext: mediaPlayerState->setNext(); return; case VideoPrevious: mediaPlayerState->setPrev(); return; case VideoPlayList: mediaPlayerState->setList(); return; case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; } } } - void VideoWidget::mousePressEvent( QMouseEvent *event ) { mouseMoveEvent( event ); } - void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { if ( mediaPlayerState->fullscreen() ) { mediaPlayerState->setFullscreen( FALSE ); makeVisible(); mouseMoveEvent( event ); } } void VideoWidget::makeVisible() { if ( mediaPlayerState->fullscreen() ) { setBackgroundMode( QWidget::NoBackground ); showFullScreen(); resize( qApp->desktop()->size() ); slider->hide(); videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); } else { setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); showNormal(); showMaximized(); slider->show(); videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); } } -void VideoWidget::paintEvent( QPaintEvent * ) { +void VideoWidget::paintEvent( QPaintEvent * pe) { QPainter p( this ); if ( mediaPlayerState->fullscreen() ) { // Clear the background p.setBrush( QBrush( Qt::black ) ); // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); } else { // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); // draw the buttons - for ( int i = 0; i < numButtons; i++ ) { + if ( !pe->erased() ) { + // Combine with background and double buffer + QPixmap pix( pe->rect().size() ); + QPainter p( &pix ); + p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); + p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); + for ( int i = 0; i < numButtons; i++ ) + paintButton( &p, i ); + QPainter p2( this ); + p2.drawPixmap( pe->rect().topLeft(), pix ); + } else { + QPainter p( this ); + for ( int i = 0; i < numButtons; i++ ) paintButton( &p, i ); } - // draw the slider - slider->repaint( TRUE ); +// for ( int i = 0; i < numButtons; i++ ) { +// paintButton( &p, i ); +// } +// // draw the slider +// slider->repaint( TRUE ); } } void VideoWidget::closeEvent( QCloseEvent* ) { mediaPlayerState->setList(); } +bool VideoWidget::playVideo() { + bool result = FALSE; + + int stream = 0; + + int sw = 240; + int sh = 320; + int dd = QPixmap::defaultDepth(); + int w = height(); + int h = width(); -void VideoWidget::keyReleaseEvent( QKeyEvent *e) -{ + return true; +} + +void VideoWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity break; case Key_F10: //contacts // hide(); break; case Key_F11: //menu break; case Key_F12: //home break; case Key_F13: //mail break; case Key_Space: { if(mediaPlayerState->playing()) { mediaPlayerState->setPlaying(FALSE); } else { mediaPlayerState->setPlaying(TRUE); } } break; case Key_Down: // toggleButton(6); // emit lessClicked(); // emit lessReleased(); // toggleButton(6); break; case Key_Up: // toggleButton(5); // emit moreClicked(); // emit moreReleased(); // toggleButton(5); break; case Key_Right: mediaPlayerState->setNext(); break; case Key_Left: mediaPlayerState->setPrev(); break; case Key_Escape: break; }; } + XineVideoWidget* VideoWidget::vidWidget() { return videoFrame; } -void VideoWidget::setFullscreen ( bool b ) -{ +void VideoWidget::setFullscreen ( bool b ) { setToggleButton( VideoFullscreen, b ); } diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 04e810e..830696e 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h @@ -11,91 +11,106 @@ .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef VIDEO_WIDGET_H #define VIDEO_WIDGET_H #include <qwidget.h> #include "xinevideowidget.h" class QPixmap; class QSlider; enum VideoButtons { VideoPrevious, VideoStop, VideoPlay, VideoPause, VideoNext, VideoPlayList, VideoFullscreen }; class VideoWidget : public QWidget { Q_OBJECT public: VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); ~VideoWidget(); + bool playVideo(); XineVideoWidget* vidWidget(); public slots: void updateSlider( long, long ); void sliderPressed( ); void sliderReleased( ); void setPaused( bool b) { setToggleButton( VideoPause, b ); } void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } void setFullscreen( bool b ); void makeVisible(); void setPosition( long ); void setLength( long ); void setView( char ); signals: void sliderMoved( long ); void videoResized ( const QSize &s ); protected: + QString skin; + void resizeEvent( QResizeEvent * ); void paintEvent( QPaintEvent *pe ); void mouseMoveEvent( QMouseEvent *event ); void mousePressEvent( QMouseEvent *event ); void mouseReleaseEvent( QMouseEvent *event ); void closeEvent( QCloseEvent *event ); void keyReleaseEvent( QKeyEvent *e); private: +// Ticker songInfo; + QPixmap *pixBg; + QImage *imgUp; + QImage *imgDn; + QImage *imgButtonMask; + QBitmap *masks[7]; + QPixmap *buttonPixUp[7]; + QPixmap *buttonPixDown[7]; +// QPixmap *pixmaps[4]; + int xoff, yoff; + + void paintButton( QPainter *p, int i ); void toggleButton( int ); void setToggleButton( int, bool ); QString backgroundPix; QSlider *slider; QPixmap *pixmaps[3]; QImage *currentFrame; int scaledWidth; int scaledHeight; XineVideoWidget* videoFrame; }; #endif // VIDEO_WIDGET_H diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index 98446a0..d65006b 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp @@ -1,89 +1,90 @@ /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 LJP <> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qimage.h> #include <qpainter.h> #include <qgfx_qws.h> #include <qdirectpainter_qws.h> #include <qgfx_qws.h> #include <qsize.h> #include <qapplication.h> +#include <qpainter.h> #include <qpe/resource.h> #include "xinevideowidget.h" static inline void memcpy_rev ( void *dst, void *src, size_t len ) { ((char *) src ) += len; len >>= 1; while ( len-- ) *((short int *) dst )++ = *--((short int *) src ); } static inline void memcpy_step ( void *dst, void *src, size_t len, size_t step ) { len >>= 1; while ( len-- ) { *((short int *) dst )++ = *((short int *) src ); ((char *) src ) += step; } } static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t step ) { len >>= 1; ((char *) src ) += ( len * step ); while ( len-- ) { ((char *) src ) -= step; *((short int *) dst )++ = *((short int *) src ); } } XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name ) : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase ) { setBackgroundMode ( NoBackground ); m_image = 0; m_buff = 0; m_bytes_per_line_fb = qt_screen-> linestep ( ); m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; m_rotation = 0; } |