void Game::menu() { game = new QPopupMenu(); CHECK_PTR( game ); game->insertItem( klocale->translate("New"), this, SLOT(newGame()),Key_F2); pauseID = game->insertItem( klocale->translate("Pause"), this , SLOT(pauseGame()), Key_F3); game->insertItem( klocale->translate("High Scores..."), this, SLOT(showHighScores())); game->insertSeparator(); game->insertItem( klocale->translate("&Quit"), this, SLOT(quitGame()), CTRL+Key_Q ); game->setCheckable( TRUE ); balls = new QPopupMenu; CHECK_PTR( balls ); ballsID[0] = balls->insertItem( klocale->translate("0")); ballsID[1] = balls->insertItem( klocale->translate("1")); ballsID[2] = balls->insertItem( klocale->translate("2")); ballsID[3] = balls->insertItem( klocale->translate("3")); balls->setCheckable( TRUE ); connect(balls, SIGNAL(activated(int)), this, SLOT ( ballsChecked(int) )); snakes = new QPopupMenu; CHECK_PTR( snakes ); snakesID[0] = snakes->insertItem( klocale->translate("0")); snakesID[1] = snakes->insertItem( klocale->translate("1")); snakesID[2] = snakes->insertItem( klocale->translate("2")); snakesID[3] = snakes->insertItem( klocale->translate("3")); snakes->setCheckable( TRUE ); connect(snakes, SIGNAL(activated(int)), this, SLOT ( snakesChecked(int) )); pix = new QPopupMenu; lookupBackgroundPixmaps(); pixID.resize(backgroundPixmaps.count()); if(backgroundPixmaps.count() == 0) pix->insertItem(klocale->translate("none")); else for(unsigned i = 0; i < backgroundPixmaps.count(); i++) { // since the filename may contain underscore, they // are replaced with spaces in the menu entry QString s(backgroundPixmaps.at(i)->baseName()); s = s.replace(QRegExp("_"), " "); pixID[i] = pix->insertItem((const char *)s); } pix->setCheckable( TRUE ); connect(pix, SIGNAL(activated(int)), this, SLOT ( pixChecked(int) )); options = new QPopupMenu(); CHECK_PTR( options ); skillID[0] = options->insertItem( klocale->translate("Beginner")); skillID[1] = options->insertItem( klocale->translate("Intermediate")); skillID[2] = options->insertItem( klocale->translate("Advanced")); skillID[3] = options->insertItem( klocale->translate("Expert")); options->insertSeparator(); options->insertItem(klocale->translate("Balls"), balls); options->insertItem(klocale->translate("Computer Snakes"), snakes); options->insertSeparator(); options->insertItem(klocale->translate("Select background color..."), this, SLOT(backgroundColor())); options->insertItem(klocale->translate("Select background pixmap"), pix); options->insertSeparator(); options->insertItem(klocale->translate("Change keys..."),this, SLOT(confKeys())); options->insertSeparator(); options->insertItem(klocale->translate("Starting Room..."), this, SLOT(startingRoom())); options->setCheckable( TRUE ); connect(options, SIGNAL(activated(int)), this, SLOT ( skillChecked(int) )); QPopupMenu *help = kapp->getHelpMenu(true, QString(klocale->translate("Snake Race")) + " " + KSNAKE_VERSION + klocale->translate("\n\nby Michel Filippi" " ([email protected])")); menubar = new KMenuBar( this ); CHECK_PTR( menubar ); menubar->insertItem( klocale->translate("&Game"), game ); menubar->insertItem( klocale->translate("&Options"), options ); menubar->insertSeparator(); menubar->insertItem( klocale->translate("&Help"), help); }
void Kpacman::menu() { gamePopup = new QPopupMenu(); CHECK_PTR( gamePopup ); newID = gamePopup->insertItem(tr("&New"), this, SLOT(newKpacman()),Key_F2); pauseID = gamePopup->insertItem(tr("&Pause"), this, SLOT(pauseKpacman()), Key_F3); hofID = gamePopup->insertItem(tr("&Hall of fame"), this, SLOT(toggleHallOfFame()), Key_F4); gamePopup->insertSeparator(); gamePopup->insertItem(tr("&Quit"), this, SLOT(quitKpacman()), CTRL+Key_Q); gamePopup->setCheckable(TRUE); optionsPopup = new QPopupMenu(); CHECK_PTR(optionsPopup); modesPopup = new QPopupMenu(); CHECK_PTR(modesPopup); hideMouseCursorID = optionsPopup->insertItem(tr("&Hide Mousecursor"), this, SLOT(toggleHideMouseCursor()), CTRL+Key_H); optionsPopup->insertSeparator(); if (lookupSchemes() > 0) { optionsPopup->insertItem(tr("&Select graphic scheme"), modesPopup); optionsPopup->insertSeparator(); } focusOutPauseID = optionsPopup->insertItem(tr("&Pause in Background"), this, SLOT(toggleFocusOutPause())); focusInContinueID = optionsPopup->insertItem(tr("&Continue in Foreground"), this, SLOT(toggleFocusInContinue())); optionsPopup->insertSeparator(); optionsPopup->insertItem(tr("Change &keys..."), this, SLOT(confKeys())); #ifndef QPE_PORT QString aboutText = tr("@PACKAGE@ - @VERSION@\n\n" "Joerg Thoennissen ([email protected])\n\n" "A pacman game for the KDE Desktop\n\n" "The program based on the source of ksnake\n" "by Michel Filippi ([email protected]).\n" "The design was strongly influenced by the pacman\n" "(c) 1980 MIDWAY MFG.CO.\n\n" "I like to thank my girlfriend Elke Krueers for\n" "the last 10 years of her friendship.\n"); aboutText.replace(QRegExp("@PACKAGE@"), PACKAGE); aboutText.replace(QRegExp("@VERSION@"), VERSION); QPopupMenu *helpPopup = helpMenu(aboutText, FALSE); #endif //_menuBar = new KMenuBar(this); //CHECK_PTR( _menuBar ); //_menuBar->insertItem(tr("&Game"), gamePopup); //_menuBar->insertItem(tr("&Options"), optionsPopup); //_menuBar->insertSeparator(); #ifndef QPE_PORT _menuBar->insertItem(tr("&Help"), helpPopup); #endif }