Pārlūkot izejas kodu

Completed with settings window

Ivan Arkhipov 5 gadi atpakaļ
vecāks
revīzija
2199a40278

+ 18 - 6
gui/rusificationwidget.cpp

@@ -16,10 +16,13 @@ RusificationWidget::RusificationWidget(LegacyApp *_app, QWidget *parent) :
 {
     ui->setupUi(this);
     ui->treeWidget_title->expandAll();
-    hide_all_import_widgets();
+    hideAllImportWidgets();
     ui->database_import_widget->show();
-
     doStuffWithEveryItemInMyTree(ui->treeWidget_title->invisibleRootItem());
+
+    ui_update_timer.setInterval(500);
+    connect(&ui_update_timer, &QTimer::timeout, this, &RusificationWidget::updateUI);
+    ui_update_timer.start();
 }
 
 RusificationWidget::~RusificationWidget()
@@ -27,7 +30,7 @@ RusificationWidget::~RusificationWidget()
     delete ui;
 }
 
-void RusificationWidget::hide_all_import_widgets()
+void RusificationWidget::hideAllImportWidgets()
 {
     ui->database_import_widget->hide();
     ui->file_import_widget->hide();
@@ -36,18 +39,27 @@ void RusificationWidget::hide_all_import_widgets()
 
 void RusificationWidget::on_database_import_radiobutton_common_clicked()
 {
-    hide_all_import_widgets();
+    hideAllImportWidgets();
     ui->database_import_widget->show();
 }
 
 void RusificationWidget::on_file_import_radiobutton_common_clicked()
 {
-    hide_all_import_widgets();
+    hideAllImportWidgets();
     ui->file_import_widget->show();
 }
 
 void RusificationWidget::on_textfragment_import_radiobutton_common_clicked()
 {
-    hide_all_import_widgets();
+    hideAllImportWidgets();
     ui->textfragment_import_widget->show();
 }
+
+void RusificationWidget::updateUI()
+{
+    if (app->properties.value("settings/expert_mode", 0).toBool()) {
+        ui->tabWidget_common->tabBar()->show();
+    } else {
+        ui->tabWidget_common->tabBar()->hide();
+    }
+}

+ 6 - 1
gui/rusificationwidget.h

@@ -2,6 +2,7 @@
 #define RUSIFICATIONWIDGET_H
 
 #include <QWidget>
+#include <QTimer>
 
 namespace Ui {
 class RusificationWidget;
@@ -15,10 +16,11 @@ class RusificationWidget : public QWidget
 
 public:
     explicit RusificationWidget(LegacyApp *_app, QWidget *parent = 0);
+
     ~RusificationWidget();
 
 private:
-    void hide_all_import_widgets();
+    void hideAllImportWidgets();
 
 private slots:
     void on_database_import_radiobutton_common_clicked();
@@ -27,9 +29,12 @@ private slots:
 
     void on_textfragment_import_radiobutton_common_clicked();
 
+    void updateUI();
+
 private:
     Ui::RusificationWidget *ui;
     LegacyApp *app;
+    QTimer ui_update_timer;
 };
 
 #endif // RUSIFICATIONWIDGET_H

+ 359 - 112
gui/rusificationwidget.ui

@@ -24,7 +24,7 @@
 	color: white;
 }</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout_4">
+  <layout class="QVBoxLayout" name="verticalLayout_8">
    <property name="leftMargin">
     <number>0</number>
    </property>
@@ -37,10 +37,7 @@
    <property name="bottomMargin">
     <number>0</number>
    </property>
-   <property name="spacing">
-    <number>0</number>
-   </property>
-   <item row="0" column="0">
+   <item>
     <widget class="QTabWidget" name="tabWidget_common">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -103,7 +100,7 @@ QPushButton, QGroupBox, QComboBox {
       <enum>QTabWidget::Triangular</enum>
      </property>
      <property name="currentIndex">
-      <number>1</number>
+      <number>0</number>
      </property>
      <property name="usesScrollButtons">
       <bool>false</bool>
@@ -134,7 +131,7 @@ QPushButton, QGroupBox, QComboBox {
        <item>
         <widget class="QWidget" name="left_column_widget" native="true">
          <property name="sizePolicy">
-          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+          <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
            <horstretch>0</horstretch>
            <verstretch>0</verstretch>
           </sizepolicy>
@@ -163,6 +160,9 @@ background-color: rgba(255, 255, 255, 0);</string>
             <property name="frameShape">
              <enum>QFrame::NoFrame</enum>
             </property>
+            <property name="editTriggers">
+             <set>QAbstractItemView::EditKeyPressed</set>
+            </property>
             <property name="showDropIndicator" stdset="0">
              <bool>false</bool>
             </property>
@@ -197,7 +197,7 @@ background-color: rgba(255, 255, 255, 0);</string>
              <bool>true</bool>
             </property>
             <property name="expandsOnDoubleClick">
-             <bool>true</bool>
+             <bool>false</bool>
             </property>
             <attribute name="headerVisible">
              <bool>false</bool>
@@ -225,22 +225,43 @@ background-color: rgba(255, 255, 255, 0);</string>
             </column>
             <item>
              <property name="text">
-              <string>Тексты</string>
-             </property>
-             <property name="checkState">
-              <enum>PartiallyChecked</enum>
+              <string>Русификация</string>
              </property>
              <item>
               <property name="text">
-               <string>Шрифты</string>
+               <string>Тексты</string>
               </property>
               <property name="checkState">
-               <enum>Checked</enum>
+               <enum>PartiallyChecked</enum>
               </property>
+              <item>
+               <property name="text">
+                <string>Шрифты</string>
+               </property>
+               <property name="checkState">
+                <enum>Checked</enum>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>Предметы</string>
+               </property>
+               <property name="checkState">
+                <enum>Checked</enum>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>Эмоции</string>
+               </property>
+               <property name="checkState">
+                <enum>Checked</enum>
+               </property>
+              </item>
              </item>
              <item>
               <property name="text">
-               <string>Предметы</string>
+               <string>Карты</string>
               </property>
               <property name="checkState">
                <enum>Checked</enum>
@@ -248,83 +269,72 @@ background-color: rgba(255, 255, 255, 0);</string>
              </item>
              <item>
               <property name="text">
-               <string>Эмоции</string>
-              </property>
-              <property name="checkState">
-               <enum>Checked</enum>
-              </property>
-             </item>
-            </item>
-            <item>
-             <property name="text">
-              <string>Озвучка персонажей</string>
-             </property>
-             <property name="checkState">
-              <enum>Checked</enum>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Заставочные экраны</string>
-             </property>
-             <property name="checkState">
-              <enum>Checked</enum>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Карты</string>
-             </property>
-             <property name="checkState">
-              <enum>Checked</enum>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Видеоролики</string>
-             </property>
-             <property name="checkState">
-              <enum>Checked</enum>
-             </property>
-             <item>
-              <property name="text">
-               <string>Вступительный</string>
-              </property>
-             </item>
-             <item>
-              <property name="text">
-               <string>Расовые</string>
+               <string>Логотипы игры</string>
               </property>
              </item>
              <item>
               <property name="text">
-               <string>Классовые</string>
+               <string>Озвучка персонажей</string>
               </property>
-             </item>
-             <item>
-              <property name="text">
-               <string>Книга 1: Тени Ангмара</string>
+              <property name="checkState">
+               <enum>Checked</enum>
               </property>
              </item>
              <item>
               <property name="text">
-               <string>Книга 2: Копи Мории</string>
+               <string>Заставочные экраны</string>
               </property>
-             </item>
-             <item>
-              <property name="text">
-               <string>Книга 3: Союзники Короля</string>
+              <property name="checkState">
+               <enum>Checked</enum>
               </property>
              </item>
              <item>
               <property name="text">
-               <string>Книга 4: Мощь Саурона</string>
+               <string>Видеоролики</string>
               </property>
-             </item>
-             <item>
-              <property name="text">
-               <string>Чёрная Книга Мордора</string>
+              <property name="checkState">
+               <enum>Checked</enum>
               </property>
+              <item>
+               <property name="text">
+                <string>Вступительный</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>Расовые</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>Классовые</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>Книга 1: Тени Ангмара</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>Книга 2: Копи Мории</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>Книга 3: Союзники Короля</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>Книга 4: Мощь Саурона</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>Чёрная Книга Мордора</string>
+               </property>
+              </item>
              </item>
             </item>
            </widget>
@@ -407,9 +417,11 @@ background-color: rgba(255, 255, 255, 0);</string>
              </sizepolicy>
             </property>
             <property name="styleSheet">
-             <string notr="true">border-radius: 20px;
+             <string notr="true">QWidget#widget_2 {
+border-radius: 20px;
 background-color: rgba(30, 0, 0, 100);
-color:rgb(255,255,255)</string>
+color:rgb(255,255,255);
+}</string>
             </property>
             <layout class="QGridLayout" name="gridLayout_3">
              <item row="0" column="0">
@@ -426,7 +438,7 @@ color:rgb(255,255,255)</string>
                 <string notr="true">background:none</string>
                </property>
                <property name="text">
-                <string>ОПИСАНИЕ</string>
+                <string>Подсказка</string>
                </property>
                <property name="alignment">
                 <set>Qt::AlignCenter</set>
@@ -453,27 +465,23 @@ color:rgb(255,255,255)</string>
               </widget>
              </item>
              <item row="2" column="0">
-              <widget class="QLabel" name="label_common">
-               <property name="sizePolicy">
-                <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-                 <horstretch>0</horstretch>
-                 <verstretch>0</verstretch>
-                </sizepolicy>
-               </property>
+              <widget class="QTextBrowser" name="textBrowser">
                <property name="styleSheet">
-                <string notr="true">background-color: none;</string>
-               </property>
-               <property name="text">
-                <string>Привет как дела как жизнь что деПривет как дела как жизнь что делаешьПривет как дела как жизнь что делаешьПривет как дела как жизнь что делаешьПривет как дела как жизнь что делаешьПривет как дела как жизнь что делаешьПривет как дела как жизнь что делаешьПривет как дела как жизнь что делаешьПривет как дела как жизнь что делаешьПривет как дела как жизнь что делаешьПривет как дела как жизнь что делаешьПривет как </string>
-               </property>
-               <property name="scaledContents">
-                <bool>false</bool>
-               </property>
-               <property name="wordWrap">
-                <bool>true</bool>
-               </property>
-               <property name="margin">
-                <number>10</number>
+                <string notr="true">border-radius: 20px;
+background-color: rgba(30, 0, 0, 0);
+color:rgb(255,255,255);
+</string>
+               </property>
+               <property name="html">
+                <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Ставьте или убирайте галочки в пунктах меню слева, чтобы включить или отключить фрагмент русификации.&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Для включения некоторых фрагментов потребуется дополнительная загрузка данных&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Чтобы применить изменения, нажмите кнопку &amp;quot;Применить&amp;quot;. &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
                </property>
               </widget>
              </item>
@@ -1727,19 +1735,258 @@ background-color: none;</string>
       <attribute name="title">
        <string>  Управление  </string>
       </attribute>
-      <widget class="QCommandLinkButton" name="commandLinkButton">
-       <property name="geometry">
-        <rect>
-         <x>50</x>
-         <y>40</y>
-         <width>187</width>
-         <height>41</height>
-        </rect>
-       </property>
-       <property name="text">
-        <string>dxdxcfgb</string>
-       </property>
-      </widget>
+      <layout class="QVBoxLayout" name="verticalLayout_9">
+       <item>
+        <widget class="QWidget" name="export_folder_widget_2" native="true">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="styleSheet">
+          <string notr="true">border-radius: 20px;
+background-color: rgba(30, 0, 0, 100);</string>
+         </property>
+         <layout class="QHBoxLayout" name="horizontalLayout_15">
+          <item>
+           <widget class="QLabel" name="folder_label_common_2">
+            <property name="styleSheet">
+             <string notr="true">
+background-color: none;</string>
+            </property>
+            <property name="text">
+             <string>Путь к .dat файлу:</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="folder_value_common_2">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="styleSheet">
+             <string notr="true">
+background-color: none;</string>
+            </property>
+            <property name="text">
+             <string>D:\Programming\SourceRepos\Legacy_v2</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="change_folder_button_2">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="minimumSize">
+             <size>
+              <width>36</width>
+              <height>32</height>
+             </size>
+            </property>
+            <property name="styleSheet">
+             <string notr="true">border-image: url(:/assets/folder.png);
+
+background-color: none;</string>
+            </property>
+            <property name="text">
+             <string/>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <widget class="QWidget" name="export_folder_widget_3" native="true">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="styleSheet">
+          <string notr="true">QWidget#export_folder_widget_3{
+	border-radius: 20px;
+	background-color: rgba(30, 0, 0, 100);
+}</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout_13">
+          <item row="0" column="1">
+           <widget class="QLabel" name="label">
+            <property name="text">
+             <string>(нет)</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="0">
+           <widget class="QLabel" name="folder_label_common_3">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="styleSheet">
+             <string notr="true">
+background-color: none;</string>
+            </property>
+            <property name="text">
+             <string>Неактивные категории:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="0" colspan="2">
+           <widget class="QWidget" name="widget_12" native="true">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="minimumSize">
+             <size>
+              <width>0</width>
+              <height>40</height>
+             </size>
+            </property>
+            <layout class="QHBoxLayout" name="horizontalLayout_16">
+             <property name="spacing">
+              <number>7</number>
+             </property>
+             <property name="leftMargin">
+              <number>0</number>
+             </property>
+             <property name="topMargin">
+              <number>0</number>
+             </property>
+             <property name="rightMargin">
+              <number>0</number>
+             </property>
+             <property name="bottomMargin">
+              <number>0</number>
+             </property>
+             <item>
+              <widget class="QLabel" name="label_4_common_2">
+               <property name="text">
+                <string>Деактивировать категорию</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLineEdit" name="lineEdit_2_common_2">
+               <property name="maxLength">
+                <number>9</number>
+               </property>
+               <property name="clearButtonEnabled">
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QPushButton" name="pushButton_4_common_2">
+               <property name="text">
+                <string>Применить</string>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </item>
+          <item row="1" column="0" colspan="2">
+           <widget class="QWidget" name="widget_15" native="true">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="minimumSize">
+             <size>
+              <width>0</width>
+              <height>40</height>
+             </size>
+            </property>
+            <layout class="QHBoxLayout" name="horizontalLayout_8">
+             <property name="spacing">
+              <number>7</number>
+             </property>
+             <property name="leftMargin">
+              <number>0</number>
+             </property>
+             <property name="topMargin">
+              <number>0</number>
+             </property>
+             <property name="rightMargin">
+              <number>0</number>
+             </property>
+             <property name="bottomMargin">
+              <number>0</number>
+             </property>
+             <item>
+              <widget class="QLabel" name="label_2_common">
+               <property name="text">
+                <string>Активировать категорию</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLineEdit" name="lineEdit_common">
+               <property name="inputMask">
+                <string/>
+               </property>
+               <property name="text">
+                <string/>
+               </property>
+               <property name="maxLength">
+                <number>9</number>
+               </property>
+               <property name="clearButtonEnabled">
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QPushButton" name="pushButton_3_common">
+               <property name="text">
+                <string>Применить</string>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="pushButton_2_common">
+         <property name="text">
+          <string>Создать файл статуса ядра</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="verticalSpacer_4">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
      </widget>
     </widget>
    </item>

+ 123 - 2
gui/settingswidget.cpp

@@ -1,7 +1,12 @@
 #include "gui\settingswidget.h"
 #include "ui_settingswidget.h"
 #include "legacyapp.h"
+#include "filesystem.h"
+
 #include <QDebug>
+#include <QFileDialog>
+#include <QMessageBox>
+
 
 SettingsWidget::SettingsWidget(LegacyApp *_app, QWidget *parent) :
     QWidget(parent),
@@ -9,6 +14,10 @@ SettingsWidget::SettingsWidget(LegacyApp *_app, QWidget *parent) :
     app(_app)
 {
     ui->setupUi(this);
+
+    ui_update_timer.setInterval(500);
+    connect(&ui_update_timer, &QTimer::timeout, this, &SettingsWidget::updateUI);
+    ui_update_timer.start();
 }
 
 SettingsWidget::~SettingsWidget()
@@ -16,9 +25,39 @@ SettingsWidget::~SettingsWidget()
     delete ui;
 }
 
-void SettingsWidget::UpdateFolderPath()
+void SettingsWidget::updateUI()
 {
-//    QString path =
+    QString path = app->properties.value("settings/lotro_folder", "(не выбрана)").toString();
+    ui->folder_value_common->setText(path);
+
+    ui->data_protection_checkbox_common->setChecked(app->properties.value("settings/data_protection", 0).toBool());
+    ui->restore_checkbox_common->setChecked(app->properties.value("settings/auto_restore", 0).toBool());
+    ui->download_updates_checkbox_common->setChecked(app->properties.value("settings/download_updates", 0).toBool());
+    ui->expert_tabs_checkbox_common->setChecked(app->properties.value("settings/expert_mode", 0).toBool());
+    ui->restrict_download_speed_checkbox_common->setChecked(app->properties.value("settings/limit_download_speed", 0).toBool());
+    ui->download_restrict_slider->setValue(app->properties.value("settings/download_speed", 64).toInt());
+
+    if (app->properties.value("settings/expert_mode", 0).toBool()) {
+        ui->management_widget->show();
+        ui->data_protection_checkbox_common->show();
+        ui->restore_checkbox_common->show();
+    } else {
+        ui->management_widget->hide();
+        ui->data_protection_checkbox_common->hide();
+        ui->restore_checkbox_common->hide();
+    }
+
+    int locale_index = 0;
+    QString value = app->properties.value("settings/locale", "English").toString();
+
+    if (value == "English")
+        locale_index = 0;
+    if (value == "DE")
+        locale_index = 1;
+    if (value == "FR")
+        locale_index = 2;
+
+    ui->lotro_patch_language_combobox_common->setCurrentIndex(locale_index);
 }
 
 void SettingsWidget::on_download_restrict_slider_valueChanged(int value)
@@ -29,6 +68,8 @@ void SettingsWidget::on_download_restrict_slider_valueChanged(int value)
     } else {
         ui->download_speed_label_common->setText(QString::number(value) + " Кб/с");
     }
+    app->properties.setValue("settings/download_speed", value);
+    app->properties.sync();
 }
 
 void SettingsWidget::on_interface_scale_combobox_common_currentIndexChanged(const QString &arg1)
@@ -37,3 +78,83 @@ void SettingsWidget::on_interface_scale_combobox_common_currentIndexChanged(cons
     app->window.changeFontSizeRecursive(value, &app->window);
     app->window.resize(900 * value / 100, 650 * value / 100);
 }
+
+void SettingsWidget::on_change_folder_button_clicked()
+{
+    QStringList known_paths = FileSystem::recognizeRegistryLotroPath();
+    QString template_path = known_paths.size() > 0 ? known_paths[0] : "";
+    QString str = QFileDialog::getOpenFileName(0, "Расположение игры", template_path, "LotroLauncher.exe");
+    QString path = str.replace("/LotroLauncher.exe", "").replace("\\", "/").replace("//", "/");
+
+    if (!FileSystem::fileExists(path + "/LotroLauncher.exe")) {
+        QMessageBox error_box("Ошибка!", "Похоже, указана неверная папка с игрой. Не могу найти файл LotroLauncher.exe",
+                              QMessageBox::Critical, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
+
+        return;
+    }
+
+    if (!FileSystem::fileExists(path + "/client_local_English.dat")) {
+        QMessageBox pmbx("Файл данных не найден",
+                         "Файл данных client_local_English.dat не обнаружен в папке с игрой. Запустить лаунчер игры с целью скачать недостающие данные?",
+                         QMessageBox::Warning,
+                         QMessageBox::Yes,
+                         QMessageBox::No,
+                         QMessageBox::NoButton);
+
+        if (pmbx.exec() == QMessageBox::Yes) {
+            // Start LotRO;
+            return;
+        } else {
+            // Set status Файл данных не найден
+        }
+    }
+
+    app->properties.setValue("settings/lotro_folder", path);
+    app->properties.sync();
+    ui->folder_value_common->setText(path);
+}
+
+void SettingsWidget::on_data_protection_checkbox_common_stateChanged(int arg1)
+{
+    app->properties.setValue("settings/data_protection", arg1);
+    app->properties.sync();
+}
+
+void SettingsWidget::on_restore_checkbox_common_stateChanged(int arg1)
+{
+    app->properties.setValue("settings/auto_restore", arg1);
+    app->properties.sync();
+}
+
+void SettingsWidget::on_download_updates_checkbox_common_stateChanged(int arg1)
+{
+    app->properties.setValue("settings/download_updates", arg1);
+    app->properties.sync();
+}
+
+void SettingsWidget::on_expert_tabs_checkbox_common_stateChanged(int arg1)
+{
+    app->properties.setValue("settings/expert_mode", arg1);
+    app->properties.sync();
+}
+
+void SettingsWidget::on_restrict_download_speed_checkbox_common_stateChanged(int arg1)
+{
+    app->properties.setValue("settings/limit_download_speed", arg1);
+    app->properties.sync();
+}
+
+
+void SettingsWidget::on_lotro_patch_language_combobox_common_activated(int index)
+{
+    QString value = "";
+    if (index == 0)
+        value = "English";
+    if (index == 1)
+        value = "DE";
+    if (index == 2)
+        value = "FR";
+
+    app->properties.setValue("settings/locale", value);
+    app->properties.sync();
+}

+ 17 - 1
gui/settingswidget.h

@@ -2,6 +2,7 @@
 #define SETTINGSWIDGET_H
 
 #include <QWidget>
+#include <QTimer>
 
 namespace Ui {
 class SettingsWidget;
@@ -18,15 +19,30 @@ public:
     ~SettingsWidget();
 
 private slots:
-    void UpdateFolderPath();
+    void updateUI();
 
     void on_download_restrict_slider_valueChanged(int value);
 
     void on_interface_scale_combobox_common_currentIndexChanged(const QString &arg1);
 
+    void on_change_folder_button_clicked();
+
+    void on_data_protection_checkbox_common_stateChanged(int arg1);
+
+    void on_restore_checkbox_common_stateChanged(int arg1);
+
+    void on_download_updates_checkbox_common_stateChanged(int arg1);
+
+    void on_expert_tabs_checkbox_common_stateChanged(int arg1);
+
+    void on_restrict_download_speed_checkbox_common_stateChanged(int arg1);
+
+    void on_lotro_patch_language_combobox_common_activated(int index);
+
 private:
     Ui::SettingsWidget *ui;
     LegacyApp *app;
+    QTimer ui_update_timer;
 };
 
 #endif // SETTINGSWIDGET_H

+ 147 - 29
gui/settingswidget.ui

@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>825</width>
-    <height>495</height>
+    <width>817</width>
+    <height>653</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -36,7 +36,7 @@
     <number>10</number>
    </property>
    <item row="3" column="1">
-    <widget class="QWidget" name="widget" native="true">
+    <widget class="QWidget" name="standart_settings_widget" native="true">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
        <horstretch>0</horstretch>
@@ -60,8 +60,7 @@ background-color: rgba(30, 0, 0, 100);</string>
          </sizepolicy>
         </property>
         <property name="styleSheet">
-         <string notr="true">background-color: none;
-font: 18px &quot;Trebuchet MS&quot;;</string>
+         <string notr="true">background-color: none;</string>
         </property>
         <property name="text">
          <string>Основные</string>
@@ -104,6 +103,17 @@ background-color: none;</string>
         </property>
        </widget>
       </item>
+      <item>
+       <widget class="QCheckBox" name="expert_tabs_checkbox_common">
+        <property name="styleSheet">
+         <string notr="true">
+background-color: none;</string>
+        </property>
+        <property name="text">
+         <string>Показывать дополнительные опции</string>
+        </property>
+       </widget>
+      </item>
       <item>
        <widget class="QWidget" name="widget_3" native="true">
         <property name="sizePolicy">
@@ -129,6 +139,12 @@ background-color: none;</string>
          <property name="topMargin">
           <number>0</number>
          </property>
+         <property name="rightMargin">
+          <number>0</number>
+         </property>
+         <property name="bottomMargin">
+          <number>0</number>
+         </property>
          <item>
           <widget class="QCheckBox" name="restrict_download_speed_checkbox_common">
            <property name="sizePolicy">
@@ -208,7 +224,7 @@ background-color: none;</string>
     </widget>
    </item>
    <item row="2" column="1">
-    <widget class="QWidget" name="widget_6" native="true">
+    <widget class="QWidget" name="management_widget" native="true">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
        <horstretch>0</horstretch>
@@ -323,7 +339,7 @@ background-color: rgba(30, 0, 0, 100);</string>
      </property>
      <layout class="QVBoxLayout" name="verticalLayout_2">
       <property name="spacing">
-       <number>11</number>
+       <number>0</number>
       </property>
       <item>
        <widget class="QLabel" name="interface_label_title">
@@ -346,6 +362,18 @@ background-color: none;</string>
 background-color: none;</string>
         </property>
         <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <property name="leftMargin">
+          <number>0</number>
+         </property>
+         <property name="topMargin">
+          <number>0</number>
+         </property>
+         <property name="rightMargin">
+          <number>0</number>
+         </property>
+         <property name="bottomMargin">
+          <number>0</number>
+         </property>
          <item>
           <widget class="QLabel" name="interface_scale_common">
            <property name="sizePolicy">
@@ -369,7 +397,7 @@ background-color: none;</string>
            </property>
            <property name="minimumSize">
             <size>
-             <width>60</width>
+             <width>80</width>
              <height>0</height>
             </size>
            </property>
@@ -444,11 +472,13 @@ background-color: none;</string>
       </sizepolicy>
      </property>
      <property name="styleSheet">
-      <string notr="true">border-radius: 20px;
-background-color: rgba(30, 0, 0, 100);</string>
+      <string notr="true">QWidget#game_folder_widget{
+	border-radius: 20px;
+	background-color: rgba(30, 0, 0, 100);
+}</string>
      </property>
-     <layout class="QHBoxLayout" name="horizontalLayout">
-      <item>
+     <layout class="QGridLayout" name="gridLayout_2">
+      <item row="0" column="0">
        <widget class="QLabel" name="folder_label_common">
         <property name="styleSheet">
          <string notr="true">
@@ -459,7 +489,34 @@ background-color: none;</string>
         </property>
        </widget>
       </item>
-      <item>
+      <item row="0" column="2">
+       <widget class="QPushButton" name="change_folder_button">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>36</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="cursor">
+         <cursorShape>PointingHandCursor</cursorShape>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">border-image: url(:/assets/folder.png);
+
+background-color: none;</string>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
        <widget class="QLabel" name="folder_value_common">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -472,38 +529,99 @@ background-color: none;</string>
 background-color: none;</string>
         </property>
         <property name="text">
-         <string>D:\Programming\SourceRepos\Legacy_v2</string>
+         <string>(не выбрана)</string>
         </property>
        </widget>
       </item>
-      <item>
-       <widget class="QPushButton" name="change_folder_button">
+      <item row="1" column="0" colspan="3">
+       <widget class="QWidget" name="widget_5" native="true">
         <property name="sizePolicy">
-         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
         <property name="minimumSize">
          <size>
-          <width>36</width>
-          <height>32</height>
+          <width>0</width>
+          <height>30</height>
          </size>
         </property>
-        <property name="styleSheet">
-         <string notr="true">border-image: url(:/assets/folder.png);
-
-background-color: none;</string>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <property name="leftMargin">
+          <number>0</number>
+         </property>
+         <property name="topMargin">
+          <number>0</number>
+         </property>
+         <property name="rightMargin">
+          <number>0</number>
+         </property>
+         <property name="bottomMargin">
+          <number>0</number>
+         </property>
+         <item>
+          <widget class="QLabel" name="label_common">
+           <property name="text">
+            <string>Какую версию игры локализовать?</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="lotro_patch_language_combobox_common">
+           <property name="styleSheet">
+            <string notr="true">color: black;</string>
+           </property>
+           <item>
+            <property name="text">
+             <string>Английскую</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Немецкую</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Французскую</string>
+            </property>
+           </item>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_4">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
        </widget>
       </item>
      </layout>
     </widget>
    </item>
-   <item row="1" column="0" rowspan="4">
+   <item row="5" column="1">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="1" column="0" rowspan="5">
     <spacer name="horizontalSpacer">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
@@ -519,7 +637,7 @@ background-color: none;</string>
      </property>
     </spacer>
    </item>
-   <item row="1" column="2" rowspan="4">
+   <item row="1" column="2" rowspan="5">
     <spacer name="horizontalSpacer_2">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>

+ 9 - 0
gui/statuswidget.h

@@ -20,6 +20,15 @@ public:
 private:
     Ui::StatusWidget *ui;
     LegacyApp *app;
+
+    const QColor inWorkColor = QColor(85, 170, 255);
+    const QColor readyColor = QColor(0, 170, 0);
+    const QColor errorColor = QColor(255, 85, 0);
+
+    const QString inWorkIconStyle = "image: url(:/assets/info.png);";
+    const QString readyIconStyle = "image: url(:/assets/ok.png);";
+    const QString criticalIconStyle = "image: url(:/assets/critical.png);";
+    const QString warningIconStyle = "image: url(:/assets/warning.png);";
 };
 
 #endif // STATUSWIDGET_H

+ 15 - 15
gui/statuswidget.ui

@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>696</width>
-    <height>382</height>
+    <width>764</width>
+    <height>495</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -46,6 +46,19 @@
    <item row="0" column="2" rowspan="3">
     <widget class="QWidget" name="right_column_widget" native="true">
      <layout class="QGridLayout" name="gridLayout_2">
+      <item row="1" column="0">
+       <spacer name="horizontalSpacer_3">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>219</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
       <item row="0" column="0" colspan="2">
        <widget class="QWidget" name="common_status_widget" native="true">
         <property name="styleSheet">
@@ -303,19 +316,6 @@ background-color: rgba(30, 0, 0, 100);</string>
         </layout>
        </widget>
       </item>
-      <item row="1" column="0">
-       <spacer name="horizontalSpacer_3">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>219</width>
-          <height>20</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
       <item row="1" column="1">
        <widget class="QWidget" name="buttons_widget" native="true">
         <property name="sizePolicy">

+ 1 - 1
include/filesystem.h

@@ -17,7 +17,7 @@ public:
     static bool fileExists(QString path);
     static QString fileHash(const QString &fileName, QCryptographicHash::Algorithm hashAlgorithm);
     static void clearFolder(QDir &dir);
-
+    static QStringList recognizeRegistryLotroPath();
 signals:
 
 public slots:

+ 0 - 1
include/legacyapp.h

@@ -22,7 +22,6 @@ public:
 
     void Init();
 
-
 private:
     void StartDatFilesInitialisation();
 

+ 45 - 0
src/filesystem.cpp

@@ -1,5 +1,6 @@
 #include "filesystem.h"
 #include <QDebug>
+#include <QSettings>
 
 bool FileSystem::fileExists(QString path) {
     QFileInfo check_file(path);
@@ -33,3 +34,47 @@ void FileSystem::clearFolder(QDir &dir){
         QFile::remove(entryAbsPath);
     }
 }
+
+QStringList FileSystem::recognizeRegistryLotroPath()
+{
+    QStringList paths;
+
+    #ifdef _WIN32
+        // Windows 8, 10
+        QSettings n("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\12bbe590-c890-11d9-9669-0800200c9a66_is1", QSettings::NativeFormat);
+        foreach (QString key, n.allKeys()) {
+            qDebug() << key;
+            if(key.contains("InstallLocation") || key.contains("installlocation")){
+                QString folder = n.value(key).toString()
+                        .replace("\\", "/")
+                        .replace("/TurbineLauncher.exe", "")
+                        .replace("/LotroLauncher.exe", "")
+                        .replace("\"", "");
+
+                if(FileSystem::fileExists(folder + "/LotroLauncher.exe"))
+                    paths.append(folder);
+            }
+        }
+
+
+        // Windows 7
+        QSettings m("HKEY_CLASSES_ROOT\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache", QSettings::NativeFormat);
+        foreach (QString key, m.allKeys()) {
+          if((key.contains("TurbineLauncher.exe") || key.contains("LotroLauncher.exe")) && FileSystem::fileExists(key)){
+              QString folder = n.value(key).toString()
+                      .replace("\\", "/")
+                      .replace("/TurbineLauncher.exe", "")
+                      .replace("/LotroLauncher.exe", "")
+                      .replace("\"", "");
+
+              if(FileSystem::fileExists(folder + "/LotroLauncher.exe"))
+                  paths.append(folder);
+          }
+        }
+    #else
+        // Реализация под Linux
+    #endif
+
+    return paths;
+
+}

+ 1 - 1
src/legacyapp.cpp

@@ -16,7 +16,7 @@ void LegacyApp::Init()
 
 void LegacyApp::StartDatFilesInitialisation()
 {
-    QString lotro_dir_path = properties.value("lotro/folder", "none").toString();
+    QString lotro_dir_path = properties.value("settings/lotro_folder", "none").toString();
     QString locale = properties.value("lotro/locale", "English").toString();
 
     qDebug() << "Initialising file " << lotro_dir_path + "/client_local_" + locale + ".dat";