author | llornkcor <llornkcor> | 2005-01-08 19:56:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-01-08 19:56:24 (UTC) |
commit | 60a617583d0ccc793d9ea4465998d90ec208db58 (patch) (side-by-side diff) | |
tree | 58b125c9526c9dff30efbfa427c92c49f2995aee | |
parent | 955213d274c2f0c11d0f153e2fed5df5170e50f6 (diff) | |
download | opie-60a617583d0ccc793d9ea4465998d90ec208db58.zip opie-60a617583d0ccc793d9ea4465998d90ec208db58.tar.gz opie-60a617583d0ccc793d9ea4465998d90ec208db58.tar.bz2 |
check for skins directory and fail nicely if not found
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 2e9553f..5f4159c 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -857,192 +857,197 @@ void PlayListWidget::writem3u() { // odebug << filename << oendl; Config config( "OpiePlayer" ); config.setGroup( "PlayList" ); config.writeEntry("CurrentPlaylist",filename); currentPlayList=filename; if(!lnk.writeLink()) { odebug << "Writing doclink did not work" << oendl; } setCaption(tr("OpiePlayer: ") + name); } } } void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_F9: //activity // if(audioUI->isHidden()) // audioUI->showMaximized(); break; case Key_F10: //contacts // if( videoUI->isHidden()) // videoUI->showMaximized(); break; case Key_F11: //menu break; case Key_F12: //home // doBlank(); break; case Key_F13: //mail // doUnblank(); break; case Key_Q: //add to playlist addSelected(); break; case Key_R: //remove from playlist removeSelected(); break; // case Key_P: //play // odebug << "Play" << oendl; // playSelected(); // break; case Key_Space: // playSelected(); puh break; case Key_1: tabWidget->setCurrentPage( 0 ); break; case Key_2: tabWidget->setCurrentPage( 1 ); break; case Key_3: tabWidget->setCurrentPage( 2 ); break; case Key_4: tabWidget->setCurrentPage( 3 ); break; 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) { // odebug << "" << index << "" << oendl; switch(index) { case -16: { 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" ); QDir skinsDir( QPEApplication::qpeDir() + "pics/opieplayer2/skins" ); + if(!skinsDir.exists()) { + QMessageBox::critical( 0, tr("Opieplayer Error"), + tr("<p><b>Opieplayer2 skin not found!</b></p><p>Please install an opieplayer2 skin package.</p>") ); + exit(1) ; + } skinsDir.setFilter( QDir::Dirs ); skinsDir.setSorting(QDir::Name ); const QFileInfoList *skinslist = skinsDir.entryInfoList(); QFileInfoListIterator it( *skinslist ); QFileInfo *fi; while ( ( fi = it.current() ) ) { skinName = fi->fileName(); // odebug << fi->fileName() << oendl; if( skinName != "." && skinName != ".." && skinName !="CVS" ) { item = skinsMenu->insertItem( fi->fileName() ) ; } if( skinName == "default" ) { defaultSkinIndex = item; } if( skinName == skin ) { skinsMenu->setItemChecked( item, TRUE ); } ++it; } } void PlayListWidget::skinsMenuActivated( int item ) { for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { skinsMenu->setItemChecked( i, FALSE ); } skinsMenu->setItemChecked( item, TRUE ); { Config cfg( "OpiePlayer" ); cfg.setGroup("Options"); cfg.writeEntry("Skin", skinsMenu->text( item ) ); } emit skinSelected(); } PlayListWidget::TabType PlayListWidget::currentTab() const { static const TabType indexToTabType[ TabTypeCount ] = { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; int index = tabWidget->currentPageIndex(); assert( index < TabTypeCount && index >= 0 ); return indexToTabType[ index ]; } PlayListWidget::Entry PlayListWidget::currentEntry() const { if ( currentTab() == CurrentPlayList ) { const DocLnk *lnk = current(); return Entry( lnk->name(), lnk->file() ); } return Entry( currentFileListPathName() ); } QString PlayListWidget::currentFileListPathName() const { return currentFileListView->currentItem()->text( 3 ); } void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { QDataStream stream ( data, IO_ReadOnly ); if ( msg == "play()" ) { //plays current selection btnPlay( true); } else if ( msg == "stop()" ) { mediaPlayerState->setPlaying( false); } else if ( msg == "togglePause()" ) { mediaPlayerState->togglePaused(); } else if ( msg == "next()" ) { //select next in list mediaPlayerState->setNext(); } else if ( msg == "prev()" ) { //select previous in list mediaPlayerState->setPrev(); } else if ( msg == "toggleLooping()" ) { //loop or not loop mediaPlayerState->toggleLooping(); } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled 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 lnk.setFile( file ); //sets file name addToSelection( lnk ); |