Commit a6df8277 authored by Benjamin Meyer's avatar Benjamin Meyer
Browse files

KMainWindow can now handle the statusbar and toolbar, removed unnecessary

functionality.

svn path=/trunk/kdegames/ktron/; revision=214394
parent f5952dc2
......@@ -50,48 +50,46 @@
* Constuctor
*/
KTron::KTron() : settings(0) {
playerPoints[0]=playerPoints[1]=0;
tron=new Tron(this);
connect(tron,SIGNAL(gameEnds(Player)),SLOT(changeStatus(Player)));
setCentralWidget(tron);
tron->setMinimumSize(200,180);
// create statusbar
statusBar()->insertItem("abcdefghijklmnopqrst: 0 ",ID_STATUS_BASE+1);
statusBar()->insertItem("abcdefghijklmnopqrst: 0 ",ID_STATUS_BASE+2);
actionCollection()->setAutoConnectShortcuts(false);
(void)new KAction(i18n("Player 1 Up"), Key_R, 0, 0, actionCollection(), "Pl1Up");
(void)new KAction(i18n("Player 1 Down"), Key_F, 0, 0, actionCollection(), "Pl1Down");
(void)new KAction(i18n("Player 1 Right"), Key_G, 0, 0, actionCollection(), "Pl1Right");
(void)new KAction(i18n("Player 1 Left"), Key_D, 0, 0, actionCollection(), "Pl1Left");
(void)new KAction(i18n("Player 1 Accelerator"), Key_A, 0, 0, actionCollection(), "Pl1Ac");
(void)new KAction(i18n("Player 2 Up"), Key_Up, 0, 0, actionCollection(), "Pl2Up");
(void)new KAction(i18n("Player 2 Down"), Key_Down, 0, 0, actionCollection(), "Pl2Down");
(void)new KAction(i18n("Player 2 Right"), Key_Right, 0, 0, actionCollection(), "Pl2Right");
(void)new KAction(i18n("Player 2 Left"), Key_Left, 0, 0, actionCollection(), "Pl2Left");
(void)new KAction(i18n("Player 2 Accelerator"), Key_0, 0, 0, actionCollection(), "Pl2Ac");
actionCollection()->setAutoConnectShortcuts(true);
tron->setActionCollection(actionCollection());
KStdGameAction::pause(tron, SLOT(togglePause()), actionCollection());
KStdGameAction::gameNew( tron, SLOT( newGame() ), actionCollection() );
KStdGameAction::quit(this, SLOT( close() ), actionCollection());
//showStatusbar = KStdAction::showStatusbar(this, SLOT(toggleStatusbar()), actionCollection());
KStdAction::keyBindings(this, SLOT(configureKeys()), actionCollection());
playerPoints[0]=playerPoints[1]=0;
tron=new Tron(this);
connect(tron,SIGNAL(gameEnds(Player)),SLOT(changeStatus(Player)));
setCentralWidget(tron);
tron->setMinimumSize(200,180);
// create statusbar
statusBar()->insertItem("abcdefghijklmnopqrst: 0 ",ID_STATUS_BASE+1);
statusBar()->insertItem("abcdefghijklmnopqrst: 0 ",ID_STATUS_BASE+2);
actionCollection()->setAutoConnectShortcuts(false);
(void)new KAction(i18n("Player 1 Up"), Key_R, 0, 0, actionCollection(), "Pl1Up");
(void)new KAction(i18n("Player 1 Down"), Key_F, 0, 0, actionCollection(), "Pl1Down");
(void)new KAction(i18n("Player 1 Right"), Key_G, 0, 0, actionCollection(), "Pl1Right");
(void)new KAction(i18n("Player 1 Left"), Key_D, 0, 0, actionCollection(), "Pl1Left");
(void)new KAction(i18n("Player 1 Accelerator"), Key_A, 0, 0, actionCollection(), "Pl1Ac");
(void)new KAction(i18n("Player 2 Up"), Key_Up, 0, 0, actionCollection(), "Pl2Up");
(void)new KAction(i18n("Player 2 Down"), Key_Down, 0, 0, actionCollection(), "Pl2Down");
(void)new KAction(i18n("Player 2 Right"), Key_Right, 0, 0, actionCollection(), "Pl2Right");
(void)new KAction(i18n("Player 2 Left"), Key_Left, 0, 0, actionCollection(), "Pl2Left");
(void)new KAction(i18n("Player 2 Accelerator"), Key_0, 0, 0, actionCollection(), "Pl2Ac");
actionCollection()->setAutoConnectShortcuts(true);
tron->setActionCollection(actionCollection());
KStdGameAction::pause(tron, SLOT(togglePause()), actionCollection());
KStdGameAction::gameNew( tron, SLOT( newGame() ), actionCollection() );
KStdGameAction::quit(this, SLOT( close() ), actionCollection());
KStdAction::keyBindings(this, SLOT(configureKeys()), actionCollection());
(void)new KAction(i18n("&Configure KTron..."), 0, this, SLOT(showSettings()), actionCollection(), "configure_ktron" );
KStdAction::preferences(this, SLOT(showSettings()), actionCollection());
createStandardStatusBarAction();
createGUI();
resize(400,300);
setAutoSaveSettings();
//showStatusbar->setChecked(!statusBar()->isHidden());
readSettings();
}
......@@ -187,16 +185,6 @@ void KTron::paletteChange(const QPalette &/*oldPalette*/){
tron->update();
}
/**
* Turn the statusbar on/off
*/
void KTron::toggleStatusbar() {
if(showStatusbar->isChecked())
statusBar()->show();
else
statusBar()->hide();
}
/**
* Bring up the key configuration dialog.
*/
......
......@@ -31,7 +31,6 @@
class KAccel;
class KSelectAction;
class KToggleAction;
class KDialogBase;
class Tron;
......@@ -51,7 +50,6 @@ private:
Tron *tron;
QString playerName[2];
int playerPoints[2];
KToggleAction *showStatusbar;
KDialogBase *settings;
void updateStatusbar();
......@@ -66,7 +64,6 @@ private slots:
void changeStatus(Player);
void showWinner(Player winner);
void toggleStatusbar();
void configureKeys();
void showSettings();
void closeSettings();
......
<!DOCTYPE kpartgui>
<kpartgui name="ktron" version="2">
<ActionProperties>
<Action name="configure_ktron" icon="configure"/>
</ActionProperties>
<MenuBar>
<Menu name="settings"><text>&amp;Settings</text>
<Action name="configure_ktron"/>
</Menu>
</MenuBar>
<kpartgui name="ktron" version="3">
</kpartgui>
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