Diffstat (limited to 'core/settings/citytime/zonemap.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/citytime/zonemap.cpp | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/core/settings/citytime/zonemap.cpp b/core/settings/citytime/zonemap.cpp index 872e786..b83da59 100644 --- a/core/settings/citytime/zonemap.cpp +++ b/core/settings/citytime/zonemap.cpp | |||
@@ -1,86 +1,79 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | // changes by Maximilian Reiss <harlekin@handhelds.org> | 21 | // changes by Maximilian Reiss <harlekin@handhelds.org> |
22 | 22 | ||
23 | #include "sun.h" | 23 | #include "sun.h" |
24 | #include "zonemap.h" | 24 | #include "zonemap.h" |
25 | 25 | ||
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/timestring.h> | ||
28 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
29 | 28 | ||
30 | #include <qdatetime.h> | ||
31 | #include <qfile.h> | 29 | #include <qfile.h> |
32 | #include <qimage.h> | ||
33 | #include <qlabel.h> | 30 | #include <qlabel.h> |
34 | #include <qlist.h> | ||
35 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
36 | #include <qpixmap.h> | ||
37 | #include <qpainter.h> | ||
38 | #include <qregexp.h> | ||
39 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
40 | #include <qtimer.h> | 33 | #include <qtimer.h> |
41 | #include <qtoolbutton.h> | 34 | #include <qtoolbutton.h> |
42 | #include <qlayout.h> | 35 | #include <qlayout.h> |
43 | #include <qhbox.h> | 36 | #include <qhbox.h> |
44 | #include <qlistview.h> | 37 | #include <qlistview.h> |
45 | #include <qwhatsthis.h> | 38 | #include <qwhatsthis.h> |
46 | 39 | ||
47 | #include <limits.h> | 40 | #include <limits.h> |
48 | 41 | ||
49 | // the map file... | 42 | // the map file... |
50 | static const char strZONEINFO[] = "/usr/share/zoneinfo/zone.tab"; | 43 | static const char strZONEINFO[] = "/usr/share/zoneinfo/zone.tab"; |
51 | static const char strMAP[] = "citytime/simple_grid_400"; | 44 | static const char strMAP[] = "citytime/simple_grid_400"; |
52 | 45 | ||
53 | // the maximum distance we'll allow the pointer to be away from a city | 46 | // the maximum distance we'll allow the pointer to be away from a city |
54 | // and still show the city's time | 47 | // and still show the city's time |
55 | static const int iTHRESHOLD = 50000; | 48 | static const int iTHRESHOLD = 50000; |
56 | 49 | ||
57 | // The label offset (how far away from pointer) | 50 | // The label offset (how far away from pointer) |
58 | static const int iLABELOFFSET = 8; | 51 | static const int iLABELOFFSET = 8; |
59 | 52 | ||
60 | // the size of the dot to draw, and where to start it | 53 | // the size of the dot to draw, and where to start it |
61 | static const int iCITYSIZE = 3; | 54 | static const int iCITYSIZE = 3; |
62 | const int iCITYOFFSET = 2; | 55 | const int iCITYOFFSET = 2; |
63 | 56 | ||
64 | // the darkening function | 57 | // the darkening function |
65 | static inline void darken( QImage *pImage, int start, int stop, int row ); | 58 | static inline void darken( QImage *pImage, int start, int stop, int row ); |
66 | static void dayNight( QImage *pImage ); | 59 | static void dayNight( QImage *pImage ); |
67 | 60 | ||
68 | ZoneField::ZoneField( const QString& strLine ) | 61 | ZoneField::ZoneField( const QString& strLine ) |
69 | { | 62 | { |
70 | // make a bunch of RegExp's to match the data from the line | 63 | // make a bunch of RegExp's to match the data from the line |
71 | QRegExp regCoord( "[-+][0-9]+" );// the latitude | 64 | QRegExp regCoord( "[-+][0-9]+" );// the latitude |
72 | QRegExp regCountry( "[A-Za-z]+/" ); // the country (not good enough) | 65 | QRegExp regCountry( "[A-Za-z]+/" ); // the country (not good enough) |
73 | QRegExp regCity( "[A-Za-z_-]*" ); // the city | 66 | QRegExp regCity( "[A-Za-z_-]*" ); // the city |
74 | 67 | ||
75 | int iStart, | 68 | int iStart, |
76 | iStop, | 69 | iStop, |
77 | iLen, | 70 | iLen, |
78 | tmp; | 71 | tmp; |
79 | QString strTmp; | 72 | QString strTmp; |
80 | // we should be able to assume that the country code is always the first | 73 | // we should be able to assume that the country code is always the first |
81 | // two chars, so just grap them and let it go... | 74 | // two chars, so just grap them and let it go... |
82 | strCountryCode = strLine.left( 2 ); | 75 | strCountryCode = strLine.left( 2 ); |
83 | iStart = regCoord.match( strLine, 0, &iLen ); | 76 | iStart = regCoord.match( strLine, 0, &iLen ); |
84 | if ( iStart >= 0 ) { | 77 | if ( iStart >= 0 ) { |
85 | strTmp = strLine.mid( iStart, iLen ); | 78 | strTmp = strLine.mid( iStart, iLen ); |
86 | tmp = strTmp.toInt(); | 79 | tmp = strTmp.toInt(); |