Source Code (Use browser search to find items of interest.)
Class Index
ksirtet'MainWidget (./kdegames/ksirtet/main.h:9)
class MainWidget : public KTMainWindow
{
Q_OBJECT
public:
MainWidget();
~MainWidget();
private slots:
void showHighScores();
void toggleMenubar();
void print();
protected:
bool eventFilter(QObject *, QEvent *);
private:
Interface *inter;
GPieceInfo *pieceInfo;
void readSettings();
};
ksirtet'MainWidget::MainWidget() (./kdegames/ksirtet/main.cpp:17)
MainWidget::MainWidget()
{
installEventFilter(this);
KAccel *kacc = new KAccel(this);
pieceInfo = createPieceInfo();
inter = new Interface(kacc, this);
inter->installEventFilter(this);
inter->singleHuman();
// File & Popup
KStdAction::openNew(inter, SLOT(start()), actionCollection(), "game_new");
(void)new KAction(i18n("Pause"), Key_P, inter, SLOT(pause()),
actionCollection(), "game_pause");
(void)new KAction(i18n("High Scores..."), Key_H,
this, SLOT(showHighScores()),
actionCollection(), "game_highscores");
KAction *action = KStdAction::print(this, SLOT(print()),
actionCollection(), "game_print");
action->setEnabled(FALSE);
KStdAction::quit(qApp, SLOT(quit()), actionCollection(), "game_quit");
// Multiplayers
(void)new KAction(i18n("Single Human"), 0, inter, SLOT(singleHuman()),
actionCollection(), "mp_single_human");
(void)new KAction(i18n("Human vs Human"), 0, inter, SLOT(humanVsHuman()),
actionCollection(), "mp_human_vs_human");
(void)new KAction(i18n("Human vs &Computer"), 0,
inter, SLOT(humanVsComputer()),
actionCollection(), "mp_human_vs_computer");
(void)new KAction(i18n("More..."), 0, inter, SLOT(dialog()),
actionCollection(), "mp_more");
// Settings
KStdAction::showMenubar(this, SLOT(toggleMenubar()), actionCollection());
KStdAction::preferences(inter, SLOT(preferences()), actionCollection());
KStdAction::keyBindings(inter, SLOT(configureKeys()), actionCollection());
(void)new KAction(i18n("Configure AI..."), 0, inter, SLOT(configureAI()),
actionCollection(), "options_configure_ai");
createGUI();
readSettings();
setView(inter);
updateRects(); // #### should be in KTMainWindow::setView
}
ksirtet'MainWidget::~MainWidget() (./kdegames/ksirtet/main.cpp:63)
MainWidget::~MainWidget()
{
delete pieceInfo;
}
ksirtet'MainWidget::eventFilter() (./kdegames/ksirtet/main.cpp:68)
bool MainWidget::eventFilter(QObject *, QEvent *e)
{
QPopupMenu *popup;
switch (e->type()) {
case QEvent::MouseButtonPress:
if ( ((QMouseEvent *)e)->button()!=RightButton ) return FALSE;
popup = (QPopupMenu*)factory()->container("popup", this);
popup->popup(QCursor::pos());
return TRUE;
default : return FALSE;
}
}
ksirtet'MainWidget::readSettings() (./kdegames/ksirtet/main.cpp:88)
void MainWidget::readSettings()
{
bool visible = OptionDialog::readMenuVisible();
MENUBAR_ACTION->setChecked(visible);
toggleMenubar();
}
ksirtet'MainWidget::toggleMenubar() (./kdegames/ksirtet/main.cpp:95)
void MainWidget::toggleMenubar()
{
bool b = MENUBAR_ACTION->isChecked();
if (b) menuBar()->show();
else {
menuBar()->hide();
// #### sort of hack : because KTMainWindow does not manage correctly
// main widget with a fixed layout
updateRects();
adjustSize();
}
OptionDialog::writeMenuVisible(b);
}
ksirtet'MainWidget::print() (./kdegames/ksirtet/main.cpp:111)
void MainWidget::print()
{
// #### TODO
}
ksirtet'MainWidget::showHighScores() (./kdegames/ksirtet/main.cpp:116)
void MainWidget::showHighScores()
{
HighScores hs(0, this);
hs.exec();
}
//-----------------------------------------------------------------------------