1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 20:00:13 +02:00

Fix main toolbar scaling.

This commit is contained in:
Teo Mrnjavac
2013-07-31 12:59:18 +02:00
parent 5ef100f526
commit 6a821eef2e
2 changed files with 17 additions and 5 deletions

View File

@@ -102,6 +102,7 @@ using namespace Accounts;
TomahawkWindow::TomahawkWindow( QWidget* parent ) TomahawkWindow::TomahawkWindow( QWidget* parent )
: QMainWindow( parent ) : QMainWindow( parent )
, TomahawkUtils::DpiScaler( this )
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
, m_buttonCreatedID( RegisterWindowMessage( L"TaskbarButtonCreated" ) ) , m_buttonCreatedID( RegisterWindowMessage( L"TaskbarButtonCreated" ) )
#ifdef HAVE_THUMBBUTTON #ifdef HAVE_THUMBBUTTON
@@ -263,7 +264,11 @@ TomahawkWindow::setupToolBar()
m_toolbar->setObjectName( "TomahawkToolbar" ); m_toolbar->setObjectName( "TomahawkToolbar" );
m_toolbar->setMovable( false ); m_toolbar->setMovable( false );
m_toolbar->setFloatable( false ); m_toolbar->setFloatable( false );
#ifdef Q_OS_MAC
m_toolbar->setIconSize( QSize( 22, 22 ) ); m_toolbar->setIconSize( QSize( 22, 22 ) );
#else
m_toolbar->setIconSize( scaled( 22, 22 ) );
#endif
m_toolbar->setToolButtonStyle( Qt::ToolButtonIconOnly ); m_toolbar->setToolButtonStyle( Qt::ToolButtonIconOnly );
m_toolbar->setStyleSheet( "border-bottom: 0px" ); m_toolbar->setStyleSheet( "border-bottom: 0px" );
// If the toolbar is hidden accidentally it causes trouble on Unity because the user can't // 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 ) ); m_toolbar->installEventFilter( new WidgetDragFilter( m_toolbar ) );
#endif #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_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_forwardAction->setToolTip( tr( "Go forward one page" ) );
m_toolbarLeftBalancer = new QWidget( this ); m_toolbarLeftBalancer = new QWidget( this );
@@ -292,7 +303,7 @@ TomahawkWindow::setupToolBar()
m_searchWidget = new QSearchField( this ); m_searchWidget = new QSearchField( this );
m_searchWidget->setPlaceholderText( tr( "Search for any artist, album or song..." ) ); m_searchWidget->setPlaceholderText( tr( "Search for any artist, album or song..." ) );
m_searchWidget->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); m_searchWidget->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
m_searchWidget->setFixedWidth( 340 ); m_searchWidget->setFixedWidth( scaledX( 340 ) );
connect( m_searchWidget, SIGNAL( returnPressed() ), this, SLOT( onFilterEdited() ) ); connect( m_searchWidget, SIGNAL( returnPressed() ), this, SLOT( onFilterEdited() ) );
// Use Ctrl+F to focus the searchWidget // Use Ctrl+F to focus the searchWidget
QShortcut *shortcut = new QShortcut( QKeySequence( QKeySequence::Find ), this ); QShortcut *shortcut = new QShortcut( QKeySequence( QKeySequence::Find ), this );
@@ -316,7 +327,7 @@ TomahawkWindow::setupToolBar()
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
ContainedMenuButton* compactMenuButton = new ContainedMenuButton( m_toolbar ); 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->setText( tr( "&Main Menu" ) );
compactMenuButton->setMenu( m_compactMainMenu ); compactMenuButton->setMenu( m_compactMainMenu );
compactMenuButton->setToolButtonStyle( Qt::ToolButtonIconOnly ); compactMenuButton->setToolButtonStyle( Qt::ToolButtonIconOnly );

View File

@@ -25,6 +25,7 @@
#include "Result.h" #include "Result.h"
#include "audio/AudioEngine.h" #include "audio/AudioEngine.h"
#include "utils/XspfLoader.h" #include "utils/XspfLoader.h"
#include "utils/DpiScaler.h"
#include "config.h" #include "config.h"
@@ -67,7 +68,7 @@ namespace Ui
class GlobalSearchWidget; class GlobalSearchWidget;
} }
class TomahawkWindow : public QMainWindow class TomahawkWindow : public QMainWindow, private TomahawkUtils::DpiScaler
{ {
Q_OBJECT Q_OBJECT