summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/kbill/UI.cpp6
-rw-r--r--noncore/games/kbill/kbill.cpp30
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 @@
1/*************************************************************************** 1/***************************************************************************
2 UI.cc - description 2 UI.cc - description
3 ------------------- 3 -------------------
4 begin : Thu Dec 30 1999 4 begin : Thu Dec 30 1999
5 copyright : (C) 1999 by Jurrien Loonstra 5 copyright : (C) 1999 by Jurrien Loonstra
6 email : j.h.loonstra@st.hanze.nl 6 email : j.h.loonstra@st.hanze.nl
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17#include "kbill.h" 17#include "kbill.h"
18#include "objects.h" 18#include "objects.h"
19#include "Strings.h" 19#include "Strings.h"
20#ifdef KDEVER 20#ifdef KDEVER
21#include <kapplication.h> 21#include <kapplication.h>
22#endif 22#endif
23#include <qpixmap.h> 23#include <qpixmap.h>
24#include <qmessagebox.h> 24#include <qmessagebox.h>
25#include <qnamespace.h> 25#include <qnamespace.h>
26 26
27#include "inputbox.h" 27#include "inputbox.h"
28 28
29/**************************/ 29/**************************/
30/* Timer control routines */ 30/* Timer control routines */
31/**************************/ 31/**************************/
32 32
33UI::~UI() { 33UI::~UI() {
34 paint.end(); 34 paint.end();
35 delete pix; 35 delete pix;
36} 36}
37 37
38void UI::restart_timer() { 38void UI::restart_timer() {
39 field->startTimer(); 39 field->startTimer();
40} 40}
41 41
42void UI::kill_timer() { 42void UI::kill_timer() {
43 field->stopTimer(); 43 field->stopTimer();
44} 44}
45 45
46/*******************/ 46/*******************/
47/* Window routines */ 47/* Window routines */
48/*******************/ 48/*******************/
49 49
50void UI::initialize(int *argc, char **argv) { 50void UI::initialize(int *argc, char **argv) {
51 #ifdef KDEVER 51 #ifdef KDEVER
52 app = new KApplication(*argc, argv, "kbill"); 52 app = new KApplication(*argc, argv, "kbill");
53 #endif 53 #endif
54 app = new QPEApplication(*argc, argv); 54 app = new QPEApplication(*argc, argv);
55} 55}
56 56
57void UI::graph_init() { 57void UI::graph_init() {
58 pix = new QPixmap(Game::scrwidth, Game::scrheight); 58 pix = new QPixmap(Game::scrwidth, Game::scrheight);
59 paint.begin(pix, field); 59 paint.begin(pix, field);
60 paint.setPen(QPen(Qt::black, 3)); 60 paint.setPen(QPen(Qt::black, 3));
61} 61}
62 62
63void UI::make_mainwin() { 63void UI::make_mainwin() {
64 main = new KBill(); 64 main = new KBill();
65 app->showMainWidget(main,true); 65 app->showMainWidget(main,true);
66 main->showMaximized(); 66 main->showMaximized();
67 field = main->getField(); 67 field = main->getField();
68} 68}
69 69
70void UI::popup_dialog (int dialog) { 70void UI::popup_dialog (int dialog) {
71 kill_timer(); 71 kill_timer();
72 switch (dialog) { 72 switch (dialog) {
73 case Game::ENDGAME: 73 case Game::ENDGAME:
74 QMessageBox::message(("Endgame"), (endgamestr)); 74 QMessageBox::message(("Endgame"), QT_TR_NOOP(endgamestr));
75 break; 75 break;
76 case Game::HIGHSCORE: 76 case Game::HIGHSCORE:
77 //QMessageBox::message(("HighScore"), highscorestr); 77 //QMessageBox::message(("HighScore"), highscorestr);
78 break; 78 break;
79 case Game::ENTERNAME: { 79 case Game::ENTERNAME: {
80 InputBox b(main, 0, ("Enter Name"), (enternamestr)); 80 InputBox b(main, 0, ("Enter Name"), QT_TR_NOOP(enternamestr));
81 bool state = b.exec() == 2; 81 bool state = b.exec() == 2;
82 char str[20], *nl; 82 char str[20], *nl;
83 strcpy(str, b.getText()); 83 strcpy(str, b.getText());
84 if (!str[0] || state) 84 if (!str[0] || state)
85 strcpy(str, "Anonymous"); 85 strcpy(str, "Anonymous");
86 else if ((nl = strchr(str, '\n'))) 86 else if ((nl = strchr(str, '\n')))
87 *nl = '\0'; 87 *nl = '\0';
88 if (strlen(str) > 20) 88 if (strlen(str) > 20)
89 str[20] = 0; /* truncate string if too long */ 89 str[20] = 0; /* truncate string if too long */
90 // scores.recalc(str); 90 // scores.recalc(str);
91 } 91 }
92 break; 92 break;
93 case Game::SCORE: 93 case Game::SCORE:
94 QMessageBox::message(("Score"), scorestr); 94 QMessageBox::message(("Score"), scorestr);
95 break; 95 break;
96 } 96 }
97 restart_timer(); 97 restart_timer();
98} 98}
99 99
100/*********************/ 100/*********************/
101/* Graphics routines */ 101/* Graphics routines */
102/*********************/ 102/*********************/
103 103
104void UI::set_cursor(int cursor) { 104void UI::set_cursor(int cursor) {
105 QCursor *cur; 105 QCursor *cur;
106 switch (cursor) { 106 switch (cursor) {
107 case Game::BUCKETC: 107 case Game::BUCKETC:
108 cur = bucket.cursor.cursor; 108 cur = bucket.cursor.cursor;
109 break; 109 break;
110 case Game::DOWNC: 110 case Game::DOWNC:
111 cur = downcursor.cursor; 111 cur = downcursor.cursor;
112 break; 112 break;
113 case Game::DEFAULTC: 113 case Game::DEFAULTC:
114 cur = defaultcursor.cursor; 114 cur = defaultcursor.cursor;
115 break; 115 break;
116 default: 116 default:
117 cur = OS.cursor[cursor].cursor; 117 cur = OS.cursor[cursor].cursor;
118 } 118 }
119 field->setCursor(*cur); 119 field->setCursor(*cur);
120} 120}
121 121
122void UI::load_cursors() { 122void UI::load_cursors() {
123 defaultcursor.load("hand_up", MCursor::SEP_MASK); 123 defaultcursor.load("hand_up", MCursor::SEP_MASK);
124 field->setCursor(*defaultcursor.cursor); 124 field->setCursor(*defaultcursor.cursor);
125 downcursor.load("hand_down", MCursor::SEP_MASK); 125 downcursor.load("hand_down", MCursor::SEP_MASK);
126} 126}
127 127
128void UI::clear() { 128void UI::clear() {
129 paint.eraseRect(0, 0, field->width(), field->height()); 129 paint.eraseRect(0, 0, field->width(), field->height());
130} 130}
131 131
132void UI::refresh() { 132void UI::refresh() {
133 paint.flush(); 133 paint.flush();
134 field->setPixmap(pix); 134 field->setPixmap(pix);
135 field->repaint(FALSE); 135 field->repaint(FALSE);
136} 136}
137 137
138void UI::draw (Picture pict, int x, int y) { 138void UI::draw (Picture pict, int x, int y) {
139 paint.drawPixmap(x, y, *pict.pix); 139 paint.drawPixmap(x, y, *pict.pix);
140} 140}
141 141
142void UI::draw_centered (Picture pict) { 142void UI::draw_centered (Picture pict) {
143 draw(pict, (field->width() - pict.width) / 2, (field->height() - pict.height) / 2); 143 draw(pict, (field->width() - pict.width) / 2, (field->height() - pict.height) / 2);
144} 144}
145 145
146void UI::draw_line(int x1, int y1, int x2, int y2) { 146void UI::draw_line(int x1, int y1, int x2, int y2) {
147 paint.drawLine(x1, y1, x2, y2); 147 paint.drawLine(x1, y1, x2, y2);
148 148
149} 149}
150 150
151void UI::draw_str(char *str, int x, int y) { 151void UI::draw_str(char *str, int x, int y) {
152 paint.drawText(x, y, str); 152 paint.drawText(x, y, str);
153} 153}
154 154
155 155
156/******************/ 156/******************/
157/* Other routines */ 157/* Other routines */
158/******************/ 158/******************/
159 159
160void UI::set_pausebutton (int action) { 160void UI::set_pausebutton (int action) {
161 main->file->setItemEnabled(main->pauseid, action); 161 main->file->setItemEnabled(main->pauseid, action);
162} 162}
163 163
164 164
165int UI::MainLoop() { 165int UI::MainLoop() {
166 return app->exec(); 166 return app->exec();
167} 167}
168 168
169void UI::update_hsbox(char *str) { 169void UI::update_hsbox(char *str) {
170 highscorestr = str; 170 highscorestr = str;
171} 171}
172 172
173void UI::update_scorebox(int level, int score) { 173void UI::update_scorebox(int level, int score) {
174 scorestr.sprintf ("%s %d:\n%s: %d", ("After Level"), level, ("Your score"), score); 174 scorestr.sprintf ("%s %d:\n%s: %d", QT_TR_NOOP("After Level"), level, QT_TR_NOOP("Your score"), score);
175} 175}
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 @@
1/*************************************************************************** 1/***************************************************************************
2 kbill.cpp - description 2 kbill.cpp - description
3 ------------------- 3 -------------------
4 begin : Thu Dec 30 16:55:55 CET 1999 4 begin : Thu Dec 30 16:55:55 CET 1999
5 copyright : (C) 1999 by Jurrien Loonstra 5 copyright : (C) 1999 by Jurrien Loonstra
6 email : j.h.loonstra@st.hanze.nl 6 email : j.h.loonstra@st.hanze.nl
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include <qmessagebox.h> 18#include <qmessagebox.h>
19#include <qmultilinedit.h> 19#include <qmultilinedit.h>
20#include <qmenubar.h> 20#include <qmenubar.h>
21#include <qtextbrowser.h> 21#include <qtextbrowser.h>
22#include <qfont.h> 22#include <qfont.h>
23#include <qwidget.h> 23#include <qwidget.h>
24#include "kbill.h" 24#include "kbill.h"
25#include "inputbox.h" 25#include "inputbox.h"
26#include "helpdialog.h" 26#include "helpdialog.h"
27#include "objects.h" 27#include "objects.h"
28#include "Strings.h" 28#include "Strings.h"
29 29
30KBill::KBill() : QMainWindow() { 30KBill::KBill() : QMainWindow() {
31 setCaption("kBill"); 31 setCaption(tr("kBill"));
32 file = new QPopupMenu(); 32 file = new QPopupMenu();
33 file->insertItem(("New game"), this, SLOT(NewGame())); 33 file->insertItem(tr("New game"), this, SLOT(NewGame()));
34 pauseid = file->insertItem(("Pause game"), this, SLOT(Pause())); 34 pauseid = file->insertItem(tr("Pause game"), this, SLOT(Pause()));
35 //these are dissabled until I fix them 35 //these are dissabled until I fix them
36 //file->insertItem(("Warp to level..."), this, SLOT(WarpTo())); 36 //file->insertItem(tr("Warp to level..."), this, SLOT(WarpTo()));
37 //file->insertItem(("View high scores"), this, SLOT(ViewHighScores())); 37 //file->insertItem(tr("View high scores"), this, SLOT(ViewHighScores()));
38 38
39 39
40 help = new QPopupMenu(); 40 help = new QPopupMenu();
41 help->insertItem(("Story of kBill"), this, SLOT(Story())); 41 help->insertItem(tr("Story of kBill"), this, SLOT(Story()));
42 help->insertItem(("Rules"), this, SLOT(Rules())); 42 help->insertItem(tr("Rules"), this, SLOT(Rules()));
43 43
44 44
45 menu = new QMenuBar(this); 45 menu = new QMenuBar(this);
46 menu->insertItem(("&File"), file); 46 menu->insertItem(tr("&File"), file);
47 menu->insertSeparator(); 47 menu->insertSeparator();
48 menu->insertItem(("&Help"), help); 48 menu->insertItem(tr("&Help"), help);
49 49
50 field = new Field(this); 50 field = new Field(this);
51 //setView(field); 51 //setView(field);
52 //setMainWidget(field); 52 //setMainWidget(field);
53 //setMenu(menu); 53 //setMenu(menu);
54} 54}
55 55
56KBill::~KBill() { 56KBill::~KBill() {
57} 57}
58 58
59Field* KBill::getField() { 59Field* KBill::getField() {
60 return field; 60 return field;
61} 61}
62 62
63// ----------------------------------------------------------------------- 63// -----------------------------------------------------------------------
64 64
65void KBill::Quit() { 65void KBill::Quit() {
66 field->stopTimer(); 66 field->stopTimer();
67 qApp->quit(); 67 qApp->quit();
68 68
69} 69}
70 70
71void KBill::About(){ 71void KBill::About(){
72 // field->stopTimer(); 72 // field->stopTimer();
73 // AboutBox about(this); 73 // AboutBox about(this);
74 // about.exec(); 74 // about.exec();
75 // field->startTimer(); 75 // field->startTimer();
76} 76}
77 77
78void KBill::NewGame() { 78void KBill::NewGame() {
79 field->stopTimer(); 79 field->stopTimer();
80 // if (KMsgBox::yesNo(this, i18n("New Game"), i18n(newgamestr), KMsgBox::QUESTION) == 1) 80 // if (KMsgBox::yesNo(this, i18n("New Game"), i18n(newgamestr), KMsgBox::QUESTION) == 1)
81 game.start(1); 81 game.start(1);
82 // else 82 // else
83 field->startTimer(); 83 field->startTimer();
84} 84}
85 85
86void KBill::Pause() { 86void KBill::Pause() {
87 field->stopTimer(); 87 field->stopTimer();
88 QMessageBox::message(("Pause Game"), (pausestr), 0); 88 QMessageBox::message(tr("Pause Game"), tr(pausestr), 0);
89 field->startTimer(); 89 field->startTimer();
90} 90}
91 91
92void KBill::WarpTo() { 92void KBill::WarpTo() {
93 /* field->stopTimer(); 93 /* field->stopTimer();
94 InputBox b(this, 0, "Warp To Level", warpstr); 94 InputBox b(this, 0, "Warp To Level", tr(warpstr));
95 bool status = b.exec() == 1; 95 bool status = b.exec() == 1;
96 field->startTimer(); 96 field->startTimer();
97 if (status) { 97 if (status) {
98 bool ok; 98 bool ok;
99 int level = b.getText().toUInt(&ok); 99 int level = b.getText().toUInt(&ok);
100 if (ok) { 100 if (ok) {
101 field->startTimer(); 101 field->startTimer();
102 game.warp_to_level(level); 102 game.warp_to_level(level);
103 return; 103 return;
104 } 104 }
105 }*/ 105 }*/
106} 106}
107 107
108void KBill::ViewHighScores() { 108void KBill::ViewHighScores() {
109 //ui.popup_dialog(Game::HIGHSCORE); 109 //ui.popup_dialog(Game::HIGHSCORE);
110} 110}
111 111
112void KBill::Story() { 112void KBill::Story() {
113 field->stopTimer(); 113 field->stopTimer();
114 HelpDialog *stryDialog = new HelpDialog(this,"helpdialog",1); 114 HelpDialog *stryDialog = new HelpDialog(this,"helpdialog",1);
115 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."; 115 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.");
116 stryDialog->setCaption("The story of KBill"); 116 stryDialog->setCaption(tr("The story of KBill"));
117 stryDialog->TextBrowser1->setText(stryString); 117 stryDialog->TextBrowser1->setText(stryString);
118 stryDialog->resize(200,200); 118 stryDialog->resize(200,200);
119 stryDialog->show(); 119 stryDialog->show();
120 field->startTimer(); 120 field->startTimer();
121} 121}
122 122
123void KBill::Rules() { 123void KBill::Rules() {
124 field->stopTimer(); 124 field->stopTimer();
125 HelpDialog *rulesDialog = new HelpDialog(this,"helpdialog",1); 125 HelpDialog *rulesDialog = new HelpDialog(this,"helpdialog",1);
126 rulesDialog->setCaption("The rules of KBill"); 126 rulesDialog->setCaption(tr("The rules of KBill"));
127 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"; 127 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");
128 rulesDialog->TextBrowser1->setText(rulesStr); 128 rulesDialog->TextBrowser1->setText(rulesStr);
129 rulesDialog->resize(200,200); 129 rulesDialog->resize(200,200);
130 rulesDialog->show(); 130 rulesDialog->show();
131 field->startTimer(); 131 field->startTimer();
132} 132}