diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:42:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:42:31 +0000 |
commit | 576eb4299a00bc053db35414406f46372a0f70f2 (patch) | |
tree | 4c030922d533821db464af566188e7d40cc8848c /kmahjongg | |
parent | 0718336b6017d1a4fc1d626544180a5a2a29ddec (diff) | |
download | tdegames-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 'kmahjongg')
-rw-r--r-- | kmahjongg/Background.cpp | 16 | ||||
-rw-r--r-- | kmahjongg/Background.h | 18 | ||||
-rw-r--r-- | kmahjongg/BoardLayout.cpp | 24 | ||||
-rw-r--r-- | kmahjongg/BoardLayout.h | 14 | ||||
-rw-r--r-- | kmahjongg/Editor.cpp | 62 | ||||
-rw-r--r-- | kmahjongg/Editor.h | 22 | ||||
-rw-r--r-- | kmahjongg/GameTimer.cpp | 14 | ||||
-rw-r--r-- | kmahjongg/GameTimer.h | 12 | ||||
-rw-r--r-- | kmahjongg/HighScore.cpp | 112 | ||||
-rw-r--r-- | kmahjongg/HighScore.h | 38 | ||||
-rw-r--r-- | kmahjongg/Preview.cpp | 116 | ||||
-rw-r--r-- | kmahjongg/Preview.h | 48 | ||||
-rw-r--r-- | kmahjongg/Tileset.cpp | 16 | ||||
-rw-r--r-- | kmahjongg/Tileset.h | 40 | ||||
-rw-r--r-- | kmahjongg/boardwidget.cpp | 64 | ||||
-rw-r--r-- | kmahjongg/boardwidget.h | 40 | ||||
-rw-r--r-- | kmahjongg/kmahjongg.cpp | 118 | ||||
-rw-r--r-- | kmahjongg/kmahjongg.h | 12 |
18 files changed, 393 insertions, 393 deletions
diff --git a/kmahjongg/Background.cpp b/kmahjongg/Background.cpp index 749607b3..432ae5fb 100644 --- a/kmahjongg/Background.cpp +++ b/kmahjongg/Background.cpp @@ -1,6 +1,6 @@ #include "Background.h" -#include <qimage.h> +#include <tqimage.h> Background::Background(): tile(true) { @@ -17,17 +17,17 @@ Background::~Background() { delete backgroundShadowPixmap; } -bool Background::load(const QString &file, short width, short height) { +bool Background::load(const TQString &file, short width, short height) { w=width; h=height; if (file == filename) { return true; } - sourceImage = new QImage(); - backgroundImage = new QImage(); - backgroundPixmap = new QPixmap(); - backgroundShadowPixmap = new QPixmap(); + sourceImage = new TQImage(); + backgroundImage = new TQImage(); + backgroundPixmap = new TQPixmap(); + backgroundShadowPixmap = new TQPixmap(); // try to load the image, return on failure if(!sourceImage->load(file )) @@ -96,13 +96,13 @@ void Background::sourceToBackground() { // blitting. backgroundPixmap->convertFromImage(*backgroundImage); - QImage tmp; + TQImage tmp; tmp.create(backgroundImage->width(), backgroundImage->height(), 32); for (int ys=0; ys < tmp.height(); ys++) { QRgb *src = (QRgb *) backgroundImage->scanLine(ys); QRgb *dst = (QRgb *) tmp.scanLine(ys); for (int xs=0; xs < tmp.width(); xs++) { - *dst=QColor(*src).dark(133).rgb(); + *dst=TQColor(*src).dark(133).rgb(); src++; dst++; } diff --git a/kmahjongg/Background.h b/kmahjongg/Background.h index 095f0f6e..a98d14df 100644 --- a/kmahjongg/Background.h +++ b/kmahjongg/Background.h @@ -1,6 +1,6 @@ #ifndef _BACKGROUND_H #define _BACKGROUND_H -#include <qstring.h> +#include <tqstring.h> class QPixmap; class QImage; @@ -15,20 +15,20 @@ class Background ~Background(); bool tile; - bool load(const QString &file, short width, short height); + bool load(const TQString &file, short width, short height); void sizeChanged(int newW, int newH); void scaleModeChanged(); - QPixmap *getBackground() {return backgroundPixmap;} - QPixmap *getShadowBackground() {return backgroundShadowPixmap;} + TQPixmap *getBackground() {return backgroundPixmap;} + TQPixmap *getShadowBackground() {return backgroundShadowPixmap;} private: void sourceToBackground(); int tileMode; // scale background = 0, tile = 1 - QImage *backgroundImage; - QImage *sourceImage; - QPixmap *backgroundPixmap; - QPixmap *backgroundShadowPixmap; - QString filename; + TQImage *backgroundImage; + TQImage *sourceImage; + TQPixmap *backgroundPixmap; + TQPixmap *backgroundShadowPixmap; + TQString filename; short w; short h; }; diff --git a/kmahjongg/BoardLayout.cpp b/kmahjongg/BoardLayout.cpp index 56659611..8da404ae 100644 --- a/kmahjongg/BoardLayout.cpp +++ b/kmahjongg/BoardLayout.cpp @@ -1,8 +1,8 @@ #include "BoardLayout.h" -#include <qfile.h> -#include <qtextstream.h> -#include <qtextcodec.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqtextcodec.h> @@ -23,13 +23,13 @@ void BoardLayout::clearBoardLayout() { initialiseBoard(); } -bool BoardLayout::saveBoardLayout(const QString where) { - QFile f(where); +bool BoardLayout::saveBoardLayout(const TQString where) { + TQFile f(where); if (!f.open(IO_ReadWrite)) { return false; } - QCString tmp = layoutMagic1_0.utf8(); + TQCString tmp = layoutMagic1_0.utf8(); if (f.writeBlock(tmp, tmp.length()) == -1) { return(false); } @@ -56,20 +56,20 @@ bool BoardLayout::saveBoardLayout(const QString where) { } -bool BoardLayout::loadBoardLayout(const QString from) +bool BoardLayout::loadBoardLayout(const TQString from) { if (from == filename) { return true; } - QFile f(from); - QString all = ""; + TQFile f(from); + TQString all = ""; if ( f.open(IO_ReadOnly) ) { - QTextStream t( &f ); - t.setCodec(QTextCodec::codecForName("UTF-8")); - QString s; + TQTextStream t( &f ); + t.setCodec(TQTextCodec::codecForName("UTF-8")); + TQString s; s = t.readLine(); if (s != layoutMagic1_0) { f.close(); diff --git a/kmahjongg/BoardLayout.h b/kmahjongg/BoardLayout.h index 60048bc9..468bf5bc 100644 --- a/kmahjongg/BoardLayout.h +++ b/kmahjongg/BoardLayout.h @@ -1,10 +1,10 @@ #ifndef __BOARD__LAYOUT_ #define __BOARD__LAYOUT_ -#include <qstring.h> +#include <tqstring.h> #include "KmTypes.h" -const QString layoutMagic1_0 = "kmahjongg-layout-v1.0"; +const TQString layoutMagic1_0 = "kmahjongg-layout-v1.0"; class BoardLayout { @@ -12,8 +12,8 @@ public: BoardLayout(); ~BoardLayout(); - bool loadBoardLayout(const QString from); - bool saveBoardLayout(const QString where); + bool loadBoardLayout(const TQString from); + bool saveBoardLayout(const TQString where); UCHAR getBoardData(short z, short y, short x) {return board[z][y][x];} // is there a tile anywhere above here (top left to bot right quarter) @@ -46,15 +46,15 @@ public: depth = 5 }; enum { maxTiles = (depth*width*height)/4 }; - QString &getFilename() {return filename;} + TQString &getFilename() {return filename;} protected: void initialiseBoard(); private: - QString filename; - QString loadedBoard; + TQString filename; + TQString loadedBoard; UCHAR board[depth][height][width]; unsigned short maxTileNum; }; diff --git a/kmahjongg/Editor.cpp b/kmahjongg/Editor.cpp index 4e141259..d11ff7b2 100644 --- a/kmahjongg/Editor.cpp +++ b/kmahjongg/Editor.cpp @@ -1,8 +1,8 @@ #include <stdlib.h> #include <kapplication.h> -#include <qlayout.h> -#include <qpainter.h> +#include <tqlayout.h> +#include <tqpainter.h> #include "Editor.h" #include "prefs.h" @@ -41,11 +41,11 @@ Editor::Editor ( - QWidget* parent, + TQWidget* parent, const char* name ) : - QDialog( parent, name, true, 0 ), tiles(false) + TQDialog( parent, name, true, 0 ), tiles(false) { clean= true; @@ -61,15 +61,15 @@ Editor::Editor drawFrame->setGeometry( 10, 40 ,sWidth ,sHeight); drawFrame->setMinimumSize( 0, 0 ); drawFrame->setMaximumSize( 32767, 32767 ); - drawFrame->setFocusPolicy( QWidget::NoFocus ); - drawFrame->setBackgroundMode( QWidget::PaletteBackground ); + drawFrame->setFocusPolicy( TQWidget::NoFocus ); + drawFrame->setBackgroundMode( TQWidget::PaletteBackground ); drawFrame->setFrameStyle( 49 ); drawFrame->setMouseTracking(true); // setup the tool bar setupToolbar(); - QVBoxLayout *layout = new QVBoxLayout(this, 1); + TQVBoxLayout *layout = new TQVBoxLayout(this, 1); layout->addWidget(topToolbar,0); layout->addWidget(drawFrame,1); layout->activate(); @@ -78,17 +78,17 @@ Editor::Editor setMinimumSize( sWidth+60, sHeight+60); setMaximumSize( sWidth+60, sHeight+60); - QString tile = Prefs::tileSet(); + TQString tile = Prefs::tileSet(); tiles.loadTileset(tile); // tell the user what we do setCaption(kapp->makeStdCaption(i18n("Edit Board Layout"))); - connect( drawFrame, SIGNAL(mousePressed(QMouseEvent *) ), - SLOT(drawFrameMousePressEvent(QMouseEvent *))); - connect( drawFrame, SIGNAL(mouseMoved(QMouseEvent *) ), - SLOT(drawFrameMouseMovedEvent(QMouseEvent *))); + connect( drawFrame, TQT_SIGNAL(mousePressed(TQMouseEvent *) ), + TQT_SLOT(drawFrameMousePressEvent(TQMouseEvent *))); + connect( drawFrame, TQT_SIGNAL(mouseMoved(TQMouseEvent *) ), + TQT_SLOT(drawFrameMouseMovedEvent(TQMouseEvent *))); statusChanged(); @@ -169,14 +169,14 @@ void Editor::setupToolbar() // status in the toolbar for now (ick) - theLabel = new QLabel(statusText(), topToolbar); + theLabel = new TQLabel(statusText(), topToolbar); int lWidth = theLabel->sizeHint().width(); topToolbar->insertWidget(ID_TOOL_STATUS,lWidth, theLabel ); topToolbar->alignItemRight( ID_TOOL_STATUS, true ); //addToolBar(topToolbar); - connect( topToolbar, SIGNAL(clicked(int) ), SLOT( topToolbarOption(int) ) ); + connect( topToolbar, TQT_SIGNAL(clicked(int) ), TQT_SLOT( topToolbarOption(int) ) ); topToolbar->updateRects(0); topToolbar->setFullSize(true); @@ -245,8 +245,8 @@ void Editor::topToolbarOption(int option) { } -QString Editor::statusText() { - QString buf; +TQString Editor::statusText() { + TQString buf; int x=currPos.x; int y=currPos.y; @@ -323,7 +323,7 @@ bool Editor::saveBoard() { if ( url.isEmpty() ) return false; - QFileInfo f( url.path() ); + TQFileInfo f( url.path() ); if ( f.exists() ) { // if it already exists, querie the user for replacement int res=KMessageBox::warningContinueCancel(this, @@ -356,7 +356,7 @@ bool Editor::testSave() int res; res=KMessageBox::warningYesNoCancel(this, i18n("The board has been modified. Would you " - "like to save the changes?"),QString::null,KStdGuiItem::save(),KStdGuiItem::dontSave()); + "like to save the changes?"),TQString::null,KStdGuiItem::save(),KStdGuiItem::dontSave()); if (res == KMessageBox::Yes) { // yes to save @@ -375,12 +375,12 @@ bool Editor::testSave() // The main paint event, draw in the grid and blit in // the tiles as specified by the layout. -void Editor::paintEvent( QPaintEvent* ) { +void Editor::paintEvent( TQPaintEvent* ) { // first we layer on a background grid - QPixmap buff; - QPixmap *dest=drawFrame->getPreviewPixmap(); + TQPixmap buff; + TQPixmap *dest=drawFrame->getPreviewPixmap(); buff.resize(dest->width(), dest->height()); drawBackground(&buff); drawTiles(&buff); @@ -389,12 +389,12 @@ void Editor::paintEvent( QPaintEvent* ) { drawFrame->repaint(false); } -void Editor::drawBackground(QPixmap *pixmap) { +void Editor::drawBackground(TQPixmap *pixmap) { - QPainter p(pixmap); + TQPainter p(pixmap); // blast in a white background - p.fillRect(0,0,pixmap->width(), pixmap->height(), QColor(white)); + p.fillRect(0,0,pixmap->width(), pixmap->height(), TQColor(white)); // now put in a grid of tile quater width squares @@ -412,11 +412,11 @@ void Editor::drawBackground(QPixmap *pixmap) { } } -void Editor::drawTiles(QPixmap *dest) { +void Editor::drawTiles(TQPixmap *dest) { - QPainter p(dest); + TQPainter p(dest); - QString tile1 = Prefs::tileSet(); + TQString tile1 = Prefs::tileSet(); tiles.loadTileset(tile1); @@ -437,7 +437,7 @@ void Editor::drawTiles(QPixmap *dest) { if (theBoard.getBoardData(z, y, x) != '1') { continue; } - QPixmap *t; + TQPixmap *t; tile=(z*BoardLayout::depth)+ (y*BoardLayout::height)+ (x*BoardLayout::width); @@ -486,7 +486,7 @@ void Editor::drawTiles(QPixmap *dest) { // we return a result too. void Editor::transformPointToPosition( - const QPoint& point, + const TQPoint& point, POSITION& MouseClickPos, bool align) { @@ -551,7 +551,7 @@ void Editor::transformPointToPosition( // we swallow the draw frames mouse clicks and process here -void Editor::drawFrameMousePressEvent( QMouseEvent* e ) +void Editor::drawFrameMousePressEvent( TQMouseEvent* e ) { POSITION mPos; @@ -608,7 +608,7 @@ void Editor::drawCursor(POSITION &p, bool visible) // we swallow the draw frames mouse moves and process here -void Editor::drawFrameMouseMovedEvent( QMouseEvent* e ){ +void Editor::drawFrameMouseMovedEvent( TQMouseEvent* e ){ POSITION mPos; diff --git a/kmahjongg/Editor.h b/kmahjongg/Editor.h index 5ced0daf..edc8f912 100644 --- a/kmahjongg/Editor.h +++ b/kmahjongg/Editor.h @@ -1,8 +1,8 @@ #ifndef _EditorLoadBase_H #define _EditorLoadBase_H -#include <qdialog.h> -#include <qframe.h> +#include <tqdialog.h> +#include <tqframe.h> #include <ktoolbar.h> #include <kstatusbar.h> #include <kfiledialog.h> @@ -22,7 +22,7 @@ public: Editor ( - QWidget* parent = NULL, + TQWidget* parent = NULL, const char* name = NULL ); @@ -32,25 +32,25 @@ public: protected slots: void topToolbarOption(int w); - void drawFrameMousePressEvent ( QMouseEvent* ); - void drawFrameMouseMovedEvent ( QMouseEvent *); + void drawFrameMousePressEvent ( TQMouseEvent* ); + void drawFrameMouseMovedEvent ( TQMouseEvent *); protected: enum {remove=98, insert=99, move=100}; - void paintEvent( QPaintEvent* pa ); + void paintEvent( TQPaintEvent* pa ); void setupToolbar(); void loadBoard(); bool saveBoard(); void newBoard(); - void drawBackground(QPixmap *to); - void drawTiles(QPixmap *to); + void drawBackground(TQPixmap *to); + void drawTiles(TQPixmap *to); bool testSave(); - void transformPointToPosition(const QPoint &, POSITION &, bool align); + void transformPointToPosition(const TQPoint &, POSITION &, bool align); void drawCursor(POSITION &p, bool visible); bool canInsert(POSITION &p); void statusChanged(); - QString statusText(); + TQString statusText(); private: int mode; int numTiles; @@ -60,7 +60,7 @@ private: BoardLayout theBoard; bool clean; POSITION currPos; - QLabel *theLabel; + TQLabel *theLabel; private: }; diff --git a/kmahjongg/GameTimer.cpp b/kmahjongg/GameTimer.cpp index 5eb827d9..f3ce4f52 100644 --- a/kmahjongg/GameTimer.cpp +++ b/kmahjongg/GameTimer.cpp @@ -11,20 +11,20 @@ // Constructs a GameTimer widget with a parent and a name. // -GameTimer::GameTimer( QWidget *parent, const char *name ) - : QLCDNumber( parent, name ) +GameTimer::GameTimer( TQWidget *parent, const char *name ) + : TQLCDNumber( parent, name ) { showingColon = false; setNumDigits(7); - setFrameStyle(QFrame::Panel | QFrame::Sunken); - setFrameStyle(QFrame::NoFrame); + setFrameStyle(TQFrame::Panel | TQFrame::Sunken); + setFrameStyle(TQFrame::NoFrame); timerMode = stopped; showTime(); // display the current time1 startTimer( 500 ); // 1/2 second timer events } -// QObject timer call back implementation -void GameTimer::timerEvent( QTimerEvent * ) +// TQObject timer call back implementation +void GameTimer::timerEvent( TQTimerEvent * ) { if (timerMode == running) theTimer=theTimer.addMSecs(500); @@ -38,7 +38,7 @@ void GameTimer::timerEvent( QTimerEvent * ) void GameTimer::showTime() { - QString s; + TQString s; showingColon = !showingColon; // toggle/blink colon switch(timerMode) { diff --git a/kmahjongg/GameTimer.h b/kmahjongg/GameTimer.h index 6cde5d11..10d97e13 100644 --- a/kmahjongg/GameTimer.h +++ b/kmahjongg/GameTimer.h @@ -16,23 +16,23 @@ #ifndef KM_GAME_TIMER #define KM_GAME_TIMER -#include <qlcdnumber.h> -#include <qdatetime.h> +#include <tqlcdnumber.h> +#include <tqdatetime.h> enum TimerMode {running = -53 , stopped= -54 , paused = -55}; -class GameTimer: public QLCDNumber +class GameTimer: public TQLCDNumber { Q_OBJECT public: - GameTimer( QWidget *parent=0, const char *name=0 ); + GameTimer( TQWidget *parent=0, const char *name=0 ); int toInt(); - QString toString() {return theTimer.toString();} + TQString toString() {return theTimer.toString();} void fromString(const char *); protected: // event handlers - void timerEvent( QTimerEvent * ); + void timerEvent( TQTimerEvent * ); public slots: void start(); diff --git a/kmahjongg/HighScore.cpp b/kmahjongg/HighScore.cpp index 2e55c15a..f59e782b 100644 --- a/kmahjongg/HighScore.cpp +++ b/kmahjongg/HighScore.cpp @@ -3,20 +3,20 @@ #include "HighScore.moc" -#include <qlabel.h> -#include <qfileinfo.h> +#include <tqlabel.h> +#include <tqfileinfo.h> #include <kmessagebox.h> #include "klocale.h" #include <kstandarddirs.h> #include <kiconloader.h> -#include <qlineedit.h> -#include <qcombobox.h> +#include <tqlineedit.h> +#include <tqcombobox.h> #include <kapplication.h> #include <kpushbutton.h> #include <kstdguiitem.h> -static const QString highScoreMagic1_0 = "kmahjongg-scores-v1.0"; -static const QString highScoreMagic1_1 = "kmahjongg-scores-v1.1"; +static const TQString highScoreMagic1_0 = "kmahjongg-scores-v1.0"; +static const TQString highScoreMagic1_1 = "kmahjongg-scores-v1.1"; static const char * highScoreFilename = "/kmahjonggHiscores"; @@ -43,11 +43,11 @@ int defTimes[numScores] = {ages, ages-1, ages-2, ages-3, HighScore::HighScore ( - QWidget* parent, + TQWidget* parent, const char* name ) : - QDialog( parent, name, true, 0 ) + TQDialog( parent, name, true, 0 ) { // form the target name @@ -55,10 +55,10 @@ HighScore::HighScore filename = locateLocal("appdata", highScoreFilename); - QFont fnt; + TQFont fnt; // Number - QLabel* qtarch_Label_3; - qtarch_Label_3 = new QLabel( this, "Label_3" ); + TQLabel* qtarch_Label_3; + qtarch_Label_3 = new TQLabel( this, "Label_3" ); qtarch_Label_3->setGeometry( 10, 45, 30, 30 ); qtarch_Label_3->setFrameStyle( 50 ); qtarch_Label_3->setText( i18n("Pos") ); @@ -70,8 +70,8 @@ HighScore::HighScore // name - QLabel* qtarch_Label_4; - qtarch_Label_4 = new QLabel( this, "Label_4" ); + TQLabel* qtarch_Label_4; + qtarch_Label_4 = new TQLabel( this, "Label_4" ); qtarch_Label_4->setGeometry( 40, 45, 150, 30 ); qtarch_Label_4->setFrameStyle( 50 ); qtarch_Label_4->setText( i18n("Name") ); @@ -79,24 +79,24 @@ HighScore::HighScore // board number - QLabel* boardTitle; - boardTitle= new QLabel( this, "" ); + TQLabel* boardTitle; + boardTitle= new TQLabel( this, "" ); boardTitle->setGeometry( 190, 45, 80, 30 ); boardTitle->setFrameStyle( 50 ); boardTitle->setText( i18n("Board") ); boardTitle->setFont(fnt); // score - QLabel* qtarch_Label_5; - qtarch_Label_5 = new QLabel( this, "Label_5" ); + TQLabel* qtarch_Label_5; + qtarch_Label_5 = new TQLabel( this, "Label_5" ); qtarch_Label_5->setGeometry( 270, 45, 70, 30 ); qtarch_Label_5->setFrameStyle( 50 ); qtarch_Label_5->setText( i18n("Score") ); qtarch_Label_5->setFont(fnt); // time - QLabel* qtarch_Label_6; - qtarch_Label_6 = new QLabel( this, "Label_6" ); + TQLabel* qtarch_Label_6; + qtarch_Label_6 = new TQLabel( this, "Label_6" ); qtarch_Label_6->setGeometry( 340, 45, 70, 30 ); qtarch_Label_6->setFrameStyle( 50 ); qtarch_Label_6->setText( i18n("Time") ); @@ -107,22 +107,22 @@ HighScore::HighScore for (int row=0; row<numScores; row++) addRow(row); - QPushButton* qtarch_PushButton_1; + TQPushButton* qtarch_PushButton_1; qtarch_PushButton_1 = new KPushButton( KStdGuiItem::ok(), this, "PushButton_1" ); qtarch_PushButton_1->setGeometry( 110+35, 340+50, 100, 30 ); qtarch_PushButton_1->setMinimumSize( 0, 0 ); qtarch_PushButton_1->setMaximumSize( 32767, 32767 ); - qtarch_PushButton_1->setFocusPolicy( QWidget::TabFocus ); + qtarch_PushButton_1->setFocusPolicy( TQWidget::TabFocus ); qtarch_PushButton_1->setAutoRepeat( false ); qtarch_PushButton_1->setAutoResize( false ); qtarch_PushButton_1->setDefault(true); - QPushButton* resetBtn; - resetBtn= new QPushButton( this, "resetBtn" ); + TQPushButton* resetBtn; + resetBtn= new TQPushButton( this, "resetBtn" ); resetBtn->setGeometry( 10, 5, 25, 25); resetBtn->setMinimumSize( 0, 0 ); resetBtn->setMaximumSize( 32767, 32767 ); - resetBtn->setFocusPolicy( QWidget::TabFocus ); + resetBtn->setFocusPolicy( TQWidget::TabFocus ); //resetBtn->setText(i18n( "Reset" )); resetBtn->setAutoRepeat( false ); resetBtn->setAutoResize( false ); @@ -136,23 +136,23 @@ HighScore::HighScore /* off screen. it is moved over and placed in position when a */ /* new name is added */ - lineEdit = new QLineEdit(this, ""); + lineEdit = new TQLineEdit(this, ""); lineEdit->setGeometry( 50, 40+(20*30), 190, 30 ); - lineEdit->setFocusPolicy(QWidget::StrongFocus); + lineEdit->setFocusPolicy(TQWidget::StrongFocus); lineEdit->setFrame(true); - lineEdit->setEchoMode(QLineEdit::Normal); + lineEdit->setEchoMode(TQLineEdit::Normal); lineEdit->setText(""); // the drop down for the board names - combo = new QComboBox( false, this, "combo" ); + combo = new TQComboBox( false, this, "combo" ); combo->setGeometry( 65, 5, 220, 25 ); combo->setMinimumSize( 0, 0 ); combo->setMaximumSize( 32767, 32767 ); - combo->setFocusPolicy( QWidget::StrongFocus ); + combo->setFocusPolicy( TQWidget::StrongFocus ); combo->setSizeLimit( 10 ); combo->setAutoResize( false ); - connect( combo, SIGNAL(activated(int)), SLOT(selectionChanged(int)) ); + connect( combo, TQT_SIGNAL(activated(int)), TQT_SLOT(selectionChanged(int)) ); resize( 350+70,390+45 ); @@ -166,12 +166,12 @@ HighScore::HighScore selectedLine = -1; - connect(lineEdit, SIGNAL( textChanged(const QString &)), - SLOT( nameChanged(const QString &))); + connect(lineEdit, TQT_SIGNAL( textChanged(const TQString &)), + TQT_SLOT( nameChanged(const TQString &))); - connect(qtarch_PushButton_1, SIGNAL(clicked()), SLOT(reject())); - connect(resetBtn, SIGNAL(clicked()), SLOT(reset())); + connect(qtarch_PushButton_1, TQT_SIGNAL(clicked()), TQT_SLOT(reject())); + connect(resetBtn, TQT_SIGNAL(clicked()), TQT_SLOT(reset())); } // free up the table structures @@ -202,7 +202,7 @@ void HighScore::loadTables() { char buff[1024]; // open the file, on error set up the default table - FILE *fp = fopen( QFile::encodeName(highScoreFile()), "r"); + FILE *fp = fopen( TQFile::encodeName(highScoreFile()), "r"); if (fp == NULL) goto error; @@ -235,7 +235,7 @@ void HighScore::loadTables() { fgets(buff, sizeof(buff), fp); if (buff[strlen(buff)-1] == '\n') buff[strlen(buff)-1] = '\0'; - t->entries[e].name=QString::fromUtf8(buff,-1); + t->entries[e].name=TQString::fromUtf8(buff,-1); } } @@ -261,7 +261,7 @@ void HighScore::saveTables() { // open the outrput file, with naff error handling - FILE *fp = fopen( QFile::encodeName(highScoreFile()), "w"); + FILE *fp = fopen( TQFile::encodeName(highScoreFile()), "w"); if (fp == NULL) return; @@ -294,7 +294,7 @@ void HighScore::saveTables() { // current table to the specified board. Create it if it does not // exist. -void HighScore::selectTable(const QString &board) { +void HighScore::selectTable(const TQString &board) { TableInstance *pos = tables; @@ -335,10 +335,10 @@ void HighScore::selectTable(const QString &board) { void HighScore::addRow(int num) { - QFont tmp; + TQFont tmp; // game number - numbersWidgets[num] = new QLabel( this); + numbersWidgets[num] = new TQLabel( this); numbersWidgets[num]->setGeometry( 10, 75+(num*30), 30, 30 ); numbersWidgets[num]->setFrameStyle( 50 ); numbersWidgets[num]->setAlignment( AlignRight | AlignVCenter ); @@ -346,19 +346,19 @@ void HighScore::addRow(int num) { // name - namesWidgets[num] = new QLabel( this); + namesWidgets[num] = new TQLabel( this); namesWidgets[num]->setGeometry( 40, 75+(num*30), 150, 30 ); namesWidgets[num]->setFrameStyle( 50 ); namesWidgets[num]->setAlignment( 289 ); // board - boardWidgets[num] = new QLabel( this); + boardWidgets[num] = new TQLabel( this); boardWidgets[num]->setGeometry( 190, 75+(num*30), 80, 30 ); boardWidgets[num]->setFrameStyle( 50 ); boardWidgets[num]->setAlignment( 289 ); // score - scoresWidgets[num] = new QLabel( this); + scoresWidgets[num] = new TQLabel( this); scoresWidgets[num]->setGeometry( 270, 75+(num*30), 70, 30 ); scoresWidgets[num]->setFrameStyle( 50 ); tmp = scoresWidgets[num]->font(); @@ -366,7 +366,7 @@ void HighScore::addRow(int num) { scoresWidgets[num]->setFont(tmp); // elapsed time - elapsedWidgets[num] = new QLabel( this); + elapsedWidgets[num] = new TQLabel( this); elapsedWidgets[num]->setGeometry( 270+70, 75+(num*30), 70, 30 ); elapsedWidgets[num]->setFrameStyle( 50 ); tmp = elapsedWidgets[num]->font(); @@ -376,9 +376,9 @@ void HighScore::addRow(int num) { } -void HighScore::copyTableToScreen(const QString &name) { +void HighScore::copyTableToScreen(const TQString &name) { char buff[256]; - QString base; + TQString base; getBoardName(name, base); selectTable(base); for (int p=0; p<numScores;p++) { @@ -399,15 +399,15 @@ void HighScore::copyTableToScreen(const QString &name) { repaint(false); } -int HighScore::exec(QString &layout) { +int HighScore::exec(TQString &layout) { copyTableToScreen(layout); - return(QDialog::exec()); + return(TQDialog::exec()); } -void HighScore::checkHighScore(int s, int e, long gameNum, QString &name) { +void HighScore::checkHighScore(int s, int e, long gameNum, TQString &name) { int pos; - QString board; + TQString board; getBoardName(name, board); // make this board name the current one! @@ -455,7 +455,7 @@ void HighScore::checkHighScore(int s, int e, long gameNum, QString &name) { } -void HighScore::nameChanged(const QString &s) { +void HighScore::nameChanged(const TQString &s) { if (selectedLine == -1) return; @@ -468,13 +468,13 @@ void HighScore::nameChanged(const QString &s) { } -void HighScore::getBoardName(QString in, QString &out) { +void HighScore::getBoardName(TQString in, TQString &out) { - QFileInfo fi( in ); + TQFileInfo fi( in ); out = fi.baseName(); } -void HighScore::setComboTo(const QString &to) { +void HighScore::setComboTo(const TQString &to) { for (int p=0; p<combo->count(); p++) { if (combo->text(p) == to) combo->setCurrentItem(p); @@ -504,7 +504,7 @@ void HighScore::reset() { return ; // delete the file - res = unlink( QFile::encodeName(highScoreFile())); + res = unlink( TQFile::encodeName(highScoreFile())); // wipe ou the in memory list of tables TableInstance *t, *d; @@ -535,7 +535,7 @@ void HighScore::reset() { copyTableToScreen("default"); } -QString &HighScore::highScoreFile() { +TQString &HighScore::highScoreFile() { return filename; } diff --git a/kmahjongg/HighScore.h b/kmahjongg/HighScore.h index 5db36819..87256826 100644 --- a/kmahjongg/HighScore.h +++ b/kmahjongg/HighScore.h @@ -2,7 +2,7 @@ #ifndef HighScore_included #define HighScore_included -#include <qdialog.h> +#include <tqdialog.h> class QLineEdit; @@ -12,7 +12,7 @@ class QLabel; const int numScores = 10; typedef struct HiScoreEntry { - QString name; + TQString name; long board; long score; long elapsed; @@ -20,7 +20,7 @@ typedef struct HiScoreEntry { }; typedef struct TableInstance { - QString name; + TQString name; HiScoreEntry entries[numScores]; TableInstance *next; }; @@ -34,41 +34,41 @@ public: HighScore ( - QWidget* parent = NULL, + TQWidget* parent = NULL, const char* name = NULL ); virtual ~HighScore(); - int exec(QString &layout); + int exec(TQString &layout); - void checkHighScore(int score, int elapsed, long game, QString &board); + void checkHighScore(int score, int elapsed, long game, TQString &board); public slots: void selectionChanged(int); protected slots: - void nameChanged(const QString &s); + void nameChanged(const TQString &s); void reset(); private: void addRow(int num); // generate one table row void loadTables(); // initialise from saved void saveTables(); // save to disc. - void getBoardName(QString in, QString &out); - void selectTable(const QString &name); - void setComboTo(const QString &to); - void copyTableToScreen(const QString &name); + void getBoardName(TQString in, TQString &out); + void selectTable(const TQString &name); + void setComboTo(const TQString &to); + void copyTableToScreen(const TQString &name); QString &highScoreFile(); int selectedLine; - QLineEdit *lineEdit; - QLabel* numbersWidgets[numScores]; - QLabel* boardWidgets[numScores]; - QLabel* namesWidgets[numScores]; - QLabel* scoresWidgets[numScores]; - QLabel* elapsedWidgets[numScores]; - QComboBox* combo; - QString filename; + TQLineEdit *lineEdit; + TQLabel* numbersWidgets[numScores]; + TQLabel* boardWidgets[numScores]; + TQLabel* namesWidgets[numScores]; + TQLabel* scoresWidgets[numScores]; + TQLabel* elapsedWidgets[numScores]; + TQComboBox* combo; + TQString filename; TableInstance *tables; TableInstance *currTable; diff --git a/kmahjongg/Preview.cpp b/kmahjongg/Preview.cpp index edd8ef79..11fbcdbd 100644 --- a/kmahjongg/Preview.cpp +++ b/kmahjongg/Preview.cpp @@ -7,33 +7,33 @@ #include <kstdguiitem.h> #include <kimageio.h> -#include <qcombobox.h> -#include <qhgroupbox.h> -#include <qimage.h> -#include <qregexp.h> -#include <qpainter.h> -#include <qvbox.h> +#include <tqcombobox.h> +#include <tqhgroupbox.h> +#include <tqimage.h> +#include <tqregexp.h> +#include <tqpainter.h> +#include <tqvbox.h> #include "prefs.h" #include "Preview.h" static const char * themeMagicV1_0= "kmahjongg-theme-v1.0"; -Preview::Preview(QWidget* parent) : KDialogBase(parent), m_tiles(true) +Preview::Preview(TQWidget* parent) : KDialogBase(parent), m_tiles(true) { KPushButton *loadButton; - QGroupBox *group; - QVBox *page; + TQGroupBox *group; + TQVBox *page; - page = new QVBox(this); + page = new TQVBox(this); - group = new QHGroupBox(page); + group = new TQHGroupBox(page); - m_combo = new QComboBox(false, group); - connect(m_combo, SIGNAL(activated(int)), SLOT(selectionChanged(int))); + m_combo = new TQComboBox(false, group); + connect(m_combo, TQT_SIGNAL(activated(int)), TQT_SLOT(selectionChanged(int))); loadButton = new KPushButton(i18n("Load..."), group); - connect( loadButton, SIGNAL(clicked()), SLOT(load()) ); + connect( loadButton, TQT_SIGNAL(clicked()), TQT_SLOT(load()) ); m_drawFrame = new FrameImage(page); m_drawFrame->setFixedSize(310, 236); @@ -73,10 +73,10 @@ void Preview::markUnchanged() void Preview::initialise(const PreviewType type) { - QString extension; - QString tile = Prefs::tileSet(); - QString back = Prefs::background(); - QString layout = Prefs::layout(); + TQString extension; + TQString tile = Prefs::tileSet(); + TQString back = Prefs::background(); + TQString layout = Prefs::layout(); // set up the concept of the current file. Initialised to the preferences // value initially. Set the caption to indicate what we are doing @@ -130,13 +130,13 @@ void Preview::initialise(const PreviewType type) // get rid of files from the last invocation m_combo->clear(); - QStringList names; - QStringList::const_iterator it, itEnd; + TQStringList names; + TQStringList::const_iterator it, itEnd; it = m_fileList.begin(); itEnd = m_fileList.end(); for ( ; it != itEnd; ++it) { - QFileInfo fi(*it); + TQFileInfo fi(*it); names << fi.baseName(); } @@ -158,7 +158,7 @@ void Preview::slotOk() { } void Preview::load() { - KURL url = KFileDialog::getOpenURL(QString::null, m_fileSelector, this, i18n("Open Board Layout" )); + KURL url = KFileDialog::getOpenURL(TQString::null, m_fileSelector, this, i18n("Open Board Layout" )); if ( !url.isEmpty() ) { m_selectedFile = url.path(); drawPreview(); @@ -174,9 +174,9 @@ void Preview::load() { void Preview::drawPreview() { - QString tile = Prefs::tileSet(); - QString back = Prefs::background(); - QString layout = Prefs::layout(); + TQString tile = Prefs::tileSet(); + TQString back = Prefs::background(); + TQString layout = Prefs::layout(); switch (m_previewType) { @@ -197,12 +197,12 @@ void Preview::drawPreview() // specified bits in (layout, background and tileset if (!m_selectedFile.isEmpty()) { - QString backRaw, layoutRaw, tilesetRaw, magic; + TQString backRaw, layoutRaw, tilesetRaw, magic; - QFile in(m_selectedFile); + TQFile in(m_selectedFile); if (in.open(IO_ReadOnly)) { - QTextStream stream(&in); + TQTextStream stream(&in); magic = stream.readLine(); if (magic != themeMagicV1_0) { @@ -217,7 +217,7 @@ void Preview::drawPreview() tile = tilesetRaw; tile.replace(":", "/kmahjongg/pics/"); - if (!QFile::exists(tile)) + if (!TQFile::exists(tile)) { tile = tilesetRaw; tile = "pics/" + tile.right(tile.length() - tile.find(":") - 1 ); @@ -226,7 +226,7 @@ void Preview::drawPreview() back = backRaw; back.replace(":", "/kmahjongg/pics/"); - if (!QFile::exists(back)) + if (!TQFile::exists(back)) { back = backRaw; back = "pics/" + back.right(back.length() - back.find(":") - 1); @@ -235,7 +235,7 @@ void Preview::drawPreview() layout = layoutRaw; layout.replace(":", "/kmahjongg/pics/"); - if (!QFile::exists(layout)) + if (!TQFile::exists(layout)) { layout = layoutRaw; layout = "pics/" + layout.right(layout.length() - layout.find(":") - 1); @@ -254,7 +254,7 @@ void Preview::drawPreview() renderTiles(tile, layout); } -void Preview::paintEvent( QPaintEvent* ){ +void Preview::paintEvent( TQPaintEvent* ){ m_drawFrame->repaint(false); } @@ -296,11 +296,11 @@ void Preview::applyChange() } // Render the background to the pixmap. -void Preview::renderBackground(const QString &bg) { - QImage img; - QImage tmp; - QPixmap *p; - QPixmap *b; +void Preview::renderBackground(const TQString &bg) { + TQImage img; + TQImage tmp; + TQPixmap *p; + TQPixmap *b; p = m_drawFrame->getPreviewPixmap(); m_back.load(bg, p->width(), p->height()); b = m_back.getBackground(); @@ -310,11 +310,11 @@ void Preview::renderBackground(const QString &bg) { // This method draws a mini-tiled board with no tiles missing. -void Preview::renderTiles(const QString &file, const QString &layout) { +void Preview::renderTiles(const TQString &file, const TQString &layout) { m_tiles.loadTileset(file, true); m_boardLayout.loadBoardLayout(layout); - QPixmap *dest = m_drawFrame->getPreviewPixmap(); + TQPixmap *dest = m_drawFrame->getPreviewPixmap(); int xOffset = m_tiles.width()/2; int yOffset = m_tiles.height()/2; short tile = 0; @@ -332,7 +332,7 @@ void Preview::renderTiles(const QString &file, const QString &layout) { if (m_boardLayout.getBoardData(z, y, x) != '1') { continue; } - QPixmap *t = m_tiles.unselectedPixmaps(tile); + TQPixmap *t = m_tiles.unselectedPixmaps(tile); // Only one compilcation. Since we render top to bottom , left // to right situations arise where...: @@ -364,14 +364,14 @@ void Preview::renderTiles(const QString &file, const QString &layout) { // this really does not belong here. It will be fixed in v1.1 onwards void Preview::saveTheme() { - QString tile = Prefs::tileSet(); - QString back = Prefs::background(); - QString layout = Prefs::layout(); + TQString tile = Prefs::tileSet(); + TQString back = Prefs::background(); + TQString layout = Prefs::layout(); - QString with = ":"; + TQString with = ":"; // we want to replace any path in the default store // with a + - QRegExp p(locate("data_dir", "/kmahjongg/pics/")); + TQRegExp p(locate("data_dir", "/kmahjongg/pics/")); back.replace(p,with); tile.replace(p,with); @@ -394,7 +394,7 @@ void Preview::saveTheme() { } // Are we over writing an existin file, or was a directory selected? - QFileInfo f( url.path() ); + TQFileInfo f( url.path() ); if( f.isDir() ) return; if (f.exists()) { @@ -402,11 +402,11 @@ void Preview::saveTheme() { int res=KMessageBox::warningContinueCancel(this, i18n("A file with that name " "already exists. Do you " - "wish to overwrite it?"),QString::null,i18n("Overwrite")); + "wish to overwrite it?"),TQString::null,i18n("Overwrite")); if (res != KMessageBox::Continue) return ; } - FILE *outFile = fopen( QFile::encodeName(url.path()), "w" ); + FILE *outFile = fopen( TQFile::encodeName(url.path()), "w" ); if (outFile == NULL) { KMessageBox::sorry(this, i18n("Could not write to file. Aborting.")); @@ -421,11 +421,11 @@ void Preview::saveTheme() { fclose(outFile); } -FrameImage::FrameImage (QWidget *parent, const char *name) - : QFrame(parent, name) +FrameImage::FrameImage (TQWidget *parent, const char *name) + : TQFrame(parent, name) { rx = -1; - thePixmap = new QPixmap(); + thePixmap = new TQPixmap(); } FrameImage::~FrameImage() @@ -434,20 +434,20 @@ FrameImage::~FrameImage() } void FrameImage::setGeometry(int x, int y, int w, int h) { - QFrame::setGeometry(x,y,w,h); + TQFrame::setGeometry(x,y,w,h); thePixmap->resize(size()); } -void FrameImage::paintEvent( QPaintEvent* pa ) +void FrameImage::paintEvent( TQPaintEvent* pa ) { - QFrame::paintEvent(pa); + TQFrame::paintEvent(pa); - QPainter p(this); + TQPainter p(this); - QPen line; + TQPen line; line.setStyle(DotLine); line.setWidth(2); line.setColor(yellow); @@ -502,11 +502,11 @@ void FrameImage::setRect(int x,int y,int w,int h, int s, int t) // Pass on the mouse presed event to our owner -void FrameImage::mousePressEvent(QMouseEvent *m) { +void FrameImage::mousePressEvent(TQMouseEvent *m) { mousePressed(m); } -void FrameImage::mouseMoveEvent(QMouseEvent *e) { +void FrameImage::mouseMoveEvent(TQMouseEvent *e) { mouseMoved(e); } diff --git a/kmahjongg/Preview.h b/kmahjongg/Preview.h index 4f58e2cd..00629c8b 100644 --- a/kmahjongg/Preview.h +++ b/kmahjongg/Preview.h @@ -3,7 +3,7 @@ #include <kdialogbase.h> -#include <qframe.h> +#include <tqframe.h> #include "Tileset.h" #include "BoardLayout.h" @@ -16,20 +16,20 @@ class FrameImage: public QFrame { Q_OBJECT public: - FrameImage(QWidget *parent=NULL, const char *name = NULL); + FrameImage(TQWidget *parent=NULL, const char *name = NULL); ~FrameImage(); void setGeometry(int x, int y, int w, int h); - QPixmap *getPreviewPixmap() {return thePixmap;} + TQPixmap *getPreviewPixmap() {return thePixmap;} void setRect(int x, int y, int w, int h, int ss, int type); signals: - void mousePressed(QMouseEvent *e); - void mouseMoved(QMouseEvent *e); + void mousePressed(TQMouseEvent *e); + void mouseMoved(TQMouseEvent *e); protected: - void mousePressEvent(QMouseEvent *e); - void mouseMoveEvent(QMouseEvent *e); - void paintEvent( QPaintEvent* pa ); + void mousePressEvent(TQMouseEvent *e); + void mouseMoveEvent(TQMouseEvent *e); + void paintEvent( TQPaintEvent* pa ); private: - QPixmap *thePixmap; + TQPixmap *thePixmap; int rx; int ry; int rw; @@ -47,7 +47,7 @@ class Preview: public KDialogBase public: enum PreviewType {background, tileset, board, theme}; - Preview(QWidget* parent); + Preview(TQWidget* parent); ~Preview(); void initialise(const PreviewType type); @@ -57,18 +57,18 @@ protected: void markUnchanged(); void markChanged(); bool isChanged(); - QPixmap *getPreviewPixmap() {return m_drawFrame->getPreviewPixmap(); } + TQPixmap *getPreviewPixmap() {return m_drawFrame->getPreviewPixmap(); } virtual void drawPreview(); void applyChange() ; - void renderBackground(const QString &bg); - void renderTiles(const QString &file, const QString &layout); - void paintEvent( QPaintEvent* pa ); + void renderBackground(const TQString &bg); + void renderTiles(const TQString &file, const TQString &layout); + void paintEvent( TQPaintEvent* pa ); signals: void boardRedraw(bool); - void loadTileset(const QString &); - void loadBackground(const QString &, bool); - void loadBoard(const QString &); + void loadTileset(const TQString &); + void loadBackground(const TQString &, bool); + void loadBoard(const TQString &); void layoutChange(); public slots: @@ -83,22 +83,22 @@ private slots: protected: FrameImage *m_drawFrame; - QComboBox *m_combo; + TQComboBox *m_combo; - QString m_selectedFile; + TQString m_selectedFile; Tileset m_tiles; BoardLayout m_boardLayout; Background m_back; private: - QString m_fileSelector; + TQString m_fileSelector; bool m_changed; - QStringList m_fileList; + TQStringList m_fileList; PreviewType m_previewType; - QString m_themeBack; - QString m_themeLayout; - QString m_themeTileset; + TQString m_themeBack; + TQString m_themeLayout; + TQString m_themeTileset; }; #endif diff --git a/kmahjongg/Tileset.cpp b/kmahjongg/Tileset.cpp index c29f9701..b7e04f4e 100644 --- a/kmahjongg/Tileset.cpp +++ b/kmahjongg/Tileset.cpp @@ -1,7 +1,7 @@ #include <stdlib.h> #include "Tileset.h" -#include <qimage.h> +#include <tqimage.h> #define mini_width 20 @@ -94,7 +94,7 @@ Tileset::~Tileset() { // method returns the address of the byte after the copied image // and can be used to fill a larger array of tiles. -QRgb *Tileset::copyTileImage(short tileX, short tileY, QRgb *to, QImage &from) { +QRgb *Tileset::copyTileImage(short tileX, short tileY, QRgb *to, TQImage &from) { QRgb *dest = to; QRgb *src; @@ -118,7 +118,7 @@ QRgb *Tileset::copyTileImage(short tileX, short tileY, QRgb *to, QImage &from) { QRgb *Tileset::createTile(short x, short y, - QRgb *det, QImage &allTiles , QRgb *face) { + QRgb *det, TQImage &allTiles , QRgb *face) { QRgb *image ; QRgb *to = det; @@ -173,10 +173,10 @@ QRgb *Tileset::createTile(short x, short y, // version, which can be used for mini tile requirements. // this gives us a small tile for previews and showing // removed tiles. -void Tileset::createPixmap(QRgb *src, QPixmap &dest, bool scale, bool shadow) +void Tileset::createPixmap(QRgb *src, TQPixmap &dest, bool scale, bool shadow) { - QImage buff; + TQImage buff; QRgb *line; buff.create(w, h, 32); @@ -187,7 +187,7 @@ void Tileset::createPixmap(QRgb *src, QPixmap &dest, bool scale, bool shadow) if (shadow) { for (int spos=0; spos <w; spos++) { - line[spos] = QColor(line[spos]).dark(133).rgb(); + line[spos] = TQColor(line[spos]).dark(133).rgb(); } } @@ -208,10 +208,10 @@ void Tileset::createPixmap(QRgb *src, QPixmap &dest, bool scale, bool shadow) // --------------------------------------------------------- -bool Tileset::loadTileset( const QString& tilesetPath, const bool isPreview) +bool Tileset::loadTileset( const TQString& tilesetPath, const bool isPreview) { - QImage qiTiles; + TQImage qiTiles; QRgb *unsel; QRgb *sel; QRgb *nextSel=0; diff --git a/kmahjongg/Tileset.h b/kmahjongg/Tileset.h index 45bc9281..3c09a37c 100644 --- a/kmahjongg/Tileset.h +++ b/kmahjongg/Tileset.h @@ -2,16 +2,16 @@ #define _TILE_SET_H_ -#include <qbitmap.h> +#include <tqbitmap.h> class Tileset { public: Tileset(bool scaled=false); ~Tileset(); - bool loadTileset(const QString &filesetPath, const bool isPreview = false); - QRgb *createTile(short x, short y, QRgb *dst, QImage &src , QRgb *face); - QRgb *copyTileImage(short tileX, short tileY, QRgb *to, QImage &from); + bool loadTileset(const TQString &filesetPath, const bool isPreview = false); + QRgb *createTile(short x, short y, QRgb *dst, TQImage &src , QRgb *face); + QRgb *copyTileImage(short tileX, short tileY, QRgb *to, TQImage &from); void setScaled(bool sc) {isScaled = sc; divisor = (sc) ? 2 : 1;} @@ -26,28 +26,28 @@ class Tileset { short qHeight() {return qh/divisor;} - QPixmap *selectedPixmaps(int num) { + TQPixmap *selectedPixmaps(int num) { if (!isScaled) return &(selectedPix[num]); else return &(selectedMiniPix[num]); } - QPixmap *unselectedPixmaps(int num) { + TQPixmap *unselectedPixmaps(int num) { if (!isScaled) return &(unselectedPix[num]); else return &(unselectedMiniPix[num]); } - QPixmap *selectedShadowPixmaps(int num) { + TQPixmap *selectedShadowPixmaps(int num) { if (!isScaled) return &(selectedShadowPix[num]); else return &(selectedShadowMiniPix[num]); } - QPixmap *unselectedShadowPixmaps(int num) { + TQPixmap *unselectedShadowPixmaps(int num) { if (!isScaled) return &(unselectedShadowPix[num]); else @@ -57,12 +57,12 @@ class Tileset { protected: enum { maxTiles=45 }; - void createPixmap(QRgb *src, QPixmap &dest, bool scale, bool shadow); + void createPixmap(QRgb *src, TQPixmap &dest, bool scale, bool shadow); private: - QBitmap maskBits; // xbm mask for the tile - QBitmap maskBitsMini; // xbm mask for the tile + TQBitmap maskBits; // xbm mask for the tile + TQBitmap maskBitsMini; // xbm mask for the tile QRgb* tiles; // Buffer containing all tiles (unselected glyphs) QRgb* selectedTiles; // Buffer containing all tiles (selected glyphs) @@ -70,15 +70,15 @@ class Tileset { // in version 0.5 we have moved ftom using images and calculating // masks etc, to using pixmaps and letting the blt do the hard work, // in hardware. - QPixmap selectedPix[maxTiles]; // selected tiles - QPixmap unselectedPix[maxTiles]; // unselected tiles - QPixmap selectedMiniPix[maxTiles]; // selected tiles - QPixmap unselectedMiniPix[maxTiles]; // unselected tiles + TQPixmap selectedPix[maxTiles]; // selected tiles + TQPixmap unselectedPix[maxTiles]; // unselected tiles + TQPixmap selectedMiniPix[maxTiles]; // selected tiles + TQPixmap unselectedMiniPix[maxTiles]; // unselected tiles - QPixmap selectedShadowPix[maxTiles]; // selected tiles as above in shadow - QPixmap unselectedShadowPix[maxTiles]; // unselected tiles - QPixmap selectedShadowMiniPix[maxTiles]; // selected tiles - QPixmap unselectedShadowMiniPix[maxTiles]; // unselected tiles + TQPixmap selectedShadowPix[maxTiles]; // selected tiles as above in shadow + TQPixmap unselectedShadowPix[maxTiles]; // unselected tiles + TQPixmap selectedShadowMiniPix[maxTiles]; // selected tiles + TQPixmap unselectedShadowMiniPix[maxTiles]; // unselected tiles @@ -96,7 +96,7 @@ class Tileset { short qh; // quarter tile height used in 3d rendering short s; // buffer size for tile (width*height) - QString filename; // cache the last file loaded to save reloading it + TQString filename; // cache the last file loaded to save reloading it bool isScaled; int divisor; }; diff --git a/kmahjongg/boardwidget.cpp b/kmahjongg/boardwidget.cpp index 9c3355ea..c8a5cd61 100644 --- a/kmahjongg/boardwidget.cpp +++ b/kmahjongg/boardwidget.cpp @@ -3,25 +3,25 @@ #include <kmessagebox.h> #include <kapplication.h> -#include <qtimer.h> -#include <qpainter.h> +#include <tqtimer.h> +#include <tqpainter.h> #include <klocale.h> #include <kstandarddirs.h> -#include <qfile.h> +#include <tqfile.h> #include <kconfig.h> /** * Constructor. * Loads tileset and background bitmaps. */ -BoardWidget::BoardWidget( QWidget* parent, const char *name ) - : QWidget( parent, name ), theTiles(false) +BoardWidget::BoardWidget( TQWidget* parent, const char *name ) + : TQWidget( parent, name ), theTiles(false) { - setBackgroundColor( QColor( 0,0,0 ) ); + setBackgroundColor( TQColor( 0,0,0 ) ); - timer = new QTimer(this); - connect( timer, SIGNAL(timeout()), - this, SLOT(helpMoveTimeout()) ); + timer = new TQTimer(this); + connect( timer, TQT_SIGNAL(timeout()), + this, TQT_SLOT(helpMoveTimeout()) ); TimerState = Stop; gamePaused = false; @@ -39,7 +39,7 @@ BoardWidget::BoardWidget( QWidget* parent, const char *name ) updateBackBuffer=true; // Load tileset. First try to load the last use tileset - QString tFile; + TQString tFile; getFileOrDefault(Prefs::tileSet(), "tileset", tFile); if (!loadTileset(tFile)){ @@ -95,13 +95,13 @@ void BoardWidget::saveSettings(){ //config->writePathEntry("Layout_file", layout); } -void BoardWidget::getFileOrDefault(QString filename, QString type, QString &res) +void BoardWidget::getFileOrDefault(TQString filename, TQString type, TQString &res) { - QString picsPos = "pics/"; + TQString picsPos = "pics/"; picsPos += "default."; picsPos += type; - if (QFile::exists(filename)) { + if (TQFile::exists(filename)) { res = filename; } else { @@ -156,7 +156,7 @@ void BoardWidget::calcShadow(int e, int y, int x, int &l, int &t, int &c) { // if a second shadow botton left to top right is rendered over it // then the shadow becomes a box (ie in the middle of the run) -void BoardWidget::shadowTopLeft(int depth, int sx, int sy, int rx, int ry, QPixmap *src, bool flag) { +void BoardWidget::shadowTopLeft(int depth, int sx, int sy, int rx, int ry, TQPixmap *src, bool flag) { if (depth) { int shadowPixels= (depth+1) * theTiles.shadowSize(); int xOffset=theTiles.qWidth()-shadowPixels; @@ -181,7 +181,7 @@ void BoardWidget::shadowTopLeft(int depth, int sx, int sy, int rx, int ry, QPixm } // Second triangular shadow generator see above -void BoardWidget::shadowBotRight(int depth, int sx, int sy, int rx, int ry, QPixmap *src, bool flag) { +void BoardWidget::shadowBotRight(int depth, int sx, int sy, int rx, int ry, TQPixmap *src, bool flag) { if (depth) { int shadowPixels= (depth+1) * theTiles.shadowSize(); int xOffset=theTiles.qWidth(); @@ -211,7 +211,7 @@ void BoardWidget::shadowBotRight(int depth, int sx, int sy, int rx, int ry, QPix -void BoardWidget::shadowArea(int z, int y, int x, int sx, int sy,int rx, int ry, QPixmap *src) +void BoardWidget::shadowArea(int z, int y, int x, int sx, int sy,int rx, int ry, TQPixmap *src) { // quick check to see if we are obscured if (z < BoardLayout::depth-1) { @@ -246,9 +246,9 @@ void BoardWidget::shadowArea(int z, int y, int x, int sx, int sy,int rx, int ry, } // --------------------------------------------------------- -void BoardWidget::paintEvent( QPaintEvent* pa ) +void BoardWidget::paintEvent( TQPaintEvent* pa ) { - QPixmap *back; + TQPixmap *back; int xx = pa->rect().left(); int xheight = pa->rect().height(); @@ -317,8 +317,8 @@ void BoardWidget::paintEvent( QPaintEvent* pa ) if (!Game.tilePresent(z,y,x)) continue; - QPixmap *t; - QPixmap *s; + TQPixmap *t; + TQPixmap *s; if (Game.hilighted[z][y][x]) { t= theTiles.selectedPixmaps( Game.Board[z][y][x]-TILE_OFFSET); @@ -438,8 +438,8 @@ void BoardWidget::stackTiles(unsigned char t, unsigned short h, unsigned short x { int ss = theTiles.shadowSize(); - QPainter p(&backBuffer); - QPen line; + TQPainter p(&backBuffer); + TQPen line; p.setBackgroundMode(OpaqueMode); p.setBackgroundColor(black); @@ -456,10 +456,10 @@ void BoardWidget::stackTiles(unsigned char t, unsigned short h, unsigned short x p.drawLine(x2, y+ss, x2, y2); p.drawLine(x+1, y2, x2, y2); - // p.fillRect(x+1, y+ss+1, theTiles.width()-ss-2, theTiles.height()-ss-2, QBrush(lightGray)); + // p.fillRect(x+1, y+ss+1, theTiles.width()-ss-2, theTiles.height()-ss-2, TQBrush(lightGray)); for (unsigned short pos=0; pos < h; pos++) { - QPixmap *p = theTiles.unselectedPixmaps(t-TILE_OFFSET); + TQPixmap *p = theTiles.unselectedPixmaps(t-TILE_OFFSET); bitBlt( &backBuffer, x+(pos*ss), y-(pos*ss), p, 0,0, p->width(), p->height(), CopyROP ); } @@ -633,7 +633,7 @@ void BoardWidget::demoMoveTimeout() break; } // restart timer - QTimer::singleShot( ANIMSPEED, this, SLOT( demoMoveTimeout() ) ); + TQTimer::singleShot( ANIMSPEED, this, TQT_SLOT( demoMoveTimeout() ) ); } } @@ -667,7 +667,7 @@ void BoardWidget::matchAnimationTimeout() } } if( TimerState == Match ) - QTimer::singleShot( ANIMSPEED, this, SLOT( matchAnimationTimeout() ) ); + TQTimer::singleShot( ANIMSPEED, this, TQT_SLOT( matchAnimationTimeout() ) ); } // --------------------------------------------------------- void BoardWidget::stopMatchAnimation() @@ -1618,7 +1618,7 @@ void BoardWidget::removeTile( POSITION& Pos , bool doRepaint) } // --------------------------------------------------------- -void BoardWidget::mousePressEvent ( QMouseEvent* event ) +void BoardWidget::mousePressEvent ( TQMouseEvent* event ) { if (gamePaused) return; @@ -1708,7 +1708,7 @@ void BoardWidget::mousePressEvent ( QMouseEvent* event ) @param MouseClickPos Output: Position in game board */ void BoardWidget::transformPointToPosition( - const QPoint& point, + const TQPoint& point, POSITION& MouseClickPos ) { @@ -1788,7 +1788,7 @@ bool BoardWidget::loadBoard( ) } // --------------------------------------------------------- -void BoardWidget::setStatusText( const QString & pszText ) +void BoardWidget::setStatusText( const TQString & pszText ) { emit statusTextChanged( pszText, gameGenerationNum ); } @@ -1797,7 +1797,7 @@ void BoardWidget::setStatusText( const QString & pszText ) // --------------------------------------------------------- bool BoardWidget::loadBackground( - const QString& pszFileName, + const TQString& pszFileName, bool bShowError ) { @@ -1919,7 +1919,7 @@ void BoardWidget::initialiseRemovedTiles() { } // --------------------------------------------------------- -bool BoardWidget::loadTileset(const QString &path) { +bool BoardWidget::loadTileset(const TQString &path) { if (theTiles.loadTileset(path)) { Prefs::setTileSet(path); @@ -1931,7 +1931,7 @@ bool BoardWidget::loadTileset(const QString &path) { } -bool BoardWidget::loadBoardLayout(const QString &file) { +bool BoardWidget::loadBoardLayout(const TQString &file) { if (theBoardLayout.loadBoardLayout(file)) { Prefs::setLayout(file); Prefs::writeConfig(); diff --git a/kmahjongg/boardwidget.h b/kmahjongg/boardwidget.h index 4c042c38..3fe7c3b7 100644 --- a/kmahjongg/boardwidget.h +++ b/kmahjongg/boardwidget.h @@ -1,8 +1,8 @@ #ifndef BOARDWIDGET_H #define BOARDWIDGET_H -#include <qwidget.h> -#include <qevent.h> +#include <tqwidget.h> +#include <tqevent.h> #include <krandomsequence.h> @@ -91,7 +91,7 @@ class BoardWidget : public QWidget Q_OBJECT public: - BoardWidget( QWidget* parent = 0, const char *name = 0 ); + BoardWidget( TQWidget* parent = 0, const char *name = 0 ); ~BoardWidget(); void calculateNewGame(int num = -1 ); @@ -107,8 +107,8 @@ class BoardWidget : public QWidget void setShowMatch( bool ); void tileSizeChanged(); long getGameNum() {return gameGenerationNum;} - QString &getBoardName(){return theBoardLayout.getFilename();} - QString &getLayoutName() {return theBoardLayout.getFilename();} + TQString &getBoardName(){return theBoardLayout.getFilename();} + TQString &getLayoutName() {return theBoardLayout.getFilename();} public slots: @@ -122,14 +122,14 @@ class BoardWidget : public QWidget void demoMoveTimeout(); void matchAnimationTimeout(); void setDisplayedWidth(); - bool loadTileset ( const QString & ); - bool loadBoardLayout( const QString& ); + bool loadTileset ( const TQString & ); + bool loadBoardLayout( const TQString& ); bool loadBoard ( ); void updateScaleMode (); void drawBoard(bool deferUpdate = true); - bool loadBackground ( const QString&, bool bShowError = true ); + bool loadBackground ( const TQString&, bool bShowError = true ); signals: - void statusTextChanged ( const QString&, long ); + void statusTextChanged ( const TQString&, long ); void tileNumberChanged ( int iMaximum, int iCurrent, int iLeft ); void demoModeChanged ( bool bActive ); @@ -137,14 +137,14 @@ class BoardWidget : public QWidget void gameOver(unsigned short removed, unsigned short cheats); protected: - void getFileOrDefault(QString filename, QString type, QString &res); - void shadowArea(int z, int y, int x, int sx, int sy, int rx, int ry, QPixmap *src); - void shadowTopLeft(int depth, int sx, int sy, int rx, int ry,QPixmap *src, bool flag); - void shadowBotRight(int depth, int sx, int sy, int rx, int ry,QPixmap *src, bool flag); - void paintEvent ( QPaintEvent* ); - void mousePressEvent ( QMouseEvent* ); - - void setStatusText ( const QString& ); + void getFileOrDefault(TQString filename, TQString type, TQString &res); + void shadowArea(int z, int y, int x, int sx, int sy, int rx, int ry, TQPixmap *src); + void shadowTopLeft(int depth, int sx, int sy, int rx, int ry,TQPixmap *src, bool flag); + void shadowBotRight(int depth, int sx, int sy, int rx, int ry,TQPixmap *src, bool flag); + void paintEvent ( TQPaintEvent* ); + void mousePressEvent ( TQMouseEvent* ); + + void setStatusText ( const TQString& ); void cancelUserSelectedTiles(); void drawTileNumber(); @@ -153,7 +153,7 @@ class BoardWidget : public QWidget void removeTile ( POSITION& , bool refresh = true); void setRemovedTilePair(POSITION &a, POSITION &b); void clearRemovedTilePair(POSITION &a, POSITION &b); - void transformPointToPosition( const QPoint&, POSITION& ); + void transformPointToPosition( const TQPoint&, POSITION& ); bool isMatchingTile( POSITION&, POSITION& ); bool generateStartPosition2(); @@ -197,10 +197,10 @@ class BoardWidget : public QWidget bool showMatch; bool showHelp; - QTimer *timer; + TQTimer *timer; // offscreen draw area. - QPixmap backBuffer; // pixmap to render to + TQPixmap backBuffer; // pixmap to render to diff --git a/kmahjongg/kmahjongg.cpp b/kmahjongg/kmahjongg.cpp index 7c18ed50..dd49fedd 100644 --- a/kmahjongg/kmahjongg.cpp +++ b/kmahjongg/kmahjongg.cpp @@ -57,7 +57,7 @@ int is_paused = 0; /** Constructor. */ -KMahjongg::KMahjongg( QWidget* parent, const char *name) +KMahjongg::KMahjongg( TQWidget* parent, const char *name) : KMainWindow(parent, name) { boardEditor = 0; @@ -80,37 +80,37 @@ KMahjongg::KMahjongg( QWidget* parent, const char *name) bDemoModeActive = false; - connect( bw, SIGNAL( statusTextChanged(const QString&, long) ), - SLOT( showStatusText(const QString&, long) ) ); + connect( bw, TQT_SIGNAL( statusTextChanged(const TQString&, long) ), + TQT_SLOT( showStatusText(const TQString&, long) ) ); - connect( bw, SIGNAL( tileNumberChanged(int,int,int) ), - SLOT( showTileNumber(int,int,int) ) ); + connect( bw, TQT_SIGNAL( tileNumberChanged(int,int,int) ), + TQT_SLOT( showTileNumber(int,int,int) ) ); - connect( bw, SIGNAL( demoModeChanged(bool) ), - SLOT( demoModeChanged(bool) ) ); + connect( bw, TQT_SIGNAL( demoModeChanged(bool) ), + TQT_SLOT( demoModeChanged(bool) ) ); - connect( bw, SIGNAL( gameOver(unsigned short , unsigned short)), this, - SLOT( gameOver(unsigned short , unsigned short))); + connect( bw, TQT_SIGNAL( gameOver(unsigned short , unsigned short)), this, + TQT_SLOT( gameOver(unsigned short , unsigned short))); - connect(bw, SIGNAL(gameCalculated()), - this, SLOT(timerReset())); + connect(bw, TQT_SIGNAL(gameCalculated()), + this, TQT_SLOT(timerReset())); // Make connections for the preview load dialog - connect( previewLoad, SIGNAL( boardRedraw(bool) ), - bw, SLOT( drawBoard(bool) ) ); + connect( previewLoad, TQT_SIGNAL( boardRedraw(bool) ), + bw, TQT_SLOT( drawBoard(bool) ) ); - connect( previewLoad, SIGNAL( layoutChange() ), - this, SLOT( newGame() ) ); + connect( previewLoad, TQT_SIGNAL( layoutChange() ), + this, TQT_SLOT( newGame() ) ); - connect( previewLoad, SIGNAL( loadBackground(const QString&, bool) ), - bw, SLOT(loadBackground(const QString&, bool) ) ); + connect( previewLoad, TQT_SIGNAL( loadBackground(const TQString&, bool) ), + bw, TQT_SLOT(loadBackground(const TQString&, bool) ) ); - connect( previewLoad, SIGNAL( loadTileset(const QString &) ), - bw, SLOT(loadTileset(const QString&) ) ); - connect( previewLoad, SIGNAL( loadBoard(const QString&) ), - SLOT(loadBoardLayout(const QString&) ) ); + connect( previewLoad, TQT_SIGNAL( loadTileset(const TQString &) ), + bw, TQT_SLOT(loadTileset(const TQString&) ) ); + connect( previewLoad, TQT_SIGNAL( loadBoard(const TQString&) ), + TQT_SLOT(loadBoardLayout(const TQString&) ) ); startNewGame( ); @@ -128,41 +128,41 @@ KMahjongg::~KMahjongg() void KMahjongg::setupKAction() { // game - KStdGameAction::gameNew(this, SLOT(newGame()), actionCollection()); - KStdGameAction::load(this, SLOT(loadGame()), actionCollection()); - KStdGameAction::save(this, SLOT(saveGame()), actionCollection()); - KStdGameAction::quit(this, SLOT(close()), actionCollection()); - KStdGameAction::restart(this, SLOT(restartGame()), actionCollection()); - new KAction(i18n("New Numbered Game..."), "newnum", 0, this, SLOT(startNewNumeric()), actionCollection(), "game_new_numeric"); - new KAction(i18n("Open Th&eme..."), 0, this, SLOT(openTheme()), actionCollection(), "game_open_theme"); - new KAction(i18n("Open &Tileset..."), 0, this, SLOT(openTileset()), actionCollection(), "game_open_tileset"); - new KAction(i18n("Open &Background..."), 0, this, SLOT(openBackground()), actionCollection(), "game_open_background"); - new KAction(i18n("Open La&yout..."), 0, this, SLOT(openLayout()), actionCollection(), "game_open_layout"); - new KAction(i18n("Sa&ve Theme..."), 0, this, SLOT(saveTheme()), actionCollection(), "game_save_theme"); + KStdGameAction::gameNew(this, TQT_SLOT(newGame()), actionCollection()); + KStdGameAction::load(this, TQT_SLOT(loadGame()), actionCollection()); + KStdGameAction::save(this, TQT_SLOT(saveGame()), actionCollection()); + KStdGameAction::quit(this, TQT_SLOT(close()), actionCollection()); + KStdGameAction::restart(this, TQT_SLOT(restartGame()), actionCollection()); + new KAction(i18n("New Numbered Game..."), "newnum", 0, this, TQT_SLOT(startNewNumeric()), actionCollection(), "game_new_numeric"); + new KAction(i18n("Open Th&eme..."), 0, this, TQT_SLOT(openTheme()), actionCollection(), "game_open_theme"); + new KAction(i18n("Open &Tileset..."), 0, this, TQT_SLOT(openTileset()), actionCollection(), "game_open_tileset"); + new KAction(i18n("Open &Background..."), 0, this, TQT_SLOT(openBackground()), actionCollection(), "game_open_background"); + new KAction(i18n("Open La&yout..."), 0, this, TQT_SLOT(openLayout()), actionCollection(), "game_open_layout"); + new KAction(i18n("Sa&ve Theme..."), 0, this, TQT_SLOT(saveTheme()), actionCollection(), "game_save_theme"); // originally "file" ends here - KStdGameAction::hint(bw, SLOT(helpMove()), actionCollection()); - new KAction(i18n("Shu&ffle"), "reload", 0, bw, SLOT(shuffle()), actionCollection(), "move_shuffle"); - demoAction = KStdGameAction::demo(this, SLOT(demoMode()), actionCollection()); - showMatchingTilesAction = new KToggleAction(i18n("Show &Matching Tiles"), 0, this, SLOT(showMatchingTiles()), actionCollection(), "options_show_matching_tiles"); + KStdGameAction::hint(bw, TQT_SLOT(helpMove()), actionCollection()); + new KAction(i18n("Shu&ffle"), "reload", 0, bw, TQT_SLOT(shuffle()), actionCollection(), "move_shuffle"); + demoAction = KStdGameAction::demo(this, TQT_SLOT(demoMode()), actionCollection()); + showMatchingTilesAction = new KToggleAction(i18n("Show &Matching Tiles"), 0, this, TQT_SLOT(showMatchingTiles()), actionCollection(), "options_show_matching_tiles"); showMatchingTilesAction->setCheckedState(i18n("Hide &Matching Tiles")); showMatchingTilesAction->setChecked(Prefs::showMatchingTiles()); bw->setShowMatch( Prefs::showMatchingTiles() ); - KStdGameAction::highscores(this, SLOT(showHighscores()), actionCollection()); - pauseAction = KStdGameAction::pause(this, SLOT(pause()), actionCollection()); + KStdGameAction::highscores(this, TQT_SLOT(showHighscores()), actionCollection()); + pauseAction = KStdGameAction::pause(this, TQT_SLOT(pause()), actionCollection()); // TODO: store the background ; open on startup // TODO: same about layout // TODO: same about theme // move - undoAction = KStdGameAction::undo(this, SLOT(undo()), actionCollection()); - redoAction = KStdGameAction::redo(this, SLOT(redo()), actionCollection()); + undoAction = KStdGameAction::undo(this, TQT_SLOT(undo()), actionCollection()); + redoAction = KStdGameAction::redo(this, TQT_SLOT(redo()), actionCollection()); // edit - new KAction(i18n("&Board Editor"), 0, this, SLOT(slotBoardEditor()), actionCollection(), "edit_board_editor"); + new KAction(i18n("&Board Editor"), 0, this, TQT_SLOT(slotBoardEditor()), actionCollection(), "edit_board_editor"); // settings - KStdAction::preferences(this, SLOT(showSettings()), actionCollection()); + KStdAction::preferences(this, TQT_SLOT(showSettings()), actionCollection()); setupGUI(); } @@ -177,18 +177,18 @@ void KMahjongg::setupStatusBar() // as compilation), in case someone comes up with a better fix. // pStatusBar->setInsertOrder( KStatusBar::RightToLeft ); - tilesLeftLabel= new QLabel("Removed: 0000/0000", statusBar()); - tilesLeftLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); + tilesLeftLabel= new TQLabel("Removed: 0000/0000", statusBar()); + tilesLeftLabel->setFrameStyle( TQFrame::Panel | TQFrame::Sunken ); statusBar()->addWidget(tilesLeftLabel, tilesLeftLabel->sizeHint().width(), ID_STATUS_GAME); - gameNumLabel = new QLabel("Game: 000000000000000000000", statusBar()); - gameNumLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); + gameNumLabel = new TQLabel("Game: 000000000000000000000", statusBar()); + gameNumLabel->setFrameStyle( TQFrame::Panel | TQFrame::Sunken ); statusBar()->addWidget(gameNumLabel, gameNumLabel->sizeHint().width(), ID_STATUS_TILENUMBER); - statusLabel= new QLabel("Kmahjongg", statusBar()); - statusLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); + statusLabel= new TQLabel("Kmahjongg", statusBar()); + statusLabel->setFrameStyle( TQFrame::Panel | TQFrame::Sunken ); statusBar()->addWidget(statusLabel, statusLabel->sizeHint().width(), ID_STATUS_MESSAGE); // pStatusBar->setAlignment( ID_STATUS_TILENUMBER, AlignCenter ); @@ -198,7 +198,7 @@ void KMahjongg::setDisplayedWidth() { bw->setDisplayedWidth(); /* setFixedSize( bw->size() + - QSize( 2, (!statusBar()->isHidden() ? statusBar()->height() : 0) + TQSize( 2, (!statusBar()->isHidden() ? statusBar()->height() : 0) + 2 + menuBar()->height() ) ); toolBar()->setFixedWidth(bw->width());*/ toolBar()->alignItemRight( ID_GAME_TIMER, true ); @@ -238,8 +238,8 @@ void KMahjongg::showSettings(){ KConfigDialog *dialog = new KConfigDialog(this, "settings", Prefs::self(), KDialogBase::Swallow); dialog->addPage(new Settings(0, "General"), i18n("General"), "package_settings"); - connect(dialog, SIGNAL(settingsChanged()), bw, SLOT(loadSettings())); - connect(dialog, SIGNAL(settingsChanged()), this, SLOT(setDisplayedWidth())); + connect(dialog, TQT_SIGNAL(settingsChanged()), bw, TQT_SLOT(loadSettings())); + connect(dialog, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(setDisplayedWidth())); dialog->show(); } @@ -394,10 +394,10 @@ void KMahjongg::gameOver( } // --------------------------------------------------------- -void KMahjongg::showStatusText( const QString &msg, long board ) +void KMahjongg::showStatusText( const TQString &msg, long board ) { statusLabel->setText(msg); - QString str = i18n("Game number: %1").arg(board); + TQString str = i18n("Game number: %1").arg(board); gameNumLabel->setText(str); } @@ -406,8 +406,8 @@ void KMahjongg::showStatusText( const QString &msg, long board ) void KMahjongg::showTileNumber( int iMaximum, int iCurrent, int iLeft ) { // Hmm... seems iCurrent is the number of remaining tiles, not removed ... - //QString szBuffer = i18n("Removed: %1/%2").arg(iCurrent).arg(iMaximum); - QString szBuffer = i18n("Removed: %1/%2 Combinations left: %3").arg(iMaximum-iCurrent).arg(iMaximum).arg(iLeft); + //TQString szBuffer = i18n("Removed: %1/%2").arg(iCurrent).arg(iMaximum); + TQString szBuffer = i18n("Removed: %1/%2 Combinations left: %3").arg(iMaximum-iCurrent).arg(iMaximum).arg(iLeft); tilesLeftLabel->setText(szBuffer); // Update here since undo allow is effected by demo mode @@ -445,7 +445,7 @@ void KMahjongg::demoModeChanged( bool bActive) } } -void KMahjongg::loadBoardLayout(const QString &file) { +void KMahjongg::loadBoardLayout(const TQString &file) { bw->loadBoardLayout(file); } @@ -458,7 +458,7 @@ void KMahjongg::tileSizeChanged() { void KMahjongg::loadGame() { GAMEDATA in; char buffer[1024]; - QString fname; + TQString fname; // Get the name of the file to load KURL url = KFileDialog::getOpenURL( NULL, "*.kmgame", this, i18n("Load Game" ) ); @@ -469,7 +469,7 @@ void KMahjongg::loadGame() { KIO::NetAccess::download( url, fname, this ); // open the file for reading - FILE *outFile = fopen( QFile::encodeName(fname), "r"); + FILE *outFile = fopen( TQFile::encodeName(fname), "r"); if (outFile == NULL) { KMessageBox::sorry(this, i18n("Could not read from file. Aborting.")); @@ -537,7 +537,7 @@ void KMahjongg::saveGame() { return; } - FILE *outFile = fopen( QFile::encodeName(url.path()), "w"); + FILE *outFile = fopen( TQFile::encodeName(url.path()), "w"); if (outFile == NULL) { KMessageBox::sorry(this, i18n("Could not write to file. Aborting.")); diff --git a/kmahjongg/kmahjongg.h b/kmahjongg/kmahjongg.h index a4b3ac3f..ce4ef504 100644 --- a/kmahjongg/kmahjongg.h +++ b/kmahjongg/kmahjongg.h @@ -53,16 +53,16 @@ class KMahjongg : public KMainWindow Q_OBJECT public: - KMahjongg( QWidget* parent = 0, const char *name = 0); + KMahjongg( TQWidget* parent = 0, const char *name = 0); ~KMahjongg(); public slots: void startNewGame( int num = -1 ); - void showStatusText ( const QString& , long); + void showStatusText ( const TQString& , long); void showTileNumber( int iMaximum, int iCurrent, int iLeft ); void demoModeChanged( bool bActive ); void gameOver( unsigned short removed, unsigned short cheats); - void loadBoardLayout(const QString&); + void loadBoardLayout(const TQString&); void setDisplayedWidth(); void newGame(); void timerReset(); @@ -99,9 +99,9 @@ private: unsigned long gameElapsedTime; BoardWidget* bw; - QLabel *gameNumLabel; - QLabel *tilesLeftLabel; - QLabel *statusLabel; + TQLabel *gameNumLabel; + TQLabel *tilesLeftLabel; + TQLabel *statusLabel; GameTimer *gameTimer; HighScore *theHighScores; |