Added option to hide menubar (thanks to Darrell Anderson for the patch)

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/amarok@1164807 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 448423a4ca
commit 36a9c19165

@ -216,6 +216,11 @@
<whatsthis>Set this to the style dir you want to use.</whatsthis> <whatsthis>Set this to the style dir you want to use.</whatsthis>
<default>Default</default> <default>Default</default>
</entry> </entry>
<entry key="Show Menu Bar" type="Bool">
<label>Whether Menubar is shown</label>
<whatsthis>If set, Amarok displays a menubar on top of the application.</whatsthis>
<default>true</default>
</entry>
<entry key="Relative Playlist" type="Bool"> <entry key="Relative Playlist" type="Bool">
<label>Whether playlists store relative path</label> <label>Whether playlists store relative path</label>
<whatsthis>If set, Amarok's manually saved playlists will contain a relative path to each track, not an absolute path.</whatsthis> <whatsthis>If set, Amarok's manually saved playlists will contain a relative path to each track, not an absolute path.</whatsthis>

@ -678,6 +678,13 @@ void App::applySettings( bool firstTime )
m_pPlaylistWindow->setCaption( i18n("Amarok - %1").arg( EngineController::instance()->bundle().veryNiceTitle() ) ); m_pPlaylistWindow->setCaption( i18n("Amarok - %1").arg( EngineController::instance()->bundle().veryNiceTitle() ) );
else else
m_pPlaylistWindow->setCaption( "Amarok" ); m_pPlaylistWindow->setCaption( "Amarok" );
//m_pPlaylistWindow->show(); //must be shown //we do below now
//ensure that at least one Menu is plugged into an accessible UI element
if( !AmarokConfig::showMenuBar() && !Amarok::actionCollection()->action( "amarok_menu" )->isPlugged() )
playlistWindow()->createGUI();
} }
playlistWindow()->applySettings(); playlistWindow()->applySettings();

@ -139,6 +139,9 @@ PlaylistWindow::PlaylistWindow()
ac->action( "stream_add" )->setIcon( Amarok::icon( "files" ) ); ac->action( "stream_add" )->setIcon( Amarok::icon( "files" ) );
KStdAction::save( this, SLOT(savePlaylist()), ac, "playlist_save" )->setText( i18n("&Save Playlist As...") ); KStdAction::save( this, SLOT(savePlaylist()), ac, "playlist_save" )->setText( i18n("&Save Playlist As...") );
ac->action( "playlist_save" )->setIcon( Amarok::icon( "save" ) ); ac->action( "playlist_save" )->setIcon( Amarok::icon( "save" ) );
#ifndef Q_WS_MAC
KStdAction::showMenubar( this, SLOT(slotToggleMenu()), ac );
#endif
//FIXME: after string freeze rename to "Burn Current Playlist"? //FIXME: after string freeze rename to "Burn Current Playlist"?
new KAction( i18n("Burn to CD"), Amarok::icon( "burn" ), 0, this, SLOT(slotBurnPlaylist()), ac, "playlist_burn" ); new KAction( i18n("Burn to CD"), Amarok::icon( "burn" ), 0, this, SLOT(slotBurnPlaylist()), ac, "playlist_burn" );
@ -233,6 +236,8 @@ PlaylistWindow::PlaylistWindow()
PlaylistWindow::~PlaylistWindow() PlaylistWindow::~PlaylistWindow()
{ {
Amarok::config( "PlaylistWindow" )->writeEntry( "showMenuBar", m_menubar->isShown() );
AmarokConfig::setPlaylistWindowPos( pos() ); //TODO de XT? AmarokConfig::setPlaylistWindowPos( pos() ); //TODO de XT?
AmarokConfig::setPlaylistWindowSize( size() ); //TODO de XT? AmarokConfig::setPlaylistWindowSize( size() ); //TODO de XT?
} }
@ -308,6 +313,9 @@ void PlaylistWindow::init()
connect( repeatAction, SIGNAL( activated( int ) ), playlist, SLOT( slotRepeatTrackToggled( int ) ) ); connect( repeatAction, SIGNAL( activated( int ) ), playlist, SLOT( slotRepeatTrackToggled( int ) ) );
m_menubar = new KMenuBar( this ); m_menubar = new KMenuBar( this );
#ifndef Q_WS_MAC
m_menubar->setShown( AmarokConfig::showMenuBar() );
#endif
//BEGIN Actions menu //BEGIN Actions menu
KPopupMenu *actionsMenu = new KPopupMenu( m_menubar ); KPopupMenu *actionsMenu = new KPopupMenu( m_menubar );
@ -381,6 +389,8 @@ void PlaylistWindow::init()
m_settingsMenu = new KPopupMenu( m_menubar ); m_settingsMenu = new KPopupMenu( m_menubar );
//TODO use KStdAction or KMainWindow //TODO use KStdAction or KMainWindow
#ifndef Q_WS_MAC #ifndef Q_WS_MAC
static_cast<KToggleAction *>(actionCollection()->action(KStdAction::name(KStdAction::ShowMenubar)))->setChecked( AmarokConfig::showMenuBar() );
actionCollection()->action(KStdAction::name(KStdAction::ShowMenubar))->plug( m_settingsMenu );
m_settingsMenu->insertItem( AmarokConfig::showToolbar() ? i18n( "Hide Toolbar" ) : i18n("Show Toolbar"), ID_SHOW_TOOLBAR ); m_settingsMenu->insertItem( AmarokConfig::showToolbar() ? i18n( "Hide Toolbar" ) : i18n("Show Toolbar"), ID_SHOW_TOOLBAR );
m_settingsMenu->insertItem( AmarokConfig::showPlayerWindow() ? i18n("Hide Player &Window") : i18n("Show Player &Window"), ID_SHOW_PLAYERWINDOW ); m_settingsMenu->insertItem( AmarokConfig::showPlayerWindow() ? i18n("Hide Player &Window") : i18n("Show Player &Window"), ID_SHOW_PLAYERWINDOW );
m_settingsMenu->insertSeparator(); m_settingsMenu->insertSeparator();
@ -570,6 +580,13 @@ void PlaylistWindow::createGUI()
{ {
KToolBarButton* const button = static_cast<KToolBarButton*>( m_toolbar->child( (*it).latin1() ) ); KToolBarButton* const button = static_cast<KToolBarButton*>( m_toolbar->child( (*it).latin1() ) );
if ( it == last ) {
//if the user has no PlayerWindow, he MUST have the menu action plugged
//NOTE this is not saved to the local XMLFile, which is what the user will want
if ( !AmarokConfig::showPlayerWindow() && !AmarokConfig::showMenuBar() && !button )
actionCollection()->action( "amarok_menu" )->plug( m_toolbar );
}
if ( button ) { if ( button ) {
button->modeChange(); button->modeChange();
button->setFocusPolicy( QWidget::NoFocus ); button->setFocusPolicy( QWidget::NoFocus );
@ -1031,6 +1048,20 @@ void PlaylistWindow::slotToggleFocus() //SLOT
Playlist::instance()->setFocus(); Playlist::instance()->setFocus();
} }
void PlaylistWindow::slotToggleMenu() //SLOT
{
if( static_cast<KToggleAction *>(actionCollection()->action(KStdAction::name(KStdAction::ShowMenubar)))->isChecked() ) {
AmarokConfig::setShowMenuBar( true );
m_menubar->setShown( true );
}
else
{
AmarokConfig::setShowMenuBar( false );
m_menubar->setShown( false );
}
recreateGUI();
}
void PlaylistWindow::slotMenuActivated( int index ) //SLOT void PlaylistWindow::slotMenuActivated( int index ) //SLOT
{ {
switch( index ) switch( index )
@ -1042,6 +1073,7 @@ void PlaylistWindow::slotMenuActivated( int index ) //SLOT
case ID_SHOW_TOOLBAR: case ID_SHOW_TOOLBAR:
m_toolbar->setShown( !m_toolbar->isShown() ); m_toolbar->setShown( !m_toolbar->isShown() );
AmarokConfig::setShowToolbar( !AmarokConfig::showToolbar() ); AmarokConfig::setShowToolbar( !AmarokConfig::showToolbar() );
actionCollection()->action(KStdAction::name(KStdAction::ShowMenubar))->setEnabled( m_toolbar->isShown() );
m_settingsMenu->changeItem( index, m_toolbar->isShown() ? i18n("Hide Toolbar") : i18n("Show Toolbar") ); m_settingsMenu->changeItem( index, m_toolbar->isShown() ? i18n("Hide Toolbar") : i18n("Show Toolbar") );
break; break;
case ID_SHOW_PLAYERWINDOW: case ID_SHOW_PLAYERWINDOW:

@ -91,6 +91,7 @@ class PlaylistWindow : public QWidget, public KXMLGUIClient
void slotMenuActivated( int ); void slotMenuActivated( int );
void actionsMenuAboutToShow(); void actionsMenuAboutToShow();
void toolsMenuAboutToShow(); void toolsMenuAboutToShow();
void slotToggleMenu();
void slotToggleFocus(); void slotToggleFocus();
void slotEditFilter(); void slotEditFilter();
void slotSetFilter( const QString &filter ); void slotSetFilter( const QString &filter );

Loading…
Cancel
Save