summaryrefslogtreecommitdiffstats
path: root/ktuberling
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
commit576eb4299a00bc053db35414406f46372a0f70f2 (patch)
tree4c030922d533821db464af566188e7d40cc8848c /ktuberling
parent0718336b6017d1a4fc1d626544180a5a2a29ddec (diff)
downloadtdegames-576eb4299a00bc053db35414406f46372a0f70f2.tar.gz
tdegames-576eb4299a00bc053db35414406f46372a0f70f2.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ktuberling')
-rw-r--r--ktuberling/playground.cpp134
-rw-r--r--ktuberling/playground.h46
-rw-r--r--ktuberling/soundfactory.cpp38
-rw-r--r--ktuberling/soundfactory.h10
-rw-r--r--ktuberling/todraw.cpp20
-rw-r--r--ktuberling/todraw.h10
-rw-r--r--ktuberling/toplevel.cpp102
-rw-r--r--ktuberling/toplevel.h10
8 files changed, 185 insertions, 185 deletions
diff --git a/ktuberling/playground.cpp b/ktuberling/playground.cpp
index 367c407c..4488fe8d 100644
--- a/ktuberling/playground.cpp
+++ b/ktuberling/playground.cpp
@@ -11,11 +11,11 @@
#include <kstandarddirs.h>
#include <kprinter.h>
-#include <qfile.h>
-#include <qpainter.h>
-#include <qimage.h>
-#include <qcursor.h>
-#include <qdom.h>
+#include <tqfile.h>
+#include <tqpainter.h>
+#include <tqimage.h>
+#include <tqcursor.h>
+#include <tqdom.h>
#include "playground.moc"
#include "toplevel.h"
@@ -25,7 +25,7 @@
// Constructor
PlayGround::PlayGround(TopLevel *parent, const char *name, uint selectedGameboard)
- : QWidget(parent, name)
+ : TQWidget(parent, name)
{
topLevel = parent;
@@ -38,7 +38,7 @@ PlayGround::PlayGround(TopLevel *parent, const char *name, uint selectedGameboar
setBackgroundColor(white);
- QDomDocument layoutsDocument;
+ TQDomDocument layoutsDocument;
bool ok = topLevel->loadLayout(layoutsDocument);
if (ok) ok = registerPlayGrounds(layoutsDocument);
if (ok) ok = loadPlayGround(layoutsDocument, selectedGameboard);
@@ -71,7 +71,7 @@ void PlayGround::reset()
// Change the gameboard
void PlayGround::change(uint selectedGameboard)
{
- QDomDocument layoutsDocument;
+ TQDomDocument layoutsDocument;
bool ok = topLevel->loadLayout(layoutsDocument);
if (ok) ok = loadPlayGround(layoutsDocument, selectedGameboard);
if (!ok) loadFailure();
@@ -88,7 +88,7 @@ void PlayGround::change(uint selectedGameboard)
// Repaint all the editable area
void PlayGround::repaintAll()
{
- QRect dirtyArea
+ TQRect dirtyArea
(editableArea.left() - 10,
editableArea.top() - 10,
editableArea.width() + 20,
@@ -158,12 +158,12 @@ bool PlayGround::redo()
}
// Save objects laid down on the editable area
-bool PlayGround::saveAs(const QString & name)
+bool PlayGround::saveAs(const TQString & name)
{
FILE *fp;
const ToDraw *currentObject;
- if (!(fp = fopen((const char *) QFile::encodeName(name), "w"))) return false;
+ if (!(fp = fopen((const char *) TQFile::encodeName(name), "w"))) return false;
fprintf(fp, "%d\n", topLevel->getSelectedGameboard());
for (currentObject = toDraw.first(); currentObject; currentObject = toDraw.next())
@@ -175,21 +175,21 @@ bool PlayGround::saveAs(const QString & name)
// Print gameboard's picture
bool PlayGround::printPicture(KPrinter &printer) const
{
- QPainter artist;
- QPixmap picture(getPicture());
+ TQPainter artist;
+ TQPixmap picture(getPicture());
if (!artist.begin(&printer)) return false;
- artist.drawPixmap(QPoint(32, 32), picture);
+ artist.drawPixmap(TQPoint(32, 32), picture);
if (!artist.end()) return false;
return true;
}
// Get a pixmap containing the current picture
-QPixmap PlayGround::getPicture() const
+TQPixmap PlayGround::getPicture() const
{
- QPixmap result(editableArea.size());
- QPainter artist(&result);
- QRect transEditableArea(editableArea);
+ TQPixmap result(editableArea.size());
+ TQPainter artist(&result);
+ TQRect transEditableArea(editableArea);
transEditableArea.moveBy(-XMARGIN, -YMARGIN);
artist.translate(XMARGIN - editableArea.left(),
@@ -199,9 +199,9 @@ QPixmap PlayGround::getPicture() const
}
// Draw some text
-void PlayGround::drawText(QPainter &artist, QRect &area, QString &textId) const
+void PlayGround::drawText(TQPainter &artist, TQRect &area, TQString &textId) const
{
- QString label;
+ TQString label;
label=i18n(textId.latin1());
@@ -209,7 +209,7 @@ void PlayGround::drawText(QPainter &artist, QRect &area, QString &textId) const
}
// Paint the current picture to the given device
-void PlayGround::drawGameboard( QPainter &artist, const QRect &area ) const
+void PlayGround::drawGameboard( TQPainter &artist, const TQRect &area ) const
{
artist.drawPixmap(area.topLeft(), gameboard, area);
@@ -218,25 +218,25 @@ void PlayGround::drawGameboard( QPainter &artist, const QRect &area ) const
drawText(artist, textsLayout[text], textsList[text]);
artist.setPen(black);
- for (QPtrListIterator<ToDraw> currentObject(toDraw);
+ for (TQPtrListIterator<ToDraw> currentObject(toDraw);
currentObject.current();
++currentObject)
currentObject.current()->draw(artist, area, objectsLayout, &gameboard, &masks);
}
// Painting event
-void PlayGround::paintEvent( QPaintEvent *event )
+void PlayGround::paintEvent( TQPaintEvent *event )
{
- QPoint destination(event->rect().topLeft()),
+ TQPoint destination(event->rect().topLeft()),
position(destination.x() - XMARGIN,
destination.y() - YMARGIN);
- QRect area(position, QSize(event->rect().size()));
- QPixmap cache(gameboard.size());
- QPainter artist(&cache);
+ TQRect area(position, TQSize(event->rect().size()));
+ TQPixmap cache(gameboard.size());
+ TQPainter artist(&cache);
if (destination.x() < XMARGIN) destination.setX(XMARGIN);
if (destination.y() < YMARGIN) destination.setY(YMARGIN);
- area = QRect(0, 0, gameboard.width(), gameboard.height()).intersect(area);
+ area = TQRect(0, 0, gameboard.width(), gameboard.height()).intersect(area);
if (area.isEmpty()) return;
drawGameboard(artist, area);
@@ -245,41 +245,41 @@ void PlayGround::paintEvent( QPaintEvent *event )
}
// Mouse pressed event
-void PlayGround::mousePressEvent( QMouseEvent *event )
+void PlayGround::mousePressEvent( TQMouseEvent *event )
{
if (draggedCursor) return;
- QPoint position(event->x() - XMARGIN,
+ TQPoint position(event->x() - XMARGIN,
event->y() - YMARGIN);
if (!zone(position)) return;
int draggedNumber = draggedObject.getNumber();
- QPixmap object(objectsLayout[draggedNumber].size());
- QBitmap shape(objectsLayout[draggedNumber].size());
- bitBlt(&object, QPoint(0, 0), &gameboard, objectsLayout[draggedNumber], Qt::CopyROP);
- bitBlt(&shape, QPoint(0, 0), &masks, objectsLayout[draggedNumber], Qt::CopyROP);
+ TQPixmap object(objectsLayout[draggedNumber].size());
+ TQBitmap shape(objectsLayout[draggedNumber].size());
+ bitBlt(&object, TQPoint(0, 0), &gameboard, objectsLayout[draggedNumber], Qt::CopyROP);
+ bitBlt(&shape, TQPoint(0, 0), &masks, objectsLayout[draggedNumber], Qt::CopyROP);
object.setMask(shape);
- draggedCursor = new QCursor(object, position.x(), position.y());
+ draggedCursor = new TQCursor(object, position.x(), position.y());
setCursor(*draggedCursor);
topLevel->playSound(soundsList[draggedNumber]);
}
// Mouse released event
-void PlayGround::mouseReleaseEvent( QMouseEvent *event )
+void PlayGround::mouseReleaseEvent( TQMouseEvent *event )
{
// If we are not dragging an object, ignore the event
if (!draggedCursor) return;
- QCursor arrow;
+ TQCursor arrow;
int draggedNumber = draggedObject.getNumber();
- QRect position(
+ TQRect position(
event->x() - XMARGIN - draggedCursor->hotSpot().x(),
event->y() - YMARGIN - draggedCursor->hotSpot().y(),
objectsLayout[draggedNumber].width(),
objectsLayout[draggedNumber].height());
- QRect dirtyArea
+ TQRect dirtyArea
(editableArea.left() - 10,
editableArea.top() - 10,
editableArea.width() + 20,
@@ -325,11 +325,11 @@ void PlayGround::mouseReleaseEvent( QMouseEvent *event )
}
// Register the various playgrounds
-bool PlayGround::registerPlayGrounds(QDomDocument &layoutDocument)
+bool PlayGround::registerPlayGrounds(TQDomDocument &layoutDocument)
{
- QDomNodeList playGroundsList, menuItemsList, labelsList;
- QDomElement playGroundElement, menuItemElement, labelElement;
- QDomAttr actionAttribute;
+ TQDomNodeList playGroundsList, menuItemsList, labelsList;
+ TQDomElement playGroundElement, menuItemElement, labelElement;
+ TQDomAttr actionAttribute;
playGroundsList = layoutDocument.elementsByTagName("playground");
if (playGroundsList.count() < 1)
@@ -337,19 +337,19 @@ bool PlayGround::registerPlayGrounds(QDomDocument &layoutDocument)
for (uint i = 0; i < playGroundsList.count(); i++)
{
- playGroundElement = (const QDomElement &) playGroundsList.item(i).toElement();
+ playGroundElement = (const TQDomElement &) playGroundsList.item(i).toElement();
menuItemsList = playGroundElement.elementsByTagName("menuitem");
if (menuItemsList.count() != 1)
return false;
- menuItemElement = (const QDomElement &) menuItemsList.item(0).toElement();
+ menuItemElement = (const TQDomElement &) menuItemsList.item(0).toElement();
labelsList = menuItemElement.elementsByTagName("label");
if (labelsList.count() != 1)
return false;
- labelElement = (const QDomElement &) labelsList.item(0).toElement();
+ labelElement = (const TQDomElement &) labelsList.item(0).toElement();
actionAttribute = menuItemElement.attributeNode("action");
topLevel->registerGameboard(labelElement.text(), actionAttribute.value().latin1());
}
@@ -358,15 +358,15 @@ bool PlayGround::registerPlayGrounds(QDomDocument &layoutDocument)
}
// Load background and draggable objects masks
-bool PlayGround::loadPlayGround(QDomDocument &layoutDocument, uint toLoad)
+bool PlayGround::loadPlayGround(TQDomDocument &layoutDocument, uint toLoad)
{
- QDomNodeList playGroundsList,
+ TQDomNodeList playGroundsList,
editableAreasList, categoriesList, objectsList,
gameAreasList, maskAreasList, soundNamesList, labelsList;
- QDomElement playGroundElement,
+ TQDomElement playGroundElement,
editableAreaElement, categoryElement, objectElement,
gameAreaElement, maskAreaElement, soundNameElement, labelElement;
- QDomAttr gameboardAttribute, masksAttribute,
+ TQDomAttr gameboardAttribute, masksAttribute,
leftAttribute, topAttribute, rightAttribute, bottomAttribute,
refAttribute;
@@ -374,7 +374,7 @@ bool PlayGround::loadPlayGround(QDomDocument &layoutDocument, uint toLoad)
if (toLoad >= playGroundsList.count())
return false;
- playGroundElement = (const QDomElement &) playGroundsList.item(toLoad).toElement();
+ playGroundElement = (const TQDomElement &) playGroundsList.item(toLoad).toElement();
gameboardAttribute = playGroundElement.attributeNode("gameboard");
if (!gameboard.load(locate("data", "ktuberling/pics/" + gameboardAttribute.value())))
@@ -388,13 +388,13 @@ bool PlayGround::loadPlayGround(QDomDocument &layoutDocument, uint toLoad)
if (editableAreasList.count() != 1)
return false;
- editableAreaElement = (const QDomElement &) editableAreasList.item(0).toElement();
+ editableAreaElement = (const TQDomElement &) editableAreasList.item(0).toElement();
gameAreasList = editableAreaElement.elementsByTagName("position");
if (gameAreasList.count() != 1)
return false;
- gameAreaElement = (const QDomElement &) gameAreasList.item(0).toElement();
+ gameAreaElement = (const TQDomElement &) gameAreasList.item(0).toElement();
leftAttribute = gameAreaElement.attributeNode("left");
topAttribute = gameAreaElement.attributeNode("top");
rightAttribute = gameAreaElement.attributeNode("right");
@@ -410,7 +410,7 @@ bool PlayGround::loadPlayGround(QDomDocument &layoutDocument, uint toLoad)
if (soundNamesList.count() != 1)
return false;
- soundNameElement = (const QDomElement &) soundNamesList.item(0).toElement();
+ soundNameElement = (const TQDomElement &) soundNamesList.item(0).toElement();
refAttribute = soundNameElement.attributeNode("ref");
editableSound = refAttribute.value();
@@ -427,13 +427,13 @@ bool PlayGround::loadPlayGround(QDomDocument &layoutDocument, uint toLoad)
for (int text = 0; text < texts; text++)
{
- categoryElement = (const QDomElement &) categoriesList.item(text).toElement();
+ categoryElement = (const TQDomElement &) categoriesList.item(text).toElement();
gameAreasList = categoryElement.elementsByTagName("position");
if (gameAreasList.count() != 1)
return false;
- gameAreaElement = (const QDomElement &) gameAreasList.item(0).toElement();
+ gameAreaElement = (const TQDomElement &) gameAreasList.item(0).toElement();
leftAttribute = gameAreaElement.attributeNode("left");
topAttribute = gameAreaElement.attributeNode("top");
rightAttribute = gameAreaElement.attributeNode("right");
@@ -449,7 +449,7 @@ bool PlayGround::loadPlayGround(QDomDocument &layoutDocument, uint toLoad)
if (labelsList.count() != 1)
return false;
- labelElement = (const QDomElement &) labelsList.item(0).toElement();
+ labelElement = (const TQDomElement &) labelsList.item(0).toElement();
textsList[text] = labelElement.text();
}
@@ -466,13 +466,13 @@ bool PlayGround::loadPlayGround(QDomDocument &layoutDocument, uint toLoad)
for (int decoration = 0; decoration < decorations; decoration++)
{
- objectElement = (const QDomElement &) objectsList.item(decoration).toElement();
+ objectElement = (const TQDomElement &) objectsList.item(decoration).toElement();
gameAreasList = objectElement.elementsByTagName("position");
if (gameAreasList.count() != 1)
return false;
- gameAreaElement = (const QDomElement &) gameAreasList.item(0).toElement();
+ gameAreaElement = (const TQDomElement &) gameAreasList.item(0).toElement();
leftAttribute = gameAreaElement.attributeNode("left");
topAttribute = gameAreaElement.attributeNode("top");
rightAttribute = gameAreaElement.attributeNode("right");
@@ -488,7 +488,7 @@ bool PlayGround::loadPlayGround(QDomDocument &layoutDocument, uint toLoad)
if (soundNamesList.count() != 1)
return false;
- soundNameElement = (const QDomElement &) soundNamesList.item(0).toElement();
+ soundNameElement = (const TQDomElement &) soundNamesList.item(0).toElement();
refAttribute = soundNameElement.attributeNode("ref");
@@ -518,7 +518,7 @@ void PlayGround::setupGeometry()
// In which decorative object are we?
// On return, the position is the location of the cursor's hot spot
// Returns false if we aren't in any zone
-bool PlayGround::zone(QPoint &position)
+bool PlayGround::zone(TQPoint &position)
{
// Scan all available decorative objects on right side because we may be adding one
int draggedNumber;
@@ -543,14 +543,14 @@ bool PlayGround::zone(QPoint &position)
currentObject = toDraw.at(draggedZOrder);
if (!currentObject->getPosition().contains(position)) continue;
- QRect toUpdate(currentObject->getPosition());
+ TQRect toUpdate(currentObject->getPosition());
draggedObject = *currentObject;
draggedNumber = draggedObject.getNumber();
- QBitmap shape(objectsLayout[draggedNumber].size());
- QPoint relative(position.x() - toUpdate.x(),
+ TQBitmap shape(objectsLayout[draggedNumber].size());
+ TQPoint relative(position.x() - toUpdate.x(),
position.y() - toUpdate.y());
- bitBlt(&shape, QPoint(0, 0), &masks, objectsLayout[draggedNumber], Qt::CopyROP);
+ bitBlt(&shape, TQPoint(0, 0), &masks, objectsLayout[draggedNumber], Qt::CopyROP);
if (!shape.convertToImage().pixelIndex(relative.x(), relative.y())) continue;
toDraw.remove(draggedZOrder);
@@ -570,14 +570,14 @@ bool PlayGround::zone(QPoint &position)
}
// Load objects and lay them down on the editable area
-bool PlayGround::loadFrom(const QString &name)
+bool PlayGround::loadFrom(const TQString &name)
{
FILE *fp;
bool eof = false;
ToDraw readObject, *newObject;
Action *newAction;
- if (!(fp = fopen(QFile::encodeName(name), "r"))) return false;
+ if (!(fp = fopen(TQFile::encodeName(name), "r"))) return false;
uint newGameboard;
int nitems = fscanf(fp, "%u\n", &newGameboard);
diff --git a/ktuberling/playground.h b/ktuberling/playground.h
index ee1a9a51..a84a7e63 100644
--- a/ktuberling/playground.h
+++ b/ktuberling/playground.h
@@ -10,9 +10,9 @@
#include <kprinter.h>
-#include <qwidget.h>
-#include <qbitmap.h>
-#include <qptrlist.h>
+#include <tqwidget.h>
+#include <tqbitmap.h>
+#include <tqptrlist.h>
#include "todraw.h"
#include "action.h"
@@ -34,50 +34,50 @@ public:
void repaintAll();
bool undo();
bool redo();
- bool loadFrom(const QString &name);
- bool saveAs(const QString &name);
+ bool loadFrom(const TQString &name);
+ bool saveAs(const TQString &name);
bool printPicture(KPrinter &printer) const;
- QPixmap getPicture() const;
+ TQPixmap getPicture() const;
inline bool isFirstAction() const { return currentAction == 0; }
inline bool isLastAction() const { return currentAction >= history.count(); }
protected:
- virtual void paintEvent(QPaintEvent *event);
- virtual void mousePressEvent(QMouseEvent *event);
- virtual void mouseReleaseEvent(QMouseEvent *event);
+ virtual void paintEvent(TQPaintEvent *event);
+ virtual void mousePressEvent(TQMouseEvent *event);
+ virtual void mouseReleaseEvent(TQMouseEvent *event);
private:
- bool registerPlayGrounds(QDomDocument &layoutDocument);
- bool loadPlayGround(QDomDocument &layoutDocument, uint toLoad);
+ bool registerPlayGrounds(TQDomDocument &layoutDocument);
+ bool loadPlayGround(TQDomDocument &layoutDocument, uint toLoad);
void loadFailure();
void setupGeometry();
- bool zone(QPoint &position);
- void drawText(QPainter &artist, QRect &area, QString &textId) const;
- void drawGameboard(QPainter &artist, const QRect &area) const;
+ bool zone(TQPoint &position);
+ void drawText(TQPainter &artist, TQRect &area, TQString &textId) const;
+ void drawGameboard(TQPainter &artist, const TQRect &area) const;
private:
- QPixmap gameboard; // Picture of the game board
- QBitmap masks; // Pictures of the objects' shapes
- QRect editableArea; // Part of the gameboard where the player can lay down objects
- QString menuItem, // Menu item describing describing this gameboard
+ TQPixmap gameboard; // Picture of the game board
+ TQBitmap masks; // Pictures of the objects' shapes
+ TQRect editableArea; // Part of the gameboard where the player can lay down objects
+ TQString menuItem, // Menu item describing describing this gameboard
editableSound; // Sound associated with this area
int texts, // Number of categories of objects names
decorations; // Number of draggable objects on the right side of the gameboard
- QRect *textsLayout, // Positions of the categories names
+ TQRect *textsLayout, // Positions of the categories names
*objectsLayout; // Position of the draggable objects on right side of the gameboard
- QString *textsList, // List of the message numbers associated with categories
+ TQString *textsList, // List of the message numbers associated with categories
*soundsList; // List of sounds associated with each object
- QCursor *draggedCursor; // Cursor's shape for currently dragged object
+ TQCursor *draggedCursor; // Cursor's shape for currently dragged object
ToDraw draggedObject; // Object currently dragged
int draggedZOrder; // Z-order (in to-draw buffer) of this object
- QPtrList<ToDraw> toDraw; // List of objects in z-order
- QPtrList<Action> history; // List of actions in chronological order
+ TQPtrList<ToDraw> toDraw; // List of objects in z-order
+ TQPtrList<Action> history; // List of actions in chronological order
unsigned int currentAction; // Number of current action (not the last one if used "undo" button!)
TopLevel *topLevel; // Top-level window
diff --git a/ktuberling/soundfactory.cpp b/ktuberling/soundfactory.cpp
index d9bdf48d..9831adcd 100644
--- a/ktuberling/soundfactory.cpp
+++ b/ktuberling/soundfactory.cpp
@@ -11,7 +11,7 @@
#include <kstandarddirs.h>
#include <kaudioplayer.h>
-#include <qdom.h>
+#include <tqdom.h>
#include "soundfactory.h"
#include "soundfactory.moc"
@@ -19,13 +19,13 @@
// Constructor
SoundFactory::SoundFactory(TopLevel *parent, const char *name, uint selectedLanguage)
- : QObject(parent, name)
+ : TQObject(parent, name)
{
topLevel = parent;
namesList = filesList = 0;
- QDomDocument layoutsDocument;
+ TQDomDocument layoutsDocument;
bool ok = topLevel->loadLayout(layoutsDocument);
if (ok) ok = registerLanguages(layoutsDocument);
if (ok) ok = loadLanguage(layoutsDocument, selectedLanguage);
@@ -42,17 +42,17 @@ SoundFactory::~SoundFactory()
// Change the language
void SoundFactory::change(uint selectedLanguage)
{
- QDomDocument layoutsDocument;
+ TQDomDocument layoutsDocument;
bool ok = topLevel->loadLayout(layoutsDocument);
if (ok) ok = loadLanguage(layoutsDocument, selectedLanguage);
if (!ok) loadFailure();
}
// Play some sound
-void SoundFactory::playSound(const QString &soundRef) const
+void SoundFactory::playSound(const TQString &soundRef) const
{
int sound;
- QString soundFile;
+ TQString soundFile;
if (!topLevel->isSoundEnabled()) return;
@@ -74,11 +74,11 @@ void SoundFactory::loadFailure()
}
// Register the various languages
-bool SoundFactory::registerLanguages(QDomDocument &layoutDocument)
+bool SoundFactory::registerLanguages(TQDomDocument &layoutDocument)
{
- QDomNodeList languagesList, menuItemsList, labelsList;
- QDomElement languageElement, menuItemElement, labelElement;
- QDomAttr codeAttribute, actionAttribute;
+ TQDomNodeList languagesList, menuItemsList, labelsList;
+ TQDomElement languageElement, menuItemElement, labelElement;
+ TQDomAttr codeAttribute, actionAttribute;
bool enabled;
languagesList = layoutDocument.elementsByTagName("language");
@@ -87,7 +87,7 @@ bool SoundFactory::registerLanguages(QDomDocument &layoutDocument)
for (uint i = 0; i < languagesList.count(); i++)
{
- languageElement = (const QDomElement &) languagesList.item(i).toElement();
+ languageElement = (const TQDomElement &) languagesList.item(i).toElement();
codeAttribute = languageElement.attributeNode("code");
enabled = locate("data", "ktuberling/sounds/" + codeAttribute.value() + "/") != 0;
@@ -95,13 +95,13 @@ bool SoundFactory::registerLanguages(QDomDocument &layoutDocument)
if (menuItemsList.count() != 1)
return false;
- menuItemElement = (const QDomElement &) menuItemsList.item(0).toElement();
+ menuItemElement = (const TQDomElement &) menuItemsList.item(0).toElement();
labelsList = menuItemElement.elementsByTagName("label");
if (labelsList.count() != 1)
return false;
- labelElement = (const QDomElement &) labelsList.item(0).toElement();
+ labelElement = (const TQDomElement &) labelsList.item(0).toElement();
actionAttribute = menuItemElement.attributeNode("action");
topLevel->registerLanguage(labelElement.text(), actionAttribute.value().latin1(), enabled);
}
@@ -110,19 +110,19 @@ bool SoundFactory::registerLanguages(QDomDocument &layoutDocument)
}
// Load the sounds of one given language
-bool SoundFactory::loadLanguage(QDomDocument &layoutDocument, uint toLoad)
+bool SoundFactory::loadLanguage(TQDomDocument &layoutDocument, uint toLoad)
{
- QDomNodeList languagesList,
+ TQDomNodeList languagesList,
soundNamesList;
- QDomElement languageElement,
+ TQDomElement languageElement,
soundNameElement;
- QDomAttr nameAttribute, fileAttribute;
+ TQDomAttr nameAttribute, fileAttribute;
languagesList = layoutDocument.elementsByTagName("language");
if (toLoad >= languagesList.count())
return false;
- languageElement = (const QDomElement &) languagesList.item(toLoad).toElement();
+ languageElement = (const TQDomElement &) languagesList.item(toLoad).toElement();
soundNamesList = languageElement.elementsByTagName("sound");
sounds = soundNamesList.count();
@@ -136,7 +136,7 @@ bool SoundFactory::loadLanguage(QDomDocument &layoutDocument, uint toLoad)
for (uint sound = 0; sound < sounds; sound++)
{
- soundNameElement = (const QDomElement &) soundNamesList.item(sound).toElement();
+ soundNameElement = (const TQDomElement &) soundNamesList.item(sound).toElement();
nameAttribute = soundNameElement.attributeNode("name");
namesList[sound] = nameAttribute.value();
diff --git a/ktuberling/soundfactory.h b/ktuberling/soundfactory.h
index 1eb0abd5..7ea0d532 100644
--- a/ktuberling/soundfactory.h
+++ b/ktuberling/soundfactory.h
@@ -8,7 +8,7 @@
#ifndef _SOUNDFACTORY_H_
#define _SOUNDFACTORY_H_
-#include "qobject.h"
+#include "tqobject.h"
class QDomDocument;
class TopLevel;
@@ -23,12 +23,12 @@ public:
~SoundFactory();
void change(uint selectedLanguage);
- void playSound(const QString &soundRef) const;
+ void playSound(const TQString &soundRef) const;
protected:
- bool registerLanguages(QDomDocument &layoutDocument);
- bool loadLanguage(QDomDocument &layoutDocument, uint toLoad);
+ bool registerLanguages(TQDomDocument &layoutDocument);
+ bool loadLanguage(TQDomDocument &layoutDocument, uint toLoad);
private:
@@ -37,7 +37,7 @@ private:
private:
int sounds; // Number of sounds
- QString *namesList, // List of sound names
+ TQString *namesList, // List of sound names
*filesList; // List of sound files associated with each sound name
TopLevel *topLevel; // Top-level window
diff --git a/ktuberling/todraw.cpp b/ktuberling/todraw.cpp
index e12c9e1b..c88328a7 100644
--- a/ktuberling/todraw.cpp
+++ b/ktuberling/todraw.cpp
@@ -4,8 +4,8 @@
------------------------------------------------------------- */
-#include <qbitmap.h>
-#include <qpainter.h>
+#include <tqbitmap.h>
+#include <tqpainter.h>
#include "todraw.h"
@@ -24,7 +24,7 @@ ToDraw::ToDraw(const ToDraw &model)
}
// Constructor with arguments
-ToDraw::ToDraw(int declaredNumber, const QRect &declaredPosition)
+ToDraw::ToDraw(int declaredNumber, const TQRect &declaredPosition)
: position(declaredPosition)
{
number = declaredNumber;
@@ -42,17 +42,17 @@ ToDraw &ToDraw::operator=(const ToDraw &model)
}
// Draw an object previously laid down on the game board
-void ToDraw::draw(QPainter &artist, const QRect &area,
- const QRect *objectsLayout,
- const QPixmap *gameboard, const QBitmap *masks) const
+void ToDraw::draw(TQPainter &artist, const TQRect &area,
+ const TQRect *objectsLayout,
+ const TQPixmap *gameboard, const TQBitmap *masks) const
{
if (!position.intersects(area)) return;
- QPixmap objectPixmap(objectsLayout[number].size());
- QBitmap shapeBitmap(objectsLayout[number].size());
+ TQPixmap objectPixmap(objectsLayout[number].size());
+ TQBitmap shapeBitmap(objectsLayout[number].size());
- bitBlt(&objectPixmap, QPoint(0, 0), gameboard, objectsLayout[number], Qt::CopyROP);
- bitBlt(&shapeBitmap, QPoint(0, 0), masks, objectsLayout[number], Qt::CopyROP);
+ bitBlt(&objectPixmap, TQPoint(0, 0), gameboard, objectsLayout[number], Qt::CopyROP);
+ bitBlt(&shapeBitmap, TQPoint(0, 0), masks, objectsLayout[number], Qt::CopyROP);
objectPixmap.setMask(shapeBitmap);
artist.drawPixmap(position.topLeft(), objectPixmap);
}
diff --git a/ktuberling/todraw.h b/ktuberling/todraw.h
index 4e46200a..a2753da3 100644
--- a/ktuberling/todraw.h
+++ b/ktuberling/todraw.h
@@ -8,7 +8,7 @@
#ifndef _TODRAW_H_
#define _TODRAW_H_
-#include <qrect.h>
+#include <tqrect.h>
#include <stdio.h>
@@ -17,19 +17,19 @@ class ToDraw
public:
ToDraw();
ToDraw(const ToDraw &);
- ToDraw(int, const QRect &);
+ ToDraw(int, const TQRect &);
ToDraw &operator=(const ToDraw &);
- void draw(QPainter &, const QRect &, const QRect *, const QPixmap *, const QBitmap *) const;
+ void draw(TQPainter &, const TQRect &, const TQRect *, const TQPixmap *, const TQBitmap *) const;
void save(FILE *) const;
bool load(FILE *, int, bool &);
inline int getNumber() const { return number; }
inline void setNumber(int newValue) { number = newValue; }
- inline const QRect &getPosition() const { return position; }
+ inline const TQRect &getPosition() const { return position; }
private:
int number;
- QRect position;
+ TQRect position;
};
#endif
diff --git a/ktuberling/toplevel.cpp b/ktuberling/toplevel.cpp
index d4ad647c..53566f17 100644
--- a/ktuberling/toplevel.cpp
+++ b/ktuberling/toplevel.cpp
@@ -15,7 +15,7 @@
#include <kstdgameaction.h>
#include <kprinter.h>
-#include <qclipboard.h>
+#include <tqclipboard.h>
#include "toplevel.moc"
#include "playground.h"
@@ -55,27 +55,27 @@ void TopLevel::enableRedo(bool enable) const
}
// Register an available gameboard
-void TopLevel::registerGameboard(const QString &menuItem, const char *actionId)
+void TopLevel::registerGameboard(const TQString &menuItem, const char *actionId)
{
KToggleAction *t = 0;
switch (gameboards)
{
- case 0: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(gameboard0()), actionCollection(), actionId);
+ case 0: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(gameboard0()), actionCollection(), actionId);
break;
- case 1: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(gameboard1()), actionCollection(), actionId);
+ case 1: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(gameboard1()), actionCollection(), actionId);
break;
- case 2: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(gameboard2()), actionCollection(), actionId);
+ case 2: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(gameboard2()), actionCollection(), actionId);
break;
- case 3: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(gameboard3()), actionCollection(), actionId);
+ case 3: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(gameboard3()), actionCollection(), actionId);
break;
- case 4: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(gameboard4()), actionCollection(), actionId);
+ case 4: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(gameboard4()), actionCollection(), actionId);
break;
- case 5: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(gameboard5()), actionCollection(), actionId);
+ case 5: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(gameboard5()), actionCollection(), actionId);
break;
- case 6: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(gameboard6()), actionCollection(), actionId);
+ case 6: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(gameboard6()), actionCollection(), actionId);
break;
- case 7: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(gameboard7()), actionCollection(), actionId);
+ case 7: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(gameboard7()), actionCollection(), actionId);
break;
}
@@ -87,43 +87,43 @@ void TopLevel::registerGameboard(const QString &menuItem, const char *actionId)
}
// Register an available language
-void TopLevel::registerLanguage(const QString &menuItem, const char *actionId, bool enabled)
+void TopLevel::registerLanguage(const TQString &menuItem, const char *actionId, bool enabled)
{
KToggleAction *t = 0;
switch (languages)
{
- case 0: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language0()), actionCollection(), actionId);
+ case 0: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language0()), actionCollection(), actionId);
break;
- case 1: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language1()), actionCollection(), actionId);
+ case 1: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language1()), actionCollection(), actionId);
break;
- case 2: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language2()), actionCollection(), actionId);
+ case 2: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language2()), actionCollection(), actionId);
break;
- case 3: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language3()), actionCollection(), actionId);
+ case 3: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language3()), actionCollection(), actionId);
break;
- case 4: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language4()), actionCollection(), actionId);
+ case 4: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language4()), actionCollection(), actionId);
break;
- case 5: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language5()), actionCollection(), actionId);
+ case 5: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language5()), actionCollection(), actionId);
break;
- case 6: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language6()), actionCollection(), actionId);
+ case 6: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language6()), actionCollection(), actionId);
break;
- case 7: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language7()), actionCollection(), actionId);
+ case 7: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language7()), actionCollection(), actionId);
break;
- case 8: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language8()), actionCollection(), actionId);
+ case 8: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language8()), actionCollection(), actionId);
break;
- case 9: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language9()), actionCollection(), actionId);
+ case 9: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language9()), actionCollection(), actionId);
break;
- case 10: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language10()), actionCollection(), actionId);
+ case 10: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language10()), actionCollection(), actionId);
break;
- case 11: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language11()), actionCollection(), actionId);
+ case 11: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language11()), actionCollection(), actionId);
break;
- case 12: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language12()), actionCollection(), actionId);
+ case 12: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language12()), actionCollection(), actionId);
break;
- case 13: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language13()), actionCollection(), actionId);
+ case 13: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language13()), actionCollection(), actionId);
break;
- case 14: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language14()), actionCollection(), actionId);
+ case 14: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language14()), actionCollection(), actionId);
break;
- case 15: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, SLOT(language15()), actionCollection(), actionId);
+ case 15: t = new KToggleAction(i18n(menuItem.latin1()), 0, this, TQT_SLOT(language15()), actionCollection(), actionId);
break;
}
@@ -187,9 +187,9 @@ void TopLevel::changeLanguage(uint newLanguage)
}
// Load the layouts file
-bool TopLevel::loadLayout(QDomDocument &layoutDocument)
+bool TopLevel::loadLayout(TQDomDocument &layoutDocument)
{
- QFile layoutFile(QFile::encodeName(locate("data", "ktuberling/pics/layout.xml")));
+ TQFile layoutFile(TQFile::encodeName(locate("data", "ktuberling/pics/layout.xml")));
if (!layoutFile.open(IO_ReadOnly))
return false;
@@ -204,7 +204,7 @@ bool TopLevel::loadLayout(QDomDocument &layoutDocument)
}
// Play a sound
-void TopLevel::playSound(const QString &ref) const
+void TopLevel::playSound(const TQString &ref) const
{
soundFactory->playSound(ref);
}
@@ -213,7 +213,7 @@ void TopLevel::playSound(const QString &ref) const
void TopLevel::readOptions()
{
KConfig *config;
- QString option;
+ TQString option;
config = KApplication::kApplication()->config();
@@ -254,22 +254,22 @@ void TopLevel::writeOptions()
void TopLevel::setupKAction()
{
//Game
- KStdGameAction::gameNew(this, SLOT(fileNew()), actionCollection());
- KStdGameAction::load(this, SLOT(fileOpen()), actionCollection());
- KStdGameAction::save(this, SLOT(fileSave()), actionCollection());
- KStdGameAction::print(this, SLOT(filePrint()), actionCollection());
- KStdGameAction::quit(kapp, SLOT(quit()), actionCollection());
- (void) new KAction(i18n("Save &as Picture..."), 0, this, SLOT(filePicture()), actionCollection(), "game_save_picture");
+ KStdGameAction::gameNew(this, TQT_SLOT(fileNew()), actionCollection());
+ KStdGameAction::load(this, TQT_SLOT(fileOpen()), actionCollection());
+ KStdGameAction::save(this, TQT_SLOT(fileSave()), actionCollection());
+ KStdGameAction::print(this, TQT_SLOT(filePrint()), actionCollection());
+ KStdGameAction::quit(kapp, TQT_SLOT(quit()), actionCollection());
+ (void) new KAction(i18n("Save &as Picture..."), 0, this, TQT_SLOT(filePicture()), actionCollection(), "game_save_picture");
//Edit
- KStdAction::copy(this, SLOT(editCopy()), actionCollection());
- KStdAction::undo(this, SLOT(editUndo()), actionCollection());
- KStdAction::redo(this, SLOT(editRedo()), actionCollection());
+ KStdAction::copy(this, TQT_SLOT(editCopy()), actionCollection());
+ KStdAction::undo(this, TQT_SLOT(editUndo()), actionCollection());
+ KStdAction::redo(this, TQT_SLOT(editRedo()), actionCollection());
enableUndo(false);
enableRedo(false);
//Speech
- KToggleAction* t = new KToggleAction(i18n("&No Sound"), 0, this, SLOT(soundOff()), actionCollection(), "speech_no_sound");
+ KToggleAction* t = new KToggleAction(i18n("&No Sound"), 0, this, TQT_SLOT(soundOff()), actionCollection(), "speech_no_sound");
if (!soundEnabled) t->setChecked(true);
setupGUI();
@@ -289,7 +289,7 @@ void TopLevel::fileNew()
// Load gameboard
void TopLevel::fileOpen()
{
- QString dir = locate("data", "ktuberling/museum/miss.tuberling");
+ TQString dir = locate("data", "ktuberling/museum/miss.tuberling");
dir.truncate(dir.findRev('/') + 1);
KURL url = KFileDialog::getOpenURL(dir, "*.tuberling");
@@ -302,7 +302,7 @@ void TopLevel::open(const KURL &url)
if (url.isEmpty())
return;
- QString name;
+ TQString name;
KIO::NetAccess::download(url, name, this);
@@ -323,7 +323,7 @@ void TopLevel::open(const KURL &url)
void TopLevel::fileSave()
{
KURL url = KFileDialog::getSaveURL
- ( QString::null,
+ ( TQString::null,
"*.tuberling");
if (url.isEmpty())
@@ -337,7 +337,7 @@ void TopLevel::fileSave()
return;
}
- QString name = url.path();
+ TQString name = url.path();
int suffix;
suffix = name.findRev('.');
@@ -353,10 +353,10 @@ void TopLevel::fileSave()
// Save gameboard as picture
void TopLevel::filePicture()
{
- QPixmap picture(playGround->getPicture());
+ TQPixmap picture(playGround->getPicture());
KURL url = KFileDialog::getSaveURL
- ( QString::null,
+ ( TQString::null,
i18n( "*.xpm|UNIX Pixmaps (*.xpm)\n"
"*.jpg|JPEG Compressed Files (*.jpg)\n"
"*.png|Next Generation Pictures (*.png)\n"
@@ -374,10 +374,10 @@ void TopLevel::filePicture()
return;
}
- QString name = url.path();
+ TQString name = url.path();
const char *format;
int suffix;
- QString end;
+ TQString end;
suffix = name.findRev('.');
if (suffix == -1)
@@ -422,8 +422,8 @@ void TopLevel::filePrint()
// Copy modified area to clipboard
void TopLevel::editCopy()
{
- QClipboard *clipboard = QApplication::clipboard();
- QPixmap picture(playGround->getPicture());
+ QClipboard *clipboard = TQApplication::clipboard();
+ TQPixmap picture(playGround->getPicture());
clipboard->setPixmap(picture);
}
diff --git a/ktuberling/toplevel.h b/ktuberling/toplevel.h
index 8d67a252..31848f0f 100644
--- a/ktuberling/toplevel.h
+++ b/ktuberling/toplevel.h
@@ -27,12 +27,12 @@ public:
void open(const KURL &url);
void enableUndo(bool enable) const;
void enableRedo(bool enable) const;
- void registerGameboard(const QString &menuItem, const char *actionId);
- void registerLanguage(const QString &menuItem, const char *actionId, bool enabled);
+ void registerGameboard(const TQString &menuItem, const char *actionId);
+ void registerLanguage(const TQString &menuItem, const char *actionId, bool enabled);
void changeGameboard(uint newGameboard);
void changeLanguage(uint newLanguage);
- bool loadLayout(QDomDocument &layoutDocument);
- void playSound(const QString &ref) const;
+ bool loadLayout(TQDomDocument &layoutDocument);
+ void playSound(const TQString &ref) const;
inline bool isSoundEnabled() const {return soundEnabled;}
inline uint getSelectedGameboard() const {return selectedGameboard;}
@@ -95,7 +95,7 @@ private:
gameboards; // Total number of gameboards
uint selectedLanguage, // Number of selected language
languages; // Total number of languages
- QString gameboardActions[8], // Name of actions for registered gameboards
+ TQString gameboardActions[8], // Name of actions for registered gameboards
languageActions[16]; // Name of actions for registered languages
PlayGround *playGround; // Play ground central widget