Commit 11791d73 authored by Stephan Binner's avatar Stephan Binner

Patch by Andreas Simon <yuipx@gmx.net> to fix #38509

 * fixes ktron doesn't recognize keystroke
 * fixes Game/Quit does not work
 * fix use of deprecated method KAccel::insertItem
 * fix use of deprecated method KAccel::currentItem

svn path=/trunk/kdegames/ktron/; revision=139178
parent dd0024ba
......@@ -65,17 +65,17 @@ KTron::KTron(const char *name)
accel=new KAccel(this,"Key Accel");
accel->insertItem(i18n("Player 1 Up"),"Pl1Up","R");
accel->insertItem(i18n("Player 1 Down"),"Pl1Down","F");
accel->insertItem(i18n("Player 1 Right"),"Pl1Right","G");
accel->insertItem(i18n("Player 1 Left"),"Pl1Left","D");
accel->insertItem(i18n("Player 1 Accelerator"),"Pl1Ac","A");
accel->insertItem(i18n("Player 2 Up"),"Pl2Up","Up");
accel->insertItem(i18n("Player 2 Down"),"Pl2Down","Down");
accel->insertItem(i18n("Player 2 Right"),"Pl2Right","Right");
accel->insertItem(i18n("Player 2 Left"),"Pl2Left","Left");
accel->insertItem(i18n("Player 2 Accelerator"),"Pl2Ac","Plus");
accel->insert("Pl1Up", i18n("Player 1 Up"), 0, Key_R, 0, 0);
accel->insert("Pl1Down", i18n("Player 1 Down"), 0, Key_F, 0, 0);
accel->insert("Pl1Right", i18n("Player 1 Right"), 0, Key_G, 0, 0);
accel->insert("Pl1Left", i18n("Player 1 Left"), 0, Key_D, 0, 0);
accel->insert("Pl1Ac", i18n("Player 1 Accelerator"), 0, Key_A, 0, 0);
accel->insert("Pl2Up", i18n("Player 2 Up"), 0, Key_Up, 0, 0);
accel->insert("Pl2Down", i18n("Player 2 Down"), 0, Key_Down, 0, 0);
accel->insert("Pl2Right", i18n("Player 2 Right"), 0, Key_Right, 0, 0);
accel->insert("Pl2Left", i18n("Player 2 Left"), 0, Key_Left, 0, 0);
accel->insert("Pl2Ac", i18n("Player 2 Accelerator"), 0, Key_Plus, 0, 0);
accel->readSettings();
tron->setAccel(accel);
......@@ -85,11 +85,7 @@ KTron::KTron(const char *name)
actionCollection(), "game_pause");
action->plugAccel(accel);
KStdGameAction::gameNew( tron, SLOT( newGame() ), actionCollection() );
//action=new KAction(i18n("&New Game"), KStdAccel::openNew(), tron, SLOT(newGame()),
// actionCollection(), "game_new");
//action->plugAccel(accel);
KStdGameAction::quit(this, SLOT( slotQuit() ), actionCollection());
//action->plugAccel(accel);
KStdGameAction::quit(this, SLOT( quit() ), actionCollection());
/* options-menu */
new KToggleAction(i18n("Player &1"), 0 , this, SLOT(toggleComPl1()),
......
......@@ -753,27 +753,27 @@ void Tron::keyPressEvent(QKeyEvent *e)
if(!players[1].computer)
{
if(key==accel->currentKey("Pl2::Up"))
if(key==accel->shortcut("Pl2Up"))
{
switchDir(1,::Up);
players[1].keyPressed=true;
}
else if(key==accel->currentKey("Pl2::Left"))
else if(key==accel->shortcut("Pl2Left"))
{
switchDir(1,::Left);
players[1].keyPressed=true;
}
else if(key==accel->currentKey("Pl2::Right"))
else if(key==accel->shortcut("Pl2Right"))
{
switchDir(1,::Right);
players[1].keyPressed=true;
}
else if(key==accel->currentKey("Pl2::Down"))
else if(key==accel->shortcut("Pl2Down"))
{
switchDir(1,::Down);
players[1].keyPressed=true;
}
else if(key==accel->currentKey("Pl2Ac"))
else if(key==accel->shortcut("Pl2Ac"))
{
if(!blockAccelerator)
players[1].accelerated=true;
......@@ -783,28 +783,28 @@ void Tron::keyPressEvent(QKeyEvent *e)
if(!players[0].computer)
{
if(key==accel->currentKey("Pl1::Left"))
if(key==accel->shortcut("Pl1Left"))
{
switchDir(0,::Left);
players[0].keyPressed=true;
}
else if(key==accel->currentKey("Pl1::Right"))
else if(key==accel->shortcut("Pl1Right"))
{
switchDir(0,::Right);
players[0].keyPressed=true;
}
else if(key==accel->currentKey("Pl1::Up"))
else if(key==accel->shortcut("Pl1Up"))
{
switchDir(0,::Up);
players[0].keyPressed=true;
}
else if(key==accel->currentKey("Pl1::Down"))
else if(key==accel->shortcut("Pl1Down"))
{
switchDir(0,::Down);
players[0].keyPressed=true;
}
else if(key==accel->currentKey("Pl1Ac"))
else if(key==accel->shortcut("Pl1Ac"))
{
if(!blockAccelerator)
players[0].accelerated=true;
......@@ -840,28 +840,28 @@ void Tron::keyReleaseEvent(QKeyEvent * e)
if(!players[1].computer)
{
if(key==accel->currentKey("Pl2Ac"))
if(key==accel->shortcut("Pl2Ac"))
{
players[1].accelerated=false;
return;
}
else if(key==accel->currentKey("Pl2::Left"))
else if(key==accel->shortcut("Pl2Left"))
{
players[1].keyPressed=false;
return;
}
else if(key==accel->currentKey("Pl2::Right"))
else if(key==accel->shortcut("Pl2Right"))
{
players[1].keyPressed=false;
return;
}
else if(key==accel->currentKey("Pl2::Up"))
else if(key==accel->shortcut("Pl2Up"))
{
players[1].keyPressed=false;
return;
}
else if(key==accel->currentKey("Pl2::Down"))
else if(key==accel->shortcut("Pl2Down"))
{
players[1].keyPressed=false;
return;
......@@ -870,27 +870,27 @@ void Tron::keyReleaseEvent(QKeyEvent * e)
if(!players[0].computer)
{
if(key==accel->currentKey("Pl1::Left"))
if(key==accel->shortcut("Pl1Left"))
{
players[0].keyPressed=false;
return;
}
else if(key==accel->currentKey("Pl1::Right"))
else if(key==accel->shortcut("Pl1Right"))
{
players[0].keyPressed=false;
return;
}
else if(key==accel->currentKey("Pl1::Up"))
else if(key==accel->shortcut("Pl1Up"))
{
players[0].keyPressed=false;
return;
}
else if(key==accel->currentKey("Pl1::Down"))
else if(key==accel->shortcut("Pl1Down"))
{
players[0].keyPressed=false;
return;
}
else if(key==accel->currentKey("Pl1Ac"))
else if(key==accel->shortcut("Pl1Ac"))
{
players[0].accelerated=false;
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment