mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 23:57:34 +02:00
TWK-604: Update Show/Hide menu entry if Tomahawk is hidden with Cmd-H
This commit is contained in:
@@ -58,6 +58,8 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
|||||||
m_showWindowAction = m_contextMenu->addAction( tr( "Hide Tomahawk Window" ) );
|
m_showWindowAction = m_contextMenu->addAction( tr( "Hide Tomahawk Window" ) );
|
||||||
m_showWindowAction->setData( true );
|
m_showWindowAction->setData( true );
|
||||||
connect( m_showWindowAction, SIGNAL( triggered() ), this, SLOT( showWindow() ) );
|
connect( m_showWindowAction, SIGNAL( triggered() ), this, SLOT( showWindow() ) );
|
||||||
|
|
||||||
|
connect( m_contextMenu, SIGNAL( aboutToShow() ), this, SLOT( menuAboutToShow() ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_contextMenu->addSeparator();
|
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
|
void
|
||||||
TomahawkTrayIcon::setResult( const Tomahawk::result_ptr& result )
|
TomahawkTrayIcon::setResult( const Tomahawk::result_ptr& result )
|
||||||
{
|
{
|
||||||
|
@@ -46,6 +46,7 @@ private slots:
|
|||||||
void enablePlay();
|
void enablePlay();
|
||||||
void enablePause();
|
void enablePause();
|
||||||
|
|
||||||
|
void menuAboutToShow();
|
||||||
private:
|
private:
|
||||||
void refreshToolTip();
|
void refreshToolTip();
|
||||||
~TomahawkTrayIcon();
|
~TomahawkTrayIcon();
|
||||||
|
Reference in New Issue
Block a user