author | wimpie <wimpie> | 2005-01-04 01:35:26 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-04 01:35:26 (UTC) |
commit | a9c188235c97e07b0eb96b13adbcdfd4bad64767 (patch) (unidiff) | |
tree | 13f6ae5c499dc0c1d1bd4b763a1973a0fa8635cf /noncore/games | |
parent | 48b6cd5966ec6cc0b968edf10ba1a1ad96ef165f (diff) | |
download | opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.zip opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.tar.gz opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.tar.bz2 |
CONTROL files : changed version string
NS2 many changes and first release of OT2
-rw-r--r-- | noncore/games/bounce/opie-bounce.control | 2 | ||||
-rw-r--r-- | noncore/games/buzzword/opie-buzzword.control | 2 | ||||
-rw-r--r-- | noncore/games/kbill/opie-kbill.control | 2 | ||||
-rw-r--r-- | noncore/games/kcheckers/opie-kcheckers.control | 2 | ||||
-rw-r--r-- | noncore/games/kpacman/opie-kpacman.control | 2 | ||||
-rw-r--r-- | noncore/games/tetrix/ohighscoredlg.cpp | 81 | ||||
-rw-r--r-- | noncore/games/tetrix/ohighscoredlg.h | 13 | ||||
-rw-r--r-- | noncore/games/tetrix/tetrix.pro | 2 |
8 files changed, 56 insertions, 50 deletions
diff --git a/noncore/games/bounce/opie-bounce.control b/noncore/games/bounce/opie-bounce.control index dfd1bf0..0513958 100644 --- a/noncore/games/bounce/opie-bounce.control +++ b/noncore/games/bounce/opie-bounce.control | |||
@@ -1,11 +1,11 @@ | |||
1 | Package: opie-bounce | 1 | Package: opie-bounce |
2 | Files: plugins/application/libbounce.so* bin/bounce apps/Games/bounce.desktop pics/bounce/*.png | 2 | Files: plugins/application/libbounce.so* bin/bounce apps/Games/bounce.desktop pics/bounce/*.png |
3 | Version: 0.6-$SUB_VERSION | 3 | Version: $QPE_VERSION$EXTRAVERSION |
4 | Depends: task-opie-minimal, libopiecore2 | 4 | Depends: task-opie-minimal, libopiecore2 |
5 | Priority: optional | 5 | Priority: optional |
6 | Section: opie/games | 6 | Section: opie/games |
7 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 7 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
8 | Architecture: arm | 8 | Architecture: arm |
9 | License: GPL | 9 | License: GPL |
10 | Description: bounce | 10 | Description: bounce |
11 | A JezzGame like game for Qtopia. | 11 | A JezzGame like game for Qtopia. |
diff --git a/noncore/games/buzzword/opie-buzzword.control b/noncore/games/buzzword/opie-buzzword.control index 3316445..f76a2c2 100644 --- a/noncore/games/buzzword/opie-buzzword.control +++ b/noncore/games/buzzword/opie-buzzword.control | |||
@@ -1,11 +1,11 @@ | |||
1 | Package: opie-buzzword | 1 | Package: opie-buzzword |
2 | Files: plugins/application/libbuzzword.so* bin/buzzword apps/Games/buzzword.desktop pics/buzzword/buzzword.png share/buzzword/buzzwords | 2 | Files: plugins/application/libbuzzword.so* bin/buzzword apps/Games/buzzword.desktop pics/buzzword/buzzword.png share/buzzword/buzzwords |
3 | Version: 1.1-$SUB_VERSION | 3 | Version: $QPE_VERSION$EXTRAVERSION |
4 | Depends: task-opie-minimal,libopiecore2 | 4 | Depends: task-opie-minimal,libopiecore2 |
5 | Priority: optional | 5 | Priority: optional |
6 | Section: opie/games | 6 | Section: opie/games |
7 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 7 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
8 | Architecture: arm | 8 | Architecture: arm |
9 | License: GPL | 9 | License: GPL |
10 | Description: BuzzWord | 10 | Description: BuzzWord |
11 | A BuzzWord Bingo for the Opie environment. | 11 | A BuzzWord Bingo for the Opie environment. |
diff --git a/noncore/games/kbill/opie-kbill.control b/noncore/games/kbill/opie-kbill.control index 3299b93..cf12bca 100644 --- a/noncore/games/kbill/opie-kbill.control +++ b/noncore/games/kbill/opie-kbill.control | |||
@@ -1,13 +1,13 @@ | |||
1 | Package: opie-kbill | 1 | Package: opie-kbill |
2 | Files: bin/kbill apps/Games/kbill.desktop pics/kbill/* | 2 | Files: bin/kbill apps/Games/kbill.desktop pics/kbill/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Mark Westcott <mark@houseoffish.org> | 5 | Maintainer: Mark Westcott <mark@houseoffish.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.8-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal | 8 | Depends: task-opie-minimal |
9 | License: GPL | 9 | License: GPL |
10 | Description: The famous hit Bill game | 10 | Description: The famous hit Bill game |
11 | Hit Bill as hard as you can before he | 11 | Hit Bill as hard as you can before he |
12 | infects your network with a wannabe | 12 | infects your network with a wannabe |
13 | OS. | 13 | OS. |
diff --git a/noncore/games/kcheckers/opie-kcheckers.control b/noncore/games/kcheckers/opie-kcheckers.control index 5bd03ae..e7c20d3 100644 --- a/noncore/games/kcheckers/opie-kcheckers.control +++ b/noncore/games/kcheckers/opie-kcheckers.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-kcheckers | 1 | Package: opie-kcheckers |
2 | Files: plugins/application/libkcheckers.so* bin/kcheckers apps/Games/kcheckers.desktop pics/kcheckers | 2 | Files: plugins/application/libkcheckers.so* bin/kcheckers apps/Games/kcheckers.desktop pics/kcheckers |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: leseb <prudhomme@laposte.net> | 5 | Maintainer: leseb <prudhomme@laposte.net> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.3-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal, libopiecore2 | 8 | Depends: task-opie-minimal, libopiecore2 |
9 | Description: The game of Checkers | 9 | Description: The game of Checkers |
10 | A game for the Opie environment. | 10 | A game for the Opie environment. |
diff --git a/noncore/games/kpacman/opie-kpacman.control b/noncore/games/kpacman/opie-kpacman.control index 68487ec..97120aa 100644 --- a/noncore/games/kpacman/opie-kpacman.control +++ b/noncore/games/kpacman/opie-kpacman.control | |||
@@ -1,11 +1,11 @@ | |||
1 | Package: opie-kpacman | 1 | Package: opie-kpacman |
2 | Files: plugins/applications/libkpacman.so* bin/kpacman apps/Games/kpacman.desktop pics/kpacman/kpacman.png share/kpacman | 2 | Files: plugins/applications/libkpacman.so* bin/kpacman apps/Games/kpacman.desktop pics/kpacman/kpacman.png share/kpacman |
3 | Version: 0.3.1-$SUB_VERSION | 3 | Version: $QPE_VERSION$EXTRAVERSION |
4 | Depends: task-opie-minimal | 4 | Depends: task-opie-minimal |
5 | Priority: optional | 5 | Priority: optional |
6 | Section: opie/games | 6 | Section: opie/games |
7 | Maintainer: Catalin Climov <catalin@climov.com> | 7 | Maintainer: Catalin Climov <catalin@climov.com> |
8 | Architecture: arm | 8 | Architecture: arm |
9 | License: GPL | 9 | License: GPL |
10 | Description: Kpacman | 10 | Description: Kpacman |
11 | A Pacman clone for Qtopia. | 11 | A Pacman clone for Qtopia. |
diff --git a/noncore/games/tetrix/ohighscoredlg.cpp b/noncore/games/tetrix/ohighscoredlg.cpp index 8d8079e..66f4917 100644 --- a/noncore/games/tetrix/ohighscoredlg.cpp +++ b/noncore/games/tetrix/ohighscoredlg.cpp | |||
@@ -1,199 +1,206 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | begin : January 2003 | 2 | begin : January 2003 |
3 | copyright : ( C ) 2003 by Carsten Niehaus | 3 | copyright : ( C ) 2003 by Carsten Niehaus |
4 | email : cniehaus@handhelds.org | 4 | email : cniehaus@handhelds.org |
5 | **************************************************************************/ | 5 | **************************************************************************/ |
6 | 6 | ||
7 | /*************************************************************************** | 7 | /*************************************************************************** |
8 | * * | 8 | * * |
9 | * This program is free software; you can redistribute it and/or modify * | 9 | * This program is free software; you can redistribute it and/or modify * |
10 | * it under the terms of the GNU General Public License as published by * | 10 | * it under the terms of the GNU General Public License as published by * |
11 | * the Free Software Foundation; either version 2 of the License, or * | 11 | * the Free Software Foundation; either version 2 of the License, or * |
12 | * ( at your option ) any later version. * | 12 | * ( at your option ) any later version. * |
13 | * * | 13 | * * |
14 | **************************************************************************/ | 14 | **************************************************************************/ |
15 | 15 | ||
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | #include <qlayout.h> | 17 | #include <qlayout.h> |
18 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | 20 | ||
21 | #include <qstring.h> | 21 | #include <qstring.h> |
22 | #include <qlist.h> | ||
22 | #include <qhbox.h> | 23 | #include <qhbox.h> |
23 | #include <qvbox.h> | 24 | #include <qvbox.h> |
24 | #include <qlabel.h> | 25 | #include <qlabel.h> |
25 | #include <qlistview.h> | 26 | #include <qlistview.h> |
26 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
27 | 28 | ||
28 | #include "ohighscoredlg.h" | 29 | #include "ohighscoredlg.h" |
29 | 30 | ||
30 | OHighscore::OHighscore( int score , int playerLevel ) | 31 | OHighscore::OHighscore( int score , int playerLevel ) : playerData() |
31 | { | 32 | { |
32 | pLevel = playerLevel; | 33 | pLevel = playerLevel; |
33 | getList(); | 34 | getList(); |
34 | checkIfItIsANewhighscore( score ); | 35 | checkIfItIsANewhighscore( score ); |
36 | playerData.setAutoDelete( TRUE ); | ||
35 | } | 37 | } |
36 | 38 | ||
37 | OHighscore::~OHighscore() | 39 | OHighscore::~OHighscore() |
38 | { | 40 | { |
39 | std::list<t_playerData*>::iterator deleteIterator = playerData.begin(); | ||
40 | for ( ; deleteIterator != playerData.end() ; deleteIterator++ ) | ||
41 | { | ||
42 | delete ( *deleteIterator ); | ||
43 | } | ||
44 | } | 41 | } |
45 | 42 | ||
46 | void OHighscore::getList() | 43 | void OHighscore::getList() |
47 | { | 44 | { |
48 | Config cfg ( "tetrix" ); | 45 | Config cfg ( "tetrix" ); |
49 | cfg.setGroup( QString::number( 1 ) ); | 46 | cfg.setGroup( QString::number( 1 ) ); |
50 | lowest = cfg.readNumEntry( "Points" ); | 47 | lowest = cfg.readNumEntry( "Points" ); |
51 | playerData.clear(); | 48 | playerData.clear(); |
52 | 49 | ||
53 | int rest = 1;//for the filling up later | 50 | int rest = 1;//for the filling up later |
54 | 51 | ||
55 | for ( int i = 1 ; i < 11 ; i++ ) | 52 | for ( int i = 1 ; i < 11 ; i++ ) |
56 | { | 53 | { |
57 | if ( cfg.hasGroup( QString::number( i ) ) ) | 54 | if ( cfg.hasGroup( QString::number( i ) ) ) |
58 | { | 55 | { |
59 | cfg.setGroup( QString::number( i ) ); | 56 | cfg.setGroup( QString::number( i ) ); |
60 | int temp = cfg.readNumEntry( "Points" ); | 57 | int temp = cfg.readNumEntry( "Points" ); |
61 | 58 | ||
62 | t_playerData *pPlayerData = new t_playerData; | 59 | t_playerData *pPlayerData = new t_playerData; |
63 | pPlayerData->sName = cfg.readEntry( "Name" ); | 60 | pPlayerData->sName = cfg.readEntry( "Name" ); |
64 | pPlayerData->points = temp; | 61 | pPlayerData->points = temp; |
65 | pPlayerData->level = cfg.readNumEntry( "Level" ); | 62 | pPlayerData->level = cfg.readNumEntry( "Level" ); |
66 | 63 | ||
67 | playerData.push_back( pPlayerData ); | 64 | playerData.append( pPlayerData ); |
68 | 65 | ||
69 | if ( (temp < lowest) ) lowest = temp; | 66 | if ( (temp < lowest) ) lowest = temp; |
70 | rest++; | 67 | rest++; |
71 | } | 68 | } |
72 | } | 69 | } |
73 | 70 | ||
74 | //now I fill up the rest of the list | 71 | //now I fill up the rest of the list |
75 | if ( rest < 11 ) //only go in this loop if there are less than | 72 | if ( rest < 11 ) //only go in this loop if there are less than |
76 | //10 highscoreentries | 73 | //10 highscoreentries |
77 | { | 74 | { |
78 | lowest = 0; | 75 | lowest = 0; |
79 | for ( ; rest < 11 ; rest++ ) | 76 | for ( ; rest < 11 ; rest++ ) |
80 | { | 77 | { |
81 | t_playerData *pPlayerData = new t_playerData; | 78 | t_playerData *pPlayerData = new t_playerData; |
82 | pPlayerData->sName = tr( "empty"); | 79 | pPlayerData->sName = tr( "empty"); |
83 | pPlayerData->points = 0; | 80 | pPlayerData->points = 0; |
84 | pPlayerData->level = 0; | 81 | pPlayerData->level = 0; |
85 | 82 | ||
86 | playerData.push_back( pPlayerData ); | 83 | playerData.append( pPlayerData ); |
87 | } | 84 | } |
88 | } | 85 | } |
89 | 86 | ||
90 | } | 87 | } |
91 | 88 | ||
92 | void OHighscore::checkIfItIsANewhighscore( int points) | 89 | void OHighscore::checkIfItIsANewhighscore( int points) |
93 | { | 90 | { |
94 | if ( points > lowest ) | 91 | if ( points > lowest ) |
95 | isNewhighscore = true; | 92 | isNewhighscore = true; |
96 | else | 93 | else |
97 | isNewhighscore = false; | 94 | isNewhighscore = false; |
98 | } | 95 | } |
99 | 96 | ||
100 | void OHighscore::insertData( QString name , int punkte , int playerLevel ) | 97 | void OHighscore::insertData( QString name , int punkte , int playerLevel ) |
101 | { | 98 | { |
102 | Config cfg ( "tetrix" ); | 99 | Config cfg ( "tetrix" ); |
100 | t_playerData * Run; | ||
101 | int index = 0; | ||
103 | int entryNumber = 1; | 102 | int entryNumber = 1; |
104 | std::list<t_playerData*>::iterator insertIterator = playerData.begin(); | 103 | |
105 | while ( insertIterator != playerData.end() ) | 104 | for ( Run=playerData.first(); |
106 | { | 105 | Run != 0; |
107 | if ( punkte > ( *insertIterator )->points ) | 106 | index ++, Run=playerData.next() ) { |
107 | |||
108 | if ( punkte > Run->points ) | ||
108 | { | 109 | { |
109 | t_playerData* temp = new t_playerData; | 110 | t_playerData* temp = new t_playerData; |
110 | temp->sName = name; | 111 | temp->sName = name; |
111 | temp->points = punkte; | 112 | temp->points = punkte; |
112 | temp->level = playerLevel; | 113 | temp->level = playerLevel; |
113 | playerData.insert( insertIterator , temp ); | 114 | |
115 | playerData.insert( index, temp ); | ||
114 | 116 | ||
115 | //now we have to delete the last entry | 117 | //now we have to delete the last entry |
116 | insertIterator = playerData.end(); | 118 | playerData.remove( playerData.count() ); |
117 | insertIterator--; | ||
118 | //X delete *insertIterator; //memleak? | ||
119 | playerData.erase( insertIterator ); | ||
120 | 119 | ||
121 | ///////////////////////////////////////// | 120 | ///////////////////////////////////////// |
122 | //this block just rewrites the highscore | 121 | //this block just rewrites the highscore |
123 | insertIterator = playerData.begin(); | 122 | for ( t_playerData * Run2=playerData.first(); |
124 | while ( insertIterator != playerData.end() ) | 123 | Run2 != 0; |
125 | { | 124 | Run2=playerData.next() ) { |
126 | cfg.setGroup( QString::number( entryNumber ) ); | 125 | cfg.setGroup( QString::number( entryNumber ) ); |
127 | cfg.writeEntry( "Name" , ( *insertIterator )->sName ); | 126 | cfg.writeEntry( "Name" , Run2->sName ); |
128 | cfg.writeEntry( "Points" , ( *insertIterator )->points ); | 127 | cfg.writeEntry( "Points" , Run2->points ); |
129 | cfg.writeEntry( "Level" , ( *insertIterator )->level ); | 128 | cfg.writeEntry( "Level" , Run2->level ); |
130 | entryNumber++; | 129 | entryNumber++; |
131 | insertIterator++; | ||
132 | } | 130 | } |
133 | //////////////////////////////////////// | 131 | //////////////////////////////////////// |
134 | 132 | ||
135 | return; | 133 | return; |
136 | } | 134 | } |
137 | insertIterator++; | ||
138 | } | 135 | } |
139 | } | 136 | } |
140 | 137 | ||
141 | QString OHighscore::getName() | 138 | QString OHighscore::getName() |
142 | { | 139 | { |
143 | QString name; | 140 | QString name; |
144 | QDialog *d = new QDialog ( this, 0, true ); | 141 | QDialog *d = new QDialog ( this, 0, true ); |
145 | d->setCaption( tr( "Enter your name!" )); | 142 | d->setCaption( tr( "Enter your name!" )); |
146 | QLineEdit *ed = new QLineEdit ( d ); | 143 | QLineEdit *ed = new QLineEdit ( d ); |
147 | ( new QVBoxLayout ( d, 3, 3 ))->addWidget ( ed ); | 144 | ( new QVBoxLayout ( d, 3, 3 ))->addWidget ( ed ); |
148 | ed->setFocus ( ); | 145 | ed->setFocus ( ); |
149 | 146 | ||
150 | if ( d->exec() == QDialog::Accepted ) { | 147 | if ( d->exec() == QDialog::Accepted ) { |
151 | name = ed->text(); | 148 | name = ed->text(); |
152 | } | 149 | } |
153 | //delete d; | 150 | //delete d; |
154 | return name; | 151 | return name; |
155 | } | 152 | } |
156 | 153 | ||
157 | OHighscoreDialog::OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) | 154 | OHighscoreDialog::OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) |
158 | { | 155 | { |
159 | hs_ = highscore; | 156 | hs_ = highscore; |
160 | setCaption( tr( "Highscores" ) ); | 157 | setCaption( tr( "Highscores" ) ); |
161 | vbox_layout = new QVBoxLayout( this, 4 , 4 ); | 158 | vbox_layout = new QVBoxLayout( this, 4 , 4 ); |
162 | list = new QListView( this ); | 159 | list = new QListView( this ); |
163 | list->setSorting( -1 ); | 160 | list->setSorting( -1 ); |
164 | list->addColumn( tr( "#" )); | 161 | list->addColumn( tr( "#" )); |
165 | list->addColumn( tr( "Name" )); | 162 | list->addColumn( tr( "Name" )); |
166 | list->addColumn( tr( "Points" )); | 163 | list->addColumn( tr( "Points" )); |
167 | list->addColumn( tr( "Level" )); | 164 | list->addColumn( tr( "Level" )); |
168 | 165 | ||
169 | createHighscoreListView(); | 166 | createHighscoreListView(); |
170 | 167 | ||
171 | vbox_layout->addWidget( list ); | 168 | vbox_layout->addWidget( list ); |
172 | QPEApplication::showDialog( this ); | 169 | QPEApplication::showDialog( this ); |
173 | } | 170 | } |
174 | 171 | ||
175 | void OHighscoreDialog::createHighscoreListView() | 172 | void OHighscoreDialog::createHighscoreListView() |
176 | { | 173 | { |
177 | int pos = 10; | 174 | int pos = 10; |
178 | int points_ = 0; | 175 | int points_ = 0; |
179 | int level_ = 0; | 176 | int level_ = 0; |
180 | 177 | QListViewItem * Prev = 0; | |
181 | std::list<t_playerData*>::reverse_iterator iListe = hs_->playerData.rbegin(); | 178 | |
182 | 179 | for ( t_playerData * Run = hs_->playerData.first(); | |
183 | for ( ; iListe != hs_->playerData.rend() ; ++iListe ) | 180 | Run != 0; |
184 | { | 181 | Run=hs_->playerData.next() ) |
185 | QListViewItem *item = new QListViewItem( list ); | 182 | { |
183 | QListViewItem *item; | ||
184 | |||
185 | if( Prev ) { | ||
186 | // after previous | ||
187 | item = new QListViewItem( list, Prev ); | ||
188 | Prev = item; | ||
189 | } else { | ||
190 | item = new QListViewItem( list ); | ||
191 | |||
192 | } | ||
186 | item->setText( 0 , QString::number( pos ) ); //number | 193 | item->setText( 0 , QString::number( pos ) ); //number |
187 | item->setText( 1 , ( *iListe )->sName ); //name | 194 | item->setText( 1 , Run->sName ); //name |
188 | if ( ( *iListe )->points == -1 ) | 195 | if ( Run->points == -1 ) |
189 | points_ = 0; | 196 | points_ = 0; |
190 | else points_ = ( *iListe )->points; | 197 | else points_ = Run->points; |
191 | if ( ( *iListe )->level == -1 ) | 198 | if ( Run->level == -1 ) |
192 | level_ = 0; | 199 | level_ = 0; |
193 | else level_ = ( *iListe )->level; | 200 | else level_ = Run->level; |
194 | item->setText( 2 , QString::number( points_ ) ); //points | 201 | item->setText( 2 , QString::number( points_ ) ); //points |
195 | item->setText( 3 , QString::number( level_ ) ); //level | 202 | item->setText( 3 , QString::number( level_ ) ); //level |
196 | pos--; | 203 | pos--; |
197 | } | 204 | } |
198 | } | 205 | } |
199 | 206 | ||
diff --git a/noncore/games/tetrix/ohighscoredlg.h b/noncore/games/tetrix/ohighscoredlg.h index fdbe623..845e639 100644 --- a/noncore/games/tetrix/ohighscoredlg.h +++ b/noncore/games/tetrix/ohighscoredlg.h | |||
@@ -1,97 +1,96 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 6 | * ( at your option ) any later version. * |
7 | * * | 7 | * * |
8 | **************************************************************************/ | 8 | **************************************************************************/ |
9 | 9 | ||
10 | class QWidget; | 10 | class QWidget; |
11 | class QVBoxLayout; | 11 | class QVBoxLayout; |
12 | class QListView; | 12 | class QListView; |
13 | 13 | ||
14 | #include <qdialog.h> | 14 | #include <qdialog.h> |
15 | #include <list> | 15 | #include <qlist.h> |
16 | 16 | ||
17 | using namespace std; | 17 | class t_playerData |
18 | |||
19 | struct t_playerData | ||
20 | { | 18 | { |
19 | |||
20 | public : | ||
21 | |||
21 | QString sName; | 22 | QString sName; |
22 | int points; | 23 | int points; |
23 | int level; | 24 | int level; |
24 | }; | 25 | }; |
25 | 26 | ||
26 | class OHighscore : public QWidget | 27 | class OHighscore : public QWidget |
27 | { | 28 | { |
28 | Q_OBJECT | 29 | Q_OBJECT |
29 | 30 | ||
30 | public: | 31 | public: |
31 | /* | 32 | /* |
32 | *An OHighscore-Object contains all Points, level and playernames sorted in a stl::vector | 33 | *An OHighscore-Object contains all Points, level and playernames sorted in a stl::vector |
33 | */ | 34 | */ |
34 | OHighscore( int , int ); | 35 | OHighscore( int , int ); |
35 | 36 | ||
36 | ~OHighscore(); | 37 | ~OHighscore(); |
37 | 38 | ||
38 | /* | 39 | /* |
39 | * is true if the player did a new highscore | 40 | * is true if the player did a new highscore |
40 | */ | 41 | */ |
41 | bool isNewhighscore; | 42 | bool isNewhighscore; |
42 | 43 | ||
43 | /* | 44 | /* |
44 | * this inserts the new entry at the correct position | 45 | * this inserts the new entry at the correct position |
45 | */ | 46 | */ |
46 | void insertData( QString , int , int ); | 47 | void insertData( QString , int , int ); |
47 | 48 | ||
48 | list<t_playerData*> playerData; | 49 | QList<t_playerData> playerData; |
49 | 50 | ||
50 | /* | 51 | /* |
51 | * As Qt/e does not support QInputDialog I did that code myself | 52 | * As Qt/e does not support QInputDialog I did that code myself |
52 | */ | 53 | */ |
53 | QString getName(); | 54 | QString getName(); |
54 | private: | 55 | private: |
55 | 56 | ||
56 | list<t_playerData*>::iterator iPlayerData; | ||
57 | |||
58 | /* | 57 | /* |
59 | * the lowest score in the highscorelist | 58 | * the lowest score in the highscorelist |
60 | */ | 59 | */ |
61 | int lowest; | 60 | int lowest; |
62 | 61 | ||
63 | /* | 62 | /* |
64 | * the level of the highscore | 63 | * the level of the highscore |
65 | */ | 64 | */ |
66 | int pLevel; | 65 | int pLevel; |
67 | 66 | ||
68 | /* | 67 | /* |
69 | * get all scores in a vector and give "lowest" a value | 68 | * get all scores in a vector and give "lowest" a value |
70 | */ | 69 | */ |
71 | void getList(); | 70 | void getList(); |
72 | 71 | ||
73 | /* | 72 | /* |
74 | * sets the bool if the current score is in the top10 | 73 | * sets the bool if the current score is in the top10 |
75 | */ | 74 | */ |
76 | void checkIfItIsANewhighscore( int ); | 75 | void checkIfItIsANewhighscore( int ); |
77 | }; | 76 | }; |
78 | 77 | ||
79 | class OHighscoreDialog : public QDialog | 78 | class OHighscoreDialog : public QDialog |
80 | { | 79 | { |
81 | Q_OBJECT | 80 | Q_OBJECT |
82 | 81 | ||
83 | public: | 82 | public: |
84 | OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name = 0, bool modal = true ); | 83 | OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name = 0, bool modal = true ); |
85 | 84 | ||
86 | private: | 85 | private: |
87 | OHighscore *hs_; | 86 | OHighscore *hs_; |
88 | 87 | ||
89 | QVBoxLayout *vbox_layout; | 88 | QVBoxLayout *vbox_layout; |
90 | 89 | ||
91 | /* | 90 | /* |
92 | * this method creates the QListView with all data | 91 | * this method creates the QListView with all data |
93 | */ | 92 | */ |
94 | void createHighscoreListView(); | 93 | void createHighscoreListView(); |
95 | 94 | ||
96 | QListView *list; | 95 | QListView *list; |
97 | }; | 96 | }; |
diff --git a/noncore/games/tetrix/tetrix.pro b/noncore/games/tetrix/tetrix.pro index 580a542..96f452f 100644 --- a/noncore/games/tetrix/tetrix.pro +++ b/noncore/games/tetrix/tetrix.pro | |||
@@ -1,22 +1,22 @@ | |||
1 | CONFIG = qt warn_on quick-app | 1 | CONFIG = qt warn_on quick-app |
2 | HEADERS = gtetrix.h \ | 2 | HEADERS = gtetrix.h \ |
3 | qtetrix.h \ | 3 | qtetrix.h \ |
4 | qtetrixb.h \ | 4 | qtetrixb.h \ |
5 | tpiece.h \ | 5 | tpiece.h \ |
6 | ohighscoredlg.h | 6 | ohighscoredlg.h |
7 | SOURCES = main.cpp \ | 7 | SOURCES = main.cpp \ |
8 | gtetrix.cpp \ | 8 | gtetrix.cpp \ |
9 | qtetrix.cpp \ | 9 | qtetrix.cpp \ |
10 | qtetrixb.cpp \ | 10 | qtetrixb.cpp \ |
11 | tpiece.cpp \ | 11 | tpiece.cpp \ |
12 | ohighscoredlg.cpp | 12 | ohighscoredlg.cpp |
13 | INCLUDEPATH += $(OPIEDIR)/include | 13 | INCLUDEPATH += $(OPIEDIR)/include |
14 | DEPENDPATH+= $(OPIEDIR)/include | 14 | DEPENDPATH+= $(OPIEDIR)/include |
15 | LIBS += -lqpe -lopiecore2 -lstdc++ | 15 | LIBS += -lqpe -lopiecore2 |
16 | INTERFACES= | 16 | INTERFACES= |
17 | TARGET = tetrix | 17 | TARGET = tetrix |
18 | 18 | ||
19 | 19 | ||
20 | 20 | ||
21 | 21 | ||
22 | include( $(OPIEDIR)/include.pro ) | 22 | include( $(OPIEDIR)/include.pro ) |