1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-13 04:21:51 +02:00

* Use new TomahawkStyle namespace throughout Tomahawk.

This commit is contained in:
Christian Muehlhaeuser 2013-04-29 17:48:37 +02:00
parent 7276b805d5
commit 082cedda17
13 changed files with 57 additions and 45 deletions

View File

@ -24,6 +24,7 @@
#include "Source.h"
#include "utils/ImageRegistry.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"
@ -70,7 +71,7 @@ SocialWidget::SocialWidget( QWidget* parent )
ui->buttonBox->button( QDialogButtonBox::Ok )->setIcon( ImageRegistry::instance()->icon( RESPATH "images/tweet.svg" ) );
ui->buttonBox->button( QDialogButtonBox::Cancel )->setIcon( ImageRegistry::instance()->icon( RESPATH "images/cancel.svg" ) );
ui->textEdit->setStyleSheet( "border: 1px solid " + TomahawkUtils::Colors::BORDER_LINE.name() );
ui->textEdit->setStyleSheet( "border: 1px solid " + TomahawkStyle::BORDER_LINE.name() );
m_parent->installEventFilter( this );
@ -144,16 +145,16 @@ SocialWidget::paintEvent( QPaintEvent* event )
QPainterPath outline;
QRect r = contentsRect();
outline.addRoundedRect( r, TomahawkUtils::POPUP_ROUNDING_RADIUS, TomahawkUtils::POPUP_ROUNDING_RADIUS );
outline.addRoundedRect( r, TomahawkStyle::POPUP_ROUNDING_RADIUS, TomahawkStyle::POPUP_ROUNDING_RADIUS );
outline.moveTo( r.right() - ARROW_HEIGHT * 2, r.bottom() + 1 );
outline.lineTo( r.right() - ARROW_HEIGHT * 3, r.bottom() + 1 + ARROW_HEIGHT );
outline.lineTo( r.right() - ARROW_HEIGHT * 4, r.bottom() + 1 );
TomahawkUtils::drawCompositedPopup( this,
outline,
TomahawkUtils::Colors::BORDER_LINE,
TomahawkUtils::Colors::POPUP_BACKGROUND,
TomahawkUtils::POPUP_OPACITY );
TomahawkStyle::BORDER_LINE,
TomahawkStyle::POPUP_BACKGROUND,
TomahawkStyle::POPUP_OPACITY );
}

View File

@ -35,6 +35,7 @@
#include "playlist/PlayableItem.h"
#include "playlist/PlayableProxyModel.h"
#include "widgets/ImageButton.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/PixmapDelegateFader.h"
#include "utils/Closure.h"
@ -198,7 +199,7 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
painter->drawRect( gradientRect );
painter->restore();
painter->setPen( TomahawkUtils::Colors::SELECTION_FOREGROUND );
painter->setPen( TomahawkStyle::SELECTION_FOREGROUND );
QRect textRect = option.rect.adjusted( 6, option.rect.height() - frameHeight, -6, -6 );
bool oneLiner = false;
@ -226,7 +227,7 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
if ( m_hoveringOver == index )
{
TomahawkUtils::drawQueryBackground( painter, r );
painter->setPen( TomahawkUtils::Colors::SELECTION_FOREGROUND );
painter->setPen( TomahawkStyle::SELECTION_FOREGROUND );
}
to.setAlignment( Qt::AlignHCenter | Qt::AlignBottom );

View File

@ -28,6 +28,7 @@
#include "Query.h"
#include "Result.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"
#include "utils/Closure.h"
@ -122,9 +123,9 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
if ( item->isPlaying() )
{
textColor = TomahawkUtils::Colors::NOW_PLAYING_ITEM_TEXT;
o.palette.setColor( QPalette::Highlight, TomahawkUtils::Colors::NOW_PLAYING_ITEM );
o.palette.setColor( QPalette::Text, TomahawkUtils::Colors::NOW_PLAYING_ITEM_TEXT );
textColor = TomahawkStyle::NOW_PLAYING_ITEM_TEXT;
o.palette.setColor( QPalette::Highlight, TomahawkStyle::NOW_PLAYING_ITEM );
o.palette.setColor( QPalette::Text, TomahawkStyle::NOW_PLAYING_ITEM_TEXT );
o.state |= QStyle::State_Selected;
}

View File

@ -25,7 +25,7 @@
#include <QWidget>
#include "utils/Logger.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/TomahawkStyle.h"
#define ARROW_WIDTH 7
#define ARROW_HEIGHT 7
@ -89,7 +89,7 @@ ProxyStyle::drawControl( ControlElement ce, const QStyleOption* opt, QPainter* p
const QSplitter* splitter = qobject_cast< const QSplitter* >( w );
if ( !splitter->sizes().contains( 0 ) )
{
p->setPen( TomahawkUtils::Colors::BORDER_LINE );
p->setPen( TomahawkStyle::BORDER_LINE );
// We must special-case this because of the AnimatedSplitterHandle which has a
// SizeHint of 0,0.
if( splitter->orientation() == Qt::Vertical )

View File

@ -26,6 +26,7 @@
#include "Result.h"
#include "Source.h"
#include "ImageRegistry.h"
#include "TomahawkStyle.h"
#include "Logger.h"
#include <QLayout>
@ -206,8 +207,8 @@ drawQueryBackground( QPainter* p, const QRect& r )
{
p->save();
p->setPen( Colors::SELECTION_BACKGROUND );
p->setBrush( Colors::SELECTION_BACKGROUND );
p->setPen( TomahawkStyle::SELECTION_BACKGROUND );
p->setBrush( TomahawkStyle::SELECTION_BACKGROUND );
p->drawRoundedRect( r, 4.0, 4.0 );
p->restore();
@ -739,9 +740,9 @@ prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, Pl
if ( item->isPlaying() )
{
option->backgroundBrush = TomahawkUtils::Colors::NOW_PLAYING_ITEM;
option->palette.setColor( QPalette::Highlight, TomahawkUtils::Colors::NOW_PLAYING_ITEM.lighter() );
option->palette.setColor( QPalette::Text, TomahawkUtils::Colors::NOW_PLAYING_ITEM_TEXT );
option->backgroundBrush = TomahawkStyle::NOW_PLAYING_ITEM;
option->palette.setColor( QPalette::Highlight, TomahawkStyle::NOW_PLAYING_ITEM.lighter() );
option->palette.setColor( QPalette::Text, TomahawkStyle::NOW_PLAYING_ITEM_TEXT );
}
else if ( option->state & QStyle::State_Selected )

View File

@ -24,6 +24,7 @@
#include "ViewManager.h"
#include "audio/AudioEngine.h"
#include "widgets/ImageButton.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"
@ -273,7 +274,7 @@ PlayableCover::paintEvent( QPaintEvent* event )
if ( m_hoveredRect == r )
{
TomahawkUtils::drawQueryBackground( &bufpainter, r );
bufpainter.setPen( TomahawkUtils::Colors::SELECTION_FOREGROUND );
bufpainter.setPen( TomahawkStyle::SELECTION_FOREGROUND );
}
to.setAlignment( Qt::AlignHCenter | Qt::AlignBottom );

View File

@ -22,6 +22,7 @@
#include "Album.h"
#include "Query.h"
#include "ContextMenu.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"
#include "ViewManager.h"
@ -380,8 +381,8 @@ QueryLabel::paintEvent( QPaintEvent* event )
{
if ( m_hoverArea.width() )
{
p.setBrush( TomahawkUtils::Colors::SELECTION_BACKGROUND );
p.setPen( TomahawkUtils::Colors::SELECTION_FOREGROUND );
p.setBrush( TomahawkStyle::SELECTION_BACKGROUND );
p.setPen( TomahawkStyle::SELECTION_FOREGROUND );
}
else
{
@ -405,8 +406,8 @@ QueryLabel::paintEvent( QPaintEvent* event )
if ( m_hoverType == Artist )
{
p.setBrush( TomahawkUtils::Colors::SELECTION_BACKGROUND );
p.setPen( TomahawkUtils::Colors::SELECTION_FOREGROUND );
p.setBrush( TomahawkStyle::SELECTION_BACKGROUND );
p.setPen( TomahawkStyle::SELECTION_FOREGROUND );
}
p.drawText( r, m_align, artist()->name() );
@ -424,8 +425,8 @@ QueryLabel::paintEvent( QPaintEvent* event )
}
if ( m_hoverType == Album )
{
p.setBrush( TomahawkUtils::Colors::SELECTION_BACKGROUND );
p.setPen( TomahawkUtils::Colors::SELECTION_FOREGROUND );
p.setBrush( TomahawkStyle::SELECTION_BACKGROUND );
p.setPen( TomahawkStyle::SELECTION_FOREGROUND );
}
p.drawText( r, m_align, album()->name() );
@ -443,8 +444,8 @@ QueryLabel::paintEvent( QPaintEvent* event )
}
if ( m_hoverType == Track )
{
p.setBrush( TomahawkUtils::Colors::SELECTION_BACKGROUND );
p.setPen( TomahawkUtils::Colors::SELECTION_FOREGROUND );
p.setBrush( TomahawkStyle::SELECTION_BACKGROUND );
p.setPen( TomahawkStyle::SELECTION_FOREGROUND );
}
p.drawText( r, m_align, track() );

View File

@ -34,6 +34,7 @@
#include "SourceTreePopupDialog_mac.h"
#endif
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/ImageRegistry.h"
@ -58,7 +59,7 @@ SourceTreePopupDialog::SourceTreePopupDialog()
m_title = new QLabel( this );
QFont titleFont = m_title->font();
titleFont.setBold( true );
m_title->setStyleSheet( "color: " + TomahawkUtils::Colors::GROUP_HEADER.name() );
m_title->setStyleSheet( "color: " + TomahawkStyle::GROUP_HEADER.name() );
titleFont.setPointSize( TomahawkUtils::defaultFontSize() + 1 );
m_title->setFont( titleFont );
m_title->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
@ -84,7 +85,7 @@ SourceTreePopupDialog::SourceTreePopupDialog()
m_separatorLine->setFixedHeight( 1 );
m_separatorLine->setContentsMargins( 0, 0, 0, 0 );
m_separatorLine->setStyleSheet( "QWidget { border-top: 1px solid " +
TomahawkUtils::Colors::BORDER_LINE.name() + "; }" );
TomahawkStyle::BORDER_LINE.name() + "; }" );
m_layout->addWidget( m_separatorLine );
m_layout->addWidget( m_label );
m_layout->addWidget( m_buttons );
@ -185,7 +186,7 @@ SourceTreePopupDialog::paintEvent( QPaintEvent* event )
// Constants for painting
const int leftTriangleWidth = 12;
const int cornerRounding = TomahawkUtils::POPUP_ROUNDING_RADIUS;
const int cornerRounding = TomahawkStyle::POPUP_ROUNDING_RADIUS;
const int leftEdgeOffset = 2 /*margin*/ + leftTriangleWidth / 2;
const QRect brect = rect().adjusted( 2, 3, -2, -3 );
@ -205,13 +206,13 @@ SourceTreePopupDialog::paintEvent( QPaintEvent* event )
#ifndef Q_OS_MAC
TomahawkUtils::drawCompositedPopup( this,
outline,
TomahawkUtils::Colors::BORDER_LINE,
TomahawkUtils::Colors::POPUP_BACKGROUND,
TomahawkUtils::POPUP_OPACITY );
TomahawkStyle::BORDER_LINE,
TomahawkStyle::POPUP_BACKGROUND,
TomahawkStyle::POPUP_OPACITY );
#else
TomahawkUtils::drawCompositedPopup( this,
outline,
TomahawkUtils::Colors::BORDER_LINE,
TomahawkStyle::BORDER_LINE,
QColor( "#D6E3F1" ),
0.93 );
#endif

View File

@ -39,6 +39,7 @@
#include "ContextMenu.h"
#include "resolvers/ScriptCollection.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"
@ -376,7 +377,7 @@ SourceDelegate::paintCategory( QPainter* painter, const QStyleOptionViewItem& op
painter->setPen( Qt::white );
painter->drawText( option.rect.translated( 4, 1 ), index.data().toString().toUpper(), to );
painter->setPen( TomahawkUtils::Colors::GROUP_HEADER );
painter->setPen( TomahawkStyle::GROUP_HEADER );
painter->drawText( option.rect.translated( 4, 0 ), index.data().toString().toUpper(), to );
if ( option.state & QStyle::State_MouseOver )
@ -393,7 +394,7 @@ SourceDelegate::paintCategory( QPainter* painter, const QStyleOptionViewItem& op
// draw close icon
painter->setPen( Qt::white );
painter->drawText( option.rect.translated( -4, 1 ), text, to );
painter->setPen( TomahawkUtils::Colors::GROUP_HEADER );
painter->setPen( TomahawkStyle::GROUP_HEADER );
painter->drawText( option.rect.translated( -4, 0 ), text, to );
}
@ -417,7 +418,7 @@ SourceDelegate::paintGroup( QPainter* painter, const QStyleOptionViewItem& optio
painter->setPen( Qt::white );
painter->drawText( option.rect.translated( 4, 1 ), index.data().toString().toUpper(), to );
painter->setPen( TomahawkUtils::Colors::GROUP_HEADER );
painter->setPen( TomahawkStyle::GROUP_HEADER );
painter->drawText( option.rect.translated( 4, 0 ), index.data().toString().toUpper(), to );
if ( option.state & QStyle::State_MouseOver )
@ -434,7 +435,7 @@ SourceDelegate::paintGroup( QPainter* painter, const QStyleOptionViewItem& optio
// draw close icon
painter->setPen( Qt::white );
painter->drawText( option.rect.translated( -4, 1 ), text, to );
painter->setPen( TomahawkUtils::Colors::GROUP_HEADER );
painter->setPen( TomahawkStyle::GROUP_HEADER );
painter->drawText( option.rect.translated( -4, 0 ), text, to );
}

View File

@ -22,6 +22,7 @@
#include "accounts/AccountManager.h"
#include "AccountWidget.h"
#include "utils/ImageRegistry.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"
@ -55,14 +56,14 @@ AccountListWidget::AccountListWidget( AccountModelFactoryProxy* model, QWidget*
separatorLine->setFixedHeight( 1 );
separatorLine->setContentsMargins( 0, 0, 0, 0 );
separatorLine->setStyleSheet( "QWidget { border-top: 1px solid " +
TomahawkUtils::Colors::BORDER_LINE.name() + "; }" ); //from ProxyStyle
TomahawkStyle::BORDER_LINE.name() + "; }" ); //from ProxyStyle
mainLayout->insertWidget( 0, separatorLine );
mainLayout->addSpacing( 6 );
QLabel *connectionsLabel = new QLabel( tr( "Connections" ).toUpper(), this );
QFont clFont = connectionsLabel->font();
clFont.setBold( true );
connectionsLabel->setStyleSheet( "color: " + TomahawkUtils::Colors::GROUP_HEADER.name() );
connectionsLabel->setStyleSheet( "color: " + TomahawkStyle::GROUP_HEADER.name() );
clFont.setPointSize( TomahawkUtils::defaultFontSize() + 1 );
connectionsLabel->setFont( clFont );
connectionsLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );

View File

@ -24,6 +24,7 @@
#include "accounts/AccountModel.h"
#include "accounts/AccountManager.h"
#include "sip/SipPlugin.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/AnimatedSpinner.h"
#include "widgets/ElidedLabel.h"
@ -102,7 +103,7 @@ AccountWidget::AccountWidget( QWidget* parent )
m_inviteContainer = new UnstyledFrame( this );
vLayout->addWidget( m_inviteContainer, 1, 0 );
m_inviteContainer->setFrameColor( TomahawkUtils::Colors::BORDER_LINE );
m_inviteContainer->setFrameColor( TomahawkStyle::BORDER_LINE );
m_inviteContainer->setMinimumWidth( m_inviteContainer->logicalDpiX() * 2 );
m_inviteContainer->setContentsMargins( 1, 1, 1, 2 );
m_inviteContainer->setAttribute( Qt::WA_TranslucentBackground, false );

View File

@ -19,6 +19,7 @@
#include "AccountsPopupWidget.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include <QDebug>
@ -92,7 +93,7 @@ void
AccountsPopupWidget::paintEvent( QPaintEvent* )
{
// Constants for painting
const int cornerRadius = TomahawkUtils::POPUP_ROUNDING_RADIUS; //the rounding radius of the widget
const int cornerRadius = TomahawkStyle::POPUP_ROUNDING_RADIUS; //the rounding radius of the widget
const int arrowHeight = 6;
//m_arrowOffset is the distance between the far right boundary and the x value of the arrow head.
@ -111,9 +112,9 @@ AccountsPopupWidget::paintEvent( QPaintEvent* )
TomahawkUtils::drawCompositedPopup( this,
outline,
TomahawkUtils::Colors::BORDER_LINE,
TomahawkUtils::Colors::POPUP_BACKGROUND,
TomahawkUtils::POPUP_OPACITY );
TomahawkStyle::BORDER_LINE,
TomahawkStyle::POPUP_BACKGROUND,
TomahawkStyle::POPUP_OPACITY );
}

View File

@ -20,6 +20,7 @@
#include "AccountListWidget.h"
#include "accounts/AccountManager.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include <QLabel>
@ -78,7 +79,7 @@ AccountsToolButton::AccountsToolButton( QWidget* parent )
separatorLine->setFixedHeight( 1 );
separatorLine->setContentsMargins( 0, 0, 0, 0 );
separatorLine->setStyleSheet( "QWidget { border-top: 1px solid " +
TomahawkUtils::Colors::BORDER_LINE.name() + "; }" ); //from ProxyStyle
TomahawkStyle::BORDER_LINE.name() + "; }" ); //from ProxyStyle
wMainLayout->addWidget( separatorLine );
wMainLayout->addSpacing( 6 );