Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

kbill.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           kbill.cpp  -  description
00003                              -------------------
00004     begin                : Thu Dec 30 16:55:55 CET 1999
00005     copyright            : (C) 1999 by Jurrien Loonstra
00006     email                : j.h.loonstra@st.hanze.nl
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include <qmessagebox.h>
00019 #include <qmenubar.h>
00020 #include <qtextbrowser.h>
00021 #include "kbill.h"
00022 #include "helpdialog.h"
00023 #include "objects.h"
00024 #include "Strings.h"
00025 
00026 KBill::KBill() : QMainWindow() {
00027         setCaption(tr("kBill"));
00028         file = new QPopupMenu();
00029         file->insertItem(tr("New game"), this, SLOT(NewGame()));
00030         pauseid = file->insertItem(tr("Pause game"), this, SLOT(Pause()));
00031         //these are dissabled until I fix them
00032         //file->insertItem(tr("Warp to level..."), this, SLOT(WarpTo()));
00033         //file->insertItem(tr("View high scores"), this, SLOT(ViewHighScores()));
00034         
00035 
00036         help = new QPopupMenu();
00037         help->insertItem(tr("Story of kBill"), this, SLOT(Story()));
00038         help->insertItem(tr("Rules"), this, SLOT(Rules()));
00039 
00040 
00041         menu = new QMenuBar(this);
00042         menu->insertItem(tr("&File"), file);
00043         menu->insertSeparator();
00044         menu->insertItem(tr("&Help"), help);
00045 
00046         field = new Field(this);
00047         //setView(field);
00048         //setMainWidget(field);
00049         //setMenu(menu);
00050 }
00051 
00052 KBill::~KBill() {
00053 }
00054 
00055 Field* KBill::getField() {
00056         return field;
00057 }
00058 
00059 // -----------------------------------------------------------------------
00060 
00061 void KBill::Quit() {
00062         field->stopTimer();
00063         qApp->quit();
00064 
00065 }
00066 
00067 void KBill::About(){
00068 //      field->stopTimer();
00069 //      AboutBox about(this);
00070 //      about.exec();
00071 //      field->startTimer();
00072 }
00073 
00074 void KBill::NewGame() {
00075         field->stopTimer();
00076 //      if (KMsgBox::yesNo(this, i18n("New Game"), i18n(newgamestr), KMsgBox::QUESTION) == 1)
00077                 game.start(1);
00078 //      else
00079                 field->startTimer();
00080 }
00081 
00082 void KBill::Pause() {
00083         field->stopTimer();
00084         QMessageBox::message(tr("Pause Game"), tr(pausestr), 0);
00085         field->startTimer();
00086 }
00087 
00088 void KBill::WarpTo() {
00089 /*      field->stopTimer();
00090         InputBox b(this, 0, "Warp To Level", tr(warpstr));
00091         bool status  = b.exec() == 1;
00092         field->startTimer();
00093         if (status) {
00094                 bool ok;
00095                 int level = b.getText().toUInt(&ok);
00096                 if (ok) {
00097                         field->startTimer();
00098                         game.warp_to_level(level);
00099                         return;
00100                 }
00101         }*/
00102 }
00103 
00104 void KBill::ViewHighScores() {
00105         //ui.popup_dialog(Game::HIGHSCORE);
00106 }
00107 
00108 void KBill::Story() {
00109         field->stopTimer();
00110         HelpDialog *stryDialog = new HelpDialog(this,"helpdialog",1);
00111         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 disguised as a popular operating system. As System Administrator and Exterminator, your job is to keep Bill from succeeding at his task.");
00112         stryDialog->setCaption(tr("The story of KBill"));
00113         stryDialog->TextBrowser1->setText(stryString);
00114         stryDialog->resize(200,200);
00115         stryDialog->show();
00116          field->startTimer();
00117 }
00118 
00119 void KBill::Rules() {
00120         field->stopTimer();
00121         HelpDialog *rulesDialog = new HelpDialog(this,"helpdialog",1);
00122         rulesDialog->setCaption(tr("The rules of KBill"));
00123         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");
00124         rulesDialog->TextBrowser1->setText(rulesStr);
00125         rulesDialog->resize(200,200);
00126         rulesDialog->show();    
00127         field->startTimer();
00128 }

Generated on Sat Nov 5 16:17:19 2005 for OPIE by  doxygen 1.4.2