1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-13 20:39:57 +01:00

TWK-604: Update Show/Hide menu entry if Tomahawk is hidden with Cmd-H

This commit is contained in:
Leo Franchi 2012-02-26 12:44:19 -05:00
parent 56c2f86381
commit e9fb17dadb
2 changed files with 13 additions and 0 deletions

View File

@ -58,6 +58,8 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
m_showWindowAction = m_contextMenu->addAction( tr( "Hide Tomahawk Window" ) );
m_showWindowAction->setData( true );
connect( m_showWindowAction, SIGNAL( triggered() ), this, SLOT( showWindow() ) );
connect( m_contextMenu, SIGNAL( aboutToShow() ), this, SLOT( menuAboutToShow() ) );
#endif
m_contextMenu->addSeparator();
@ -118,6 +120,16 @@ TomahawkTrayIcon::showWindow()
}
void
TomahawkTrayIcon::menuAboutToShow()
{
// When using Cmd-H on mac to hide a window, it is an OS-level hide that is different from QWidget::hide().
// Qt returns isVisible() == true for windows that are hidden with Cmd-H, which is weird. isActiveWindow() returns
// the proper information though.
setShowHideWindow( APP->mainWindow()->isActiveWindow() );
}
void
TomahawkTrayIcon::setResult( const Tomahawk::result_ptr& result )
{

View File

@ -46,6 +46,7 @@ private slots:
void enablePlay();
void enablePause();
void menuAboutToShow();
private:
void refreshToolTip();
~TomahawkTrayIcon();