| 1 |
/**************************************************************************************** |
| 2 |
* Copyright (c) 2008 Nikolaj Hald Nielsen <nhn@kde.org> * |
| 3 |
* * |
| 4 |
* This program is free software; you can redistribute it and/or modify it under * |
| 5 |
* the terms of the GNU General Public License as published by the Free Software * |
| 6 |
* Foundation; either version 2 of the License, or (at your option) any later * |
| 7 |
* version. * |
| 8 |
* * |
| 9 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY * |
| 10 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * |
| 11 |
* PARTICULAR PURPOSE. See the GNU General Public License for more details. * |
| 12 |
* * |
| 13 |
* You should have received a copy of the GNU General Public License along with * |
| 14 |
* this program. If not, see <http://www.gnu.org/licenses/>. * |
| 15 |
****************************************************************************************/ |
| 16 |
|
| 17 |
#ifndef PALETTEHANDLER_H |
| 18 |
#define PALETTEHANDLER_H |
| 19 |
|
| 20 |
#include "amarok_export.h" |
| 21 |
|
| 22 |
#include <QObject> |
| 23 |
#include <QTreeView> |
| 24 |
|
| 25 |
class PaletteHandler; |
| 26 |
|
| 27 |
namespace The { |
| 28 |
AMAROK_EXPORT PaletteHandler* paletteHandler(); |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
A small singleton class to handle propagating palette change notifications and hold some utility functions for updating certain widgets |
| 33 |
|
| 34 |
@author Nikolaj Hald Nielsen <nhn@kde.org> |
| 35 |
*/ |
| 36 |
class AMAROK_EXPORT PaletteHandler : public QObject |
| 37 |
{ |
| 38 |
Q_OBJECT |
| 39 |
|
| 40 |
friend PaletteHandler* The::paletteHandler(); |
| 41 |
|
| 42 |
public: |
| 43 |
~PaletteHandler(); |
| 44 |
|
| 45 |
QPalette palette(); |
| 46 |
|
| 47 |
void setPalette( const QPalette & palette ); |
| 48 |
void updateItemView( QAbstractItemView * view ); |
| 49 |
|
| 50 |
/** |
| 51 |
* Returns the highlight color which should be used instead of the color from KDE. |
| 52 |
* @return Highlight color, which is the KDE highlight color, with reduced saturation (less contrast). |
| 53 |
*/ |
| 54 |
static QColor highlightColor(); |
| 55 |
|
| 56 |
/** |
| 57 |
* Returns the highlight color which should be used instead of the color from KDE. |
| 58 |
* @param Decimal percentage to saturate the highlight color. Will reduce (or magnify) the saturation in HSV representation of the color. |
| 59 |
* @param Decimal percentage to multiply the value of the HSV color with. |
| 60 |
* @return Highlight color, which is the KDE highlight color, with reduced saturation (less contrast). |
| 61 |
*/ |
| 62 |
static QColor highlightColor( qreal percentSaturation, qreal percentValue ); |
| 63 |
|
| 64 |
/** |
| 65 |
* Returns the background color used in context applets. |
| 66 |
*/ |
| 67 |
static QColor backgroundColor(); |
| 68 |
|
| 69 |
/** |
| 70 |
* Returns the alternate background color used in context applets. |
| 71 |
*/ |
| 72 |
static QColor alternateBackgroundColor(); |
| 73 |
|
| 74 |
signals: |
| 75 |
void newPalette( const QPalette & palette ); |
| 76 |
|
| 77 |
private: |
| 78 |
PaletteHandler( QObject* parent = 0 ); |
| 79 |
|
| 80 |
QPalette m_palette; |
| 81 |
}; |
| 82 |
|
| 83 |
#endif |