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