summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libqtaux/oticker.cpp45
1 files changed, 26 insertions, 19 deletions
diff --git a/libqtaux/oticker.cpp b/libqtaux/oticker.cpp
index c05c2a8..2d8397e 100644
--- a/libqtaux/oticker.cpp
+++ b/libqtaux/oticker.cpp
@@ -29,14 +29,12 @@
29*/ 29*/
30 30
31#include <qpe/config.h>
32
33#include <stdlib.h>
34#include <stdio.h>
35
36#include "oticker.h" 31#include "oticker.h"
37 32
33/* OPIE */
34#include <qpe/config.h>
35
38OTicker::OTicker( QWidget* parent ) 36OTicker::OTicker( QWidget* parent )
39 : QLabel( parent ) { 37 : QLabel( parent )
40 // : QFrame( parent ) { 38{
41 setTextFormat(Qt::RichText); 39 setTextFormat(Qt::RichText);
42 Config cfg("qpe"); 40 Config cfg("qpe");
@@ -48,23 +46,27 @@ OTicker::OTicker( QWidget* parent )
48} 46}
49 47
50OTicker::~OTicker() { 48OTicker::~OTicker()
51} 49{}
52 50
53void OTicker::setBackgroundColor(const QColor& backcolor) { 51void OTicker::setBackgroundColor( const QColor& backcolor )
52{
54 backgroundcolor = backcolor; 53 backgroundcolor = backcolor;
55 update(); 54 update();
56} 55}
57 56
58void OTicker::setForegroundColor(const QColor& backcolor) { 57void OTicker::setForegroundColor( const QColor& backcolor )
58{
59 foregroundcolor = backcolor; 59 foregroundcolor = backcolor;
60 update(); 60 update();
61} 61}
62 62
63void OTicker::setFrame(int frameStyle) { 63void OTicker::setFrame( int frameStyle )
64{
64 setFrameStyle( frameStyle/*WinPanel | Sunken */); 65 setFrameStyle( frameStyle/*WinPanel | Sunken */);
65 update(); 66 update();
66} 67}
67 68
68void OTicker::setText( const QString& text ) { 69void OTicker::setText( const QString& text )
70{
69 pos = 0; // reset it everytime the text is changed 71 pos = 0; // reset it everytime the text is changed
70 scrollText = text; 72 scrollText = text;
@@ -76,5 +78,5 @@ qDebug(scrollText);
76 int contHeight = contentsRect().height(); 78 int contHeight = contentsRect().height();
77 int pixelTextLen = fontMetrics().width( text ); 79 int pixelTextLen = fontMetrics().width( text );
78 printf("<<<<<<<height %d, width %d, text width %d %d\n", contHeight, contWidth, pixelTextLen, scrollText.length()); 80 qDebug( "<<<<<<<height %d, width %d, text width %d %d\n", contHeight, contWidth, pixelTextLen, scrollText.length() );
79 if( pixelTextLen < contWidth) 81 if( pixelTextLen < contWidth)
80 { 82 {
@@ -104,10 +106,12 @@ qDebug(scrollText);
104 106
105 107
106void OTicker::timerEvent( QTimerEvent * ) { 108void OTicker::timerEvent( QTimerEvent * )
109{
107 pos = ( pos <= 0 ) ? scrollTextPixmap.width() : pos - scrollLength;//1; 110 pos = ( pos <= 0 ) ? scrollTextPixmap.width() : pos - scrollLength;//1;
108 repaint( FALSE ); 111 repaint( FALSE );
109} 112}
110 113
111void OTicker::drawContents( QPainter *p ) { 114void OTicker::drawContents( QPainter *p )
115{
112 int pixelLen = scrollTextPixmap.width(); 116 int pixelLen = scrollTextPixmap.width();
113 p->drawPixmap( pos, contentsRect().y(), scrollTextPixmap ); 117 p->drawPixmap( pos, contentsRect().y(), scrollTextPixmap );
@@ -116,14 +120,17 @@ void OTicker::drawContents( QPainter *p ) {
116} 120}
117 121
118void OTicker::mouseReleaseEvent( QMouseEvent * ) { 122void OTicker::mouseReleaseEvent( QMouseEvent * )
123{
119// qDebug("<<<<<<<>>>>>>>>>"); 124// qDebug("<<<<<<<>>>>>>>>>");
120 emit mousePressed(); 125 emit mousePressed();
121} 126}
122 127
123void OTicker::setUpdateTime(int time) { 128void OTicker::setUpdateTime( int time )
129{
124 updateTimerTime=time; 130 updateTimerTime=time;
125} 131}
126 132
127void OTicker::setScrollLength(int len) { 133void OTicker::setScrollLength( int len )
134{
128scrollLength=len; 135scrollLength=len;
129} 136}