From 96f0ed2e6f76af799ca3c7557affb44fbdb77bb2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timur=20Krist=C3=B3f?= Date: Thu, 19 May 2011 22:20:30 +0200 Subject: [PATCH] * Fixed an issue with translations * App close message when the main window is closed --- main.cpp | 15 +++--- mainwindow.cpp | 13 ++++- mainwindow.h | 1 + translations/puzzle-master_hu_HU.ts | 100 ++++++++++++++++++------------------ 4 files changed, 69 insertions(+), 60 deletions(-) diff --git a/main.cpp b/main.cpp index 3cbcc36..901d451 100644 --- a/main.cpp +++ b/main.cpp @@ -18,14 +18,13 @@ int main(int argc, char *argv[]) if (langCode.isEmpty() || langCode == "C") langCode = QLocale::system().name(); - if (!langCode.isEmpty() && langCode != "C") - { - QTranslator tQt, tApp; - tQt.load("qt_" + langCode, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); - tApp.load("puzzle-master_" + langCode, ":/translations"); - QApplication::installTranslator(&tQt); - QApplication::installTranslator(&tApp); - } + // qDebug() << langCode; + + QTranslator tQt, tApp; + tQt.load("qt_" + langCode, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + tApp.load("puzzle-master_" + langCode, ":/translations"); + QApplication::installTranslator(&tQt); + QApplication::installTranslator(&tApp); qsrand((uint)QTime::currentTime().msec()); settings = new QSettings(); diff --git a/mainwindow.cpp b/mainwindow.cpp index ff54b8f..358cf45 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -87,6 +87,16 @@ MainWindow::~MainWindow() delete ui; } +void MainWindow::closeEvent(QCloseEvent *event) +{ + if (QMessageBox::Yes == QMessageBox::question(this, tr("Are you sure?"), tr("Do you want to exit the game?"), QMessageBox::Yes, QMessageBox::No)) + { + event->accept(); + QApplication::instance()->quit(); + } + event->ignore(); +} + bool MainWindow::event(QEvent *event) { bool result = QMainWindow::event(event); @@ -567,6 +577,5 @@ void MainWindow::unfixCurrentOrientation() void MainWindow::exitTriggered() { - if (QMessageBox::Yes == QMessageBox::question(this, tr("Are you sure?"), tr("Do you want to exit the game?"), QMessageBox::Yes, QMessageBox::No)) - QApplication::instance()->quit(); + this->close(); } diff --git a/mainwindow.h b/mainwindow.h index 2f0f336..fe24749 100755 --- a/mainwindow.h +++ b/mainwindow.h @@ -36,6 +36,7 @@ class MainWindow : public QMainWindow protected: bool event(QEvent *event); void resizeEvent(QResizeEvent *event); + void closeEvent(QCloseEvent *event); public: explicit MainWindow(QWidget *parent = 0); diff --git a/translations/puzzle-master_hu_HU.ts b/translations/puzzle-master_hu_HU.ts index 1783021..375f688 100644 --- a/translations/puzzle-master_hu_HU.ts +++ b/translations/puzzle-master_hu_HU.ts @@ -19,22 +19,22 @@ Bezárás - + No high scores Nincs pontszám - + There are no high scores yet. Még nincs egyetlen pontszám sem. - + Clear successful! Törlés sikeres! - + High scores successfully deleted. A pontszámokat sikeresen kitöröltük! @@ -43,7 +43,7 @@ ImageChooser - + Select an image Válassz egy képet @@ -73,60 +73,60 @@ Oké - + Name the image Nevezze el a képet - + Please give a name to this image. Kérem, adjon egy nevet ennek a képnek! - - - + + + Error Hiba - + This file is either not a valid image file or not supported by your Qt installation, or you don't have enough memory to open it. Ez a fájl érvénytelen képfájl, vagy nem támogatott az Ön Qt verzióján, vagy nincs elég memória a megnyitásához. - + This file doesn't exist. Please select a file that exists. Ez a fájl nem létezik. Kérem, válasszon egy olyan fájlt, amelyik létezik! - + Please select an image Kérem, válasszon egy képet! - + You should select an image before you can start a game. Válasszon egy képet, mielőtt elkezdené a játékot! - - + + Are you sure? Biztos? - + Do you wish to clear all custom images? Szeretné letörölni az összes egyéni képet? - + Remove selected image? Törli a kijelölt képet? - + Select an image if you want to remove it. Válasszon egy képet, ha szeretné törölni azt! @@ -168,7 +168,7 @@ - + About Névjegy @@ -210,7 +210,7 @@ - + Pause Szünet @@ -225,107 +225,107 @@ Nyomja meg az új játék gombot! - - + + Generating puzzle... Kirakó elkészítése... - + Cancel Mégsem - + Error Hiba - + Could not load the selected image. Nem tudtuk betölteni a kiválasztott képet. - - + + Are you sure? Biztos? - + Are you sure you want to abandon this game? Biztosan elhagyja ezt a játékot? - - + + You rock! Ön nagymenő! - - + + Congratulations! Gratulálunk! - - + + You've successfully solved the given puzzle! Sikeresen megoldotta ezt a kirakóst. - + Fun and addictive jigsaw puzzle game Szórakoztató és addiktív kirakósjáték - + Licensed under the terms of EUPL 1.1 - 2011, Timur Kristóf Licenszelve az EUPL 1.1 feltételei szerint, 2011, Kristóf Timur - - - + + + Game paused! Játék szünetel! - + Elapsed %1 second Eltelt: %1 másodperc - + Elapsed %1 seconds Eltelt: %1 másodperc - + Resume Folytatás - - + + You now can't move the pieces. Most nem fogja tudni mozgatni a darabokat. - - + + Game resumed! Játék folytatódik! - - + + Now you can move the pieces again. Most már újból lehet mozgatni a darabokat. - + Do you want to exit the game? Szeretne kilépni a játékból? -- 2.1.4