summaryrefslogtreecommitdiff
path: root/noncore/games/backgammon/backgammon.cpp
authorcniehaus <cniehaus>2003-06-01 13:48:07 (UTC)
committer cniehaus <cniehaus>2003-06-01 13:48:07 (UTC)
commit145faa6417fd952768d0abe15cc8b9920548d45f (patch) (side-by-side diff)
treed78efad22827115e07bf584425bf666f0f8d7e47 /noncore/games/backgammon/backgammon.cpp
parent316ced6af8e9492215ad0a39d43127665239503d (diff)
downloadopie-145faa6417fd952768d0abe15cc8b9920548d45f.zip
opie-145faa6417fd952768d0abe15cc8b9920548d45f.tar.gz
opie-145faa6417fd952768d0abe15cc8b9920548d45f.tar.bz2
first patches for tr()-changes\!
Diffstat (limited to 'noncore/games/backgammon/backgammon.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/backgammon/backgammon.cpp48
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
@@ -16,25 +16,25 @@
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
#include <stdlib.h>
BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
: QMainWindow(parent, name, fl)
{
if (!name) setName("BackGammon");
- setCaption("Backgammon");
+ setCaption(tr( "Backgammon") );
setIcon( Resource::loadPixmap( "backgammon" ) );
//general counter varaible
int a=0;
//the game engine
move=new MoveEngine();
//load the default theme
Config conf("backgammon");
if(!conf.isValid())
{
qDebug("config file does not exist");
conf.setGroup("general");
@@ -96,48 +96,48 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
piecesA_name=theme.readEntry("pieces1","casino_pieces_blue");
piecesB_name=theme.readEntry("pieces2","casino_pieces_white");
diceA_name=theme.readEntry("dice1","casino_dice");
diceB_name=theme.readEntry("dice2","casino_dice");
table_name=theme.readEntry("table","casino_table_green");
odds_name=theme.readEntry("odds","casino_odds");
//the menu
QPEMenuBar* menuBar = new QPEMenuBar(this);
QPopupMenu* gamemenu= new QPopupMenu(this);
- gamemenu->insertItem("New",this,SLOT(newgame()));
+ gamemenu->insertItem(tr( "New" ),this,SLOT(newgame()));
gamemenu->insertSeparator();
- gamemenu->insertItem("Load",this,SLOT(loadgame()));
- gamemenu->insertItem("Save",this,SLOT(savegame()));
+ gamemenu->insertItem(tr( "Load" ),this,SLOT(loadgame()));
+ gamemenu->insertItem(tr( "Save" ),this,SLOT(savegame()));
gamemenu->insertSeparator();
- gamemenu->insertItem("Delete",this,SLOT(deletegame()));
- menuBar->insertItem("Game",gamemenu);
+ gamemenu->insertItem(tr( "Delete" ),this,SLOT(deletegame()));
+ menuBar->insertItem(tr( "Game" ),gamemenu);
QPopupMenu* thememenu= new QPopupMenu(this);
- thememenu->insertItem("New",this,SLOT(newtheme()));
+ thememenu->insertItem(tr( "New" ),this,SLOT(newtheme()));
thememenu->insertSeparator();
- thememenu->insertItem("Load",this,SLOT(loadtheme()));
- thememenu->insertItem("Save",this,SLOT(savetheme()));
+ thememenu->insertItem(tr( "Load"),this,SLOT(loadtheme()));
+ thememenu->insertItem(tr( "Save" ),this,SLOT(savetheme()));
thememenu->insertSeparator();
- thememenu->insertItem("Default",this,SLOT(themedefault()));
- thememenu->insertItem("Delete",this,SLOT(deletetheme()));
- menuBar->insertItem("Theme",thememenu);
+ thememenu->insertItem(tr( "Default"),this,SLOT(themedefault()));
+ thememenu->insertItem(tr( "Delete" ),this,SLOT(deletetheme()));
+ menuBar->insertItem(tr( "Theme" ),thememenu);
QPopupMenu* optionmenu=new QPopupMenu(this);
- optionmenu->insertItem("Player",this,SLOT(playerselect()));
+ optionmenu->insertItem(tr( "Player" ),this,SLOT(playerselect()));
optionmenu->insertSeparator();
- optionmenu->insertItem("AI",this,SLOT(modify_AI()));
- optionmenu->insertItem("Rules",this,SLOT(setrules()));
- menuBar->insertItem("Options",optionmenu);
+ optionmenu->insertItem(tr( "AI" ),this,SLOT(modify_AI()));
+ optionmenu->insertItem(tr( "Rules" ),this,SLOT(setrules()));
+ menuBar->insertItem(tr( "Options"),optionmenu);
QWidget* mainarea=new QWidget(this);
setCentralWidget(mainarea);
//the main area
QBoxLayout* layout=new QBoxLayout(mainarea,QBoxLayout::TopToBottom);
area=new QCanvas(235,235);
boardview=new BackGammonView(area,mainarea);
boardview->setMaximumHeight(240);
layout->addWidget(boardview);
connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int)));
//status bar
message=new QLabel("<b>Backgammon</b>",mainarea);
@@ -501,54 +501,54 @@ void BackGammon::themedefault()
conf.writeEntry("theme",theme_name);
}
void BackGammon::deletetheme()
{
FileDialog* file=new FileDialog(this,"Delete Theme",".theme");
if(!file->exec())
return;
theme_name=file->filename();
QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
- if(!QMessageBox::warning(this,"Backgammon","deleted theme "+theme_name+" ?","OK","Cancel"))
+ if(!QMessageBox::warning(this,tr( "Backgammon" ),tr( "deleted theme %1?").arg(theme_name),tr( "OK" ),tr( "Cancel" )))
{
QFile(theme_file).remove();
}
}
void BackGammon::modify_AI()
{
- AI_Dialog* ai_mod=new AI_Dialog(this,"Load Theme",".theme");
+ AI_Dialog* ai_mod=new AI_Dialog(this,tr( "Load Theme" ),".theme");
ai_mod->setAISettings(move->getAISettings());
if(!ai_mod->exec())
return;
//get the AI settings
AISettings ai=ai_mod->getAISettings();
move->setAISettings(ai);
//write new settings to conf file
Config conf("backgammon");
conf.setGroup("ai");
conf.writeEntry("rescue",ai.rescue);
conf.writeEntry("eliminate",ai.eliminate);
conf.writeEntry("expose",ai.expose);
conf.writeEntry("protect",ai.protect);
conf.writeEntry("safe",ai.safe);
conf.writeEntry("empty",ai.empty);
}
void BackGammon::setrules()
{
- RulesDialog* rulesdialog=new RulesDialog(this,"Load Theme",".theme");
+ RulesDialog* rulesdialog=new RulesDialog(this,tr( "Load Theme" ),".theme");
rulesdialog->setRules(rules);
if(!rulesdialog->exec())
return;
rules=rulesdialog->getRules();
Config conf("backgammon");
conf.setGroup("rules");
conf.writeEntry("move_with_pieces_out",rules.move_with_pieces_out);
conf.writeEntry("nice_dice",rules.generous_dice);
move->setRules(rules);
}
@@ -790,25 +790,25 @@ void BackGammon::done_dice4()
}
}
}
void BackGammon::nomove()
{
if(player==1)
nomove_marker->setX(0);
else
nomove_marker->setX(170);
nomove_marker->show();
- message->setText("<b>no move</b>");
+ message->setText(tr( "<b>no move</b>" ));
dice1_played=true;
dice2_played=true;
dice3_played=true;
dice4_played=true;
if(player==1)
{
diceA1_value=7;
diceA2_value=7;
diceA3_value=7;
diceA4_value=7;
}
else
@@ -826,27 +826,27 @@ void BackGammon::nomove2()
{
nomove_marker->hide();
setplayer();
showdice();
draw();
area->update();
}
void BackGammon::finished(int theplayer)
{
nomove_marker->hide();
if(theplayer==1)
- message->setText("<b>Player 1 wins. Click on board for new game.</b>");
+ message->setText(tr( "<b>Player 1 wins. Click on board for new game.</b>" ));
else
- message->setText("<b>Player 2 wins. Click on board for new game.</b>");
+ message->setText(tr( "<b>Player 2 wins. Click on board for new game.</b>" ));
diceA1_value=7;
diceA2_value=7;
diceB1_value=7;
diceB2_value=7;
player=0;
showdice();
draw();
area->update();
gameFinished=true;
}
void BackGammon::showdice()
@@ -886,33 +886,33 @@ void BackGammon::showdice()
if(value_diceB2==index)
diceB2[index]->show();
else
diceB2[index]->hide();
}
}
void BackGammon::setplayer()
{
if(dice1_played && dice2_played && dice3_played && dice4_played && player==1)
{
- message->setText("<b>P2 turn</b>");
+ message->setText(tr( "<b>P2 turn</b>", "P means player" ));
dice_rolled=false;
player=2;
if(player2_auto)
QTimer::singleShot(2000,this,SLOT(autoroll_dice2()));
}
else if(dice1_played && dice2_played && dice3_played && dice4_played && player==2)
{
- message->setText("<b>P1 turn</b>");
+ message->setText(tr( "<b>P1 turn</b>", "P means player" ));
dice_rolled=false;
player=1;
if(player1_auto)
QTimer::singleShot(2000,this,SLOT(autoroll_dice1()));
}
}
void BackGammon::autoroll_dice1()
{
mouse(20,210);
}