diff --git a/src/tomahawk/TomahawkWindow.cpp b/src/tomahawk/TomahawkWindow.cpp index c259dd00a..9ca96eb00 100644 --- a/src/tomahawk/TomahawkWindow.cpp +++ b/src/tomahawk/TomahawkWindow.cpp @@ -102,6 +102,7 @@ using namespace Accounts; TomahawkWindow::TomahawkWindow( QWidget* parent ) : QMainWindow( parent ) + , TomahawkUtils::DpiScaler( this ) #ifdef Q_OS_WIN , m_buttonCreatedID( RegisterWindowMessage( L"TaskbarButtonCreated" ) ) #ifdef HAVE_THUMBBUTTON @@ -263,7 +264,11 @@ TomahawkWindow::setupToolBar() m_toolbar->setObjectName( "TomahawkToolbar" ); m_toolbar->setMovable( false ); m_toolbar->setFloatable( false ); +#ifdef Q_OS_MAC m_toolbar->setIconSize( QSize( 22, 22 ) ); +#else + m_toolbar->setIconSize( scaled( 22, 22 ) ); +#endif m_toolbar->setToolButtonStyle( Qt::ToolButtonIconOnly ); m_toolbar->setStyleSheet( "border-bottom: 0px" ); // If the toolbar is hidden accidentally it causes trouble on Unity because the user can't @@ -275,9 +280,15 @@ TomahawkWindow::setupToolBar() m_toolbar->installEventFilter( new WidgetDragFilter( m_toolbar ) ); #endif - m_backAction = m_toolbar->addAction( ImageRegistry::instance()->icon( RESPATH "images/back.svg" ), tr( "Back" ), ViewManager::instance(), SLOT( historyBack() ) ); + m_backAction = m_toolbar->addAction( ImageRegistry::instance()->pixmap( RESPATH "images/back.svg", m_toolbar->iconSize() ), + tr( "Back" ), + ViewManager::instance(), + SLOT( historyBack() ) ); m_backAction->setToolTip( tr( "Go back one page" ) ); - m_forwardAction = m_toolbar->addAction( ImageRegistry::instance()->icon( RESPATH "images/forward.svg" ), tr( "Forward" ), ViewManager::instance(), SLOT( historyForward() ) ); + m_forwardAction = m_toolbar->addAction( ImageRegistry::instance()->pixmap( RESPATH "images/forward.svg", m_toolbar->iconSize() ), + tr( "Forward" ), + ViewManager::instance(), + SLOT( historyForward() ) ); m_forwardAction->setToolTip( tr( "Go forward one page" ) ); m_toolbarLeftBalancer = new QWidget( this ); @@ -292,7 +303,7 @@ TomahawkWindow::setupToolBar() m_searchWidget = new QSearchField( this ); m_searchWidget->setPlaceholderText( tr( "Search for any artist, album or song..." ) ); m_searchWidget->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); - m_searchWidget->setFixedWidth( 340 ); + m_searchWidget->setFixedWidth( scaledX( 340 ) ); connect( m_searchWidget, SIGNAL( returnPressed() ), this, SLOT( onFilterEdited() ) ); // Use Ctrl+F to focus the searchWidget QShortcut *shortcut = new QShortcut( QKeySequence( QKeySequence::Find ), this ); @@ -316,7 +327,7 @@ TomahawkWindow::setupToolBar() #ifndef Q_OS_MAC ContainedMenuButton* compactMenuButton = new ContainedMenuButton( m_toolbar ); - compactMenuButton->setIcon( ImageRegistry::instance()->icon( RESPATH "images/configure.svg" ) ); + compactMenuButton->setIcon( ImageRegistry::instance()->pixmap( RESPATH "images/configure.svg", m_toolbar->iconSize() ) ); compactMenuButton->setText( tr( "&Main Menu" ) ); compactMenuButton->setMenu( m_compactMainMenu ); compactMenuButton->setToolButtonStyle( Qt::ToolButtonIconOnly ); diff --git a/src/tomahawk/TomahawkWindow.h b/src/tomahawk/TomahawkWindow.h index be262dc6f..f4023040a 100644 --- a/src/tomahawk/TomahawkWindow.h +++ b/src/tomahawk/TomahawkWindow.h @@ -25,6 +25,7 @@ #include "Result.h" #include "audio/AudioEngine.h" #include "utils/XspfLoader.h" +#include "utils/DpiScaler.h" #include "config.h" @@ -67,7 +68,7 @@ namespace Ui class GlobalSearchWidget; } -class TomahawkWindow : public QMainWindow +class TomahawkWindow : public QMainWindow, private TomahawkUtils::DpiScaler { Q_OBJECT