mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 06:36:55 +02:00
* Merged StyleHelper into TomahawkStyle.
This commit is contained in:
@@ -1,68 +0,0 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
|
||||||
*
|
|
||||||
* Copyright 2011, Casey Link <unnamedrambler@gmail.com>
|
|
||||||
*
|
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Tomahawk is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef STYLEHELPER_H
|
|
||||||
#define STYLEHELPER_H
|
|
||||||
|
|
||||||
#include <QColor>
|
|
||||||
#include <QStyle>
|
|
||||||
#include <QStyleOption>
|
|
||||||
|
|
||||||
class QPalette;
|
|
||||||
class QPainter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \class StyleHelper
|
|
||||||
* \brief A static class that contains Tomahawk's styling details (colors, etc).
|
|
||||||
*/
|
|
||||||
class StyleHelper
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Our header BG is a two color gradient. This is the upper color.
|
|
||||||
*/
|
|
||||||
static QColor headerUpperColor();
|
|
||||||
/**
|
|
||||||
* Our header BG is a two color gradient. This is the lower color.
|
|
||||||
*/
|
|
||||||
static QColor headerLowerColor();
|
|
||||||
/**
|
|
||||||
* The color of text on a Header.
|
|
||||||
*/
|
|
||||||
static QColor headerTextColor();
|
|
||||||
/**
|
|
||||||
* The widget highlight color for headers
|
|
||||||
*/
|
|
||||||
static QColor headerHighlightColor();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws a header background on a painter with the specified rectangle
|
|
||||||
*/
|
|
||||||
static void horizontalHeader( QPainter* painter, const QRect& rect );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws a styled arrow that looks good on a Header (from qwindowstyle.cpp)
|
|
||||||
* \copyright { Licensed under the GPL v3+
|
|
||||||
* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
* Contact: Nokia Corporation (qt-info@nokia.com) }
|
|
||||||
*/
|
|
||||||
static void drawArrow( QStyle::PrimitiveElement, QPainter* painter, const QStyleOption* opt );
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // STYLEHELPER_H
|
|
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2011, Casey Link <unnamedrambler@gmail.com>
|
* Copyright 2011, Casey Link <unnamedrambler@gmail.com>
|
||||||
|
* Copyright 2013, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,47 +17,48 @@
|
|||||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "StyleHelper.h"
|
#include "TomahawkStyle.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QStyleOption>>
|
||||||
|
|
||||||
|
|
||||||
QColor
|
QColor
|
||||||
StyleHelper::headerUpperColor()
|
TomahawkStyle::headerUpperColor()
|
||||||
{
|
{
|
||||||
return QColor( "#25292c" );
|
return QColor( "#25292c" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QColor
|
QColor
|
||||||
StyleHelper::headerLowerColor()
|
TomahawkStyle::headerLowerColor()
|
||||||
{
|
{
|
||||||
return QColor( "#707070" );
|
return QColor( "#707070" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QColor
|
QColor
|
||||||
StyleHelper::headerHighlightColor()
|
TomahawkStyle::headerHighlightColor()
|
||||||
{
|
{
|
||||||
return QColor( "#333" );
|
return QColor( "#333" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StyleHelper::horizontalHeader( QPainter* painter, const QRect& r )
|
TomahawkStyle::horizontalHeader( QPainter* painter, const QRect& r )
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
/* QRect upperHalf( 0, 0, r.width(), r.height() / 2 );
|
/* QRect upperHalf( 0, 0, r.width(), r.height() / 2 );
|
||||||
QRect lowerHalf( 0, upperHalf.height(), r.width(), r.height() );
|
QRect lowerHalf( 0, upperHalf.height(), r.width(), r.height() );
|
||||||
painter->fillRect( upperHalf, StyleHelper::headerUpperColor() );
|
painter->fillRect( upperHalf, TomahawkStyle::headerUpperColor() );
|
||||||
painter->fillRect( lowerHalf, StyleHelper::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, StyleHelper::headerLowerColor() );
|
gradient.setColorAt( 0.0, TomahawkStyle::headerLowerColor() );
|
||||||
gradient.setColorAt( 1.0, StyleHelper::headerUpperColor() );
|
gradient.setColorAt( 1.0, TomahawkStyle::headerUpperColor() );
|
||||||
|
|
||||||
painter->setBrush( gradient );
|
painter->setBrush( gradient );
|
||||||
painter->fillRect( r, gradient );
|
painter->fillRect( r, gradient );
|
||||||
@@ -79,7 +81,7 @@ StyleHelper::horizontalHeader( QPainter* painter, const QRect& r )
|
|||||||
|
|
||||||
|
|
||||||
QColor
|
QColor
|
||||||
StyleHelper::headerTextColor()
|
TomahawkStyle::headerTextColor()
|
||||||
{
|
{
|
||||||
return QColor( "#eaeaea" );
|
return QColor( "#eaeaea" );
|
||||||
}
|
}
|
||||||
@@ -92,7 +94,8 @@ StyleHelper::headerTextColor()
|
|||||||
* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
* Contact: Nokia Corporation (qt-info@nokia.com)
|
* Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
*/
|
*/
|
||||||
void StyleHelper::drawArrow( QStyle::PrimitiveElement element, QPainter* p, const QStyleOption* opt )
|
void
|
||||||
|
TomahawkStyle::drawArrow( QStyle::PrimitiveElement element, QPainter* p, const QStyleOption* opt )
|
||||||
{
|
{
|
||||||
if ( opt->rect.width() <= 1 || opt->rect.height() <= 1 )
|
if ( opt->rect.width() <= 1 || opt->rect.height() <= 1 )
|
||||||
return;
|
return;
|
@@ -23,9 +23,41 @@
|
|||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QStyle>
|
||||||
|
|
||||||
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
|
||||||
|
*/
|
||||||
|
DLLEXPORT void horizontalHeader( QPainter* painter, const QRect& rect );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a styled arrow that looks good on a Header (from qwindowstyle.cpp)
|
||||||
|
* \copyright { Licensed under the GPL v3+
|
||||||
|
* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
* Contact: Nokia Corporation (qt-info@nokia.com) }
|
||||||
|
*/
|
||||||
|
DLLEXPORT void drawArrow( QStyle::PrimitiveElement, QPainter* painter, const QStyleOption* opt );
|
||||||
|
|
||||||
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" );
|
||||||
@@ -33,6 +65,7 @@ namespace TomahawkStyle
|
|||||||
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 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;
|
||||||
|
Reference in New Issue
Block a user