summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-19 21:11:10 (UTC)
committer harlekin <harlekin>2002-08-19 21:11:10 (UTC)
commit0d336f310b310ba18af70185eed58be6e07c26d8 (patch) (side-by-side diff)
tree4084cce27741e5e3ae1bc309d539b7db2ecc8e99
parent7f1a7e9b3272f7848423583ea5fc04eb67d97f14 (diff)
downloadopie-0d336f310b310ba18af70185eed58be6e07c26d8.zip
opie-0d336f310b310ba18af70185eed58be6e07c26d8.tar.gz
opie-0d336f310b310ba18af70185eed58be6e07c26d8.tar.bz2
fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h5
-rw-r--r--noncore/multimedia/opieplayer2/inputDialog.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/inputDialog.h5
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/volumecontrol.cpp15
-rw-r--r--noncore/multimedia/opieplayer2/volumecontrol.h2
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h8
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp7
12 files changed, 44 insertions, 28 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 40e20e1..a718826 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -144,50 +144,50 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
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 < 10; i++ ) {
QString filename = QString( QPEApplication::qpeDir() + "/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 < 10; i++ ) {
- buttonPixUp[i] = NULL;
- buttonPixDown[i] = NULL;
+ buttonPixUp[i] = 0l;
+ buttonPixDown[i] = 0l;
}
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() ) );
connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
@@ -206,64 +206,66 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
// Intialise state
setLength( mediaPlayerState->length() );
setPosition( mediaPlayerState->position() );
setLooping( mediaPlayerState->fullscreen() );
// setPaused( mediaPlayerState->paused() );
setPlaying( mediaPlayerState->playing() );
}
AudioWidget::~AudioWidget() {
for ( int i = 0; i < 10; i++ ) {
delete buttonPixUp[i];
delete buttonPixDown[i];
}
delete pixBg;
delete imgUp;
delete imgDn;
delete imgButtonMask;
for ( int i = 0; i < 10; i++ ) {
delete masks[i];
}
}
+namespace {
+
QPixmap *combineImageWithBackground( 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 );
}
QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) {
QPixmap *pixmap = new QPixmap( pix );
pixmap->setMask( mask );
return pixmap;
}
-
+};
void AudioWidget::resizeEvent( QResizeEvent * ) {
int h = height();
int w = 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 = ( w - imgUp->width() ) / 2;
yoff = (( h - imgUp->height() ) / 2) - 10;
QPoint p( xoff, yoff );
QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p );
QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p );
for ( int i = 0; i < 10; i++ ) {
if ( !masks[i]->isNull() ) {
delete buttonPixUp[i];
delete buttonPixDown[i];
buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] );
buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] );
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 626004a..c544882 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -25,61 +25,63 @@
 -.   .:....=;==+<; 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 AUDIO_WIDGET_H
#define AUDIO_WIDGET_H
#include <qwidget.h>
#include <qpainter.h>
#include <qdrawutil.h>
#include <qpixmap.h>
#include <qstring.h>
#include <qslider.h>
#include <qframe.h>
#include <qlineedit.h>
class QPixmap;
+namespace {
+
enum AudioButtons {
AudioPlay=0,
AudioStop,
AudioNext,
AudioPrevious,
AudioVolumeUp,
AudioVolumeDown,
AudioLoop,
AudioPlayList,
AudioForward,
AudioBack
};
-
+};
class Ticker : public QFrame {
Q_OBJECT
public:
Ticker( QWidget* parent=0 );
~Ticker();
void setText( const QString& text ) ;
protected:
void timerEvent( QTimerEvent * );
void drawContents( QPainter *p );
private:
QString scrollText;
int pos, pixelLen;
};
class AudioWidget : public QWidget {
Q_OBJECT
public:
AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
~AudioWidget();
void setTickerText( const QString &text ) { songInfo.setText( text ); }
@@ -119,29 +121,30 @@ protected:
void keyReleaseEvent( QKeyEvent *e);
private slots:
void skipFor();
void skipBack();
void stopSkip();
private:
void toggleButton( int );
void setToggleButton( int, bool );
void paintButton( QPainter *p, int i );
int skipDirection;
QString skin;
QPixmap *pixBg;
QImage *imgUp;
QImage *imgDn;
QImage *imgButtonMask;
QBitmap *masks[10];
QPixmap *buttonPixUp[10];
QPixmap *buttonPixDown[10];
QPixmap *pixmaps[4];
Ticker songInfo;
QSlider slider;
QLineEdit time;
int xoff, yoff;
+ bool isStreaming : 1;
};
#endif // AUDIO_WIDGET_H
diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp
index c13ea63..9edb1d3 100644
--- a/noncore/multimedia/opieplayer2/inputDialog.cpp
+++ b/noncore/multimedia/opieplayer2/inputDialog.cpp
@@ -5,53 +5,57 @@
#include <opie/ofiledialog.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qpushbutton.h>
#include <qwhatsthis.h>
InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl ) {
if ( !name ) {
setName( "InputDialog" );
}
resize( 234, 115);
setMaximumSize( QSize( 240, 40));
setCaption( tr( name ) );
QPushButton *browserButton;
browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton");
browserButton->setGeometry( QRect( 205, 10, 22, 22));
connect( browserButton, SIGNAL(released()),this,SLOT(browse()));
LineEdit1 = new QLineEdit( this, "LineEdit1" );
LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) );
}
-
+/*
+ * return the current text(input)
+ */
+QString InputDialog::text() const {
+ return LineEdit1->text();
+}
/*
* Destroys the object and frees any allocated resources
*/
InputDialog::~InputDialog() {
- inputText= LineEdit1->text();
}
void InputDialog::browse() {
MimeTypes types;
QStringList audio, video, all;
audio << "audio/*";
audio << "playlist/plain";
audio << "audio/x-mpegurl";
video << "video/*";
video << "playlist/plain";
all += audio;
all += video;
types.insert("All Media Files", all );
types.insert("Audio", audio );
types.insert("Video", video );
QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 );
LineEdit1->setText(str);
}
diff --git a/noncore/multimedia/opieplayer2/inputDialog.h b/noncore/multimedia/opieplayer2/inputDialog.h
index d4f5e12..0f36ea4 100644
--- a/noncore/multimedia/opieplayer2/inputDialog.h
+++ b/noncore/multimedia/opieplayer2/inputDialog.h
@@ -1,22 +1,25 @@
#ifndef INPUTDIALOG_H
#define INPUTDIALOG_H
#include <qvariant.h>
#include <qdialog.h>
class QLineEdit;
class InputDialog : public QDialog {
Q_OBJECT
public:
InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~InputDialog();
- QString inputText;
+ QString text()const;
+
+private:
QLineEdit* LineEdit1;
+
protected slots:
void browse();
};
#endif // INPUTDIALOG_H
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 18caaad..0f8242b 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -159,50 +159,50 @@ void MediaPlayer::stopChangingVolume() {
onScreenDisplayVolume = 0;
int w=0;
int h=0;
if( !xineControl->hasVideo()) {
w = audioUI->width();
h = audioUI->height();
audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
} else {
w = videoUI->width();
h = videoUI->height();
videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
}
}
void MediaPlayer::timerEvent( QTimerEvent * ) {
if ( volumeDirection == +1 ) {
volControl->incVol(2);
} else if ( volumeDirection == -1 ) {
volControl->decVol(2);
}
// TODO FIXME
- unsigned int v;
- v = volControl->getVolume();
+ unsigned int v= 0;
+ v = volControl->volume();
v = v / 10;
if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
return;
}
int w=0; int h=0;
if( !xineControl->hasVideo()) {
w = audioUI->width();
h = audioUI->height();
if ( drawnOnScreenDisplay ) {
if ( onScreenDisplayVolume > v ) {
audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE );
}
}
drawnOnScreenDisplay = TRUE;
onScreenDisplayVolume = v;
QPainter p( audioUI );
p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
QFont f;
f.setPixelSize( 20 );
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 8366ab4..eaedaa5 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -1,43 +1,43 @@
#include <qpe/qpeapplication.h>
#include <qpe/qlibrary.h>
#include <qpe/config.h>
#include <qvaluelist.h>
#include <qobject.h>
#include <qdir.h>
#include "mediaplayerstate.h"
//#define MediaPlayerDebug(x) qDebug x
#define MediaPlayerDebug(x)
MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
: QObject( parent, name ) {
Config cfg( "OpiePlayer" );
readConfig( cfg );
-
+ isStreaming = false;
}
MediaPlayerState::~MediaPlayerState() {
Config cfg( "OpiePlayer" );
writeConfig( cfg );
}
void MediaPlayerState::readConfig( Config& cfg ) {
cfg.setGroup("Options");
isFullscreen = cfg.readBoolEntry( "FullScreen" );
isScaled = cfg.readBoolEntry( "Scaling" );
isLooping = cfg.readBoolEntry( "Looping" );
isShuffled = cfg.readBoolEntry( "Shuffle" );
usePlaylist = cfg.readBoolEntry( "UsePlayList" );
usePlaylist = TRUE;
isPlaying = FALSE;
isStreaming = FALSE;
isPaused = FALSE;
curPosition = 0;
curLength = 0;
curView = 'l';
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 10f1792..251c2e5 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -568,49 +568,49 @@ bool PlayListWidget::first() {
if ( mediaPlayerState->playlist() )
return d->selectedFiles->first();
else
return mediaPlayerState->looping();
}
bool PlayListWidget::last() {
if ( mediaPlayerState->playlist() )
return d->selectedFiles->last();
else
return mediaPlayerState->looping();
}
void PlayListWidget::saveList() {
QString filename;
InputDialog *fileDlg = 0l;
fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
if ( d->current )
delete d->current;
- filename = fileDlg->LineEdit1->text();//+".playlist";
+ filename = fileDlg->text();//+".playlist";
// qDebug("saving playlist "+filename+".playlist");
Config cfg( filename +".playlist");
writeConfig( cfg );
DocLnk lnk;
lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property
lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D
lnk.setIcon("opieplayer2/playlist2");
lnk.setName( filename); //sets file name
// qDebug(filename);
if(!lnk.writeLink()) {
qDebug("Writing doclink did not work");
}
}
Config config( "OpiePlayer" );
config.writeEntry("CurrentPlaylist",filename);
setCaption(tr("OpiePlayer: ")+filename);
d->selectedFiles->first();
if(fileDlg) {
delete fileDlg;
}
}
void PlayListWidget::loadList( const DocLnk & lnk) {
@@ -927,49 +927,49 @@ void PlayListWidget::populateVideoView() {
videoView->clear();
QString storage;
for ( ; Vdit.current(); ++Vdit ) {
for( ; it.current(); ++it ){
const QString name = (*it)->name();
const QString path = (*it)->path();
if( Vdit.current()->file().find(path) != -1 ) storage=name;
}
QListViewItem * newItem;
if ( QFile( Vdit.current()->file()).exists() ) {
newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
QString::number( QFile( Vdit.current()->file()).size() ), storage);
newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ));
}
}
}
void PlayListWidget::openFile() {
QString filename, name;
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
- filename = fileDlg->LineEdit1->text();
+ filename = fileDlg->text();
qDebug("Selected filename is "+filename);
if(filename.right(3) == "m3u") {
readm3u( filename );
} else if(filename.right(3) == "pls") {
readPls( filename );
} else {
DocLnk lnk;
lnk.setName(filename); //sets file name
lnk.setFile(filename); //sets File property
lnk.setType("audio/x-mpegurl");
lnk.setExec("opieplayer");
lnk.setIcon("opieplayer2/MPEGPlayer");
if(!lnk.writeLink()) {
qDebug("Writing doclink did not work");
}
d->selectedFiles->addToSelection( lnk);
}
}
if(fileDlg) {
delete fileDlg;
}
@@ -1102,49 +1102,49 @@ void PlayListWidget::readm3u(const QString &filename) {
if(s.at(s.length()-4) == '.') {
lnk.setFile( s);
} else {
lnk.setFile( s+"/");
}
lnk.setType("audio/x-mpegurl");
lnk.writeLink();
d->selectedFiles->addToSelection( lnk);
}
i++;
}
}
}
}
f.close();
}
void PlayListWidget::writem3u() {
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0);
fileDlg->exec();
QString filename,list;
if( fileDlg->result() == 1 ) {
- filename = fileDlg->LineEdit1->text();
+ filename = fileDlg->text();
qDebug(filename);
int noOfFiles = 0;
d->selectedFiles->first();
do {
// we dont check for existance because of url's
// qDebug(d->selectedFiles->current()->file());
list += d->selectedFiles->current()->file()+"\n";
noOfFiles++;
}
while ( d->selectedFiles->next() );
qDebug(list);
if(filename.left(1) != "/")
filename=QPEApplication::documentDir()+"/"+filename;
if(filename.right(3) != "m3u")
filename=filename+".m3u";
QFile f(filename);
f.open(IO_WriteOnly);
f.writeBlock(list, list.length());
f.close();
}
if(fileDlg) delete fileDlg;
}
diff --git a/noncore/multimedia/opieplayer2/volumecontrol.cpp b/noncore/multimedia/opieplayer2/volumecontrol.cpp
index a795f3b..271b84e 100644
--- a/noncore/multimedia/opieplayer2/volumecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/volumecontrol.cpp
@@ -1,62 +1,61 @@
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include "qpe/qcopenvelope_qws.h"
#include <qmessagebox.h>
#include "volumecontrol.h"
-int VolumeControl::getVolume() {
- int volumePerc;
+int VolumeControl::volume() {
Config cfg( "qpe" );
cfg. setGroup( "Volume" );
- volumePerc = cfg. readNumEntry( "VolumePercent", 50 );
- m_volumePerc = volumePerc;
- return volumePerc;
+ m_volumePerc = cfg. readNumEntry( "VolumePercent", 50 );
+
+ return m_volumePerc;
}
void VolumeControl::setVolume( int volumePerc ) {
Config cfg("qpe");
cfg.setGroup("Volume");
if ( volumePerc > 100 ) {
volumePerc = 100;
}
if ( volumePerc < 0 ) {
volumePerc = 0;
}
m_volumePerc = volumePerc;
cfg.writeEntry("VolumePercent", volumePerc );
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
// QCopEnvelope( "QPE/System", "setVolume(int,int)" ) << 0, volumePerc;
}
void VolumeControl::incVol( int ammount ) {
- int oldVol = getVolume();
+ int oldVol = volume();
setVolume( oldVol + ammount);
}
void VolumeControl::decVol( int ammount ) {
- int oldVol = getVolume();
+ int oldVol = volume();
setVolume( oldVol - ammount);
}
VolumeControl::VolumeControl( ) {
- getVolume();
+ volume();
}
VolumeControl::~VolumeControl() {
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
}
void VolumeControl::setMute(bool on) {
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << on;
}
diff --git a/noncore/multimedia/opieplayer2/volumecontrol.h b/noncore/multimedia/opieplayer2/volumecontrol.h
index d0d34a2..040f978 100644
--- a/noncore/multimedia/opieplayer2/volumecontrol.h
+++ b/noncore/multimedia/opieplayer2/volumecontrol.h
@@ -4,45 +4,45 @@
**********/
#ifndef VOLUMECONTROL_H
#define VOLUMECONTROL_H
#include <qobject.h>
class VolumeControl : public QObject {
Q_OBJECT
public:
VolumeControl();
~VolumeControl();
// increase by "ammount"
void incVol( int ammount );
void decVol( int ammount );
/**
* Get the volume in percent
* @return volume percentage
*/
- int getVolume();
+ int volume();
public slots:
/**
* Set the volume in percent
* @value volumePerc between 0 and 100
*/
void setVolume( int volumePerc );
void setMute(bool);
private:
int m_volumePerc;
};
#endif
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 766ece2..12d80ba 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -50,49 +50,51 @@ XineControl::XineControl( QObject *parent, const char *name )
connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) );
connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
disabledSuspendScreenSaver = FALSE;
}
XineControl::~XineControl() {
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = FALSE;
// Re-enable the suspend mode
QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
delete libXine;
}
void XineControl::play( const QString& fileName ) {
hasVideoChannel=FALSE;
hasAudioChannel=FALSE;
m_fileName = fileName;
+
qDebug("<<FILENAME: " + fileName + ">>>>");
+
libXine->play( fileName );
mediaPlayerState->setPlaying( true );
// default to audio view until we know how to handle video
// MediaDetect mdetect;
char whichGui = mdetect.videoOrAudio( fileName );
if (whichGui == 'f') {
qDebug("Nicht erkannter Dateityp");
return;
}
if (whichGui == 'a') {
libXine->setShowVideo( false );
hasAudioChannel=TRUE;
} else {
libXine->setShowVideo( true );
hasVideoChannel=TRUE;
}
// determine if slider is shown
mediaPlayerState->setIsStreaming( !libXine->isSeekable() );
// which gui (video / audio)
mediaPlayerState->setView( whichGui );
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 88458be..4263b36 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -22,58 +22,58 @@
..}^=.=       =       ; 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 XINECONTROL_H
#define XINECONTROL_H
#include "lib.h"
#include "mediadetect.h"
#include <qobject.h>
class XineControl : public QObject {
Q_OBJECT
public:
XineControl( QObject *parent = 0, const char *name =0 );
~XineControl();
- int m_length;
bool hasVideo() const { return hasVideoChannel; }
bool hasAudio() const { return hasAudioChannel; }
public slots:
void play( const QString& fileName );
void stop( bool );
void pause( bool );
void setFullscreen( bool );
long currentTime();
void seekTo( long );
// get length of media file and set it
void length();
long position();
void nextMedia();
void videoResized ( const QSize &s );
private:
XINE::Lib *libXine;
MediaDetect mdetect;
long m_currentTime;
long m_position;
+ int m_length;
QString m_fileName;
- bool disabledSuspendScreenSaver;
- bool hasVideoChannel;
- bool hasAudioChannel;
+ bool disabledSuspendScreenSaver : 1;
+ bool hasVideoChannel : 1;
+ bool hasAudioChannel : 1;
signals:
void positionChanged( long );
};
#endif
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
index 3e28e54..bc95d86 100644
--- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp
+++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
@@ -120,89 +120,92 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
QDirectPainter dp ( this );
int rot = dp. transformOrientation ( ) + m_rotation;
uchar *fb = dp. frameBuffer ( );
uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame;
QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
qt_bug_workaround_clip_rects. resize ( dp. numRects ( ));
for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) {
const QRect &clip = dp. rect ( i );
qt_bug_workaround_clip_rects [i] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb );
uchar *src = frame;
switch ( rot ) {
case 0: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) ); break;
case 1: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_pixel ) ); break;
case 2: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame ) ); break;
case 3: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) ); break;
+ default: break;
}
uint leftfill = 0;
uint framefill = 0;
uint rightfill = 0;
uint clipwidth = clip. width ( ) * m_bytes_per_pixel;
if ( clip. left ( ) < framerect. left ( ))
leftfill = (( framerect. left ( ) - clip. left ( )) * m_bytes_per_pixel ) <? clipwidth;
if ( clip. right ( ) > framerect. right ( ))
rightfill = (( clip. right ( ) - framerect. right ( )) * m_bytes_per_pixel ) <? clipwidth;
framefill = clipwidth - ( leftfill + rightfill );
for ( int y = clip. top ( ); y <= clip. bottom ( ); y++ ) {
if (( y < framerect. top ( )) || ( y > framerect. bottom ( ))) {
memset ( dst, 0, clipwidth );
}
else {
if ( leftfill )
memset ( dst, 0, leftfill );
if ( framefill ) {
switch ( rot ) {
case 0: memcpy ( dst + leftfill, src, framefill ); break;
case 1: memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
case 2: memcpy_rev ( dst + leftfill, src, framefill ); break;
case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
+ default: break;
}
}
if ( rightfill )
memset ( dst + leftfill + framefill, 0, rightfill );
}
dst += m_bytes_per_line_fb;
switch ( rot ) {
case 0: src += m_bytes_per_line_frame; break;
case 1: src -= m_bytes_per_pixel; break;
case 2: src -= m_bytes_per_line_frame; break;
case 3: src += m_bytes_per_pixel; break;
+ default: break;
}
}
}
}
//qWarning ( " ||| painting |||" );
{
// QVFB hack by MArtin Jones
QPainter p ( this );
for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) {
p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [i]. topLeft ( )), qt_bug_workaround_clip_rects [i]. size ( )), QBrush ( NoBrush ) );
}
}
}
//qWarning( "painting >>>" );
}
void XineVideoWidget::setImage ( QImage* image )
{
delete m_image;
m_image = image;
}
@@ -223,48 +226,48 @@ void XineVideoWidget::setImage ( uchar* img, int w, int h, int bpl )
m_buff = img;
m_bytes_per_line_frame = bpl;
repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false );
}
void XineVideoWidget::resizeEvent ( QResizeEvent * )
{
QSize s = size ( );
bool fs = ( s == qApp-> desktop ( )-> size ( ));
m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0;
if ( fs && qt_screen-> isTransformed ( )) {
s = qt_screen-> mapToDevice ( s );
}
// qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation );
emit videoResized ( s );
}
-void XineVideoWidget::mousePressEvent ( QMouseEvent *me )
+void XineVideoWidget::mousePressEvent ( QMouseEvent * /*me*/ )
{
QWidget *p = parentWidget ( );
if ( p ) {
// QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( ));
// QApplication::sendEvent ( p, &pme );
// emit clicked();
}
}
-void XineVideoWidget::mouseReleaseEvent ( QMouseEvent *me )
+void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ )
{
QWidget *p = parentWidget ( );
if ( p ) {
// QMouseEvent pme ( QEvent::MouseButtonRelease, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( ));
// QApplication::sendEvent ( p, &pme );
emit clicked();
}
}