summaryrefslogtreecommitdiffstats
path: root/kgoldrunner/src/kgrgame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kgoldrunner/src/kgrgame.cpp')
-rw-r--r--kgoldrunner/src/kgrgame.cpp262
1 files changed, 131 insertions, 131 deletions
diff --git a/kgoldrunner/src/kgrgame.cpp b/kgoldrunner/src/kgrgame.cpp
index 93164d88..985d0783 100644
--- a/kgoldrunner/src/kgrgame.cpp
+++ b/kgoldrunner/src/kgrgame.cpp
@@ -37,7 +37,7 @@
/*********************** KGOLDRUNNER GAME CLASS *************************/
/******************************************************************************/
-KGrGame::KGrGame (KGrCanvas * theView, QString theSystemDir, QString theUserDir)
+KGrGame::KGrGame (KGrCanvas * theView, TQString theSystemDir, TQString theUserDir)
{
view = theView;
systemDataDir = theSystemDir;
@@ -63,17 +63,17 @@ KGrGame::KGrGame (KGrCanvas * theView, QString theSystemDir, QString theUserDir)
modalFreeze = FALSE;
messageFreeze = FALSE;
- connect (hero, SIGNAL (gotNugget(int)), SLOT (incScore(int)));
- connect (hero, SIGNAL (caughtHero()), SLOT (herosDead()));
- connect (hero, SIGNAL (haveAllNuggets()), SLOT (showHiddenLadders()));
- connect (hero, SIGNAL (leaveLevel()), SLOT (goUpOneLevel()));
+ connect (hero, TQT_SIGNAL (gotNugget(int)), TQT_SLOT (incScore(int)));
+ connect (hero, TQT_SIGNAL (caughtHero()), TQT_SLOT (herosDead()));
+ connect (hero, TQT_SIGNAL (haveAllNuggets()), TQT_SLOT (showHiddenLadders()));
+ connect (hero, TQT_SIGNAL (leaveLevel()), TQT_SLOT (goUpOneLevel()));
- dyingTimer = new QTimer (this);
- connect (dyingTimer, SIGNAL (timeout()), SLOT (finalBreath()));
+ dyingTimer = new TQTimer (this);
+ connect (dyingTimer, TQT_SIGNAL (timeout()), TQT_SLOT (finalBreath()));
// Get the mouse position every 40 msec. It is used to steer the hero.
- mouseSampler = new QTimer (this);
- connect (mouseSampler, SIGNAL(timeout()), SLOT (readMousePos ()));
+ mouseSampler = new TQTimer (this);
+ connect (mouseSampler, TQT_SIGNAL(timeout()), TQT_SLOT (readMousePos ()));
mouseSampler->start (40, FALSE);
srand(1); // initialisiere Random-Generator
@@ -142,7 +142,7 @@ void KGrGame::herosDead()
// Game over: display the "ENDE" screen.
emit showLives (lives);
freeze();
- QString gameOver = "<NOBR><B>" + i18n("GAME OVER !!!") + "</B></NOBR>";
+ TQString gameOver = "<NOBR><B>" + i18n("GAME OVER !!!") + "</B></NOBR>";
KGrMessage::information (view, collection->name, gameOver);
checkHighScore(); // Check if there is a high score for this game.
@@ -294,18 +294,18 @@ void KGrGame::setBlankLevel(bool playable)
editObjArray[i+1][j+1] = FREE;
}
for (int j=0;j<30;j++) {
- //playfield[j][0]=new KGrBeton(QPixmap ());
+ //playfield[j][0]=new KGrBeton(TQPixmap ());
playfield[j][0]=new KGrObject (BETON);
editObjArray[j][0] = BETON;
- //playfield[j][21]=new KGrBeton(QPixmap ());
+ //playfield[j][21]=new KGrBeton(TQPixmap ());
playfield[j][21]=new KGrObject (BETON);
editObjArray[j][21] = BETON;
}
for (int i=0;i<22;i++) {
- //playfield[0][i]=new KGrBeton(QPixmap ());
+ //playfield[0][i]=new KGrBeton(TQPixmap ());
playfield[0][i]=new KGrObject (BETON);
editObjArray[0][i] = BETON;
- //playfield[29][i]=new KGrBeton(QPixmap ());
+ //playfield[29][i]=new KGrBeton(TQPixmap ());
playfield[29][i]=new KGrObject (BETON);
editObjArray[29][i] = BETON;
}
@@ -391,7 +391,7 @@ void KGrGame::startTutorial()
void KGrGame::showHint()
{
// Put out a hint for this level.
- QString caption = i18n("Hint");
+ TQString caption = i18n("Hint");
if (levelHint.length() > 0)
myMessage (view, caption, levelHint);
@@ -403,7 +403,7 @@ void KGrGame::showHint()
int KGrGame::loadLevel (int levelNo)
{
int i,j;
- QFile openlevel;
+ TQFile openlevel;
if (! openLevelFile (levelNo, openlevel)) {
return 0;
@@ -426,8 +426,8 @@ int KGrGame::loadLevel (int levelNo)
int c = openlevel.getch();
levelName = "";
levelHint = "";
- QCString levelNameC = "";
- QCString levelHintC = "";
+ TQCString levelNameC = "";
+ TQCString levelHintC = "";
i = 1;
while ((c = openlevel.getch()) != EOF) {
switch (i) {
@@ -456,8 +456,8 @@ int KGrGame::loadLevel (int levelNo)
levelHint = i18n((const char *) levelHintC.left(len-1));
// Disconnect edit-mode slots from signals from "view".
- disconnect (view, SIGNAL (mouseClick(int)), 0, 0);
- disconnect (view, SIGNAL (mouseLetGo(int)), 0, 0);
+ disconnect (view, TQT_SIGNAL (mouseClick(int)), 0, 0);
+ disconnect (view, TQT_SIGNAL (mouseLetGo(int)), 0, 0);
if (newLevel) {
hero->setEnemyList (&enemies);
@@ -491,7 +491,7 @@ int KGrGame::loadLevel (int levelNo)
view->setMousePos (startI, startJ);
// Connect play-mode slot to signal from "view".
- connect (view, SIGNAL(mouseClick(int)), SLOT(doDig(int)));
+ connect (view, TQT_SIGNAL(mouseClick(int)), TQT_SLOT(doDig(int)));
// Re-enable player input.
loading = FALSE;
@@ -499,10 +499,10 @@ int KGrGame::loadLevel (int levelNo)
return 1;
}
-bool KGrGame::openLevelFile (int levelNo, QFile & openlevel)
+bool KGrGame::openLevelFile (int levelNo, TQFile & openlevel)
{
- QString filePath;
- QString msg;
+ TQString filePath;
+ TQString msg;
filePath = getFilePath (owner, collection, levelNo);
@@ -554,9 +554,9 @@ void KGrGame::changeObject (unsigned char kind, int i, int j)
enemy->setPlayfield(&playfield);
enemy->enemyId = enemyCount++;
enemies.append(enemy);
- connect(enemy, SIGNAL(lostNugget()), SLOT(loseNugget()));
- connect(enemy, SIGNAL(trapped(int)), SLOT(incScore(int)));
- connect(enemy, SIGNAL(killed(int)), SLOT(incScore(int)));
+ connect(enemy, TQT_SIGNAL(lostNugget()), TQT_SLOT(loseNugget()));
+ connect(enemy, TQT_SIGNAL(trapped(int)), TQT_SLOT(incScore(int)));
+ connect(enemy, TQT_SIGNAL(killed(int)), TQT_SLOT(incScore(int)));
} else {
// Starting a level again after losing.
enemy=enemies.at(enemyCount);
@@ -650,9 +650,9 @@ void KGrGame::startPlaying () {
}
}
-QString KGrGame::getFilePath (Owner o, KGrCollection * colln, int lev)
+TQString KGrGame::getFilePath (Owner o, KGrCollection * colln, int lev)
{
- QString filePath;
+ TQString filePath;
if (lev == 0) {
// End of game: show the "ENDE" screen.
@@ -660,7 +660,7 @@ QString KGrGame::getFilePath (Owner o, KGrCollection * colln, int lev)
filePath = "level000.grl";
}
else {
- filePath.setNum (lev); // Convert INT -> QString.
+ filePath.setNum (lev); // Convert INT -> TQString.
filePath = filePath.rightJustify (3,'0'); // Add 0-2 zeros at left.
filePath.append (".grl"); // Add KGoldrunner level-suffix.
filePath.prepend (colln->prefix); // Add collection file-prefix.
@@ -671,9 +671,9 @@ QString KGrGame::getFilePath (Owner o, KGrCollection * colln, int lev)
return (filePath);
}
-QString KGrGame::getTitle()
+TQString KGrGame::getTitle()
{
- QString levelTitle;
+ TQString levelTitle;
if (level == 0) {
// Generate a special title: end of game or creating a new level.
if (! editMode)
@@ -695,7 +695,7 @@ QString KGrGame::getTitle()
void KGrGame::readMousePos()
{
- QPoint p;
+ TQPoint p;
int i, j;
// If loading a level for play or editing, ignore mouse-position input.
@@ -778,10 +778,10 @@ void KGrGame::saveGame() // Save game ID, score and level.
"level, not as they are now."));
}
- QDate today = QDate::currentDate();
- QTime now = QTime::currentTime();
- QString saved;
- QString day;
+ TQDate today = TQDate::currentDate();
+ TQTime now = TQTime::currentTime();
+ TQString saved;
+ TQString day;
#ifdef QT3
day = today.shortDayName(today.dayOfWeek());
#else
@@ -794,8 +794,8 @@ void KGrGame::saveGame() // Save game ID, score and level.
today.year(), today.month(), today.day(),
now.hour(), now.minute());
- QFile file1 (userDataDir + "savegame.dat");
- QFile file2 (userDataDir + "savegame.tmp");
+ TQFile file1 (userDataDir + "savegame.dat");
+ TQFile file2 (userDataDir + "savegame.tmp");
if (! file2.open (IO_WriteOnly)) {
KGrMessage::information (view, i18n("Save Game"),
@@ -803,7 +803,7 @@ void KGrGame::saveGame() // Save game ID, score and level.
.arg(userDataDir + "savegame.tmp"));
return;
}
- QTextStream text2 (&file2);
+ TQTextStream text2 (&file2);
text2 << saved;
if (file1.exists()) {
@@ -814,7 +814,7 @@ void KGrGame::saveGame() // Save game ID, score and level.
return;
}
- QTextStream text1 (&file1);
+ TQTextStream text1 (&file1);
int n = 30; // Limit the file to the last 30 saves.
while ((! text1.endData()) && (--n > 0)) {
saved = text1.readLine() + "\n";
@@ -825,7 +825,7 @@ void KGrGame::saveGame() // Save game ID, score and level.
file2.close();
- QDir dir;
+ TQDir dir;
dir.rename (file2.name(), file1.name(), TRUE);
KGrMessage::information (view, i18n("Save Game"),
i18n("Your game has been saved."));
@@ -837,7 +837,7 @@ void KGrGame::loadGame() // Re-load game, score and level.
return;
}
- QFile savedGames (userDataDir + "savegame.dat");
+ TQFile savedGames (userDataDir + "savegame.dat");
if (! savedGames.exists()) {
// Use myMessage() because it stops the game while the message appears.
myMessage (view, i18n("Load Game"),
@@ -859,17 +859,17 @@ void KGrGame::loadGame() // Re-load game, score and level.
freeze();
}
- QString s;
+ TQString s;
KGrLGDialog * lg = new KGrLGDialog (&savedGames, collections,
view, "loadDialog");
- if (lg->exec() == QDialog::Accepted) {
+ if (lg->exec() == TQDialog::Accepted) {
s = lg->getCurrentText();
}
bool found = FALSE;
- QString pr;
+ TQString pr;
int lev;
int i;
int imax = collections.count();
@@ -932,8 +932,8 @@ void KGrGame::checkHighScore()
return;
// Look for user's high-score file or for a released high-score file.
- QFile high1 (userDataDir + "hi_" + collection->prefix + ".dat");
- QDataStream s1;
+ TQFile high1 (userDataDir + "hi_" + collection->prefix + ".dat");
+ TQDataStream s1;
if (! high1.exists()) {
high1.setName (systemDataDir + "hi_" + collection->prefix + ".dat");
@@ -945,7 +945,7 @@ void KGrGame::checkHighScore()
// If a previous high score file exists, check the current score against it.
if (prevHigh) {
if (! high1.open (IO_ReadOnly)) {
- QString high1_name = high1.name();
+ TQString high1_name = high1.name();
KGrMessage::information (view, i18n("Check for High Score"),
i18n("Cannot open file '%1' for read-only.").arg(high1_name));
return;
@@ -981,8 +981,8 @@ void KGrGame::checkHighScore()
/* If we have come this far, we have a new high score to record. */
/* ************************************************************* */
- QFile high2 (userDataDir + "hi_" + collection->prefix + ".tmp");
- QDataStream s2;
+ TQFile high2 (userDataDir + "hi_" + collection->prefix + ".tmp");
+ TQDataStream s2;
if (! high2.open (IO_WriteOnly)) {
KGrMessage::information (view, i18n("Check for High Score"),
@@ -992,21 +992,21 @@ void KGrGame::checkHighScore()
}
// Dialog to ask the user to enter their name.
- QDialog * hsn = new QDialog (view, "hsNameDialog", TRUE,
+ TQDialog * hsn = new TQDialog (view, "hsNameDialog", TRUE,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title);
int margin = 10;
int spacing = 10;
- QVBoxLayout * mainLayout = new QVBoxLayout (hsn, margin, spacing);
+ TQVBoxLayout * mainLayout = new TQVBoxLayout (hsn, margin, spacing);
- QLabel * hsnMessage = new QLabel (
+ TQLabel * hsnMessage = new TQLabel (
i18n("<b>Congratulations !!!</b> "
"You have achieved a high "
"score in this game. Please enter your name so that "
"it may be enshrined in the KGoldrunner Hall of Fame."),
hsn);
- QLineEdit * hsnUser = new QLineEdit (hsn);
- QPushButton * OK = new KPushButton (KStdGuiItem::ok(), hsn);
+ TQLineEdit * hsnUser = new TQLineEdit (hsn);
+ TQPushButton * OK = new KPushButton (KStdGuiItem::ok(), hsn);
mainLayout-> addWidget (hsnMessage);
mainLayout-> addWidget (hsnUser);
@@ -1014,14 +1014,14 @@ void KGrGame::checkHighScore()
hsn-> setCaption (i18n("Save High Score"));
- QPoint p = view->mapToGlobal (QPoint (0,0));
+ QPoint p = view->mapToGlobal (TQPoint (0,0));
hsn-> move (p.x() + 50, p.y() + 50);
OK-> setAccel (Key_Return);
hsnUser-> setFocus(); // Set the keyboard input on.
- connect (hsnUser, SIGNAL (returnPressed ()), hsn, SLOT (accept ()));
- connect (OK, SIGNAL (clicked ()), hsn, SLOT (accept ()));
+ connect (hsnUser, TQT_SIGNAL (returnPressed ()), hsn, TQT_SLOT (accept ()));
+ connect (OK, TQT_SIGNAL (clicked ()), hsn, TQT_SLOT (accept ()));
while (TRUE) {
hsn->exec();
@@ -1034,12 +1034,12 @@ void KGrGame::checkHighScore()
delete hsn;
- QDate today = QDate::currentDate();
- QString hsDate;
+ TQDate today = TQDate::currentDate();
+ TQString hsDate;
#ifdef QT3
- QString day = today.shortDayName(today.dayOfWeek());
+ TQString day = today.shortDayName(today.dayOfWeek());
#else
- QString day = today.dayName(today.dayOfWeek());
+ TQString day = today.dayName(today.dayOfWeek());
#endif
hsDate = hsDate.sprintf
("%s %04d-%02d-%02d",
@@ -1100,7 +1100,7 @@ void KGrGame::checkHighScore()
high2.close();
- QDir dir;
+ TQDir dir;
dir.rename (high2.name(),
userDataDir + "hi_" + collection->prefix + ".dat", TRUE);
KGrMessage::information (view, i18n("Save High Score"),
@@ -1124,8 +1124,8 @@ void KGrGame::showHighScores()
int n = 0;
// Look for user's high-score file or for a released high-score file.
- QFile high1 (userDataDir + "hi_" + collection->prefix + ".dat");
- QDataStream s1;
+ TQFile high1 (userDataDir + "hi_" + collection->prefix + ".dat");
+ TQDataStream s1;
if (! high1.exists()) {
high1.setName (systemDataDir + "hi_" + collection->prefix + ".dat");
@@ -1138,25 +1138,25 @@ void KGrGame::showHighScores()
}
if (! high1.open (IO_ReadOnly)) {
- QString high1_name = high1.name();
+ TQString high1_name = high1.name();
KGrMessage::information (view, i18n("Show High Scores"),
i18n("Cannot open file '%1' for read-only.").arg(high1_name));
return;
}
- QDialog * hs = new QDialog (view, "hsDialog", TRUE,
+ TQDialog * hs = new TQDialog (view, "hsDialog", TRUE,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title);
int margin = 10;
int spacing = 10;
- QVBoxLayout * mainLayout = new QVBoxLayout (hs, margin, spacing);
+ TQVBoxLayout * mainLayout = new TQVBoxLayout (hs, margin, spacing);
- QLabel * hsHeader = new QLabel (i18n (
+ TQLabel * hsHeader = new TQLabel (i18n (
"<center><h2>KGoldrunner Hall of Fame</h2></center><br>"
"<center><h3>\"%1\" Game</h3></center>")
.arg(collection->name),
hs);
- QLabel * hsColHeader = new QLabel (
+ TQLabel * hsColHeader = new TQLabel (
i18n(" Name "
"Level Score Date"), hs);
#ifdef KGR_PORTABLE
@@ -1168,11 +1168,11 @@ void KGrGame::showHighScores()
f. setBold (TRUE);
hsColHeader-> setFont (f);
- QLabel * hsLine [10];
+ TQLabel * hsLine [10];
- QHBox * buttons = new QHBox (hs);
+ TQHBox * buttons = new TQHBox (hs);
buttons-> setSpacing (spacing);
- QPushButton * OK = new KPushButton (KStdGuiItem::close(), buttons);
+ TQPushButton * OK = new KPushButton (KStdGuiItem::close(), buttons);
mainLayout-> addWidget (hsHeader);
mainLayout-> addWidget (hsColHeader);
@@ -1197,13 +1197,13 @@ void KGrGame::showHighScores()
s1 >> prevScore;
s1 >> prevDate;
- // QString::sprintf expects UTF-8 encoding in its string arguments, so
+ // TQString::sprintf expects UTF-8 encoding in its string arguments, so
// prevUser has been saved on file as UTF-8 to allow non=ASCII chars
// in the user's name (e.g. "Kr�ger" is encoded as "Krüger" in UTF-8).
line = line.sprintf (hsFormat,
n+1, prevUser, prevLevel, prevScore, prevDate);
- hsLine [n] = new QLabel (line, hs);
+ hsLine [n] = new TQLabel (line, hs);
hsLine [n]->setFont (f);
mainLayout->addWidget (hsLine [n]);
@@ -1212,18 +1212,18 @@ void KGrGame::showHighScores()
n++;
}
- QFrame * separator = new QFrame (hs);
- separator->setFrameStyle (QFrame::HLine + QFrame::Sunken);
+ TQFrame * separator = new TQFrame (hs);
+ separator->setFrameStyle (TQFrame::HLine + TQFrame::Sunken);
mainLayout->addWidget (separator);
OK-> setMaximumWidth (100);
mainLayout-> addWidget (buttons);
- QPoint p = view->mapToGlobal (QPoint (0,0));
+ QPoint p = view->mapToGlobal (TQPoint (0,0));
hs-> move (p.x() + 50, p.y() + 50);
// Start up the dialog box.
- connect (OK, SIGNAL (clicked ()), hs, SLOT (accept ()));
+ connect (OK, TQT_SIGNAL (clicked ()), hs, TQT_SLOT (accept ()));
hs-> exec();
delete hs;
@@ -1302,7 +1302,7 @@ void KGrGame::showEnemyState(int enemyId)
void KGrGame::showObjectState()
{
- QPoint p;
+ TQPoint p;
int i, j;
KGrObject * myObject;
@@ -1439,7 +1439,7 @@ void KGrGame::updateNext()
void KGrGame::loadEditLevel (int lev)
{
int i, j;
- QFile levelFile;
+ TQFile levelFile;
if (! openLevelFile (lev, levelFile))
return;
@@ -1461,8 +1461,8 @@ void KGrGame::loadEditLevel (int lev)
// Read a newline character, then read in the level name and hint (if any).
int c = levelFile.getch();
- QCString levelHintC = "";
- QCString levelNameC = "";
+ TQCString levelHintC = "";
+ TQCString levelNameC = "";
levelHint = "";
levelName = "";
i = 1;
@@ -1484,11 +1484,11 @@ void KGrGame::loadEditLevel (int lev)
// to Unicode (eg. ü to �).
int len = levelHintC.length();
if (len > 0)
- levelHint = QString::fromUtf8((const char *) levelHintC.left(len-1));
+ levelHint = TQString::fromUtf8((const char *) levelHintC.left(len-1));
len = levelNameC.length();
if (len > 0)
- levelName = QString::fromUtf8((const char *) levelNameC);
+ levelName = TQString::fromUtf8((const char *) levelNameC);
editObj = BRICK; // Reset default object.
levelFile.close ();
@@ -1509,7 +1509,7 @@ void KGrGame::editNameAndHint()
// Run a dialog box to create/edit the level name and hint.
KGrNHDialog * nh = new KGrNHDialog (levelName, levelHint, view, "NHDialog");
- if (nh->exec() == QDialog::Accepted) {
+ if (nh->exec() == TQDialog::Accepted) {
levelName = nh->getName();
levelHint = nh->getHint();
shouldSave = TRUE;
@@ -1525,7 +1525,7 @@ bool KGrGame::saveLevelFile()
int selectedLevel = level;
int i, j;
- QString filePath;
+ TQString filePath;
if (! editMode) {
KGrMessage::information (view, i18n("Save Level"),
@@ -1555,7 +1555,7 @@ bool KGrGame::saveLevelFile()
// Set the name of the output file.
filePath = getFilePath (owner, collection, selectedLevel);
- QFile levelFile (filePath);
+ TQFile levelFile (filePath);
if ((action == SL_SAVE) && (n == N) && (selectedLevel == level)) {
// This is a normal edit: the old file is to be re-written.
@@ -1597,7 +1597,7 @@ bool KGrGame::saveLevelFile()
levelFile.putch ('\n');
// Save the level name, changing non-ASCII chars to UTF-8 (eg. � to ü).
- QCString levelNameC = levelName.utf8();
+ TQCString levelNameC = levelName.utf8();
int len1 = levelNameC.length();
if (len1 > 0) {
for (i = 0; i < len1; i++)
@@ -1606,7 +1606,7 @@ bool KGrGame::saveLevelFile()
}
// Save the level hint, changing non-ASCII chars to UTF-8 (eg. � to ü).
- QCString levelHintC = levelHint.utf8();
+ TQCString levelHintC = levelHint.utf8();
int len2 = levelHintC.length();
char ch = '\0';
@@ -1682,9 +1682,9 @@ void KGrGame::moveLevelFile ()
}
}
- QDir dir;
- QString filePath1;
- QString filePath2;
+ TQDir dir;
+ TQString filePath1;
+ TQString filePath2;
// Save the "fromN" file under a temporary name.
filePath1 = getFilePath (USER, collections.at(fromC), fromL);
@@ -1752,12 +1752,12 @@ void KGrGame::deleteLevelFile ()
if (lev == 0)
return;
- QString filePath;
+ TQString filePath;
// Set the name of the file to be deleted.
int n = collnIndex;
filePath = getFilePath (USER, collections.at(n), lev);
- QFile levelFile (filePath);
+ TQFile levelFile (filePath);
// Delete the file for the selected collection and level.
if (levelFile.exists()) {
@@ -1828,10 +1828,10 @@ void KGrGame::editCollection (int action)
KGrECDialog * ec = new KGrECDialog (action, n, collections,
view, "editGameDialog");
- while (ec->exec() == QDialog::Accepted) { // Loop until valid.
+ while (ec->exec() == TQDialog::Accepted) { // Loop until valid.
// Validate the collection details.
- QString ecName = ec->getName();
+ TQString ecName = ec->getName();
int len = ecName.length();
if (len == 0) {
KGrMessage::information (view, i18n("Save Game Info"),
@@ -1839,7 +1839,7 @@ void KGrGame::editCollection (int action)
continue;
}
- QString ecPrefix = ec->getPrefix();
+ TQString ecPrefix = ec->getPrefix();
if ((action == SL_CR_GAME) || (collections.at(n)->nLevels <= 0)) {
// The filename prefix could have been entered, so validate it.
len = ecPrefix.length();
@@ -2030,19 +2030,19 @@ void KGrGame::setEditableCell (int i, int j, char type)
void KGrGame::showEditLevel()
{
// Disconnect play-mode slots from signals from "view".
- disconnect (view, SIGNAL(mouseClick(int)), 0, 0);
- disconnect (view, SIGNAL(mouseLetGo(int)), 0, 0);
+ disconnect (view, TQT_SIGNAL(mouseClick(int)), 0, 0);
+ disconnect (view, TQT_SIGNAL(mouseLetGo(int)), 0, 0);
// Connect edit-mode slots to signals from "view".
- connect (view, SIGNAL(mouseClick(int)), SLOT(doEdit(int)));
- connect (view, SIGNAL(mouseLetGo(int)), SLOT(endEdit(int)));
+ connect (view, TQT_SIGNAL(mouseClick(int)), TQT_SLOT(doEdit(int)));
+ connect (view, TQT_SIGNAL(mouseLetGo(int)), TQT_SLOT(endEdit(int)));
}
bool KGrGame::reNumberLevels (int cIndex, int first, int last, int inc)
{
int i, n, step;
- QDir dir;
- QString file1, file2;
+ TQDir dir;
+ TQString file1, file2;
if (inc > 0) {
i = last;
@@ -2083,7 +2083,7 @@ void KGrGame::setLevel (int lev)
void KGrGame::doEdit (int button)
{
// Mouse button down: start making changes.
- QPoint p;
+ TQPoint p;
int i, j;
p = view->getMousePos ();
@@ -2106,7 +2106,7 @@ void KGrGame::doEdit (int button)
void KGrGame::endEdit (int button)
{
// Mouse button released: finish making changes.
- QPoint p;
+ TQPoint p;
int i, j;
p = view->getMousePos ();
@@ -2144,7 +2144,7 @@ int KGrGame::selectLevel (int action, int requestedLevel)
// Create and run a modal dialog box to select a game and level.
KGrSLDialog * sl = new KGrSLDialog (action, requestedLevel, collnIndex,
collections, this, view, "levelDialog");
- while (sl->exec() == QDialog::Accepted) {
+ while (sl->exec() == TQDialog::Accepted) {
selectedGame = sl->selectedGame();
selectedLevel = 0; // In case the selection is invalid.
if (collections.at(selectedGame)->owner == SYSTEM) {
@@ -2226,26 +2226,26 @@ bool KGrGame::ownerOK (Owner o)
/********************** CLASS TO DISPLAY THUMBNAIL ***********************/
/******************************************************************************/
-KGrThumbNail::KGrThumbNail (QWidget * parent, const char * name)
- : QFrame (parent, name)
+KGrThumbNail::KGrThumbNail (TQWidget * parent, const char * name)
+ : TQFrame (parent, name)
{
// Let the parent do all the work. We need a class here so that
- // QFrame::drawContents (QPainter *) can be re-implemented and
+ // TQFrame::drawContents (TQPainter *) can be re-implemented and
// the thumbnail can be automatically re-painted when required.
}
-QColor KGrThumbNail::backgroundColor = QColor ("#dddddd");
-QColor KGrThumbNail::brickColor = QColor ("#ff0000");
-QColor KGrThumbNail::ladderColor = QColor ("#ddcc00");
-QColor KGrThumbNail::poleColor = QColor ("#aa7700");
+TQColor KGrThumbNail::backgroundColor = TQColor ("#dddddd");
+TQColor KGrThumbNail::brickColor = TQColor ("#ff0000");
+TQColor KGrThumbNail::ladderColor = TQColor ("#ddcc00");
+TQColor KGrThumbNail::poleColor = TQColor ("#aa7700");
-void KGrThumbNail::setFilePath (QString & fp, QLabel * sln)
+void KGrThumbNail::setFilePath (TQString & fp, TQLabel * sln)
{
filePath = fp; // Keep safe copies of file
lName = sln; // path and level name field.
}
-void KGrThumbNail::drawContents (QPainter * p) // Activated via "paintEvent".
+void KGrThumbNail::drawContents (TQPainter * p) // Activated via "paintEvent".
{
QFile openFile;
QPen pen = p->pen();
@@ -2259,7 +2259,7 @@ void KGrThumbNail::drawContents (QPainter * p) // Activated via "paintEvent".
openFile.setName (filePath);
if ((! openFile.exists()) || (! openFile.open (IO_ReadOnly))) {
// There is no file, so fill the thumbnail with "FREE" cells.
- p->drawRect (QRect(fw, fw, FIELDWIDTH*n, FIELDHEIGHT*n));
+ p->drawRect (TQRect(fw, fw, FIELDWIDTH*n, FIELDHEIGHT*n));
return;
}
@@ -2301,7 +2301,7 @@ void KGrThumbNail::drawContents (QPainter * p) // Activated via "paintEvent".
// For a nugget, add just a vertical touch of yellow (2-3 pixels).
if (obj == NUGGET) {
int k = (n/2)+fw;
- // pen.setColor (QColor("#ffff00"));
+ // pen.setColor (TQColor("#ffff00"));
pen.setColor (ladderColor);
p->setPen (pen);
p->drawLine (i*n+k, j*n+k, i*n+k, j*n+(n-1)+fw);
@@ -2311,7 +2311,7 @@ void KGrThumbNail::drawContents (QPainter * p) // Activated via "paintEvent".
// Absorb a newline character, then read in the level name (if any).
int c = openFile.getch();
- QCString s = "";
+ TQCString s = "";
while ((c = openFile.getch()) != EOF) {
if (c == '\n') // Level name is on one line.
break;
@@ -2330,7 +2330,7 @@ void KGrThumbNail::drawContents (QPainter * p) // Activated via "paintEvent".
/******************************************************************************/
// NOTE: Macros "myStr" and "myChar", defined in "kgrgame.h", are used
-// to smooth out differences between Qt 1 and Qt2 QString classes.
+// to smooth out differences between Qt 1 and Qt2 TQString classes.
bool KGrGame::initCollections ()
{
@@ -2381,9 +2381,9 @@ void KGrGame::mapCollections()
}
const QFileInfoList * files = d.entryInfoList
- (colln->prefix + "???.grl", QDir::Files, QDir::Name);
+ (colln->prefix + "???.grl", TQDir::Files, TQDir::Name);
QFileInfoListIterator i (* files);
- QFileInfo * file;
+ TQFileInfo * file;
if ((files->count() <= 0) && (colln->nLevels > 0)) {
KGrMessage::information (view, i18n("Check Games & Levels"),
@@ -2403,7 +2403,7 @@ void KGrGame::mapCollections()
while (TRUE) {
// Work out what the file name should be, based on the level no.
- fileName2.setNum (lev); // Convert to QString.
+ fileName2.setNum (lev); // Convert to TQString.
fileName2 = fileName2.rightJustify (3,'0'); // Add zeros.
fileName2.append (".grl"); // Add level-suffix.
fileName2.prepend (colln->prefix); // Add colln. prefix.
@@ -2450,7 +2450,7 @@ bool KGrGame::loadCollections (Owner o)
filePath = ((o == SYSTEM)? systemDataDir : userDataDir) + "games.dat";
- QFile c (filePath);
+ TQFile c (filePath);
if (! c.exists()) {
// If the user has not yet created a collection, don't worry.
@@ -2506,7 +2506,7 @@ bool KGrGame::loadCollections (Owner o)
collections.append (new KGrCollection
(o, i18n((const char *) name), // Translate now.
prefix, settings, nLevels,
- QString::fromUtf8((const char *) line)));
+ TQString::fromUtf8((const char *) line)));
name = ""; prefix = ""; settings = ' '; nLevels = -1;
}
else if (ch >= 0) {
@@ -2537,7 +2537,7 @@ bool KGrGame::saveCollections (Owner o)
filePath = ((o == SYSTEM)? systemDataDir : userDataDir) + "games.dat";
- QFile c (filePath);
+ TQFile c (filePath);
// Open the output file.
if (! c.open (IO_WriteOnly)) {
@@ -2563,7 +2563,7 @@ bool KGrGame::saveCollections (Owner o)
len = colln->about.length();
if (len > 0) {
- QCString aboutC = colln->about.utf8();
+ TQCString aboutC = colln->about.utf8();
len = aboutC.length(); // Might be longer now.
for (i = 0; i < len; i++) {
ch = aboutC[i];
@@ -2588,7 +2588,7 @@ bool KGrGame::saveCollections (Owner o)
/********************** WORD-WRAPPED MESSAGE BOX ************************/
/******************************************************************************/
-void KGrGame::myMessage (QWidget * parent, QString title, QString contents)
+void KGrGame::myMessage (TQWidget * parent, TQString title, TQString contents)
{
// Halt the game while the message is displayed.
setMessageFreeze (TRUE);
@@ -2603,8 +2603,8 @@ void KGrGame::myMessage (QWidget * parent, QString title, QString contents)
/*********************** COLLECTION DATA CLASS **************************/
/******************************************************************************/
-KGrCollection::KGrCollection (Owner o, const QString & n, const QString & p,
- const char s, int nl, const QString & a)
+KGrCollection::KGrCollection (Owner o, const TQString & n, const TQString & p,
+ const char s, int nl, const TQString & a)
{
// Holds information about a collection of KGoldrunner levels (i.e. a game).
owner = o; name = n; prefix = p; settings = s; nLevels = nl; about = a;