Source Code (Use browser search to find items of interest.)
Class Index
katomic'AtomTopLevel (./kdegames/katomic/toplevel.h:26)
class AtomTopLevel : public KTMainWindow
{
Q_OBJECT
public:
// The constructor method for class KFortune
//
// @see AtomTopLevel
// @param parent Parent widget, used for QWidget
// @param name Name for QWidget
AtomTopLevel ( const char *name=0 );
// The destrucor method for class KFortune
~AtomTopLevel();
protected:
// @see KKeyConfig
void initKeys();
// Creates the menubar and connects the menu-entries to the
// appropriate functions
void createMenu();
// Get the configuration from the config-file.
void initConfig();
// Save the current configuration to the config-file.
void saveConfig();
// called before exiting -> save configuration
virtual bool queryExit();
KConfig *config;
KAccel *accel;
QPopupMenu *file, *options;
GameWidget *main;
public slots:
// Quit the application
void quitapp();
// Shows a window for configuring the keybindings
void configkeys();
// Shows a dialog for options other than keys
void configopts();
};
katomic'AtomTopLevel::createMenu() (./kdegames/katomic/toplevel.cpp:38)
void AtomTopLevel::createMenu()
{
file = new QPopupMenu();
file->insertItem (i18n ("&Highscores"),
main, SLOT (showHighscores ()));
file->insertSeparator(-1);
file->insertItem(i18n("&Quit"), this, SLOT(quitapp()) );
options = new QPopupMenu();
options->insertItem(i18n("&Configure keys"), this,
SLOT(configkeys()) );
options->insertItem(i18n("&Options"), this,
SLOT(configopts()) );
KMenuBar *menu = menuBar();
menu->insertItem(i18n("&File"), file);
menu->insertItem(i18n("&Options"), options);
menu->insertSeparator(-1);
menu->insertItem(i18n("&Help"), helpMenu(
i18n("Atomic 2.0 by Stephan Kulow <coolo@kde.org>\n"
"and Cristian Tibirna <tibirna@kde.org>\n"
"based on Atomic 1.0.67 by Andreas Wüst (AndreasWuest@gmx.de)\n")));
}
katomic'AtomTopLevel::configkeys() (./kdegames/katomic/toplevel.cpp:64)
void AtomTopLevel::configkeys()
{
KKeyDialog::configureKeys(accel);
}
katomic'AtomTopLevel::configopts() (./kdegames/katomic/toplevel.cpp:69)
void AtomTopLevel::configopts()
{
(new ConfigBox(this, "Options"))->show();
}
katomic'AtomTopLevel::initKeys() (./kdegames/katomic/toplevel.cpp:74)
void AtomTopLevel::initKeys()
{
// here we create to shortcuts according to
// the standard Kde keybinding
accel = new KAccel(this);
accel->insertStdItem(KStdAccel::Quit);
accel->connectItem(KStdAccel::Quit, this, SLOT(quitapp()) );
accel->insertItem(i18n("Highscores"), "highscore", "CTRL+H");
accel->connectItem ("highscore", main,
SLOT (showHighscores ()));
// moving keys
accel->insertItem(i18n("Atom Up"), "up", "J");
accel->insertItem(i18n("Atom Down"), "down", "N");
accel->insertItem(i18n("Atom Left"), "left", "S");
accel->insertItem(i18n("Atom Right"), "right", "D");
accel->insertItem(i18n("Next Atom"), "next", "Space");
}
katomic'AtomTopLevel::initConfig() (./kdegames/katomic/toplevel.cpp:94)
void AtomTopLevel::initConfig()
{
config = KGlobal::config();
accel->readSettings(config);
}
katomic'AtomTopLevel::saveConfig() (./kdegames/katomic/toplevel.cpp:101)
void AtomTopLevel::saveConfig()
{
config = KGlobal::config();
accel->writeSettings(config);
if (settings.changed) {
config->setGroup("Options");
config->writeEntry("Animation Speed", settings.anim_speed);
config->setGroup("Colors");
}
config->sync();
}
katomic'AtomTopLevel::AtomTopLevel() (./kdegames/katomic/toplevel.cpp:115)
AtomTopLevel::AtomTopLevel ( const char* name )
: KTMainWindow ( name )
{
main = new GameWidget(this, "gamewidget");
createMenu();
initKeys();
initConfig();
setView(main);
}
katomic'AtomTopLevel::~AtomTopLevel() (./kdegames/katomic/toplevel.cpp:126)
AtomTopLevel::~AtomTopLevel()
{
delete file;
delete options;
delete main;
}
katomic'AtomTopLevel::quitapp() (./kdegames/katomic/toplevel.cpp:133)
void AtomTopLevel::quitapp()
{
saveConfig();
kapp->quit();
}
katomic'AtomTopLevel::queryExit() (./kdegames/katomic/toplevel.cpp:139)
bool AtomTopLevel::queryExit()
{
saveConfig();
return true;
}