summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-10-31 13:57:32 (UTC)
committer llornkcor <llornkcor>2002-10-31 13:57:32 (UTC)
commitb0687f08f561a879311e934b1d297e2e8c53689f (patch) (unidiff)
tree6617025864f43dfcf9427a9483df2d8f56e81d09
parent74db7535e17fd87d98fc3b82be3a09d5dfbfe292 (diff)
downloadopie-b0687f08f561a879311e934b1d297e2e8c53689f.zip
opie-b0687f08f561a879311e934b1d297e2e8c53689f.tar.gz
opie-b0687f08f561a879311e934b1d297e2e8c53689f.tar.bz2
no refresh, and Ticker back is users background preference
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp4
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.h2
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp8
3 files changed, 10 insertions, 4 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp
index 82dfb13..baf8198 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp
@@ -1,56 +1,58 @@
1/* 1/*
2 * stocktickerplugin.cpp 2 * stocktickerplugin.cpp
3 * 3 *
4 * copyright : (c) 2002 by L.J. Potter 4 * copyright : (c) 2002 by L.J. Potter
5 * email : llornkcor@handhelds.org 5 * email : llornkcor@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17 17
18#include "stocktickerplugin.h" 18#include "stocktickerplugin.h"
19#include "stocktickerpluginwidget.h" 19#include "stocktickerpluginwidget.h"
20 20
21 21
22StockTickerPlugin::StockTickerPlugin() { 22StockTickerPlugin::StockTickerPlugin() {
23} 23}
24 24
25StockTickerPlugin::~StockTickerPlugin() { 25StockTickerPlugin::~StockTickerPlugin() {
26} 26}
27 27
28QString StockTickerPlugin::pluginName() const { 28QString StockTickerPlugin::pluginName() const {
29 return QObject::tr( "StockTicker plugin" ); 29 return QObject::tr( "StockTicker plugin" );
30} 30}
31 31
32double StockTickerPlugin::versionNumber() const { 32double StockTickerPlugin::versionNumber() const {
33 return 0.6; 33 return 0.6;
34} 34}
35 35
36QString StockTickerPlugin::pixmapNameWidget() const { 36QString StockTickerPlugin::pixmapNameWidget() const {
37 return "pass"; 37 return "pass";
38} 38}
39 39
40QWidget* StockTickerPlugin::widget( QWidget * wid ) { 40QWidget* StockTickerPlugin::widget( QWidget * wid ) {
41 return new StockTickerPluginWidget( wid, "StockTicker " ); 41 return new StockTickerPluginWidget( wid, "StockTicker " );
42} 42}
43 43
44QString StockTickerPlugin::pixmapNameConfig() const { 44QString StockTickerPlugin::pixmapNameConfig() const {
45 return 0l; 45 return 0l;
46} 46}
47 47
48TodayConfigWidget* StockTickerPlugin::configWidget( QWidget* wid ) { 48TodayConfigWidget* StockTickerPlugin::configWidget( QWidget* wid ) {
49 return 0l; 49 return 0l;
50} 50}
51 51
52QString StockTickerPlugin::appName() const { 52QString StockTickerPlugin::appName() const {
53 return "stockticker"; 53 return "stockticker";
54} 54}
55 55
56 56bool StockTickerPlugin::excludeFromRefresh() const {
57return true;
58}
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.h
index 9f174bf..7e7698f 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.h
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.h
@@ -1,47 +1,47 @@
1/* 1/*
2 * stocktickerplugin.h 2 * stocktickerplugin.h
3 * 3 *
4 * copyright : (c) 2002 by L.J. Potter 4 * copyright : (c) 2002 by L.J. Potter
5 * email : llornkcor@handhelds.org 5 * email : llornkcor@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17 17
18#ifndef STOCKTICKER_PLUGIN_H 18#ifndef STOCKTICKER_PLUGIN_H
19#define STOCKTICKER_PLUGIN_H 19#define STOCKTICKER_PLUGIN_H
20 20
21#include <qstring.h> 21#include <qstring.h>
22#include <qwidget.h> 22#include <qwidget.h>
23 23
24#include <opie/tododb.h> 24#include <opie/tododb.h>
25#include <opie/oclickablelabel.h> 25#include <opie/oclickablelabel.h>
26 26
27#include <opie/todayplugininterface.h> 27#include <opie/todayplugininterface.h>
28#include <opie/todayconfigwidget.h> 28#include <opie/todayconfigwidget.h>
29 29
30class StockTickerPlugin : public TodayPluginObject { 30class StockTickerPlugin : public TodayPluginObject {
31 31
32public: 32public:
33 StockTickerPlugin(); 33 StockTickerPlugin();
34 ~StockTickerPlugin(); 34 ~StockTickerPlugin();
35 35
36 QString pluginName() const; 36 QString pluginName() const;
37 double versionNumber() const; 37 double versionNumber() const;
38 QString pixmapNameWidget() const; 38 QString pixmapNameWidget() const;
39 QWidget* widget(QWidget *); 39 QWidget* widget(QWidget *);
40 QString pixmapNameConfig() const; 40 QString pixmapNameConfig() const;
41 TodayConfigWidget* configWidget(QWidget *); 41 TodayConfigWidget* configWidget(QWidget *);
42 QString appName() const; 42 QString appName() const;
43 43 bool excludeFromRefresh() const;
44 44
45}; 45};
46 46
47#endif 47#endif
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp b/noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp
index 6e6273b..3bdc820 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp
+++ b/noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp
@@ -1,93 +1,97 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37 37
38#include <qwidget.h> 38#include <qwidget.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include <qbutton.h> 40#include <qbutton.h>
41#include <qpainter.h> 41#include <qpainter.h>
42#include <qframe.h> 42#include <qframe.h>
43#include <qlayout.h> 43#include <qlayout.h>
44#include <qdir.h> 44#include <qdir.h>
45#include <stdlib.h> 45#include <stdlib.h>
46#include <stdio.h> 46#include <stdio.h>
47 47
48#include "ticker.h" 48#include "ticker.h"
49 49
50Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) { 50Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) {
51 setFrameStyle( NoFrame/*WinPanel | Sunken */); 51 setFrameStyle( NoFrame/*WinPanel | Sunken */);
52} 52}
53 53
54Ticker::~Ticker() { 54Ticker::~Ticker() {
55} 55}
56 56
57void Ticker::setText( const QString& text ) { 57void Ticker::setText( const QString& text ) {
58 58 Config cfg("qpe");
59 cfg.setGroup("Appearance");
60
59 pos = 0; // reset it everytime the text is changed 61 pos = 0; // reset it everytime the text is changed
60 scrollText = text; 62 scrollText = text;
61 63
62 int pixelLen = fontMetrics().width( text ); 64 int pixelLen = fontMetrics().width( text );
63 QPixmap pm( pixelLen, contentsRect().height() ); 65 QPixmap pm( pixelLen, contentsRect().height() );
64 pm.fill( QColor( 167, 212, 167 ) ); 66// pm.fill( QColor( 167, 212, 167 ));
67
68 pm.fill( QColor( cfg.readEntry( "Background", "#E5E1D5" ) ));
65 QPainter pmp( &pm ); 69 QPainter pmp( &pm );
66 pmp.setPen( Qt::black ); 70 pmp.setPen( Qt::black );
67 pmp.drawText( 0, 0, pixelLen, contentsRect().height(), AlignVCenter, scrollText ); 71 pmp.drawText( 0, 0, pixelLen, contentsRect().height(), AlignVCenter, scrollText );
68 pmp.end(); 72 pmp.end();
69 scrollTextPixmap = pm; 73 scrollTextPixmap = pm;
70 74
71 killTimers(); 75 killTimers();
72 if ( pixelLen > contentsRect().width() ) 76 if ( pixelLen > contentsRect().width() )
73 startTimer( 50 ); 77 startTimer( 50 );
74 update(); 78 update();
75} 79}
76 80
77 81
78void Ticker::timerEvent( QTimerEvent * ) { 82void Ticker::timerEvent( QTimerEvent * ) {
79 pos = ( pos <= 0 ) ? scrollTextPixmap.width() : pos - 1; 83 pos = ( pos <= 0 ) ? scrollTextPixmap.width() : pos - 1;
80 repaint( FALSE ); 84 repaint( FALSE );
81} 85}
82 86
83void Ticker::drawContents( QPainter *p ) { 87void Ticker::drawContents( QPainter *p ) {
84 int pixelLen = scrollTextPixmap.width(); 88 int pixelLen = scrollTextPixmap.width();
85 p->drawPixmap( pos, contentsRect().y(), scrollTextPixmap ); 89 p->drawPixmap( pos, contentsRect().y(), scrollTextPixmap );
86 if ( pixelLen > contentsRect().width() ) // Scrolling 90 if ( pixelLen > contentsRect().width() ) // Scrolling
87 p->drawPixmap( pos - pixelLen, contentsRect().y(), scrollTextPixmap ); 91 p->drawPixmap( pos - pixelLen, contentsRect().y(), scrollTextPixmap );
88} 92}
89 93
90void Ticker::mouseReleaseEvent( QMouseEvent * e) { 94void Ticker::mouseReleaseEvent( QMouseEvent * e) {
91 qDebug("<<<<<<<>>>>>>>>>"); 95 qDebug("<<<<<<<>>>>>>>>>");
92 emit mousePressed(); 96 emit mousePressed();
93} 97}