| 1 |
/**************************************************************************************** |
| 2 |
* Copyright (c) 2007 Nikolaj Hald Nielsen <nhn@kde.org> * |
| 3 |
* Copyright (c) 2007 Mark Kretschmann <kretschmann@kde.org> * |
| 4 |
* * |
| 5 |
* This program is free software; you can redistribute it and/or modify it under * |
| 6 |
* the terms of the GNU General Public License as published by the Free Software * |
| 7 |
* Foundation; either version 2 of the License, or (at your option) any later * |
| 8 |
* version. * |
| 9 |
* * |
| 10 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY * |
| 11 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * |
| 12 |
* PARTICULAR PURPOSE. See the GNU General Public License for more details. * |
| 13 |
* * |
| 14 |
* You should have received a copy of the GNU General Public License along with * |
| 15 |
* this program. If not, see <http://www.gnu.org/licenses/>. * |
| 16 |
****************************************************************************************/ |
| 17 |
|
| 18 |
#ifndef SVGTINTER_H |
| 19 |
#define SVGTINTER_H |
| 20 |
|
| 21 |
#include "amarok_export.h" |
| 22 |
|
| 23 |
#include <QColor> |
| 24 |
#include <QFile> |
| 25 |
#include <QMap> |
| 26 |
#include <QString> |
| 27 |
#include <QPalette> |
| 28 |
|
| 29 |
class SvgTinter; |
| 30 |
|
| 31 |
namespace The { |
| 32 |
AMAROK_EXPORT SvgTinter* svgTinter(); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
This singleton class is used to tint the svg artwork to attempt to better match the users color scheme. |
| 37 |
|
| 38 |
@author Nikolaj Hald Nielsen <nhn@kde.org> |
| 39 |
*/ |
| 40 |
class SvgTinter |
| 41 |
{ |
| 42 |
friend SvgTinter* The::svgTinter(); |
| 43 |
|
| 44 |
public: |
| 45 |
~SvgTinter(); |
| 46 |
|
| 47 |
QString AMAROK_EXPORT tint( QString filename ); |
| 48 |
void AMAROK_EXPORT init(); |
| 49 |
|
| 50 |
QColor blendColors( const QColor& color1, const QColor& color2, int percent ); |
| 51 |
|
| 52 |
private: |
| 53 |
SvgTinter(); |
| 54 |
|
| 55 |
static SvgTinter * s_instance; |
| 56 |
QMap<QString, QString> m_tintMap; |
| 57 |
|
| 58 |
QPalette m_lastPalette; |
| 59 |
bool m_firstRun; |
| 60 |
}; |
| 61 |
|
| 62 |
#endif |