- small fix to translation
authorunc0rr
Sun, 30 Jul 2006 22:18:37 +0000
changeset 93 c21ff3af56cf
parent 92 0c359a7a2356
child 94 c6eec0bdb630
- small fix to translation - Forts preview renders square pixmap
QTfrontend/CMakeLists.txt
QTfrontend/SquareLabel.cpp
QTfrontend/SquareLabel.h
QTfrontend/hedgewars.pro
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/translations/hedgewars_ru.ts
--- a/QTfrontend/CMakeLists.txt	Sun Jul 30 18:59:35 2006 +0000
+++ b/QTfrontend/CMakeLists.txt	Sun Jul 30 22:18:37 2006 +0000
@@ -17,7 +17,8 @@
 	gameuiconfig.cpp
 	ui_hwform.cpp
 	gamecfgwidget.cpp
-	pages.cpp)
+	pages.cpp
+	SquareLabel.cpp)
 
 if (WIN32)
 	set(hwfr_src ${hwfr_src} res/hedgewars.rc)
@@ -35,7 +36,8 @@
 	ui_hwform.h
 	gamecfgwidget.h
 	predefteams.h
-	pages.h)
+	pages.h
+	SquareLabel.h)
 
 
 set(hwfr_rez
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/SquareLabel.cpp	Sun Jul 30 22:18:37 2006 +0000
@@ -0,0 +1,56 @@
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * Distributed under the terms of the BSD-modified licence:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * with the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <QPaintEvent>
+#include <QPainter>
+#include "SquareLabel.h"
+
+SquareLabel::SquareLabel(QWidget * parent) :
+  QLabel(parent)
+{
+
+}
+
+void SquareLabel::paintEvent(QPaintEvent * event)
+{
+	QPainter painter(this);
+	int pixsize;
+	if (width() > height()) {
+		pixsize = height();
+		painter.translate((width() - pixsize) / 2, 0);
+	} else {
+		pixsize = width();
+		painter.translate(0, (height() - pixsize) / 2);
+	}
+	painter.drawPixmap(0, 0, pixsize, pixsize, pixmap()->scaled(pixsize, pixsize, Qt::KeepAspectRatio));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/SquareLabel.h	Sun Jul 30 22:18:37 2006 +0000
@@ -0,0 +1,50 @@
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * Distributed under the terms of the BSD-modified licence:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * with the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SQUARELABEL_H
+#define _SQUARELABEL_H
+
+#include <QLabel>
+
+class SquareLabel : public QLabel
+{
+	Q_OBJECT
+
+public:
+	SquareLabel(QWidget * parent = 0);
+
+protected:
+	virtual void paintEvent(QPaintEvent * event);
+};
+
+#endif // _SQUARELABEL_H
--- a/QTfrontend/hedgewars.pro	Sun Jul 30 18:59:35 2006 +0000
+++ b/QTfrontend/hedgewars.pro	Sun Jul 30 22:18:37 2006 +0000
@@ -26,7 +26,8 @@
            ui_hwform.h \
            gamecfgwidget.h \
            predefteams.h \
-           pages.h
+           pages.h \
+           SquareLabel.h
            
 SOURCES += game.cpp \
            main.cpp \
@@ -42,7 +43,8 @@
            gameuiconfig.cpp \
            ui_hwform.cpp \
            gamecfgwidget.cpp \
-           pages.cpp
+           pages.cpp \
+           SquareLabel.cpp
 
 TRANSLATIONS += translations/hedgewars_ru.ts
 
--- a/QTfrontend/pages.cpp	Sun Jul 30 18:59:35 2006 +0000
+++ b/QTfrontend/pages.cpp	Sun Jul 30 22:18:37 2006 +0000
@@ -48,6 +48,7 @@
 #include "gamecfgwidget.h"
 #include "teamselect.h"
 #include "gamecfgwidget.h"
+#include "SquareLabel.h"
 
 PageMain::PageMain(QWidget* parent) : QWidget(parent)
 {
@@ -207,7 +208,7 @@
 	CBFort = new QComboBox(GBoxFort);
 	CBFort->setMaxCount(65535);
 	GBFLayout->addWidget(CBFort, 0, 0);
-	FortPreview	= new QLabel(GBoxFort);
+	FortPreview	= new SquareLabel(GBoxFort);
 	FortPreview->setPixmap(QPixmap());
 	FortPreview->setScaledContents(true);
 	GBFLayout->addWidget(FortPreview, 1, 0);
--- a/QTfrontend/pages.h	Sun Jul 30 18:59:35 2006 +0000
+++ b/QTfrontend/pages.h	Sun Jul 30 22:18:37 2006 +0000
@@ -49,6 +49,7 @@
 class DemosList;
 class QListWidget;
 class QCheckBox;
+class SquareLabel;
 
 class PageMain : public QWidget
 {
@@ -87,7 +88,7 @@
 	QGroupBox *GBoxTeam;
 	QGroupBox *GBoxFort;
 	QComboBox *CBFort;
-	QLabel *FortPreview;
+	SquareLabel *FortPreview;
 	QGroupBox *GBoxGrave;
 	QComboBox *CBGrave;
 	QLabel *GravePreview;
--- a/QTfrontend/translations/hedgewars_ru.ts	Sun Jul 30 18:59:35 2006 +0000
+++ b/QTfrontend/translations/hedgewars_ru.ts	Sun Jul 30 22:18:37 2006 +0000
@@ -11,7 +11,7 @@
     </message>
     <message>
         <source>Quit</source>
-        <translation>Выход</translation>
+        <translation>Выйти</translation>
     </message>
     <message>
         <source>Cannot save options to file %1</source>