-rw-r--r-- | noncore/games/backgammon/backgammon.cpp | 14 | ||||
-rw-r--r-- | noncore/games/backgammon/filedialog.cpp | 2 | ||||
-rw-r--r-- | noncore/games/backgammon/themedialog.cpp | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp index bdb1c78..c286a36 100644 --- a/noncore/games/backgammon/backgammon.cpp +++ b/noncore/games/backgammon/backgammon.cpp | |||
@@ -48,25 +48,25 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | |||
48 | conf.writeEntry("warning",true); | 48 | conf.writeEntry("warning",true); |
49 | conf.setGroup("ai"); | 49 | conf.setGroup("ai"); |
50 | conf.writeEntry("rescue",6); | 50 | conf.writeEntry("rescue",6); |
51 | conf.writeEntry("eliminate",4); | 51 | conf.writeEntry("eliminate",4); |
52 | conf.writeEntry("expose",1); | 52 | conf.writeEntry("expose",1); |
53 | conf.writeEntry("protect",5); | 53 | conf.writeEntry("protect",5); |
54 | conf.writeEntry("safe",3); | 54 | conf.writeEntry("safe",3); |
55 | conf.writeEntry("empty",2); | 55 | conf.writeEntry("empty",2); |
56 | 56 | ||
57 | } | 57 | } |
58 | conf.setGroup("general"); | 58 | conf.setGroup("general"); |
59 | theme_name=conf.readEntry("theme","default"); | 59 | theme_name=conf.readEntry("theme","default"); |
60 | QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; | 60 | QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme"; |
61 | 61 | ||
62 | //the rules | 62 | //the rules |
63 | conf.setGroup("rules"); | 63 | conf.setGroup("rules"); |
64 | rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false); | 64 | rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false); |
65 | rules.generous_dice=conf.readBoolEntry("nice_dice",false); | 65 | rules.generous_dice=conf.readBoolEntry("nice_dice",false); |
66 | 66 | ||
67 | move->setRules(rules); | 67 | move->setRules(rules); |
68 | 68 | ||
69 | //get the AI settings | 69 | //get the AI settings |
70 | AISettings ai; | 70 | AISettings ai; |
71 | conf.setGroup("ai"); | 71 | conf.setGroup("ai"); |
72 | ai.rescue=conf.readNumEntry("rescue",6); | 72 | ai.rescue=conf.readNumEntry("rescue",6); |
@@ -319,25 +319,25 @@ void BackGammon::playerselect() | |||
319 | return; | 319 | return; |
320 | player1_auto=playerdialog->getAuto1(); | 320 | player1_auto=playerdialog->getAuto1(); |
321 | player2_auto=playerdialog->getAuto2(); | 321 | player2_auto=playerdialog->getAuto2(); |
322 | } | 322 | } |
323 | 323 | ||
324 | void BackGammon::loadgame() | 324 | void BackGammon::loadgame() |
325 | { | 325 | { |
326 | FileDialog* file=new FileDialog(this,"Load Game",".game"); | 326 | FileDialog* file=new FileDialog(this,"Load Game",".game"); |
327 | if(!file->exec()) | 327 | if(!file->exec()) |
328 | return; | 328 | return; |
329 | 329 | ||
330 | game_name=file->filename(); | 330 | game_name=file->filename(); |
331 | QString game_file=QPEApplication::qpeDir()+"/backgammon/"+game_name+".game"; | 331 | QString game_file=QPEApplication::qpeDir()+"backgammon/"+game_name+".game"; |
332 | 332 | ||
333 | Config game(game_file,Config::File); | 333 | Config game(game_file,Config::File); |
334 | game.setGroup("dice"); | 334 | game.setGroup("dice"); |
335 | diceA1_value=game.readNumEntry("diceA1_value"); | 335 | diceA1_value=game.readNumEntry("diceA1_value"); |
336 | diceA2_value=game.readNumEntry("diceA2_value"); | 336 | diceA2_value=game.readNumEntry("diceA2_value"); |
337 | diceA3_value=game.readNumEntry("diceA3_value"); | 337 | diceA3_value=game.readNumEntry("diceA3_value"); |
338 | diceA4_value=game.readNumEntry("diceA4_value"); | 338 | diceA4_value=game.readNumEntry("diceA4_value"); |
339 | diceB1_value=game.readNumEntry("diceB1_value"); | 339 | diceB1_value=game.readNumEntry("diceB1_value"); |
340 | diceB2_value=game.readNumEntry("diceB2_value"); | 340 | diceB2_value=game.readNumEntry("diceB2_value"); |
341 | diceB3_value=game.readNumEntry("diceB3_value"); | 341 | diceB3_value=game.readNumEntry("diceB3_value"); |
342 | diceB4_value=game.readNumEntry("diceB4_value"); | 342 | diceB4_value=game.readNumEntry("diceB4_value"); |
343 | player=game.readNumEntry("player"); | 343 | player=game.readNumEntry("player"); |
@@ -358,25 +358,25 @@ void BackGammon::loadgame() | |||
358 | load.pop[a].total = game.readNumEntry(label,0); | 358 | load.pop[a].total = game.readNumEntry(label,0); |
359 | } | 359 | } |
360 | 360 | ||
361 | move->loadGame(load); | 361 | move->loadGame(load); |
362 | setplayer(); | 362 | setplayer(); |
363 | showdice(); | 363 | showdice(); |
364 | draw(); | 364 | draw(); |
365 | area->update(); | 365 | area->update(); |
366 | } | 366 | } |
367 | 367 | ||
368 | void BackGammon::savegame() | 368 | void BackGammon::savegame() |
369 | { | 369 | { |
370 | QString game_file=QPEApplication::qpeDir()+"/backgammon/"+game_name+".game"; | 370 | QString game_file=QPEApplication::qpeDir()+"backgammon/"+game_name+".game"; |
371 | 371 | ||
372 | Config game(game_file,Config::File); | 372 | Config game(game_file,Config::File); |
373 | game.setGroup("dice"); | 373 | game.setGroup("dice"); |
374 | game.writeEntry("diceA1_value",diceA1_value); | 374 | game.writeEntry("diceA1_value",diceA1_value); |
375 | game.writeEntry("diceA2_value",diceA2_value); | 375 | game.writeEntry("diceA2_value",diceA2_value); |
376 | game.writeEntry("diceA3_value",diceA3_value); | 376 | game.writeEntry("diceA3_value",diceA3_value); |
377 | game.writeEntry("diceA4_value",diceA4_value); | 377 | game.writeEntry("diceA4_value",diceA4_value); |
378 | game.writeEntry("diceB1_value",diceB1_value); | 378 | game.writeEntry("diceB1_value",diceB1_value); |
379 | game.writeEntry("diceB2_value",diceB3_value); | 379 | game.writeEntry("diceB2_value",diceB3_value); |
380 | game.writeEntry("diceB3_value",diceB4_value); | 380 | game.writeEntry("diceB3_value",diceB4_value); |
381 | game.writeEntry("diceB4_value",diceB4_value); | 381 | game.writeEntry("diceB4_value",diceB4_value); |
382 | game.writeEntry("player",player); | 382 | game.writeEntry("player",player); |
@@ -397,25 +397,25 @@ void BackGammon::savegame() | |||
397 | game.writeEntry(label,save.pop[a].total); | 397 | game.writeEntry(label,save.pop[a].total); |
398 | } | 398 | } |
399 | QMessageBox::information(this,"Backgammon","Game saved","OK"); | 399 | QMessageBox::information(this,"Backgammon","Game saved","OK"); |
400 | } | 400 | } |
401 | 401 | ||
402 | void BackGammon::deletegame() | 402 | void BackGammon::deletegame() |
403 | { | 403 | { |
404 | FileDialog* file=new FileDialog(this,"Delete Game",".game"); | 404 | FileDialog* file=new FileDialog(this,"Delete Game",".game"); |
405 | if(!file->exec()) | 405 | if(!file->exec()) |
406 | return; | 406 | return; |
407 | 407 | ||
408 | game_name=file->filename(); | 408 | game_name=file->filename(); |
409 | QString game_file=QPEApplication::qpeDir()+"/backgammon/"+game_name+".game"; | 409 | QString game_file=QPEApplication::qpeDir()+"backgammon/"+game_name+".game"; |
410 | 410 | ||
411 | if(!QMessageBox::warning(this,"Backgammon","deleted game\n"+game_name+" ?","OK","Cancel")) | 411 | if(!QMessageBox::warning(this,"Backgammon","deleted game\n"+game_name+" ?","OK","Cancel")) |
412 | { | 412 | { |
413 | QFile(game_file).remove(); | 413 | QFile(game_file).remove(); |
414 | } | 414 | } |
415 | } | 415 | } |
416 | 416 | ||
417 | 417 | ||
418 | void BackGammon::newtheme() | 418 | void BackGammon::newtheme() |
419 | { | 419 | { |
420 | ThemeDialog* theme=new ThemeDialog(this); | 420 | ThemeDialog* theme=new ThemeDialog(this); |
421 | 421 | ||
@@ -444,48 +444,48 @@ void BackGammon::newtheme() | |||
444 | table_name=names.table; | 444 | table_name=names.table; |
445 | 445 | ||
446 | applytheme(); | 446 | applytheme(); |
447 | } | 447 | } |
448 | 448 | ||
449 | void BackGammon::loadtheme() | 449 | void BackGammon::loadtheme() |
450 | { | 450 | { |
451 | FileDialog* file=new FileDialog(this,"Load Theme",".theme"); | 451 | FileDialog* file=new FileDialog(this,"Load Theme",".theme"); |
452 | if(!file->exec()) | 452 | if(!file->exec()) |
453 | return; | 453 | return; |
454 | 454 | ||
455 | theme_name=file->filename(); | 455 | theme_name=file->filename(); |
456 | QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; | 456 | QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme"; |
457 | 457 | ||
458 | Config theme(theme_file,Config::File); | 458 | Config theme(theme_file,Config::File); |
459 | theme.setGroup("theme"); | 459 | theme.setGroup("theme"); |
460 | board_name=theme.readEntry("board","board_1"); | 460 | board_name=theme.readEntry("board","board_1"); |
461 | piecesA_name=theme.readEntry("pieces1","pieces_1"); | 461 | piecesA_name=theme.readEntry("pieces1","pieces_1"); |
462 | piecesB_name=theme.readEntry("pieces2","pieces_2"); | 462 | piecesB_name=theme.readEntry("pieces2","pieces_2"); |
463 | diceA_name=theme.readEntry("dice1","dice_1"); | 463 | diceA_name=theme.readEntry("dice1","dice_1"); |
464 | diceB_name=theme.readEntry("dice2","dice_2"); | 464 | diceB_name=theme.readEntry("dice2","dice_2"); |
465 | table_name=theme.readEntry("table","table_1"); | 465 | table_name=theme.readEntry("table","table_1"); |
466 | odds_name=theme.readEntry("odds","odds_1"); | 466 | odds_name=theme.readEntry("odds","odds_1"); |
467 | 467 | ||
468 | applytheme(); | 468 | applytheme(); |
469 | 469 | ||
470 | } | 470 | } |
471 | 471 | ||
472 | void BackGammon::savetheme() | 472 | void BackGammon::savetheme() |
473 | { | 473 | { |
474 | if(theme_name=="default") | 474 | if(theme_name=="default") |
475 | { | 475 | { |
476 | QMessageBox::information(this,"Backgammon","Sorry\nCannot overwrite default.theme","OK"); | 476 | QMessageBox::information(this,"Backgammon","Sorry\nCannot overwrite default.theme","OK"); |
477 | return; | 477 | return; |
478 | } | 478 | } |
479 | QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; | 479 | QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme"; |
480 | if(QMessageBox::information(this,"Backgammon","Save Theme\n"+theme_name,"Yes","No")) | 480 | if(QMessageBox::information(this,"Backgammon","Save Theme\n"+theme_name,"Yes","No")) |
481 | return; | 481 | return; |
482 | 482 | ||
483 | Config theme(theme_file,Config::File); | 483 | Config theme(theme_file,Config::File); |
484 | theme.setGroup("theme"); | 484 | theme.setGroup("theme"); |
485 | theme.writeEntry("board",board_name); | 485 | theme.writeEntry("board",board_name); |
486 | theme.writeEntry("pieces1",piecesA_name); | 486 | theme.writeEntry("pieces1",piecesA_name); |
487 | theme.writeEntry("pieces2",piecesB_name); | 487 | theme.writeEntry("pieces2",piecesB_name); |
488 | theme.writeEntry("dice1",diceA_name); | 488 | theme.writeEntry("dice1",diceA_name); |
489 | theme.writeEntry("dice2",diceB_name); | 489 | theme.writeEntry("dice2",diceB_name); |
490 | theme.writeEntry("table",table_name); | 490 | theme.writeEntry("table",table_name); |
491 | theme.writeEntry("odds",odds_name); | 491 | theme.writeEntry("odds",odds_name); |
@@ -500,25 +500,25 @@ void BackGammon::themedefault() | |||
500 | Config conf("backgammon"); | 500 | Config conf("backgammon"); |
501 | conf.setGroup("general"); | 501 | conf.setGroup("general"); |
502 | conf.writeEntry("theme",theme_name); | 502 | conf.writeEntry("theme",theme_name); |
503 | } | 503 | } |
504 | 504 | ||
505 | void BackGammon::deletetheme() | 505 | void BackGammon::deletetheme() |
506 | { | 506 | { |
507 | FileDialog* file=new FileDialog(this,"Delete Theme",".theme"); | 507 | FileDialog* file=new FileDialog(this,"Delete Theme",".theme"); |
508 | if(!file->exec()) | 508 | if(!file->exec()) |
509 | return; | 509 | return; |
510 | 510 | ||
511 | theme_name=file->filename(); | 511 | theme_name=file->filename(); |
512 | QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; | 512 | QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme"; |
513 | 513 | ||
514 | if(!QMessageBox::warning(this,tr( "Backgammon" ),tr( "deleted theme %1?").arg(theme_name),tr( "OK" ),tr( "Cancel" ))) | 514 | if(!QMessageBox::warning(this,tr( "Backgammon" ),tr( "deleted theme %1?").arg(theme_name),tr( "OK" ),tr( "Cancel" ))) |
515 | { | 515 | { |
516 | QFile(theme_file).remove(); | 516 | QFile(theme_file).remove(); |
517 | } | 517 | } |
518 | } | 518 | } |
519 | 519 | ||
520 | void BackGammon::modify_AI() | 520 | void BackGammon::modify_AI() |
521 | { | 521 | { |
522 | AI_Dialog* ai_mod=new AI_Dialog(this,tr( "Load Theme" ),".theme"); | 522 | AI_Dialog* ai_mod=new AI_Dialog(this,tr( "Load Theme" ),".theme"); |
523 | ai_mod->setAISettings(move->getAISettings()); | 523 | ai_mod->setAISettings(move->getAISettings()); |
524 | if(!ai_mod->exec()) | 524 | if(!ai_mod->exec()) |
diff --git a/noncore/games/backgammon/filedialog.cpp b/noncore/games/backgammon/filedialog.cpp index e0a2914..f185188 100644 --- a/noncore/games/backgammon/filedialog.cpp +++ b/noncore/games/backgammon/filedialog.cpp | |||
@@ -28,25 +28,25 @@ FileDialog::~FileDialog() | |||
28 | 28 | ||
29 | void FileDialog::selectorclicked(QListViewItem* entry) | 29 | void FileDialog::selectorclicked(QListViewItem* entry) |
30 | { | 30 | { |
31 | if(entry==NULL) | 31 | if(entry==NULL) |
32 | return; | 32 | return; |
33 | file_name=entry->text(0); | 33 | file_name=entry->text(0); |
34 | fileinput->setText(file_name); | 34 | fileinput->setText(file_name); |
35 | } | 35 | } |
36 | 36 | ||
37 | void FileDialog::getCurrentDir() | 37 | void FileDialog::getCurrentDir() |
38 | { | 38 | { |
39 | dirselector->clear(); | 39 | dirselector->clear(); |
40 | QDir dir(QPEApplication::qpeDir()+"/backgammon"); | 40 | QDir dir(QPEApplication::qpeDir()+"backgammon"); |
41 | dir.setFilter(QDir::Files); | 41 | dir.setFilter(QDir::Files); |
42 | QFileInfoListIterator it(*(dir.entryInfoList())); | 42 | QFileInfoListIterator it(*(dir.entryInfoList())); |
43 | QFileInfo* fi; | 43 | QFileInfo* fi; |
44 | 44 | ||
45 | int ext_length=ext.length(); | 45 | int ext_length=ext.length(); |
46 | while((fi=it.current())) // go through all file and subdirs | 46 | while((fi=it.current())) // go through all file and subdirs |
47 | { | 47 | { |
48 | QString file=fi->fileName(); | 48 | QString file=fi->fileName(); |
49 | if(file.right(ext_length)==ext && file) | 49 | if(file.right(ext_length)==ext && file) |
50 | { | 50 | { |
51 | file=file.left(file.length()-ext_length); | 51 | file=file.left(file.length()-ext_length); |
52 | new QListViewItem(dirselector,file); | 52 | new QListViewItem(dirselector,file); |
diff --git a/noncore/games/backgammon/themedialog.cpp b/noncore/games/backgammon/themedialog.cpp index afd6a1b..9bdb6a9 100644 --- a/noncore/games/backgammon/themedialog.cpp +++ b/noncore/games/backgammon/themedialog.cpp | |||
@@ -134,25 +134,25 @@ void ThemeDialog::setCurrent(const ImageNames& current) | |||
134 | { | 134 | { |
135 | if(boxtable->text(a)==current.table) | 135 | if(boxtable->text(a)==current.table) |
136 | { | 136 | { |
137 | boxtable->setCurrentItem(a); | 137 | boxtable->setCurrentItem(a); |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | void ThemeDialog::fillBox(QString dirname,QComboBox* thebox) | 143 | void ThemeDialog::fillBox(QString dirname,QComboBox* thebox) |
144 | { | 144 | { |
145 | thebox->clear(); | 145 | thebox->clear(); |
146 | QDir dir(QPEApplication::qpeDir()+"/pics/backgammon/"+dirname); | 146 | QDir dir(QPEApplication::qpeDir()+"pics/backgammon/"+dirname); |
147 | dir.setFilter(QDir::Dirs | QDir::Files); | 147 | dir.setFilter(QDir::Dirs | QDir::Files); |
148 | QFileInfoListIterator it(*(dir.entryInfoList())); | 148 | QFileInfoListIterator it(*(dir.entryInfoList())); |
149 | QFileInfo* fi; | 149 | QFileInfo* fi; |
150 | 150 | ||
151 | while((fi=it.current())) // go through all file and subdirs | 151 | while((fi=it.current())) // go through all file and subdirs |
152 | { | 152 | { |
153 | QString file=fi->fileName(); | 153 | QString file=fi->fileName(); |
154 | if(file.right(4)==".png") | 154 | if(file.right(4)==".png") |
155 | { | 155 | { |
156 | thebox->insertItem(file.left(file.find(".png"))); | 156 | thebox->insertItem(file.left(file.find(".png"))); |
157 | } | 157 | } |
158 | ++it; | 158 | ++it; |