mirror of
git://projects.qi-hardware.com/openwrt-packages.git
synced 2025-04-21 12:27:27 +03:00
gottet:Tetris clone written in Qt, adapted for Ben
This commit is contained in:
157
gottet/patches/001-qtopia.patch
Normal file
157
gottet/patches/001-qtopia.patch
Normal file
@@ -0,0 +1,157 @@
|
||||
diff --git a/src/board.cpp b/src/board.cpp
|
||||
index 4b1888f..877a7ec 100644
|
||||
--- a/src/board.cpp
|
||||
+++ b/src/board.cpp
|
||||
@@ -54,10 +54,6 @@ Board::Board(QWidget* parent)
|
||||
m_done(false),
|
||||
m_paused(false)
|
||||
{
|
||||
-#if !defined(QTOPIA_PHONE)
|
||||
- setMinimumSize(201, 401);
|
||||
- setFocusPolicy(Qt::StrongFocus);
|
||||
-#endif
|
||||
setFocus();
|
||||
|
||||
m_shift_timer = new QTimer(this);
|
||||
@@ -174,7 +170,7 @@ void Board::pauseGame()
|
||||
}
|
||||
|
||||
update();
|
||||
- emit showMessage(tr("<big><b>Paused</b></big><br>Click to resume playing."));
|
||||
+ emit showMessage(tr("<big><b>Paused</b></big><br>Press P to resume playing."));
|
||||
|
||||
unsetCursor();
|
||||
emit pauseAvailable(false);
|
||||
@@ -402,7 +398,7 @@ void Board::gameOver()
|
||||
m_piece = 0;
|
||||
m_done = true;
|
||||
unsetCursor();
|
||||
- emit showMessage(tr("<big><b>Game Over!</b></big><br>Click to start a new game."));
|
||||
+ emit showMessage(tr("<big><b>Game Over!</b></big><br>Ctrl+N to start a new game."));
|
||||
emit gameOver(m_level, m_removed_lines, m_score);
|
||||
}
|
||||
|
||||
@@ -495,11 +491,7 @@ QPixmap Board::renderPiece(int type) const
|
||||
painter.drawRoundRect(piece[i].x * 20, piece[i].y * 20, 19, 19);
|
||||
}
|
||||
}
|
||||
-
|
||||
-#if defined(QTOPIA_PHONE)
|
||||
result = result.scaled(30,50, Qt::KeepAspectRatio);
|
||||
-#endif
|
||||
-
|
||||
return result;
|
||||
}
|
||||
|
||||
diff --git a/src/main.cpp b/src/main.cpp
|
||||
index bc3c73a..4d475ed 100644
|
||||
--- a/src/main.cpp
|
||||
+++ b/src/main.cpp
|
||||
@@ -19,15 +19,11 @@
|
||||
|
||||
#include "window.h"
|
||||
|
||||
-#if defined(QTOPIA_PHONE)
|
||||
-#include <QtopiaApplication>
|
||||
-QTOPIA_ADD_APPLICATION(QTOPIA_TARGET,Window)
|
||||
-QTOPIA_MAIN
|
||||
-#else
|
||||
-
|
||||
#include <QApplication>
|
||||
-#include <QLocale>
|
||||
-#include <QTranslator>
|
||||
+
|
||||
+#if defined(Q_WS_QWS)
|
||||
+#include <QtGui/QWSServer>
|
||||
+#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
@@ -35,18 +31,11 @@ int main(int argc, char** argv)
|
||||
app.setApplicationName("Gottet");
|
||||
app.setOrganizationDomain("gottcode.org");
|
||||
app.setOrganizationName("GottCode");
|
||||
-
|
||||
- QTranslator qt_translator;
|
||||
- qt_translator.load("qt_" + QLocale::system().name());
|
||||
- app.installTranslator(&qt_translator);
|
||||
-
|
||||
- QTranslator gottet_translator;
|
||||
- gottet_translator.load("gottet_" + QLocale::system().name());
|
||||
- app.installTranslator(&gottet_translator);
|
||||
-
|
||||
+ #if defined(Q_WS_QWS)
|
||||
+ QWSServer::setCursorVisible(false);
|
||||
+ #endif
|
||||
Window window;
|
||||
window.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
-#endif
|
||||
diff --git a/src/window.cpp b/src/window.cpp
|
||||
index c691ae5..f7e970b 100644
|
||||
--- a/src/window.cpp
|
||||
+++ b/src/window.cpp
|
||||
@@ -34,11 +34,7 @@
|
||||
#include <QPixmap>
|
||||
#include <QSettings>
|
||||
|
||||
-#if defined(QTOPIA_PHONE)
|
||||
-#include <QSoftMenuBar>
|
||||
-#else
|
||||
#include <QMenuBar>
|
||||
-#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -53,11 +49,7 @@ Window::Window(QWidget *parent, Qt::WindowFlags wf)
|
||||
|
||||
// Create preview
|
||||
m_preview = new QLabel(contents);
|
||||
-#if !defined(QTOPIA_PHONE)
|
||||
- m_preview->setFixedSize(80, 100);
|
||||
-#else
|
||||
- m_preview->setFixedSize(30, 40);
|
||||
-#endif
|
||||
+ m_preview->setFixedSize(40, 40);
|
||||
m_preview->setAutoFillBackground(true);
|
||||
{
|
||||
QPalette palette = m_preview->palette();
|
||||
@@ -99,7 +91,7 @@ Window::Window(QWidget *parent, Qt::WindowFlags wf)
|
||||
connect(m_board, SIGNAL(gameStarted()), this, SLOT(newGame()));
|
||||
|
||||
// Create overlay message
|
||||
- QLabel* message = new QLabel(tr("Click to start a new game."), contents);
|
||||
+ QLabel* message = new QLabel(tr("Ctrl+N to start a new game."), contents);
|
||||
message->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
message->setAlignment(Qt::AlignCenter);
|
||||
message->setStyleSheet(
|
||||
@@ -117,19 +109,6 @@ Window::Window(QWidget *parent, Qt::WindowFlags wf)
|
||||
connect(m_board, SIGNAL(hideMessage()), message, SLOT(clear()));
|
||||
|
||||
// Create menus
|
||||
-#if defined(QTOPIA_PHONE)
|
||||
- QMenu* menu = QSoftMenuBar::menuFor(this);
|
||||
- menu->addAction(tr("&About"), this, SLOT(about()));
|
||||
- menu->addSeparator();
|
||||
- menu->addAction(tr("&Scores"), m_score_board, SLOT(show()));
|
||||
- menu->addSeparator();
|
||||
- m_resume_action = menu->addAction(tr("&Resume"), m_board, SLOT(resumeGame()));
|
||||
- m_resume_action->setVisible(false);
|
||||
- m_pause_action = menu->addAction(tr("&Pause"), m_board, SLOT(pauseGame()));
|
||||
- m_pause_action->setEnabled(false);
|
||||
- QAction* action = menu->addAction(tr("&New Game"), m_board, SLOT(newGame()));
|
||||
- connect(action, SIGNAL(triggered(bool)), this, SLOT(newGame()));
|
||||
-#else
|
||||
QMenu* menu = menuBar()->addMenu(tr("&Game"));
|
||||
menu->addAction(tr("&New"), m_board, SLOT(newGame()), tr("Ctrl+N"));
|
||||
m_pause_action = menu->addAction(tr("&Pause"), m_board, SLOT(pauseGame()), tr("P"));
|
||||
@@ -143,7 +122,6 @@ Window::Window(QWidget *parent, Qt::WindowFlags wf)
|
||||
menu = menuBar()->addMenu(tr("&Help"));
|
||||
menu->addAction(tr("&About"), this, SLOT(about()));
|
||||
menu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt()));
|
||||
-#endif
|
||||
|
||||
// Layout window
|
||||
QGridLayout* layout = new QGridLayout(contents);
|
||||
Reference in New Issue
Block a user