1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 00:09:47 +01:00

Consistent size for all headers in the view

This commit is contained in:
Leo Franchi 2011-10-17 17:45:06 -04:00
parent a708f37cd6
commit 3f9c2366f2
7 changed files with 44 additions and 5 deletions

View File

@ -62,6 +62,9 @@
namespace TomahawkUtils
{
static int s_headerHeight = 0;
#ifdef Q_WS_MAC
QString
appSupportFolderPath()
@ -445,8 +448,8 @@ unmarginLayout( QLayout* layout )
}
QWeakPointer< QNetworkAccessManager > s_nam;
NetworkProxyFactory* s_proxyFactory = 0;
static QWeakPointer< QNetworkAccessManager > s_nam;
static NetworkProxyFactory* s_proxyFactory = 0;
QList< QNetworkProxy >
@ -650,4 +653,17 @@ crash()
*a = 1;
}
int
headerHeight()
{
return s_headerHeight;
}
void
setHeaderHeight( int height )
{
s_headerHeight = height;
}
} // ns

View File

@ -101,6 +101,9 @@ namespace TomahawkUtils
DLLEXPORT QPixmap createAvatarFrame( const QPixmap &avatar );
DLLEXPORT void crash();
DLLEXPORT int headerHeight();
DLLEXPORT void setHeaderHeight( int height );
}
#endif // TOMAHAWKUTILS_H

View File

@ -23,9 +23,10 @@
#include "utils/logger.h"
#include "utils/stylehelper.h"
#include "utils/tomahawkutils.h"
#define FONT_SIZE 16
static const int s_defaultFontSize = 12;
HeaderLabel::HeaderLabel( QWidget* parent )
: QLabel( parent )
@ -33,10 +34,10 @@ HeaderLabel::HeaderLabel( QWidget* parent )
{
QFont f( font() );
f.setBold( true );
f.setPixelSize( 12 );
f.setPixelSize( s_defaultFontSize );
setFont( f );
setFixedHeight( sizeHint().height() + 8 );
setFixedHeight( TomahawkUtils::headerHeight() );
}
@ -51,6 +52,12 @@ HeaderLabel::sizeHint() const
return QLabel::sizeHint();
}
int
HeaderLabel::defaultFontSize()
{
return s_defaultFontSize;
}
void
HeaderLabel::mousePressEvent( QMouseEvent* event )

View File

@ -39,6 +39,8 @@ public:
QSize minimumSizeHint() const { return sizeHint(); }
QSize sizeHint() const;
static int defaultFontSize();
signals:
void clicked();

View File

@ -20,6 +20,7 @@
#include "combobox.h"
#include "utils/stylehelper.h"
#include "utils/tomahawkutils.h"
#include <QTimer>
#include <QDebug>
@ -37,6 +38,7 @@ SiblingCrumbButton::SiblingCrumbButton(
: BreadcrumbButtonBase(parent),
m_index(index), m_combo( new ComboBox(this) )
{
setFixedHeight( TomahawkUtils::headerHeight() );
m_combo->setSizeAdjustPolicy( QComboBox::AdjustToContents );
setIndex(index);
connect(m_combo, SIGNAL(activated(int)), SLOT(comboboxActivated(int)));

View File

@ -1,6 +1,7 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -57,6 +58,7 @@
#include "utils/spotifyparser.h"
#include "dropjob.h"
#include "EchonestCatalogSynchronizer.h"
#include "widgets/HeaderLabel.h"
#include "audio/audioengine.h"
#include "utils/xspfloader.h"
@ -148,6 +150,11 @@ TomahawkApp::init()
setQuitOnLastWindowClosed( false );
#endif
QFont f = APP->font();
f.setPixelSize( HeaderLabel::defaultFontSize() );
QFontMetrics fm( f );
TomahawkUtils::setHeaderHeight( fm.height() + 8 );
registerMetaTypes();
new TomahawkSettings( this );

View File

@ -1,6 +1,7 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -69,6 +70,7 @@
#include "utils/logger.h"
#include "jobview/JobStatusModel.h"
#include "LoadXSPFDialog.h"
#include <widgets/HeaderLabel.h>
using namespace Tomahawk;