-rw-r--r-- | libqtaux/oticker.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libqtaux/oticker.cpp b/libqtaux/oticker.cpp index 2d8397e..e954cc8 100644 --- a/libqtaux/oticker.cpp +++ b/libqtaux/oticker.cpp | |||
@@ -1,83 +1,85 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 3 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "oticker.h" | 31 | #include "oticker.h" |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | 35 | ||
36 | using namespace Opie::Ui; | ||
37 | |||
36 | OTicker::OTicker( QWidget* parent ) | 38 | OTicker::OTicker( QWidget* parent ) |
37 | : QLabel( parent ) | 39 | : QLabel( parent ) |
38 | { | 40 | { |
39 | setTextFormat( Qt::RichText ); | 41 | setTextFormat( Qt::RichText ); |
40 | Config cfg( "qpe" ); | 42 | Config cfg( "qpe" ); |
41 | cfg.setGroup( "Appearance" ); | 43 | cfg.setGroup( "Appearance" ); |
42 | backgroundcolor = QColor( cfg.readEntry( "Background", "#E5E1D5" ) ); | 44 | backgroundcolor = QColor( cfg.readEntry( "Background", "#E5E1D5" ) ); |
43 | foregroundcolor = Qt::black; | 45 | foregroundcolor = Qt::black; |
44 | updateTimerTime = 50; | 46 | updateTimerTime = 50; |
45 | scrollLength = 1; | 47 | scrollLength = 1; |
46 | } | 48 | } |
47 | 49 | ||
48 | OTicker::~OTicker() | 50 | OTicker::~OTicker() |
49 | {} | 51 | {} |
50 | 52 | ||
51 | void OTicker::setBackgroundColor( const QColor& backcolor ) | 53 | void OTicker::setBackgroundColor( const QColor& backcolor ) |
52 | { | 54 | { |
53 | backgroundcolor = backcolor; | 55 | backgroundcolor = backcolor; |
54 | update(); | 56 | update(); |
55 | } | 57 | } |
56 | 58 | ||
57 | void OTicker::setForegroundColor( const QColor& backcolor ) | 59 | void OTicker::setForegroundColor( const QColor& backcolor ) |
58 | { | 60 | { |
59 | foregroundcolor = backcolor; | 61 | foregroundcolor = backcolor; |
60 | update(); | 62 | update(); |
61 | } | 63 | } |
62 | 64 | ||
63 | void OTicker::setFrame( int frameStyle ) | 65 | void OTicker::setFrame( int frameStyle ) |
64 | { | 66 | { |
65 | setFrameStyle( frameStyle /*WinPanel | Sunken */ ); | 67 | setFrameStyle( frameStyle /*WinPanel | Sunken */ ); |
66 | update(); | 68 | update(); |
67 | } | 69 | } |
68 | 70 | ||
69 | void OTicker::setText( const QString& text ) | 71 | void OTicker::setText( const QString& text ) |
70 | { | 72 | { |
71 | pos = 0; // reset it everytime the text is changed | 73 | pos = 0; // reset it everytime the text is changed |
72 | scrollText = text; | 74 | scrollText = text; |
73 | qDebug( scrollText ); | 75 | qDebug( scrollText ); |
74 | 76 | ||
75 | int pixelLen = 0; | 77 | int pixelLen = 0; |
76 | bool bigger = false; | 78 | bool bigger = false; |
77 | int contWidth = contentsRect().width(); | 79 | int contWidth = contentsRect().width(); |
78 | int contHeight = contentsRect().height(); | 80 | int contHeight = contentsRect().height(); |
79 | int pixelTextLen = fontMetrics().width( text ); | 81 | int pixelTextLen = fontMetrics().width( text ); |
80 | qDebug( "<<<<<<<height %d, width %d, text width %d %d\n", contHeight, contWidth, pixelTextLen, scrollText.length() ); | 82 | qDebug( "<<<<<<<height %d, width %d, text width %d %d\n", contHeight, contWidth, pixelTextLen, scrollText.length() ); |
81 | if ( pixelTextLen < contWidth ) | 83 | if ( pixelTextLen < contWidth ) |
82 | { | 84 | { |
83 | pixelLen = contWidth; | 85 | pixelLen = contWidth; |