wmmoonclock: Rename changelog to ChangeLog; clean up and split off TODO.
[dockapps.git] / Temperature.app / Temperature.h
blob8810bc98f8a9ff66f235e0bdd7aa8c02abb29543
1 //
2 // Temperature.app
3 //
4 // Copyright (c) 2000-2002 Per Liden
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307,
19 // USA.
22 #ifndef _TEMPERATURE_H_
23 #define _TEMPERATURE_H_
25 #include <fstream>
26 #include <X11/Xlib.h>
28 #define APPNAME "Temperature.app"
29 #define VERSION "1.5"
30 #define INSTANCENAME "temperature_app"
31 #define CLASSNAME "Temperature_app"
32 #define METAR_URL "http://weather.noaa.gov/pub/data/observations/metar/decoded/%s.TXT"
33 #define UPDATE_INTERVAL 900
34 #define TIME_POS 22
35 #define TEMP_POS 35
36 #define TEMP_WITH_TIME_POS 42
37 #define TIME_FONT "-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*"
38 #define AMPM_FONT "-*-helvetica-medium-r-*-*-8-*-*-*-*-*-*-*"
39 #define TEMP_FONT "-*-helvetica-medium-r-*-*-18-*-*-*-*-*-*-*"
40 #define UNIT_FONT "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*"
41 #define LED_X 57
42 #define LED_Y 59
43 #define TMP_FILE "/tmp/temperature.app-XXXXXX"
45 /* temporary hack */
46 using namespace std;
48 enum ChildStatus
50 ChildRunning,
51 ChildDone,
52 ChildError
55 class Temperature
57 public:
58 Temperature(int argc, char** argv);
59 ~Temperature() {};
60 void run();
62 private:
63 void tryHelp(char* appname);
64 void showHelp();
65 void checkArgument(char** argv, int argc, int index);
66 void showErrorLed(bool show);
67 void calcTimeDiff();
68 void setTime(char* utcTime);
69 bool updateTemperture(ifstream& file);
70 void showLed(bool show);
72 Display* mDisplay;
73 Window mRoot;
74 Window mAppWin;
75 Window mIconWin;
76 Window mStatusLed;
77 char* mInstanceName;
78 char* mStationId;
79 char mTemperature[5];
80 char mTime[6];
81 char* mTimeAMPM;
82 double mTimeDiff;
83 bool mFahrenheit;
84 bool mShowTime;
85 bool mTime12HourFormat;
86 bool mVerbose;
89 #endif