summaryrefslogtreecommitdiff
authorchicken <chicken>2003-11-17 19:28:21 (UTC)
committer chicken <chicken>2003-11-17 19:28:21 (UTC)
commit56f2b27abab0cbae7548b43be4509965b37e3a92 (patch) (side-by-side diff)
tree210dc84c5dbb1a93aaa5ae358a38a3de3510f493
parent8515000ba00ec666ee5e68fdd3c2786186093b93 (diff)
downloadopie-56f2b27abab0cbae7548b43be4509965b37e3a92.zip
opie-56f2b27abab0cbae7548b43be4509965b37e3a92.tar.gz
opie-56f2b27abab0cbae7548b43be4509965b37e3a92.tar.bz2
merge branch with head
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/config.in4
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/main.cpp9
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/opie-mediaplayer2.control4
-rw-r--r--noncore/multimedia/opieplayer2/opieplayer2.pro9
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp69
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h7
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.h4
11 files changed, 65 insertions, 56 deletions
diff --git a/noncore/multimedia/opieplayer2/config.in b/noncore/multimedia/opieplayer2/config.in
index 27142a8..2272a9b 100644
--- a/noncore/multimedia/opieplayer2/config.in
+++ b/noncore/multimedia/opieplayer2/config.in
@@ -1,6 +1,4 @@
config OPIEPLAYER2
- boolean "opie-mediaplayer2 (streaming capable media player for mp3, mpeg, wav, ogg, quicktime, divx and more)"
+ boolean "opieplayer2"
default "n"
depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
- comment "opie-mediaplayer2-skin-default-landscape automatically selected"
- depends OPIEPLAYER2
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 11ad745..00cfa33 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -74,33 +74,33 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
m_duringInitialization = false;
m_video = false;
m_wid = widget;
printf("Lib");
QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
// get the configuration
// not really OO, should be an extra class, later
if ( !QFile::exists(configPath) ) {
QFile f(configPath);
f.open(IO_WriteOnly);
QTextStream ts( &f );
ts << "misc.memcpy_method:glibc\n";
ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n";
ts << "codec.ffmpeg_pp_quality:3\n";
ts << "audio.num_buffers:50\n";
- ts << "audio.size_buffers:4160\n";
+ ts << "audio.size_buffers:4096\n";
ts << "video.num_buffers:20\n";
ts << "video.size_buffers:4096\n";
ts << "audio.out_num_audio_buf:16\n";
ts << "audio.out_size_audio_buf:8096\n";
ts << "audio.out_size_zero_buf:1024\n";
ts << "audio.passthrough_offset:0\n";
f.close();
}
if ( initMode == InitializeImmediately ) {
initialize();
m_initialized = true;
}
else
start();
}
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp
index f87cee8..b0a22b2 100644
--- a/noncore/multimedia/opieplayer2/main.cpp
+++ b/noncore/multimedia/opieplayer2/main.cpp
@@ -1,22 +1,29 @@
#include <qpe/qpeapplication.h>
#include "mediaplayerstate.h"
#include "playlistwidget.h"
#include "mediaplayer.h"
+
+
+#include <opie/oapplicationfactory.h>
+
+OPIE_EXPORT_APP( OApplicationFactory<PlayListWidget> )
+
+#if 0
int main(int argc, char **argv) {
QPEApplication a(argc,argv);
MediaPlayerState st( 0, "mediaPlayerState" );
PlayListWidget pl( st, 0, "playList" );
pl.showMaximized();
MediaPlayer mp( pl, st, 0, "mediaPlayer" );
QObject::connect( &pl, SIGNAL( skinSelected() ),
&mp, SLOT( reloadSkins() ) );
a.showMainDocumentWidget(&pl);
return a.exec();
}
-
+#endif
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 4c9afca..9f51006 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -270,33 +270,32 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
f.setBold( TRUE );
p.setFont( f );
p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) );
for ( unsigned int i = 0; i < 10; i++ ) {
if ( v > i ) {
p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
} else {
p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
}
}
}
}
void MediaPlayer::blank( bool b ) {
-// ### FIXME use ODevice::inst()->setDisplayStatus( b );
fd=open("/dev/fb0",O_RDWR);
#ifdef QT_QWS_SL5XXX
fl= open( "/dev/fl", O_RDWR );
#endif
if (fd != -1) {
if ( b ) {
qDebug("do blanking");
#ifdef QT_QWS_SL5XXX
ioctl( fd, FBIOBLANK, 1 );
if(fl !=-1) {
ioctl( fl, 2 );
::close(fl);
}
#else
ioctl( fd, FBIOBLANK, 3 );
#endif
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index b1f88c9..f193001 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -13,34 +13,32 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <assert.h>
#include "mediawidget.h"
#include "playlistwidget.h"
#include "skin.h"
-#include <assert.h>
-
MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
: QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
{
connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
this, SLOT( setLength( long ) ) );
connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
this, SLOT( setPlaying( bool ) ) );
setBackgroundMode( NoBackground );
}
MediaWidget::~MediaWidget()
{
}
diff --git a/noncore/multimedia/opieplayer2/opie-mediaplayer2.control b/noncore/multimedia/opieplayer2/opie-mediaplayer2.control
index 8e68c57..3e3e856 100644
--- a/noncore/multimedia/opieplayer2/opie-mediaplayer2.control
+++ b/noncore/multimedia/opieplayer2/opie-mediaplayer2.control
@@ -1,11 +1,11 @@
Package: opie-mediaplayer2
Files: plugins/application/libopieplayer2.so* bin/opieplayer2 apps/Applications/mediaplayer.desktop pics/opieplayer2/add_to_playlist.png pics/opieplayer2/cut.png pics/opieplayer2/delete.png pics/opieplayer2/down.png pics/opieplayer2/loop.png pics/opieplayer2/MPEGPlayer.png pics/opieplayer2/musicfile.png pics/opieplayer2/playlist2.png pics/opieplayer2/play.png pics/opieplayer2/remove_from_playlist.png pics/opieplayer2/shuffle.png pics/opieplayer2/up.png pics/opieplayer2/videofile.png
Priority: optional
Section: opie/applications
Maintainer: L.J.Potter <ljp@llornkcor.com>, Maximilian Reiss <harlekin@handhelds.org>
Architecture: arm
-Depends: task-opie-minimal, libopie1, zlib1g, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs
-Description: The Opie media player II
+Depends: task-opie-minimal, libopie1, zlib1g, libstdc++2.10-glibc2.2, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs
+Description: The Opie media player
The mediaplayer for Opie. It plays mp3, mpeg, wav, ogg, quicktime, divx and
more. Also it is streaming capable.
Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro
index 5dabbab..46e14a0 100644
--- a/noncore/multimedia/opieplayer2/opieplayer2.pro
+++ b/noncore/multimedia/opieplayer2/opieplayer2.pro
@@ -1,44 +1,37 @@
-TEMPLATE = app
-CONFIG = qt warn_on release
-DESTDIR = $(OPIEDIR)/bin
+CONFIG = qt warn_on release quick-app
HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h \
videowidget.h audiowidget.h playlistwidget.h om3u.h mediaplayer.h inputDialog.h \
frame.h lib.h xinevideowidget.h volumecontrol.h playlistwidgetgui.h\
alphablend.h yuv2rgb.h threadutil.h mediawidget.h playlistview.h playlistfileview.h \
skin.h
SOURCES = main.cpp \
playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp \
videowidget.cpp audiowidget.cpp playlistwidget.cpp om3u.cpp mediaplayer.cpp inputDialog.cpp \
frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp \
playlistwidgetgui.cpp\
alphablend.c yuv2rgb.c yuv2rgb_arm2.c yuv2rgb_arm4l.S \
threadutil.cpp mediawidget.cpp playlistview.cpp playlistfileview.cpp \
skin.cpp
TARGET = opieplayer2
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lpthread -lopie -lxine -lstdc++
MOC_DIR = qpeobj
OBJECTS_DIR = qpeobj
-#INCLUDEPATH += $(OPIEDIR)/include
-#DEPENDPATH += $(OPIEDIR)/include
-
-
-
TRANSLATIONS = ../../../i18n/de/opieplayer2.ts \
../../../i18n/nl/opieplayer2.ts \
../../../i18n/da/opieplayer2.ts \
../../../i18n/xx/opieplayer2.ts \
../../../i18n/en/opieplayer2.ts \
../../../i18n/es/opieplayer2.ts \
../../../i18n/fr/opieplayer2.ts \
../../../i18n/hu/opieplayer2.ts \
../../../i18n/ja/opieplayer2.ts \
../../../i18n/ko/opieplayer2.ts \
../../../i18n/no/opieplayer2.ts \
../../../i18n/pl/opieplayer2.ts \
../../../i18n/pt/opieplayer2.ts \
../../../i18n/pt_BR/opieplayer2.ts \
../../../i18n/sl/opieplayer2.ts \
../../../i18n/zh_CN/opieplayer2.ts \
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index a1a1016..9a9e1ec 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -26,84 +26,89 @@
  -_. . .   )=.  = 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 <qtoolbar.h>
#include <opie/ofiledialog.h>
#include <qmessagebox.h>
#include "playlistselection.h"
#include "playlistwidget.h"
+#include "mediaplayer.h"
#include "mediaplayerstate.h"
#include "inputDialog.h"
#include "om3u.h"
#include "playlistfileview.h"
//only needed for the random play
#include <assert.h>
-PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
- : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 )
+PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl )
+ : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 )
{
+ mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" );
+ m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer");
+
+
d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
"opieplayer2/add_to_playlist",
this , SLOT(addSelected() ) );
d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
"opieplayer2/remove_from_playlist",
this , SLOT(removeSelected() ) );
d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
this , SLOT( btnPlay( bool) ), TRUE );
d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
- &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
+ mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
- &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
+ mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
(void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
(void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
this, SLOT( addAllMusicToList() ) );
(void)new MenuItem( pmPlayList, tr( "Add all video files" ),
this, SLOT( addAllVideoToList() ) );
(void)new MenuItem( pmPlayList, tr( "Add all files" ),
this, SLOT( addAllToList() ) );
pmPlayList->insertSeparator(-1);
(void)new MenuItem( pmPlayList, tr( "Add File" ),
this,SLOT( openFile() ) );
(void)new MenuItem( pmPlayList, tr("Add URL"),
this,SLOT( openURL() ) );
pmPlayList->insertSeparator(-1);
(void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
this, SLOT(writem3u() ) );
pmPlayList->insertSeparator(-1);
(void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
audioView, SLOT( scanFiles() ) );
(void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
videoView, SLOT( scanFiles() ) );
pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
- &mediaPlayerState, SLOT( toggleFullscreen() ) );
+ mediaPlayerState, SLOT( toggleFullscreen() ) );
Config cfg( "OpiePlayer" );
bool b= cfg.readBoolEntry("FullScreen", 0);
- mediaPlayerState.setFullscreen( b );
+ mediaPlayerState->setFullscreen( b );
pmView->setItemChecked( -16, b );
(void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
d->selectedFiles, SLOT(moveSelectedUp() ) );
(void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
d->selectedFiles, SLOT(removeSelected() ) );
(void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
d->selectedFiles, SLOT(moveSelectedDown() ) );
QVBox *stretch2 = new QVBox( vbox1 );
connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
SLOT( deletePlaylist() ) );
connect( pmView, SIGNAL( activated( int ) ),
this, SLOT( pmViewActivated( int ) ) );
connect( skinsMenu, SIGNAL( activated( int ) ) ,
this, SLOT( skinsMenuActivated( int ) ) );
@@ -112,69 +117,73 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
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 ) ),
+ connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ),
d->tbPlay, SLOT( setOn( bool ) ) );
- connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ),
+ connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ),
d->tbLoop, SLOT( setOn( bool ) ) );
- connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ),
+ connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ),
d->tbShuffle, SLOT( setOn( bool ) ) );
connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ),
this, SLOT( playIt( QListViewItem *) ) );
connect ( gammaSlider, SIGNAL( valueChanged( int ) ),
- &mediaPlayerState, SLOT( setVideoGamma( int ) ) );
+ mediaPlayerState, SLOT( setVideoGamma( int ) ) );
+
+ connect( this, SIGNAL(skinSelected() ),
+ m_mp, SLOT( reloadSkins() ) );
// see which skins are installed
populateSkinsMenu();
initializeStates();
channel = new QCopChannel( "QPE/Application/opieplayer2", this );
connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
this, SLOT( qcopReceive(const QCString&, const QByteArray&)) );
cfg.setGroup("PlayList");
QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
loadList(DocLnk( currentPlaylist ) );
tabWidget->showPage( playListTab );
}
PlayListWidget::~PlayListWidget() {
delete d;
+ delete m_mp;
}
void PlayListWidget::initializeStates() {
- d->tbPlay->setOn( mediaPlayerState.isPlaying() );
- d->tbLoop->setOn( mediaPlayerState.isLooping() );
- d->tbShuffle->setOn( mediaPlayerState.isShuffled() );
+ d->tbPlay->setOn( mediaPlayerState->isPlaying() );
+ d->tbLoop->setOn( mediaPlayerState->isLooping() );
+ d->tbShuffle->setOn( mediaPlayerState->isShuffled() );
d->playListFrame->show();
}
void PlayListWidget::writeDefaultPlaylist() {
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );
QString filename=QPEApplication::documentDir() + "/default.m3u";
QString currentString = config.readEntry( "CurrentPlaylist", filename);
if( currentString == filename) {
Om3u *m3uList;
// qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
if( d->selectedFiles->first() ) {
m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
do {
// qDebug(d->selectedFiles->current()->file());
@@ -328,89 +337,89 @@ void PlayListWidget::setDocument( const QString& fileref ) {
clearList();
QString extension = fileInfo.extension(false);
if( extension.find( "m3u", 0, false) != -1
|| extension.find( "pls", 0, false) != -1 ) {
readListFromFile( fileref );
} else {
clearList();
DocLnk lnk;
lnk.setName( fileInfo.baseName() ); //sets name
lnk.setFile( fileref ); //sets file name
addToSelection( lnk );
writeCurrentM3u();
d->setDocumentUsed = TRUE;
- mediaPlayerState.setPlaying( FALSE );
- mediaPlayerState.setPlaying( TRUE );
+ mediaPlayerState->setPlaying( FALSE );
+ mediaPlayerState->setPlaying( TRUE );
}
}
void PlayListWidget::useSelectedDocument() {
d->setDocumentUsed = FALSE;
}
const DocLnk *PlayListWidget::current() const { // this is fugly
assert( currentTab() == CurrentPlayList );
const DocLnk *lnk = d->selectedFiles->current();
if ( !lnk ) {
d->selectedFiles->first();
lnk = d->selectedFiles->current();
}
assert( lnk );
return lnk;
}
bool PlayListWidget::prev() {
- if ( mediaPlayerState.isShuffled() ) {
+ if ( mediaPlayerState->isShuffled() ) {
const DocLnk *cur = current();
int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
for ( int i = 0; i < j; i++ ) {
if ( !d->selectedFiles->next() )
d->selectedFiles->first();
}
if ( cur == current() )
if ( !d->selectedFiles->next() ) {
d->selectedFiles->first();
}
return TRUE;
} else {
if ( !d->selectedFiles->prev() ) {
- if ( mediaPlayerState.isLooping() ) {
+ if ( mediaPlayerState->isLooping() ) {
return d->selectedFiles->last();
} else {
return FALSE;
}
}
return TRUE;
}
}
bool PlayListWidget::next() {
//qDebug("<<<<<<<<<<<<next()");
- if ( mediaPlayerState.isShuffled() ) {
+ if ( mediaPlayerState->isShuffled() ) {
return prev();
} else {
if ( !d->selectedFiles->next() ) {
- if ( mediaPlayerState.isLooping() ) {
+ if ( mediaPlayerState->isLooping() ) {
return d->selectedFiles->first();
} else {
return FALSE;
}
}
return TRUE;
}
}
bool PlayListWidget::first() {
return d->selectedFiles->first();
}
bool PlayListWidget::last() {
@@ -450,34 +459,34 @@ void PlayListWidget::addSelected() {
}
currentFileListView->clearSelection();
writeCurrentM3u();
}
void PlayListWidget::removeSelected() {
d->selectedFiles->removeSelected( );
writeCurrentM3u();
}
void PlayListWidget::playIt( QListViewItem *it) {
if(!it) return;
- mediaPlayerState.setPlaying(FALSE);
- mediaPlayerState.setPlaying(TRUE);
+ mediaPlayerState->setPlaying(FALSE);
+ mediaPlayerState->setPlaying(TRUE);
d->selectedFiles->unSelect();
}
void PlayListWidget::addToSelection( QListViewItem *it) {
d->setDocumentUsed = FALSE;
if(it) {
if ( currentTab() == CurrentPlayList )
return;
DocLnk lnk;
QString filename;
filename=it->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
@@ -552,33 +561,33 @@ void PlayListWidget::tabChanged(QWidget *) {
{
if( tbDeletePlaylist->isHidden() ) {
tbDeletePlaylist->show();
}
playLists->reread();
d->tbAddToList->setEnabled(FALSE);
d->tbPlay->setEnabled( false );
}
break;
};
}
void PlayListWidget::btnPlay(bool b) {
// mediaPlayerState->setPlaying(false);
- mediaPlayerState.setPlaying(b);
+ mediaPlayerState->setPlaying(b);
insanityBool=FALSE;
}
void PlayListWidget::deletePlaylist() {
switch( QMessageBox::information( this, (tr("Remove Playlist?")),
(tr("You really want to delete\nthis playlist?")),
(tr("Yes")), (tr("No")), 0 )){
case 0: // Yes clicked,
QFile().remove(playLists->selectedDocument().file());
QFile().remove(playLists->selectedDocument().linkFile());
playLists->reread();
break;
case 1: // Cancel
break;
};
}
@@ -896,34 +905,34 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
case Key_Down:
if ( !d->selectedFiles->next() )
d->selectedFiles->first();
break;
case Key_Up:
if ( !d->selectedFiles->prev() )
// d->selectedFiles->last();
break;
}
}
void PlayListWidget::pmViewActivated(int index) {
// qDebug("%d", index);
switch(index) {
case -16:
{
- mediaPlayerState.toggleFullscreen();
- bool b=mediaPlayerState.isFullscreen();
+ mediaPlayerState->toggleFullscreen();
+ bool b=mediaPlayerState->isFullscreen();
pmView->setItemChecked( index, b);
Config cfg( "OpiePlayer" );
cfg.writeEntry( "FullScreen", b );
}
break;
};
}
void PlayListWidget::populateSkinsMenu() {
int item = 0;
defaultSkinIndex = 0;
QString skinName;
Config cfg( "OpiePlayer" );
cfg.setGroup("Options" );
QString skin = cfg.readEntry( "Skin", "default" );
@@ -983,43 +992,43 @@ PlayListWidget::Entry PlayListWidget::currentEntry() const
}
return Entry( currentFileListPathName() );
}
QString PlayListWidget::currentFileListPathName() const {
return currentFileListView->currentItem()->text( 3 );
}
void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
qDebug("qcop message "+msg );
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "play()" ) { //plays current selection
btnPlay( true);
} else if ( msg == "stop()" ) {
- mediaPlayerState.setPlaying( false);
+ mediaPlayerState->setPlaying( false);
} else if ( msg == "togglePause()" ) {
- mediaPlayerState.togglePaused();
+ mediaPlayerState->togglePaused();
} else if ( msg == "next()" ) { //select next in list
- mediaPlayerState.setNext();
+ mediaPlayerState->setNext();
} else if ( msg == "prev()" ) { //select previous in list
- mediaPlayerState.setPrev();
+ mediaPlayerState->setPrev();
} else if ( msg == "toggleLooping()" ) { //loop or not loop
- mediaPlayerState.toggleLooping();
+ mediaPlayerState->toggleLooping();
} else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled
- mediaPlayerState.toggleShuffled();
+ mediaPlayerState->toggleShuffled();
} else if ( msg == "volUp()" ) { //volume more
// emit moreClicked();
// emit moreReleased();
} else if ( msg == "volDown()" ) { //volume less
// emit lessClicked();
// emit lessReleased();
} else if ( msg == "play(QString)" ) { //play this now
QString file;
stream >> file;
setDocument( (const QString &) file);
} else if ( msg == "add(QString)" ) { //add to playlist
QString file;
stream >> file;
QFileInfo fileInfo(file);
DocLnk lnk;
lnk.setName( fileInfo.baseName() ); //sets name
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index fc305cd..29f3e8d 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -34,51 +34,54 @@
#ifndef PLAY_LIST_WIDGET_H
#define PLAY_LIST_WIDGET_H
#include <qpushbutton.h>
#include <qpopupmenu.h>
#include <qpe/qcopenvelope_qws.h>
#include "playlistwidgetgui.h"
class Config;
class QListViewItem;
class QListView;
class QPoint;
class QAction;
class QLabel;
+class MediaPlayerState;
+class MediaPlayer;
class PlayListWidget : public PlayListWidgetGui {
Q_OBJECT
public:
enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
enum { TabTypeCount = 4 };
struct Entry
{
Entry( const QString &_name, const QString &_fileName )
: name( _name ), file( _fileName ) {}
Entry( const QString &_fileName )
: name( _fileName ), file( _fileName ) {}
QString name;
QString file;
};
- PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
+ static QString appName() { return QString::fromLatin1("opieplayer2"); }
+ PlayListWidget( QWidget* parent=0, const char* name=0, WFlags = 0 );
~PlayListWidget();
// retrieve the current playlist entry (media file link)
const DocLnk *current() const;
void useSelectedDocument();
TabType currentTab() const;
Entry currentEntry() const;
public slots:
bool first();
bool last();
bool next();
bool prev();
void writeDefaultPlaylist( );
QString currentFileListPathName() const;
@@ -119,20 +122,22 @@ private slots:
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();
private:
bool fromSetDocument;
bool insanityBool;
QString setDocFileRef, currentPlayList;
int selected;
QListView *currentFileListView;
+
+ MediaPlayer *m_mp;
};
#endif // PLAY_LIST_WIDGET_H
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index 293bf45..fec91ea 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -33,34 +33,34 @@
#include <qtoolbar.h>
#include <qpe/qpeapplication.h>
#include <qlayout.h>
#include <qmenubar.h>
#include "playlistselection.h"
#include "playlistwidget.h"
#include "mediaplayerstate.h"
#include "inputDialog.h"
#include "playlistfileview.h"
#include "mediaplayerstate.h"
-PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent, const char* name )
- : QMainWindow( parent, name ), mediaPlayerState( _mediaPlayerState ) {
+PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name )
+ : QMainWindow( parent, name ) {
d = new PlayListWidgetPrivate;
d->setDocumentUsed = FALSE;
setBackgroundMode( PaletteButton );
setToolBarsMovable( FALSE );
// Create Toolbar
QToolBar *toolbar = new QToolBar( this );
toolbar->setHorizontalStretchable( TRUE );
// Create Menubar
QMenuBar *menu = new QMenuBar( toolbar );
menu->setMargin( 0 );
bar = new QToolBar( this );
@@ -173,22 +173,22 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg
PlayListWidgetGui::~PlayListWidgetGui() {
}
void PlayListWidgetGui::setView( char view ) {
if ( view == 'l' )
showMaximized();
else
hide();
}
void PlayListWidgetGui::setActiveWindow() {
// qDebug("SETTING active window");
// When we get raised we need to ensure that it switches views
- MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType();
- mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
- mediaPlayerState.setDisplayType( origDisplayType ); // now switch back
+ MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType();
+ mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
+ mediaPlayerState->setDisplayType( origDisplayType ); // now switch back
}
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
index c0cd37a..5706d14 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
@@ -80,50 +80,50 @@ public:
}
};
class MenuItem : public QAction {
public:
MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
: QAction( text, QString::null, 0, 0 ) {
connect( this, SIGNAL( activated() ), handler, slot );
addTo( parent );
}
};
class PlayListWidgetGui : public QMainWindow {
Q_OBJECT
public:
- PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent=0, const char* name=0 );
+ PlayListWidgetGui( QWidget* parent=0, const char* name=0 );
~PlayListWidgetGui();
protected:
QTabWidget * tabWidget;
PlayListFileView *audioView, *videoView;
QListView *playlistView;
QLabel *libString;
QPopupMenu *pmView ;
QPopupMenu *gammaMenu;
QSlider *gammaSlider;
QLCDNumber *gammaLCD;
bool fromSetDocument;
bool insanityBool;
QString setDocFileRef;
// retrieve the current playlist entry (media file link)
QPushButton *tbDeletePlaylist;
int selected;
QPopupMenu *pmPlayList;
FileSelector* playLists;
QPopupMenu *skinsMenu;
PlayListWidgetPrivate *d; // Private implementation data
QVBox *vbox1;
QVBox *vbox5;
QToolBar *bar;
QWidget *playListTab;
void setActiveWindow(); // need to handle this to show the right view
void setView( char );
- MediaPlayerState &mediaPlayerState;
+ MediaPlayerState *mediaPlayerState;
};
#endif