mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 00:54:20 +02:00
Share one trayIcon across all windows
This commit is contained in:
@@ -32,10 +32,10 @@
|
|||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
SourcesModel* TomahawkWindow::s_sourcesModel = 0;
|
SourcesModel* TomahawkWindow::s_sourcesModel = 0;
|
||||||
|
TomahawkTrayIcon* TomahawkWindow::s_trayIcon = 0;
|
||||||
|
|
||||||
TomahawkWindow::TomahawkWindow( QWidget* parent )
|
TomahawkWindow::TomahawkWindow( QWidget* parent )
|
||||||
: QMainWindow( parent )
|
: QMainWindow( parent )
|
||||||
, m_trayIcon( new TomahawkTrayIcon( this ) )
|
|
||||||
{
|
{
|
||||||
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
||||||
|
|
||||||
@@ -45,6 +45,9 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
|||||||
if( !s_sourcesModel )
|
if( !s_sourcesModel )
|
||||||
s_sourcesModel = new SourcesModel( this );
|
s_sourcesModel = new SourcesModel( this );
|
||||||
|
|
||||||
|
if( !s_trayIcon )
|
||||||
|
s_trayIcon = new TomahawkTrayIcon( this );
|
||||||
|
|
||||||
setupSignals();
|
setupSignals();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +130,7 @@ TomahawkWindow::closeEvent( QCloseEvent* e )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
m_trayIcon->setShowHideWindow( false );
|
s_trayIcon->setShowHideWindow( false );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
e->accept();
|
e->accept();
|
||||||
|
@@ -59,9 +59,9 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static SourcesModel* s_sourcesModel;
|
static SourcesModel* s_sourcesModel;
|
||||||
|
static TomahawkTrayIcon* s_trayIcon;
|
||||||
|
|
||||||
QString m_windowTitle;
|
QString m_windowTitle;
|
||||||
TomahawkTrayIcon* m_trayIcon;
|
|
||||||
Tomahawk::result_ptr m_currentTrack;
|
Tomahawk::result_ptr m_currentTrack;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user