|
|
|
@ -53,11 +53,11 @@ using namespace Amarok;
|
|
|
|
|
KHelpMenu *Menu::s_helpMenu = 0;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
safePlug( KActionCollection *ac, const char *name, TQWidget *w )
|
|
|
|
|
safePlug( TDEActionCollection *ac, const char *name, TQWidget *w )
|
|
|
|
|
{
|
|
|
|
|
if( ac )
|
|
|
|
|
{
|
|
|
|
|
KAction *a = ac->action( name );
|
|
|
|
|
TDEAction *a = ac->action( name );
|
|
|
|
|
if( a ) a->plug( w );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -65,11 +65,11 @@ safePlug( KActionCollection *ac, const char *name, TQWidget *w )
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// MenuAction && Menu
|
|
|
|
|
// KActionMenu doesn't work very well, so we derived our own
|
|
|
|
|
// TDEActionMenu doesn't work very well, so we derived our own
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
MenuAction::MenuAction( KActionCollection *ac )
|
|
|
|
|
: KAction( i18n( "Amarok Menu" ), 0, ac, "amarok_menu" )
|
|
|
|
|
MenuAction::MenuAction( TDEActionCollection *ac )
|
|
|
|
|
: TDEAction( i18n( "Amarok Menu" ), 0, ac, "amarok_menu" )
|
|
|
|
|
{
|
|
|
|
|
setShortcutConfigurable ( false ); //FIXME disabled as it doesn't work, should use TQCursor::pos()
|
|
|
|
|
}
|
|
|
|
@ -77,11 +77,11 @@ MenuAction::MenuAction( KActionCollection *ac )
|
|
|
|
|
int
|
|
|
|
|
MenuAction::plug( TQWidget *w, int index )
|
|
|
|
|
{
|
|
|
|
|
KToolBar *bar = dynamic_cast<KToolBar*>(w);
|
|
|
|
|
TDEToolBar *bar = dynamic_cast<TDEToolBar*>(w);
|
|
|
|
|
|
|
|
|
|
if( bar && kapp->authorizeKAction( name() ) )
|
|
|
|
|
if( bar && kapp->authorizeTDEAction( name() ) )
|
|
|
|
|
{
|
|
|
|
|
const int id = KAction::getToolButtonID();
|
|
|
|
|
const int id = TDEAction::getToolButtonID();
|
|
|
|
|
|
|
|
|
|
addContainer( bar, id );
|
|
|
|
|
connect( bar, TQT_SIGNAL( destroyed() ), TQT_SLOT( slotDestroyed() ) );
|
|
|
|
@ -92,7 +92,7 @@ MenuAction::plug( TQWidget *w, int index )
|
|
|
|
|
bar->insertButton( TQString(), id, true, i18n( "Menu" ), index );
|
|
|
|
|
bar->alignItemRight( id );
|
|
|
|
|
|
|
|
|
|
KToolBarButton* button = bar->getButton( id );
|
|
|
|
|
TDEToolBarButton* button = bar->getButton( id );
|
|
|
|
|
button->setPopup( Amarok::Menu::instance() );
|
|
|
|
|
button->setName( "toolbutton_amarok_menu" );
|
|
|
|
|
button->setIcon( "amarok" );
|
|
|
|
@ -104,7 +104,7 @@ MenuAction::plug( TQWidget *w, int index )
|
|
|
|
|
|
|
|
|
|
Menu::Menu()
|
|
|
|
|
{
|
|
|
|
|
KActionCollection *ac = Amarok::actionCollection();
|
|
|
|
|
TDEActionCollection *ac = Amarok::actionCollection();
|
|
|
|
|
|
|
|
|
|
setCheckable( true );
|
|
|
|
|
|
|
|
|
@ -170,7 +170,7 @@ Menu::instance()
|
|
|
|
|
return &menu;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KPopupMenu*
|
|
|
|
|
TDEPopupMenu*
|
|
|
|
|
Menu::helpMenu( TQWidget *parent ) //STATIC
|
|
|
|
|
{
|
|
|
|
|
if ( s_helpMenu == 0 )
|
|
|
|
@ -207,8 +207,8 @@ Menu::slotActivated( int index )
|
|
|
|
|
// PlayPauseAction
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
PlayPauseAction::PlayPauseAction( KActionCollection *ac )
|
|
|
|
|
: KToggleAction( i18n( "Play/Pause" ), 0, ac, "play_pause" )
|
|
|
|
|
PlayPauseAction::PlayPauseAction( TDEActionCollection *ac )
|
|
|
|
|
: TDEToggleAction( i18n( "Play/Pause" ), 0, ac, "play_pause" )
|
|
|
|
|
, EngineObserver( EngineController::instance() )
|
|
|
|
|
{
|
|
|
|
|
engineStateChanged( EngineController::engine()->state() );
|
|
|
|
@ -246,9 +246,9 @@ PlayPauseAction::engineStateChanged( Engine::State state, Engine::State /*oldSt
|
|
|
|
|
TQWidget *w = container( x );
|
|
|
|
|
if( w->inherits( TQPOPUPMENU_OBJECT_NAME_STRING ) )
|
|
|
|
|
static_cast<TQPopupMenu*>(w)->changeItem( itemId( x ), text );
|
|
|
|
|
//TODO KToolBar sucks so much
|
|
|
|
|
// else if( w->inherits( "KToolBar" ) )
|
|
|
|
|
// static_cast<KToolBar*>(w)->getButton( itemId( x ) )->setText( text );
|
|
|
|
|
//TODO TDEToolBar sucks so much
|
|
|
|
|
// else if( w->inherits( "TDEToolBar" ) )
|
|
|
|
|
// static_cast<TDEToolBar*>(w)->getButton( itemId( x ) )->setText( text );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -257,8 +257,8 @@ PlayPauseAction::engineStateChanged( Engine::State state, Engine::State /*oldSt
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
#include "analyzerbase.h"
|
|
|
|
|
|
|
|
|
|
AnalyzerAction::AnalyzerAction( KActionCollection *ac )
|
|
|
|
|
: KAction( i18n( "Analyzer" ), 0, ac, "toolbar_analyzer" )
|
|
|
|
|
AnalyzerAction::AnalyzerAction( TDEActionCollection *ac )
|
|
|
|
|
: TDEAction( i18n( "Analyzer" ), 0, ac, "toolbar_analyzer" )
|
|
|
|
|
{
|
|
|
|
|
setShortcutConfigurable( false );
|
|
|
|
|
}
|
|
|
|
@ -270,11 +270,11 @@ AnalyzerAction::plug( TQWidget *w, int index )
|
|
|
|
|
//we are not designed for unplugging() yet so there would be a leak if that happens
|
|
|
|
|
//but it's a rare event and unplugging is complicated.
|
|
|
|
|
|
|
|
|
|
KToolBar *bar = dynamic_cast<KToolBar*>(w);
|
|
|
|
|
TDEToolBar *bar = dynamic_cast<TDEToolBar*>(w);
|
|
|
|
|
|
|
|
|
|
if( bar && kapp->authorizeKAction( name() ) )
|
|
|
|
|
if( bar && kapp->authorizeTDEAction( name() ) )
|
|
|
|
|
{
|
|
|
|
|
const int id = KAction::getToolButtonID();
|
|
|
|
|
const int id = TDEAction::getToolButtonID();
|
|
|
|
|
|
|
|
|
|
addContainer( w, id );
|
|
|
|
|
connect( w, TQT_SIGNAL( destroyed() ), TQT_SLOT( slotDestroyed() ) );
|
|
|
|
@ -324,7 +324,7 @@ void
|
|
|
|
|
AnalyzerContainer::contextMenuEvent( TQContextMenuEvent *e)
|
|
|
|
|
{
|
|
|
|
|
#if defined HAVE_LIBVISUAL
|
|
|
|
|
KPopupMenu menu;
|
|
|
|
|
TDEPopupMenu menu;
|
|
|
|
|
menu.insertItem( SmallIconSet( Amarok::icon( "visualizations" ) ), i18n("&Visualizations"), Menu::ID_SHOW_VIS_SELECTOR );
|
|
|
|
|
|
|
|
|
|
if( menu.exec( mapToGlobal( e->pos() ) ) == Menu::ID_SHOW_VIS_SELECTOR )
|
|
|
|
@ -338,8 +338,8 @@ AnalyzerContainer::contextMenuEvent( TQContextMenuEvent *e)
|
|
|
|
|
// ToggleAction
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
ToggleAction::ToggleAction( const TQString &text, void ( *f ) ( bool ), KActionCollection* const ac, const char *name )
|
|
|
|
|
: KToggleAction( text, 0, ac, name )
|
|
|
|
|
ToggleAction::ToggleAction( const TQString &text, void ( *f ) ( bool ), TDEActionCollection* const ac, const char *name )
|
|
|
|
|
: TDEToggleAction( text, 0, ac, name )
|
|
|
|
|
, m_function( f )
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
@ -348,9 +348,9 @@ void ToggleAction::setChecked( bool b )
|
|
|
|
|
const bool announce = b != isChecked();
|
|
|
|
|
|
|
|
|
|
m_function( b );
|
|
|
|
|
KToggleAction::setChecked( b );
|
|
|
|
|
TDEToggleAction::setChecked( b );
|
|
|
|
|
AmarokConfig::writeConfig(); //So we don't lose the setting when crashing
|
|
|
|
|
if( announce ) emit toggled( b ); //KToggleAction doesn't do this for us. How gay!
|
|
|
|
|
if( announce ) emit toggled( b ); //TDEToggleAction doesn't do this for us. How gay!
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ToggleAction::setEnabled( bool b )
|
|
|
|
@ -359,7 +359,7 @@ void ToggleAction::setEnabled( bool b )
|
|
|
|
|
|
|
|
|
|
if( !b )
|
|
|
|
|
setChecked( false );
|
|
|
|
|
KToggleAction::setEnabled( b );
|
|
|
|
|
TDEToggleAction::setEnabled( b );
|
|
|
|
|
AmarokConfig::writeConfig(); //So we don't lose the setting when crashing
|
|
|
|
|
if( announce ) emit enabled( b );
|
|
|
|
|
}
|
|
|
|
@ -368,8 +368,8 @@ void ToggleAction::setEnabled( bool b )
|
|
|
|
|
// SelectAction
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
SelectAction::SelectAction( const TQString &text, void ( *f ) ( int ), KActionCollection* const ac, const char *name )
|
|
|
|
|
: KSelectAction( text, 0, ac, name )
|
|
|
|
|
SelectAction::SelectAction( const TQString &text, void ( *f ) ( int ), TDEActionCollection* const ac, const char *name )
|
|
|
|
|
: TDESelectAction( text, 0, ac, name )
|
|
|
|
|
, m_function( f )
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
@ -378,7 +378,7 @@ void SelectAction::setCurrentItem( int n )
|
|
|
|
|
const bool announce = n != currentItem();
|
|
|
|
|
|
|
|
|
|
m_function( n );
|
|
|
|
|
KSelectAction::setCurrentItem( n );
|
|
|
|
|
TDESelectAction::setCurrentItem( n );
|
|
|
|
|
AmarokConfig::writeConfig(); //So we don't lose the setting when crashing
|
|
|
|
|
if( announce ) emit activated( n );
|
|
|
|
|
}
|
|
|
|
@ -389,7 +389,7 @@ void SelectAction::setEnabled( bool b )
|
|
|
|
|
|
|
|
|
|
if( !b )
|
|
|
|
|
setCurrentItem( 0 );
|
|
|
|
|
KSelectAction::setEnabled( b );
|
|
|
|
|
TDESelectAction::setEnabled( b );
|
|
|
|
|
AmarokConfig::writeConfig(); //So we don't lose the setting when crashing
|
|
|
|
|
if( announce ) emit enabled( b );
|
|
|
|
|
}
|
|
|
|
@ -411,15 +411,15 @@ TQString SelectAction::currentIcon() const
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQString SelectAction::currentText() const {
|
|
|
|
|
return KSelectAction::currentText() + "<br /><br />" + i18n("Click to change");
|
|
|
|
|
return TDESelectAction::currentText() + "<br /><br />" + i18n("Click to change");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// VolumeAction
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
VolumeAction::VolumeAction( KActionCollection *ac )
|
|
|
|
|
: KAction( i18n( "Volume" ), 0, ac, "toolbar_volume" )
|
|
|
|
|
VolumeAction::VolumeAction( TDEActionCollection *ac )
|
|
|
|
|
: TDEAction( i18n( "Volume" ), 0, ac, "toolbar_volume" )
|
|
|
|
|
, EngineObserver( EngineController::instance() )
|
|
|
|
|
, m_slider( 0 ) //is TQGuardedPtr
|
|
|
|
|
{}
|
|
|
|
@ -442,7 +442,7 @@ VolumeAction::plug( TQWidget *w, int index )
|
|
|
|
|
connect( m_slider, TQT_SIGNAL(sliderMoved( int )), ec, TQT_SLOT(setVolume( int )) );
|
|
|
|
|
connect( m_slider, TQT_SIGNAL(sliderReleased( int )), ec, TQT_SLOT(setVolume( int )) );
|
|
|
|
|
|
|
|
|
|
static_cast<KToolBar*>(w)->insertWidget( KAction::getToolButtonID(), 0, m_slider, index );
|
|
|
|
|
static_cast<TDEToolBar*>(w)->insertWidget( TDEAction::getToolButtonID(), 0, m_slider, index );
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -458,7 +458,7 @@ VolumeAction::engineVolumeChanged( int value )
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// RandomAction
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
RandomAction::RandomAction( KActionCollection *ac ) :
|
|
|
|
|
RandomAction::RandomAction( TDEActionCollection *ac ) :
|
|
|
|
|
SelectAction( i18n( "Ra&ndom" ), &AmarokConfig::setRandomMode, ac, "random_mode" )
|
|
|
|
|
{
|
|
|
|
|
setItems( TQStringList() << i18n( "&Off" ) << i18n( "&Tracks" ) << i18n( "&Albums" ) );
|
|
|
|
@ -469,7 +469,7 @@ RandomAction::RandomAction( KActionCollection *ac ) :
|
|
|
|
|
void
|
|
|
|
|
RandomAction::setCurrentItem( int n )
|
|
|
|
|
{
|
|
|
|
|
if( KAction *a = parentCollection()->action( "favor_tracks" ) )
|
|
|
|
|
if( TDEAction *a = parentCollection()->action( "favor_tracks" ) )
|
|
|
|
|
a->setEnabled( n );
|
|
|
|
|
SelectAction::setCurrentItem( n );
|
|
|
|
|
}
|
|
|
|
@ -478,7 +478,7 @@ RandomAction::setCurrentItem( int n )
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// FavorAction
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
FavorAction::FavorAction( KActionCollection *ac ) :
|
|
|
|
|
FavorAction::FavorAction( TDEActionCollection *ac ) :
|
|
|
|
|
SelectAction( i18n( "&Favor" ), &AmarokConfig::setFavorTracks, ac, "favor_tracks" )
|
|
|
|
|
{
|
|
|
|
|
setItems( TQStringList() << i18n( "Off" )
|
|
|
|
@ -493,7 +493,7 @@ FavorAction::FavorAction( KActionCollection *ac ) :
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// RepeatAction
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
RepeatAction::RepeatAction( KActionCollection *ac ) :
|
|
|
|
|
RepeatAction::RepeatAction( TDEActionCollection *ac ) :
|
|
|
|
|
SelectAction( i18n( "&Repeat" ), &AmarokConfig::setRepeat, ac, "repeat" )
|
|
|
|
|
{
|
|
|
|
|
setItems( TQStringList() << i18n( "&Off" ) << i18n( "&Track" )
|
|
|
|
@ -505,25 +505,25 @@ RepeatAction::RepeatAction( KActionCollection *ac ) :
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// BurnMenuAction
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
BurnMenuAction::BurnMenuAction( KActionCollection *ac )
|
|
|
|
|
: KAction( i18n( "Burn" ), 0, ac, "burn_menu" )
|
|
|
|
|
BurnMenuAction::BurnMenuAction( TDEActionCollection *ac )
|
|
|
|
|
: TDEAction( i18n( "Burn" ), 0, ac, "burn_menu" )
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
BurnMenuAction::plug( TQWidget *w, int index )
|
|
|
|
|
{
|
|
|
|
|
KToolBar *bar = dynamic_cast<KToolBar*>(w);
|
|
|
|
|
TDEToolBar *bar = dynamic_cast<TDEToolBar*>(w);
|
|
|
|
|
|
|
|
|
|
if( bar && kapp->authorizeKAction( name() ) )
|
|
|
|
|
if( bar && kapp->authorizeTDEAction( name() ) )
|
|
|
|
|
{
|
|
|
|
|
const int id = KAction::getToolButtonID();
|
|
|
|
|
const int id = TDEAction::getToolButtonID();
|
|
|
|
|
|
|
|
|
|
addContainer( bar, id );
|
|
|
|
|
connect( bar, TQT_SIGNAL( destroyed() ), TQT_SLOT( slotDestroyed() ) );
|
|
|
|
|
|
|
|
|
|
bar->insertButton( TQString(), id, true, i18n( "Burn" ), index );
|
|
|
|
|
|
|
|
|
|
KToolBarButton* button = bar->getButton( id );
|
|
|
|
|
TDEToolBarButton* button = bar->getButton( id );
|
|
|
|
|
button->setPopup( Amarok::BurnMenu::instance() );
|
|
|
|
|
button->setName( "toolbutton_burn_menu" );
|
|
|
|
|
button->setIcon( "k3b" );
|
|
|
|
@ -543,7 +543,7 @@ BurnMenu::BurnMenu()
|
|
|
|
|
connect( this, TQT_SIGNAL( activated(int) ), TQT_SLOT( slotActivated(int) ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KPopupMenu*
|
|
|
|
|
TDEPopupMenu*
|
|
|
|
|
BurnMenu::instance()
|
|
|
|
|
{
|
|
|
|
|
static BurnMenu menu;
|
|
|
|
@ -573,18 +573,18 @@ BurnMenu::slotActivated( int index )
|
|
|
|
|
// StopMenuAction
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
StopAction::StopAction( KActionCollection *ac )
|
|
|
|
|
: KAction( i18n( "Stop" ), Amarok::icon( "stop" ), 0, EngineController::instance(), TQT_SLOT( stop() ), ac, "stop" )
|
|
|
|
|
StopAction::StopAction( TDEActionCollection *ac )
|
|
|
|
|
: TDEAction( i18n( "Stop" ), Amarok::icon( "stop" ), 0, EngineController::instance(), TQT_SLOT( stop() ), ac, "stop" )
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
StopAction::plug( TQWidget *w, int index )
|
|
|
|
|
{
|
|
|
|
|
KToolBar *bar = dynamic_cast<KToolBar*>(w);
|
|
|
|
|
TDEToolBar *bar = dynamic_cast<TDEToolBar*>(w);
|
|
|
|
|
|
|
|
|
|
if( bar && kapp->authorizeKAction( name() ) )
|
|
|
|
|
if( bar && kapp->authorizeTDEAction( name() ) )
|
|
|
|
|
{
|
|
|
|
|
const int id = KAction::getToolButtonID();
|
|
|
|
|
const int id = TDEAction::getToolButtonID();
|
|
|
|
|
|
|
|
|
|
addContainer( bar, id );
|
|
|
|
|
connect( bar, TQT_SIGNAL( destroyed() ), TQT_SLOT( slotDestroyed() ) );
|
|
|
|
@ -592,7 +592,7 @@ StopAction::plug( TQWidget *w, int index )
|
|
|
|
|
bar->insertButton( TQString(), id, TQT_SIGNAL( clicked() ), EngineController::instance(), TQT_SLOT( stop() ),
|
|
|
|
|
true, i18n( "Stop" ), index );
|
|
|
|
|
|
|
|
|
|
KToolBarButton* button = bar->getButton( id );
|
|
|
|
|
TDEToolBarButton* button = bar->getButton( id );
|
|
|
|
|
button->setDelayedPopup( Amarok::StopMenu::instance() );
|
|
|
|
|
button->setName( "toolbutton_stop_menu" );
|
|
|
|
|
button->setIcon( Amarok::icon( "stop" ) );
|
|
|
|
@ -600,7 +600,7 @@ StopAction::plug( TQWidget *w, int index )
|
|
|
|
|
|
|
|
|
|
return containerCount() - 1;
|
|
|
|
|
}
|
|
|
|
|
else return KAction::plug( w, index );
|
|
|
|
|
else return TDEAction::plug( w, index );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StopMenu::StopMenu()
|
|
|
|
@ -614,7 +614,7 @@ StopMenu::StopMenu()
|
|
|
|
|
connect( this, TQT_SIGNAL( activated(int) ), TQT_SLOT( slotActivated(int) ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KPopupMenu*
|
|
|
|
|
TDEPopupMenu*
|
|
|
|
|
StopMenu::instance()
|
|
|
|
|
{
|
|
|
|
|
static StopMenu menu;
|
|
|
|
|