Diffstat (limited to 'noncore/games/tetrix/ohighscoredlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/tetrix/ohighscoredlg.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/noncore/games/tetrix/ohighscoredlg.cpp b/noncore/games/tetrix/ohighscoredlg.cpp index 66f4917..504385f 100644 --- a/noncore/games/tetrix/ohighscoredlg.cpp +++ b/noncore/games/tetrix/ohighscoredlg.cpp | |||
@@ -153,54 +153,47 @@ QString OHighscore::getName() | |||
153 | 153 | ||
154 | 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) |
155 | { | 155 | { |
156 | hs_ = highscore; | 156 | hs_ = highscore; |
157 | setCaption( tr( "Highscores" ) ); | 157 | setCaption( tr( "Highscores" ) ); |
158 | vbox_layout = new QVBoxLayout( this, 4 , 4 ); | 158 | vbox_layout = new QVBoxLayout( this, 4 , 4 ); |
159 | list = new QListView( this ); | 159 | list = new QListView( this ); |
160 | list->setSorting( -1 ); | 160 | list->setSorting( -1 ); |
161 | list->addColumn( tr( "#" )); | 161 | list->addColumn( tr( "#" )); |
162 | list->addColumn( tr( "Name" )); | 162 | list->addColumn( tr( "Name" )); |
163 | list->addColumn( tr( "Points" )); | 163 | list->addColumn( tr( "Points" )); |
164 | list->addColumn( tr( "Level" )); | 164 | list->addColumn( tr( "Level" )); |
165 | 165 | ||
166 | createHighscoreListView(); | 166 | createHighscoreListView(); |
167 | 167 | ||
168 | vbox_layout->addWidget( list ); | 168 | vbox_layout->addWidget( list ); |
169 | QPEApplication::showDialog( this ); | 169 | QPEApplication::showDialog( this ); |
170 | } | 170 | } |
171 | 171 | ||
172 | void OHighscoreDialog::createHighscoreListView() | 172 | void OHighscoreDialog::createHighscoreListView() |
173 | { | 173 | { |
174 | int pos = 10; | 174 | int pos = 10; |
175 | int points_ = 0; | 175 | int points_ = 0; |
176 | int level_ = 0; | 176 | int level_ = 0; |
177 | QListViewItem * Prev = 0; | ||
178 | 177 | ||
179 | for ( t_playerData * Run = hs_->playerData.first(); | 178 | for ( t_playerData * Run = hs_->playerData.first(); |
180 | Run != 0; | 179 | Run != 0; |
181 | Run=hs_->playerData.next() ) | 180 | Run=hs_->playerData.next() ) |
182 | { | 181 | { |
183 | QListViewItem *item; | 182 | QListViewItem *item; |
184 | 183 | ||
185 | if( Prev ) { | 184 | item = new QListViewItem( list ); |
186 | // after previous | ||
187 | item = new QListViewItem( list, Prev ); | ||
188 | Prev = item; | ||
189 | } else { | ||
190 | item = new QListViewItem( list ); | ||
191 | 185 | ||
192 | } | ||
193 | item->setText( 0 , QString::number( pos ) ); //number | 186 | item->setText( 0 , QString::number( pos ) ); //number |
194 | item->setText( 1 , Run->sName ); //name | 187 | item->setText( 1 , Run->sName ); //name |
195 | if ( Run->points == -1 ) | 188 | if ( Run->points == -1 ) |
196 | points_ = 0; | 189 | points_ = 0; |
197 | else points_ = Run->points; | 190 | else points_ = Run->points; |
198 | if ( Run->level == -1 ) | 191 | if ( Run->level == -1 ) |
199 | level_ = 0; | 192 | level_ = 0; |
200 | else level_ = Run->level; | 193 | else level_ = Run->level; |
201 | item->setText( 2 , QString::number( points_ ) ); //points | 194 | item->setText( 2 , QString::number( points_ ) ); //points |
202 | item->setText( 3 , QString::number( level_ ) ); //level | 195 | item->setText( 3 , QString::number( level_ ) ); //level |
203 | pos--; | 196 | pos--; |
204 | } | 197 | } |
205 | } | 198 | } |
206 | 199 | ||