-rw-r--r-- | noncore/games/kbill/UI.cpp | 6 | ||||
-rw-r--r-- | noncore/games/kbill/kbill.cpp | 30 |
2 files changed, 18 insertions, 18 deletions
diff --git a/noncore/games/kbill/UI.cpp b/noncore/games/kbill/UI.cpp index fac731a..2afaf9b 100644 --- a/noncore/games/kbill/UI.cpp +++ b/noncore/games/kbill/UI.cpp @@ -1,175 +1,175 @@ /*************************************************************************** UI.cc - description ------------------- begin : Thu Dec 30 1999 copyright : (C) 1999 by Jurrien Loonstra email : j.h.loonstra@st.hanze.nl ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "kbill.h" #include "objects.h" #include "Strings.h" #ifdef KDEVER #include <kapplication.h> #endif #include <qpixmap.h> #include <qmessagebox.h> #include <qnamespace.h> #include "inputbox.h" /**************************/ /* Timer control routines */ /**************************/ UI::~UI() { paint.end(); delete pix; } void UI::restart_timer() { field->startTimer(); } void UI::kill_timer() { field->stopTimer(); } /*******************/ /* Window routines */ /*******************/ void UI::initialize(int *argc, char **argv) { #ifdef KDEVER app = new KApplication(*argc, argv, "kbill"); #endif app = new QPEApplication(*argc, argv); } void UI::graph_init() { pix = new QPixmap(Game::scrwidth, Game::scrheight); paint.begin(pix, field); paint.setPen(QPen(Qt::black, 3)); } void UI::make_mainwin() { main = new KBill(); app->showMainWidget(main,true); main->showMaximized(); field = main->getField(); } void UI::popup_dialog (int dialog) { kill_timer(); switch (dialog) { case Game::ENDGAME: - QMessageBox::message(("Endgame"), (endgamestr)); + QMessageBox::message(("Endgame"), QT_TR_NOOP(endgamestr)); break; case Game::HIGHSCORE: // QMessageBox::message(("HighScore"), highscorestr); break; case Game::ENTERNAME: { - InputBox b(main, 0, ("Enter Name"), (enternamestr)); + InputBox b(main, 0, ("Enter Name"), QT_TR_NOOP(enternamestr)); bool state = b.exec() == 2; char str[20], *nl; strcpy(str, b.getText()); if (!str[0] || state) strcpy(str, "Anonymous"); else if ((nl = strchr(str, '\n'))) *nl = '\0'; if (strlen(str) > 20) str[20] = 0; /* truncate string if too long */ // scores.recalc(str); } break; case Game::SCORE: QMessageBox::message(("Score"), scorestr); break; } restart_timer(); } /*********************/ /* Graphics routines */ /*********************/ void UI::set_cursor(int cursor) { QCursor *cur; switch (cursor) { case Game::BUCKETC: cur = bucket.cursor.cursor; break; case Game::DOWNC: cur = downcursor.cursor; break; case Game::DEFAULTC: cur = defaultcursor.cursor; break; default: cur = OS.cursor[cursor].cursor; } field->setCursor(*cur); } void UI::load_cursors() { defaultcursor.load("hand_up", MCursor::SEP_MASK); field->setCursor(*defaultcursor.cursor); downcursor.load("hand_down", MCursor::SEP_MASK); } void UI::clear() { paint.eraseRect(0, 0, field->width(), field->height()); } void UI::refresh() { paint.flush(); field->setPixmap(pix); field->repaint(FALSE); } void UI::draw (Picture pict, int x, int y) { paint.drawPixmap(x, y, *pict.pix); } void UI::draw_centered (Picture pict) { draw(pict, (field->width() - pict.width) / 2, (field->height() - pict.height) / 2); } void UI::draw_line(int x1, int y1, int x2, int y2) { paint.drawLine(x1, y1, x2, y2); } void UI::draw_str(char *str, int x, int y) { paint.drawText(x, y, str); } /******************/ /* Other routines */ /******************/ void UI::set_pausebutton (int action) { main->file->setItemEnabled(main->pauseid, action); } int UI::MainLoop() { return app->exec(); } void UI::update_hsbox(char *str) { highscorestr = str; } void UI::update_scorebox(int level, int score) { - scorestr.sprintf ("%s %d:\n%s: %d", ("After Level"), level, ("Your score"), score); + scorestr.sprintf ("%s %d:\n%s: %d", QT_TR_NOOP("After Level"), level, QT_TR_NOOP("Your score"), score); } diff --git a/noncore/games/kbill/kbill.cpp b/noncore/games/kbill/kbill.cpp index 9fcfd5d..afeaeb5 100644 --- a/noncore/games/kbill/kbill.cpp +++ b/noncore/games/kbill/kbill.cpp @@ -1,132 +1,132 @@ /*************************************************************************** kbill.cpp - description ------------------- begin : Thu Dec 30 16:55:55 CET 1999 copyright : (C) 1999 by Jurrien Loonstra email : j.h.loonstra@st.hanze.nl ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include <qmessagebox.h> #include <qmultilinedit.h> #include <qmenubar.h> #include <qtextbrowser.h> #include <qfont.h> #include <qwidget.h> #include "kbill.h" #include "inputbox.h" #include "helpdialog.h" #include "objects.h" #include "Strings.h" KBill::KBill() : QMainWindow() { - setCaption("kBill"); + setCaption(tr("kBill")); file = new QPopupMenu(); - file->insertItem(("New game"), this, SLOT(NewGame())); - pauseid = file->insertItem(("Pause game"), this, SLOT(Pause())); + file->insertItem(tr("New game"), this, SLOT(NewGame())); + pauseid = file->insertItem(tr("Pause game"), this, SLOT(Pause())); //these are dissabled until I fix them - //file->insertItem(("Warp to level..."), this, SLOT(WarpTo())); - //file->insertItem(("View high scores"), this, SLOT(ViewHighScores())); + //file->insertItem(tr("Warp to level..."), this, SLOT(WarpTo())); + //file->insertItem(tr("View high scores"), this, SLOT(ViewHighScores())); help = new QPopupMenu(); - help->insertItem(("Story of kBill"), this, SLOT(Story())); - help->insertItem(("Rules"), this, SLOT(Rules())); + help->insertItem(tr("Story of kBill"), this, SLOT(Story())); + help->insertItem(tr("Rules"), this, SLOT(Rules())); menu = new QMenuBar(this); - menu->insertItem(("&File"), file); + menu->insertItem(tr("&File"), file); menu->insertSeparator(); - menu->insertItem(("&Help"), help); + menu->insertItem(tr("&Help"), help); field = new Field(this); //setView(field); //setMainWidget(field); //setMenu(menu); } KBill::~KBill() { } Field* KBill::getField() { return field; } // ----------------------------------------------------------------------- void KBill::Quit() { field->stopTimer(); qApp->quit(); } void KBill::About(){ // field->stopTimer(); // AboutBox about(this); // about.exec(); // field->startTimer(); } void KBill::NewGame() { field->stopTimer(); // if (KMsgBox::yesNo(this, i18n("New Game"), i18n(newgamestr), KMsgBox::QUESTION) == 1) game.start(1); // else field->startTimer(); } void KBill::Pause() { field->stopTimer(); - QMessageBox::message(("Pause Game"), (pausestr), 0); + QMessageBox::message(tr("Pause Game"), tr(pausestr), 0); field->startTimer(); } void KBill::WarpTo() { /* field->stopTimer(); - InputBox b(this, 0, "Warp To Level", warpstr); + InputBox b(this, 0, "Warp To Level", tr(warpstr)); bool status = b.exec() == 1; field->startTimer(); if (status) { bool ok; int level = b.getText().toUInt(&ok); if (ok) { field->startTimer(); game.warp_to_level(level); return; } }*/ } void KBill::ViewHighScores() { //ui.popup_dialog(Game::HIGHSCORE); } void KBill::Story() { field->stopTimer(); HelpDialog *stryDialog = new HelpDialog(this,"helpdialog",1); - QString stryString = "<b>The Story</b><p>Yet again, the fate of the world rests in your hands! An evil computer hacker, known only by his handle 'Bill', has created the ultimate computer virus. A virus so powerful that it has the power to transmute an ordinary computer into a toaster oven. (oooh!) 'Bill' has cloned himself into a billion-jillion micro-Bills. Their sole purpose is to deliver the nefarious virus, which has been cleverly diguised as a popular operating system. As System Administrator and Exterminator, your job is to keep Bill from succeeding at his task."; - stryDialog->setCaption("The story of KBill"); + QString stryString = tr("<b>The Story</b><p>Yet again, the fate of the world rests in your hands! An evil computer hacker, known only by his handle 'Bill', has created the ultimate computer virus. A virus so powerful that it has the power to transmute an ordinary computer into a toaster oven. (oooh!) 'Bill' has cloned himself into a billion-jillion micro-Bills. Their sole purpose is to deliver the nefarious virus, which has been cleverly diguised as a popular operating system. As System Administrator and Exterminator, your job is to keep Bill from succeeding at his task."); + stryDialog->setCaption(tr("The story of KBill")); stryDialog->TextBrowser1->setText(stryString); stryDialog->resize(200,200); stryDialog->show(); field->startTimer(); } void KBill::Rules() { field->stopTimer(); HelpDialog *rulesDialog = new HelpDialog(this,"helpdialog",1); - rulesDialog->setCaption("The rules of KBill"); - QString rulesStr = "<b>The Rules</b><p>kBill has been painstakingly designed and researched in order to make it as easy to use for the whole family as it is for little Sally. Years - nay - days of beta testing and consulting with the cheapest of human interface designers have resulted in a game that is easy to use, yet nothing at all like a Macintosh.<p><UL><LI>Whack the Bills (click)</LI><LI>Restart the computer (click)</LI><LI>Pick up stolen OSes & return (drag) them to their respective computers</LI><LI>Drag the bucket to extinguish sparks</LI><LI>Scoring is based on total uptime, with bonuses for killing Bills.</LI></UL><P>As for the rest, you can probably work it out for yourself. We did, so it can't be too hard"; + rulesDialog->setCaption(tr("The rules of KBill")); + QString rulesStr = tr("<b>The Rules</b><p>kBill has been painstakingly designed and researched in order to make it as easy to use for the whole family as it is for little Sally. Years - nay - days of beta testing and consulting with the cheapest of human interface designers have resulted in a game that is easy to use, yet nothing at all like a Macintosh.<p><UL><LI>Whack the Bills (click)</LI><LI>Restart the computer (click)</LI><LI>Pick up stolen OSes & return (drag) them to their respective computers</LI><LI>Drag the bucket to extinguish sparks</LI><LI>Scoring is based on total uptime, with bonuses for killing Bills.</LI></UL><P>As for the rest, you can probably work it out for yourself. We did, so it can't be too hard"); rulesDialog->TextBrowser1->setText(rulesStr); rulesDialog->resize(200,200); rulesDialog->show(); field->startTimer(); } |