mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 22:26:32 +02:00
* Provide convenience openUrl( url ) method in TomahawkUtilsGui, since QDesktopServices fail to work on Windows.
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
#include <QtGui/QScrollBar>
|
#include <QtGui/QScrollBar>
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
#include <QtGui/QX11Info>
|
#include <QtGui/QX11Info>
|
||||||
@@ -43,6 +44,7 @@
|
|||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
#include <shellapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -134,7 +136,7 @@ drawShadowText( QPainter* painter, const QRect& rect, const QString& text, const
|
|||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
painter->drawText( rect, text, textOption );
|
painter->drawText( rect, text, textOption );
|
||||||
|
|
||||||
/* QFont font = painter->font();
|
/* QFont font = painter->font();
|
||||||
font.setPixelSize( font.pixelSize() + 2 );
|
font.setPixelSize( font.pixelSize() + 2 );
|
||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
@@ -182,7 +184,7 @@ drawBackgroundAndNumbers( QPainter* painter, const QString& text, const QRect& f
|
|||||||
painter->setPen( origpen );
|
painter->setPen( origpen );
|
||||||
painter->setPen( Qt::white );
|
painter->setPen( Qt::white );
|
||||||
painter->drawText( figRect.adjusted( -5, 0, 6, 0 ), text, QTextOption( Qt::AlignCenter ) );
|
painter->drawText( figRect.adjusted( -5, 0, 6, 0 ), text, QTextOption( Qt::AlignCenter ) );
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,6 +295,17 @@ bringToFront()
|
|||||||
#endif
|
#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
|
QPixmap
|
||||||
createAvatarFrame( const QPixmap &avatar )
|
createAvatarFrame( const QPixmap &avatar )
|
||||||
{
|
{
|
||||||
|
@@ -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
|
/// 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 bringToFront();
|
||||||
|
|
||||||
|
DLLEXPORT void openUrl( const QUrl& url );
|
||||||
|
|
||||||
DLLEXPORT QPixmap createAvatarFrame( const QPixmap &avatar );
|
DLLEXPORT QPixmap createAvatarFrame( const QPixmap &avatar );
|
||||||
|
|
||||||
DLLEXPORT QColor alphaBlend( const QColor& colorFrom, const QColor& colorTo, float opacity );
|
DLLEXPORT QColor alphaBlend( const QColor& colorFrom, const QColor& colorTo, float opacity );
|
||||||
|
Reference in New Issue
Block a user