1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-13 22:06:58 +02:00

Cursor type is now configurable in Launcher

This commit is contained in:
Ivan Savenko 2023-01-19 18:14:10 +02:00
parent 8d407be67f
commit f5a7f5173f
4 changed files with 53 additions and 4 deletions

@ -82,7 +82,7 @@
"type" : "object", "type" : "object",
"additionalProperties" : false, "additionalProperties" : false,
"default": {}, "default": {},
"required" : [ "screenRes", "bitsPerPixel", "fullscreen", "realFullscreen", "softwareCursor", "spellbookAnimation", "driver", "showIntro", "displayIndex" ], "required" : [ "screenRes", "bitsPerPixel", "fullscreen", "realFullscreen", "cursor", "spellbookAnimation", "driver", "showIntro", "displayIndex" ],
"properties" : { "properties" : {
"screenRes" : { "screenRes" : {
"type" : "object", "type" : "object",
@ -106,9 +106,10 @@
"type" : "boolean", "type" : "boolean",
"default" : false "default" : false
}, },
"softwareCursor" : { "cursor" : {
"type" : "boolean", "type" : "string",
"default" : false "enum" : [ "auto", "hardware", "software" ],
"default" : "auto"
}, },
"showIntro" : { "showIntro" : {
"type" : "boolean", "type" : "boolean",

@ -58,6 +58,13 @@ static const std::string languageTagList[] =
"ukrainian", "ukrainian",
}; };
static const std::string cursorTypesList[] =
{
"auto",
"hardware",
"software"
};
void CSettingsView::setDisplayList() void CSettingsView::setDisplayList()
{ {
QStringList list; QStringList list;
@ -89,6 +96,8 @@ void CSettingsView::loadSettings()
ui->comboBoxFullScreen->setDisabled(true); ui->comboBoxFullScreen->setDisabled(true);
#else #else
ui->comboBoxFullScreen->setCurrentIndex(settings["video"]["fullscreen"].Bool()); ui->comboBoxFullScreen->setCurrentIndex(settings["video"]["fullscreen"].Bool());
if (settings["video"]["realFullscreen"].Bool())
ui->comboBoxFullScreen->setCurrentIndex(2);
#endif #endif
ui->comboBoxFriendlyAI->setCurrentText(QString::fromStdString(settings["server"]["friendlyAI"].String())); ui->comboBoxFriendlyAI->setCurrentText(QString::fromStdString(settings["server"]["friendlyAI"].String()));
@ -120,6 +129,10 @@ void CSettingsView::loadSettings()
size_t languageIndex = boost::range::find(languageTagList, language) - languageTagList; size_t languageIndex = boost::range::find(languageTagList, language) - languageTagList;
if(languageIndex < ui->comboBoxLanguage->count()) if(languageIndex < ui->comboBoxLanguage->count())
ui->comboBoxLanguage->setCurrentIndex((int)languageIndex); ui->comboBoxLanguage->setCurrentIndex((int)languageIndex);
std::string cursorType = settings["video"]["cursor"].String();
size_t cursorTypeIndex = boost::range::find(cursorTypesList, cursorType) - cursorTypesList;
ui->comboBoxCursorType->setCurrentIndex((int)cursorTypeIndex);
} }
void CSettingsView::fillValidResolutions(bool isExtraResolutionsModEnabled) void CSettingsView::fillValidResolutions(bool isExtraResolutionsModEnabled)
@ -339,3 +352,10 @@ void CSettingsView::changeEvent(QEvent *event)
} }
QWidget::changeEvent(event); QWidget::changeEvent(event);
} }
void CSettingsView::on_comboBoxCursorType_currentIndexChanged(int index)
{
Settings node = settings.write["video"]["cursor"];
node->String() = cursorTypesList[index];
}

@ -71,6 +71,8 @@ private slots:
void on_comboBoxLanguage_currentIndexChanged(int index); void on_comboBoxLanguage_currentIndexChanged(int index);
void on_comboBoxCursorType_currentIndexChanged(int index);
private: private:
Ui::CSettingsView * ui; Ui::CSettingsView * ui;

@ -638,6 +638,32 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1">
<widget class="QLabel" name="labelCursorType">
<property name="text">
<string>Cursor</string>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QComboBox" name="comboBoxCursorType">
<item>
<property name="text">
<string>Default</string>
</property>
</item>
<item>
<property name="text">
<string>Hardware</string>
</property>
</item>
<item>
<property name="text">
<string>Software</string>
</property>
</item>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>