|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
Four patches for KaffeineHello everybody,
I want to share some patches I wrote for Kaffeine. You have them attached to this post: *The first one, "Improved_actions_after_play.diff" makes Kaffeine to not only hide but actually quit when you select "Quit After This Track" or "Quit After Playlist". Also, it adds the option "ShutDown System After Playlist" which I think is quite useful (I used to use Kaffeine + KShutDown to shut down my system when I went bed with some music, now I only need Kaffeine). *The second one, "Second_drive_support.diff" makes Kaffeine to look for audio CDs not only in /dev/cdrom0 but also in /dev/cdrom1, allowing you to play your music CDs from a second CD drive. This does not work with a third or a fourth drive or with DVDs, so I think it needs to be improved. *The third patch, "Start_window_remove.diff" makes Playlist the default tab when you open Kaffeine, so you can directly drag & drop files without having to change the active tab. In my opinion, the Start tab had no point because you already have the tab bar to access all the features, so I simply removed it. *The fourth patch, "Missing_ppl_in_credits.diff", only adds some missing people to the About window, as Pfister said in a source code comment. That's all, I hope you found it useful. Have a good day! -- Albert Vaka albertvaka@... [Improved_actions_after_play.diff] =================================================================== --- kaffeine/src/kaffeine.cpp (revision 817982) +++ kaffeine/src/kaffeine.cpp (working copy) @@ -529,18 +528,6 @@ { MRL mrl; if ( inplug->playbackFinished( mrl ) ) { - if (m_sleepAfterPlay->isChecked()) - { - stop(); - slotSleepAfterPlay();// Shut screen off - return; - } - if (m_quitAfterPlay->isChecked()) - { - stop(); - slotQuitAfterPlay(); - return; - } m_recent->addURL(mrl.kurl()); slotPlay(mrl); } @@ -551,14 +538,19 @@ m_mediaPart->closeURL(); if (m_sleepAfterPlay->isChecked()) { - slotSleepAfterPlay();// Shut screen off + slotSleepAfterPlay(); // Shut screen off return; } - if (m_quitAfterPlay->isChecked() || m_quitAfterPlaylist->isChecked()) + if (m_quitAfterPlay->isChecked()) { slotQuitAfterPlay(); return; } + if (m_shutDownAfterPlay->isChecked()) + { + slotShutDownAfterPlay(); + return; + } } } } @@ -665,9 +652,9 @@ new KAction(i18n("Open &URL..."), "www", CTRL|Key_U, this, SLOT(slotOpenURL()), actionCollection(), "file_open_url"); new KAction(i18n("Open D&irectory..."), "folder_video", 0, this, SLOT(slotOpenDirectory()), actionCollection(), "file_open_directory"); m_recent = KStdAction::openRecent(this, SLOT(slotPlayRecent(const KURL&)), actionCollection(), "file_open_recent"); - m_sleepAfterPlay = new KToggleAction(i18n("Quit && Shutoff Monitor After This Track"), 0, 0, this, SLOT(slotSleepAfterPlayMenu()), actionCollection(), "sleep_after_play"); - m_quitAfterPlay = new KToggleAction(i18n("Quit After This Track"), 0, 0, this, SLOT(slotQuitAfterPlayMenu()), actionCollection(), "quit_after_play"); - m_quitAfterPlaylist = new KToggleAction(i18n("Quit After Playlist"), 0, 0, this, SLOT(slotQuitAfterPlaylistMenu()), actionCollection(), "quit_after_playlist"); + m_quitAfterPlay = new KToggleAction(i18n("Quit Kaffeine After Playlist"), 0, 0, this, SLOT(slotQuitAfterPlayMenu()), actionCollection(), "quit_after_play"); + m_sleepAfterPlay = new KToggleAction(i18n("Turn Off Monitor After Playlist"), 0, 0, this, SLOT(slotSleepAfterPlayMenu()), actionCollection(), "sleep_after_play"); + m_shutDownAfterPlay = new KToggleAction(i18n("ShutDown System After Playlist"), 0, 0, this, SLOT(slotShutDownAfterPlayMenu()), actionCollection(), "shutdown_after_play"); KStdAction::quit(this, SLOT(slotQuit()), actionCollection()); /*view menu */ @@ -994,9 +981,20 @@ } } +//================================// +// Quit after play menu checboxes // +//================================// + +void Kaffeine::slotQuitAfterPlayMenu() +{ + m_sleepAfterPlay->setChecked(false); //Keep from checking both quits + m_shutDownAfterPlay->setChecked(false); +} + void Kaffeine::slotSleepAfterPlayMenu() { - m_quitAfterPlay->setChecked(false); //Keep from checking both quits + m_quitAfterPlay->setChecked(false); + m_shutDownAfterPlay->setChecked(false); #ifdef HAVE_DPMS Display *dspl = qt_xdisplay(); @@ -1011,12 +1009,37 @@ { if (m_sleepAfterPlay->isChecked()) { - KMessageBox::information(this, i18n("This will quit Kaffeine and shut off the monitor's power after the file/playlist has finished. Option \"dpms\" must be in your X config file for the monitor to power off."), QString::null, "sleep_info", 1); + KMessageBox::information(this, i18n("This will shut off the monitor's power after the file/playlist has finished. Option \"dpms\" must be in your X config file for the monitor to power off."), QString::null, "sleep_info", 1); } } #endif } +void Kaffeine::slotShutDownAfterPlayMenu() +{ + m_sleepAfterPlay->setChecked(false); + m_quitAfterPlay->setChecked(false); +} + +//=========================// +// Quit after play actions // +//=========================// + +void Kaffeine::slotQuitAfterPlay() +{ +/* Why should we want to only hide the player instead of quiting? --Vaka */ +/* + if (m_systemTray) + { + hide(); + m_quitAfterPlay->setChecked(false); + m_quitAfterPlaylist->setChecked(false); + } + else +*/ + slotQuit(); +} + void Kaffeine::slotSleepAfterPlay() { #ifdef HAVE_DPMS @@ -1032,41 +1055,31 @@ DPMSSetTimeouts(dspl, standby, suspend, off); // For reseting DPMS and toggle XFlush(dspl); #endif +} - if (m_systemTray) +void Kaffeine::slotShutDownAfterPlay() +{ + if ( + !kapp->requestShutDown( + KApplication::ShutdownConfirmNo, + KApplication::ShutdownTypeHalt, + KApplication::ShutdownModeForceNow + ) + ) { - hide(); - m_sleepAfterPlay->setChecked(false); - m_quitAfterPlaylist->setChecked(false); + KMessageBox::error( + 0, + i18n( + "Could not logout properly.\n" \ + "The session manager cannot be contacted." + ) + ); } - else - slotQuit(); } -void Kaffeine::slotQuitAfterPlaylistMenu() -{ - m_sleepAfterPlay->setChecked(false); - m_quitAfterPlay->setChecked(false); -} +//=========================// -void Kaffeine::slotQuitAfterPlayMenu() -{ - m_sleepAfterPlay->setChecked(false); //Keep from checking both quits - m_quitAfterPlaylist->setChecked(false); -} -void Kaffeine::slotQuitAfterPlay() -{ - if (m_systemTray) - { - hide(); - m_quitAfterPlay->setChecked(false); - m_quitAfterPlaylist->setChecked(false); - } - else - slotQuit(); -} - void Kaffeine::slotOpenFile() { QString fileFilter = m_filter; Index: kaffeine/src/kaffeine.h =================================================================== --- kaffeine/src/kaffeine.h (revision 817982) +++ kaffeine/src/kaffeine.h (working copy) @@ -182,11 +181,12 @@ void slotUseAlternateEncoding(bool); void slotAlternateEncoding(const QString&); void slotMute(); - void slotSleepAfterPlay(); + void slotQuitAfterPlayMenu(); void slotSleepAfterPlayMenu(); + void slotShutDownAfterPlayMenu(); void slotQuitAfterPlay(); - void slotQuitAfterPlayMenu(); - void slotQuitAfterPlaylistMenu(); + void slotSleepAfterPlay(); + void slotShutDownAfterPlay(); void slotSetOSDTimeout(uint); void slotPauseVideo(bool); void slotDvbClient(bool,const QString&,int,int,const QString&); @@ -260,7 +259,7 @@ KActionMenu* m_playersMenu; KToggleAction* m_sleepAfterPlay; KToggleAction* m_quitAfterPlay; - KToggleAction* m_quitAfterPlaylist; + KToggleAction* m_shutDownAfterPlay; bool m_statusBarVisible; QTimer m_screensaverTimer; Index: kaffeine/src/kaffeineui.rc =================================================================== --- kaffeine/src/kaffeineui.rc (revision 817982) +++ kaffeine/src/kaffeineui.rc (working copy) @@ -10,9 +10,9 @@ <Merge/> <Separator/> <Menu name="quit_options"><text>Quit Options</text> + <Action name="quit_after_play"/> <Action name="sleep_after_play"/> - <Action name="quit_after_play"/> - <Action name="quit_after_playlist"/> + <Action name="shutdown_after_play"/> </Menu> <Action name="file_quit"/> </Menu> Index: kaffeine/src/Makefile.am =================================================================== [Missing_ppl_in_credits.diff] Index: kaffeine/src/main.cpp =================================================================== --- kaffeine/src/main.cpp (revision 817982) +++ kaffeine/src/main.cpp (working copy) @@ -90,6 +90,22 @@ aboutData.addCredit("Giorgos Gousios", I18N_NOOP("Subtitle file import."), "gousiosg@..."); aboutData.addCredit("Michael Rolf", I18N_NOOP("M3U import. Testing."), "mi.rolf@..."); + /* Added other contributions listed in CREDITS as pfister said. --Vaka */ + + aboutData.addCredit("Adrian Schroeter", I18N_NOOP("fix for position changes in paused mode, help with xfree crash"), "adrian@..."); + aboutData.addCredit("Alex Young", I18N_NOOP("fix for volume slider"), "a.d.y@..."); + aboutData.addCredit("Bryan Allen", I18N_NOOP("quit options for end of playback"), "theoiper@..."); + aboutData.addCredit("Carlo Miotto", I18N_NOOP("automatic resize"), "cmiotto@..."); + aboutData.addCredit("Gav Wood", I18N_NOOP("DCop, lirc profile"), "gav@..."); + aboutData.addCredit("Giorgos Gousios", I18N_NOOP("subtitle file handling"), "gousiosg@..."); + aboutData.addCredit("Gustavo Pichorim Boiko", I18N_NOOP("Mouse wheel events for tray icon"), "gustavo.boiko@..."); + aboutData.addCredit("James Stembridge", I18N_NOOP("Toolbar fix"), "jstembridge@..."); + aboutData.addCredit("Jeroen Wijnhout", I18N_NOOP("Shortcut configuration"), "Jeroen.Wijnhout@..."); + aboutData.addCredit("Laurent Montel", I18N_NOOP("Memory leak fixes, speed improvements"), "montel@..."); + aboutData.addCredit("Steffen Schoenwiese", I18N_NOOP("Volume saving, file dialogs remembers last directory"), "ss310636@..."); + aboutData.addCredit("Zack Cerza", I18N_NOOP("English manpages"), "zcerza@..."); + + KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions(cmdLineOptions); [Second_drive_support.diff] Index: kaffeine/src/input/disc/disc.cpp =================================================================== --- kaffeine/src/input/disc/disc.cpp (revision 817982) +++ kaffeine/src/input/disc/disc.cpp (working copy) @@ -430,11 +430,13 @@ s.append( devList[0] ); else { s.append( "/dev/cdrom" ); + s.append( "/dev/cdrom1" ); s.append( "/dev/dvd" ); } } else { s.append( "/dev/cdrom" ); + s.append( "/dev/cdrom1" ); s.append( "/dev/dvd" ); } } [Start_window_remove.diff] Index: kaffeine/src/inputmanager.h =================================================================== --- kaffeine/src/inputmanager.h (revision 817982) +++ kaffeine/src/inputmanager.h (working copy) @@ -79,7 +79,6 @@ void add( KaffeineInput *p, const QPixmap &icon, const QString &name ); void addPlayerWidget( QWidget *w, const QPixmap &icon, const QString &name ); - void addStartWindow( QWidget *w, const QPixmap &icon, const QString &name ); void remove( KaffeineInput *p ); void setPlayerContainer( PlayerContainer *pc ); void fullscreen( bool b ); @@ -114,12 +113,11 @@ void showMe( KaffeineInput* ); private: - void makeTargets( KaffeineInput*, bool ); QWidgetStack *stack; KMultiTabBar *mtBar; QPtrList<InputPlugin> plugs; - QWidget *playerWidget, *startWindow; + QWidget *playerWidget; QWidget *currentMainWidget; PlayerContainer *playerContainer; QWidget *oldMainWidget; Index: kaffeine/src/kaffeine.cpp =================================================================== --- kaffeine/src/kaffeine.cpp (revision 817982) +++ kaffeine/src/kaffeine.cpp (working copy) @@ -70,7 +70,6 @@ #include "kaffeinepart.h" #include "playlist.h" #include "pref.h" -#include "startwindow.h" #include "systemtray.h" #include "instwizard.h" #include "version.h" @@ -179,19 +178,19 @@ stack->setMouseTracking( true ); inplug = new InputManager( this, stack, mtBar ); - m_startWindow = new StartWindow( stack ); - inplug->addStartWindow( m_startWindow, KGlobal::iconLoader()->loadIcon("kmenu", KIcon::Small), i18n("Start") ); - + // player playerWidget = new QVBox( stack ); playerWidget->setMouseTracking( true ); inplug->addPlayerWidget( playerWidget, KGlobal::iconLoader()->loadIcon("kaffeine", KIcon::Small), i18n("Player Window") ); // playlist m_playlist = new PlayList( stack, this ); inplug->add( m_playlist, KGlobal::iconLoader()->loadIcon("view_text", KIcon::Small), i18n( "Playlist") ); m_playlist->setFileFilter(DEFAULT_FILTER); guiFactory()->addClient( m_playlist ); + inplug->togglePlaylist(); //Should be the default open tab + //disc cddisc = new Disc( stack, this ); inplug->add( cddisc, KGlobal::iconLoader()->loadIcon("cdrom_unmount", KIcon::Small), i18n( "Audio CD") ); guiFactory()->addClient( cddisc ); @@ -580,11 +572,6 @@ void Kaffeine::slotNumKeyInput( int n ) { - if ( inplug->visibleWidget()==m_startWindow ) { - m_startWindow->execTarget( n-10 ); - return; - } - QString s; if ( m_numKeyHideTimer.isActive() ) { Index: kaffeine/src/kaffeine.h =================================================================== --- kaffeine/src/kaffeine.h (revision 817982) +++ kaffeine/src/kaffeine.h (working copy) @@ -48,7 +48,6 @@ class MRL; class PlayList; class PlayerContainer; -class StartWindow; class SystemTray; extern const KCmdLineOptions cmdLineOptions[]; @@ -216,7 +216,6 @@ DvbPanel *dvbPanel; #endif CdWidget *dvbClient; - StartWindow *m_startWindow; bool m_dvbClientEnabled; QString m_dvbClientAddress; Index: kaffeine/src/Makefile.am =================================================================== --- kaffeine/src/Makefile.am (revision 817982) +++ kaffeine/src/Makefile.am (working copy) @@ -19,7 +19,6 @@ kaffeine_SOURCES = main.cpp \ kaffeine.cpp \ - startwindow.cpp \ pref.cpp \ kaffeineiface.skel \ systemtray.cpp \ Index: kaffeine/src/inputmanager.cpp =================================================================== --- kaffeine/src/inputmanager.cpp (revision 817982) +++ kaffeine/src/inputmanager.cpp (working copy) @@ -33,7 +33,6 @@ #include "kaffeineinput.h" #include "inputmanager.h" #include "mrl.h" -#include "startwindow.h" #include "inputmanager.moc" @@ -158,8 +157,6 @@ } if ( currentMainWidget==playerWidget ) id = 2; - else if ( currentMainWidget==startWindow ) - id = 1; if ( id && p_id && (id!=p_id) ) { if ( mtBar->isHidden() ) @@ -195,8 +192,7 @@ if ( currentMainWidget==playerWidget ) return; - if ( currentMainWidget==startWindow ) - id = 1; + else { for ( QPtrListIterator<InputPlugin> it(plugs); it.current(); ++it ) { if ( it.current()->plug->inputMainWidget()==currentMainWidget ) { @@ -236,11 +232,7 @@ mtBar->setTab( playlistPluginId, true ); show( playlistPluginId ); } - else if ( currentMainWidget == startWindow ) { - mtBar->setTab( 1, false ); - mtBar->setTab( playlistPluginId, true ); - show( playlistPluginId ); - } + else if ( currentPluginId == playlistPluginId ) { showPlayer(); } @@ -362,7 +354,6 @@ if ( !currentPlugin ) currentPlugin = plugs.current()->plug; ++nextId; - makeTargets( p, true ); } @@ -377,20 +368,7 @@ -void InputManager::addStartWindow( QWidget *w, const QPixmap &icon, const QString &name ) -{ - startWindow = w; - mtBar->appendTab( icon, 1, name ); - connect( mtBar->tab(1), SIGNAL(clicked(int)), this, SLOT(show(int)) ); - stack->addWidget( startWindow, 1 ); - mtBar->setTab( 1, true ); - stack->raiseWidget( 1 ); - oldMainWidget = currentMainWidget = startWindow; - connect( (StartWindow*)w, SIGNAL(execTarget(const QString&)), this, SLOT(execTarget(const QString&)) ); -} - - void InputManager::execTarget( const QString &target ) { QPtrListIterator<InputPlugin> it(plugs); @@ -402,23 +380,7 @@ -void InputManager::makeTargets( KaffeineInput *p, bool make ) -{ - int i; - QStringList uiNames, iconNames, targetNames; - StartWindow *sw = (StartWindow*)(startWindow); - p->getTargets( uiNames, iconNames, targetNames ); - for ( i=0; i<(int)uiNames.count(); i++ ) { - if ( make ) - sw->registerTarget( uiNames[i], iconNames[i], targetNames[i] ); - else - sw->unregisterTarget( targetNames[i] ); - } -} - - - void InputManager::remove( KaffeineInput *p ) { InputPlugin *i=NULL; @@ -459,7 +421,6 @@ } mtBar->removeTab( i->id ); stack->removeWidget( i->plug->inputMainWidget() ); - makeTargets( i->plug, false ); delete i->plug; plugs.remove( i ); } @@ -497,11 +458,6 @@ } currentMainWidget = playerWidget; } - else if ( id==1 ) { - if ( currentMainWidget==startWindow ) - return; - currentMainWidget = startWindow; - } else { for ( QPtrListIterator<InputPlugin> it(plugs); it.current(); ++it ) { if ( it.current()->id==id ) { @@ -538,14 +494,10 @@ else { stack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); mtBar->show(); - if ( oldMainWidget==startWindow ) - id = 1; - else { - for ( it.toFirst(); it.current(); ++it ) { - if ( it.current()->plug->inputMainWidget()==oldMainWidget ) { - id = it.current()->id; - break; - } + for ( it.toFirst(); it.current(); ++it ) { + if ( it.current()->plug->inputMainWidget()==oldMainWidget ) { + id = it.current()->id; + break; } } show( id ); ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ kaffeine-devel mailing list kaffeine-devel@... https://lists.sourceforge.net/lists/listinfo/kaffeine-devel |
| Free embeddable forum powered by Nabble | Forum Help |