Browse Source

Define touchscreen mode at first launch

nordsoft 2 years ago
parent
commit
3e6a656e4c
2 changed files with 17 additions and 0 deletions
  1. 14 0
      launcher/firstLaunch/firstlaunch_moc.cpp
  2. 3 0
      launcher/firstLaunch/firstlaunch_moc.h

+ 14 - 0
launcher/firstLaunch/firstlaunch_moc.cpp

@@ -102,6 +102,7 @@ void FirstLaunchView::on_comboBoxLanguage_currentIndexChanged(int index)
 
 void FirstLaunchView::enterSetup()
 {
+	setupPlatformSettings();
 	Languages::fillLanguages(ui->listWidgetLanguage, false);
 }
 
@@ -158,6 +159,19 @@ void FirstLaunchView::exitSetup()
 		mainWindow->exitSetup();
 }
 
+// Initial platform-dependend settings
+void FirstLaunchView::setupPlatformSettings()
+{
+#if defined(VCMI_MOBILE)
+	bool touchscreenMode = true;
+#else
+	bool touchscreenMode = false
+#endif
+	
+	Settings node = settings.write["battle"]["touchscreenMode"];
+	node->Bool() = touchscreenMode;
+}
+
 // Tab Language
 void FirstLaunchView::languageSelected(const QString & selectedLanguage)
 {

+ 3 - 0
launcher/firstLaunch/firstlaunch_moc.h

@@ -37,6 +37,9 @@ class FirstLaunchView : public QWidget
 	void activateTabHeroesData();
 	void activateTabModPreset();
 	void exitSetup();
+	
+	// Initial platform-dependend settings
+	void setupPlatformSettings();
 
 	// Tab Language
 	void languageSelected(const QString & languageCode);