summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-07-03 14:44:22 (UTC)
committer harlekin <harlekin>2002-07-03 14:44:22 (UTC)
commite1e4956ec7ffa9a07f98b03e831f0f9627556a6c (patch) (side-by-side diff)
treec0545c6a22732f05804bda7704227132f64b7239
parent61770de77f2abe8012d44cce49d04489e4187644 (diff)
downloadopie-e1e4956ec7ffa9a07f98b03e831f0f9627556a6c.zip
opie-e1e4956ec7ffa9a07f98b03e831f0f9627556a6c.tar.gz
opie-e1e4956ec7ffa9a07f98b03e831f0f9627556a6c.tar.bz2
much more code cleanup, make if look more like c++ code
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp43
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h44
-rw-r--r--noncore/multimedia/opieplayer2/inputDialog.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/inputDialog.h12
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp68
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h5
7 files changed, 65 insertions, 125 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 8d3963a..1b0de5d 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -17,3 +17,2 @@ extern MediaPlayerState *mediaPlayerState;
-
static const int xo = -2; // movable x offset
@@ -22,2 +21,40 @@ static const int yo = 22; // movable y offset
+Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) {
+ setFrameStyle( WinPanel | Sunken );
+ setText( "No Song" );
+}
+
+Ticker::~Ticker() {
+}
+
+void Ticker::setText( const QString& text ) {
+ pos = 0; // reset it everytime the text is changed
+ scrollText = text;
+ pixelLen = fontMetrics().width( scrollText );
+ killTimers();
+ if ( pixelLen > width() ) {
+ startTimer( 50 );
+ }
+ update();
+}
+
+
+void Ticker::timerEvent( QTimerEvent * ) {
+ pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1;
+ repaint( FALSE );
+}
+
+void Ticker::drawContents( QPainter *p ) {
+ QPixmap pm( width(), height() );
+ pm.fill( colorGroup().base() );
+ QPainter pmp( &pm );
+ for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) {
+ pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
+ }
+ p->drawPixmap( 0, 0, pm );
+}
+
+
+
+
struct MediaButton {
@@ -29,2 +66,4 @@ struct MediaButton {
+
+
// Layout information for the audioButtons (and if it is a toggle button or not)
@@ -42,3 +81,2 @@ MediaButton audioButtons[] = {
-
static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
@@ -147,3 +185,2 @@ void AudioWidget::setView( char view ) {
startTimer( 150 );
- // show();
showMaximized();
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index eab5df4..441eb6e 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -32,41 +32,11 @@ class Ticker : public QFrame {
Q_OBJECT
+
public:
- Ticker( QWidget* parent=0 ) : QFrame( parent ) {
- setFrameStyle( WinPanel | Sunken );
- setText( "No Song" );
- }
- ~Ticker() { }
- void setText( const QString& text ) {
- pos = 0; // reset it everytime the text is changed
- scrollText = text;
- pixelLen = fontMetrics().width( scrollText );
- killTimers();
- if ( pixelLen > width() )
- startTimer( 50 );
- update();
- }
+ Ticker( QWidget* parent=0 );
+ ~Ticker();
+ void setText( const QString& text ) ;
+
protected:
- void timerEvent( QTimerEvent * ) {
- pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1;
-#ifndef USE_DBLBUF
- scroll( -1, 0, contentsRect() );
-#else
- repaint( FALSE );
-#endif
- }
- void drawContents( QPainter *p ) {
-#ifndef USE_DBLBUF
- for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen )
- p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
-#else
- // Double buffering code.
- // Looks like qvfb makes it look like it flickers but I don't think it really is
- QPixmap pm( width(), height() );
- pm.fill( colorGroup().base() );
- QPainter pmp( &pm );
- for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen )
- pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
- p->drawPixmap( 0, 0, pm );
-#endif
- }
+ void timerEvent( QTimerEvent * );
+ void drawContents( QPainter *p );
private:
diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp
index da8e276..687aff6 100644
--- a/noncore/multimedia/opieplayer2/inputDialog.cpp
+++ b/noncore/multimedia/opieplayer2/inputDialog.cpp
@@ -1,9 +1 @@
-/****************************************************************************
-** Form implementation generated from reading ui file 'inputDialog.ui'
-**
-** Created: Sat Mar 2 07:55:03 2002
-** by: The User Interface Compiler (uic)
-**
-** WARNING! All changes made in this file will be lost!
-****************************************************************************/
#include "inputDialog.h"
diff --git a/noncore/multimedia/opieplayer2/inputDialog.h b/noncore/multimedia/opieplayer2/inputDialog.h
index 3e3e36f..d4f5e12 100644
--- a/noncore/multimedia/opieplayer2/inputDialog.h
+++ b/noncore/multimedia/opieplayer2/inputDialog.h
@@ -1,9 +1,2 @@
-/****************************************************************************
-** Form interface generated from reading ui file 'inputDialog.ui'
-**
-** Created: Sat Mar 2 07:54:46 2002
-** by: The User Interface Compiler (uic)
-**
-** WARNING! All changes made in this file will be lost!
-****************************************************************************/
+
#ifndef INPUTDIALOG_H
@@ -16,4 +9,3 @@ class QLineEdit;
-class InputDialog : public QDialog
-{
+class InputDialog : public QDialog {
Q_OBJECT
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index e6d0525..87184ba 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -56,5 +56,4 @@ void MediaPlayer::setPlaying( bool play ) {
if ( !play ) {
- mediaPlayerState->setPaused( FALSE );
-// loopControl->stop( FALSE );
- return;
+ mediaPlayerState->setPaused( FALSE );
+ return;
}
@@ -62,4 +61,4 @@ void MediaPlayer::setPlaying( bool play ) {
if ( mediaPlayerState->paused() ) {
- mediaPlayerState->setPaused( FALSE );
- return;
+ mediaPlayerState->setPaused( FALSE );
+ return;
}
@@ -68,53 +67,14 @@ void MediaPlayer::setPlaying( bool play ) {
if ( playListCurrent != NULL ) {
-// loopControl->stop( TRUE );
- currentFile = playListCurrent;
- }
-
- /*
-
- if ( currentFile == NULL ) {
- QMessageBox::critical( 0, tr( "No file"), tr( "Error: There is no file selected" ) );
- mediaPlayerState->setPlaying( FALSE );
- return;
- }
-
- if ( ((currentFile->file()).left(4) != "http") && !QFile::exists( currentFile->file() ) ) {
- QMessageBox::critical( 0, tr( "File not found"), tr( "The following file was not found: <i>" ) + currentFile->file() + "</i>" );
- mediaPlayerState->setPlaying( FALSE );
- return;
- }
-
- if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) {
- QMessageBox::critical( 0, tr( "No decoder found"), tr( "Sorry, no appropriate decoders found for this file: <i>" ) + currentFile->file() + "</i>" );
- mediaPlayerState->setPlaying( FALSE );
- return;
+ currentFile = playListCurrent;
}
-// if ( !loopControl->init( currentFile->file() ) ) {
-// QMessageBox::critical( 0, tr( "Error opening file"), tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" );
-// mediaPlayerState->setPlaying( FALSE );
-// return;
-// }
-// long seconds = loopControl->totalPlaytime();
- long seconds = 120;
- QString time;
- time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
- QString tickerText;
- if( currentFile->file().left(4) == "http" )
- tickerText= tr( " File: " ) + currentFile->name();
- else
- tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time;
+ audioUI->setTickerText( currentFile->file() );
- QString fileInfo = mediaPlayerState->curDecoder()->fileInfo();
- if ( !fileInfo.isEmpty() )
- tickerText += ", " + fileInfo;
- audioUI->setTickerText( tickerText + "." );
+ // alles nicht nötig, xine kümmert sich drum, man muss nur den return andio oder video gui geben
- */ // alles nicht nötig, xine kümmert sich drum, man muss nur den return andio oder video gui geben
+ // Ob auch video 'v' : 'a'
+ // mediaPlayerState->setView( 'v' );
-
- // loopControl->play();
-
- // mediaPlayerState->setView( loopControl->hasVideo() ? 'v' : 'a' );
+ // abspielen starten.
}
@@ -147,3 +107,3 @@ void MediaPlayer::startDecreasingVolume() {
startTimer( 100 );
- // sollte volumeapplet machen
+ // da kommt demnächst osound denk ich mal
// AudioDevice::decreaseVolume();
@@ -165,5 +125,5 @@ void MediaPlayer::stopChangingVolume() {
void MediaPlayer::timerEvent( QTimerEvent * ) {
-// if ( volumeDirection == +1 )
-// AudioDevice::increaseVolume();
-// else if ( volumeDirection == -1 )
+ // if ( volumeDirection == +1 )
+ // AudioDevice::increaseVolume();
+ // else if ( volumeDirection == -1 )
// AudioDevice::decreaseVolume();
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 9b5f70e..d1d30e4 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -14,10 +14,2 @@
-#ifdef QT_NO_COMPONENT
-// Plugins which are compiled in when no plugin architecture available
-#include "libmad/libmadpluginimpl.h"
-#include "libmpeg3/libmpeg3pluginimpl.h"
-#include "wavplugin/wavpluginimpl.h"
-#endif
-
-
//#define MediaPlayerDebug(x) qDebug x
@@ -27,3 +19,3 @@
MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
- : QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) {
+ : QObject( parent, name ), decoder( NULL ) {
Config cfg( "OpiePlayer" );
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index 374e780..8a64939 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -32,4 +32,3 @@ public:
MediaPlayerDecoder *curDecoder();
- MediaPlayerDecoder *libMpeg3Decoder(); // ### Yucky hack needed to use libmpeg3plugin to get the
- // number of audio samples if we are using the libmad plugin
+
public slots:
@@ -90,4 +89,2 @@ private:
MediaPlayerDecoder *decoder;
- MediaPlayerDecoder *libmpeg3decoder;
-// MediaPlayerDecoder *libwavdecoder;