1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 09:34:53 +02:00

* No need to have const values being returned from methods.

This commit is contained in:
Christian Muehlhaeuser
2013-04-29 18:27:54 +02:00
parent 4a221a79a4
commit e6c2498fc6
8 changed files with 25 additions and 63 deletions

View File

@@ -33,8 +33,8 @@ ContextProxyPage::paint( QPainter* painter, const QStyleOptionGraphicsItem* opti
painter->save(); painter->save();
painter->setRenderHint( QPainter::Antialiasing, true ); painter->setRenderHint( QPainter::Antialiasing, true );
painter->setPen( TomahawkStyle::headerHighlightColor() ); painter->setPen( TomahawkStyle::HEADER_HIGHLIGHT );
painter->setBrush( TomahawkStyle::headerHighlightColor() ); painter->setBrush( TomahawkStyle::HEADER_HIGHLIGHT );
painter->drawRoundedRect( option->rect, 4.0, 4.0 ); painter->drawRoundedRect( option->rect, 4.0, 4.0 );
QFont f( font() ); QFont f( font() );

View File

@@ -26,12 +26,13 @@
#include <QPaintEvent> #include <QPaintEvent>
#include <QPainter> #include <QPainter>
#include "Source.h"
#include "ViewManager.h" #include "ViewManager.h"
#include "thirdparty/Qocoa/qsearchfield.h" #include "thirdparty/Qocoa/qsearchfield.h"
#include "widgets/QueryLabel.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "widgets/QueryLabel.h"
#include "Source.h"
#define ANIMATION_TIME 400 #define ANIMATION_TIME 400
#define IMAGE_HEIGHT 64 #define IMAGE_HEIGHT 64
@@ -292,8 +293,8 @@ InfoBar::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_LOWER );
painter.setBrush( gradient ); painter.setBrush( gradient );
painter.fillRect( rect(), gradient ); painter.fillRect( rect(), gradient );

View File

@@ -157,8 +157,8 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
{ {
painter->save(); painter->save();
painter->setPen( QColor( "dddddd" ) ); painter->setPen( TomahawkStyle::HOVER_GLOW );
painter->setBrush( QColor( "#dddddd" ) ); painter->setBrush( TomahawkStyle::HOVER_GLOW );
painter->setOpacity( opacity ); painter->setOpacity( opacity );
painter->drawRect( r ); painter->drawRect( r );

View File

@@ -25,27 +25,6 @@
#include <QStyleOption>> #include <QStyleOption>>
QColor
TomahawkStyle::headerUpperColor()
{
return QColor( "#25292c" );
}
QColor
TomahawkStyle::headerLowerColor()
{
return QColor( "#707070" );
}
QColor
TomahawkStyle::headerHighlightColor()
{
return QColor( "#333" );
}
void void
TomahawkStyle::horizontalHeader( QPainter* painter, const QRect& r ) TomahawkStyle::horizontalHeader( QPainter* painter, const QRect& r )
{ {
@@ -57,8 +36,8 @@ TomahawkStyle::horizontalHeader( QPainter* painter, const QRect& r )
painter->fillRect( lowerHalf, TomahawkStyle::headerLowerColor() );*/ painter->fillRect( lowerHalf, TomahawkStyle::headerLowerColor() );*/
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, TomahawkStyle::headerLowerColor() ); gradient.setColorAt( 0.0, TomahawkStyle::HEADER_LOWER );
gradient.setColorAt( 1.0, TomahawkStyle::headerUpperColor() ); gradient.setColorAt( 1.0, TomahawkStyle::HEADER_UPPER );
painter->setBrush( gradient ); painter->setBrush( gradient );
painter->fillRect( r, gradient ); painter->fillRect( r, gradient );
@@ -80,13 +59,6 @@ TomahawkStyle::horizontalHeader( QPainter* painter, const QRect& r )
} }
QColor
TomahawkStyle::headerTextColor()
{
return QColor( "#eaeaea" );
}
/* /*
* This implementation is from QWindowsStyle (Qt 4.2) * This implementation is from QWindowsStyle (Qt 4.2)
* *

View File

@@ -28,23 +28,6 @@
namespace TomahawkStyle namespace TomahawkStyle
{ {
/**
* Our header BG is a two color gradient. This is the upper color.
*/
DLLEXPORT QColor headerUpperColor();
/**
* Our header BG is a two color gradient. This is the lower color.
*/
DLLEXPORT QColor headerLowerColor();
/**
* The color of text on a Header.
*/
DLLEXPORT QColor headerTextColor();
/**
* The widget highlight color for headers
*/
DLLEXPORT QColor headerHighlightColor();
/** /**
* Draws a header background on a painter with the specified rectangle * Draws a header background on a painter with the specified rectangle
*/ */
@@ -61,11 +44,17 @@ 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 GROUP_HEADER = QColor( "#637180" ); static const QColor GROUP_HEADER = QColor( "#637180" );
static const QColor HOVER_GLOW = QColor( "#dddddd" );
static const QColor NOW_PLAYING_ITEM = QColor( "#962c26" ); static const QColor NOW_PLAYING_ITEM = QColor( "#962c26" );
static const QColor NOW_PLAYING_ITEM_TEXT = QColor( "#ffffff" ); static const QColor NOW_PLAYING_ITEM_TEXT = QColor( "#ffffff" );
static const QColor SELECTION_BACKGROUND = QColor( "#962c26" ); static const QColor SELECTION_BACKGROUND = QColor( "#962c26" );
static const QColor SELECTION_FOREGROUND = QColor( "#ffffff" ); static const QColor SELECTION_FOREGROUND = QColor( "#ffffff" );
static const QColor HEADER = QColor( "#ffffff" );
static const QColor HEADER_UPPER = QColor( "#25292c" );
static const QColor HEADER_LOWER = QColor( "#707070" );
static const QColor HEADER_TEXT = QColor( "#eaeaea" );
static const QColor HEADER_HIGHLIGHT = QColor( "#333" );
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.96;

View File

@@ -68,7 +68,7 @@ ComboBox::paintEvent( QPaintEvent* )
highlightRect.setSize( hS ); highlightRect.setSize( hS );
highlightRect.translate( 0, 2 ); highlightRect.translate( 0, 2 );
p.setRenderHint( QPainter::Antialiasing ); p.setRenderHint( QPainter::Antialiasing );
p.setBrush( TomahawkStyle::headerHighlightColor() ); p.setBrush( TomahawkStyle::HEADER_HIGHLIGHT );
p.drawRoundedRect( highlightRect, 10.0, 10.0 ); p.drawRoundedRect( highlightRect, 10.0, 10.0 );
p.restore(); p.restore();
} }
@@ -77,7 +77,7 @@ ComboBox::paintEvent( QPaintEvent* )
QTextOption to( Qt::AlignVCenter ); QTextOption to( Qt::AlignVCenter );
r.adjust( 8, 0, -8, 0 ); r.adjust( 8, 0, -8, 0 );
p.setPen( Qt::white ); p.setPen( Qt::white );
p.setBrush( TomahawkStyle::headerTextColor() ); p.setBrush( TomahawkStyle::HEADER_TEXT );
p.drawText( r, cb.currentText, to ); p.drawText( r, cb.currentText, to );
bool reverse = cb.direction == Qt::RightToLeft; bool reverse = cb.direction == Qt::RightToLeft;

View File

@@ -107,6 +107,6 @@ HeaderLabel::paintEvent( QPaintEvent* /* event */ )
QTextOption to( alignment() | Qt::AlignVCenter ); QTextOption to( alignment() | Qt::AlignVCenter );
r.adjust( 8, 0, -8, 0 ); r.adjust( 8, 0, -8, 0 );
p.setPen( TomahawkStyle::headerTextColor() ); p.setPen( TomahawkStyle::HEADER_TEXT );
p.drawText( r, text(), to ); p.drawText( r, text(), to );
} }

View File

@@ -89,15 +89,15 @@ ToggleButton::paintEvent( QPaintEvent* event )
if ( isChecked() ) if ( isChecked() )
{ {
p.setBrush( TomahawkStyle::headerHighlightColor() ); p.setBrush( TomahawkStyle::HEADER_HIGHLIGHT );
} }
else if ( false ) else if ( false )
{ {
p.setBrush( TomahawkStyle::headerLowerColor() ); p.setBrush( TomahawkStyle::HEADER_LOWER );
} }
else else
{ {
p.setBrush( TomahawkStyle::headerUpperColor() ); p.setBrush( TomahawkStyle::HEADER_UPPER );
} }
p.drawRoundedRect( highlightRect, 4.0, 4.0 ); p.drawRoundedRect( highlightRect, 4.0, 4.0 );
@@ -105,7 +105,7 @@ ToggleButton::paintEvent( QPaintEvent* event )
QTextOption to( Qt::AlignCenter ); QTextOption to( Qt::AlignCenter );
r.adjust( 8, 0, -8, 0 ); r.adjust( 8, 0, -8, 0 );
p.setBrush( TomahawkStyle::headerTextColor() ); p.setBrush( TomahawkStyle::HEADER_TEXT );
p.drawText( r, text(), to ); p.drawText( r, text(), to );
p.restore(); p.restore();