From d199fe5ff0f3b1a02848b60caf8c1c2361487145 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Sun, 20 Nov 2011 22:34:34 +0100 Subject: [PATCH] ifdefs--: split TomahawkUtils --- src/libtomahawk/CMakeLists.txt | 2 + src/libtomahawk/context/ContextWidget.cpp | 1 + .../playlist/playlistitemdelegate.cpp | 2 +- src/libtomahawk/playlist/queueview.cpp | 1 + src/libtomahawk/playlist/treeitemdelegate.cpp | 2 +- src/libtomahawk/source.cpp | 2 +- .../thirdparty/Qocoa/qsearchfield.cpp | 2 +- src/libtomahawk/utils/tomahawkutils.cpp | 301 +----------------- src/libtomahawk/utils/tomahawkutils.h | 29 +- src/libtomahawk/viewpage.h | 4 +- src/libtomahawk/widgets/BreadcrumbButton.cpp | 2 +- src/libtomahawk/widgets/HeaderLabel.cpp | 2 +- .../widgets/infowidgets/ArtistInfoWidget.cpp | 2 +- src/libtomahawk/widgets/querylabel.cpp | 2 +- src/libtomahawk/widgets/welcomewidget.h | 2 +- src/settingsdialog.cpp | 8 +- .../jabber/googlewrapper/googlewrapper.cpp | 2 +- src/sip/jabber/jabber.cpp | 2 +- src/sourcetree/items/collectionitem.cpp | 2 +- src/sourcetree/sourcedelegate.cpp | 2 +- src/tomahawkapp.cpp | 4 +- 21 files changed, 40 insertions(+), 336 deletions(-) diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index 7ac9c43dc..afbebf0a4 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -108,6 +108,7 @@ set( libGuiSources utils/stylehelper.cpp utils/dropjobnotifier.cpp utils/proxystyle.cpp + utils/tomahawkutilsgui.cpp widgets/checkdirtree.cpp widgets/querylabel.cpp @@ -225,6 +226,7 @@ set( libGuiHeaders utils/rdioparser.h utils/shortenedlinkparser.h utils/dropjobnotifier.h + utils/tomahawkutilsgui.h widgets/checkdirtree.h widgets/querylabel.h diff --git a/src/libtomahawk/context/ContextWidget.cpp b/src/libtomahawk/context/ContextWidget.cpp index f2006e31c..0f024f117 100644 --- a/src/libtomahawk/context/ContextWidget.cpp +++ b/src/libtomahawk/context/ContextWidget.cpp @@ -33,6 +33,7 @@ #include "playlist/treemodel.h" #include "utils/stylehelper.h" +#include "utils/tomahawkutilsgui.h" #define ANIMATION_TIME 450 #define SLIDE_TIME 350 diff --git a/src/libtomahawk/playlist/playlistitemdelegate.cpp b/src/libtomahawk/playlist/playlistitemdelegate.cpp index 17dfb54f6..ffc1be8b8 100644 --- a/src/libtomahawk/playlist/playlistitemdelegate.cpp +++ b/src/libtomahawk/playlist/playlistitemdelegate.cpp @@ -33,7 +33,7 @@ #include "trackview.h" #include "trackheader.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" #include "utils/logger.h" #define PLAYING_ICON QString( RESPATH "images/now-playing-speaker.png" ) diff --git a/src/libtomahawk/playlist/queueview.cpp b/src/libtomahawk/playlist/queueview.cpp index 07ca0f908..8ceff7054 100644 --- a/src/libtomahawk/playlist/queueview.cpp +++ b/src/libtomahawk/playlist/queueview.cpp @@ -26,6 +26,7 @@ #include "widgets/overlaywidget.h" #include "utils/logger.h" #include "playlistview.h" +#include "utils/tomahawkutilsgui.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/treeitemdelegate.cpp b/src/libtomahawk/playlist/treeitemdelegate.cpp index dee8934c9..6e1bef875 100644 --- a/src/libtomahawk/playlist/treeitemdelegate.cpp +++ b/src/libtomahawk/playlist/treeitemdelegate.cpp @@ -26,7 +26,7 @@ #include "query.h" #include "result.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" #include "utils/logger.h" #include "treemodelitem.h" diff --git a/src/libtomahawk/source.cpp b/src/libtomahawk/source.cpp index 6ef74bd46..26151393f 100644 --- a/src/libtomahawk/source.cpp +++ b/src/libtomahawk/source.cpp @@ -32,7 +32,7 @@ #include #include "utils/logger.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" #include "database/databasecommand_socialaction.h" using namespace Tomahawk; diff --git a/src/libtomahawk/thirdparty/Qocoa/qsearchfield.cpp b/src/libtomahawk/thirdparty/Qocoa/qsearchfield.cpp index 7772755e8..a1da7af8c 100644 --- a/src/libtomahawk/thirdparty/Qocoa/qsearchfield.cpp +++ b/src/libtomahawk/thirdparty/Qocoa/qsearchfield.cpp @@ -27,7 +27,7 @@ THE SOFTWARE. #include #include "playlist/topbar/searchlineedit.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" class DLLEXPORT QSearchFieldPrivate { diff --git a/src/libtomahawk/utils/tomahawkutils.cpp b/src/libtomahawk/utils/tomahawkutils.cpp index f77e9e312..c85cccd04 100644 --- a/src/libtomahawk/utils/tomahawkutils.cpp +++ b/src/libtomahawk/utils/tomahawkutils.cpp @@ -17,22 +17,25 @@ */ #include "config.h" -#include "tomahawkutils.h" - #include "headlesscheck.h" -#include +#include "tomahawksettings.h" + +#include "utils/tomahawkutils.h" +#include "utils/logger.h" + +#ifdef LIBLASTFM_FOUND + #include +#endif -#include -#include -#include -#include -#include -#include -#include #include #include #include +#include +#include +#include +#include + #ifdef Q_WS_WIN #include #include @@ -43,37 +46,12 @@ #include #endif -#ifndef ENABLE_HEADLESS - #include - #include - - #ifdef Q_WS_X11 - #include - #include - #endif - - #ifdef Q_WS_WIN - #include - #include - #endif -#endif - -#include -#include "utils/logger.h" -#include "config.h" - -#ifdef LIBLASTFM_FOUND -#include -#endif - namespace TomahawkUtils { - - -static int s_headerHeight = 0; static quint64 s_infosystemRequestId = 0; static QMutex s_infosystemRequestIdMutex; + #ifdef Q_WS_MAC QString appSupportFolderPath() @@ -335,148 +313,6 @@ alphaBlend( const QColor& colorFrom, const QColor& colorTo, float opacity ) } -QPixmap -createDragPixmap( MediaType type, int itemCount ) -{ - // If more than one item is dragged, align the items inside a - // rectangular grid. The maximum grid size is limited to 5 x 5 items. - int xCount = 3; - int size = 32; - - if ( itemCount > 16 ) - { - xCount = 5; - size = 16; - } else if( itemCount > 9 ) - { - xCount = 4; - size = 22; - } - - if( itemCount < xCount ) - { - xCount = itemCount; - } - - int yCount = itemCount / xCount; - if( itemCount % xCount != 0 ) - { - ++yCount; - } - if( yCount > xCount ) - { - yCount = xCount; - } - // Draw the selected items into the grid cells - QPixmap dragPixmap( xCount * size + xCount - 1, yCount * size + yCount - 1 ); - dragPixmap.fill( Qt::transparent ); - - QPainter painter( &dragPixmap ); - painter.setRenderHint( QPainter::Antialiasing ); - - QPixmap pixmap; - switch ( type ) - { - case MediaTypeArtist: - pixmap = QPixmap( ":/data/images/artist-icon.png" ).scaledToWidth( size, Qt::SmoothTransformation ); - break; - case MediaTypeAlbum: - pixmap = QPixmap( ":/data/images/album-icon.png" ).scaledToWidth( size, Qt::SmoothTransformation ); - break; - case MediaTypeTrack: - pixmap = QPixmap( QString( ":/data/images/track-icon-%2x%2.png" ).arg( size ) ); - break; - } - - int x = 0; - int y = 0; - for( int i = 0; i < itemCount; ++i ) - { - - painter.drawPixmap( x, y, pixmap ); - - x += size + 1; - if ( x >= dragPixmap.width() ) - { - x = 0; - y += size + 1; - } - if ( y >= dragPixmap.height() ) - { - break; - } - } - - return dragPixmap; -} - -void -drawBackgroundAndNumbers( QPainter* painter, const QString& text, const QRect& figRectIn ) -{ - QRect figRect = figRectIn; - if ( text.length() == 1 ) - figRect.adjust( -painter->fontMetrics().averageCharWidth(), 0, 0, 0 ); - - QPen origpen = painter->pen(); - QPen pen = origpen; - pen.setWidth( 1.0 ); - painter->setPen( pen ); - painter->drawRect( figRect ); - - // circles look bad. make it an oval. (thanks, apple) - const int bulgeWidth = 8; - const int offset = 0; // number of pixels to begin, counting inwards from figRect.x() and figRect.width(). 0 means start at each end, negative means start inside the rect. - - QPainterPath ppath; - ppath.moveTo( QPoint( figRect.x() + offset, figRect.y() + figRect.height() / 2 ) ); - QRect leftArcRect( figRect.x() + offset - bulgeWidth, figRect.y(), 2*bulgeWidth, figRect.height() ); - ppath.arcTo( leftArcRect, 90, 180 ); - painter->drawPath( ppath ); - - ppath = QPainterPath(); - ppath.moveTo( figRect.x() + figRect.width() - offset, figRect.y() + figRect.height() / 2 ); - leftArcRect = QRect( figRect.x() + figRect.width() - offset - bulgeWidth, figRect.y(), 2*bulgeWidth, figRect.height() ); - ppath.arcTo( leftArcRect, 270, 180 ); - painter->drawPath( ppath ); - - painter->setPen( origpen ); - -#ifdef Q_WS_MAC - figRect.adjust( -1, 0, 0, 0 ); -#endif - - QTextOption to( Qt::AlignCenter ); - painter->setPen( Qt::white ); - painter->drawText( figRect.adjusted( -5, 0, 6, 0 ), text, to ); -} - -#ifndef ENABLE_HEADLESS -void -drawQueryBackground( QPainter* p, const QPalette& palette, const QRect& r, qreal lightnessFactor ) -{ - p->setPen( palette.mid().color().lighter( lightnessFactor * 100 ) ); - p->setBrush( palette.highlight().color().lighter( lightnessFactor * 100 ) ); - p->drawRoundedRect( r, 4.0, 4.0 ); -} - - -void -unmarginLayout( QLayout* layout ) -{ - layout->setContentsMargins( 0, 0, 0, 0 ); - layout->setMargin( 0 ); - layout->setSpacing( 0 ); - - for ( int i = 0; i < layout->count(); i++ ) - { - QLayout* childLayout = layout->itemAt( i )->layout(); - if ( childLayout ) - unmarginLayout( childLayout ); - } -} -#endif - - NetworkProxyFactory::NetworkProxyFactory( const NetworkProxyFactory& other ) { m_noProxyHosts = QStringList( other.m_noProxyHosts ); @@ -691,103 +527,6 @@ setNam( QNetworkAccessManager* nam, bool noMutexLocker ) } -#ifndef ENABLE_HEADLESS -QWidget* -tomahawkWindow() -{ - QWidgetList widgetList = qApp->topLevelWidgets(); - int i = 0; - while( i < widgetList.count() && widgetList.at( i )->objectName() != "TH_Main_Window" ) - i++; - - if ( i == widgetList.count() ) - { - qDebug() << Q_FUNC_INFO << "could not find main Tomahawk mainwindow"; - Q_ASSERT( false ); - return 0; - } - - QWidget *widget = widgetList.at( i ); - return widget; -} - - -#ifndef Q_WS_MAC -void -bringToFront() -{ -#if defined(Q_WS_X11) - { - qDebug() << Q_FUNC_INFO; - - QWidget* widget = tomahawkWindow(); - if ( !widget ) - return; - - widget->show(); - widget->activateWindow(); - widget->raise(); - - WId wid = widget->winId(); - NETWM::init(); - - XEvent e; - e.xclient.type = ClientMessage; - e.xclient.message_type = NETWM::NET_ACTIVE_WINDOW; - e.xclient.display = QX11Info::display(); - e.xclient.window = wid; - e.xclient.format = 32; - e.xclient.data.l[0] = 2; - e.xclient.data.l[1] = QX11Info::appTime(); - e.xclient.data.l[2] = 0; - e.xclient.data.l[3] = 0l; - e.xclient.data.l[4] = 0l; - - XSendEvent( QX11Info::display(), RootWindow( QX11Info::display(), DefaultScreen( QX11Info::display() ) ), False, SubstructureRedirectMask | SubstructureNotifyMask, &e ); - } -#elif defined(Q_WS_WIN) - { - qDebug() << Q_FUNC_INFO; - - QWidget* widget = tomahawkWindow(); - if ( !widget ) - return; - - widget->show(); - widget->activateWindow(); - widget->raise(); - - WId wid = widget->winId(); - - HWND hwndActiveWin = GetForegroundWindow(); - int idActive = GetWindowThreadProcessId(hwndActiveWin, NULL); - if ( AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) ) - { - SetForegroundWindow( wid ); - SetFocus( wid ); - AttachThreadInput(GetCurrentThreadId(), idActive, FALSE); - } - } -#endif -} -#endif - -#endif - - -QPixmap -createAvatarFrame( const QPixmap &avatar ) -{ - QPixmap frame( ":/data/images/avatar_frame.png" ); - QPixmap scaledAvatar = avatar.scaled( frame.height() * 75 / 100, frame.width() * 75 / 100, Qt::KeepAspectRatio, Qt::SmoothTransformation ); - - QPainter painter( &frame ); - painter.drawPixmap( (frame.height() - scaledAvatar.height()) / 2, (frame.width() - scaledAvatar.width()) / 2, scaledAvatar ); - - return frame; -} - - void crash() { @@ -795,18 +534,6 @@ crash() *a = 1; } -int -headerHeight() -{ - return s_headerHeight; -} - -void -setHeaderHeight( int height ) -{ - s_headerHeight = height; -} - // taken from util/fileutils.cpp in kdevplatform bool removeDirectory( const QString& dir ) diff --git a/src/libtomahawk/utils/tomahawkutils.h b/src/libtomahawk/utils/tomahawkutils.h index 67b251187..91c85355d 100644 --- a/src/libtomahawk/utils/tomahawkutils.h +++ b/src/libtomahawk/utils/tomahawkutils.h @@ -21,25 +21,15 @@ #include "dllmacro.h" -#include #include #include #include -#include -#ifndef ENABLE_HEADLESS - #include -#endif #define RESPATH ":/data/" -class QPainter; -class QColor; + class QDir; -class QDateTime; -class QString; -class QPixmap; -class QLayout; class QNetworkAccessManager; namespace TomahawkUtils @@ -89,20 +79,6 @@ namespace TomahawkUtils DLLEXPORT QString filesizeToString( unsigned int size ); DLLEXPORT QString extensionToMimetype( const QString& extension ); - DLLEXPORT QColor alphaBlend( const QColor& colorFrom, const QColor& colorTo, float opacity ); - DLLEXPORT QPixmap createDragPixmap( MediaType type, int itemCount = 1 ); - - DLLEXPORT void drawBackgroundAndNumbers( QPainter* p, const QString& text, const QRect& rect ); -#ifndef ENABLE_HEADLESS - DLLEXPORT void drawQueryBackground( QPainter* p, const QPalette& palette, const QRect& r, qreal lightnessFactor = 1 ); - DLLEXPORT QWidget* tomahawkWindow(); - /// 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 QPixmap createAvatarFrame( const QPixmap &avatar ); -#endif - DLLEXPORT void unmarginLayout( QLayout* layout ); - DLLEXPORT NetworkProxyFactory* proxyFactory( bool noMutexLocker = false ); DLLEXPORT QNetworkAccessManager* nam(); @@ -111,9 +87,6 @@ namespace TomahawkUtils DLLEXPORT void crash(); - DLLEXPORT int headerHeight(); - DLLEXPORT void setHeaderHeight( int height ); - DLLEXPORT bool removeDirectory( const QString& dir ); DLLEXPORT quint64 infosystemRequestId(); diff --git a/src/libtomahawk/viewpage.h b/src/libtomahawk/viewpage.h index 2810830d1..72726f57e 100644 --- a/src/libtomahawk/viewpage.h +++ b/src/libtomahawk/viewpage.h @@ -19,15 +19,13 @@ #ifndef VIEWPAGE_H #define VIEWPAGE_H -#include - #include "typedefs.h" #include "playlistinterface.h" #include "artist.h" #include "album.h" #include "utils/tomahawkutils.h" -#include "dllmacro.h" +#include namespace Tomahawk { diff --git a/src/libtomahawk/widgets/BreadcrumbButton.cpp b/src/libtomahawk/widgets/BreadcrumbButton.cpp index 4a94b469a..aa60a5f35 100644 --- a/src/libtomahawk/widgets/BreadcrumbButton.cpp +++ b/src/libtomahawk/widgets/BreadcrumbButton.cpp @@ -22,7 +22,7 @@ #include "Breadcrumb.h" #include "combobox.h" #include "utils/stylehelper.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" #include #include diff --git a/src/libtomahawk/widgets/HeaderLabel.cpp b/src/libtomahawk/widgets/HeaderLabel.cpp index 5f5e78c2e..94ce95fe6 100644 --- a/src/libtomahawk/widgets/HeaderLabel.cpp +++ b/src/libtomahawk/widgets/HeaderLabel.cpp @@ -23,7 +23,7 @@ #include "utils/logger.h" #include "utils/stylehelper.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" static const int s_defaultFontSize = 12; diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp index 3ead1a03c..0e40a33e9 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp @@ -29,7 +29,7 @@ #include "database/databasecommand_allalbums.h" #include "utils/stylehelper.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" #include "utils/logger.h" #include "widgets/OverlayButton.h" diff --git a/src/libtomahawk/widgets/querylabel.cpp b/src/libtomahawk/widgets/querylabel.cpp index 0218bfc6d..0877f9ffe 100644 --- a/src/libtomahawk/widgets/querylabel.cpp +++ b/src/libtomahawk/widgets/querylabel.cpp @@ -27,7 +27,7 @@ #include "artist.h" #include "album.h" #include "query.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" #include "utils/logger.h" #define BOXMARGIN 2 diff --git a/src/libtomahawk/widgets/welcomewidget.h b/src/libtomahawk/widgets/welcomewidget.h index bc4bcc24e..34cfc1577 100644 --- a/src/libtomahawk/widgets/welcomewidget.h +++ b/src/libtomahawk/widgets/welcomewidget.h @@ -29,7 +29,7 @@ #include "source.h" #include "viewpage.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" #include "dllmacro.h" diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 797bf7d0c..2591cae71 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -20,6 +20,8 @@ #include "settingsdialog.h" #include "config.h" +#include "utils/tomahawkutilsgui.h" + #include #include #include @@ -417,7 +419,7 @@ SettingsDialog::testLastFmLogin() // ensure they have up-to-date settings lastfm::setNetworkAccessManager( TomahawkUtils::nam() ); - + QNetworkReply* authJob = lastfm::ws::post( query ); connect( authJob, SIGNAL( finished() ), SLOT( onLastFmFinished() ) ); @@ -877,7 +879,7 @@ ProxyDialog::saveSettings() qDebug() << Q_FUNC_INFO; QNetworkProxy::ProxyType type = static_cast< QNetworkProxy::ProxyType>( m_backwardMap[ ui->typeBox->currentIndex() ] ); - + //First set settings TomahawkSettings* s = TomahawkSettings::instance(); s->setProxyHost( ui->hostLineEdit->text() ); @@ -890,7 +892,7 @@ ProxyDialog::saveSettings() s->setProxyType( type ); s->setProxyDns( ui->checkBoxUseProxyForDns->checkState() == Qt::Checked ); s->sync(); - + TomahawkUtils::NetworkProxyFactory* proxyFactory = TomahawkUtils::proxyFactory(); tDebug() << Q_FUNC_INFO << "Got proxyFactory: " << proxyFactory; if ( type == QNetworkProxy::NoProxy ) diff --git a/src/sip/jabber/googlewrapper/googlewrapper.cpp b/src/sip/jabber/googlewrapper/googlewrapper.cpp index 1e7c107f4..df7ec7b69 100644 --- a/src/sip/jabber/googlewrapper/googlewrapper.cpp +++ b/src/sip/jabber/googlewrapper/googlewrapper.cpp @@ -20,7 +20,7 @@ #include "googlewrapper.h" #include "ui_configwidget.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" #include #include diff --git a/src/sip/jabber/jabber.cpp b/src/sip/jabber/jabber.cpp index d3df97984..2a4b42454 100644 --- a/src/sip/jabber/jabber.cpp +++ b/src/sip/jabber/jabber.cpp @@ -50,7 +50,7 @@ #endif -#include +#include #include "utils/logger.h" SipPlugin* diff --git a/src/sourcetree/items/collectionitem.cpp b/src/sourcetree/items/collectionitem.cpp index 1b33a3265..4307d5dbb 100644 --- a/src/sourcetree/items/collectionitem.cpp +++ b/src/sourcetree/items/collectionitem.cpp @@ -23,7 +23,7 @@ #include "viewmanager.h" #include "playlist.h" #include "genericpageitems.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" #include "utils/logger.h" #include "widgets/SocialPlaylistWidget.h" #include "playlist/customplaylistview.h" diff --git a/src/sourcetree/sourcedelegate.cpp b/src/sourcetree/sourcedelegate.cpp index 90d57836b..6561acb6d 100644 --- a/src/sourcetree/sourcedelegate.cpp +++ b/src/sourcetree/sourcedelegate.cpp @@ -26,7 +26,7 @@ #include "items/categoryitems.h" #include "items/temporarypageitem.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" #include "animationhelper.h" #include "source.h" #include "tomahawksettings.h" diff --git a/src/tomahawkapp.cpp b/src/tomahawkapp.cpp index 47f854fc7..9a6631804 100644 --- a/src/tomahawkapp.cpp +++ b/src/tomahawkapp.cpp @@ -59,7 +59,7 @@ #include "utils/xspfloader.h" #include "utils/jspfloader.h" #include "utils/logger.h" -#include "utils/tomahawkutils.h" +#include "utils/tomahawkutilsgui.h" #include #include "config.h" @@ -162,7 +162,7 @@ TomahawkApp::init() new ActionCollection( this ); connect( ActionCollection::instance()->getAction( "quit" ), SIGNAL( triggered() ), SLOT( quit() ), Qt::UniqueConnection ); #endif - + tDebug( LOGINFO ) << "Setting NAM."; // Cause the creation of the nam, but don't need to address it directly, so prevent warning Q_UNUSED( TomahawkUtils::nam() );