From 92243ed48b22ee96ecfc25479660e2232976a11d Mon Sep 17 00:00:00 2001 From: Qiaoyong Zhong Date: Mon, 21 Apr 2014 04:06:02 +0800 Subject: [PATCH] specified font family and figured out an translation file issue --- 2048-qt_zh_CN.qm | Bin 734 -> 740 bytes 2048-qt_zh_CN.ts | 2 +- main.cpp | 8 ++++++-- qml/main.qml | 8 +++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/2048-qt_zh_CN.qm b/2048-qt_zh_CN.qm index 5e3784698ec98c8ba42dd20ae9fefdc8f9701fac..561fa290e20ffc3993e03eecf0d40b2fb6c88c10 100644 GIT binary patch delta 53 zcmcb|`h<0Y4d-Qs^w@a}42)kVy6W>u^Gvy13goQGWME)Q+Sp{l$f=jqRrVutf3 IUPeVm0NL6RM*si- delta 47 zcmaFDdXII24d+>g^w@a}42 Join the numbers and get to the <b>2048 tile</b>! - 把数字相加,得到<b>2048</b>! + 把相同的数字相加,得到<b>2048</b>! Game Over diff --git a/main.cpp b/main.cpp index b800816..dad4fd9 100644 --- a/main.cpp +++ b/main.cpp @@ -12,10 +12,14 @@ int main(int argc, char *argv[]) // Localization QString locale = QLocale::system().name(); - qDebug() << "Locale: " + locale; + QString tsFile = "2048-qt_" + locale; QTranslator translator; - translator.load("2048-qt_" + locale); + if (translator.load(tsFile, ".")) { + qDebug() << "Successfully loaded " + tsFile; + } else { + qDebug() << "Failed to load " + tsFile; + } app.installTranslator(&translator); QQmlApplicationEngine engine; diff --git a/qml/main.qml b/qml/main.qml index a10dffc..899ef34 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -11,7 +11,7 @@ ApplicationWindow { width: 550 height: 740 title: qsTr("2048 Game"); - flags: Qt.Window | Qt.MSWindowsFixedSizeDialogHint +// flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint | Qt.CustomizeWindowHint x: (Screen.width - width) / 2 y: (Screen.height - height) / 2 @@ -64,6 +64,7 @@ ApplicationWindow { Text { id: gameName + font.family: "Sans-serif" font.pixelSize: 55 font.bold: true text: "2048" @@ -86,6 +87,7 @@ ApplicationWindow { text: (index == 0) ? qsTr("SCORE") : qsTr("BEST") anchors.horizontalCenter: parent.horizontalCenter y: 7 + font.family: "Sans-serif" font.pixelSize: 13 color: helper.myColors.fglight } @@ -93,6 +95,7 @@ ApplicationWindow { text: scoreText anchors.horizontalCenter: parent.horizontalCenter y: 25 + font.family: "Sans-serif" font.pixelSize: 25 font.bold: true color: "white" @@ -102,6 +105,7 @@ ApplicationWindow { Text { id: addScoreText + font.family: "Sans-serif" font.pixelSize: 25 font.bold: true color: Qt.rgba(119/255, 110/255, 101/255, 0.9); @@ -142,6 +146,7 @@ ApplicationWindow { height: 40 text: qsTr("Join the numbers and get to the 2048 tile!") color: helper.myColors.fgdark + font.family: "Sans-serif" font.pixelSize: 16 verticalAlignment: Text.AlignVCenter } @@ -160,6 +165,7 @@ ApplicationWindow { anchors.centerIn: parent text: qsTr("New Game") color: helper.myColors.fgbutton + font.family: "Sans-serif" font.pixelSize: 18 font.bold: true }