summaryrefslogtreecommitdiffstats
path: root/amarok/src/starmanager.h
blob: e73dc00ba33f13e71bea2f70030a5e8c5b567a34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// C++ Interface: starmanager
//
// Description: Small little manager to return the color stars we want
//
//
// Author: Jeff Mitchell <kde-dev@emailgoeshere.com>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//


#ifndef AMAROK_STAR_MANAGER_H
#define AMAROK_STAR_MANAGER_H

#include <tqimage.h>
#include <tqpixmap.h>

class StarManager : public QObject
{

    Q_OBJECT

    public:
        StarManager();
        ~StarManager();
        static StarManager *instance();

        TQPixmap* getStar( int num, bool full = false );
        TQPixmap* getGreyStar() { return &m_greyedStarPix; }
        TQPixmap* getHalfStar( int num = -1, bool full = false  );
        TQImage& getStarImage( int num, bool full = false  );
        TQImage& getGreyStarImage() { return m_greyedStar; }
        TQImage& getHalfStarImage( int num = -1, bool full = false  );

        bool setColor( int starNum, const TQColor &color );
        bool setHalfColor( const TQColor &color );

        void reinitStars( int height = -1, int margin = -1 );

    signals:
        void ratingsColorsChanged();

    private:

        int m_height;
        int m_margin;

        //cached stars...why both?  For faster conversion when drawing context browser
        TQPixmap m_starPix;
        TQImage m_star;
        TQPixmap m_fullStarPix;
        TQImage m_fullStar;
        TQPixmap m_greyedStarPix;
        TQImage m_greyedStar;
        TQPixmap m_halfStarPix;
        TQPixmap m_fullHalfStarPix;
        TQImage m_halfStar;
        TQImage m_fullHalfStar;

        TQImage m_images[5];
        TQImage m_halfimages[5];
        TQPixmap m_pixmaps[5];
        TQPixmap m_halfpixmaps[5];

        TQColor m_colors[5];
        TQColor m_halfStarColor;
};

#endif