summaryrefslogtreecommitdiffstats
path: root/kmines/status.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmines/status.cpp')
-rw-r--r--kmines/status.cpp128
1 files changed, 64 insertions, 64 deletions
diff --git a/kmines/status.cpp b/kmines/status.cpp
index a3d5f061..ec9dfc3e 100644
--- a/kmines/status.cpp
+++ b/kmines/status.cpp
@@ -19,13 +19,13 @@
#include "status.h"
#include "status.moc"
-#include <qpainter.h>
-#include <qpixmap.h>
-#include <qwhatsthis.h>
-#include <qlayout.h>
-#include <qwidgetstack.h>
-#include <qtextedit.h>
-#include <qtimer.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqwhatsthis.h>
+#include <tqlayout.h>
+#include <tqwidgetstack.h>
+#include <tqtextedit.h>
+#include <tqtimer.h>
#include <kapplication.h>
#include <klocale.h>
@@ -45,27 +45,27 @@
#include "version.h"
-Status::Status(QWidget *parent)
- : QWidget(parent, "status"), _oldLevel(Level::Easy)
+Status::Status(TQWidget *parent)
+ : TQWidget(parent, "status"), _oldLevel(Level::Easy)
{
- _timer = new QTimer(this);
- connect(_timer, SIGNAL(timeout()), SLOT(replayStep()));
+ _timer = new TQTimer(this);
+ connect(_timer, TQT_SIGNAL(timeout()), TQT_SLOT(replayStep()));
_solver = new Solver(this);
- connect(_solver, SIGNAL(solvingDone(bool)), SLOT(solvingDone(bool)));
+ connect(_solver, TQT_SIGNAL(solvingDone(bool)), TQT_SLOT(solvingDone(bool)));
// top layout
- QGridLayout *top = new QGridLayout(this, 2, 5, 10, 10);
+ TQGridLayout *top = new TQGridLayout(this, 2, 5, 10, 10);
top->setColStretch(1, 1);
top->setColStretch(3, 1);
// status bar
// mines left LCD
left = new KGameLCD(5, this);
- left->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+ left->setFrameStyle(TQFrame::Panel | TQFrame::Sunken);
left->setDefaultBackgroundColor(black);
left->setDefaultColor(white);
- QWhatsThis::add(left, i18n("<qt>Mines left.<br/>"
+ TQWhatsThis::add(left, i18n("<qt>Mines left.<br/>"
"It turns <font color=\"red\">red</font> "
"when you have flagged more cases than "
"present mines.</qt>"));
@@ -73,14 +73,14 @@ Status::Status(QWidget *parent)
// smiley
smiley = new Smiley(this);
- connect(smiley, SIGNAL(clicked()), SLOT(smileyClicked()));
- smiley->setFocusPolicy(QWidget::NoFocus);
- QWhatsThis::add(smiley, i18n("Press to start a new game"));
+ connect(smiley, TQT_SIGNAL(clicked()), TQT_SLOT(smileyClicked()));
+ smiley->setFocusPolicy(TQWidget::NoFocus);
+ TQWhatsThis::add(smiley, i18n("Press to start a new game"));
top->addWidget(smiley, 0, 2);
// digital clock LCD
dg = new DigitalClock(this);
- QWhatsThis::add(dg, i18n("<qt>Time elapsed.<br/>"
+ TQWhatsThis::add(dg, i18n("<qt>Time elapsed.<br/>"
"It turns <font color=\"blue\">blue</font> "
"if it is a highscore "
"and <font color=\"red\">red</font> "
@@ -88,32 +88,32 @@ Status::Status(QWidget *parent)
top->addWidget(dg, 0, 4);
// mines field
- _fieldContainer = new QWidget(this);
- QGridLayout *g = new QGridLayout(_fieldContainer, 1, 1);
+ _fieldContainer = new TQWidget(this);
+ TQGridLayout *g = new TQGridLayout(_fieldContainer, 1, 1);
_field = new Field(_fieldContainer);
_field->readSettings();
g->addWidget(_field, 0, 0, AlignCenter);
- connect( _field, SIGNAL(updateStatus(bool)), SLOT(updateStatus(bool)) );
- connect(_field, SIGNAL(gameStateChanged(GameState)),
- SLOT(gameStateChangedSlot(GameState)) );
- connect(_field, SIGNAL(setMood(Mood)), smiley, SLOT(setMood(Mood)));
- connect(_field, SIGNAL(setCheating()), dg, SLOT(setCheating()));
- connect(_field,SIGNAL(addAction(const KGrid2D::Coord &, Field::ActionType)),
- SLOT(addAction(const KGrid2D::Coord &, Field::ActionType)));
- QWhatsThis::add(_field, i18n("Mines field."));
+ connect( _field, TQT_SIGNAL(updateStatus(bool)), TQT_SLOT(updateStatus(bool)) );
+ connect(_field, TQT_SIGNAL(gameStateChanged(GameState)),
+ TQT_SLOT(gameStateChangedSlot(GameState)) );
+ connect(_field, TQT_SIGNAL(setMood(Mood)), smiley, TQT_SLOT(setMood(Mood)));
+ connect(_field, TQT_SIGNAL(setCheating()), dg, TQT_SLOT(setCheating()));
+ connect(_field,TQT_SIGNAL(addAction(const KGrid2D::Coord &, Field::ActionType)),
+ TQT_SLOT(addAction(const KGrid2D::Coord &, Field::ActionType)));
+ TQWhatsThis::add(_field, i18n("Mines field."));
// resume button
- _resumeContainer = new QWidget(this);
- g = new QGridLayout(_resumeContainer, 1, 1);
- QFont f = font();
+ _resumeContainer = new TQWidget(this);
+ g = new TQGridLayout(_resumeContainer, 1, 1);
+ TQFont f = font();
f.setBold(true);
- QPushButton *pb
- = new QPushButton(i18n("Press to Resume"), _resumeContainer);
+ TQPushButton *pb
+ = new TQPushButton(i18n("Press to Resume"), _resumeContainer);
pb->setFont(f);
- connect(pb, SIGNAL(clicked()), SIGNAL(pause()));
+ connect(pb, TQT_SIGNAL(clicked()), TQT_SIGNAL(pause()));
g->addWidget(pb, 0, 0, AlignCenter);
- _stack = new QWidgetStack(this);
+ _stack = new TQWidgetStack(this);
_stack->addWidget(_fieldContainer);
_stack->addWidget(_resumeContainer);
_stack->raiseWidget(_fieldContainer);
@@ -176,7 +176,7 @@ void Status::settingsChanged()
void Status::updateStatus(bool mine)
{
int r = _field->nbMines() - _field->nbMarked();
- QColor color = (r<0 && !_field->isSolved() ? red : white);
+ TQColor color = (r<0 && !_field->isSolved() ? red : white);
left->setColor(color);
left->display(r);
@@ -207,14 +207,14 @@ void Status::setGameOver(bool won)
if ( Settings::magicReveal() )
_logRoot.setAttribute("complete_reveal", "true");
- QString sa = "none";
+ TQString sa = "none";
if ( _field->solvingState()==Solved ) sa = "solving";
else if ( _field->solvingState()==Advised ) sa = "advising";
_logRoot.setAttribute("solver", sa);
- QDomElement f = _log.createElement("Field");
+ TQDomElement f = _log.createElement("Field");
_logRoot.appendChild(f);
- QDomText data = _log.createTextNode(_field->string());
+ TQDomText data = _log.createTextNode(_field->string());
f.appendChild(data);
}
@@ -235,10 +235,10 @@ void Status::setPlaying()
// game log
const Level &level = _field->level();
- _log = QDomDocument("kmineslog");
+ _log = TQDomDocument("kmineslog");
_logRoot = _log.createElement("kmineslog");
_logRoot.setAttribute("version", SHORT_VERSION);
- QDateTime date = QDateTime::currentDateTime();
+ TQDateTime date = TQDateTime::currentDateTime();
_logRoot.setAttribute("date", date.toString(Qt::ISODate));
_logRoot.setAttribute("width", level.width());
_logRoot.setAttribute("height", level.height());
@@ -250,7 +250,7 @@ void Status::setPlaying()
void Status::gameStateChanged(GameState state, bool won)
{
- QWidget *w = _fieldContainer;
+ TQWidget *w = _fieldContainer;
switch (state) {
case Playing:
@@ -282,7 +282,7 @@ void Status::gameStateChanged(GameState state, bool won)
void Status::addAction(const KGrid2D::Coord &c, Field::ActionType type)
{
- QDomElement action = _log.createElement("Action");
+ TQDomElement action = _log.createElement("Action");
action.setAttribute("time", dg->pretty());
action.setAttribute("column", c.first);
action.setAttribute("line", c.second);
@@ -296,7 +296,7 @@ void Status::advise()
int res = KMessageBox::warningContinueCancel(this,
i18n("When the solver gives "
"you advice, your score will not be added to the highscores."),
- QString::null, QString::null, "advice_warning");
+ TQString::null, TQString::null, "advice_warning");
if ( res==KMessageBox::Cancel ) return;
dg->setCheating();
float probability;
@@ -326,7 +326,7 @@ void Status::viewLog()
{
KDialogBase d(this, "view_log", true, i18n("View Game Log"),
KDialogBase::Close, KDialogBase::Close);
- QTextEdit *view = new QTextEdit(&d);
+ TQTextEdit *view = new TQTextEdit(&d);
view->setReadOnly(true);
view->setTextFormat(PlainText);
view->setText(_log.toString());
@@ -337,7 +337,7 @@ void Status::viewLog()
void Status::saveLog()
{
- KURL url = KFileDialog::getSaveURL(QString::null, QString::null, this);
+ KURL url = KFileDialog::getSaveURL(TQString::null, TQString::null, this);
if ( url.isEmpty() ) return;
if ( KIO::NetAccess::exists(url, false, this) ) {
KGuiItem gi = KStdGuiItem::save();
@@ -356,13 +356,13 @@ void Status::saveLog()
void Status::loadLog()
{
- KURL url = KFileDialog::getOpenURL(QString::null, QString::null, this);
+ KURL url = KFileDialog::getOpenURL(TQString::null, TQString::null, this);
if ( url.isEmpty() ) return;
- QString tmpFile;
+ TQString tmpFile;
bool success = false;
- QDomDocument doc;
+ TQDomDocument doc;
if( KIO::NetAccess::download(url, tmpFile, this) ) {
- QFile file(tmpFile);
+ TQFile file(tmpFile);
if ( file.open(IO_ReadOnly) ) {
int errorLine;
bool ok = doc.setContent(&file, 0, &errorLine);
@@ -390,11 +390,11 @@ void Status::loadLog()
}
}
-bool Status::checkLog(const QDomDocument &doc)
+bool Status::checkLog(const TQDomDocument &doc)
{
// check root element
if ( doc.doctype().name()!="kmineslog" ) return false;
- QDomElement root = doc.namedItem("kmineslog").toElement();
+ TQDomElement root = doc.namedItem("kmineslog").toElement();
if ( root.isNull() ) return false;
bool ok;
uint w = root.attribute("width").toUInt(&ok);
@@ -407,24 +407,24 @@ bool Status::checkLog(const QDomDocument &doc)
if ( !ok || nb==0 || nb>Level::maxNbMines(w, h) ) return false;
// check field
- QDomElement field = root.namedItem("Field").toElement();
+ TQDomElement field = root.namedItem("Field").toElement();
if ( field.isNull() ) return false;
- QString ftext = field.text();
+ TQString ftext = field.text();
if ( !BaseField::checkField(w, h, nb, ftext) ) return false;
// check action list
- QDomElement list = root.namedItem("ActionList").toElement();
+ TQDomElement list = root.namedItem("ActionList").toElement();
if ( list.isNull() ) return false;
- QDomNodeList actions = list.elementsByTagName("Action");
+ TQDomNodeList actions = list.elementsByTagName("Action");
if ( actions.count()==0 ) return false;
for (uint i=0; i<actions.count(); i++) {
- QDomElement a = actions.item(i).toElement();
+ TQDomElement a = actions.item(i).toElement();
if ( a.isNull() ) return false;
uint i0 = a.attribute("line").toUInt(&ok);
if ( !ok || i0>=h ) return false;
uint j = a.attribute("column").toUInt(&ok);
if ( !ok || j>=w ) return false;
- QString type = a.attribute("type");
+ TQString type = a.attribute("type");
uint k = 0;
for (; k<Field::Nb_Actions; k++)
if ( type==Field::ACTION_DATA[k].name ) break;
@@ -441,11 +441,11 @@ void Status::replayLog()
uint h = _logRoot.attribute("height").toUInt();
uint n = _logRoot.attribute("mines").toUInt();
Level level(w, h, n);
- QDomNode f = _logRoot.namedItem("Field");
+ TQDomNode f = _logRoot.namedItem("Field");
_oldLevel = _field->level();
newGame(level);
_field->setReplayField(f.toElement().text());
- QString s = _logRoot.attribute("complete_reveal");
+ TQString s = _logRoot.attribute("complete_reveal");
_completeReveal = ( s=="true" );
f = _logRoot.namedItem("ActionList");
@@ -458,16 +458,16 @@ void Status::replayStep()
{
if ( _index>=_actions.count() ) {
_timer->stop();
- _actions = QDomNodeList();
+ _actions = TQDomNodeList();
return;
}
_timer->changeInterval(200);
- QDomElement a = _actions.item(_index).toElement();
+ TQDomElement a = _actions.item(_index).toElement();
dg->setTime(a.attribute("time"));
uint i = a.attribute("column").toUInt();
uint j = a.attribute("line").toUInt();
- QString type = a.attribute("type");
+ TQString type = a.attribute("type");
for (uint k=0; k<Field::Nb_Actions; k++)
if ( type==Field::ACTION_DATA[k].name ) {
_field->doAction((Field::ActionType)k,