~ubuntu-branches/ubuntu/lucid/lastfm/lucid

« back to all changes in this revision

Viewing changes to src/progressframe.h

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2007-12-31 09:49:54 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071231094954-ix1amvcsj9pk61ya
Tags: 1:1.4.1.57486.dfsg-1ubuntu1
* Merge from Debian unstable (LP: #180254), remaining changes:
  - debian/rules;
    - Added dh_icons
  - Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 *   You should have received a copy of the GNU General Public License     *
17
17
 *   along with this program; if not, write to the                         *
18
18
 *   Free Software Foundation, Inc.,                                       *
19
 
 *   51 Franklin Steet, Fifth Floor, Boston, MA  02111-1307, USA.          *
 
19
 *   51 Franklin Steet, Fifth Floor, Boston, MA  02110-1301, USA.          *
20
20
 ***************************************************************************/
21
21
 
22
22
#ifndef PROGRESSFRAME_H
23
23
#define PROGRESSFRAME_H
24
24
 
25
 
#include "stopwatch.h"
 
25
#include "StopWatch.h"
26
26
#include "metadata.h"
27
27
 
28
 
#include <QtGui>
 
28
#include <QFrame>
 
29
#include <QTimer>
 
30
 
 
31
class QPainter;
29
32
 
30
33
class ProgressFrame : public QFrame
31
34
{
41
44
        // The stopwatch whose time to reflect. The StopWatch must have a
42
45
        // timeout for reverse display to work.
43
46
        void setStopWatch( StopWatch* watch );
 
47
 
 
48
        bool reverse() { return m_reverse; }
44
49
        void setReverse( bool reverse ) { m_reverse = reverse; }
45
50
 
46
51
        // The main text
66
71
        void setForegroundGradient( const QLinearGradient& fg ) { m_foregroundGradient = fg; }
67
72
 
68
73
        // No progress will be shown is this is off
 
74
        bool progressEnabled() { return m_progressEnabled; }
69
75
        void setProgressEnabled( bool enabled );
70
76
 
71
77
        // No clock will be shown if this is off
 
78
        bool clockEnabled() { return m_clockEnabled; }
72
79
        void setClockEnabled( bool enabled );
73
80
 
74
81
        void setEnabled( bool enabled )
77
84
            setClockEnabled( enabled );
78
85
        }
79
86
 
 
87
        int watchTimeOut() { return m_watch != NULL ? m_watch->getTimeOut() : -1 ; }
 
88
 
80
89
        // Drag and drop functions
81
 
        QHash<QString, QString> itemData() { return m_itemData; }
82
 
        void setItemData( QHash<QString, QString> data ) { m_itemData = data; }
 
90
        QMap<QString, QString> itemData() { return m_itemData; }
 
91
        void setItemData( QMap<QString, QString> data ) { m_itemData = data; }
83
92
        int itemType() { return m_itemType; }
84
93
        void setItemType( int type ) { m_itemType = type; }
85
94
 
92
101
 
93
102
        virtual int
94
103
        paintProgressBar( QPainter* painter, const QLinearGradient& grad );
95
 
        
 
104
 
96
105
        virtual void
97
106
        paintBackground( QPainter* painter, int xPos, const QLinearGradient& grad );
98
 
        
 
107
 
99
108
        virtual void
100
109
        paintIcon( QPainter* painter, QRect rect, const QPixmap& icon );
101
 
        
 
110
 
102
111
        virtual QRect
103
112
        paintClock( QPainter* painter, QRect rect );
104
 
        
 
113
 
105
114
        virtual void
106
115
        paintText( QPainter* painter, QRect rect, QRect clockRect );
107
116
 
 
117
        virtual void
 
118
        paintGradients( QPainter* painter, bool progressBar = true );
 
119
 
108
120
        QString
109
121
        secondsToTimeString( int time );
110
122
 
111
 
    // EJ TODO: these should really be private but there was too much
112
 
    // getting the subclass to work properly so made them protected for now
113
 
    //private:
 
123
    private:
114
124
 
115
125
        void paintEvent( QPaintEvent* event );
116
126
        void disconnectWatch();
126
136
        QLinearGradient m_foregroundGradient;
127
137
 
128
138
        int m_itemType;
129
 
        QHash<QString, QString> m_itemData;
 
139
        QMap<QString, QString> m_itemData;
130
140
 
131
141
        bool m_progressEnabled;
132
142
        bool m_clockEnabled;