mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 08:34:34 +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}
|
||||
infosystem/infoplugins/mac/adium.mm
|
||||
infosystem/infoplugins/mac/adiumplugin.cpp )
|
||||
infosystem/infoplugins/mac/adiumplugin.cpp
|
||||
utils/tomahawkutils_mac.mm )
|
||||
|
||||
SET( libHeaders ${libHeaders}
|
||||
infosystem/infoplugins/mac/adium.h
|
||||
@@ -433,6 +434,8 @@ IF( APPLE )
|
||||
${COREFOUNDATION_LIBRARY}
|
||||
${FOUNDATION_LIBRARY}
|
||||
${SCRIPTINGBRIDGE_LIBRARY}
|
||||
|
||||
/System/Library/Frameworks/AppKit.framework
|
||||
)
|
||||
ENDIF( APPLE )
|
||||
|
||||
|
@@ -460,5 +460,11 @@ setNam( QNetworkAccessManager* nam )
|
||||
s_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
||||
}
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
void
|
||||
bringToFront() {
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
} // ns
|
||||
|
@@ -80,6 +80,9 @@ namespace TomahawkUtils
|
||||
|
||||
DLLEXPORT void setProxyFactory( TomahawkUtils::NetworkProxyFactory* factory );
|
||||
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
|
||||
|
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()
|
||||
{
|
||||
#ifndef TOMAHAWK_HEADLESS
|
||||
mainWindow()->show();
|
||||
TomahawkUtils::bringToFront();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -578,6 +578,7 @@ TomahawkApp::activate()
|
||||
bool
|
||||
TomahawkApp::loadUrl( const QString& url )
|
||||
{
|
||||
activate();
|
||||
if ( url.startsWith( "tomahawk://" ) )
|
||||
return GlobalActionManager::instance()->parseTomahawkLink( url );
|
||||
else
|
||||
|
Reference in New Issue
Block a user