From f0ab167ef3dd45bfe78e04041f0b63c91984b157 Mon Sep 17 00:00:00 2001 From: Marja Hassinen Date: Tue, 5 Jan 2010 21:51:48 +0200 Subject: [PATCH] Don't use custom css in the ui -> let's hope to get the maemo style. --- src/collections.ui | 6 +- src/game.cpp | 10 +- src/game.h | 3 +- src/game.ui | 297 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.cpp | 12 ++- src/main.ui | 283 +++---------------------------------------------- src/src.pro | 2 +- src/startlevel.ui | 6 +- 8 files changed, 329 insertions(+), 290 deletions(-) create mode 100644 src/game.ui diff --git a/src/collections.ui b/src/collections.ui index 0c209ce..de2719c 100644 --- a/src/collections.ui +++ b/src/collections.ui @@ -20,11 +20,7 @@ false - QWidget -{ - background-color: #15445d; - color: #9fb2bc; -} + diff --git a/src/game.cpp b/src/game.cpp index 62da042..1466704 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -557,12 +557,12 @@ LevelSwitcher::LevelSwitcher(GameController* gameController, QPushButton* levelStartButton, QWidget* startWidget, QLabel* startTitle, QLabel* startLabel, QPushButton* startButton, - QLabel* levelLabel, QLabel* scoreLabel, + QWidget* gameWidget, QLabel* levelLabel, QLabel* scoreLabel, QStringList collections) : gameController(gameController), levelWidget(levelWidget), levelList(levelList), levelStartButton(levelStartButton), startWidget(startWidget), startTitle(startTitle), startLabel(startLabel), startButton(startButton), - levelLabel(levelLabel), scoreLabel(scoreLabel), + gameWidget(gameWidget), levelLabel(levelLabel), scoreLabel(scoreLabel), curColl(""), level(0), totalScore(0) { connect(levelStartButton, SIGNAL(clicked()), this, SLOT(onLevelCollectionChosen())); @@ -600,6 +600,8 @@ void LevelSwitcher::chooseLevelCollection() first = false; } } + gameWidget->hide(); + startWidget->hide(); levelWidget->show(); } @@ -632,9 +634,10 @@ void LevelSwitcher::onLevelCollectionChosen() void LevelSwitcher::onStartClicked() { - startWidget->hide(); levelLabel->setText(QString::number(level+1)); gameController->startLevel(QString(LEVDIR) + "/" + levels[level] + ".dat"); + startWidget->hide(); + gameWidget->show(); } void LevelSwitcher::initiateLevel() @@ -657,6 +660,7 @@ void LevelSwitcher::initiateLevel() startButton->disconnect(); connect(startButton, SIGNAL(clicked()), this, SLOT(onStartClicked())); startLabel->setText(introText); + gameWidget->hide(); startWidget->show(); } diff --git a/src/game.h b/src/game.h index 8ec06d4..df62499 100644 --- a/src/game.h +++ b/src/game.h @@ -231,7 +231,7 @@ public: LevelSwitcher(GameController* gameController, QWidget* levelWidget, QListWidget* levelList, QPushButton* levelStartButton, QWidget* startWidget, QLabel* startTitle, QLabel* startLabel, QPushButton* startButton, - QLabel* levelLabel, QLabel* scoreLabel, + QWidget* gameWidget, QLabel* levelLabel, QLabel* scoreLabel, QStringList levels); private slots: @@ -255,6 +255,7 @@ private: QLabel* startTitle; // Not owned QLabel* startLabel; // Not owned QPushButton* startButton; // Not owned + QWidget* gameWidget; // Not owned QLabel* levelLabel; // Not owned QLabel* scoreLabel; // Not owned diff --git a/src/game.ui b/src/game.ui new file mode 100644 index 0000000..6d60420 --- /dev/null +++ b/src/game.ui @@ -0,0 +1,297 @@ + + + Game + + + + 0 + 0 + 800 + 430 + + + + Form + + + + + 270 + 60 + 510 + 365 + + + + + Sans Serif + 2 + + + + Qt::LeftToRight + + + + + + QFrame::Plain + + + 3 + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + false + + + QAbstractItemView::NoEditTriggers + + + false + + + false + + + QAbstractItemView::NoSelection + + + + 68 + 68 + + + + Qt::ElideNone + + + true + + + Qt::SolidLine + + + false + + + false + + + false + + + true + + + false + + + + + + 550 + 10 + 91 + 41 + + + + + AlArabiya + 20 + + + + Score: + + + + + + 10 + 60 + 245 + 355 + + + + QFrame::Plain + + + 3 + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + false + + + QAbstractItemView::NoEditTriggers + + + false + + + QAbstractItemView::SingleSelection + + + + 50 + 50 + + + + false + + + false + + + 6 + + + 2 + + + false + + + false + + + + + + + + + + + + + + 640 + 10 + 111 + 41 + + + + + AlArabiya + 20 + + + + + + + + + + 150 + 10 + 101 + 41 + + + + + Sans Serif + 20 + + + + Done + + + + + + 270 + 10 + 121 + 41 + + + + + AlArabiya + 20 + + + + Time left: + + + + + + 10 + 10 + 81 + 41 + + + + + AlArabiya + 20 + + + + Level: + + + + + + 390 + 10 + 111 + 41 + + + + + AlArabiya + 20 + + + + + + + + + + 90 + 10 + 51 + 41 + + + + + AlArabiya + 20 + + + + + + + + + + diff --git a/src/main.cpp b/src/main.cpp index 043a304..29c8791 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,7 @@ #include "ui_main.h" #include "ui_startlevel.h" #include "ui_collections.h" +#include "ui_game.h" #include "game.h" #include @@ -29,16 +30,19 @@ int main(int argc, char** argv) levelUi.setupUi(ui.collectionWidget); QObject::connect(levelUi.quitButton, SIGNAL(clicked()), &app, SLOT(quit())); - GameField field(ui.gameTable); - AvailablePieces pieces(ui.pieceTable); + Ui::Game gameUi; + gameUi.setupUi(ui.gameWidget); + + GameField field(gameUi.gameTable); + AvailablePieces pieces(gameUi.pieceTable); QStringList levelCollections; levelCollections << "intro" << "basic"; // TODO: read from fs - GameController controller(&pieces, &field, ui.timeLabel, ui.doneButton); + GameController controller(&pieces, &field, gameUi.timeLabel, gameUi.doneButton); LevelSwitcher switcher(&controller, ui.collectionWidget, levelUi.levelList, levelUi.startButton, ui.startWidget, startUi.startTitle, startUi.startLabel, startUi.startButton, - ui.levelLabel, ui.scoreLabel, levelCollections); + ui.gameWidget, gameUi.levelLabel, gameUi.scoreLabel, levelCollections); mainWindow.show(); diff --git a/src/main.ui b/src/main.ui index 4f4b176..97309ca 100644 --- a/src/main.ui +++ b/src/main.ui @@ -23,285 +23,26 @@ Evil Plumber - QWidget -{ - background-color: #15445d; - color: #9fb2bc; -} + - - - - 270 - 50 - 510 - 365 - - - - - Sans Serif - 2 - - - - Qt::LeftToRight - - - - - - QFrame::Plain - - - 3 - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - false - - - QAbstractItemView::NoEditTriggers - - - false - - - false - - - QAbstractItemView::NoSelection - - - - 68 - 68 - - - - Qt::ElideNone - - - true - - - Qt::SolidLine - - - false - - - false - - - false - - + + true - - - false - - - - - - 270 - 0 - 121 - 41 - - - - - AlArabiya - 20 - - - - Time left: - - - 390 - 0 - 111 - 41 - - - - - AlArabiya - 20 - - - - - - - - - - 10 - 50 - 245 - 355 - - - - QFrame::Plain - - - 3 - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - false - - - QAbstractItemView::NoEditTriggers - - - false - - - QAbstractItemView::SingleSelection - - - - 50 - 50 - - - - false - - - false - - - 6 - - - 2 - - - false - - - false - - - - - - - - - - - - - - 10 - 0 - 81 - 41 - - - - - AlArabiya - 20 - - - - Level: - - - - - - 150 - 0 - 101 - 41 - - - - Done - - - - - - 550 - 0 - 91 - 41 - - - - - AlArabiya - 20 - - - - Score: - - - - - - 640 - 0 - 111 - 41 - - - - - AlArabiya - 20 - - - - - - - - - - 90 + 0 0 - 51 - 41 + 800 + 430 - - - AlArabiya - 20 - - - + + collectionWidget - + true @@ -317,14 +58,14 @@ - + true - 0 - 0 + 10 + 10 800 430 diff --git a/src/src.pro b/src/src.pro index 7ad7ce6..d924db6 100644 --- a/src/src.pro +++ b/src/src.pro @@ -5,7 +5,7 @@ INCLUDEPATH += . # Input HEADERS += game.h -FORMS += main.ui collections.ui startlevel.ui +FORMS += main.ui collections.ui startlevel.ui game.ui SOURCES += game.cpp main.cpp include("../common.pri") diff --git a/src/startlevel.ui b/src/startlevel.ui index 5f5dcc3..06005d8 100644 --- a/src/startlevel.ui +++ b/src/startlevel.ui @@ -20,11 +20,7 @@ false - QWidget -{ - background-color: #15445d; - color: #9fb2bc; -} + -- 1.7.9.5