Diffstat (limited to 'noncore/games/backgammon/backgammon.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/backgammon/backgammon.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp index c40f462..06523f1 100644 --- a/noncore/games/backgammon/backgammon.cpp +++ b/noncore/games/backgammon/backgammon.cpp | |||
@@ -22,13 +22,13 @@ | |||
22 | 22 | ||
23 | 23 | ||
24 | BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | 24 | BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) |
25 | : QMainWindow(parent, name, fl) | 25 | : QMainWindow(parent, name, fl) |
26 | { | 26 | { |
27 | if (!name) setName("BackGammon"); | 27 | if (!name) setName("BackGammon"); |
28 | setCaption("Backgammon"); | 28 | setCaption(tr( "Backgammon") ); |
29 | setIcon( Resource::loadPixmap( "backgammon" ) ); | 29 | setIcon( Resource::loadPixmap( "backgammon" ) ); |
30 | //general counter varaible | 30 | //general counter varaible |
31 | int a=0; | 31 | int a=0; |
32 | //the game engine | 32 | //the game engine |
33 | move=new MoveEngine(); | 33 | move=new MoveEngine(); |
34 | 34 | ||
@@ -102,36 +102,36 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | |||
102 | 102 | ||
103 | 103 | ||
104 | //the menu | 104 | //the menu |
105 | QPEMenuBar* menuBar = new QPEMenuBar(this); | 105 | QPEMenuBar* menuBar = new QPEMenuBar(this); |
106 | 106 | ||
107 | QPopupMenu* gamemenu= new QPopupMenu(this); | 107 | QPopupMenu* gamemenu= new QPopupMenu(this); |
108 | gamemenu->insertItem("New",this,SLOT(newgame())); | 108 | gamemenu->insertItem(tr( "New" ),this,SLOT(newgame())); |
109 | gamemenu->insertSeparator(); | 109 | gamemenu->insertSeparator(); |
110 | gamemenu->insertItem("Load",this,SLOT(loadgame())); | 110 | gamemenu->insertItem(tr( "Load" ),this,SLOT(loadgame())); |
111 | gamemenu->insertItem("Save",this,SLOT(savegame())); | 111 | gamemenu->insertItem(tr( "Save" ),this,SLOT(savegame())); |
112 | gamemenu->insertSeparator(); | 112 | gamemenu->insertSeparator(); |
113 | gamemenu->insertItem("Delete",this,SLOT(deletegame())); | 113 | gamemenu->insertItem(tr( "Delete" ),this,SLOT(deletegame())); |
114 | menuBar->insertItem("Game",gamemenu); | 114 | menuBar->insertItem(tr( "Game" ),gamemenu); |
115 | 115 | ||
116 | QPopupMenu* thememenu= new QPopupMenu(this); | 116 | QPopupMenu* thememenu= new QPopupMenu(this); |
117 | thememenu->insertItem("New",this,SLOT(newtheme())); | 117 | thememenu->insertItem(tr( "New" ),this,SLOT(newtheme())); |
118 | thememenu->insertSeparator(); | 118 | thememenu->insertSeparator(); |
119 | thememenu->insertItem("Load",this,SLOT(loadtheme())); | 119 | thememenu->insertItem(tr( "Load"),this,SLOT(loadtheme())); |
120 | thememenu->insertItem("Save",this,SLOT(savetheme())); | 120 | thememenu->insertItem(tr( "Save" ),this,SLOT(savetheme())); |
121 | thememenu->insertSeparator(); | 121 | thememenu->insertSeparator(); |
122 | thememenu->insertItem("Default",this,SLOT(themedefault())); | 122 | thememenu->insertItem(tr( "Default"),this,SLOT(themedefault())); |
123 | thememenu->insertItem("Delete",this,SLOT(deletetheme())); | 123 | thememenu->insertItem(tr( "Delete" ),this,SLOT(deletetheme())); |
124 | menuBar->insertItem("Theme",thememenu); | 124 | menuBar->insertItem(tr( "Theme" ),thememenu); |
125 | 125 | ||
126 | QPopupMenu* optionmenu=new QPopupMenu(this); | 126 | QPopupMenu* optionmenu=new QPopupMenu(this); |
127 | optionmenu->insertItem("Player",this,SLOT(playerselect())); | 127 | optionmenu->insertItem(tr( "Player" ),this,SLOT(playerselect())); |
128 | optionmenu->insertSeparator(); | 128 | optionmenu->insertSeparator(); |
129 | optionmenu->insertItem("AI",this,SLOT(modify_AI())); | 129 | optionmenu->insertItem(tr( "AI" ),this,SLOT(modify_AI())); |
130 | optionmenu->insertItem("Rules",this,SLOT(setrules())); | 130 | optionmenu->insertItem(tr( "Rules" ),this,SLOT(setrules())); |
131 | menuBar->insertItem("Options",optionmenu); | 131 | menuBar->insertItem(tr( "Options"),optionmenu); |
132 | 132 | ||
133 | QWidget* mainarea=new QWidget(this); | 133 | QWidget* mainarea=new QWidget(this); |
134 | setCentralWidget(mainarea); | 134 | setCentralWidget(mainarea); |
135 | //the main area | 135 | //the main area |
136 | QBoxLayout* layout=new QBoxLayout(mainarea,QBoxLayout::TopToBottom); | 136 | QBoxLayout* layout=new QBoxLayout(mainarea,QBoxLayout::TopToBottom); |
137 | area=new QCanvas(235,235); | 137 | area=new QCanvas(235,235); |
@@ -507,21 +507,21 @@ void BackGammon::deletetheme() | |||
507 | if(!file->exec()) | 507 | if(!file->exec()) |
508 | return; | 508 | return; |
509 | 509 | ||
510 | theme_name=file->filename(); | 510 | theme_name=file->filename(); |
511 | QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; | 511 | QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; |
512 | 512 | ||
513 | if(!QMessageBox::warning(this,"Backgammon","deleted theme "+theme_name+" ?","OK","Cancel")) | 513 | if(!QMessageBox::warning(this,tr( "Backgammon" ),tr( "deleted theme %1?").arg(theme_name),tr( "OK" ),tr( "Cancel" ))) |
514 | { | 514 | { |
515 | QFile(theme_file).remove(); | 515 | QFile(theme_file).remove(); |
516 | } | 516 | } |
517 | } | 517 | } |
518 | 518 | ||
519 | void BackGammon::modify_AI() | 519 | void BackGammon::modify_AI() |
520 | { | 520 | { |
521 | AI_Dialog* ai_mod=new AI_Dialog(this,"Load Theme",".theme"); | 521 | AI_Dialog* ai_mod=new AI_Dialog(this,tr( "Load Theme" ),".theme"); |
522 | ai_mod->setAISettings(move->getAISettings()); | 522 | ai_mod->setAISettings(move->getAISettings()); |
523 | if(!ai_mod->exec()) | 523 | if(!ai_mod->exec()) |
524 | return; | 524 | return; |
525 | 525 | ||
526 | //get the AI settings | 526 | //get the AI settings |
527 | AISettings ai=ai_mod->getAISettings(); | 527 | AISettings ai=ai_mod->getAISettings(); |
@@ -536,13 +536,13 @@ void BackGammon::modify_AI() | |||
536 | conf.writeEntry("safe",ai.safe); | 536 | conf.writeEntry("safe",ai.safe); |
537 | conf.writeEntry("empty",ai.empty); | 537 | conf.writeEntry("empty",ai.empty); |
538 | } | 538 | } |
539 | 539 | ||
540 | void BackGammon::setrules() | 540 | void BackGammon::setrules() |
541 | { | 541 | { |
542 | RulesDialog* rulesdialog=new RulesDialog(this,"Load Theme",".theme"); | 542 | RulesDialog* rulesdialog=new RulesDialog(this,tr( "Load Theme" ),".theme"); |
543 | rulesdialog->setRules(rules); | 543 | rulesdialog->setRules(rules); |
544 | if(!rulesdialog->exec()) | 544 | if(!rulesdialog->exec()) |
545 | return; | 545 | return; |
546 | rules=rulesdialog->getRules(); | 546 | rules=rulesdialog->getRules(); |
547 | Config conf("backgammon"); | 547 | Config conf("backgammon"); |
548 | conf.setGroup("rules"); | 548 | conf.setGroup("rules"); |
@@ -796,13 +796,13 @@ void BackGammon::nomove() | |||
796 | { | 796 | { |
797 | if(player==1) | 797 | if(player==1) |
798 | nomove_marker->setX(0); | 798 | nomove_marker->setX(0); |
799 | else | 799 | else |
800 | nomove_marker->setX(170); | 800 | nomove_marker->setX(170); |
801 | nomove_marker->show(); | 801 | nomove_marker->show(); |
802 | message->setText("<b>no move</b>"); | 802 | message->setText(tr( "<b>no move</b>" )); |
803 | dice1_played=true; | 803 | dice1_played=true; |
804 | dice2_played=true; | 804 | dice2_played=true; |
805 | dice3_played=true; | 805 | dice3_played=true; |
806 | dice4_played=true; | 806 | dice4_played=true; |
807 | if(player==1) | 807 | if(player==1) |
808 | { | 808 | { |
@@ -832,15 +832,15 @@ void BackGammon::nomove2() | |||
832 | } | 832 | } |
833 | 833 | ||
834 | void BackGammon::finished(int theplayer) | 834 | void BackGammon::finished(int theplayer) |
835 | { | 835 | { |
836 | nomove_marker->hide(); | 836 | nomove_marker->hide(); |
837 | if(theplayer==1) | 837 | if(theplayer==1) |
838 | message->setText("<b>Player 1 wins. Click on board for new game.</b>"); | 838 | message->setText(tr( "<b>Player 1 wins. Click on board for new game.</b>" )); |
839 | else | 839 | else |
840 | message->setText("<b>Player 2 wins. Click on board for new game.</b>"); | 840 | message->setText(tr( "<b>Player 2 wins. Click on board for new game.</b>" )); |
841 | diceA1_value=7; | 841 | diceA1_value=7; |
842 | diceA2_value=7; | 842 | diceA2_value=7; |
843 | diceB1_value=7; | 843 | diceB1_value=7; |
844 | diceB2_value=7; | 844 | diceB2_value=7; |
845 | player=0; | 845 | player=0; |
846 | showdice(); | 846 | showdice(); |
@@ -892,21 +892,21 @@ void BackGammon::showdice() | |||
892 | } | 892 | } |
893 | 893 | ||
894 | void BackGammon::setplayer() | 894 | void BackGammon::setplayer() |
895 | { | 895 | { |
896 | if(dice1_played && dice2_played && dice3_played && dice4_played && player==1) | 896 | if(dice1_played && dice2_played && dice3_played && dice4_played && player==1) |
897 | { | 897 | { |
898 | message->setText("<b>P2 turn</b>"); | 898 | message->setText(tr( "<b>P2 turn</b>", "P means player" )); |
899 | dice_rolled=false; | 899 | dice_rolled=false; |
900 | player=2; | 900 | player=2; |
901 | if(player2_auto) | 901 | if(player2_auto) |
902 | QTimer::singleShot(2000,this,SLOT(autoroll_dice2())); | 902 | QTimer::singleShot(2000,this,SLOT(autoroll_dice2())); |
903 | } | 903 | } |
904 | else if(dice1_played && dice2_played && dice3_played && dice4_played && player==2) | 904 | else if(dice1_played && dice2_played && dice3_played && dice4_played && player==2) |
905 | { | 905 | { |
906 | message->setText("<b>P1 turn</b>"); | 906 | message->setText(tr( "<b>P1 turn</b>", "P means player" )); |
907 | dice_rolled=false; | 907 | dice_rolled=false; |
908 | player=1; | 908 | player=1; |
909 | if(player1_auto) | 909 | if(player1_auto) |
910 | QTimer::singleShot(2000,this,SLOT(autoroll_dice1())); | 910 | QTimer::singleShot(2000,this,SLOT(autoroll_dice1())); |
911 | } | 911 | } |
912 | } | 912 | } |