From 082cedda17c60c626cd6fa6df910003de269d10b Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser <muesli@gmail.com> Date: Mon, 29 Apr 2013 17:48:37 +0200 Subject: [PATCH] * Use new TomahawkStyle namespace throughout Tomahawk. --- src/SocialWidget.cpp | 11 ++++++----- src/libtomahawk/playlist/GridItemDelegate.cpp | 5 +++-- src/libtomahawk/playlist/TreeItemDelegate.cpp | 7 ++++--- src/libtomahawk/utils/ProxyStyle.cpp | 4 ++-- src/libtomahawk/utils/TomahawkUtilsGui.cpp | 11 ++++++----- src/libtomahawk/widgets/PlayableCover.cpp | 3 ++- src/libtomahawk/widgets/QueryLabel.cpp | 17 +++++++++-------- .../widgets/SourceTreePopupDialog.cpp | 15 ++++++++------- src/sourcetree/SourceDelegate.cpp | 9 +++++---- src/widgets/AccountListWidget.cpp | 5 +++-- src/widgets/AccountWidget.cpp | 3 ++- src/widgets/AccountsPopupWidget.cpp | 9 +++++---- src/widgets/AccountsToolButton.cpp | 3 ++- 13 files changed, 57 insertions(+), 45 deletions(-) diff --git a/src/SocialWidget.cpp b/src/SocialWidget.cpp index 876770d8c..a82b51f04 100644 --- a/src/SocialWidget.cpp +++ b/src/SocialWidget.cpp @@ -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 ); } diff --git a/src/libtomahawk/playlist/GridItemDelegate.cpp b/src/libtomahawk/playlist/GridItemDelegate.cpp index 6d80a475d..5b0854df1 100644 --- a/src/libtomahawk/playlist/GridItemDelegate.cpp +++ b/src/libtomahawk/playlist/GridItemDelegate.cpp @@ -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 ); diff --git a/src/libtomahawk/playlist/TreeItemDelegate.cpp b/src/libtomahawk/playlist/TreeItemDelegate.cpp index 3f2b6c647..b980985be 100644 --- a/src/libtomahawk/playlist/TreeItemDelegate.cpp +++ b/src/libtomahawk/playlist/TreeItemDelegate.cpp @@ -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; } diff --git a/src/libtomahawk/utils/ProxyStyle.cpp b/src/libtomahawk/utils/ProxyStyle.cpp index 5180a2f67..ed19bec79 100644 --- a/src/libtomahawk/utils/ProxyStyle.cpp +++ b/src/libtomahawk/utils/ProxyStyle.cpp @@ -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 ) diff --git a/src/libtomahawk/utils/TomahawkUtilsGui.cpp b/src/libtomahawk/utils/TomahawkUtilsGui.cpp index 7aec9acc9..198e902e8 100644 --- a/src/libtomahawk/utils/TomahawkUtilsGui.cpp +++ b/src/libtomahawk/utils/TomahawkUtilsGui.cpp @@ -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 ) diff --git a/src/libtomahawk/widgets/PlayableCover.cpp b/src/libtomahawk/widgets/PlayableCover.cpp index 67337c621..6614de73d 100644 --- a/src/libtomahawk/widgets/PlayableCover.cpp +++ b/src/libtomahawk/widgets/PlayableCover.cpp @@ -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 ); diff --git a/src/libtomahawk/widgets/QueryLabel.cpp b/src/libtomahawk/widgets/QueryLabel.cpp index 40c3b9736..db7b09acd 100644 --- a/src/libtomahawk/widgets/QueryLabel.cpp +++ b/src/libtomahawk/widgets/QueryLabel.cpp @@ -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() ); diff --git a/src/libtomahawk/widgets/SourceTreePopupDialog.cpp b/src/libtomahawk/widgets/SourceTreePopupDialog.cpp index 2caae1fde..fc0ae4362 100644 --- a/src/libtomahawk/widgets/SourceTreePopupDialog.cpp +++ b/src/libtomahawk/widgets/SourceTreePopupDialog.cpp @@ -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 diff --git a/src/sourcetree/SourceDelegate.cpp b/src/sourcetree/SourceDelegate.cpp index 37d9a66b7..a2c5e6bf0 100644 --- a/src/sourcetree/SourceDelegate.cpp +++ b/src/sourcetree/SourceDelegate.cpp @@ -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 ); } diff --git a/src/widgets/AccountListWidget.cpp b/src/widgets/AccountListWidget.cpp index a00be77f0..4606043f4 100644 --- a/src/widgets/AccountListWidget.cpp +++ b/src/widgets/AccountListWidget.cpp @@ -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 ); diff --git a/src/widgets/AccountWidget.cpp b/src/widgets/AccountWidget.cpp index d7dc8fc15..81a498770 100644 --- a/src/widgets/AccountWidget.cpp +++ b/src/widgets/AccountWidget.cpp @@ -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 ); diff --git a/src/widgets/AccountsPopupWidget.cpp b/src/widgets/AccountsPopupWidget.cpp index e2fdf5fba..cb5739b97 100644 --- a/src/widgets/AccountsPopupWidget.cpp +++ b/src/widgets/AccountsPopupWidget.cpp @@ -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 ); } diff --git a/src/widgets/AccountsToolButton.cpp b/src/widgets/AccountsToolButton.cpp index 328cb3d70..ecb4fedee 100644 --- a/src/widgets/AccountsToolButton.cpp +++ b/src/widgets/AccountsToolButton.cpp @@ -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 );