Sfoglia il codice sorgente

UI draft for map translations

nordsoft 2 anni fa
parent
commit
db93b8eaa1

+ 3 - 0
mapeditor/CMakeLists.txt

@@ -21,6 +21,7 @@ set(editor_SRCS
 		mapsettings/loseconditions.cpp
 		mapsettings/eventsettings.cpp
 		mapsettings/rumorsettings.cpp
+		mapsettings/translations.cpp
 		playersettings.cpp
 		playerparams.cpp
 		scenelayer.cpp
@@ -58,6 +59,7 @@ set(editor_HEADERS
 		mapsettings/loseconditions.h
 		mapsettings/eventsettings.h
 		mapsettings/rumorsettings.h
+		mapsettings/translations.h
 		playersettings.h
 		playerparams.h
 		scenelayer.h
@@ -85,6 +87,7 @@ set(editor_FORMS
 		mapsettings/loseconditions.ui
 		mapsettings/eventsettings.ui
 		mapsettings/rumorsettings.ui
+		mapsettings/translations.ui
 		playersettings.ui
 		playerparams.ui
 		validator.ui

BIN
mapeditor/icons/translations.png


+ 9 - 0
mapeditor/mainwindow.cpp

@@ -42,6 +42,7 @@
 #include "objectbrowser.h"
 #include "inspector/inspector.h"
 #include "mapsettings/mapsettings.h"
+#include "mapsettings/translations.h"
 #include "playersettings.h"
 #include "validator.h"
 
@@ -300,6 +301,7 @@ void MainWindow::initializeMap(bool isNew)
 	//enable settings
 	ui->actionMapSettings->setEnabled(true);
 	ui->actionPlayers_settings->setEnabled(true);
+	ui->actionTranslations->setEnabled(true);
 	
 	//set minimal players count
 	if(isNew)
@@ -1239,3 +1241,10 @@ void MainWindow::on_actionExport_triggered()
 	}
 }
 
+
+void MainWindow::on_actionTranslations_triggered()
+{
+	auto translationsDialog = new Translations(*controller.map(), this);
+	translationsDialog->show();
+}
+

+ 2 - 0
mapeditor/mainwindow.h

@@ -117,6 +117,8 @@ private slots:
 
 	void on_actionExport_triggered();
 
+	void on_actionTranslations_triggered();
+
 public slots:
 
 	void treeViewSelected(const QModelIndex &selected, const QModelIndex &deselected);

+ 21 - 4
mapeditor/mainwindow.ui

@@ -51,7 +51,7 @@
      <x>0</x>
      <y>0</y>
      <width>1024</width>
-     <height>22</height>
+     <height>37</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">
@@ -70,6 +70,7 @@
     </property>
     <addaction name="actionMapSettings"/>
     <addaction name="actionPlayers_settings"/>
+    <addaction name="actionTranslations"/>
     <addaction name="actionValidate"/>
     <addaction name="actionUpdate_appearance"/>
     <addaction name="actionRecreate_obstacles"/>
@@ -140,6 +141,7 @@
    <addaction name="actionPaste"/>
    <addaction name="separator"/>
    <addaction name="actionFill"/>
+   <addaction name="actionTranslations"/>
   </widget>
   <widget class="QDockWidget" name="dockWidget_2">
    <property name="sizePolicy">
@@ -754,7 +756,7 @@
           <x>0</x>
           <y>0</y>
           <width>128</width>
-          <height>251</height>
+          <height>236</height>
          </rect>
         </property>
         <property name="sizePolicy">
@@ -797,7 +799,7 @@
           <x>0</x>
           <y>0</y>
           <width>128</width>
-          <height>251</height>
+          <height>236</height>
          </rect>
         </property>
         <property name="sizePolicy">
@@ -833,7 +835,7 @@
           <x>0</x>
           <y>0</y>
           <width>128</width>
-          <height>251</height>
+          <height>236</height>
          </rect>
         </property>
         <property name="sizePolicy">
@@ -1237,6 +1239,21 @@
     <string>Export as...</string>
    </property>
   </action>
+  <action name="actionTranslations">
+   <property name="enabled">
+    <bool>false</bool>
+   </property>
+   <property name="icon">
+    <iconset>
+     <normaloff>icons:translations.png</normaloff>icons:translations.png</iconset>
+   </property>
+   <property name="text">
+    <string>Translations</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+T</string>
+   </property>
+  </action>
  </widget>
  <customwidgets>
   <customwidget>

+ 43 - 0
mapeditor/mapsettings/translations.cpp

@@ -0,0 +1,43 @@
+/*
+ * translations.cpp, part of VCMI engine
+ *
+ * Authors: listed in file AUTHORS in main folder
+ *
+ * License: GNU General Public License v2.0 or later
+ * Full text of license available in license.txt file, in main folder
+ *
+ */
+
+#include "translations.h"
+#include "ui_translations.h"
+
+Translations::Translations(CMapHeader & mh, QWidget *parent) :
+	QDialog(parent),
+	ui(new Ui::Translations),
+	mapHeader(mh)
+{
+	ui->setupUi(this);
+}
+
+Translations::~Translations()
+{
+	delete ui;
+}
+
+void Translations::on_languageSelect_currentIndexChanged(int index)
+{
+
+}
+
+
+void Translations::on_supportedCheck_toggled(bool checked)
+{
+
+}
+
+
+void Translations::on_translationsTable_itemChanged(QTableWidgetItem *item)
+{
+
+}
+

+ 38 - 0
mapeditor/mapsettings/translations.h

@@ -0,0 +1,38 @@
+/*
+ * translations.h, part of VCMI engine
+ *
+ * Authors: listed in file AUTHORS in main folder
+ *
+ * License: GNU General Public License v2.0 or later
+ * Full text of license available in license.txt file, in main folder
+ *
+ */
+
+#pragma once
+
+#include <QDialog>
+#include "../lib/mapping/CMapHeader.h"
+
+namespace Ui {
+class Translations;
+}
+
+class Translations : public QDialog
+{
+	Q_OBJECT
+
+public:
+	explicit Translations(CMapHeader & mapHeader, QWidget *parent = nullptr);
+	~Translations();
+
+private slots:
+	void on_languageSelect_currentIndexChanged(int index);
+
+	void on_supportedCheck_toggled(bool checked);
+
+	void on_translationsTable_itemChanged(QTableWidgetItem *item);
+
+private:
+	Ui::Translations *ui;
+	CMapHeader & mapHeader;
+};

+ 84 - 0
mapeditor/mapsettings/translations.ui

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Translations</class>
+ <widget class="QDialog" name="Translations">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>989</width>
+    <height>641</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Map translations</string>
+  </property>
+  <property name="modal">
+   <bool>true</bool>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>Language</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QComboBox" name="languageSelect">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QCheckBox" name="supportedCheck">
+       <property name="text">
+        <string>Suppported</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QTableWidget" name="translationsTable">
+     <attribute name="horizontalHeaderDefaultSectionSize">
+      <number>240</number>
+     </attribute>
+     <attribute name="horizontalHeaderStretchLastSection">
+      <bool>true</bool>
+     </attribute>
+     <attribute name="verticalHeaderVisible">
+      <bool>false</bool>
+     </attribute>
+     <attribute name="verticalHeaderDefaultSectionSize">
+      <number>24</number>
+     </attribute>
+     <column>
+      <property name="text">
+       <string>String ID</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Text</string>
+      </property>
+     </column>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>