Remove QT4 stuff.

Signed-off-by: gregory guy <gregory-tde@laposte.net>
(cherry picked from commit e4cea29e04)
r14.0.x
gregory guy 4 years ago committed by Slávek Banko
parent 5bf9a46ed8
commit 84575d76c0
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -11,14 +11,6 @@
#include <stdlib.h> #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 <ntqapplication.h>
#include <ntqpainter.h> #include <ntqpainter.h>
#include <ntqcursor.h> #include <ntqcursor.h>
@ -26,24 +18,15 @@
#include <ntqfiledialog.h> #include <ntqfiledialog.h>
#include <ntqdatetime.h> #include <ntqdatetime.h>
#include <ntqwmatrix.h> #include <ntqwmatrix.h>
#endif
#include "gameboard.h" #include "gameboard.h"
#define DELAY 10 #define DELAY 10
#define STEP 5 #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) BoardItem::BoardItem(int n, TQWidget *parent, const char *name)
:TQLabel(parent, name) :TQLabel(parent, name)
#endif
{ {
num = n; num = n;
} }
@ -51,7 +34,6 @@ BoardItem::~BoardItem()
{ {
} }
void void
BoardItem::paintEvent(TQPaintEvent *e) 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) GameBoard::GameBoard(TQWidget *parent, const char *name)
:TQWidget(parent, name) :TQWidget(parent, name)
#endif
{ {
#include "cat.xpm" #include "cat.xpm"
TQPixmap xpm(cat_xpm); TQPixmap xpm(cat_xpm);
@ -109,7 +86,6 @@ GameBoard::~GameBoard()
void void
GameBoard::resizeEvent(TQResizeEvent *e) GameBoard::resizeEvent(TQResizeEvent *e)
{ {
TQWidget::resizeEvent(e); TQWidget::resizeEvent(e);
initMap(); initMap();
} }
@ -126,16 +102,11 @@ GameBoard::initMap()
TQPixmap xpm; TQPixmap xpm;
if (!origin.isNull()) { if (!origin.isNull()) {
#if QT_VERSION >= 0x040000
xpm = origin.scaled(width(), height(),
Qt::KeepAspectRatioByExpanding);
#else
TQWMatrix mtx; TQWMatrix mtx;
mtx.scale((float)width() / (float)origin.width(), mtx.scale((float)width() / (float)origin.width(),
(float)height() / (float)origin.height()); (float)height() / (float)origin.height());
xpm = origin.xForm(mtx); xpm = origin.xForm(mtx);
#endif }
}
for (i = 0; i < num; ++i) { for (i = 0; i < num; ++i) {
if (map[i] != NULL) if (map[i] != NULL)
@ -148,15 +119,10 @@ GameBoard::initMap()
y = (i >> 2); y = (i >> 2);
x = i - (y << 2); x = i - (y << 2);
map[i]->move(x * w, y * h); 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()); TQPixmap xpm1(map[i]->size());
copyBlt(&xpm1, 0, 0, &xpm, copyBlt(&xpm1, 0, 0, &xpm,
map[i]->x(), map[i]->y(), w, h); map[i]->x(), map[i]->y(), w, h);
map[i]->setPixmap(xpm1); map[i]->setPixmap(xpm1);
#endif
} }
} }
if (map[num] != NULL) if (map[num] != NULL)
@ -279,7 +245,6 @@ GameBoard::index(int x, int y)
void void
GameBoard::startMoving(int i, int t) GameBoard::startMoving(int i, int t)
{ {
n = i; nt = t; n = i; nt = t;
xt = (t - (t & ~3)) * map[n]->width(); xt = (t - (t & ~3)) * map[n]->width();
yt = (t >> 2) * map[n]->height(); yt = (t >> 2) * map[n]->height();
@ -382,7 +347,6 @@ GameBoard::checkEndGame()
void void
GameBoard::newGame() GameBoard::newGame()
{ {
setEnabled(TRUE); setEnabled(TRUE);
initMap(); initMap();
newTask(); newTask();
@ -429,13 +393,8 @@ GameBoard::loadImage()
TQString str; TQString str;
TQPixmap img; TQPixmap img;
#if QT_VERSION >= 0x040000
str = QFileDialog::getOpenFileName(this, tr("Open an image..."),
QString::null, "*");
#else
str = TQFileDialog::getOpenFileName(TQString::null, "*", this, NULL, str = TQFileDialog::getOpenFileName(TQString::null, "*", this, NULL,
tr("Open an image...")); tr("Open an image..."));
#endif
if (!str.isEmpty()) { if (!str.isEmpty()) {
if (img.load(str)) { if (img.load(str)) {

@ -14,30 +14,17 @@
#include <stdlib.h> #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 <ntqwidget.h>
#include <ntqlabel.h> #include <ntqlabel.h>
#include <ntqpixmap.h> #include <ntqpixmap.h>
#include <ntqtimer.h> #include <ntqtimer.h>
#endif
class BoardItem:public TQLabel class BoardItem:public TQLabel
{ {
public: public:
#if QT_VERSION >= 0x040000
BoardItem(int, QWidget *parent = NULL);
#else
BoardItem(int, TQWidget *parent = NULL, const char *name = NULL); BoardItem(int, TQWidget *parent = NULL, const char *name = NULL);
#endif
~BoardItem(); ~BoardItem();
int item()const{return (num);} int item()const{return (num);}
@ -55,11 +42,8 @@ class GameBoard:public TQWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
#if QT_VERSION >= 0x040000
GameBoard(QWidget *parent = NULL);
#else
GameBoard(TQWidget *parent = NULL, const char *name = NULL); GameBoard(TQWidget *parent = NULL, const char *name = NULL);
#endif
~GameBoard(); ~GameBoard();
void newGame(); void newGame();

@ -11,18 +11,12 @@
#include <stdlib.h> #include <stdlib.h>
#if QT_VERSION >= 0x040000
#include <QtGui/QApplication>
#else
#include <ntqapplication.h> #include <ntqapplication.h>
#endif
#include "mainwindow.h" #include "mainwindow.h"
const int const int XSize = 640, YSize = 480;
XSize = 640,
YSize = 480;
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
@ -31,9 +25,6 @@ main(int argc, char *argv[])
MainWindow *mw; MainWindow *mw;
int result; int result;
#if QT_VERSION >= 0x040000
QApplication::setFont(QFont("textbookc", 10));
#endif
app = new TQApplication(argc, argv); app = new TQApplication(argc, argv);
mw = new MainWindow(NULL); mw = new MainWindow(NULL);

@ -9,32 +9,13 @@
* Hacked by: * Hacked by:
*/ */
#if QT_VERSION >= 0x040000
#include <QtGui/QApplication>
#else
#include <ntqapplication.h> #include <ntqapplication.h>
#endif
#include "mainwindow.h" #include "mainwindow.h"
#if QT_VERSION >= 0x040000
MainWindow::MainWindow(QWidget *parent)
:QMainWindow(parent)
#else
MainWindow::MainWindow(TQWidget *parent, const char *name) MainWindow::MainWindow(TQWidget *parent, const char *name)
:TQMainWindow(parent, 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 = new TQPopupMenu(this);
file->insertItem(tr("New"), this, SLOT(newGame()), TQt::CTRL + TQt::Key_N); file->insertItem(tr("New"), this, SLOT(newGame()), TQt::CTRL + TQt::Key_N);
file->insertItem(tr("Load an image"), this, SLOT(loadImage()), 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); file->insertItem(tr("Quit"), tqApp, SLOT(quit()), TQt::CTRL + TQt::Key_Q);
menuBar()->insertItem(tr("File"), file); menuBar()->insertItem(tr("File"), file);
#endif
gb = new GameBoard(this); gb = new GameBoard(this);
setCentralWidget(gb); setCentralWidget(gb);
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
delete gb; delete gb;
delete file; delete file;
} }
@ -58,7 +38,6 @@ MainWindow::~MainWindow()
void void
MainWindow::newGame() MainWindow::newGame()
{ {
gb->newGame(); gb->newGame();
} }
@ -66,7 +45,6 @@ MainWindow::newGame()
void void
MainWindow::loadImage() MainWindow::loadImage()
{ {
gb->loadImage(); gb->loadImage();
} }

@ -14,35 +14,22 @@
#include <stdlib.h> #include <stdlib.h>
#if QT_VERSION >= 0x040000
#include <QtGui/QMainWindow>
#include <QtGui/QMenuBar>
#include <QtGui/QMenu>
#else
#include <ntqmainwindow.h> #include <ntqmainwindow.h>
#include <ntqmenubar.h> #include <ntqmenubar.h>
#include <ntqpopupmenu.h> #include <ntqpopupmenu.h>
#endif
#include "gameboard.h" #include "gameboard.h"
class MainWindow:public TQMainWindow class MainWindow:public TQMainWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
#if QT_VERSION >= 0x040000
MainWindow(QWidget *parent = NULL);
#else
MainWindow(TQWidget *parent = NULL, const char *name = NULL); MainWindow(TQWidget *parent = NULL, const char *name = NULL);
#endif
~MainWindow(); ~MainWindow();
private: private:
#if QT_VERSION >= 0x040000
QMenu *file;
#else
TQPopupMenu *file; TQPopupMenu *file;
#endif
GameBoard *gb; GameBoard *gb;
private slots: private slots:

Loading…
Cancel
Save