mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 09:04:33 +02:00
Bring to front on mac when a tomahawkurl is opened in Tomahawk. Will add linux and win-specific code as well.
This commit is contained in:
@@ -420,7 +420,8 @@ IF( APPLE )
|
|||||||
|
|
||||||
SET( libSources ${libSources}
|
SET( libSources ${libSources}
|
||||||
infosystem/infoplugins/mac/adium.mm
|
infosystem/infoplugins/mac/adium.mm
|
||||||
infosystem/infoplugins/mac/adiumplugin.cpp )
|
infosystem/infoplugins/mac/adiumplugin.cpp
|
||||||
|
utils/tomahawkutils_mac.mm )
|
||||||
|
|
||||||
SET( libHeaders ${libHeaders}
|
SET( libHeaders ${libHeaders}
|
||||||
infosystem/infoplugins/mac/adium.h
|
infosystem/infoplugins/mac/adium.h
|
||||||
@@ -433,6 +434,8 @@ IF( APPLE )
|
|||||||
${COREFOUNDATION_LIBRARY}
|
${COREFOUNDATION_LIBRARY}
|
||||||
${FOUNDATION_LIBRARY}
|
${FOUNDATION_LIBRARY}
|
||||||
${SCRIPTINGBRIDGE_LIBRARY}
|
${SCRIPTINGBRIDGE_LIBRARY}
|
||||||
|
|
||||||
|
/System/Library/Frameworks/AppKit.framework
|
||||||
)
|
)
|
||||||
ENDIF( APPLE )
|
ENDIF( APPLE )
|
||||||
|
|
||||||
|
@@ -460,5 +460,11 @@ setNam( QNetworkAccessManager* nam )
|
|||||||
s_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
s_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
void
|
||||||
|
bringToFront() {
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
@@ -80,6 +80,9 @@ namespace TomahawkUtils
|
|||||||
|
|
||||||
DLLEXPORT void setProxyFactory( TomahawkUtils::NetworkProxyFactory* factory );
|
DLLEXPORT void setProxyFactory( TomahawkUtils::NetworkProxyFactory* factory );
|
||||||
DLLEXPORT void setNam( QNetworkAccessManager* nam );
|
DLLEXPORT void setNam( QNetworkAccessManager* nam );
|
||||||
|
|
||||||
|
/// Platform-specific bringing tomahawk mainwindow to front, b/c qt's activate() and such don't seem to work well enough for us
|
||||||
|
DLLEXPORT void bringToFront();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TOMAHAWKUTILS_H
|
#endif // TOMAHAWKUTILS_H
|
||||||
|
14
src/libtomahawk/utils/tomahawkutils_mac.mm
Normal file
14
src/libtomahawk/utils/tomahawkutils_mac.mm
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include "tomahawkutils.h"
|
||||||
|
|
||||||
|
#import <AppKit/NSApplication.h>
|
||||||
|
|
||||||
|
namespace TomahawkUtils
|
||||||
|
{
|
||||||
|
|
||||||
|
void
|
||||||
|
bringToFront() {
|
||||||
|
qDebug() << "foo";
|
||||||
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -570,7 +570,7 @@ void
|
|||||||
TomahawkApp::activate()
|
TomahawkApp::activate()
|
||||||
{
|
{
|
||||||
#ifndef TOMAHAWK_HEADLESS
|
#ifndef TOMAHAWK_HEADLESS
|
||||||
mainWindow()->show();
|
TomahawkUtils::bringToFront();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,6 +578,7 @@ TomahawkApp::activate()
|
|||||||
bool
|
bool
|
||||||
TomahawkApp::loadUrl( const QString& url )
|
TomahawkApp::loadUrl( const QString& url )
|
||||||
{
|
{
|
||||||
|
activate();
|
||||||
if ( url.startsWith( "tomahawk://" ) )
|
if ( url.startsWith( "tomahawk://" ) )
|
||||||
return GlobalActionManager::instance()->parseTomahawkLink( url );
|
return GlobalActionManager::instance()->parseTomahawkLink( url );
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user