From 8cdc9985d288264a376009c4c78dae6661ad868d Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 26 Jan 2023 00:30:51 +0200 Subject: [PATCH] Small redesign of Settings tab in Launcher --- launcher/settingsView/csettingsview_moc.cpp | 23 +- launcher/settingsView/csettingsview_moc.h | 2 + launcher/settingsView/csettingsview_moc.ui | 1251 +++++++++---------- 3 files changed, 646 insertions(+), 630 deletions(-) diff --git a/launcher/settingsView/csettingsview_moc.cpp b/launcher/settingsView/csettingsview_moc.cpp index 902992081..4e7b3098e 100644 --- a/launcher/settingsView/csettingsview_moc.cpp +++ b/launcher/settingsView/csettingsview_moc.cpp @@ -202,7 +202,7 @@ CSettingsView::CSettingsView(QWidget * parent) { ui->setupUi(this); - ui->labelBuildVersion->setText(QString::fromStdString(GameConstants::VCMI_VERSION)); + ui->lineEditBuildVersion->setText(QString::fromStdString(GameConstants::VCMI_VERSION)); loadSettings(); } @@ -359,3 +359,24 @@ void CSettingsView::on_comboBoxCursorType_currentIndexChanged(int index) node->String() = cursorTypesList[index]; } + +void CSettingsView::on_listWidgetSettings_currentRowChanged(int currentRow) +{ + QVector targetWidgets = { + ui->labelGeneral, + ui->labelVideo, + ui->labelArtificialIntelligence, + ui->labelDataDirs, + ui->labelRepositories + }; + + QWidget * currentTarget = targetWidgets[currentRow]; + + // We want to scroll in a way that will put target widget in topmost visible position + // To show not just header, but all settings in this group as well + // In order to do that, let's scroll to the very bottom and the scroll back up until target widget is visible + int maxPosition = ui->settingsScrollArea->verticalScrollBar()->maximum(); + ui->settingsScrollArea->verticalScrollBar()->setValue(maxPosition); + ui->settingsScrollArea->ensureWidgetVisible(currentTarget, 5, 5); + +} diff --git a/launcher/settingsView/csettingsview_moc.h b/launcher/settingsView/csettingsview_moc.h index 987143924..84a044eb7 100644 --- a/launcher/settingsView/csettingsview_moc.h +++ b/launcher/settingsView/csettingsview_moc.h @@ -73,6 +73,8 @@ private slots: void on_comboBoxCursorType_currentIndexChanged(int index); + void on_listWidgetSettings_currentRowChanged(int currentRow); + private: Ui::CSettingsView * ui; diff --git a/launcher/settingsView/csettingsview_moc.ui b/launcher/settingsView/csettingsview_moc.ui index 73c7226f8..8182a6d22 100644 --- a/launcher/settingsView/csettingsview_moc.ui +++ b/launcher/settingsView/csettingsview_moc.ui @@ -6,14 +6,14 @@ 0 0 - 779 - 619 + 842 + 363 - + 0 @@ -26,642 +26,635 @@ 0 - - - - false + + + + + 1 + 0 + - 150 + 200 0 - - /home/user/.vcmi + + + 75 + true + - + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + false + + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::SelectRows + + + 4 + + + + General + + + + + Video + + + + + Artificial Intelligence + + + + + Data Directories + + + + + Mod Repositories + + + + + + + + + 100 + 0 + + + + Qt::ScrollBarAlwaysOn + + + Qt::ScrollBarAlwaysOff + + true - - - - - - - 75 - true - - - - Launcher Settings - - - - - - - - 150 - 0 - - - - /usr/share/vcmi - - - - - - - false - - - Change - - - - - - - 1 - - - - Off + + + + 0 + 0 + 620 + 762 + - - - - On - - - - - - - - Open - - - - - - - Heroes III character set - - - - - - - Fullscreen - - - - - - - 1 - - - - Off - - - - - On - - - - - - - - Log files directory - - - - - - - false - - - - 150 - 0 - - - - /home/user/.vcmi - - - true - - - - - - - Autosave - - - - - - - - 75 - true - - - - Repositories - - - - - - - Check for updates - - - - - - - - - - Check repositories on startup - - - - - - - Open - - - - - - - Player AI - - - - - - - Display index - - - - - - - - 75 - true - true - false - - - - AI in the battlefield - - - - - - - QPlainTextEdit::NoWrap - - - http://downloads.vcmi.eu/Mods/repository.json - - - - - - - - 75 - true - - - - General - - - - - - - Show intro - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 8 - - - - - - - - Build version - - - - - - - Extra data directory - - - - - - - Resolution - - - - - - - 0 - - - - Off - - - - - On - - - - - Real - - - - - - - - 1 - - - - Off - - - - - On - - - - - - - - - 75 - true - - - - AI on the map - - - - - - - VCAI - - - - VCAI - - - - - Nullkiller - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 8 - 20 - - - - - - - - - - - Open - - - - - - - - 75 - true - - - - Video - - - - - - - - 75 - true - - - - Data Directories - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 56 - 8 - - - - - - - - User data directory - - - - - - - Network port - - - - - - - 1024 - - - 65535 - - - 3030 - - - - - - - VCMI Language - - - - - - - - - - - - - - - Automatic detection - - - - - Central European (Windows 1250) - - - - - Cyrillic script (Windows 1251) - - - - - Western European (Windows 1252) - - - - - Simplified Chinese (GBK) - - - - - Simplified Chinese (GB2312) - - - - - Korean (Windows 949) - - - - - - - - - English - - - - - Deutsch (German) - - - - - Polska (Polish) - - - - - Русский (Russian) - - - - - Українська (Ukrainian) - - - - - - - - Neutral AI - - - - - - - BattleAI - - - - BattleAI - - - - - StupidAI - - - - - - - - - 0 - 22 - - - - Friendly AI - - - - - - - false - - - BattleAI - - - - BattleAI - - - - - StupidAI - - - - - - - - false - - - BattleAI - - - - BattleAI - - - - - StupidAI - - - - - - - - - 0 - 22 - - - - Enemy AI - - - - - - - Cursor - - - - - - - - Default - - - - - Hardware - - - - - Software - - + + + + + + 75 + true + + + + General + + + + + + + VCMI Language + + + + + + + Heroes III character set + + + + + + + + Automatic detection + + + + + Central European (Windows 1250) + + + + + Cyrillic script (Windows 1251) + + + + + Western European (Windows 1252) + + + + + Simplified Chinese (GBK) + + + + + Simplified Chinese (GB2312) + + + + + Korean (Windows 949) + + + + + + + + Network port + + + + + + + Autosave + + + + + + + Build version + + + + + + + + 75 + true + + + + Video + + + + + + + Resolution + + + + + + + Fullscreen + + + + + + + Show intro + + + + + + + Display index + + + + + + + Cursor + + + + + + + + 75 + true + + + + Artificial Intelligence + + + + + + + Adventure Map AI + + + + + + + Neutral AI + + + + + + + Friendly AI + + + + + + + Enemy AI + + + + + + + + 75 + true + + + + Data Directories + + + + + + + Extra data directory + + + + + + + /usr/share/vcmi + + + + + + + false + + + Change + + + + + + + Open + + + + + + + User data directory + + + + + + + Open + + + + + + + Log files directory + + + + + + + Open + + + + + + + + 75 + true + + + + Mod Repositories + + + + + + + Check on startup + + + + + + + 1 + + + + Off + + + + + On + + + + + + + + Update now + + + + + + + QPlainTextEdit::NoWrap + + + http://downloads.vcmi.eu/Mods/repository.json + + + + + + + + Default + + + + + Hardware + + + + + Software + + + + + + + + + English + + + + + Deutsch (German) + + + + + Polska (Polish) + + + + + Русский (Russian) + + + + + Українська (Ukrainian) + + + + + + + + 1024 + + + 65535 + + + 3030 + + + + + + + 1 + + + + Off + + + + + On + + + + + + + + + + + false + + + /home/user/.vcmi + + + true + + + + + + + false + + + /home/user/.vcmi + + + true + + + + + + + false + + + BattleAI + + + + BattleAI + + + + + StupidAI + + + + + + + + false + + + BattleAI + + + + BattleAI + + + + + StupidAI + + + + + + + + BattleAI + + + + BattleAI + + + + + StupidAI + + + + + + + + VCAI + + + + VCAI + + + + + Nullkiller + + + + + + + + + + + 1 + + + + Off + + + + + On + + + + + + + + 0 + + + + Off + + + + + On + + + + + Real + + + + + + + + + + + true + + + + +