1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01:00

* Provide convenience openUrl( url ) method in TomahawkUtilsGui, since QDesktopServices fail to work on Windows.

This commit is contained in:
Christian Muehlhaeuser 2012-07-12 08:35:29 +02:00
parent 81b9af0dc9
commit f3d3f19ef8
2 changed files with 17 additions and 2 deletions

View File

@ -34,6 +34,7 @@
#include <QtGui/QScrollBar>
#include <QtGui/QWidget>
#include <QStyleOption>
#include <QDesktopServices>
#ifdef Q_WS_X11
#include <QtGui/QX11Info>
@ -43,6 +44,7 @@
#ifdef Q_WS_WIN
#include <windows.h>
#include <windowsx.h>
#include <shellapi.h>
#endif
@ -134,7 +136,7 @@ drawShadowText( QPainter* painter, const QRect& rect, const QString& text, const
painter->save();
painter->drawText( rect, text, textOption );
/* QFont font = painter->font();
font.setPixelSize( font.pixelSize() + 2 );
painter->setFont( font );
@ -182,7 +184,7 @@ drawBackgroundAndNumbers( QPainter* painter, const QString& text, const QRect& f
painter->setPen( origpen );
painter->setPen( Qt::white );
painter->drawText( figRect.adjusted( -5, 0, 6, 0 ), text, QTextOption( Qt::AlignCenter ) );
painter->restore();
}
@ -293,6 +295,17 @@ bringToFront()
#endif
void
openUrl( const QUrl& url )
{
#ifdef Q_OS_WIN
ShellExecuteW( 0, 0, (TCHAR*)url.toString().utf16(), 0, 0, SW_SHOWNORMAL );
#else
QDesktopServices::openUrl( url );
#endif
}
QPixmap
createAvatarFrame( const QPixmap &avatar )
{

View File

@ -45,6 +45,8 @@ namespace TomahawkUtils
/// 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();
DLLEXPORT void openUrl( const QUrl& url );
DLLEXPORT QPixmap createAvatarFrame( const QPixmap &avatar );
DLLEXPORT QColor alphaBlend( const QColor& colorFrom, const QColor& colorTo, float opacity );