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>
#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)) {

@ -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();

@ -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);

@ -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();
}

@ -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:

Loading…
Cancel
Save