1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 05:37:29 +02:00

* Moved color consts into TomahawkStyle.

This commit is contained in:
Christian Muehlhaeuser
2013-04-29 19:22:00 +02:00
parent e6c2498fc6
commit f99cfb8e66
14 changed files with 60 additions and 29 deletions

View File

@@ -100,8 +100,10 @@ ResolverConfigDelegate::paint( QPainter* painter, const QStyleOptionViewItem& op
QString pathStr = index.data( ResolversModel::ResolverPath ).toString(); QString pathStr = index.data( ResolversModel::ResolverPath ).toString();
if( error ) if( error )
{ {
//FIXME const color
painter->setPen( QColor( Qt::red ).lighter( 150 ) ); painter->setPen( QColor( Qt::red ).lighter( 150 ) );
} else { } else {
//FIXME const color
painter->setPen( Qt::gray ); painter->setPen( Qt::gray );
} }

View File

@@ -93,7 +93,7 @@ ContextWidget::ContextWidget( QWidget* parent )
ensurePolished(); ensurePolished();
QPalette pal = palette(); QPalette pal = palette();
pal.setBrush( QPalette::Window, QColor( "#272b2e" ) ); pal.setBrush( QPalette::Window, TomahawkStyle::FOOTNOTES_BACKGROUND );
setPalette( pal ); setPalette( pal );
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( toggleSize() ) ); connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( toggleSize() ) );

View File

@@ -113,6 +113,7 @@ ACLJobDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex&
void void
ACLJobDelegate::drawRoundedButton( QPainter* painter, const QRect& btnRect, bool red ) const ACLJobDelegate::drawRoundedButton( QPainter* painter, const QRect& btnRect, bool red ) const
{ {
//FIXME const colors
if ( !red ) if ( !red )
TomahawkUtils::drawRoundedButton( painter, btnRect, QColor( 54, 127, 211 ), QColor( 43, 104, 182 ), QColor( 34, 85, 159 ), QColor( 35, 79, 147 ) ); TomahawkUtils::drawRoundedButton( painter, btnRect, QColor( 54, 127, 211 ), QColor( 43, 104, 182 ), QColor( 34, 85, 159 ), QColor( 35, 79, 147 ) );
else else

View File

@@ -43,6 +43,8 @@ namespace TomahawkStyle
static const QColor BORDER_LINE = QColor( "#8c8c8c" ); static const QColor BORDER_LINE = QColor( "#8c8c8c" );
static const QColor POPUP_BACKGROUND = QColor( "#ffffff" ); static const QColor POPUP_BACKGROUND = QColor( "#ffffff" );
static const QColor POPUP_OSX_BACKGROUND = QColor( "#D6E3F1" );
static const QColor GROUP_HEADER = QColor( "#637180" ); static const QColor GROUP_HEADER = QColor( "#637180" );
static const QColor HOVER_GLOW = QColor( "#dddddd" ); static const QColor HOVER_GLOW = QColor( "#dddddd" );
@@ -56,8 +58,24 @@ namespace TomahawkStyle
static const QColor HEADER_TEXT = QColor( "#eaeaea" ); static const QColor HEADER_TEXT = QColor( "#eaeaea" );
static const QColor HEADER_HIGHLIGHT = QColor( "#333" ); static const QColor HEADER_HIGHLIGHT = QColor( "#333" );
static const QColor PAGE_BACKGROUND = QColor( "#272b2e" );
static const QColor FOOTNOTES_BACKGROUND = QColor( "#272b2e" );
static const QColor DASHBOARD_ROUNDFIGURE_BACKGROUND = QColor( "#454e59" );
static const QColor SIDEBAR_ROUNDFIGURE_BACKGROUND = QColor( 167, 183, 211 );
static const QColor SIDEBAR_ROUNDFIGURE_INBOX_BACKGROUND = QColor( 239, 140, 51 );
static const QColor SIDEBAR_LAZYLIST_UPPER = QColor( "#ffffff" );
static const QColor SIDEBAR_LAZYLIST_LOWER = QColor( 0x88, 0x88, 0x88 );
static const QColor SIDEBAR_LAZYLIST_LOWEST = QColor( 0x99, 0x99, 0x99 );
static const QColor SLIDESWITCH_CHECKED_TOP = QColor( 8, 54, 134 );
static const QColor SLIDESWITCH_CHECKED_BOTTOM = QColor( 118, 172, 240 );
static const QColor SLIDESWITCH_UNCHECKED_TOP = QColor( 128, 128, 128 );
static const QColor SLIDESWITCH_UNCHECKED_BOTTOM = QColor( 179, 179, 179 );
static const QColor SLIDESWITCH_TEXT = QColor( "#606060" );
static const int POPUP_ROUNDING_RADIUS = 6; static const int POPUP_ROUNDING_RADIUS = 6;
static const float POPUP_OPACITY = 0.96; static const float POPUP_OPACITY = 0.93;
} }
#endif // TOMAHAWKSTYLE_H #endif // TOMAHAWKSTYLE_H

View File

@@ -19,8 +19,9 @@
#include "BasicHeader.h" #include "BasicHeader.h"
#include "utils/TomahawkUtilsGui.h"
#include "ElidedLabel.h" #include "ElidedLabel.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include <QLabel> #include <QLabel>
#include <QPixmap> #include <QPixmap>
@@ -129,8 +130,8 @@ BasicHeader::paintEvent( QPaintEvent* event )
QLinearGradient gradient( QPoint( 0, 0 ), QPoint( 0, 1 ) ); QLinearGradient gradient( QPoint( 0, 0 ), QPoint( 0, 1 ) );
gradient.setCoordinateMode( QGradient::ObjectBoundingMode ); gradient.setCoordinateMode( QGradient::ObjectBoundingMode );
gradient.setColorAt( 0.0, QColor( "#707070" ) ); gradient.setColorAt( 0.0, TomahawkStyle::HEADER_LOWER );
gradient.setColorAt( 1.0, QColor( "#25292c" ) ); gradient.setColorAt( 1.0, TomahawkStyle::HEADER_UPPER );
painter.setBrush( gradient ); painter.setBrush( gradient );
painter.fillRect( rect(), gradient ); painter.fillRect( rect(), gradient );

View File

@@ -138,6 +138,7 @@ OverlayButton::paintEvent( QPaintEvent* event )
QPen pen( palette().dark().color(), .5 ); QPen pen( palette().dark().color(), .5 );
p.setPen( pen ); p.setPen( pen );
//FIXME const color
p.setBrush( QColor( 30, 30, 30, 255.0 * OPACITY ) ); p.setBrush( QColor( 30, 30, 30, 255.0 * OPACITY ) );
p.drawRoundedRect( r, CORNER_ROUNDNESS, CORNER_ROUNDNESS ); p.drawRoundedRect( r, CORNER_ROUNDNESS, CORNER_ROUNDNESS );

View File

@@ -215,6 +215,7 @@ OverlayWidget::paintEvent( QPaintEvent* event )
QPen pen( palette().dark().color(), .5 ); QPen pen( palette().dark().color(), .5 );
p.setPen( pen ); p.setPen( pen );
//FIXME const color
p.setBrush( QColor( 30, 30, 30, 255.0 * OPACITY ) ); p.setBrush( QColor( 30, 30, 30, 255.0 * OPACITY ) );
p.drawRoundedRect( r, CORNER_ROUNDNESS, CORNER_ROUNDNESS ); p.drawRoundedRect( r, CORNER_ROUNDNESS, CORNER_ROUNDNESS );

View File

@@ -213,8 +213,8 @@ SourceTreePopupDialog::paintEvent( QPaintEvent* event )
TomahawkUtils::drawCompositedPopup( this, TomahawkUtils::drawCompositedPopup( this,
outline, outline,
TomahawkStyle::BORDER_LINE, TomahawkStyle::BORDER_LINE,
QColor( "#D6E3F1" ), TomahawkStyle::POPUP_OSX_BACKGROUND,
0.93 ); TomahawkStyle::POPUP_OPACITY );
#endif #endif
} }

View File

@@ -25,17 +25,18 @@
#include "SourceList.h" #include "SourceList.h"
#include "TomahawkSettings.h" #include "TomahawkSettings.h"
#include "RecentPlaylistsModel.h" #include "RecentPlaylistsModel.h"
#include "RecentlyPlayedPlaylistsModel.h"
#include "MetaPlaylistInterface.h" #include "MetaPlaylistInterface.h"
#include "audio/AudioEngine.h" #include "audio/AudioEngine.h"
#include "playlist/AlbumModel.h" #include "playlist/AlbumModel.h"
#include "playlist/RecentlyPlayedModel.h" #include "playlist/RecentlyPlayedModel.h"
#include "playlist/dynamic/GeneratorInterface.h"
#include "widgets/OverlayWidget.h" #include "widgets/OverlayWidget.h"
#include "utils/AnimatedSpinner.h" #include "utils/AnimatedSpinner.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtils.h" #include "utils/TomahawkUtils.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "playlist/dynamic/GeneratorInterface.h"
#include "RecentlyPlayedPlaylistsModel.h"
#include <QPainter> #include <QPainter>
@@ -282,7 +283,7 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
rect.setTop( pixmapRect.bottom() - painter->fontMetrics().height() - 1 ); rect.setTop( pixmapRect.bottom() - painter->fontMetrics().height() - 1 );
rect.setBottom( pixmapRect.bottom() + 1 ); rect.setBottom( pixmapRect.bottom() + 1 );
QColor figColor( "#454e59" ); QColor figColor( TomahawkStyle::DASHBOARD_ROUNDFIGURE_BACKGROUND );
painter->setPen( figColor ); painter->setPen( figColor );
painter->setBrush( figColor ); painter->setBrush( figColor );
@@ -319,6 +320,7 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
QColor c = painter->pen().color(); QColor c = painter->pen().color();
if ( !( option.state & QStyle::State_Selected && option.state & QStyle::State_Active ) ) if ( !( option.state & QStyle::State_Selected && option.state & QStyle::State_Active ) )
{ {
//FIXME const color
painter->setPen( QColor( Qt::gray ).darker() ); painter->setPen( QColor( Qt::gray ).darker() );
} }

View File

@@ -34,6 +34,7 @@
#include "database/DatabaseCommand_AllTracks.h" #include "database/DatabaseCommand_AllTracks.h"
#include "database/DatabaseCommand_AllAlbums.h" #include "database/DatabaseCommand_AllAlbums.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h" #include "utils/Logger.h"
@@ -51,7 +52,7 @@ AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* par
ui->setupUi( widget ); ui->setupUi( widget );
QPalette pal = palette(); QPalette pal = palette();
pal.setColor( QPalette::Window, QColor( "#272b2e" ) ); pal.setColor( QPalette::Window, TomahawkStyle::PAGE_BACKGROUND );
widget->setPalette( pal ); widget->setPalette( pal );
widget->setAutoFillBackground( true ); widget->setAutoFillBackground( true );

View File

@@ -37,6 +37,7 @@
#include "GlobalActionManager.h" #include "GlobalActionManager.h"
#include "Pipeline.h" #include "Pipeline.h"
#include "MetaPlaylistInterface.h" #include "MetaPlaylistInterface.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h" #include "utils/Logger.h"
@@ -52,7 +53,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
ui->setupUi( widget ); ui->setupUi( widget );
QPalette pal = palette(); QPalette pal = palette();
pal.setColor( QPalette::Window, QColor( "##272b2e" ) ); pal.setColor( QPalette::Window, TomahawkStyle::PAGE_BACKGROUND );
widget->setPalette( pal ); widget->setPalette( pal );
widget->setAutoFillBackground( true ); widget->setAutoFillBackground( true );

View File

@@ -29,6 +29,7 @@
#include "playlist/PlayableModel.h" #include "playlist/PlayableModel.h"
#include "audio/AudioEngine.h" #include "audio/AudioEngine.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h" #include "utils/Logger.h"
@@ -44,7 +45,7 @@ TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* par
ui->setupUi( widget ); ui->setupUi( widget );
QPalette pal = palette(); QPalette pal = palette();
pal.setColor( QPalette::Window, QColor( "#272b2e" ) ); pal.setColor( QPalette::Window, TomahawkStyle::PAGE_BACKGROUND );
widget->setPalette( pal ); widget->setPalette( pal );
widget->setAutoFillBackground( true ); widget->setAutoFillBackground( true );

View File

@@ -355,7 +355,7 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
painter->setFont( figFont ); painter->setFont( figFont );
QColor figColor( 167, 183, 211 ); QColor figColor( TomahawkStyle::SIDEBAR_ROUNDFIGURE_BACKGROUND );
painter->setPen( figColor ); painter->setPen( figColor );
painter->setBrush( figColor ); painter->setBrush( figColor );
@@ -529,9 +529,9 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
if ( m_gradient.finalStop() != itemsRect.bottomLeft() ) if ( m_gradient.finalStop() != itemsRect.bottomLeft() )
{ {
m_gradient = QLinearGradient( itemsRect.topLeft(), itemsRect.bottomLeft() ); m_gradient = QLinearGradient( itemsRect.topLeft(), itemsRect.bottomLeft() );
m_gradient.setColorAt( 0.0, Qt::white ); m_gradient.setColorAt( 0.0, TomahawkStyle::SIDEBAR_LAZYLIST_UPPER );
m_gradient.setColorAt( 0.9, QColor( 0x88, 0x88, 0x88 ) ); m_gradient.setColorAt( 0.9, TomahawkStyle::SIDEBAR_LAZYLIST_LOWER );
m_gradient.setColorAt( 1.0, QColor( 0x99, 0x99, 0x99 ) ); // dark grey m_gradient.setColorAt( 1.0, TomahawkStyle::SIDEBAR_LAZYLIST_LOWEST );
} }
QPen pen = painter->pen(); QPen pen = painter->pen();
@@ -661,7 +661,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
painter->setFont( figFont ); painter->setFont( figFont );
QColor figColor( 239, 140, 51 ); QColor figColor( TomahawkStyle::SIDEBAR_ROUNDFIGURE_INBOX_BACKGROUND );
painter->setPen( figColor ); painter->setPen( figColor );
painter->setBrush( figColor ); painter->setBrush( figColor );

View File

@@ -19,6 +19,7 @@
#include "SlideSwitchButton.h" #include "SlideSwitchButton.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtils.h" #include "utils/TomahawkUtils.h"
#include <QMouseEvent> #include <QMouseEvent>
@@ -66,17 +67,17 @@ SlideSwitchButton::init()
setMouseTracking( true ); setMouseTracking( true );
#endif #endif
m_backCheckedColorTop = QColor( 8, 54, 134 ); m_backCheckedColorTop = TomahawkStyle::SLIDESWITCH_CHECKED_TOP;
m_backCheckedColorBottom = QColor( 118, 172, 240 ); m_backCheckedColorBottom = TomahawkStyle::SLIDESWITCH_CHECKED_BOTTOM;
m_backUncheckedColorTop = QColor( 128, 128, 128 ); m_backUncheckedColorTop = TomahawkStyle::SLIDESWITCH_UNCHECKED_TOP;
m_backUncheckedColorBottom = QColor( 179, 179, 179 ); m_backUncheckedColorBottom = TomahawkStyle::SLIDESWITCH_UNCHECKED_BOTTOM;
m_baseColorTop = m_backUncheckedColorTop; m_baseColorTop = m_backUncheckedColorTop;
m_baseColorBottom = m_backUncheckedColorBottom; m_baseColorBottom = m_backUncheckedColorBottom;
m_textColor = QColor( "#606060" ); m_textColor = TomahawkStyle::SLIDESWITCH_TEXT;
setFocusPolicy( Qt::NoFocus );
setFocusPolicy( Qt::NoFocus );
m_knobX = 0.; m_knobX = 0.;
m_textFont = font(); m_textFont = font();
@@ -179,8 +180,8 @@ SlideSwitchButton::paintEvent( QPaintEvent* event )
QLinearGradient gradient( 0, 0, 0, 1 ); QLinearGradient gradient( 0, 0, 0, 1 );
gradient.setCoordinateMode( QGradient::ObjectBoundingMode ); gradient.setCoordinateMode( QGradient::ObjectBoundingMode );
gradient.setColorAt( 0, m_baseColorTop ); gradient.setColorAt( 0, TomahawkStyle::SLIDESWITCH_UNCHECKED_TOP );
gradient.setColorAt( 1, m_baseColorBottom ); gradient.setColorAt( 1, TomahawkStyle::SLIDESWITCH_UNCHECKED_BOTTOM );
painter.setBrush( gradient ); painter.setBrush( gradient );
QPainterPath borderPath; QPainterPath borderPath;
@@ -275,6 +276,7 @@ SlideSwitchButton::createKnob()
QLinearGradient gradient( 0, 0, 0, 1 ); QLinearGradient gradient( 0, 0, 0, 1 );
gradient.setCoordinateMode( QGradient::ObjectBoundingMode ); gradient.setCoordinateMode( QGradient::ObjectBoundingMode );
//FIXME const colors
gradient.setColorAt( 0, Qt::white ); gradient.setColorAt( 0, Qt::white );
gradient.setColorAt( 1, QColor( 223, 223, 223 ) ); gradient.setColorAt( 1, QColor( 223, 223, 223 ) );