mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 15:59:42 +01:00
* Keep system font for all menus.
This commit is contained in:
parent
275bc0ac44
commit
f292e50943
@ -152,8 +152,10 @@ QMenuBar*
|
||||
ActionCollection::createMenuBar( QWidget *parent )
|
||||
{
|
||||
QMenuBar* menuBar = new QMenuBar( parent );
|
||||
menuBar->setFont( TomahawkUtils::systemFont() );
|
||||
|
||||
QMenu* controlsMenu = new QMenu( tr( "&Controls" ), menuBar );
|
||||
controlsMenu->setFont( TomahawkUtils::systemFont() );
|
||||
controlsMenu->addAction( m_actionCollection[ "playPause" ] );
|
||||
controlsMenu->addAction( m_actionCollection[ "previousTrack" ] );
|
||||
controlsMenu->addAction( m_actionCollection[ "nextTrack" ] );
|
||||
@ -168,16 +170,19 @@ ActionCollection::createMenuBar( QWidget *parent )
|
||||
controlsMenu->addAction( m_actionCollection[ "quit" ] );
|
||||
|
||||
QMenu* settingsMenu = new QMenu( tr( "&Settings" ), menuBar );
|
||||
settingsMenu->setFont( TomahawkUtils::systemFont() );
|
||||
#ifndef Q_OS_MAC
|
||||
settingsMenu->addAction( m_actionCollection[ "toggleMenuBar" ] );
|
||||
#endif
|
||||
settingsMenu->addAction( m_actionCollection[ "preferences" ] );
|
||||
|
||||
QMenu* helpMenu = new QMenu( tr( "&Help" ), menuBar );
|
||||
helpMenu->setFont( TomahawkUtils::systemFont() );
|
||||
helpMenu->addAction( m_actionCollection[ "diagnostics" ] );
|
||||
helpMenu->addAction( m_actionCollection[ "openLogfile" ] );
|
||||
helpMenu->addAction( m_actionCollection[ "legalInfo" ] );
|
||||
QMenu* whatsNew = helpMenu->addMenu( ImageRegistry::instance()->icon( RESPATH "images/whatsnew.svg" ), tr( "What's new in ..." ) );
|
||||
whatsNew->setFont( TomahawkUtils::systemFont() );
|
||||
whatsNew->addAction( m_actionCollection[ "whatsnew_0_8" ] );
|
||||
helpMenu->addAction( m_actionCollection[ "aboutTomahawk" ] );
|
||||
|
||||
@ -203,6 +208,7 @@ ActionCollection::createMenuBar( QWidget *parent )
|
||||
|
||||
#if defined( Q_OS_MAC )
|
||||
QMenu* windowMenu = new QMenu( tr( "&Window" ), menuBar );
|
||||
windowMenu->setFont( TomahawkUtils::systemFont() );
|
||||
windowMenu->addAction( m_actionCollection[ "minimize" ] );
|
||||
windowMenu->addAction( m_actionCollection[ "zoom" ] );
|
||||
windowMenu->addAction( m_actionCollection[ "fullscreen" ] );
|
||||
@ -219,6 +225,7 @@ QMenu*
|
||||
ActionCollection::createCompactMenu( QWidget *parent )
|
||||
{
|
||||
QMenu* compactMenu = new QMenu( tr( "Main Menu" ), parent );
|
||||
compactMenu->setFont( TomahawkUtils::systemFont() );
|
||||
|
||||
compactMenu->addAction( m_actionCollection[ "playPause" ] );
|
||||
compactMenu->addAction( m_actionCollection[ "previousTrack" ] );
|
||||
|
@ -44,6 +44,8 @@ ContextMenu::ContextMenu( QWidget* parent )
|
||||
, m_sources_sigmap( 0 )
|
||||
, m_loveAction( 0 )
|
||||
{
|
||||
setFont( TomahawkUtils::systemFont() );
|
||||
|
||||
m_sigmap = new QSignalMapper( this );
|
||||
connect( m_sigmap, SIGNAL( mapped( int ) ), SLOT( onTriggered( int ) ) );
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <QMenu>
|
||||
|
||||
#include "TomahawkSettings.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
|
||||
@ -32,6 +33,8 @@ ViewHeader::ViewHeader( QAbstractItemView* parent )
|
||||
, m_sigmap( new QSignalMapper( this ) )
|
||||
, m_init( false )
|
||||
{
|
||||
m_menu->setFont( TomahawkUtils::systemFont() );
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
||||
setSectionResizeMode( QHeaderView::Interactive );
|
||||
setSectionsMovable( true );
|
||||
|
@ -61,6 +61,7 @@ extern void qt_blurImage( QPainter *p, QImage &blurImage, qreal radius, bool qua
|
||||
|
||||
namespace TomahawkUtils
|
||||
{
|
||||
static QFont s_systemFont;
|
||||
static int s_defaultFontSize = 0;
|
||||
static int s_defaultFontHeight = 0;
|
||||
|
||||
@ -397,6 +398,20 @@ setDefaultFontSize( int points )
|
||||
}
|
||||
|
||||
|
||||
QFont
|
||||
systemFont()
|
||||
{
|
||||
return s_systemFont;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
setSystemFont( QFont font )
|
||||
{
|
||||
s_systemFont = font;
|
||||
}
|
||||
|
||||
|
||||
QSize
|
||||
defaultIconSize()
|
||||
{
|
||||
|
@ -23,12 +23,13 @@
|
||||
#include "TomahawkUtils.h"
|
||||
#include "DllMacro.h"
|
||||
|
||||
#include <QSize>
|
||||
#include <QModelIndex>
|
||||
#include <QColor>
|
||||
#include <QRect>
|
||||
#include <QTextOption>
|
||||
#include <QFont>
|
||||
#include <QImage>
|
||||
#include <QModelIndex>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QTextOption>
|
||||
|
||||
// include contains typedefs for Qt4/Qt5 compatibility
|
||||
#include <QStyleOption>
|
||||
@ -63,6 +64,8 @@ namespace TomahawkUtils
|
||||
DLLEXPORT int defaultFontSize();
|
||||
DLLEXPORT int defaultFontHeight();
|
||||
DLLEXPORT QSize defaultIconSize();
|
||||
DLLEXPORT void setSystemFont( QFont font );
|
||||
DLLEXPORT QFont systemFont();
|
||||
|
||||
DLLEXPORT void prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item );
|
||||
|
||||
|
@ -30,7 +30,7 @@ CaptionLabel::CaptionLabel( QWidget* parent )
|
||||
, m_parent( parent )
|
||||
, m_showCloseButton( false )
|
||||
{
|
||||
QFont f( "Roboto" );
|
||||
QFont f = font();
|
||||
f.setPointSize( 10 );
|
||||
setFont( f );
|
||||
|
||||
|
@ -183,6 +183,7 @@ TomahawkApp::init()
|
||||
|
||||
TomahawkStyle::loadFonts();
|
||||
QFont f = font();
|
||||
TomahawkUtils::setSystemFont( f );
|
||||
f.setFamily( "Roboto" );
|
||||
#ifndef Q_OS_MAC
|
||||
f.setPointSize( 10 );
|
||||
@ -237,7 +238,7 @@ TomahawkApp::init()
|
||||
QByteArray magic = QByteArray::fromBase64( enApiSecret );
|
||||
QByteArray wand = QByteArray::fromBase64( QCoreApplication::applicationName().toLatin1() );
|
||||
int length = magic.length(), n2 = wand.length();
|
||||
for ( int i=0; i<length; i++ ) magic[i] = magic[i] ^ wand[i%n2];
|
||||
for ( int i = 0; i < length; i++ ) magic[i] = magic[i] ^ wand[i%n2];
|
||||
Echonest::Config::instance()->setAPIKey( magic );
|
||||
|
||||
tDebug() << "Init Echonest Factory.";
|
||||
@ -274,7 +275,7 @@ TomahawkApp::init()
|
||||
}
|
||||
|
||||
connect( Playlist::removalHandler().data(), SIGNAL( aboutToBeDeletePlaylist( Tomahawk::playlist_ptr ) ),
|
||||
SLOT( playlistRemoved( Tomahawk::playlist_ptr ) ));
|
||||
SLOT( playlistRemoved( Tomahawk::playlist_ptr ) ));
|
||||
|
||||
tDebug() << "Init InfoSystem.";
|
||||
m_infoSystem = QPointer<Tomahawk::InfoSystem::InfoSystem>( Tomahawk::InfoSystem::InfoSystem::instance() );
|
||||
@ -298,7 +299,6 @@ TomahawkApp::~TomahawkApp()
|
||||
delete m_scanManager.data();
|
||||
|
||||
delete Tomahawk::Accounts::AccountManager::instance();
|
||||
|
||||
delete AtticaManager::instance();
|
||||
delete m_mainwindow;
|
||||
|
||||
|
@ -64,8 +64,8 @@ namespace Tomahawk
|
||||
}
|
||||
|
||||
#ifdef LIBLASTFM_FOUND
|
||||
#include <lastfm/NetworkAccessManager.h>
|
||||
#include "Scrobbler.h"
|
||||
#include <lastfm/NetworkAccessManager.h>
|
||||
#include "Scrobbler.h"
|
||||
#endif
|
||||
|
||||
class TomahawkWindow;
|
||||
|
@ -52,6 +52,7 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
refreshToolTip();
|
||||
|
||||
m_contextMenu = new QMenu();
|
||||
m_contextMenu->setFont( TomahawkUtils::systemFont() );
|
||||
setContextMenu( m_contextMenu );
|
||||
|
||||
m_loveTrackAction = new QAction( this );
|
||||
|
@ -688,6 +688,8 @@ TomahawkWindow::setupMenuBar()
|
||||
{
|
||||
// Always create a menubar, but only create a compactMenu on Windows and X11
|
||||
m_menuBar = ActionCollection::instance()->createMenuBar( this );
|
||||
m_menuBar->setFont( TomahawkUtils::systemFont() );
|
||||
|
||||
setMenuBar( m_menuBar );
|
||||
#ifndef Q_OS_MAC
|
||||
m_compactMainMenu = ActionCollection::instance()->createCompactMenu( this );
|
||||
|
@ -74,6 +74,11 @@ SourceTreeView::SourceTreeView( QWidget* parent )
|
||||
setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||
setContentsMargins( 0, 0, 0, 0 );
|
||||
|
||||
m_playlistMenu.setFont( TomahawkUtils::systemFont() );
|
||||
m_roPlaylistMenu.setFont( TomahawkUtils::systemFont() );
|
||||
m_latchMenu.setFont( TomahawkUtils::systemFont() );
|
||||
m_privacyMenu.setFont( TomahawkUtils::systemFont() );
|
||||
|
||||
QFont fnt = font();
|
||||
QFontMetrics fm( fnt );
|
||||
// This is sort of the longest string in there. With translations
|
||||
@ -724,6 +729,7 @@ SourceTreeView::onCustomContextMenu( const QPoint& pos )
|
||||
else if ( !customActions.isEmpty() )
|
||||
{
|
||||
QMenu customMenu;
|
||||
customMenu.setFont( TomahawkUtils::systemFont() );
|
||||
customMenu.addActions( customActions );
|
||||
customMenu.exec( mapToGlobal( pos ) );
|
||||
}
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMenu>
|
||||
#include <QPixmap>
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
|
||||
ContainedMenuButton::ContainedMenuButton( QWidget *parent )
|
||||
: QToolButton( parent )
|
||||
{
|
||||
@ -29,6 +31,7 @@ void
|
||||
ContainedMenuButton::setMenu( QMenu *menu )
|
||||
{
|
||||
m_menu = menu;
|
||||
m_menu->setFont( TomahawkUtils::systemFont() );
|
||||
connect( m_menu, SIGNAL( aboutToHide() ), SLOT( menuHidden() ) );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user