summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgregory guy <gregory-tde@laposte.net>2020-11-23 16:16:19 +0100
committerSlávek Banko <slavek.banko@axis.cz>2020-12-02 19:51:33 +0100
commit84575d76c007b8aad8f749d4b9dfd46d94e5c5cb (patch)
tree57295accdac6350580291a99904cd203de32da3e
parent5bf9a46ed843025016c7b7be43a1ca8754d60b79 (diff)
downloadtdegames-84575d76c007b8aad8f749d4b9dfd46d94e5c5cb.tar.gz
tdegames-84575d76c007b8aad8f749d4b9dfd46d94e5c5cb.zip
Remove QT4 stuff.
Signed-off-by: gregory guy <gregory-tde@laposte.net> (cherry picked from commit e4cea29e0476a2c250ee4a265cc51892eb4f6370)
-rw-r--r--q15/src/gameboard.cpp43
-rw-r--r--q15/src/gameboard.h20
-rw-r--r--q15/src/main.cpp11
-rw-r--r--q15/src/mainwindow.cpp24
-rw-r--r--q15/src/mainwindow.h15
5 files changed, 6 insertions, 107 deletions
diff --git a/q15/src/gameboard.cpp b/q15/src/gameboard.cpp
index d973e4e8..5b97e571 100644
--- a/q15/src/gameboard.cpp
+++ b/q15/src/gameboard.cpp
@@ -11,14 +11,6 @@
#include <stdlib.h>
-#if QT_VERSION >= 0x040000
-#include <QtGui/QApplication>
-#include <QtGui/QPainter>
-#include <QtGui/QCursor>
-#include <QtGui/QMessageBox>
-#include <QtGui/QFileDialog>
-#include <QtCore/QDateTime>
-#else
#include <ntqapplication.h>
#include <ntqpainter.h>
#include <ntqcursor.h>
@@ -26,24 +18,15 @@
#include <ntqfiledialog.h>
#include <ntqdatetime.h>
#include <ntqwmatrix.h>
-#endif
#include "gameboard.h"
-
#define DELAY 10
#define STEP 5
-
-#if QT_VERSION >= 0x040000
-BoardItem::BoardItem(int n, QWidget *parent)
- :QLabel(parent)
-#else
BoardItem::BoardItem(int n, TQWidget *parent, const char *name)
:TQLabel(parent, name)
-#endif
{
-
num = n;
}
@@ -51,7 +34,6 @@ BoardItem::~BoardItem()
{
}
-
void
BoardItem::paintEvent(TQPaintEvent *e)
{
@@ -73,13 +55,8 @@ BoardItem::paintEvent(TQPaintEvent *e)
//------------------------------------------------------------------------------
-#if QT_VERSION >= 0x040000
-GameBoard::GameBoard(QWidget *parent)
- :QWidget(parent)
-#else
GameBoard::GameBoard(TQWidget *parent, const char *name)
:TQWidget(parent, name)
-#endif
{
#include "cat.xpm"
TQPixmap xpm(cat_xpm);
@@ -109,7 +86,6 @@ GameBoard::~GameBoard()
void
GameBoard::resizeEvent(TQResizeEvent *e)
{
-
TQWidget::resizeEvent(e);
initMap();
}
@@ -126,16 +102,11 @@ GameBoard::initMap()
TQPixmap xpm;
if (!origin.isNull()) {
-#if QT_VERSION >= 0x040000
- xpm = origin.scaled(width(), height(),
- Qt::KeepAspectRatioByExpanding);
-#else
TQWMatrix mtx;
mtx.scale((float)width() / (float)origin.width(),
(float)height() / (float)origin.height());
xpm = origin.xForm(mtx);
-#endif
- }
+ }
for (i = 0; i < num; ++i) {
if (map[i] != NULL)
@@ -148,15 +119,10 @@ GameBoard::initMap()
y = (i >> 2);
x = i - (y << 2);
map[i]->move(x * w, y * h);
-#if QT_VERSION >= 0x040000
- map[i]->setPixmap(xpm.copy(map[i]->x(), map[i]->y(),
- w, h));
-#else
TQPixmap xpm1(map[i]->size());
copyBlt(&xpm1, 0, 0, &xpm,
map[i]->x(), map[i]->y(), w, h);
map[i]->setPixmap(xpm1);
-#endif
}
}
if (map[num] != NULL)
@@ -279,7 +245,6 @@ GameBoard::index(int x, int y)
void
GameBoard::startMoving(int i, int t)
{
-
n = i; nt = t;
xt = (t - (t & ~3)) * map[n]->width();
yt = (t >> 2) * map[n]->height();
@@ -382,7 +347,6 @@ GameBoard::checkEndGame()
void
GameBoard::newGame()
{
-
setEnabled(TRUE);
initMap();
newTask();
@@ -429,13 +393,8 @@ GameBoard::loadImage()
TQString str;
TQPixmap img;
-#if QT_VERSION >= 0x040000
- str = QFileDialog::getOpenFileName(this, tr("Open an image..."),
- QString::null, "*");
-#else
str = TQFileDialog::getOpenFileName(TQString::null, "*", this, NULL,
tr("Open an image..."));
-#endif
if (!str.isEmpty()) {
if (img.load(str)) {
diff --git a/q15/src/gameboard.h b/q15/src/gameboard.h
index 443522ef..12d305b8 100644
--- a/q15/src/gameboard.h
+++ b/q15/src/gameboard.h
@@ -14,30 +14,17 @@
#include <stdlib.h>
-#if QT_VERSION >= 0x040000
-#include <QtGui/QWidget>
-#include <QtGui/QLabel>
-#include <QtGui/QResizeEvent>
-#include <QtGui/QPaintEvent>
-#include <QtGui/QMouseEvent>
-#include <QtGui/QPixmap>
-#include <QtCore/QTimer>
-#else
#include <ntqwidget.h>
#include <ntqlabel.h>
#include <ntqpixmap.h>
#include <ntqtimer.h>
-#endif
class BoardItem:public TQLabel
{
public:
-#if QT_VERSION >= 0x040000
- BoardItem(int, QWidget *parent = NULL);
-#else
+
BoardItem(int, TQWidget *parent = NULL, const char *name = NULL);
-#endif
~BoardItem();
int item()const{return (num);}
@@ -55,11 +42,8 @@ class GameBoard:public TQWidget
{
Q_OBJECT
public:
-#if QT_VERSION >= 0x040000
- GameBoard(QWidget *parent = NULL);
-#else
+
GameBoard(TQWidget *parent = NULL, const char *name = NULL);
-#endif
~GameBoard();
void newGame();
diff --git a/q15/src/main.cpp b/q15/src/main.cpp
index cf90046a..b438794f 100644
--- a/q15/src/main.cpp
+++ b/q15/src/main.cpp
@@ -11,18 +11,12 @@
#include <stdlib.h>
-#if QT_VERSION >= 0x040000
-#include <QtGui/QApplication>
-#else
#include <ntqapplication.h>
-#endif
#include "mainwindow.h"
-const int
- XSize = 640,
- YSize = 480;
+const int XSize = 640, YSize = 480;
int
main(int argc, char *argv[])
@@ -31,9 +25,6 @@ main(int argc, char *argv[])
MainWindow *mw;
int result;
-#if QT_VERSION >= 0x040000
- QApplication::setFont(QFont("textbookc", 10));
-#endif
app = new TQApplication(argc, argv);
mw = new MainWindow(NULL);
diff --git a/q15/src/mainwindow.cpp b/q15/src/mainwindow.cpp
index 6b771e74..147e8d8e 100644
--- a/q15/src/mainwindow.cpp
+++ b/q15/src/mainwindow.cpp
@@ -9,32 +9,13 @@
* Hacked by:
*/
-#if QT_VERSION >= 0x040000
-#include <QtGui/QApplication>
-#else
#include <ntqapplication.h>
-#endif
#include "mainwindow.h"
-#if QT_VERSION >= 0x040000
-MainWindow::MainWindow(QWidget *parent)
- :QMainWindow(parent)
-#else
MainWindow::MainWindow(TQWidget *parent, const char *name)
:TQMainWindow(parent, name)
-#endif
{
-
-#if QT_VERSION >= 0x040000
- file = new QMenu(tr("File"), this);
- file->addAction(tr("New"), this, SLOT(newGame()), Qt::CTRL + Qt::Key_N);
- file->addAction(tr("Load an image"), this, SLOT(loadImage()),
- Qt::CTRL + Qt::Key_L);
- file->addAction(tr("Quit"), qApp, SLOT(quit()), Qt::CTRL + Qt::Key_Q);
-
- menuBar()->addMenu(file);
-#else
file = new TQPopupMenu(this);
file->insertItem(tr("New"), this, SLOT(newGame()), TQt::CTRL + TQt::Key_N);
file->insertItem(tr("Load an image"), this, SLOT(loadImage()),
@@ -42,14 +23,13 @@ MainWindow::MainWindow(TQWidget *parent, const char *name)
file->insertItem(tr("Quit"), tqApp, SLOT(quit()), TQt::CTRL + TQt::Key_Q);
menuBar()->insertItem(tr("File"), file);
-#endif
+
gb = new GameBoard(this);
setCentralWidget(gb);
}
MainWindow::~MainWindow()
{
-
delete gb;
delete file;
}
@@ -58,7 +38,6 @@ MainWindow::~MainWindow()
void
MainWindow::newGame()
{
-
gb->newGame();
}
@@ -66,7 +45,6 @@ MainWindow::newGame()
void
MainWindow::loadImage()
{
-
gb->loadImage();
}
diff --git a/q15/src/mainwindow.h b/q15/src/mainwindow.h
index 1fb9ee77..c45b0c8d 100644
--- a/q15/src/mainwindow.h
+++ b/q15/src/mainwindow.h
@@ -14,35 +14,22 @@
#include <stdlib.h>
-#if QT_VERSION >= 0x040000
-#include <QtGui/QMainWindow>
-#include <QtGui/QMenuBar>
-#include <QtGui/QMenu>
-#else
#include <ntqmainwindow.h>
#include <ntqmenubar.h>
#include <ntqpopupmenu.h>
-#endif
#include "gameboard.h"
class MainWindow:public TQMainWindow
{
Q_OBJECT
+
public:
-#if QT_VERSION >= 0x040000
- MainWindow(QWidget *parent = NULL);
-#else
MainWindow(TQWidget *parent = NULL, const char *name = NULL);
-#endif
~MainWindow();
private:
-#if QT_VERSION >= 0x040000
- QMenu *file;
-#else
TQPopupMenu *file;
-#endif
GameBoard *gb;
private slots: