9 files changed, 21 insertions, 14 deletions
diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.cpp b/noncore/todayplugins/fortune/fortunepluginwidget.cpp index 3aa978c..c3ee546 100644 --- a/noncore/todayplugins/fortune/fortunepluginwidget.cpp +++ b/noncore/todayplugins/fortune/fortunepluginwidget.cpp | |||
@@ -1,81 +1,83 @@ | |||
1 | /* | 1 | /* |
2 | * fortunepluginwidget.cpp | 2 | * fortunepluginwidget.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@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 | #include "fortunepluginwidget.h" | 17 | #include "fortunepluginwidget.h" |
18 | 18 | ||
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | #include <qpe/qcopenvelope_qws.h> | 20 | #include <qpe/qcopenvelope_qws.h> |
21 | 21 | ||
22 | #include <qvaluelist.h> | 22 | #include <qvaluelist.h> |
23 | #include <qtl.h> | 23 | #include <qtl.h> |
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qscrollview.h> | 25 | #include <qscrollview.h> |
26 | #include <qobject.h> | 26 | #include <qobject.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | 28 | ||
29 | using namespace Opie::Core; | ||
30 | using namespace Opie::Ui; | ||
29 | FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name ) | 31 | FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name ) |
30 | : QWidget( parent, name ) | 32 | : QWidget( parent, name ) |
31 | { | 33 | { |
32 | 34 | ||
33 | fortune = NULL; | 35 | fortune = NULL; |
34 | getFortune(); | 36 | getFortune(); |
35 | } | 37 | } |
36 | 38 | ||
37 | FortunePluginWidget::~FortunePluginWidget() { | 39 | FortunePluginWidget::~FortunePluginWidget() { |
38 | if( fortuneProcess ){ | 40 | if( fortuneProcess ){ |
39 | delete fortuneProcess; | 41 | delete fortuneProcess; |
40 | } | 42 | } |
41 | } | 43 | } |
42 | 44 | ||
43 | /** | 45 | /** |
44 | * Get the fortunes | 46 | * Get the fortunes |
45 | */ | 47 | */ |
46 | void FortunePluginWidget::getFortune() { | 48 | void FortunePluginWidget::getFortune() { |
47 | 49 | ||
48 | QVBoxLayout* layoutFortune = new QVBoxLayout( this ); | 50 | QVBoxLayout* layoutFortune = new QVBoxLayout( this ); |
49 | 51 | ||
50 | if ( fortune ) { | 52 | if ( fortune ) { |
51 | delete fortune; | 53 | delete fortune; |
52 | } | 54 | } |
53 | 55 | ||
54 | fortune = new OTicker( this ); | 56 | fortune = new OTicker( this ); |
55 | //fortune->setReadOnly( TRUE ); | 57 | //fortune->setReadOnly( TRUE ); |
56 | //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); | 58 | //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); |
57 | 59 | ||
58 | fortune->setText( QString("Obtaining fortune...") ); | 60 | fortune->setText( QString("Obtaining fortune...") ); |
59 | layoutFortune->addWidget( fortune ); | 61 | layoutFortune->addWidget( fortune ); |
60 | 62 | ||
61 | fortuneProcess = new OProcess(); | 63 | fortuneProcess = new OProcess(); |
62 | *fortuneProcess << "fortune"; | 64 | *fortuneProcess << "fortune"; |
63 | 65 | ||
64 | connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*,char*,int) ), | 66 | connect(fortuneProcess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ), |
65 | this, SLOT(slotStdOut(OProcess*,char*,int) ) ); | 67 | this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int) ) ); |
66 | 68 | ||
67 | if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 69 | if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
68 | qWarning("could not start :("); | 70 | qWarning("could not start :("); |
69 | fortune->setText( QString("Failed to obtain fortune.") ); | 71 | fortune->setText( QString("Failed to obtain fortune.") ); |
70 | delete fortuneProcess; | 72 | delete fortuneProcess; |
71 | fortuneProcess = 0; | 73 | fortuneProcess = 0; |
72 | } | 74 | } |
73 | 75 | ||
74 | } | 76 | } |
75 | 77 | ||
76 | void FortunePluginWidget::slotStdOut( OProcess* /*proc*/, char* buf, int len ) | 78 | void FortunePluginWidget::slotStdOut( OProcess* /*proc*/, char* buf, int len ) |
77 | { | 79 | { |
78 | QCString s( buf, len ); | 80 | QCString s( buf, len ); |
79 | s.replace( QRegExp("\n"), "" ); | 81 | s.replace( QRegExp("\n"), "" ); |
80 | fortune->setText( s ); | 82 | fortune->setText( s ); |
81 | } | 83 | } |
diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.h b/noncore/todayplugins/fortune/fortunepluginwidget.h index abb7bed..1b71430 100644 --- a/noncore/todayplugins/fortune/fortunepluginwidget.h +++ b/noncore/todayplugins/fortune/fortunepluginwidget.h | |||
@@ -1,45 +1,45 @@ | |||
1 | /* | 1 | /* |
2 | * fortunepluginwidget.h | 2 | * fortunepluginwidget.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Chris Larson | 4 | * copyright : (c) 2002 by Chris Larson |
5 | * email : kergoth@handhelds.org | 5 | * email : kergoth@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 | #ifndef FORTUNE_PLUGIN_WIDGET_H | 17 | #ifndef FORTUNE_PLUGIN_WIDGET_H |
18 | #define FORTUNE_PLUGIN_WIDGET_H | 18 | #define FORTUNE_PLUGIN_WIDGET_H |
19 | 19 | ||
20 | #include <opie2/oprocess.h> | 20 | #include <opie2/oprocess.h> |
21 | #include <opie2/oticker.h> | 21 | #include <opie2/oticker.h> |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | 25 | ||
26 | class FortunePluginWidget : public QWidget | 26 | class FortunePluginWidget : public QWidget |
27 | { | 27 | { |
28 | 28 | ||
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | 30 | ||
31 | public: | 31 | public: |
32 | FortunePluginWidget( QWidget *parent, const char *name ); | 32 | FortunePluginWidget( QWidget *parent, const char *name ); |
33 | ~FortunePluginWidget(); | 33 | ~FortunePluginWidget(); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | OTicker *fortune; | 36 | Opie::Ui::OTicker *fortune; |
37 | OProcess *fortuneProcess; | 37 | Opie::Core::OProcess *fortuneProcess; |
38 | 38 | ||
39 | void getFortune(); | 39 | void getFortune(); |
40 | 40 | ||
41 | private slots: | 41 | private slots: |
42 | void slotStdOut( OProcess*, char*, int ); | 42 | void slotStdOut( Opie::Core::OProcess*, char*, int ); |
43 | }; | 43 | }; |
44 | 44 | ||
45 | #endif | 45 | #endif |
diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp index b3fa708..ce35256 100644 --- a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp +++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp | |||
@@ -1,86 +1,88 @@ | |||
1 | #include "inputDialog.h" | 1 | #include "inputDialog.h" |
2 | 2 | ||
3 | #include <qapplication.h> | 3 | #include <qapplication.h> |
4 | #include <qlayout.h> | 4 | #include <qlayout.h> |
5 | #include <qcheckbox.h> | 5 | #include <qcheckbox.h> |
6 | #include <qlineedit.h> | 6 | #include <qlineedit.h> |
7 | #include <qvariant.h> | 7 | #include <qvariant.h> |
8 | #include <qpushbutton.h> | 8 | #include <qpushbutton.h> |
9 | #include <qwhatsthis.h> | 9 | #include <qwhatsthis.h> |
10 | #include <qlabel.h> | 10 | #include <qlabel.h> |
11 | #include <qlayout.h> | 11 | #include <qlayout.h> |
12 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
13 | #include <qstringlist.h> | 13 | #include <qstringlist.h> |
14 | using namespace Opie::Core; | ||
15 | using namespace Opie::Core; | ||
14 | #include <qmainwindow.h> | 16 | #include <qmainwindow.h> |
15 | #include "helpwindow.h" | 17 | #include "helpwindow.h" |
16 | 18 | ||
17 | #include <stdlib.h> | 19 | #include <stdlib.h> |
18 | // #include <sys/stat.h> | 20 | // #include <sys/stat.h> |
19 | // #include <unistd.h> | 21 | // #include <unistd.h> |
20 | 22 | ||
21 | InputDialog::InputDialog( ) | 23 | InputDialog::InputDialog( ) |
22 | : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { | 24 | : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { |
23 | setCaption( tr("Symbol Lookup")); | 25 | setCaption( tr("Symbol Lookup")); |
24 | 26 | ||
25 | QGridLayout *layout = new QGridLayout( this ); | 27 | QGridLayout *layout = new QGridLayout( this ); |
26 | layout->setSpacing(6); | 28 | layout->setSpacing(6); |
27 | layout->setMargin( 2); | 29 | layout->setMargin( 2); |
28 | 30 | ||
29 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 31 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
30 | LineEdit1->setFocus(); | 32 | LineEdit1->setFocus(); |
31 | 33 | ||
32 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); | 34 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); |
33 | 35 | ||
34 | QLabel *label; | 36 | QLabel *label; |
35 | label = new QLabel(this); | 37 | label = new QLabel(this); |
36 | label->setText( tr("Enter something to lookup / search.")); | 38 | label->setText( tr("Enter something to lookup / search.")); |
37 | label->setMaximumHeight(60); | 39 | label->setMaximumHeight(60); |
38 | layout->addMultiCellWidget( label, 1, 1, 0, 3); | 40 | layout->addMultiCellWidget( label, 1, 1, 0, 3); |
39 | 41 | ||
40 | connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup())); | 42 | connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup())); |
41 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); | 43 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); |
42 | layout->addItem( spacer, 8, 0 ); | 44 | layout->addItem( spacer, 8, 0 ); |
43 | 45 | ||
44 | } | 46 | } |
45 | 47 | ||
46 | InputDialog::~InputDialog() { | 48 | InputDialog::~InputDialog() { |
47 | } | 49 | } |
48 | 50 | ||
49 | void InputDialog::doLookup() { | 51 | void InputDialog::doLookup() { |
50 | // http://finance.yahoo.com/l?m=&s=siemens&t= | 52 | // http://finance.yahoo.com/l?m=&s=siemens&t= |
51 | 53 | ||
52 | QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\""; | 54 | QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\""; |
53 | QString tempHtml = "/tmp/stockticker.html"; | 55 | QString tempHtml = "/tmp/stockticker.html"; |
54 | QString cmd = "wget -O "+tempHtml+" "+url; | 56 | QString cmd = "wget -O "+tempHtml+" "+url; |
55 | qDebug(cmd); | 57 | qDebug(cmd); |
56 | 58 | ||
57 | 59 | ||
58 | /* | 60 | /* |
59 | OProcess proc; | 61 | OProcess proc; |
60 | proc << "/usr/bin/wget"; | 62 | proc << "/usr/bin/wget"; |
61 | proc<<"-O"<< tempHtml<< url; | 63 | proc<<"-O"<< tempHtml<< url; |
62 | 64 | ||
63 | connect( &proc, SIGNAL( processExited(OProcess*)),this, SLOT( showBrowser(OProcess*))); | 65 | connect( &proc, SIGNAL( processExited(Opie::Core::OProcess*)),this, SLOT( showBrowser(Opie::Core::OProcess*))); |
64 | proc.start( OProcess::NotifyOnExit); | 66 | proc.start( OProcess::NotifyOnExit); |
65 | */ | 67 | */ |
66 | system(cmd.latin1()); | 68 | system(cmd.latin1()); |
67 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); | 69 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); |
68 | StockLookup->setCaption("Symbol"); | 70 | StockLookup->setCaption("Symbol"); |
69 | StockLookup->showMaximized(); | 71 | StockLookup->showMaximized(); |
70 | StockLookup->show(); | 72 | StockLookup->show(); |
71 | LineEdit1->text(); | 73 | LineEdit1->text(); |
72 | 74 | ||
73 | 75 | ||
74 | } | 76 | } |
75 | 77 | ||
76 | void InputDialog::showBrowser(OProcess*) { | 78 | void InputDialog::showBrowser(OProcess*) { |
77 | qDebug("BLAH"); | 79 | qDebug("BLAH"); |
78 | QString tempHtml = "/tmp/stockticker.html"; | 80 | QString tempHtml = "/tmp/stockticker.html"; |
79 | 81 | ||
80 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); | 82 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); |
81 | StockLookup->setCaption("Symbol"); | 83 | StockLookup->setCaption("Symbol"); |
82 | StockLookup->showMaximized(); | 84 | StockLookup->showMaximized(); |
83 | StockLookup->show(); | 85 | StockLookup->show(); |
84 | LineEdit1->text(); | 86 | LineEdit1->text(); |
85 | 87 | ||
86 | } | 88 | } |
diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.h b/noncore/todayplugins/stockticker/stockticker/inputDialog.h index a1c00bd..d7ff94c 100644 --- a/noncore/todayplugins/stockticker/stockticker/inputDialog.h +++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.h | |||
@@ -1,30 +1,30 @@ | |||
1 | 1 | ||
2 | #ifndef INPUTDIALOG_H | 2 | #ifndef INPUTDIALOG_H |
3 | #define INPUTDIALOG_H | 3 | #define INPUTDIALOG_H |
4 | 4 | ||
5 | #include <opie2/oprocess.h> | 5 | #include <opie2/oprocess.h> |
6 | 6 | ||
7 | #include <qvariant.h> | 7 | #include <qvariant.h> |
8 | #include <qdialog.h> | 8 | #include <qdialog.h> |
9 | #include <qmainwindow.h> | 9 | #include <qmainwindow.h> |
10 | 10 | ||
11 | class QLineEdit; | 11 | class QLineEdit; |
12 | class QCheckBox; | 12 | class QCheckBox; |
13 | 13 | ||
14 | class InputDialog : public QMainWindow { | 14 | class InputDialog : public QMainWindow { |
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | 16 | ||
17 | public: | 17 | public: |
18 | InputDialog( ); | 18 | InputDialog( ); |
19 | ~InputDialog(); | 19 | ~InputDialog(); |
20 | 20 | ||
21 | private: | 21 | private: |
22 | QLineEdit* LineEdit1; | 22 | QLineEdit* LineEdit1; |
23 | private slots: | 23 | private slots: |
24 | void doLookup(); | 24 | void doLookup(); |
25 | void showBrowser(OProcess*); | 25 | void showBrowser(Opie::Core::OProcess*); |
26 | protected slots: | 26 | protected slots: |
27 | 27 | ||
28 | }; | 28 | }; |
29 | 29 | ||
30 | #endif // INPUTDIALOG_H | 30 | #endif // INPUTDIALOG_H |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp index 51113ba..aaeb5ee 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | |||
@@ -1,214 +1,216 @@ | |||
1 | /* | 1 | /* |
2 | * stocktickerpluginwidget.cpp | 2 | * stocktickerpluginwidget.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 | #include <opie2/oticker.h> | 17 | #include <opie2/oticker.h> |
18 | 18 | ||
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | 20 | ||
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | 22 | ||
23 | using namespace Opie::Ui; | ||
24 | using namespace Opie::Ui; | ||
23 | extern "C" { | 25 | extern "C" { |
24 | #include "libstocks/stocks.h" | 26 | #include "libstocks/stocks.h" |
25 | } | 27 | } |
26 | 28 | ||
27 | #include <pthread.h> | 29 | #include <pthread.h> |
28 | 30 | ||
29 | #include "stocktickerpluginwidget.h" | 31 | #include "stocktickerpluginwidget.h" |
30 | 32 | ||
31 | QString output; | 33 | QString output; |
32 | OTicker *stocktickerTicker; | 34 | OTicker *stocktickerTicker; |
33 | QCString stock_liste; | 35 | QCString stock_liste; |
34 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; | 36 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; |
35 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; | 37 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; |
36 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; | 38 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; |
37 | 39 | ||
38 | void getStocks(char *blah) { | 40 | void getStocks(char *blah) { |
39 | 41 | ||
40 | // stocktickerTicker->setText( "Downloading stock data."); | 42 | // stocktickerTicker->setText( "Downloading stock data."); |
41 | stock *stocks_quotes=NULL; | 43 | stock *stocks_quotes=NULL; |
42 | stock *stocks_tmp; | 44 | stock *stocks_tmp; |
43 | stock_liste = blah; | 45 | stock_liste = blah; |
44 | ::free ( blah ); | 46 | ::free ( blah ); |
45 | // char *stock_liste = (char *)blah->latin1(); | 47 | // char *stock_liste = (char *)blah->latin1(); |
46 | // qDebug("%s", stock_liste.data() ); | 48 | // qDebug("%s", stock_liste.data() ); |
47 | output = ""; | 49 | output = ""; |
48 | QString tempString; | 50 | QString tempString; |
49 | libstocks_return_code error; | 51 | libstocks_return_code error; |
50 | 52 | ||
51 | // Config cfg( "stockticker"); | 53 | // Config cfg( "stockticker"); |
52 | // cfg.setGroup( "Fields" ); | 54 | // cfg.setGroup( "Fields" ); |
53 | // bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; | 55 | // bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; |
54 | // bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; | 56 | // bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; |
55 | // bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; | 57 | // bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; |
56 | 58 | ||
57 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; | 59 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; |
58 | 60 | ||
59 | dotimeCheck=1; | 61 | dotimeCheck=1; |
60 | dodateCheck=1; | 62 | dodateCheck=1; |
61 | dosymbolCheck=1; | 63 | dosymbolCheck=1; |
62 | donameCheck=1; | 64 | donameCheck=1; |
63 | docurrentPriceCheck=1; | 65 | docurrentPriceCheck=1; |
64 | dolastPriceCheck=1; | 66 | dolastPriceCheck=1; |
65 | doopenPriceCheck=1; | 67 | doopenPriceCheck=1; |
66 | dominPriceCheck=1; | 68 | dominPriceCheck=1; |
67 | domaxPriceCheck=1; | 69 | domaxPriceCheck=1; |
68 | dovariationCheck=1; | 70 | dovariationCheck=1; |
69 | dovolumeCheck=1; | 71 | dovolumeCheck=1; |
70 | 72 | ||
71 | // dotimeCheck=cfg.readBoolEntry("timeCheck",1); | 73 | // dotimeCheck=cfg.readBoolEntry("timeCheck",1); |
72 | // dodateCheck=cfg.readBoolEntry("dateCheck",1); | 74 | // dodateCheck=cfg.readBoolEntry("dateCheck",1); |
73 | // dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); | 75 | // dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); |
74 | // donameCheck=cfg.readBoolEntry("nameCheck",1); | 76 | // donameCheck=cfg.readBoolEntry("nameCheck",1); |
75 | // docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1); | 77 | // docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1); |
76 | // dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1); | 78 | // dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1); |
77 | // doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1); | 79 | // doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1); |
78 | // dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1); | 80 | // dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1); |
79 | // domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1); | 81 | // domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1); |
80 | // dovariationCheck=cfg.readBoolEntry("variationCheck",1); | 82 | // dovariationCheck=cfg.readBoolEntry("variationCheck",1); |
81 | // dovolumeCheck=cfg.readBoolEntry("volumeCheck",1); | 83 | // dovolumeCheck=cfg.readBoolEntry("volumeCheck",1); |
82 | 84 | ||
83 | // DefProxy(); | 85 | // DefProxy(); |
84 | // { | 86 | // { |
85 | char *proxy; | 87 | char *proxy; |
86 | // libstocks_return_code error; | 88 | // libstocks_return_code error; |
87 | 89 | ||
88 | /* Proxy support */ | 90 | /* Proxy support */ |
89 | /* Checks for "http_proxy" environment variable */ | 91 | /* Checks for "http_proxy" environment variable */ |
90 | proxy = getenv("http_proxy"); | 92 | proxy = getenv("http_proxy"); |
91 | if(proxy) { | 93 | if(proxy) { |
92 | /* printf("proxy set\n"); */ | 94 | /* printf("proxy set\n"); */ |
93 | error = set_proxy(proxy); | 95 | error = set_proxy(proxy); |
94 | if (error) { | 96 | if (error) { |
95 | // printf("Proxy error (%d)\n", error); | 97 | // printf("Proxy error (%d)\n", error); |
96 | // QString tempString2; | 98 | // QString tempString2; |
97 | // tempString2.sprintf("Proxy error (%d)\n", error); | 99 | // tempString2.sprintf("Proxy error (%d)\n", error); |
98 | // output = tempString2; | 100 | // output = tempString2; |
99 | // delete tempString2; | 101 | // delete tempString2; |
100 | return; | 102 | return; |
101 | // exit(1); | 103 | // exit(1); |
102 | } | 104 | } |
103 | } | 105 | } |
104 | ::free(proxy); | 106 | ::free(proxy); |
105 | // } | 107 | // } |
106 | /* Get the stocks and process errors */ | 108 | /* Get the stocks and process errors */ |
107 | error = get_stocks( stock_liste.data(), &stocks_quotes); | 109 | error = get_stocks( stock_liste.data(), &stocks_quotes); |
108 | 110 | ||
109 | if (error) { | 111 | if (error) { |
110 | printf("Error in getting stocks (%d)\n", error); | 112 | printf("Error in getting stocks (%d)\n", error); |
111 | tempString.sprintf("Error in getting stocks (%d)\n", error); | 113 | tempString.sprintf("Error in getting stocks (%d)\n", error); |
112 | output =tempString; | 114 | output =tempString; |
113 | return; | 115 | return; |
114 | } | 116 | } |
115 | 117 | ||
116 | stocks_tmp = stocks_quotes; | 118 | stocks_tmp = stocks_quotes; |
117 | 119 | ||
118 | /* Displays the stocks */ | 120 | /* Displays the stocks */ |
119 | while(stocks_tmp!=0){ | 121 | while(stocks_tmp!=0){ |
120 | 122 | ||
121 | if (stocks_tmp->Time) { | 123 | if (stocks_tmp->Time) { |
122 | // printf("%s ", stocks_tmp->Time); | 124 | // printf("%s ", stocks_tmp->Time); |
123 | tempString.sprintf("| %s ", stocks_tmp->Time); | 125 | tempString.sprintf("| %s ", stocks_tmp->Time); |
124 | tempString.replace(QRegExp("\""),""); | 126 | tempString.replace(QRegExp("\""),""); |
125 | if( dotimeCheck) | 127 | if( dotimeCheck) |
126 | output +=tempString; | 128 | output +=tempString; |
127 | } | 129 | } |
128 | if (stocks_tmp->Date) { | 130 | if (stocks_tmp->Date) { |
129 | // printf("%s ", stocks_tmp->Date); | 131 | // printf("%s ", stocks_tmp->Date); |
130 | tempString.sprintf("| %s ", stocks_tmp->Date); | 132 | tempString.sprintf("| %s ", stocks_tmp->Date); |
131 | tempString.replace(QRegExp("\""),""); | 133 | tempString.replace(QRegExp("\""),""); |
132 | if(dodateCheck) | 134 | if(dodateCheck) |
133 | output +=tempString; | 135 | output +=tempString; |
134 | } | 136 | } |
135 | // printf("\n"); | 137 | // printf("\n"); |
136 | 138 | ||
137 | // printf("----------------------------------------\n"); | 139 | // printf("----------------------------------------\n"); |
138 | 140 | ||
139 | if ( strlen(stocks_tmp->Symbol) > 20 ) { | 141 | if ( strlen(stocks_tmp->Symbol) > 20 ) { |
140 | // printf("| Symbol | %.20s |\n",stocks_tmp->Symbol); | 142 | // printf("| Symbol | %.20s |\n",stocks_tmp->Symbol); |
141 | tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol); | 143 | tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol); |
142 | if(dosymbolCheck) | 144 | if(dosymbolCheck) |
143 | output +=tempString; | 145 | output +=tempString; |
144 | } | 146 | } |
145 | else { | 147 | else { |
146 | // printf("| Symbol | %-20s |\n",stocks_tmp->Symbol); | 148 | // printf("| Symbol | %-20s |\n",stocks_tmp->Symbol); |
147 | tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol); | 149 | tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol); |
148 | if(dosymbolCheck) | 150 | if(dosymbolCheck) |
149 | output +=tempString; | 151 | output +=tempString; |
150 | } | 152 | } |
151 | 153 | ||
152 | if (stocks_tmp->Name) { | 154 | if (stocks_tmp->Name) { |
153 | if ( strlen(stocks_tmp->Name) > 20 ) { | 155 | if ( strlen(stocks_tmp->Name) > 20 ) { |
154 | // printf("| Name %.20s |\n",stocks_tmp->Name); | 156 | // printf("| Name %.20s |\n",stocks_tmp->Name); |
155 | tempString.sprintf("| Name %s ",stocks_tmp->Name); | 157 | tempString.sprintf("| Name %s ",stocks_tmp->Name); |
156 | tempString.stripWhiteSpace(); | 158 | tempString.stripWhiteSpace(); |
157 | if(donameCheck) | 159 | if(donameCheck) |
158 | output +=tempString; | 160 | output +=tempString; |
159 | } else { | 161 | } else { |
160 | // printf("| Name | %-20s |\n",stocks_tmp->Name); | 162 | // printf("| Name | %-20s |\n",stocks_tmp->Name); |
161 | tempString.sprintf("| Name %s ",stocks_tmp->Name); | 163 | tempString.sprintf("| Name %s ",stocks_tmp->Name); |
162 | tempString.stripWhiteSpace(); | 164 | tempString.stripWhiteSpace(); |
163 | if(donameCheck) | 165 | if(donameCheck) |
164 | output +=tempString; | 166 | output +=tempString; |
165 | } | 167 | } |
166 | } | 168 | } |
167 | else { | 169 | else { |
168 | // printf("| Name | |\n"); | 170 | // printf("| Name | |\n"); |
169 | tempString.sprintf("| Name | |"); | 171 | tempString.sprintf("| Name | |"); |
170 | if(donameCheck) | 172 | if(donameCheck) |
171 | output +=tempString; | 173 | output +=tempString; |
172 | } | 174 | } |
173 | 175 | ||
174 | // printf("| Price | %-7.2f |\n", stocks_tmp->CurrentPrice); | 176 | // printf("| Price | %-7.2f |\n", stocks_tmp->CurrentPrice); |
175 | tempString.sprintf("| Price %-7.2f ", stocks_tmp->CurrentPrice); | 177 | tempString.sprintf("| Price %-7.2f ", stocks_tmp->CurrentPrice); |
176 | if(docurrentPriceCheck) | 178 | if(docurrentPriceCheck) |
177 | output +=tempString; | 179 | output +=tempString; |
178 | 180 | ||
179 | // printf("| Yesterday | %-7.2f |\n",stocks_tmp->LastPrice); | 181 | // printf("| Yesterday | %-7.2f |\n",stocks_tmp->LastPrice); |
180 | tempString.sprintf("| Yesterday %-7.2f ",stocks_tmp->LastPrice); | 182 | tempString.sprintf("| Yesterday %-7.2f ",stocks_tmp->LastPrice); |
181 | if(dolastPriceCheck) | 183 | if(dolastPriceCheck) |
182 | output +=tempString; | 184 | output +=tempString; |
183 | 185 | ||
184 | // printf("| Open | %-7.2f |\n",stocks_tmp->OpenPrice); | 186 | // printf("| Open | %-7.2f |\n",stocks_tmp->OpenPrice); |
185 | tempString.sprintf("| Open %-7.2f ",stocks_tmp->OpenPrice); | 187 | tempString.sprintf("| Open %-7.2f ",stocks_tmp->OpenPrice); |
186 | if(doopenPriceCheck) | 188 | if(doopenPriceCheck) |
187 | output +=tempString; | 189 | output +=tempString; |
188 | 190 | ||
189 | // printf("| Min | %-7.2f |\n", stocks_tmp->MinPrice); | 191 | // printf("| Min | %-7.2f |\n", stocks_tmp->MinPrice); |
190 | tempString.sprintf("| Min %-7.2f ", stocks_tmp->MinPrice); | 192 | tempString.sprintf("| Min %-7.2f ", stocks_tmp->MinPrice); |
191 | if(dominPriceCheck) | 193 | if(dominPriceCheck) |
192 | output +=tempString; | 194 | output +=tempString; |
193 | 195 | ||
194 | // printf("| Max | %-7.2f |\n",stocks_tmp->MaxPrice); | 196 | // printf("| Max | %-7.2f |\n",stocks_tmp->MaxPrice); |
195 | tempString.sprintf("| Max %-7.2f ",stocks_tmp->MaxPrice); | 197 | tempString.sprintf("| Max %-7.2f ",stocks_tmp->MaxPrice); |
196 | if(domaxPriceCheck) | 198 | if(domaxPriceCheck) |
197 | output +=tempString; | 199 | output +=tempString; |
198 | 200 | ||
199 | // printf("| Var | %-6.2f (%5.2f %%) |\n", stocks_tmp->Variation, stocks_tmp->Pourcentage); | 201 | // printf("| Var | %-6.2f (%5.2f %%) |\n", stocks_tmp->Variation, stocks_tmp->Pourcentage); |
200 | tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage); | 202 | tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage); |
201 | if(dovariationCheck) | 203 | if(dovariationCheck) |
202 | output +=tempString; | 204 | output +=tempString; |
203 | 205 | ||
204 | // printf("| Volume | %-9d |\n", stocks_tmp->Volume); | 206 | // printf("| Volume | %-9d |\n", stocks_tmp->Volume); |
205 | tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume); | 207 | tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume); |
206 | if(dovolumeCheck) | 208 | if(dovolumeCheck) |
207 | output +=tempString; | 209 | output +=tempString; |
208 | 210 | ||
209 | // printf("----------------------------------------\n\n"); | 211 | // printf("----------------------------------------\n\n"); |
210 | tempString.sprintf("||==++==|"); | 212 | tempString.sprintf("||==++==|"); |
211 | output +=tempString; | 213 | output +=tempString; |
212 | 214 | ||
213 | /* Simple function which help to browse in the stocks list */ | 215 | /* Simple function which help to browse in the stocks list */ |
214 | stocks_tmp = next_stock(stocks_tmp); | 216 | stocks_tmp = next_stock(stocks_tmp); |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h index 8a8fbf8..727e289 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h | |||
@@ -1,62 +1,62 @@ | |||
1 | /* | 1 | /* |
2 | * stocktickerpluginwidget.h | 2 | * stocktickerpluginwidget.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by L.J. Potter | 4 | * copyright : (c) 2002 by L.J. Potter |
5 | * email : lornkcor@handhelds.org | 5 | * email : lornkcor@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 STOCKTICKERL_PLUGIN_WIDGET_H | 18 | #ifndef STOCKTICKERL_PLUGIN_WIDGET_H |
19 | #define STOCKTICKERL_PLUGIN_WIDGET_H | 19 | #define STOCKTICKERL_PLUGIN_WIDGET_H |
20 | 20 | ||
21 | #include <qsocket.h> | 21 | #include <qsocket.h> |
22 | #include <qstring.h> | 22 | #include <qstring.h> |
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | #include <qlineedit.h> | 24 | #include <qlineedit.h> |
25 | 25 | ||
26 | #include <opie/oclickablelabel.h> | 26 | #include <opie2/oclickablelabel.h> |
27 | #include <opie/oticker.h> | 27 | #include <opie2/oticker.h> |
28 | 28 | ||
29 | #include <sys/types.h> | 29 | #include <sys/types.h> |
30 | #include <sys/uio.h> | 30 | #include <sys/uio.h> |
31 | #include <unistd.h> | 31 | #include <unistd.h> |
32 | #include <stdio.h> | 32 | #include <stdio.h> |
33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
34 | #include <string.h> | 34 | #include <string.h> |
35 | 35 | ||
36 | class QTimer; | 36 | class QTimer; |
37 | 37 | ||
38 | class StockTickerPluginWidget : public QWidget { | 38 | class StockTickerPluginWidget : public QWidget { |
39 | 39 | ||
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | 41 | ||
42 | public: | 42 | public: |
43 | StockTickerPluginWidget( QWidget *parent, const char *name ); | 43 | StockTickerPluginWidget( QWidget *parent, const char *name ); |
44 | ~StockTickerPluginWidget(); | 44 | ~StockTickerPluginWidget(); |
45 | 45 | ||
46 | protected slots: | 46 | protected slots: |
47 | void doStocks(); | 47 | void doStocks(); |
48 | void isConnected(); | 48 | void isConnected(); |
49 | void socketError(int); | 49 | void socketError(int); |
50 | void checkConnection(); | 50 | void checkConnection(); |
51 | private: | 51 | private: |
52 | int updateSpeed; | 52 | int updateSpeed; |
53 | QString symbollist; | 53 | QString symbollist; |
54 | bool wasError; | 54 | bool wasError; |
55 | QSocket *Sock; | 55 | QSocket *Sock; |
56 | void timerEvent( QTimerEvent * ); | 56 | void timerEvent( QTimerEvent * ); |
57 | void init(); | 57 | void init(); |
58 | // void DefProxy(void); | 58 | // void DefProxy(void); |
59 | int timerDelay; | 59 | int timerDelay; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | #endif | 62 | #endif |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktimerpluginwidget.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktimerpluginwidget.h index d7b6047..667d9c9 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktimerpluginwidget.h +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktimerpluginwidget.h | |||
@@ -1,44 +1,44 @@ | |||
1 | /* | 1 | /* |
2 | * mailpluginwidget.h | 2 | * mailpluginwidget.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@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 MAIL_PLUGIN_WIDGET_H | 18 | #ifndef MAIL_PLUGIN_WIDGET_H |
19 | #define MAIL_PLUGIN_WIDGET_H | 19 | #define MAIL_PLUGIN_WIDGET_H |
20 | 20 | ||
21 | #include <qstring.h> | 21 | #include <qstring.h> |
22 | #include <qwidget.h> | 22 | #include <qwidget.h> |
23 | 23 | ||
24 | #include <opie/oclickablelabel.h> | 24 | #include <opie2/oclickablelabel.h> |
25 | 25 | ||
26 | class MailPluginWidget : public QWidget { | 26 | class MailPluginWidget : public QWidget { |
27 | 27 | ||
28 | Q_OBJECT | 28 | Q_OBJECT |
29 | 29 | ||
30 | 30 | ||
31 | public: | 31 | public: |
32 | MailPluginWidget( QWidget *parent, const char *name ); | 32 | MailPluginWidget( QWidget *parent, const char *name ); |
33 | ~MailPluginWidget(); | 33 | ~MailPluginWidget(); |
34 | 34 | ||
35 | protected slots: | 35 | protected slots: |
36 | void startMail(); | 36 | void startMail(); |
37 | 37 | ||
38 | private: | 38 | private: |
39 | OClickableLabel *mailLabel; | 39 | Opie::Ui::OClickableLabel *mailLabel; |
40 | void readConfig(); | 40 | void readConfig(); |
41 | void getInfo(); | 41 | void getInfo(); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/todayplugins/weather/weatherpluginwidget.cpp b/noncore/todayplugins/weather/weatherpluginwidget.cpp index ad99a43..8e00c36 100644 --- a/noncore/todayplugins/weather/weatherpluginwidget.cpp +++ b/noncore/todayplugins/weather/weatherpluginwidget.cpp | |||
@@ -1,300 +1,301 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qimage.h> | 30 | #include <qimage.h> |
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <qpixmap.h> | 33 | #include <qpixmap.h> |
34 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
35 | 35 | ||
36 | #include <opie2/oprocess.h> | 36 | #include <opie2/oprocess.h> |
37 | 37 | ||
38 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
39 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
40 | 40 | ||
41 | #include "weatherpluginwidget.h" | 41 | #include "weatherpluginwidget.h" |
42 | 42 | ||
43 | using namespace Opie::Core; | ||
43 | WeatherPluginWidget::WeatherPluginWidget( QWidget *parent, const char* name ) | 44 | WeatherPluginWidget::WeatherPluginWidget( QWidget *parent, const char* name ) |
44 | : QWidget( parent, name ) | 45 | : QWidget( parent, name ) |
45 | { | 46 | { |
46 | QHBoxLayout *layout = new QHBoxLayout( this ); | 47 | QHBoxLayout *layout = new QHBoxLayout( this ); |
47 | layout->setAutoAdd( TRUE ); | 48 | layout->setAutoAdd( TRUE ); |
48 | layout->setSpacing( 2 ); | 49 | layout->setSpacing( 2 ); |
49 | 50 | ||
50 | weatherIcon = new QLabel( this ); | 51 | weatherIcon = new QLabel( this ); |
51 | weatherIcon->setMaximumWidth( 32 ); | 52 | weatherIcon->setMaximumWidth( 32 ); |
52 | QImage logo1 = Resource::loadImage( "Clock" ); | 53 | QImage logo1 = Resource::loadImage( "Clock" ); |
53 | QPixmap pic; | 54 | QPixmap pic; |
54 | pic.convertFromImage( logo1 ); | 55 | pic.convertFromImage( logo1 ); |
55 | weatherIcon->setPixmap( pic ); | 56 | weatherIcon->setPixmap( pic ); |
56 | 57 | ||
57 | weatherLabel = new QLabel( tr( "Retreiving current weather information." ), this ); | 58 | weatherLabel = new QLabel( tr( "Retreiving current weather information." ), this ); |
58 | weatherLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) ); | 59 | weatherLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) ); |
59 | 60 | ||
60 | startTimer(1000); | 61 | startTimer(1000); |
61 | } | 62 | } |
62 | 63 | ||
63 | WeatherPluginWidget::~WeatherPluginWidget() | 64 | WeatherPluginWidget::~WeatherPluginWidget() |
64 | { | 65 | { |
65 | QFile file( localFile ); | 66 | QFile file( localFile ); |
66 | if ( file.exists() ) | 67 | if ( file.exists() ) |
67 | { | 68 | { |
68 | file.remove(); | 69 | file.remove(); |
69 | } | 70 | } |
70 | } | 71 | } |
71 | 72 | ||
72 | void WeatherPluginWidget::timerEvent( QTimerEvent *e ) | 73 | void WeatherPluginWidget::timerEvent( QTimerEvent *e ) |
73 | { | 74 | { |
74 | killTimer( e->timerId() ); | 75 | killTimer( e->timerId() ); |
75 | retreiveData(); | 76 | retreiveData(); |
76 | } | 77 | } |
77 | 78 | ||
78 | 79 | ||
79 | 80 | ||
80 | void WeatherPluginWidget::retreiveData() | 81 | void WeatherPluginWidget::retreiveData() |
81 | { | 82 | { |
82 | Config config( "todayweatherplugin"); | 83 | Config config( "todayweatherplugin"); |
83 | config.setGroup( "Config" ); | 84 | config.setGroup( "Config" ); |
84 | 85 | ||
85 | location = config.readEntry( "Location", "" ); | 86 | location = config.readEntry( "Location", "" ); |
86 | useMetric = config.readBoolEntry( "Metric", TRUE ); | 87 | useMetric = config.readBoolEntry( "Metric", TRUE ); |
87 | frequency = config.readNumEntry( "Frequency", 5 ); | 88 | frequency = config.readNumEntry( "Frequency", 5 ); |
88 | 89 | ||
89 | startTimer( frequency * 60000 ); | 90 | startTimer( frequency * 60000 ); |
90 | 91 | ||
91 | localFile = "/tmp/"; | 92 | localFile = "/tmp/"; |
92 | localFile.append( location ); | 93 | localFile.append( location ); |
93 | localFile.append( ".TXT" ); | 94 | localFile.append( ".TXT" ); |
94 | 95 | ||
95 | remoteFile = "http://weather.noaa.gov/pub/data/observations/metar/stations/"; | 96 | remoteFile = "http://weather.noaa.gov/pub/data/observations/metar/stations/"; |
96 | remoteFile.append( location ); | 97 | remoteFile.append( location ); |
97 | remoteFile.append( ".TXT" ); | 98 | remoteFile.append( ".TXT" ); |
98 | 99 | ||
99 | QFile file( localFile ); | 100 | QFile file( localFile ); |
100 | if ( file.exists() ) | 101 | if ( file.exists() ) |
101 | { | 102 | { |
102 | file.remove(); | 103 | file.remove(); |
103 | } | 104 | } |
104 | 105 | ||
105 | OProcess *proc = new OProcess; | 106 | OProcess *proc = new OProcess; |
106 | 107 | ||
107 | *proc << "wget" << "-q" << remoteFile << "-O" << localFile; | 108 | *proc << "wget" << "-q" << remoteFile << "-O" << localFile; |
108 | connect( proc, SIGNAL( processExited(OProcess*) ), this, SLOT( dataRetrieved(OProcess*) ) ); | 109 | connect( proc, SIGNAL( processExited(Opie::Core::OProcess*) ), this, SLOT( dataRetrieved(Opie::Core::OProcess*) ) ); |
109 | proc->start(); | 110 | proc->start(); |
110 | } | 111 | } |
111 | 112 | ||
112 | void WeatherPluginWidget::displayWeather() | 113 | void WeatherPluginWidget::displayWeather() |
113 | { | 114 | { |
114 | weatherData = QString::null; | 115 | weatherData = QString::null; |
115 | 116 | ||
116 | QFile file( localFile ); | 117 | QFile file( localFile ); |
117 | 118 | ||
118 | if ( file.size() > 0 && file.open( IO_ReadOnly ) ) | 119 | if ( file.size() > 0 && file.open( IO_ReadOnly ) ) |
119 | { | 120 | { |
120 | QTextStream data( &file ); | 121 | QTextStream data( &file ); |
121 | while ( !data.eof() ) | 122 | while ( !data.eof() ) |
122 | { | 123 | { |
123 | weatherData.append( data.readLine() ); | 124 | weatherData.append( data.readLine() ); |
124 | } | 125 | } |
125 | file.close(); | 126 | file.close(); |
126 | weatherData = weatherData.simplifyWhiteSpace(); | 127 | weatherData = weatherData.simplifyWhiteSpace(); |
127 | 128 | ||
128 | QString tmpstr; | 129 | QString tmpstr; |
129 | 130 | ||
130 | tmpstr.append( tr( "Temp: " ) ); | 131 | tmpstr.append( tr( "Temp: " ) ); |
131 | getTemp( weatherData ); | 132 | getTemp( weatherData ); |
132 | tmpstr.append( dataStr ); | 133 | tmpstr.append( dataStr ); |
133 | 134 | ||
134 | tmpstr.append( tr( " Wind: " ) ); | 135 | tmpstr.append( tr( " Wind: " ) ); |
135 | getWind( weatherData ); | 136 | getWind( weatherData ); |
136 | tmpstr.append( dataStr ); | 137 | tmpstr.append( dataStr ); |
137 | 138 | ||
138 | tmpstr.append( tr( "\nPres: " ) ); | 139 | tmpstr.append( tr( "\nPres: " ) ); |
139 | getPressure( weatherData ); | 140 | getPressure( weatherData ); |
140 | tmpstr.append( dataStr ); | 141 | tmpstr.append( dataStr ); |
141 | 142 | ||
142 | weatherLabel->setText( tmpstr ); | 143 | weatherLabel->setText( tmpstr ); |
143 | 144 | ||
144 | tmpstr = "todayweatherplugin/"; | 145 | tmpstr = "todayweatherplugin/"; |
145 | getIcon( weatherData ); | 146 | getIcon( weatherData ); |
146 | tmpstr.append( dataStr ); | 147 | tmpstr.append( dataStr ); |
147 | QImage logo1 = Resource::loadImage( tmpstr ); | 148 | QImage logo1 = Resource::loadImage( tmpstr ); |
148 | QPixmap pic; | 149 | QPixmap pic; |
149 | pic.convertFromImage( logo1 ); | 150 | pic.convertFromImage( logo1 ); |
150 | weatherIcon->setPixmap( pic ); | 151 | weatherIcon->setPixmap( pic ); |
151 | } | 152 | } |
152 | else | 153 | else |
153 | { | 154 | { |
154 | weatherLabel->setText( tr( "Current weather data not available." ) ); | 155 | weatherLabel->setText( tr( "Current weather data not available." ) ); |
155 | } | 156 | } |
156 | } | 157 | } |
157 | 158 | ||
158 | void WeatherPluginWidget::getTemp( const QString &data ) | 159 | void WeatherPluginWidget::getTemp( const QString &data ) |
159 | { | 160 | { |
160 | int value; | 161 | int value; |
161 | bool ok; | 162 | bool ok; |
162 | 163 | ||
163 | int pos = data.find( QRegExp( "M?[0-9]+/M?[0-9]+" ), 20 ); | 164 | int pos = data.find( QRegExp( "M?[0-9]+/M?[0-9]+" ), 20 ); |
164 | if ( pos > -1 ) | 165 | if ( pos > -1 ) |
165 | { | 166 | { |
166 | if ( data.at( pos ) == 'M' ) | 167 | if ( data.at( pos ) == 'M' ) |
167 | { | 168 | { |
168 | value = -1 * data.mid( pos + 1, 2 ).toInt( &ok ); | 169 | value = -1 * data.mid( pos + 1, 2 ).toInt( &ok ); |
169 | } | 170 | } |
170 | else | 171 | else |
171 | { | 172 | { |
172 | value = data.mid( pos, 2 ).toInt( &ok ); | 173 | value = data.mid( pos, 2 ).toInt( &ok ); |
173 | } | 174 | } |
174 | if ( useMetric ) | 175 | if ( useMetric ) |
175 | { | 176 | { |
176 | dataStr = QString::number( value ); | 177 | dataStr = QString::number( value ); |
177 | dataStr.append( 'C' ); | 178 | dataStr.append( 'C' ); |
178 | } | 179 | } |
179 | else | 180 | else |
180 | { | 181 | { |
181 | dataStr = QString::number( ( value * 9 / 5 ) + 32 ); | 182 | dataStr = QString::number( ( value * 9 / 5 ) + 32 ); |
182 | dataStr.append( 'F' ); | 183 | dataStr.append( 'F' ); |
183 | } | 184 | } |
184 | } | 185 | } |
185 | else | 186 | else |
186 | { | 187 | { |
187 | dataStr = tr( "n/a" ); | 188 | dataStr = tr( "n/a" ); |
188 | } | 189 | } |
189 | } | 190 | } |
190 | 191 | ||
191 | void WeatherPluginWidget::getWind( const QString &data ) | 192 | void WeatherPluginWidget::getWind( const QString &data ) |
192 | { | 193 | { |
193 | int value; | 194 | int value; |
194 | bool ok; | 195 | bool ok; |
195 | 196 | ||
196 | int pos = data.find( QRegExp( "[0-9]*G*[0-9]*KT" ), 20 ); | 197 | int pos = data.find( QRegExp( "[0-9]*G*[0-9]*KT" ), 20 ); |
197 | if ( pos > -1 ) | 198 | if ( pos > -1 ) |
198 | { | 199 | { |
199 | if ( data.mid( pos, 3 ) != "VRB" ) | 200 | if ( data.mid( pos, 3 ) != "VRB" ) |
200 | { | 201 | { |
201 | value = data.mid( pos, 3 ).toInt( &ok ); | 202 | value = data.mid( pos, 3 ).toInt( &ok ); |
202 | if ( ( value >= 0 && value < 23 ) || ( value >= 239 && value <= 360 ) ) | 203 | if ( ( value >= 0 && value < 23 ) || ( value >= 239 && value <= 360 ) ) |
203 | dataStr = tr("E " ); | 204 | dataStr = tr("E " ); |
204 | else if ( value >= 23 && value < 69 ) | 205 | else if ( value >= 23 && value < 69 ) |
205 | dataStr = tr( "NE " ); | 206 | dataStr = tr( "NE " ); |
206 | else if ( value >= 69 && value < 113 ) | 207 | else if ( value >= 69 && value < 113 ) |
207 | dataStr = tr( "N " ); | 208 | dataStr = tr( "N " ); |
208 | else if ( value >= 113 && value < 157 ) | 209 | else if ( value >= 113 && value < 157 ) |
209 | dataStr = tr( "NW " ); | 210 | dataStr = tr( "NW " ); |
210 | else if ( value >= 157 && value < 203 ) | 211 | else if ( value >= 157 && value < 203 ) |
211 | dataStr = tr( "W " ); | 212 | dataStr = tr( "W " ); |
212 | else if ( value >= 203 && value < 248 ) | 213 | else if ( value >= 203 && value < 248 ) |
213 | dataStr = tr( "SW " ); | 214 | dataStr = tr( "SW " ); |
214 | else if ( value >= 248 && value < 294 ) | 215 | else if ( value >= 248 && value < 294 ) |
215 | dataStr = tr( "S " ); | 216 | dataStr = tr( "S " ); |
216 | else if ( value >= 294 && value < 238 ) | 217 | else if ( value >= 294 && value < 238 ) |
217 | dataStr = tr( "SE " ); | 218 | dataStr = tr( "SE " ); |
218 | } | 219 | } |
219 | if ( data.mid( pos + 5, 1) == "G" || | 220 | if ( data.mid( pos + 5, 1) == "G" || |
220 | data.mid( pos + 5, 1) == "K" ) | 221 | data.mid( pos + 5, 1) == "K" ) |
221 | { | 222 | { |
222 | value = data.mid( pos + 3, 2 ).toInt( &ok ); | 223 | value = data.mid( pos + 3, 2 ).toInt( &ok ); |
223 | } | 224 | } |
224 | else | 225 | else |
225 | { | 226 | { |
226 | value = data.mid( pos + 3, 3 ).toInt( &ok ); | 227 | value = data.mid( pos + 3, 3 ).toInt( &ok ); |
227 | } | 228 | } |
228 | if ( useMetric ) | 229 | if ( useMetric ) |
229 | { | 230 | { |
230 | value = value * 3.6 / 1.94; | 231 | value = value * 3.6 / 1.94; |
231 | dataStr.append( QString::number( value ) ); | 232 | dataStr.append( QString::number( value ) ); |
232 | dataStr.append( tr( " KPH" ) ); | 233 | dataStr.append( tr( " KPH" ) ); |
233 | } | 234 | } |
234 | else | 235 | else |
235 | { | 236 | { |
236 | value = value * 2.24 / 1.94; | 237 | value = value * 2.24 / 1.94; |
237 | dataStr.append( QString::number( value ) ); | 238 | dataStr.append( QString::number( value ) ); |
238 | dataStr.append( tr( " MPH" ) ); | 239 | dataStr.append( tr( " MPH" ) ); |
239 | } | 240 | } |
240 | } | 241 | } |
241 | else | 242 | else |
242 | { | 243 | { |
243 | dataStr = tr( "n/a" ); | 244 | dataStr = tr( "n/a" ); |
244 | } | 245 | } |
245 | } | 246 | } |
246 | 247 | ||
247 | void WeatherPluginWidget::getPressure( const QString &data ) | 248 | void WeatherPluginWidget::getPressure( const QString &data ) |
248 | { | 249 | { |
249 | float value; | 250 | float value; |
250 | bool ok; | 251 | bool ok; |
251 | 252 | ||
252 | int pos = data.find( QRegExp( "[AQ][0-9]+" ), 20 ); | 253 | int pos = data.find( QRegExp( "[AQ][0-9]+" ), 20 ); |
253 | if ( pos > -1 ) | 254 | if ( pos > -1 ) |
254 | { | 255 | { |
255 | value = data.mid( pos + 1, 4 ).toFloat( &ok ); | 256 | value = data.mid( pos + 1, 4 ).toFloat( &ok ); |
256 | if ( useMetric ) | 257 | if ( useMetric ) |
257 | { | 258 | { |
258 | if ( data.mid( pos, 1 ) == "A" ) | 259 | if ( data.mid( pos, 1 ) == "A" ) |
259 | value *= 33.8639 / 100; | 260 | value *= 33.8639 / 100; |
260 | dataStr = QString::number( value, 'f', 2 ); | 261 | dataStr = QString::number( value, 'f', 2 ); |
261 | dataStr.append( tr( " kPa" ) ); | 262 | dataStr.append( tr( " kPa" ) ); |
262 | } | 263 | } |
263 | else | 264 | else |
264 | { | 265 | { |
265 | if ( data.mid( pos, 1 ) == "Q" ) | 266 | if ( data.mid( pos, 1 ) == "Q" ) |
266 | value /= 33.8639; | 267 | value /= 33.8639; |
267 | else | 268 | else |
268 | value /= 100; | 269 | value /= 100; |
269 | dataStr = QString::number( value, 'f', 2 ); | 270 | dataStr = QString::number( value, 'f', 2 ); |
270 | dataStr.append( tr( " Hg" ) ); | 271 | dataStr.append( tr( " Hg" ) ); |
271 | } | 272 | } |
272 | } | 273 | } |
273 | else | 274 | else |
274 | { | 275 | { |
275 | dataStr = tr( "n/a" ); | 276 | dataStr = tr( "n/a" ); |
276 | } | 277 | } |
277 | } | 278 | } |
278 | 279 | ||
279 | void WeatherPluginWidget::getIcon(const QString &data ) | 280 | void WeatherPluginWidget::getIcon(const QString &data ) |
280 | { | 281 | { |
281 | dataStr = "psunny"; | 282 | dataStr = "psunny"; |
282 | if ( data.find( "CLR ", 20 ) > -1 || | 283 | if ( data.find( "CLR ", 20 ) > -1 || |
283 | data.find( "SKC ", 20 ) > -1 || | 284 | data.find( "SKC ", 20 ) > -1 || |
284 | data.find( "CAVOK ", 20 ) > -1 ) | 285 | data.find( "CAVOK ", 20 ) > -1 ) |
285 | { | 286 | { |
286 | dataStr = "sunny"; | 287 | dataStr = "sunny"; |
287 | } | 288 | } |
288 | else if ( data.find( "SH ", 20 ) > -1 || | 289 | else if ( data.find( "SH ", 20 ) > -1 || |
289 | data.find( "DZ ", 20 ) > -1 || | 290 | data.find( "DZ ", 20 ) > -1 || |
290 | data.find( "RA ", 20 ) > -1 || | 291 | data.find( "RA ", 20 ) > -1 || |
291 | data.find( "UP ", 20 ) > -1 || | 292 | data.find( "UP ", 20 ) > -1 || |
292 | data.find( "BR ", 20 ) > -1 ) | 293 | data.find( "BR ", 20 ) > -1 ) |
293 | { | 294 | { |
294 | dataStr = "shower"; | 295 | dataStr = "shower"; |
295 | } | 296 | } |
296 | else if ( data.find( "TS ", 20 ) > -1 ) | 297 | else if ( data.find( "TS ", 20 ) > -1 ) |
297 | { | 298 | { |
298 | dataStr = "tstorm"; | 299 | dataStr = "tstorm"; |
299 | } | 300 | } |
300 | else if ( data.find( "SN ", 20 ) > -1 || | 301 | else if ( data.find( "SN ", 20 ) > -1 || |
diff --git a/noncore/todayplugins/weather/weatherpluginwidget.h b/noncore/todayplugins/weather/weatherpluginwidget.h index d2bbd8b..93d0f59 100644 --- a/noncore/todayplugins/weather/weatherpluginwidget.h +++ b/noncore/todayplugins/weather/weatherpluginwidget.h | |||
@@ -1,71 +1,71 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef WEATHER_PLUGIN_WIDGET_H | 29 | #ifndef WEATHER_PLUGIN_WIDGET_H |
30 | #define WEATHER_PLUGIN_WIDGET_H | 30 | #define WEATHER_PLUGIN_WIDGET_H |
31 | 31 | ||
32 | #include <qstring.h> | 32 | #include <qstring.h> |
33 | #include <qwidget.h> | 33 | #include <qwidget.h> |
34 | 34 | ||
35 | class OProcess; | 35 | namespace Opie {namespace Core {class Opie::Core::OProcess;}} |
36 | class QLabel; | 36 | class QLabel; |
37 | class QTimer; | 37 | class QTimer; |
38 | 38 | ||
39 | class WeatherPluginWidget : public QWidget { | 39 | class WeatherPluginWidget : public QWidget { |
40 | 40 | ||
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | 42 | ||
43 | public: | 43 | public: |
44 | WeatherPluginWidget( QWidget *parent, const char *name ); | 44 | WeatherPluginWidget( QWidget *parent, const char *name ); |
45 | ~WeatherPluginWidget(); | 45 | ~WeatherPluginWidget(); |
46 | 46 | ||
47 | private: | 47 | private: |
48 | QString location; | 48 | QString location; |
49 | QString remoteFile; | 49 | QString remoteFile; |
50 | QString localFile; | 50 | QString localFile; |
51 | QString weatherData; | 51 | QString weatherData; |
52 | QString dataStr; | 52 | QString dataStr; |
53 | bool useMetric; | 53 | bool useMetric; |
54 | int frequency; | 54 | int frequency; |
55 | 55 | ||
56 | QLabel *weatherLabel; | 56 | QLabel *weatherLabel; |
57 | QLabel *weatherIcon; | 57 | QLabel *weatherIcon; |
58 | 58 | ||
59 | void timerEvent( QTimerEvent * ); | 59 | void timerEvent( QTimerEvent * ); |
60 | void retreiveData(); | 60 | void retreiveData(); |
61 | void displayWeather(); | 61 | void displayWeather(); |
62 | void getTemp( const QString & ); | 62 | void getTemp( const QString & ); |
63 | void getWind( const QString & ); | 63 | void getWind( const QString & ); |
64 | void getPressure( const QString & ); | 64 | void getPressure( const QString & ); |
65 | void getIcon( const QString & ); | 65 | void getIcon( const QString & ); |
66 | 66 | ||
67 | private slots: | 67 | private slots: |
68 | void dataRetrieved( OProcess * ); | 68 | void dataRetrieved( Opie::Core::OProcess * ); |
69 | }; | 69 | }; |
70 | 70 | ||
71 | #endif | 71 | #endif |