Permalink
Browse files

add RUSSIAN LANGUAGE

  • Loading branch information...
1 parent 1296cc7 commit af2bcdd23b3e390d46ffd994f7b4a7a38bfd7415 @lynxr committed May 15, 2012
Showing with 199 additions and 25 deletions.
  1. +2 −0 CircleMetr.pro
  2. +1 −0 main.cpp
  3. +17 −6 mainclass.cpp
  4. +2 −0 mainclass.h
  5. +7 −7 mainclass.ui
  6. +1 −1 parser.cpp
  7. +2 −2 picture.cpp
  8. +6 −6 postoperations.cpp
  9. +3 −3 postoperations.ui
  10. BIN ru_RU.qm
  11. +158 −0 ru_RU.ts
View
@@ -23,3 +23,5 @@ HEADERS += mainclass.h \
FORMS += mainclass.ui \
postoperations.ui
+
+TRANSLATIONS = ru_RU.ts
View
@@ -4,6 +4,7 @@
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
+ mainClass::translateProg();
mainClass w;
w.setWindowTitle("InterMetr 1.0 Beta");
w.show();
View
@@ -45,7 +45,7 @@ void mainClass::slotLoadImg() {
else {
lineHeight = image->img.height();
}
- ui->labelMesages->setText(QString::fromUtf8("Все считано, можно выделять"));
+ ui->labelMesages->setText(tr("All selected, now you can work"));
}
}
@@ -54,7 +54,7 @@ void mainClass::slotGetSpace() {
if(!image->imgLoaded || image->quadFlag < 4) {
return;
}
- ui->labelMesages->setText(QString::fromUtf8("Выделено %1 квадратов").arg(iSpaceCircle + 1));
+ ui->labelMesages->setText(tr("Selected %1 Quads").arg(iSpaceCircle + 1));
image->pushToSaveSpace();
tmpSpaceCircle[iSpaceCircle++] = image->spaceCircle;
@@ -87,7 +87,7 @@ void mainClass::keyPressEvent(QKeyEvent *event) {
case Qt::Key_Escape:
iSpaceCircle = 0;
- ui->labelMesages->setText(QString::fromUtf8("Выделено %1 квадратов").arg(iSpaceCircle));
+ ui->labelMesages->setText(tr("Selected %1 quads").arg(iSpaceCircle));
for(int i = 0; i <= tmpSpaceCircle.size() - 1; i++) {
tmpSpaceCircle[i] = 0;
@@ -186,21 +186,32 @@ bool mainClass::slotMenuMinus() {
}
bool mainClass::menuCreate() {
- act[0] = new QAction("(+) Plus",this);
+ act[0] = new QAction(tr("(+) Plus"),this);
connect(act[0],SIGNAL(triggered()),SLOT(slotMenuPlus()));
menu->addAction(act[0]);
- act[1] = new QAction("(-) Minus",this);
+ act[1] = new QAction(tr("(-) Minus"),this);
connect(act[1],SIGNAL(triggered()),SLOT(slotMenuMinus()));
menu->addAction(act[1]);
return true;
}
void mainClass::slotNewPostOperation() {
if(post == NULL) { // зачем зря выделять память, если клиент не прибегнет к настройкам
- QMessageBox::warning(this,"WARNING","Too early, please select lines");
+ QMessageBox::warning(this,tr("WARNING"),tr("Too early, please select lines"));
return;
}
post->setWindowTitle("InterMetr v 1.0 Beta");
post->show();
}
+
+void mainClass::translateProg() {
+ QTranslator *trans = new QTranslator;
+ QString fileTrans = "ru_RU.qm";
+ if(!trans->load(fileTrans)) {
+ delete trans;
+ }
+ else {
+ qApp->installTranslator(trans);
+ }
+}
View
@@ -6,6 +6,7 @@
#include <QPainter>
#include <QMenu>
#include <QMessageBox>
+#include <QTranslator>
#include "picture.h"
#include "postoperations.h"
@@ -20,6 +21,7 @@ class mainClass : public QMainWindow
public:
explicit mainClass(QWidget *parent = 0);
virtual ~mainClass();
+ static void translateProg();
protected:
postOperations *post; // класс настроек
picture *image;
View
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>835</width>
+ <width>904</width>
<height>669</height>
</rect>
</property>
@@ -47,7 +47,7 @@
<rect>
<x>720</x>
<y>10</y>
- <width>95</width>
+ <width>151</width>
<height>28</height>
</rect>
</property>
@@ -86,7 +86,7 @@
<rect>
<x>720</x>
<y>50</y>
- <width>95</width>
+ <width>151</width>
<height>28</height>
</rect>
</property>
@@ -97,7 +97,7 @@
<widget class="QLabel" name="labelResult">
<property name="geometry">
<rect>
- <x>730</x>
+ <x>760</x>
<y>200</y>
<width>81</width>
<height>16</height>
@@ -110,7 +110,7 @@
<widget class="QLineEdit" name="lineResult">
<property name="geometry">
<rect>
- <x>710</x>
+ <x>740</x>
<y>220</y>
<width>113</width>
<height>24</height>
@@ -120,9 +120,9 @@
<widget class="QPushButton" name="pushOperations">
<property name="geometry">
<rect>
- <x>710</x>
+ <x>720</x>
<y>90</y>
- <width>111</width>
+ <width>151</width>
<height>31</height>
</rect>
</property>
View
@@ -35,7 +35,7 @@ double parser::statMistake() {
sredArifmetic /= space.size();
double Sx = sredKvOtkl(sredArifmetic,space);
double mistake = Sx / sqrt(space.size() - 1);
- qDebug() << QString("MISTAKE=%1").arg(mistake);
+ qDebug() << tr("MISTAKE=%1").arg(mistake);
return mistake;
}
View
@@ -35,7 +35,7 @@ bool picture::loadImage(QLabel *&label, QLabel *&status) {
//QString n;
int shirinaNew;
int visotaNew;
- n = dial.getOpenFileName(0,"Open Image","","JPEG FILES (*.jpg *.JPG *.Jpg *.jPg *.jpG)");
+ n = dial.getOpenFileName(0,tr("Open Image"),"","JPEG FILES (*.jpg *.JPG *.Jpg *.jPg *.jpG)");
if(n.isEmpty())
{
label->setFixedHeight(labelH);
@@ -102,7 +102,7 @@ bool picture::saveColors(QLabel *&status) {
//qDebug() << color[i][j].value();
kolvo++;
}
- status->setText(QString("Saved %1 of %2 pixels\n").arg(kolvo).arg(razmer));
+ status->setText(tr("Saved %1 of %2 pixels\n").arg(kolvo).arg(razmer));
}
qDebug() << "image width" << width;
qDebug() << "image height" << height;
View
@@ -35,14 +35,14 @@ void postOperations::slotSaveToFile() {
QTextStream out(&file);
out << strToSave();
file.close();
- ui->labelTotalSpaces->setText(QString("Count spaces = %1").arg(++countSpaces));
+ ui->labelTotalSpaces->setText(tr("Count spaces = %1").arg(++countSpaces));
return;
}
QFileDialog dialog;
#ifdef Q_OS_LINUX
- pathToFile = dialog.getSaveFileName(0,"Select File","","Text files (*)");
+ pathToFile = dialog.getSaveFileName(0,tr("Select File"),"",tr("Text files (*)"));
#else
- pathToFile = dialog.getSaveFileName(0,"Select File","","Text files (*.txt)");
+ pathToFile = dialog.getSaveFileName(0,tr("Select File"),"",tr("Text files (*.txt)"));
#endif
if(pathToFile.isEmpty()) {
qDebug() << "EMPTY";
@@ -54,7 +54,7 @@ void postOperations::slotSaveToFile() {
QTextStream out(&file);
out << strToSave();
file.close();
- ui->labelTotalSpaces->setText(QString("Count spaces = %1").arg(++countSpaces));
+ ui->labelTotalSpaces->setText(tr("Count spaces = %1").arg(++countSpaces));
ui->checkRememberFileName->setEnabled(true);
ui->checkRememberFileName->setChecked(true);
}
@@ -68,9 +68,9 @@ QString postOperations::strToSave() {
void postOperations::slotParseFromFile() {
QFileDialog dial;
#ifdef Q_OS_LINUX
- QString file = dial.getOpenFileName(0,"Select File","","Text files (*)");
+ QString file = dial.getOpenFileName(0,tr("Select File"),"",tr("Text files (*)"));
#else
- QString file = dial.getOpenFileName(0,"Select File","","Text files (*.txt)");
+ QString file = dial.getOpenFileName(0,tr("Select File"),"",tr("Text files (*.txt)"));
#endif
if(!file.isEmpty()) {
if(parseSpaces == NULL) {
View
@@ -30,7 +30,7 @@
</font>
</property>
<property name="text">
- <string>Площадь</string>
+ <string>Space</string>
</property>
<property name="scaledContents">
<bool>false</bool>
@@ -108,7 +108,7 @@
</font>
</property>
<property name="text">
- <string>Количество подсчетов = 0</string>
+ <string>Results = 0</string>
</property>
<property name="scaledContents">
<bool>false</bool>
@@ -149,7 +149,7 @@
</font>
</property>
<property name="text">
- <string>Сататистическая ошибка</string>
+ <string>MISTAKE</string>
</property>
<property name="scaledContents">
<bool>false</bool>
View
BIN ru_RU.qm
Binary file not shown.
Oops, something went wrong.

0 comments on commit af2bcdd

Please sign in to comment.