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