-rw-r--r-- | libopie/oticker.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie/oticker.cpp b/libopie/oticker.cpp index 9a7044d..4fb5945 100644 --- a/libopie/oticker.cpp +++ b/libopie/oticker.cpp | |||
@@ -38,54 +38,54 @@ | |||
38 | #include <qpainter.h> | 38 | #include <qpainter.h> |
39 | #include <qframe.h> | 39 | #include <qframe.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include <stdlib.h> | 42 | #include <stdlib.h> |
43 | #include <stdio.h> | 43 | #include <stdio.h> |
44 | 44 | ||
45 | #include "oticker.h" | 45 | #include "oticker.h" |
46 | 46 | ||
47 | OTicker::OTicker( QWidget* parent ) | 47 | OTicker::OTicker( QWidget* parent ) |
48 | : QLabel( parent ) { | 48 | : QLabel( parent ) { |
49 | // : QFrame( parent ) { | 49 | // : QFrame( parent ) { |
50 | setTextFormat(Qt::RichText); | 50 | setTextFormat(Qt::RichText); |
51 | Config cfg("qpe"); | 51 | Config cfg("qpe"); |
52 | cfg.setGroup("Appearance"); | 52 | cfg.setGroup("Appearance"); |
53 | backgroundcolor = QColor( cfg.readEntry( "Background", "#E5E1D5" ) ); | 53 | backgroundcolor = QColor( cfg.readEntry( "Background", "#E5E1D5" ) ); |
54 | foregroundcolor= Qt::black; | 54 | foregroundcolor= Qt::black; |
55 | updateTimerTime = 50; | 55 | updateTimerTime = 50; |
56 | scrollLength = 1; | 56 | scrollLength = 1; |
57 | } | 57 | } |
58 | 58 | ||
59 | OTicker::~OTicker() { | 59 | OTicker::~OTicker() { |
60 | } | 60 | } |
61 | 61 | ||
62 | void OTicker::setBackgroundColor(QColor backcolor) { | 62 | void OTicker::setBackgroundColor(const QColor& backcolor) { |
63 | backgroundcolor = backcolor; | 63 | backgroundcolor = backcolor; |
64 | update(); | 64 | update(); |
65 | } | 65 | } |
66 | 66 | ||
67 | void OTicker::setForegroundColor(QColor backcolor) { | 67 | void OTicker::setForegroundColor(const QColor& backcolor) { |
68 | foregroundcolor = backcolor; | 68 | foregroundcolor = backcolor; |
69 | update(); | 69 | update(); |
70 | } | 70 | } |
71 | 71 | ||
72 | void OTicker::setFrame(int frameStyle) { | 72 | void OTicker::setFrame(int frameStyle) { |
73 | setFrameStyle( frameStyle/*WinPanel | Sunken */); | 73 | setFrameStyle( frameStyle/*WinPanel | Sunken */); |
74 | update(); | 74 | update(); |
75 | } | 75 | } |
76 | 76 | ||
77 | void OTicker::setText( const QString& text ) { | 77 | void OTicker::setText( const QString& text ) { |
78 | pos = 0; // reset it everytime the text is changed | 78 | pos = 0; // reset it everytime the text is changed |
79 | scrollText = text; | 79 | scrollText = text; |
80 | qDebug(scrollText); | 80 | qDebug(scrollText); |
81 | 81 | ||
82 | int pixelLen = 0; | 82 | int pixelLen = 0; |
83 | bool bigger = false; | 83 | bool bigger = false; |
84 | int contWidth = contentsRect().width(); | 84 | int contWidth = contentsRect().width(); |
85 | int contHeight = contentsRect().height(); | 85 | int contHeight = contentsRect().height(); |
86 | int pixelTextLen = fontMetrics().width( text ); | 86 | int pixelTextLen = fontMetrics().width( text ); |
87 | printf("<<<<<<<height %d, width %d, text width %d %d\n", contHeight, contWidth, pixelTextLen, scrollText.length()); | 87 | printf("<<<<<<<height %d, width %d, text width %d %d\n", contHeight, contWidth, pixelTextLen, scrollText.length()); |
88 | if( pixelTextLen < contWidth) | 88 | if( pixelTextLen < contWidth) |
89 | { | 89 | { |
90 | pixelLen = contWidth; | 90 | pixelLen = contWidth; |
91 | } | 91 | } |