summaryrefslogtreecommitdiff
path: root/noncore/games/backgammon/backgammon.cpp
Unidiff
Diffstat (limited to 'noncore/games/backgammon/backgammon.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/backgammon/backgammon.cpp14
1 files changed, 7 insertions, 7 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
324void BackGammon::loadgame() 324void 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
368void BackGammon::savegame() 368void 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
402void BackGammon::deletegame() 402void 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
418void BackGammon::newtheme() 418void 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
449void BackGammon::loadtheme() 449void 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
472void BackGammon::savetheme() 472void 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
505void BackGammon::deletetheme() 505void 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
520void BackGammon::modify_AI() 520void 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())