Sonnix 6 лет назад
Родитель
Сommit
b2c9b993af
9 измененных файлов с 615 добавлено и 8 удалено
  1. 273 0
      Qqsp.en.ts
  2. 3 0
      Qqsp.pro
  3. 273 0
      Qqsp.ru.ts
  4. 17 0
      main.cpp
  5. 10 0
      mainwindow.cpp
  6. 4 8
      mainwindow.h
  7. 29 0
      optionsdialog.cpp
  8. 2 0
      optionsdialog.h
  9. 4 0
      qqsp.qrc

+ 273 - 0
Qqsp.en.ts

@@ -0,0 +1,273 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="en_US">
+<context>
+    <name>MainWindow</name>
+    <message>
+        <location filename="mainwindow.cpp" line="51"/>
+        <source>ToolBar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="265"/>
+        <source>Error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="450"/>
+        <source>&amp;Quest</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="453"/>
+        <source>Open game...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="458"/>
+        <source>Restart game</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="466"/>
+        <source>Exit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="472"/>
+        <source>&amp;Game</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="475"/>
+        <source>Open saved game...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="479"/>
+        <source>Save game...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="485"/>
+        <source>&amp;Settings</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="488"/>
+        <source>Show / Hide</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="513"/>
+        <source>Captions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="543"/>
+        <source>Sound volume...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="547"/>
+        <source>Window / Fullscreen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="555"/>
+        <source>Display HTML code as plain text</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="566"/>
+        <source>Options...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="572"/>
+        <source>&amp;Help</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="575"/>
+        <source>About...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="583"/>
+        <source>Objects</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="595"/>
+        <source>Actions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="607"/>
+        <source>Additional desc</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="616"/>
+        <source>Input area</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="773"/>
+        <source>Select game file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="773"/>
+        <source>QSP games (*.qsp *.gam)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="794"/>
+        <source>Select saved game file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="794"/>
+        <location filename="mainwindow.cpp" line="809"/>
+        <source>Saved game files (*.sav)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="809"/>
+        <source>Select file to save</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="840"/>
+        <source>, </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="841"/>
+        <source>&lt;h2&gt;Qqsp&lt;/h2&gt;&lt;p&gt;Copyright &amp;copy; 2017, S.&lt;/p&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="843"/>
+        <source>&lt;p&gt;Application version: %1&lt;br&gt;QSP library version: %2&lt;br&gt;Application compilation date: %3&lt;br&gt;Library compilation date: %4&lt;/p&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="844"/>
+        <source>About</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>OptionsDialog</name>
+    <message>
+        <location filename="optionsdialog.ui" line="17"/>
+        <source>Options</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="25"/>
+        <source>Use custom font size</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="39"/>
+        <source>Use custom font</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="68"/>
+        <location filename="optionsdialog.ui" line="124"/>
+        <location filename="optionsdialog.ui" line="204"/>
+        <location filename="optionsdialog.ui" line="253"/>
+        <source>Select</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="77"/>
+        <source>Custom background color</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="133"/>
+        <source>Language</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="143"/>
+        <source>Custom text color</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="150"/>
+        <source>Custom link color</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="157"/>
+        <source>Autostart last game</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="262"/>
+        <source>Separate config per game</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="299"/>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="306"/>
+        <source>Ok</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <location filename="main.cpp" line="17"/>
+        <source>__LANGNAME__</source>
+        <translation>English</translation>
+    </message>
+    <message>
+        <location filename="main.cpp" line="18"/>
+        <location filename="mainwindow.cpp" line="87"/>
+        <source>__LANGID__</source>
+        <translation>en_US</translation>
+    </message>
+</context>
+<context>
+    <name>QspImgCanvas</name>
+    <message>
+        <location filename="qspimgcanvas.cpp" line="9"/>
+        <source>Image</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QspMsgDlg</name>
+    <message>
+        <location filename="qspmsgdlg.cpp" line="32"/>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>__LANG__</name>
+    <message>
+        <location filename="optionsdialog.cpp" line="48"/>
+        <location filename="optionsdialog.cpp" line="49"/>
+        <source>__LANGNAME__</source>
+        <translation>English</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.cpp" line="49"/>
+        <source>__LANGID__</source>
+        <translation>en_US</translation>
+    </message>
+</context>
+</TS>

+ 3 - 0
Qqsp.pro

@@ -51,6 +51,9 @@ HEADERS += \
 FORMS += \
     optionsdialog.ui
 
+TRANSLATIONS = Qqsp.en.ts \
+    Qqsp.ru.ts
+
 DEFINES += _UNICODE
 DEFINES += NOT_RUBY
 #DEFINES += EXPORT

+ 273 - 0
Qqsp.ru.ts

@@ -0,0 +1,273 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="ru_RU">
+<context>
+    <name>MainWindow</name>
+    <message>
+        <location filename="mainwindow.cpp" line="51"/>
+        <source>ToolBar</source>
+        <translation>Панель инструментов</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="265"/>
+        <source>Error</source>
+        <translation>Ошибка</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="450"/>
+        <source>&amp;Quest</source>
+        <translation>&amp;Квест</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="453"/>
+        <source>Open game...</source>
+        <translation>Открыть игру...</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="458"/>
+        <source>Restart game</source>
+        <translation>Перезагрузить игру</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="466"/>
+        <source>Exit</source>
+        <translation>Выход</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="472"/>
+        <source>&amp;Game</source>
+        <translation>&amp;Игра</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="475"/>
+        <source>Open saved game...</source>
+        <translation>Открыть сохраненную игру...</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="479"/>
+        <source>Save game...</source>
+        <translation>Сохранить игру...</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="485"/>
+        <source>&amp;Settings</source>
+        <translation>&amp;Настройки</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="488"/>
+        <source>Show / Hide</source>
+        <translation>Показать / Скрыть</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="513"/>
+        <source>Captions</source>
+        <translation>Заголовки</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="543"/>
+        <source>Sound volume...</source>
+        <translation>Громкость...</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="547"/>
+        <source>Window / Fullscreen mode</source>
+        <translation>Оконный / Полноэкранный режим</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="555"/>
+        <source>Display HTML code as plain text</source>
+        <translation>Отображать исходный код HTML</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="566"/>
+        <source>Options...</source>
+        <translation>Настройки...</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="572"/>
+        <source>&amp;Help</source>
+        <translation>&amp;Помощь</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="575"/>
+        <source>About...</source>
+        <translation>О программе...</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="583"/>
+        <source>Objects</source>
+        <translation>Предметы</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="595"/>
+        <source>Actions</source>
+        <translation>Действия</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="607"/>
+        <source>Additional desc</source>
+        <translation>Дополнительное описание</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="616"/>
+        <source>Input area</source>
+        <translation>Поле ввода</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="773"/>
+        <source>Select game file</source>
+        <translation>Выберите файл игры</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="773"/>
+        <source>QSP games (*.qsp *.gam)</source>
+        <translation>Файлы игры QSP (*.qsp *.gam)</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="794"/>
+        <source>Select saved game file</source>
+        <translation>Выберите файл сохраненной игры</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="794"/>
+        <location filename="mainwindow.cpp" line="809"/>
+        <source>Saved game files (*.sav)</source>
+        <translation>Файлы сохранений (*.sav)</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="809"/>
+        <source>Select file to save</source>
+        <translation>Выберите файл для сохранения</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="840"/>
+        <source>, </source>
+        <translation>, </translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="841"/>
+        <source>&lt;h2&gt;Qqsp&lt;/h2&gt;&lt;p&gt;Copyright &amp;copy; 2017, S.&lt;/p&gt;</source>
+        <translation>&lt;h2&gt;Qqsp&lt;/h2&gt;&lt;p&gt;Авторские права &amp;copy; 2017, S.&lt;/p&gt;</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="843"/>
+        <source>&lt;p&gt;Application version: %1&lt;br&gt;QSP library version: %2&lt;br&gt;Application compilation date: %3&lt;br&gt;Library compilation date: %4&lt;/p&gt;</source>
+        <translation>&lt;p&gt;Версия приложения: %1&lt;br&gt;Версия библиотеки QSP: %2&lt;br&gt;Дата компиляции приложения: %3&lt;br&gt;Дата компиляции библиотеки: %4&lt;/p&gt;</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="844"/>
+        <source>About</source>
+        <translation>О программе</translation>
+    </message>
+</context>
+<context>
+    <name>OptionsDialog</name>
+    <message>
+        <location filename="optionsdialog.ui" line="17"/>
+        <source>Options</source>
+        <translation>Настройки</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="25"/>
+        <source>Use custom font size</source>
+        <translation>Использовать выбранный размер шрифта</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="39"/>
+        <source>Use custom font</source>
+        <translation>Использовать выбранный шрифт</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="68"/>
+        <location filename="optionsdialog.ui" line="124"/>
+        <location filename="optionsdialog.ui" line="204"/>
+        <location filename="optionsdialog.ui" line="253"/>
+        <source>Select</source>
+        <translation>Выбрать</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="77"/>
+        <source>Custom background color</source>
+        <translation>Использовать выбранный цвет фона</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="133"/>
+        <source>Language</source>
+        <translation>Язык (Language)</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="143"/>
+        <source>Custom text color</source>
+        <translation>Использовать выбранный цвет текста</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="150"/>
+        <source>Custom link color</source>
+        <translation>Использовать выбранный цвет ссылок</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="157"/>
+        <source>Autostart last game</source>
+        <translation>Автозагрузка последней игры</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="262"/>
+        <source>Separate config per game</source>
+        <translation>Отдельные настройки для каждой игры</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="299"/>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.ui" line="306"/>
+        <source>Ok</source>
+        <translation>Ок</translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <location filename="main.cpp" line="17"/>
+        <source>__LANGNAME__</source>
+        <translation>Русский</translation>
+    </message>
+    <message>
+        <location filename="main.cpp" line="18"/>
+        <location filename="mainwindow.cpp" line="87"/>
+        <source>__LANGID__</source>
+        <translation>ru_RU</translation>
+    </message>
+</context>
+<context>
+    <name>QspImgCanvas</name>
+    <message>
+        <location filename="qspimgcanvas.cpp" line="9"/>
+        <source>Image</source>
+        <translation>Изображение</translation>
+    </message>
+</context>
+<context>
+    <name>QspMsgDlg</name>
+    <message>
+        <location filename="qspmsgdlg.cpp" line="32"/>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+</context>
+<context>
+    <name>__LANG__</name>
+    <message>
+        <location filename="optionsdialog.cpp" line="48"/>
+        <location filename="optionsdialog.cpp" line="49"/>
+        <source>__LANGNAME__</source>
+        <translation>Русский</translation>
+    </message>
+    <message>
+        <location filename="optionsdialog.cpp" line="49"/>
+        <source>__LANGID__</source>
+        <translation>ru_RU</translation>
+    </message>
+</context>
+</TS>

+ 17 - 0
main.cpp

@@ -1,5 +1,10 @@
 #include "mainwindow.h"
 #include <QApplication>
+#include <QObject>
+#include <QSettings>
+#include <QTranslator>
+#include <QString>
+#include <QLocale>
 
 int main(int argc, char *argv[])
 {
@@ -8,6 +13,18 @@ int main(int argc, char *argv[])
     a.setOrganizationName("Qqsp");
     a.setApplicationVersion("0.2");
 
+    QObject::tr("__LANGNAME__");
+    QObject::tr("__LANGID__");
+
+    QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QApplication::applicationName());
+    QTranslator qtTranslator;
+    QString langid = settings.value("application/language", QLocale::system().name()).toString();
+    if(qtTranslator.load(QApplication::applicationName() + "." + langid, QApplication::applicationDirPath()))
+        a.installTranslator(&qtTranslator);
+    else
+        if(qtTranslator.load(QApplication::applicationName() + "." + langid, ":/translations/"))
+            a.installTranslator(&qtTranslator);
+
     MainWindow w;
     w.show();
 

+ 10 - 0
mainwindow.cpp

@@ -11,6 +11,7 @@
 #include <QFontDialog>
 #include <QIcon>
 #include <QDesktopServices>
+#include <QLocale>
 
 #include "callbacks_gui.h"
 #include "comtools.h"
@@ -83,6 +84,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
     perGameConfig = false;
     autostartLastGame = false;
 
+    langid = QObject::tr("__LANGID__");
+    if(langid == QStringLiteral("__LANGID__"))
+        langid = QLocale::system().name();
+
     CreateDockWindows();
     LoadSettings();
     CreateMenuBar();
@@ -372,6 +377,8 @@ void MainWindow::LoadSettings(QString filePath)
     lastGame = settings->value("application/lastGame", lastGame).toString();
     autostartLastGame = settings->value("application/autostartLastGame", autostartLastGame).toBool();
 
+    langid = settings->value("application/language", langid).toString();
+
 //	cfg.Read(wxT("General/ShowHotkeys"), &m_isShowHotkeys, false);
 //	cfg.Read(wxT("General/Volume"), &m_volume, 100);
 //	m_transhelper->Load(cfg, wxT("General/Language"));
@@ -425,6 +432,8 @@ void MainWindow::SaveSettings(QString filePath)
     settings->setValue("application/lastGame", lastGame);
     settings->setValue("application/autostartLastGame", autostartLastGame);
 
+    settings->setValue("application/language", langid);
+
     settings->sync();
 
 //	cfg.Write(wxT("General/Volume"), m_volume);
@@ -515,6 +524,7 @@ void MainWindow::CreateMenuBar()
     action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_6));
     _showHideMenu->addAction(action);
 
+    //TODO: MenuBar
     // MenuBar
     //action = _showHideMenu->addAction(tr("MenuBar"));
     //action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_7));

+ 4 - 8
mainwindow.h

@@ -15,6 +15,7 @@
 #include <QFont>
 #include <QCloseEvent>
 #include <QKeyEvent>
+#include <QTranslator>
 
 #include "qsptextbox.h"
 #include "qsplistbox.h"
@@ -99,6 +100,8 @@ public:
     void SetUseLinkColor(bool isUseLinkColor) { m_isUseLinkColor = isUseLinkColor; }
     bool GetUseFontColor() { return m_isUseFontColor; }
     void SetUseFontColor(bool isUseFontColor) { m_isUseFontColor = isUseFontColor; }
+    QString GetLangID() { return langid; }
+    void SetLangID(const QString& new_langid) { langid = new_langid; }
 
 private:
     void CreateMenuBar();
@@ -169,6 +172,7 @@ private:
     bool showPlainText;
     bool showCaptions;
     bool autostartLastGame;
+    QString langid;
 
 private slots:
     void OnOpenGame();
@@ -196,14 +200,6 @@ private slots:
 
     // Events
 //    void OnQuickSave(wxCommandEvent& event);
-//    void OnSelectFont(wxCommandEvent& event);
-//    void OnUseFontSize(wxCommandEvent& event);
-//    void OnSelectFontColor(wxCommandEvent& event);
-//    void OnSelectBackColor(wxCommandEvent& event);
-//    void OnSelectLinkColor(wxCommandEvent& event);
-//    void OnSelectLang(wxCommandEvent& event);
-//    void OnToggleCaptions(wxCommandEvent& event);
-//    void OnToggleHotkeys(wxCommandEvent& event);
 //    void OnVolume(wxCommandEvent& event);
 //    void OnDropFiles(wxDropFilesEvent& event);
 };

+ 29 - 0
optionsdialog.cpp

@@ -3,6 +3,10 @@
 
 #include <QFontDialog>
 #include <QColorDialog>
+#include <QDirIterator>
+#include <QFileInfo>
+#include <QCoreApplication>
+#include <QTranslator>
 
 #include "mainwindow.h"
 
@@ -31,6 +35,29 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
     ui->checkBox_fontColor->setChecked(mw->GetUseFontColor());
     ui->checkBox_perGameConfig->setChecked(mw->GetPerGameConfig());
     ui->checkBox_autostart->setChecked(mw->GetAutostart());
+
+    QDirIterator qmIt(QCoreApplication::applicationDirPath(), QStringList() << "*.qm", QDir::Files);
+    while(qmIt.hasNext())
+    {
+        qmIt.next();
+        QFileInfo finfo = qmIt.fileInfo();
+        QTranslator translator;
+        if(translator.load(finfo.completeBaseName(), finfo.absolutePath()))
+            ui->comboBox_language->addItem(translator.translate("__LANG__", "__LANGNAME__"), QVariant(translator.translate("__LANG__", "__LANGID__")));
+    }
+    QDirIterator qmItRC(":/translations/", QStringList() << "*.qm", QDir::Files);
+    while(qmItRC.hasNext())
+    {
+        qmItRC.next();
+        QFileInfo finfo = qmItRC.fileInfo();
+        QTranslator translator;
+        if(translator.load(finfo.completeBaseName(), finfo.absolutePath()))
+            ui->comboBox_language->addItem(translator.translate("__LANG__", "__LANGNAME__"), QVariant(translator.translate("__LANG__", "__LANGID__")));
+    }
+    langid = mw->GetLangID();
+    int index = ui->comboBox_language->findData(langid);
+    if ( index != -1 )
+       ui->comboBox_language->setCurrentIndex(index);
 }
 
 OptionsDialog::~OptionsDialog()
@@ -110,6 +137,8 @@ void OptionsDialog::on_pushButton_ok_clicked()
         mw->SetForegroundColor(m_fontColor);
     mw->SetPerGameConfig(ui->checkBox_perGameConfig->isChecked());
     mw->SetAutostart(ui->checkBox_autostart->isChecked());
+    if(ui->comboBox_language->count() > 0)
+        mw->SetLangID(ui->comboBox_language->itemData(ui->comboBox_language->currentIndex()).toString());
 
     close();
 }

+ 2 - 0
optionsdialog.h

@@ -4,6 +4,7 @@
 #include <QDialog>
 #include <QFont>
 #include <QColor>
+#include <QString>
 
 namespace Ui {
 class OptionsDialog;
@@ -36,6 +37,7 @@ private:
     QColor m_backColor;
     QColor m_linkColor;
     QColor m_fontColor;
+    QString langid;
 };
 
 #endif // OPTIONSDIALOG_H

+ 4 - 0
qqsp.qrc

@@ -11,4 +11,8 @@
         <file alias="menu/windowmode">icons/windowmode.xpm</file>
         <file alias="logo">icons/logo.png</file>
     </qresource>
+    <qresource prefix="/translations">
+        <file>Qqsp.en.qm</file>
+        <file>Qqsp.ru.qm</file>
+    </qresource>
 </RCC>