summaryrefslogtreecommitdiff
authorzecke <zecke>2004-10-17 18:38:39 (UTC)
committer zecke <zecke>2004-10-17 18:38:39 (UTC)
commite95fcb09fc069a83b3c10c19c081873daba49831 (patch) (unidiff)
tree13d13bac82d5bcf2489075e4f2962685ff3c897d
parent7e28835e246e06e157d760a40754b6257f2ad6b3 (diff)
downloadopie-e95fcb09fc069a83b3c10c19c081873daba49831.zip
opie-e95fcb09fc069a83b3c10c19c081873daba49831.tar.gz
opie-e95fcb09fc069a83b3c10c19c081873daba49831.tar.bz2
G++ 4.0 compiler fixes
-Remove anonymous structures and name them -Include 'card.h' to cardpile to make 'Card' known to QList so deleteItem will work -cast 'enum' to char in event.cpp and opimevent.cpp
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/firstuse.cpp9
-rw-r--r--libopie2/opiepim/core/opimevent.cpp2
-rw-r--r--library/backend/event.cpp2
-rw-r--r--noncore/applets/zkbapplet/keyzcfg/zkbnames.cpp26
-rw-r--r--noncore/games/qasteroids/view.cpp7
-rw-r--r--noncore/games/solitaire/cardpile.h2
6 files changed, 29 insertions, 19 deletions
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp
index acddeea..8344787 100644
--- a/core/launcher/firstuse.cpp
+++ b/core/launcher/firstuse.cpp
@@ -1,199 +1,200 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the 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// I need access to some things you don't normally get access to. 21// I need access to some things you don't normally get access to.
22 22
23#ifndef _MSC_VER 23#ifndef _MSC_VER
24 //### revise to allow removal of translators under MSVC 24 //### revise to allow removal of translators under MSVC
25#define private public 25#define private public
26#define protected public 26#define protected public
27#endif 27#endif
28#include "firstuse.h" 28#include "firstuse.h"
29#include "inputmethods.h" 29#include "inputmethods.h"
30#include "applauncher.h" 30#include "applauncher.h"
31#include "serverapp.h" 31#include "serverapp.h"
32#include "calibrate.h" 32#include "calibrate.h"
33#include "documentlist.h" 33#include "documentlist.h"
34 34
35/* OPIE */ 35/* OPIE */
36#include <opie2/odebug.h> 36#include <opie2/odebug.h>
37#include <qtopia/resource.h> 37#include <qtopia/resource.h>
38#include <qtopia/qcopenvelope_qws.h> 38#include <qtopia/qcopenvelope_qws.h>
39#include <qtopia/config.h> 39#include <qtopia/config.h>
40#include <qtopia/fontmanager.h> 40#include <qtopia/fontmanager.h>
41using namespace Opie::Core; 41using namespace Opie::Core;
42 42
43/* QT */ 43/* QT */
44#include <qfile.h> 44#include <qfile.h>
45#include <qpainter.h> 45#include <qpainter.h>
46#include <qsimplerichtext.h> 46#include <qsimplerichtext.h>
47#include <qpushbutton.h> 47#include <qpushbutton.h>
48#include <qlabel.h> 48#include <qlabel.h>
49#include <qtimer.h> 49#include <qtimer.h>
50 50
51#if defined( Q_WS_QWS ) 51#if defined( Q_WS_QWS )
52#include <qwsdisplay_qws.h> 52#include <qwsdisplay_qws.h>
53#include <qgfx_qws.h> 53#include <qgfx_qws.h>
54#endif 54#endif
55 55
56/* STD */ 56/* STD */
57#include <stdlib.h> 57#include <stdlib.h>
58#include <sys/types.h> 58#include <sys/types.h>
59#if defined(Q_OS_LINUX) || defined(_OS_LINUX_) 59#if defined(Q_OS_LINUX) || defined(_OS_LINUX_)
60#include <unistd.h> 60#include <unistd.h>
61#endif 61#endif
62 62
63 63
64struct { 64struct settingsTable_t {
65 bool enabled; 65 bool enabled : 1;
66 const char *app; 66 const char *app;
67 const char *start; 67 const char *start;
68 const char *stop; 68 const char *stop;
69 const char *desc; 69 const char *desc;
70} 70};
71settingsTable [] = 71
72static settingsTable_t settingsTable [] =
72{ 73{
73 { FALSE, "language", "raise()", "accept()", // No tr 74 { FALSE, "language", "raise()", "accept()", // No tr
74 QT_TR_NOOP("Language") }, 75 QT_TR_NOOP("Language") },
75 { FALSE, "doctab", "raise()", "accept()", // No tr 76 { FALSE, "doctab", "raise()", "accept()", // No tr
76 QT_TR_NOOP("DocTab") }, 77 QT_TR_NOOP("DocTab") },
77#ifndef Q_OS_WIN32 78#ifndef Q_OS_WIN32
78 { FALSE, "systemtime", "raise()", "accept()", // No tr 79 { FALSE, "systemtime", "raise()", "accept()", // No tr
79 QT_TR_NOOP("Time and Date") }, 80 QT_TR_NOOP("Time and Date") },
80#endif 81#endif
81 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr 82 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr
82 QT_TR_NOOP("Personal Information") }, 83 QT_TR_NOOP("Personal Information") },
83 { FALSE, 0, 0, 0, 0 } 84 { FALSE, 0, 0, 0, 0 }
84}; 85};
85 86
86 87
87FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : 88FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) :
88 QDialog( parent, name, TRUE, wf), 89 QDialog( parent, name, TRUE, wf),
89 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), 90 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1),
90 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) 91 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE)
91{ 92{
92 ServerApplication::allowRestart = FALSE; 93 ServerApplication::allowRestart = FALSE;
93 // we force our height beyound the maximum (which we set anyway) 94 // we force our height beyound the maximum (which we set anyway)
94 QRect desk = qApp->desktop()->geometry(); 95 QRect desk = qApp->desktop()->geometry();
95 setGeometry( 0, 0, desk.width(), desk.height() ); 96 setGeometry( 0, 0, desk.width(), desk.height() );
96 97
97 connect(qwsServer, SIGNAL(newChannel(const QString&)), 98 connect(qwsServer, SIGNAL(newChannel(const QString&)),
98 this, SLOT(newQcopChannel(const QString&))); 99 this, SLOT(newQcopChannel(const QString&)));
99 100
100 // Create a DocumentList so appLauncher has appLnkSet to search 101 // Create a DocumentList so appLauncher has appLnkSet to search
101 docList = new DocumentList( 0, FALSE ); 102 docList = new DocumentList( 0, FALSE );
102 appLauncher = new AppLauncher( this ); 103 appLauncher = new AppLauncher( this );
103 connect( appLauncher, SIGNAL(terminated(int,const QString&)), 104 connect( appLauncher, SIGNAL(terminated(int,const QString&)),
104 this, SLOT(terminated(int,const QString&)) ); 105 this, SLOT(terminated(int,const QString&)) );
105 106
106 // more hackery 107 // more hackery
107 // I will be run as either the main server or as part of the main server 108 // I will be run as either the main server or as part of the main server
108 QWSServer::setScreenSaverIntervals(0); 109 QWSServer::setScreenSaverIntervals(0);
109 loadPixmaps(); 110 loadPixmaps();
110 111
111 //check if there is a language program 112 //check if there is a language program
112#ifndef Q_OS_WIN32 113#ifndef Q_OS_WIN32
113 QString exeSuffix; 114 QString exeSuffix;
114#else 115#else
115 QString exeSuffix(".exe"); 116 QString exeSuffix(".exe");
116#endif 117#endif
117 118
118 for ( int i = 0; settingsTable[i].app; i++ ) { 119 for ( int i = 0; settingsTable[i].app; i++ ) {
119 QString file = QPEApplication::qpeDir() + "bin/"; 120 QString file = QPEApplication::qpeDir() + "bin/";
120 file += settingsTable[i].app; 121 file += settingsTable[i].app;
121 file += exeSuffix; 122 file += exeSuffix;
122 if ( QFile::exists(file) ) 123 if ( QFile::exists(file) )
123 settingsTable[i].enabled = TRUE; 124 settingsTable[i].enabled = TRUE;
124 } 125 }
125 126
126 setFocusPolicy(NoFocus); 127 setFocusPolicy(NoFocus);
127 128
128 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); 129 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader);
129 130
130 inputMethods = new InputMethods(taskBar); 131 inputMethods = new InputMethods(taskBar);
131 connect(inputMethods, SIGNAL(inputToggled(bool)), 132 connect(inputMethods, SIGNAL(inputToggled(bool)),
132 this, SLOT(calcMaxWindowRect())); 133 this, SLOT(calcMaxWindowRect()));
133 134
134 back = new QPushButton(tr("<< Back"), taskBar); 135 back = new QPushButton(tr("<< Back"), taskBar);
135 back->setFocusPolicy(NoFocus); 136 back->setFocusPolicy(NoFocus);
136 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); 137 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) );
137 138
138 next = new QPushButton(tr("Next >>"), taskBar); 139 next = new QPushButton(tr("Next >>"), taskBar);
139 next->setFocusPolicy(NoFocus); 140 next->setFocusPolicy(NoFocus);
140 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); 141 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) );
141 142
142 // need to set the geom to lower corner 143 // need to set the geom to lower corner
143 QSize sz = inputMethods->sizeHint(); 144 QSize sz = inputMethods->sizeHint();
144 int buttonWidth = (width() - sz.width()) / 2; 145 int buttonWidth = (width() - sz.width()) / 2;
145 int x = 0; 146 int x = 0;
146 147
147 controlHeight = back->sizeHint().height(); 148 controlHeight = back->sizeHint().height();
148 149
149 inputMethods->setGeometry(0,0, sz.width(), controlHeight ); 150 inputMethods->setGeometry(0,0, sz.width(), controlHeight );
150 x += sz.width(); 151 x += sz.width();
151 152
152 back->setGeometry(x, 0, buttonWidth, controlHeight); 153 back->setGeometry(x, 0, buttonWidth, controlHeight);
153 x += buttonWidth; 154 x += buttonWidth;
154 next->setGeometry(x, 0, buttonWidth, controlHeight); 155 next->setGeometry(x, 0, buttonWidth, controlHeight);
155 156
156 taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); 157 taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight);
157 taskBar->hide(); 158 taskBar->hide();
158 159
159#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 160#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
160 odebug << "Setting up QCop to QPE/System" << oendl; 161 odebug << "Setting up QCop to QPE/System" << oendl;
161 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 162 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
162 connect(sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), 163 connect(sysChannel, SIGNAL(received(const QCString&,const QByteArray&)),
163 this, SLOT(message(const QCString&,const QByteArray&)) ); 164 this, SLOT(message(const QCString&,const QByteArray&)) );
164#endif 165#endif
165 calcMaxWindowRect(); 166 calcMaxWindowRect();
166 167
167 m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; 168 m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false;
168 169
169 if ( m_calHandler) { 170 if ( m_calHandler) {
170 if ( !QFile::exists("/etc/pointercal") ) { 171 if ( !QFile::exists("/etc/pointercal") ) {
171 needCalibrate = TRUE; 172 needCalibrate = TRUE;
172 grabMouse(); 173 grabMouse();
173 } 174 }
174 } 175 }
175 176
176 Config config("locale"); 177 Config config("locale");
177 config.setGroup( "Language"); 178 config.setGroup( "Language");
178 lang = config.readEntry( "Language", "en"); 179 lang = config.readEntry( "Language", "en");
179 180
180 defaultFont = font(); 181 defaultFont = font();
181 182
182 //###language/font hack; should look it up somewhere 183 //###language/font hack; should look it up somewhere
183#ifdef Q_WS_QWS 184#ifdef Q_WS_QWS
184 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 185 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
185 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 186 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
186 qApp->setFont( fn, TRUE ); 187 qApp->setFont( fn, TRUE );
187 } 188 }
188#endif 189#endif
189} 190}
190 191
191FirstUse::~FirstUse() 192FirstUse::~FirstUse()
192{ 193{
193 delete appLauncher; 194 delete appLauncher;
194 delete docList; 195 delete docList;
195 delete taskBar; 196 delete taskBar;
196 ServerApplication::allowRestart = TRUE; 197 ServerApplication::allowRestart = TRUE;
197} 198}
198 199
199void FirstUse::calcMaxWindowRect() 200void FirstUse::calcMaxWindowRect()
diff --git a/libopie2/opiepim/core/opimevent.cpp b/libopie2/opiepim/core/opimevent.cpp
index c656c3d..7bc6c32 100644
--- a/libopie2/opiepim/core/opimevent.cpp
+++ b/libopie2/opiepim/core/opimevent.cpp
@@ -1,201 +1,201 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers <Eilers.Stefan@epost.de> 3 Copyright (C) Stefan Eilers <Eilers.Stefan@epost.de>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
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 Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library 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#include "opimevent.h" 30#include "opimevent.h"
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/opimrecurrence.h> 33#include <opie2/opimrecurrence.h>
34#include <opie2/opimresolver.h> 34#include <opie2/opimresolver.h>
35#include <opie2/opimnotifymanager.h> 35#include <opie2/opimnotifymanager.h>
36#include <opie2/odebug.h> 36#include <opie2/odebug.h>
37 37
38#include <qpe/categories.h> 38#include <qpe/categories.h>
39#include <qpe/stringutil.h> 39#include <qpe/stringutil.h>
40 40
41/* QT */ 41/* QT */
42 42
43namespace Opie 43namespace Opie
44{ 44{
45 45
46int OCalendarHelper::week( const QDate& date ) 46int OCalendarHelper::week( const QDate& date )
47{ 47{
48 // Calculates the week this date is in within that 48 // Calculates the week this date is in within that
49 // month. Equals the "row" is is in in the month view 49 // month. Equals the "row" is is in in the month view
50 int week = 1; 50 int week = 1;
51 QDate tmp( date.year(), date.month(), 1 ); 51 QDate tmp( date.year(), date.month(), 1 );
52 if ( date.dayOfWeek() < tmp.dayOfWeek() ) 52 if ( date.dayOfWeek() < tmp.dayOfWeek() )
53 ++week; 53 ++week;
54 54
55 week += ( date.day() - 1 ) / 7; 55 week += ( date.day() - 1 ) / 7;
56 56
57 return week; 57 return week;
58} 58}
59 59
60 60
61int OCalendarHelper::ocurrence( const QDate& date ) 61int OCalendarHelper::ocurrence( const QDate& date )
62{ 62{
63 // calculates the number of occurrances of this day of the 63 // calculates the number of occurrances of this day of the
64 // week till the given date (e.g 3rd Wednesday of the month) 64 // week till the given date (e.g 3rd Wednesday of the month)
65 return ( date.day() - 1 ) / 7 + 1; 65 return ( date.day() - 1 ) / 7 + 1;
66} 66}
67 67
68 68
69int OCalendarHelper::dayOfWeek( char day ) 69int OCalendarHelper::dayOfWeek( char day )
70{ 70{
71 int dayOfWeek = 1; 71 int dayOfWeek = 1;
72 char i = OPimRecurrence::MON; 72 char i = OPimRecurrence::MON;
73 while ( !( i & day ) && i <= OPimRecurrence::SUN ) 73 while ( !( i & day ) && i <= static_cast<char>(OPimRecurrence::SUN) )
74 { 74 {
75 i <<= 1; 75 i <<= 1;
76 ++dayOfWeek; 76 ++dayOfWeek;
77 } 77 }
78 return dayOfWeek; 78 return dayOfWeek;
79} 79}
80 80
81 81
82int OCalendarHelper::monthDiff( const QDate& first, const QDate& second ) 82int OCalendarHelper::monthDiff( const QDate& first, const QDate& second )
83{ 83{
84 return ( second.year() - first.year() ) * 12 + 84 return ( second.year() - first.year() ) * 12 +
85 second.month() - first.month(); 85 second.month() - first.month();
86} 86}
87 87
88 88
89struct OPimEvent::Data : public QShared 89struct OPimEvent::Data : public QShared
90{ 90{
91 Data() : QShared() 91 Data() : QShared()
92 { 92 {
93 child = 0; 93 child = 0;
94 recur = 0; 94 recur = 0;
95 manager = 0; 95 manager = 0;
96 isAllDay = false; 96 isAllDay = false;
97 parent = 0; 97 parent = 0;
98 } 98 }
99 ~Data() 99 ~Data()
100 { 100 {
101 delete manager; 101 delete manager;
102 delete recur; 102 delete recur;
103 } 103 }
104 QString description; 104 QString description;
105 QString location; 105 QString location;
106 OPimNotifyManager* manager; 106 OPimNotifyManager* manager;
107 OPimRecurrence* recur; 107 OPimRecurrence* recur;
108 QString note; 108 QString note;
109 QDateTime created; 109 QDateTime created;
110 QDateTime start; 110 QDateTime start;
111 QDateTime end; 111 QDateTime end;
112bool isAllDay : 1; 112bool isAllDay : 1;
113 QString timezone; 113 QString timezone;
114 QArray<int>* child; 114 QArray<int>* child;
115 int parent; 115 int parent;
116}; 116};
117 117
118 118
119OPimEvent::OPimEvent( int uid ) 119OPimEvent::OPimEvent( int uid )
120 : OPimRecord( uid ) 120 : OPimRecord( uid )
121{ 121{
122 data = new Data; 122 data = new Data;
123} 123}
124 124
125 125
126OPimEvent::OPimEvent( const OPimEvent& ev ) 126OPimEvent::OPimEvent( const OPimEvent& ev )
127 : OPimRecord( ev ), data( ev.data ) 127 : OPimRecord( ev ), data( ev.data )
128{ 128{
129 data->ref(); 129 data->ref();
130} 130}
131 131
132 132
133OPimEvent::OPimEvent( const QMap<int, QString> map ) 133OPimEvent::OPimEvent( const QMap<int, QString> map )
134 : OPimRecord( 0 ) 134 : OPimRecord( 0 )
135{ 135{
136 data = new Data; 136 data = new Data;
137 137
138 fromMap( map ); 138 fromMap( map );
139} 139}
140 140
141 141
142OPimEvent::~OPimEvent() 142OPimEvent::~OPimEvent()
143{ 143{
144 if ( data->deref() ) 144 if ( data->deref() )
145 { 145 {
146 delete data; 146 delete data;
147 data = 0; 147 data = 0;
148 } 148 }
149} 149}
150 150
151 151
152OPimEvent& OPimEvent::operator=( const OPimEvent& ev ) 152OPimEvent& OPimEvent::operator=( const OPimEvent& ev )
153{ 153{
154 if ( this == &ev ) return * this; 154 if ( this == &ev ) return * this;
155 155
156 OPimRecord::operator=( ev ); 156 OPimRecord::operator=( ev );
157 ev.data->ref(); 157 ev.data->ref();
158 deref(); 158 deref();
159 data = ev.data; 159 data = ev.data;
160 160
161 161
162 return *this; 162 return *this;
163} 163}
164 164
165 165
166QString OPimEvent::description() const 166QString OPimEvent::description() const
167{ 167{
168 return data->description; 168 return data->description;
169} 169}
170 170
171 171
172void OPimEvent::setDescription( const QString& description ) 172void OPimEvent::setDescription( const QString& description )
173{ 173{
174 changeOrModify(); 174 changeOrModify();
175 data->description = description; 175 data->description = description;
176} 176}
177 177
178 178
179void OPimEvent::setLocation( const QString& loc ) 179void OPimEvent::setLocation( const QString& loc )
180{ 180{
181 changeOrModify(); 181 changeOrModify();
182 data->location = loc; 182 data->location = loc;
183} 183}
184 184
185 185
186QString OPimEvent::location() const 186QString OPimEvent::location() const
187{ 187{
188 return data->location; 188 return data->location;
189} 189}
190 190
191 191
192OPimNotifyManager &OPimEvent::notifiers() const 192OPimNotifyManager &OPimEvent::notifiers() const
193{ 193{
194 // I hope we can skip the changeOrModify here 194 // I hope we can skip the changeOrModify here
195 // the notifier should take care of it 195 // the notifier should take care of it
196 // and OPimNotify is shared too 196 // and OPimNotify is shared too
197 if ( !data->manager ) 197 if ( !data->manager )
198 data->manager = new OPimNotifyManager; 198 data->manager = new OPimNotifyManager;
199 199
200 return *data->manager; 200 return *data->manager;
201} 201}
diff --git a/library/backend/event.cpp b/library/backend/event.cpp
index 90860e8..abc420b 100644
--- a/library/backend/event.cpp
+++ b/library/backend/event.cpp
@@ -274,257 +274,257 @@ Qtopia::UidGen Event::sUidGen( Qtopia::UidGen::Qtopia );
274*/ 274*/
275 275
276/*! 276/*!
277 \fn void Event::setRepeatType(RepeatType t) 277 \fn void Event::setRepeatType(RepeatType t)
278 278
279 Sets the repeat pattern type of the event to \a t. 279 Sets the repeat pattern type of the event to \a t.
280 280
281 \sa setFrequency() 281 \sa setFrequency()
282*/ 282*/
283 283
284/*! 284/*!
285 \fn void Event::setFrequency(int n) 285 \fn void Event::setFrequency(int n)
286 286
287 Sets how often the event occurs with in its repeat pattern. 287 Sets how often the event occurs with in its repeat pattern.
288 288
289 \sa setRepeatType() 289 \sa setRepeatType()
290*/ 290*/
291 291
292/*! 292/*!
293 \fn void Event::setRepeatTill(const QDate &d) 293 \fn void Event::setRepeatTill(const QDate &d)
294 294
295 Sets the event to repeat until \a d. 295 Sets the event to repeat until \a d.
296*/ 296*/
297 297
298/*! 298/*!
299 \fn void Event::setRepeatForever(bool enable) 299 \fn void Event::setRepeatForever(bool enable)
300 300
301 If \a enable is TRUE, sets the event to repeat forever. Otherwise 301 If \a enable is TRUE, sets the event to repeat forever. Otherwise
302 sets the event to stop repeating at some date. 302 sets the event to stop repeating at some date.
303 303
304 \warning This function may affect the specific date the event will repeat 304 \warning This function may affect the specific date the event will repeat
305 till. 305 till.
306*/ 306*/
307 307
308/*! 308/*!
309 \fn bool Event::match(const QRegExp &r) const 309 \fn bool Event::match(const QRegExp &r) const
310 310
311 Returns TRUE if the event matches the regular expression \a r. 311 Returns TRUE if the event matches the regular expression \a r.
312 Otherwise returns FALSE. 312 Otherwise returns FALSE.
313*/ 313*/
314 314
315/*! 315/*!
316 \fn char Event::day(int) 316 \fn char Event::day(int)
317 \internal 317 \internal
318*/ 318*/
319 319
320/*! 320/*!
321 Creates a new, empty event. 321 Creates a new, empty event.
322*/ 322*/
323Event::Event() : Record() 323Event::Event() : Record()
324{ 324{
325 startUTC = endUTC = time( 0 ); 325 startUTC = endUTC = time( 0 );
326 typ = Normal; 326 typ = Normal;
327 hAlarm = FALSE; 327 hAlarm = FALSE;
328 hRepeat = FALSE; 328 hRepeat = FALSE;
329 aMinutes = 0; 329 aMinutes = 0;
330 aSound = Silent; 330 aSound = Silent;
331 pattern.type = NoRepeat; 331 pattern.type = NoRepeat;
332 pattern.frequency = -1; 332 pattern.frequency = -1;
333} 333}
334 334
335/*! 335/*!
336 \internal 336 \internal
337*/ 337*/
338Event::Event( const QMap<int, QString> &map ) 338Event::Event( const QMap<int, QString> &map )
339{ 339{
340 setDescription( map[DatebookDescription] ); 340 setDescription( map[DatebookDescription] );
341 setLocation( map[Location] ); 341 setLocation( map[Location] );
342 setCategories( idsFromString( map[DatebookCategory] ) ); 342 setCategories( idsFromString( map[DatebookCategory] ) );
343 setTimeZone( map[TimeZone] ); 343 setTimeZone( map[TimeZone] );
344 setNotes( map[Note] ); 344 setNotes( map[Note] );
345 setStart( TimeConversion::fromUTC( map[StartDateTime].toUInt() ) ); 345 setStart( TimeConversion::fromUTC( map[StartDateTime].toUInt() ) );
346 setEnd( TimeConversion::fromUTC( map[EndDateTime].toUInt() ) ); 346 setEnd( TimeConversion::fromUTC( map[EndDateTime].toUInt() ) );
347 setType( (Event::Type) map[DatebookType].toInt() ); 347 setType( (Event::Type) map[DatebookType].toInt() );
348 setAlarm( ( map[HasAlarm] == "1" ? TRUE : FALSE ), map[AlarmTime].toInt(), (Event::SoundTypeChoice)map[SoundType].toInt() ); 348 setAlarm( ( map[HasAlarm] == "1" ? TRUE : FALSE ), map[AlarmTime].toInt(), (Event::SoundTypeChoice)map[SoundType].toInt() );
349 Event::RepeatPattern p; 349 Event::RepeatPattern p;
350 p.type = (Event::RepeatType) map[ RepeatPatternType ].toInt(); 350 p.type = (Event::RepeatType) map[ RepeatPatternType ].toInt();
351 p.frequency = map[ RepeatPatternFrequency ].toInt(); 351 p.frequency = map[ RepeatPatternFrequency ].toInt();
352 p.position = map[ RepeatPatternPosition ].toInt(); 352 p.position = map[ RepeatPatternPosition ].toInt();
353 p.days = map[ RepeatPatternDays ].toInt(); 353 p.days = map[ RepeatPatternDays ].toInt();
354 p.hasEndDate = map[ RepeatPatternHasEndDate ].toInt(); 354 p.hasEndDate = map[ RepeatPatternHasEndDate ].toInt();
355 p.endDateUTC = map[ RepeatPatternEndDate ].toUInt(); 355 p.endDateUTC = map[ RepeatPatternEndDate ].toUInt();
356 setRepeat( p ); 356 setRepeat( p );
357 357
358 setUid( map[ DatebookUid ].toInt() ); 358 setUid( map[ DatebookUid ].toInt() );
359} 359}
360 360
361/*! 361/*!
362 Destroys an event. 362 Destroys an event.
363*/ 363*/
364Event::~Event() 364Event::~Event()
365{ 365{
366} 366}
367 367
368/*! 368/*!
369 \internal 369 \internal
370*/ 370*/
371int Event::week( const QDate& date ) 371int Event::week( const QDate& date )
372{ 372{
373 // Calculates the week this date is in within that 373 // Calculates the week this date is in within that
374 // month. Equals the "row" is is in in the month view 374 // month. Equals the "row" is is in in the month view
375 int week = 1; 375 int week = 1;
376 QDate tmp( date.year(), date.month(), 1 ); 376 QDate tmp( date.year(), date.month(), 1 );
377 377
378 if ( date.dayOfWeek() < tmp.dayOfWeek() ) 378 if ( date.dayOfWeek() < tmp.dayOfWeek() )
379 ++week; 379 ++week;
380 380
381 week += ( date.day() - 1 ) / 7; 381 week += ( date.day() - 1 ) / 7;
382 return week; 382 return week;
383} 383}
384 384
385/*! 385/*!
386 \internal 386 \internal
387*/ 387*/
388int Event::occurrence( const QDate& date ) 388int Event::occurrence( const QDate& date )
389{ 389{
390 // calculates the number of occurrances of this day of the 390 // calculates the number of occurrances of this day of the
391 // week till the given date (e.g 3rd Wednesday of the month) 391 // week till the given date (e.g 3rd Wednesday of the month)
392 return ( date.day() - 1 ) / 7 + 1; 392 return ( date.day() - 1 ) / 7 + 1;
393} 393}
394 394
395/*! 395/*!
396 \internal 396 \internal
397*/ 397*/
398int Event::dayOfWeek( char day ) 398int Event::dayOfWeek( char day )
399{ 399{
400 int dayOfWeek = 1; 400 int dayOfWeek = 1;
401 char i = Event::MON; 401 char i = Event::MON;
402 while ( !( i & day ) && i <= Event::SUN ) { 402 while ( !( i & day ) && i <= static_cast<char>(Event::SUN) ) {
403 i <<= 1; 403 i <<= 1;
404 ++dayOfWeek; 404 ++dayOfWeek;
405 } 405 }
406 return dayOfWeek; 406 return dayOfWeek;
407} 407}
408 408
409/*! 409/*!
410 \internal 410 \internal
411*/ 411*/
412int Event::monthDiff( const QDate& first, const QDate& second ) 412int Event::monthDiff( const QDate& first, const QDate& second )
413{ 413{
414 return ( second.year() - first.year() ) * 12 + 414 return ( second.year() - first.year() ) * 12 +
415 second.month() - first.month(); 415 second.month() - first.month();
416} 416}
417 417
418/*! 418/*!
419 \internal 419 \internal
420*/ 420*/
421QMap<int, QString> Event::toMap() const 421QMap<int, QString> Event::toMap() const
422{ 422{
423 QMap<int, QString> m; 423 QMap<int, QString> m;
424 424
425 if ( !description().isEmpty() ) 425 if ( !description().isEmpty() )
426 m.insert( DatebookDescription, description() ); 426 m.insert( DatebookDescription, description() );
427 if ( !location().isEmpty() ) 427 if ( !location().isEmpty() )
428 m.insert ( Location, location() ); 428 m.insert ( Location, location() );
429 if ( categories().count() ) 429 if ( categories().count() )
430 m.insert ( DatebookCategory, idsToString( categories() ) ); 430 m.insert ( DatebookCategory, idsToString( categories() ) );
431 if ( !timeZone().isEmpty() ) 431 if ( !timeZone().isEmpty() )
432 m.insert ( TimeZone, timeZone() ); 432 m.insert ( TimeZone, timeZone() );
433 if ( !notes().isEmpty() ) 433 if ( !notes().isEmpty() )
434 m.insert ( Note, notes() ); 434 m.insert ( Note, notes() );
435 435
436 m.insert ( StartDateTime, QString::number( TimeConversion::toUTC( start() ) ) ); 436 m.insert ( StartDateTime, QString::number( TimeConversion::toUTC( start() ) ) );
437 m.insert ( EndDateTime, QString::number( TimeConversion::toUTC( end() ) ) ); 437 m.insert ( EndDateTime, QString::number( TimeConversion::toUTC( end() ) ) );
438 m.insert ( DatebookType, QString::number( (int)type() ) ); 438 m.insert ( DatebookType, QString::number( (int)type() ) );
439 m.insert ( HasAlarm, ( hasAlarm() ? "1" : "0" ) ); 439 m.insert ( HasAlarm, ( hasAlarm() ? "1" : "0" ) );
440 m.insert ( SoundType, QString::number( (int)alarmSound() ) ); 440 m.insert ( SoundType, QString::number( (int)alarmSound() ) );
441 m.insert ( AlarmTime, QString::number( alarmTime() ) ); 441 m.insert ( AlarmTime, QString::number( alarmTime() ) );
442 m.insert ( RepeatPatternType, QString::number( static_cast<int>( repeatPattern().type ) ) ); 442 m.insert ( RepeatPatternType, QString::number( static_cast<int>( repeatPattern().type ) ) );
443 m.insert ( RepeatPatternFrequency, QString::number( repeatPattern().frequency ) ); 443 m.insert ( RepeatPatternFrequency, QString::number( repeatPattern().frequency ) );
444 m.insert ( RepeatPatternPosition, QString::number( repeatPattern().position ) ); 444 m.insert ( RepeatPatternPosition, QString::number( repeatPattern().position ) );
445 m.insert ( RepeatPatternDays, QString::number( repeatPattern().days ) ); 445 m.insert ( RepeatPatternDays, QString::number( repeatPattern().days ) );
446 m.insert ( RepeatPatternHasEndDate, QString::number( static_cast<int>( repeatPattern().hasEndDate ) ) ); 446 m.insert ( RepeatPatternHasEndDate, QString::number( static_cast<int>( repeatPattern().hasEndDate ) ) );
447 m.insert ( RepeatPatternEndDate, QString::number( repeatPattern().endDateUTC ) ); 447 m.insert ( RepeatPatternEndDate, QString::number( repeatPattern().endDateUTC ) );
448 448
449 m.insert( DatebookUid, QString::number( uid()) ); 449 m.insert( DatebookUid, QString::number( uid()) );
450 450
451 return m; 451 return m;
452} 452}
453 453
454/*! 454/*!
455 \internal 455 \internal
456*/ 456*/
457void Event::setRepeat( const RepeatPattern &p ) 457void Event::setRepeat( const RepeatPattern &p )
458{ 458{
459 setRepeat( p.type != NoRepeat, p ); 459 setRepeat( p.type != NoRepeat, p );
460} 460}
461 461
462/*! 462/*!
463 Sets the description of the event to \a s. 463 Sets the description of the event to \a s.
464*/ 464*/
465void Event::setDescription( const QString &s ) 465void Event::setDescription( const QString &s )
466{ 466{
467 descript = s; 467 descript = s;
468} 468}
469 469
470/*! 470/*!
471 Sets the location of the event to \a s. 471 Sets the location of the event to \a s.
472*/ 472*/
473void Event::setLocation( const QString &s ) 473void Event::setLocation( const QString &s )
474{ 474{
475 locat = s; 475 locat = s;
476} 476}
477 477
478// void Event::setCategory( const QString &s ) 478// void Event::setCategory( const QString &s )
479// { 479// {
480// categ = s; 480// categ = s;
481// } 481// }
482 482
483/*! 483/*!
484 \internal 484 \internal
485*/ 485*/
486void Event::setType( Type t ) 486void Event::setType( Type t )
487{ 487{
488 typ = t; 488 typ = t;
489} 489}
490 490
491/*! 491/*!
492 Sets the start date and time of the first or only occurance of this event 492 Sets the start date and time of the first or only occurance of this event
493 to the date and time \a d. \a d should be in local time. 493 to the date and time \a d. \a d should be in local time.
494*/ 494*/
495void Event::setStart( const QDateTime &d ) 495void Event::setStart( const QDateTime &d )
496{ 496{
497 startUTC = TimeConversion::toUTC( d ); 497 startUTC = TimeConversion::toUTC( d );
498} 498}
499 499
500/*! 500/*!
501 \internal 501 \internal
502*/ 502*/
503void Event::setStart( time_t time ) 503void Event::setStart( time_t time )
504{ 504{
505 startUTC = time; 505 startUTC = time;
506} 506}
507 507
508/*! 508/*!
509 Sets the end date and time of the first or only occurance of this event 509 Sets the end date and time of the first or only occurance of this event
510 to the date and time \a d. \a d should be in local time. 510 to the date and time \a d. \a d should be in local time.
511*/ 511*/
512void Event::setEnd( const QDateTime &d ) 512void Event::setEnd( const QDateTime &d )
513{ 513{
514 endUTC = TimeConversion::toUTC( d ); 514 endUTC = TimeConversion::toUTC( d );
515} 515}
516 516
517/*! 517/*!
518 \internal 518 \internal
519*/ 519*/
520void Event::setEnd( time_t time ) 520void Event::setEnd( time_t time )
521{ 521{
522 endUTC = time; 522 endUTC = time;
523} 523}
524 524
525/*! 525/*!
526 \internal 526 \internal
527*/ 527*/
528void Event::setTimeZone( const QString &z ) 528void Event::setTimeZone( const QString &z )
529{ 529{
530 tz = z; 530 tz = z;
diff --git a/noncore/applets/zkbapplet/keyzcfg/zkbnames.cpp b/noncore/applets/zkbapplet/keyzcfg/zkbnames.cpp
index b2180ba..a47bf6c 100644
--- a/noncore/applets/zkbapplet/keyzcfg/zkbnames.cpp
+++ b/noncore/applets/zkbapplet/keyzcfg/zkbnames.cpp
@@ -1,314 +1,320 @@
1#include <qmap.h> 1#include <qmap.h>
2 2
3#include "zkbnames.h" 3#include "zkbnames.h"
4 4
5QString Null_String((const char*) 0); 5QString Null_String((const char*) 0);
6 6
7// Implementation of KeyNames 7// Implementation of KeyNames
8static struct { 8struct Key_Names_t {
9 int key; 9 int key;
10 char *name; 10 char *name;
11} Key_Names[] = { 11};
12
13static const Key_Names_t Key_Names[] = {
12 { 32, "Space" }, 14 { 32, "Space" },
13 { 39, "Apostrophe" }, 15 { 39, "Apostrophe" },
14 { 44, "Comma" }, 16 { 44, "Comma" },
15 { 46, "Period" }, 17 { 46, "Period" },
16 { 47, "Slash" }, 18 { 47, "Slash" },
17 { 65, "A" }, 19 { 65, "A" },
18 { 66, "B" }, 20 { 66, "B" },
19 { 67, "C" }, 21 { 67, "C" },
20 { 68, "D" }, 22 { 68, "D" },
21 { 69, "E" }, 23 { 69, "E" },
22 { 70, "F" }, 24 { 70, "F" },
23 { 71, "G" }, 25 { 71, "G" },
24 { 72, "H" }, 26 { 72, "H" },
25 { 73, "I" }, 27 { 73, "I" },
26 { 74, "J" }, 28 { 74, "J" },
27 { 75, "K" }, 29 { 75, "K" },
28 { 76, "L" }, 30 { 76, "L" },
29 { 77, "M" }, 31 { 77, "M" },
30 { 78, "N" }, 32 { 78, "N" },
31 { 79, "O" }, 33 { 79, "O" },
32 { 80, "P" }, 34 { 80, "P" },
33 { 81, "Q" }, 35 { 81, "Q" },
34 { 82, "R" }, 36 { 82, "R" },
35 { 83, "S" }, 37 { 83, "S" },
36 { 84, "T" }, 38 { 84, "T" },
37 { 85, "U" }, 39 { 85, "U" },
38 { 86, "V" }, 40 { 86, "V" },
39 { 87, "W" }, 41 { 87, "W" },
40 { 88, "X" }, 42 { 88, "X" },
41 { 89, "Y" }, 43 { 89, "Y" },
42 { 90, "Z" }, 44 { 90, "Z" },
43 { 4096, "Cancel" }, 45 { 4096, "Cancel" },
44 { 4097, "Tab" }, 46 { 4097, "Tab" },
45 { 4099, "Backspace" }, 47 { 4099, "Backspace" },
46 { 4100, "Enter" }, 48 { 4100, "Enter" },
47 { 4114, "Left" }, 49 { 4114, "Left" },
48 { 4115, "Up" }, 50 { 4115, "Up" },
49 { 4116, "Right" }, 51 { 4116, "Right" },
50 { 4117, "Down" }, 52 { 4117, "Down" },
51 { 4128, "Left Shift" }, 53 { 4128, "Left Shift" },
52 { 4130, "Right Shift" }, 54 { 4130, "Right Shift" },
53 { 4152, "Calendar" }, 55 { 4152, "Calendar" },
54 { 4153, "Addressbook" }, 56 { 4153, "Addressbook" },
55 { 4154, "Menu" }, 57 { 4154, "Menu" },
56 { 4155, "Home" }, 58 { 4155, "Home" },
57 { 4156, "Mail" }, 59 { 4156, "Mail" },
58 { 4165, "Fn" }, 60 { 4165, "Fn" },
59 { 4173, "Middle" }, 61 { 4173, "Middle" },
60 { 4176, "OK" }, 62 { 4176, "OK" },
61 { 4177, "Off" }, 63 { 4177, "Off" },
62 { 4178, "Light" }, 64 { 4178, "Light" },
63 { 0, 0 } 65 { 0, 0 }
64}; 66};
65 67
66static QMap<QString, int> kn_map; 68static QMap<QString, int> kn_map;
67static QMap<int, QString> kn_rmap; 69static QMap<int, QString> kn_rmap;
68 70
69void init_kn_maps() { 71void init_kn_maps() {
70 int i = 0; 72 int i = 0;
71 while (Key_Names[i].name != 0) { 73 while (Key_Names[i].name != 0) {
72 int key = Key_Names[i].key; 74 int key = Key_Names[i].key;
73 QString name(Key_Names[i].name); 75 QString name(Key_Names[i].name);
74 76
75 kn_map.insert(name, key); 77 kn_map.insert(name, key);
76 kn_rmap.insert(key, name); 78 kn_rmap.insert(key, name);
77 i++; 79 i++;
78 } 80 }
79} 81}
80 82
81int KeyNames::find(const QString& key) { 83int KeyNames::find(const QString& key) {
82 if (kn_map.isEmpty()) { 84 if (kn_map.isEmpty()) {
83 init_kn_maps(); 85 init_kn_maps();
84 } 86 }
85 87
86 QMap<QString, int>::Iterator it = kn_map.find(key); 88 QMap<QString, int>::Iterator it = kn_map.find(key);
87 if (it == kn_map.end()) { 89 if (it == kn_map.end()) {
88 return -1; 90 return -1;
89 } else { 91 } else {
90 return it.data(); 92 return it.data();
91 } 93 }
92} 94}
93 95
94const QString& KeyNames::find(int k) { 96const QString& KeyNames::find(int k) {
95 if (kn_map.isEmpty()) { 97 if (kn_map.isEmpty()) {
96 init_kn_maps(); 98 init_kn_maps();
97 } 99 }
98 100
99 QMap<int, QString>::Iterator it = kn_rmap.find(k); 101 QMap<int, QString>::Iterator it = kn_rmap.find(k);
100 if (it == kn_rmap.end()) { 102 if (it == kn_rmap.end()) {
101 return Null_String; 103 return Null_String;
102 } else { 104 } else {
103 return it.data(); 105 return it.data();
104 } 106 }
105} 107}
106 108
107// Implementation of ModifierNames 109// Implementation of ModifierNames
108struct { 110struct Modifier_Names_t {
109 int value; 111 int value;
110 char* name; 112 char* name;
111} Modifier_Names[] = { 113};
114
115static const Modifier_Names_t Modifier_Names[] = {
112 { 8, "Shift" }, 116 { 8, "Shift" },
113 { 16, "Control" }, 117 { 16, "Control" },
114 { 32, "Alt" }, 118 { 32, "Alt" },
115 { 0x4000, "Keypad" }, 119 { 0x4000, "Keypad" },
116 { 0, 0 } 120 { 0, 0 }
117}; 121};
118 122
119static QMap<QString, int> mn_map; 123static QMap<QString, int> mn_map;
120static QMap<int, QString> mn_rmap; 124static QMap<int, QString> mn_rmap;
121 125
122void init_mn_maps() { 126void init_mn_maps() {
123 int i = 0; 127 int i = 0;
124 while (Modifier_Names[i].name != 0) { 128 while (Modifier_Names[i].name != 0) {
125 int value = Modifier_Names[i].value; 129 int value = Modifier_Names[i].value;
126 QString name(Modifier_Names[i].name); 130 QString name(Modifier_Names[i].name);
127 131
128 mn_map.insert(name, value); 132 mn_map.insert(name, value);
129 mn_rmap.insert(value, name); 133 mn_rmap.insert(value, name);
130 i++; 134 i++;
131 } 135 }
132} 136}
133 137
134int ModifierNames::find(const QString& key) { 138int ModifierNames::find(const QString& key) {
135 if (mn_map.isEmpty()) { 139 if (mn_map.isEmpty()) {
136 init_mn_maps(); 140 init_mn_maps();
137 } 141 }
138 142
139 QMap<QString, int>::Iterator it = mn_map.find(key); 143 QMap<QString, int>::Iterator it = mn_map.find(key);
140 if (it == mn_map.end()) { 144 if (it == mn_map.end()) {
141 return -1; 145 return -1;
142 } else { 146 } else {
143 return it.data(); 147 return it.data();
144 } 148 }
145} 149}
146 150
147const QString& ModifierNames::find(int k) { 151const QString& ModifierNames::find(int k) {
148 if (mn_map.isEmpty()) { 152 if (mn_map.isEmpty()) {
149 init_mn_maps(); 153 init_mn_maps();
150 } 154 }
151 155
152 QMap<int, QString>::Iterator it = mn_rmap.find(k); 156 QMap<int, QString>::Iterator it = mn_rmap.find(k);
153 if (it == mn_rmap.end()) { 157 if (it == mn_rmap.end()) {
154 return Null_String; 158 return Null_String;
155 } else { 159 } else {
156 return it.data(); 160 return it.data();
157 } 161 }
158} 162}
159 163
160// Implementation of KeycodeNames 164// Implementation of KeycodeNames
161 165
162struct { 166struct Keycode_Names_t {
163 char* name; 167 char* name;
164 int keycode; 168 int keycode;
165} Keycode_Names[] = { 169};
170
171static const Keycode_Names_t Keycode_Names[] = {
166 { "Escape", 0x1000 }, 172 { "Escape", 0x1000 },
167 { "Tab", 0x1001 }, 173 { "Tab", 0x1001 },
168 { "Backtab", 0x1002 }, 174 { "Backtab", 0x1002 },
169 { "Backspace", 0x1003 }, 175 { "Backspace", 0x1003 },
170 { "BackSpace", 0x1003 }, 176 { "BackSpace", 0x1003 },
171 { "Return", 0x1004 }, 177 { "Return", 0x1004 },
172 { "Enter", 0x1005 }, 178 { "Enter", 0x1005 },
173 { "Insert", 0x1006 }, 179 { "Insert", 0x1006 },
174 { "Delete", 0x1007 }, 180 { "Delete", 0x1007 },
175 { "Pause", 0x1008 }, 181 { "Pause", 0x1008 },
176 { "Print", 0x1009 }, 182 { "Print", 0x1009 },
177 { "SysReq", 0x100a }, 183 { "SysReq", 0x100a },
178 { "Home", 0x1010 }, 184 { "Home", 0x1010 },
179 { "End", 0x1011 }, 185 { "End", 0x1011 },
180 { "Left", 0x1012 }, 186 { "Left", 0x1012 },
181 { "Up", 0x1013 }, 187 { "Up", 0x1013 },
182 { "Right", 0x1014 }, 188 { "Right", 0x1014 },
183 { "Down", 0x1015 }, 189 { "Down", 0x1015 },
184 { "Prior", 0x1016 }, 190 { "Prior", 0x1016 },
185 { "PageUp", 0x1016 }, 191 { "PageUp", 0x1016 },
186 { "Next", 0x1017 }, 192 { "Next", 0x1017 },
187 { "PageDown", 0x1017 }, 193 { "PageDown", 0x1017 },
188 { "Shift", 0x1020 }, 194 { "Shift", 0x1020 },
189 { "Control", 0x1021 }, 195 { "Control", 0x1021 },
190 { "Meta", 0x1022 }, 196 { "Meta", 0x1022 },
191 { "Alt", 0x1023 }, 197 { "Alt", 0x1023 },
192 { "CapsLock", 0x1024 }, 198 { "CapsLock", 0x1024 },
193 { "NumLock", 0x1025 }, 199 { "NumLock", 0x1025 },
194 { "ScrollLock", 0x1026 }, 200 { "ScrollLock", 0x1026 },
195 { "F1", 0x1030 }, 201 { "F1", 0x1030 },
196 { "F2", 0x1031 }, 202 { "F2", 0x1031 },
197 { "F3", 0x1032 }, 203 { "F3", 0x1032 },
198 { "F4", 0x1033 }, 204 { "F4", 0x1033 },
199 { "F5", 0x1034 }, 205 { "F5", 0x1034 },
200 { "F6", 0x1035 }, 206 { "F6", 0x1035 },
201 { "F7", 0x1036 }, 207 { "F7", 0x1036 },
202 { "F8", 0x1037 }, 208 { "F8", 0x1037 },
203 { "F9", 0x1038 }, 209 { "F9", 0x1038 },
204 { "F10", 0x1039 }, 210 { "F10", 0x1039 },
205 { "F11", 0x103a }, 211 { "F11", 0x103a },
206 { "F12", 0x103b }, 212 { "F12", 0x103b },
207 { "F13", 0x103c }, 213 { "F13", 0x103c },
208 { "F14", 0x103d }, 214 { "F14", 0x103d },
209 { "F15", 0x103e }, 215 { "F15", 0x103e },
210 { "F16", 0x103f }, 216 { "F16", 0x103f },
211 { "F17", 0x1040 }, 217 { "F17", 0x1040 },
212 { "F18", 0x1041 }, 218 { "F18", 0x1041 },
213 { "F19", 0x1042 }, 219 { "F19", 0x1042 },
214 { "F20", 0x1043 }, 220 { "F20", 0x1043 },
215 { "F21", 0x1044 }, 221 { "F21", 0x1044 },
216 { "F22", 0x1045 }, 222 { "F22", 0x1045 },
217 { "F23", 0x1046 }, 223 { "F23", 0x1046 },
218 { "F24", 0x1047 }, 224 { "F24", 0x1047 },
219 { "F25", 0x1048 }, 225 { "F25", 0x1048 },
220 { "F26", 0x1049 }, 226 { "F26", 0x1049 },
221 { "F27", 0x104a }, 227 { "F27", 0x104a },
222 { "F28", 0x104b }, 228 { "F28", 0x104b },
223 { "F29", 0x104c }, 229 { "F29", 0x104c },
224 { "F30", 0x104d }, 230 { "F30", 0x104d },
225 { "F31", 0x104e }, 231 { "F31", 0x104e },
226 { "F32", 0x104f }, 232 { "F32", 0x104f },
227 { "F33", 0x1050 }, 233 { "F33", 0x1050 },
228 { "F34", 0x1051 }, 234 { "F34", 0x1051 },
229 { "F35", 0x1052 }, 235 { "F35", 0x1052 },
230 { "Super_L", 0x1053 }, 236 { "Super_L", 0x1053 },
231 { "Super_R", 0x1054 }, 237 { "Super_R", 0x1054 },
232 { "Menu", 0x1055 }, 238 { "Menu", 0x1055 },
233 { "Hyper_L", 0x1056 }, 239 { "Hyper_L", 0x1056 },
234 { "Hyper_R", 0x1057 }, 240 { "Hyper_R", 0x1057 },
235 { "Help", 0x1058 }, 241 { "Help", 0x1058 },
236 { "Space", 0x20 }, 242 { "Space", 0x20 },
237 { "Any", 0x20 }, 243 { "Any", 0x20 },
238 { "Exclam", 0x21 }, 244 { "Exclam", 0x21 },
239 { "QuoteDbl", 0x22 }, 245 { "QuoteDbl", 0x22 },
240 { "NumberSign", 0x23 }, 246 { "NumberSign", 0x23 },
241 { "Dollar", 0x24 }, 247 { "Dollar", 0x24 },
242 { "Percent", 0x25 }, 248 { "Percent", 0x25 },
243 { "Ampersand", 0x26 }, 249 { "Ampersand", 0x26 },
244 { "Apostrophe", 0x27 }, 250 { "Apostrophe", 0x27 },
245 { "ParenLeft", 0x28 }, 251 { "ParenLeft", 0x28 },
246 { "ParenRight", 0x29 }, 252 { "ParenRight", 0x29 },
247 { "Asterisk", 0x2a }, 253 { "Asterisk", 0x2a },
248 { "Plus", 0x2b }, 254 { "Plus", 0x2b },
249 { "Comma", 0x2c }, 255 { "Comma", 0x2c },
250 { "Minus", 0x2d }, 256 { "Minus", 0x2d },
251 { "Period", 0x2e }, 257 { "Period", 0x2e },
252 { "Slash", 0x2f }, 258 { "Slash", 0x2f },
253 { "0", 0x30 }, 259 { "0", 0x30 },
254 { "1", 0x31 }, 260 { "1", 0x31 },
255 { "2", 0x32 }, 261 { "2", 0x32 },
256 { "3", 0x33 }, 262 { "3", 0x33 },
257 { "4", 0x34 }, 263 { "4", 0x34 },
258 { "5", 0x35 }, 264 { "5", 0x35 },
259 { "6", 0x36 }, 265 { "6", 0x36 },
260 { "7", 0x37 }, 266 { "7", 0x37 },
261 { "8", 0x38 }, 267 { "8", 0x38 },
262 { "9", 0x39 }, 268 { "9", 0x39 },
263 { "Colon", 0x3a }, 269 { "Colon", 0x3a },
264 { "Semicolon", 0x3b }, 270 { "Semicolon", 0x3b },
265 { "Less", 0x3c }, 271 { "Less", 0x3c },
266 { "Equal", 0x3d }, 272 { "Equal", 0x3d },
267 { "Greater", 0x3e }, 273 { "Greater", 0x3e },
268 { "Question", 0x3f }, 274 { "Question", 0x3f },
269 { "At", 0x40 }, 275 { "At", 0x40 },
270 { "A", 0x41 }, 276 { "A", 0x41 },
271 { "B", 0x42 }, 277 { "B", 0x42 },
272 { "C", 0x43 }, 278 { "C", 0x43 },
273 { "D", 0x44 }, 279 { "D", 0x44 },
274 { "E", 0x45 }, 280 { "E", 0x45 },
275 { "F", 0x46 }, 281 { "F", 0x46 },
276 { "G", 0x47 }, 282 { "G", 0x47 },
277 { "H", 0x48 }, 283 { "H", 0x48 },
278 { "I", 0x49 }, 284 { "I", 0x49 },
279 { "J", 0x4a }, 285 { "J", 0x4a },
280 { "K", 0x4b }, 286 { "K", 0x4b },
281 { "L", 0x4c }, 287 { "L", 0x4c },
282 { "M", 0x4d }, 288 { "M", 0x4d },
283 { "N", 0x4e }, 289 { "N", 0x4e },
284 { "O", 0x4f }, 290 { "O", 0x4f },
285 { "P", 0x50 }, 291 { "P", 0x50 },
286 { "Q", 0x51 }, 292 { "Q", 0x51 },
287 { "R", 0x52 }, 293 { "R", 0x52 },
288 { "S", 0x53 }, 294 { "S", 0x53 },
289 { "T", 0x54 }, 295 { "T", 0x54 },
290 { "U", 0x55 }, 296 { "U", 0x55 },
291 { "V", 0x56 }, 297 { "V", 0x56 },
292 { "W", 0x57 }, 298 { "W", 0x57 },
293 { "X", 0x58 }, 299 { "X", 0x58 },
294 { "Y", 0x59 }, 300 { "Y", 0x59 },
295 { "Z", 0x5a }, 301 { "Z", 0x5a },
296 { "BracketLeft", 0x5b }, 302 { "BracketLeft", 0x5b },
297 { "Backslash", 0x5c }, 303 { "Backslash", 0x5c },
298 { "BracketRight", 0x5d }, 304 { "BracketRight", 0x5d },
299 { "AsciiCircum", 0x5e }, 305 { "AsciiCircum", 0x5e },
300 { "Underscore", 0x5f }, 306 { "Underscore", 0x5f },
301 { "QuoteLeft", 0x60 }, 307 { "QuoteLeft", 0x60 },
302 { "BraceLeft", 0x7b }, 308 { "BraceLeft", 0x7b },
303 { "Bar", 0x7c }, 309 { "Bar", 0x7c },
304 { "BraceRight", 0x7d }, 310 { "BraceRight", 0x7d },
305 { "AsciiTilde", 0x7e }, 311 { "AsciiTilde", 0x7e },
306 { "nobreakspace", 0x0a0 }, 312 { "nobreakspace", 0x0a0 },
307 { "exclamdown", 0x0a1 }, 313 { "exclamdown", 0x0a1 },
308 { "cent", 0x0a2 }, 314 { "cent", 0x0a2 },
309 { "sterling", 0x0a3 }, 315 { "sterling", 0x0a3 },
310 { "currency", 0x0a4 }, 316 { "currency", 0x0a4 },
311 { "yen", 0x0a5 }, 317 { "yen", 0x0a5 },
312 { "brokenbar", 0x0a6 }, 318 { "brokenbar", 0x0a6 },
313 { "section", 0x0a7 }, 319 { "section", 0x0a7 },
314 { "diaeresis", 0x0a8 }, 320 { "diaeresis", 0x0a8 },
diff --git a/noncore/games/qasteroids/view.cpp b/noncore/games/qasteroids/view.cpp
index 352c63b..3a4d410 100644
--- a/noncore/games/qasteroids/view.cpp
+++ b/noncore/games/qasteroids/view.cpp
@@ -1,192 +1,193 @@
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 * KAsteroids - Copyright (c) Martin R. Jones 1997 20 * KAsteroids - Copyright (c) Martin R. Jones 1997
21 * 21 *
22 * Part of the KDE project 22 * Part of the KDE project
23 */ 23 */
24 24
25#include "view.h" 25#include "view.h"
26 26
27#include <qpe/resource.h> 27#include <qpe/resource.h>
28 28
29 29
30#include <stdlib.h> 30#include <stdlib.h>
31#include <math.h> 31#include <math.h>
32 32
33#define IMG_BACKGROUND "qasteroids/bg.png" 33#define IMG_BACKGROUND "qasteroids/bg.png"
34 34
35#define REFRESH_DELAY 33 35#define REFRESH_DELAY 33
36#define SHIP_SPEED 0.3 36#define SHIP_SPEED 0.3
37#define MISSILE_SPEED 10.0 37#define MISSILE_SPEED 10.0
38#define SHIP_STEPS 64 38#define SHIP_STEPS 64
39#define ROTATE_RATE 2 39#define ROTATE_RATE 2
40#define SHIELD_ON_COST 1 40#define SHIELD_ON_COST 1
41#define SHIELD_HIT_COST 30 41#define SHIELD_HIT_COST 30
42#define BRAKE_ON_COST 4 42#define BRAKE_ON_COST 4
43 43
44#define MAX_ROCK_SPEED 2.5 44#define MAX_ROCK_SPEED 2.5
45#define MAX_POWERUP_SPEED 1.5 45#define MAX_POWERUP_SPEED 1.5
46 #define MAX_SHIP_SPEED 8 46 #define MAX_SHIP_SPEED 8
47#define MAX_BRAKES 5 47#define MAX_BRAKES 5
48#define MAX_SHIELDS 5 48#define MAX_SHIELDS 5
49 #define MAX_FIREPOWER 5 49 #define MAX_FIREPOWER 5
50 50
51#define TEXT_SPEED 4 51#define TEXT_SPEED 4
52 52
53#define PI_X_2 6.283185307 53#define PI_X_2 6.283185307
54#ifndef M_PI 54#ifndef M_PI
55#define M_PI 3.141592654 55#define M_PI 3.141592654
56#endif 56#endif
57 57
58struct 58struct kas_animations_t
59{ 59{
60 int id; 60 int id;
61 const char *path; 61 const char *path;
62 int frames; 62 int frames;
63} 63};
64kas_animations [] = 64
65static const kas_animations_t kas_animations [] =
65{ 66{
66// { ID_ROCK_LARGE, "rock1/rock1\%1.png", 32 }, 67// { ID_ROCK_LARGE, "rock1/rock1\%1.png", 32 },
67 { ID_ROCK_MEDIUM, "rock2/rock2\%1.png", 32 }, 68 { ID_ROCK_MEDIUM, "rock2/rock2\%1.png", 32 },
68 { ID_ROCK_SMALL, "rock3/rock3\%1.png", 32 }, 69 { ID_ROCK_SMALL, "rock3/rock3\%1.png", 32 },
69 { ID_SHIP, "ship/ship\%1.png", 32 }, 70 { ID_SHIP, "ship/ship\%1.png", 32 },
70 { ID_MISSILE, "missile/missile.png", 0 }, 71 { ID_MISSILE, "missile/missile.png", 0 },
71 { ID_BIT, "bits/bits\%1.png", 16 }, 72 { ID_BIT, "bits/bits\%1.png", 16 },
72 { ID_EXHAUST, "exhaust/exhaust.png", 0 }, 73 { ID_EXHAUST, "exhaust/exhaust.png", 0 },
73 { ID_ENERGY_POWERUP, "powerups/energy.png", 0 }, 74 { ID_ENERGY_POWERUP, "powerups/energy.png", 0 },
74// { ID_TELEPORT_POWERUP, "powerups/teleport%1.png", 12 }, 75// { ID_TELEPORT_POWERUP, "powerups/teleport%1.png", 12 },
75 { ID_BRAKE_POWERUP, "powerups/brake.png", 0 }, 76 { ID_BRAKE_POWERUP, "powerups/brake.png", 0 },
76 { ID_SHIELD_POWERUP, "powerups/shield.png", 0 }, 77 { ID_SHIELD_POWERUP, "powerups/shield.png", 0 },
77 { ID_SHOOT_POWERUP, "powerups/shoot.png", 0 }, 78 { ID_SHOOT_POWERUP, "powerups/shoot.png", 0 },
78 { ID_SHIELD, "shield/shield\%1.png", 6 }, 79 { ID_SHIELD, "shield/shield\%1.png", 6 },
79 { 0, 0, 0 } 80 { 0, 0, 0 }
80}; 81};
81 82
82 83
83 84
84KAsteroidsView::KAsteroidsView( QWidget *parent, const char *name ) 85KAsteroidsView::KAsteroidsView( QWidget *parent, const char *name )
85 : QWidget( parent, name ), 86 : QWidget( parent, name ),
86 field(200, 200), 87 field(200, 200),
87 view(&field,this) 88 view(&field,this)
88{ 89{
89 view.setVScrollBarMode( QScrollView::AlwaysOff ); 90 view.setVScrollBarMode( QScrollView::AlwaysOff );
90 view.setHScrollBarMode( QScrollView::AlwaysOff ); 91 view.setHScrollBarMode( QScrollView::AlwaysOff );
91 rocks.setAutoDelete( TRUE ); 92 rocks.setAutoDelete( TRUE );
92 missiles.setAutoDelete( TRUE ); 93 missiles.setAutoDelete( TRUE );
93 bits.setAutoDelete( TRUE ); 94 bits.setAutoDelete( TRUE );
94 powerups.setAutoDelete( TRUE ); 95 powerups.setAutoDelete( TRUE );
95 exhaust.setAutoDelete( TRUE ); 96 exhaust.setAutoDelete( TRUE );
96 97
97 QPixmap pm( Resource::loadPixmap(IMG_BACKGROUND) ); 98 QPixmap pm( Resource::loadPixmap(IMG_BACKGROUND) );
98 field.setBackgroundPixmap( pm ); 99 field.setBackgroundPixmap( pm );
99 100
100 textSprite = new QCanvasText( &field ); 101 textSprite = new QCanvasText( &field );
101 QFont font( "helvetica", 14 ); 102 QFont font( "helvetica", 14 );
102 textSprite->setFont( font ); 103 textSprite->setFont( font );
103 104
104 shield = 0; 105 shield = 0;
105 shieldOn = FALSE; 106 shieldOn = FALSE;
106 refreshRate = REFRESH_DELAY; 107 refreshRate = REFRESH_DELAY;
107 108
108 readSprites(); 109 readSprites();
109 110
110 shieldTimer = new QTimer( this ); 111 shieldTimer = new QTimer( this );
111 connect( shieldTimer, SIGNAL(timeout()), this, SLOT(hideShield()) ); 112 connect( shieldTimer, SIGNAL(timeout()), this, SLOT(hideShield()) );
112 mTimerId = -1; 113 mTimerId = -1;
113 114
114 shipPower = MAX_POWER_LEVEL; 115 shipPower = MAX_POWER_LEVEL;
115 vitalsChanged = TRUE; 116 vitalsChanged = TRUE;
116 can_destroy_powerups = FALSE; 117 can_destroy_powerups = FALSE;
117 118
118 mPaused = TRUE; 119 mPaused = TRUE;
119} 120}
120 121
121// - - - 122// - - -
122 123
123KAsteroidsView::~KAsteroidsView() 124KAsteroidsView::~KAsteroidsView()
124{ 125{
125} 126}
126 127
127// - - - 128// - - -
128 129
129void KAsteroidsView::reset() 130void KAsteroidsView::reset()
130{ 131{
131 rocks.clear(); 132 rocks.clear();
132 missiles.clear(); 133 missiles.clear();
133 bits.clear(); 134 bits.clear();
134 powerups.clear(); 135 powerups.clear();
135 exhaust.clear(); 136 exhaust.clear();
136 137
137 shotsFired = 0; 138 shotsFired = 0;
138 shotsHit = 0; 139 shotsHit = 0;
139 140
140 rockSpeed = 1.0; 141 rockSpeed = 1.0;
141 powerupSpeed = 1.0; 142 powerupSpeed = 1.0;
142 mFrameNum = 0; 143 mFrameNum = 0;
143 mPaused = FALSE; 144 mPaused = FALSE;
144 145
145 ship->hide(); 146 ship->hide();
146 shield->hide(); 147 shield->hide();
147/* 148/*
148 if ( mTimerId >= 0 ) { 149 if ( mTimerId >= 0 ) {
149 killTimer( mTimerId ); 150 killTimer( mTimerId );
150 mTimerId = -1; 151 mTimerId = -1;
151 } 152 }
152*/ 153*/
153} 154}
154 155
155// - -- 156// - --
156 157
157void KAsteroidsView::newGame() 158void KAsteroidsView::newGame()
158{ 159{
159 if ( shieldOn ) 160 if ( shieldOn )
160 { 161 {
161 shield->hide(); 162 shield->hide();
162 shieldOn = FALSE; 163 shieldOn = FALSE;
163 } 164 }
164 reset(); 165 reset();
165 if ( mTimerId < 0 ) 166 if ( mTimerId < 0 )
166 mTimerId = startTimer( REFRESH_DELAY ); 167 mTimerId = startTimer( REFRESH_DELAY );
167 emit updateVitals(); 168 emit updateVitals();
168} 169}
169 170
170// - - - 171// - - -
171 172
172void KAsteroidsView::endGame() 173void KAsteroidsView::endGame()
173{ 174{
174} 175}
175 176
176void KAsteroidsView::pause( bool p ) 177void KAsteroidsView::pause( bool p )
177{ 178{
178 if ( !mPaused && p ) { 179 if ( !mPaused && p ) {
179 if ( mTimerId >= 0 ) { 180 if ( mTimerId >= 0 ) {
180 killTimer( mTimerId ); 181 killTimer( mTimerId );
181 mTimerId = -1; 182 mTimerId = -1;
182 } 183 }
183 } else if ( mPaused && !p ) 184 } else if ( mPaused && !p )
184 mTimerId = startTimer( REFRESH_DELAY ); 185 mTimerId = startTimer( REFRESH_DELAY );
185 mPaused = p; 186 mPaused = p;
186} 187}
187 188
188// - - - 189// - - -
189 190
190void KAsteroidsView::newShip() 191void KAsteroidsView::newShip()
191{ 192{
192 ship->move( field.width()/2, field.height()/2, 0 ); 193 ship->move( field.width()/2, field.height()/2, 0 );
diff --git a/noncore/games/solitaire/cardpile.h b/noncore/games/solitaire/cardpile.h
index 1eb2499..757e6b3 100644
--- a/noncore/games/solitaire/cardpile.h
+++ b/noncore/games/solitaire/cardpile.h
@@ -1,115 +1,117 @@
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#ifndef CARD_PILE_H 20#ifndef CARD_PILE_H
21#define CARD_PILE_H 21#define CARD_PILE_H
22 22
23#include "card.h"
24
23 25
24#include <qpoint.h> 26#include <qpoint.h>
25#include <qlist.h> 27#include <qlist.h>
26 28
27 29
28enum ePileStackingType { 30enum ePileStackingType {
29 pileCascades = 0, pileStacks, pileCascadesOrStacks 31 pileCascades = 0, pileStacks, pileCascadesOrStacks
30}; 32};
31 33
32 34
33enum ePileFaceingType { 35enum ePileFaceingType {
34 pileFaceUp = 0, pileFaceDown, pileFaceUpOrDown 36 pileFaceUp = 0, pileFaceDown, pileFaceUpOrDown
35}; 37};
36 38
37 39
38class Card; 40class Card;
39class Config; 41class Config;
40 42
41 43
42class CardPile : public QList<Card> 44class CardPile : public QList<Card>
43{ 45{
44public: 46public:
45 CardPile(int x, int y); 47 CardPile(int x, int y);
46 virtual ~CardPile() { } 48 virtual ~CardPile() { }
47 49
48 int getX() { return pileX; } 50 int getX() { return pileX; }
49 int getY() { return pileY; } 51 int getY() { return pileY; }
50 int getNextX() { return pileNextX; } 52 int getNextX() { return pileNextX; }
51 int getNextY() { return pileNextY; } 53 int getNextY() { return pileNextY; }
52 int getWidth() { return pileWidth; } 54 int getWidth() { return pileWidth; }
53 int getHeight() { return pileHeight; } 55 int getHeight() { return pileHeight; }
54 int getOffsetDown() { return pileOffsetDown; } 56 int getOffsetDown() { return pileOffsetDown; }
55 int getAnzCardsInPile() { 57 int getAnzCardsInPile() {
56 int anz=0; 58 int anz=0;
57 Card *card = cardOnBottom(); 59 Card *card = cardOnBottom();
58 while (card != NULL) { anz++; card = cardInfront(card); } 60 while (card != NULL) { anz++; card = cardInfront(card); }
59 return anz; 61 return anz;
60 } 62 }
61 63
62 void setX(int x) { pileX = x; } 64 void setX(int x) { pileX = x; }
63 void setY(int y) { pileY = y; } 65 void setY(int y) { pileY = y; }
64 void setNextX(int x) { pileNextX = x; } 66 void setNextX(int x) { pileNextX = x; }
65 void setNextY(int y) { pileNextY = y; } 67 void setNextY(int y) { pileNextY = y; }
66 void setWidth(int width) { pileWidth = width; } 68 void setWidth(int width) { pileWidth = width; }
67 void setHeight(int height) { pileHeight = height; } 69 void setHeight(int height) { pileHeight = height; }
68 void setOffsetDown(int down) { pileOffsetDown = down; } 70 void setOffsetDown(int down) { pileOffsetDown = down; }
69 71
70 void beginDealing() { dealing = TRUE; } 72 void beginDealing() { dealing = TRUE; }
71 void endDealing() { dealing = FALSE; } 73 void endDealing() { dealing = FALSE; }
72 bool isDealing() { return dealing; } 74 bool isDealing() { return dealing; }
73 75
74 void beginPileResize() { PileResize = TRUE; } 76 void beginPileResize() { PileResize = TRUE; }
75 void endPileResize() { PileResize = FALSE; } 77 void endPileResize() { PileResize = FALSE; }
76 bool isPileResize() { return PileResize; } 78 bool isPileResize() { return PileResize; }
77 79
78 int distanceFromPile(int x, int y); 80 int distanceFromPile(int x, int y);
79 int distanceFromNextPos(int x, int y); 81 int distanceFromNextPos(int x, int y);
80 82
81 Card *cardOnTop() { return getLast(); } 83 Card *cardOnTop() { return getLast(); }
82 Card *cardOnBottom() { return getFirst(); } 84 Card *cardOnBottom() { return getFirst(); }
83 Card *cardInfront(Card *c); 85 Card *cardInfront(Card *c);
84 bool kingOnTop(); 86 bool kingOnTop();
85 87
86 bool addCardToTop(Card *c); 88 bool addCardToTop(Card *c);
87 bool addCardToBottom(Card *c); 89 bool addCardToBottom(Card *c);
88 bool removeCard(Card *c); 90 bool removeCard(Card *c);
89 91
90 virtual void cardAddedToTop(Card *) { } 92 virtual void cardAddedToTop(Card *) { }
91 virtual void cardAddedToBottom(Card *) { } 93 virtual void cardAddedToBottom(Card *) { }
92 virtual void cardRemoved(Card *) { } 94 virtual void cardRemoved(Card *) { }
93 virtual bool isAllowedOnTop(Card *) { return FALSE; } 95 virtual bool isAllowedOnTop(Card *) { return FALSE; }
94 virtual bool isAllowedOnBottom(Card *) { return FALSE; } 96 virtual bool isAllowedOnBottom(Card *) { return FALSE; }
95 virtual bool isAllowedToBeMoved(Card *) { return FALSE; } 97 virtual bool isAllowedToBeMoved(Card *) { return FALSE; }
96 virtual QPoint getCardPos(Card *) { return QPoint(pileX, pileY); } 98 virtual QPoint getCardPos(Card *) { return QPoint(pileX, pileY); }
97 virtual QPoint getHypertheticalNextCardPos() { return QPoint(pileX, pileY); } 99 virtual QPoint getHypertheticalNextCardPos() { return QPoint(pileX, pileY); }
98 100
99 void writeConfig( Config& cfg, QString name ); 101 void writeConfig( Config& cfg, QString name );
100 102
101protected: 103protected:
102 int pileX, pileY; 104 int pileX, pileY;
103 int pileNextX, pileNextY; 105 int pileNextX, pileNextY;
104 int pileWidth, pileHeight; 106 int pileWidth, pileHeight;
105 int pileCenterX, pileCenterY; 107 int pileCenterX, pileCenterY;
106 int pileRadius; 108 int pileRadius;
107 int pileOffsetDown; 109 int pileOffsetDown;
108private: 110private:
109 bool dealing; 111 bool dealing;
110 bool PileResize; 112 bool PileResize;
111}; 113};
112 114
113 115
114#endif 116#endif
115 117