From a14ed8fcd1f0cb06fb9353a3f672a70251394e2c Mon Sep 17 00:00:00 2001 From: Al12rs Date: Mon, 16 Apr 2018 18:38:54 +0200 Subject: Changed the modifodialog to open the first enabled left most tab, if no particular tab was specified by the function caller. This will allow the users to choose what tab should be opened when opening the mod informations since the order of the tabs can be changed and is saved. --- src/mainwindow.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 802adc24..401e3c8b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2461,9 +2461,24 @@ void MainWindow::displayModInformation(ModInfo::Ptr modInfo, unsigned int index, connect(&dialog, SIGNAL(modOpenPrev()), this, SLOT(modOpenPrev()), Qt::QueuedConnection); connect(&dialog, SIGNAL(originModified(int)), this, SLOT(originModified(int))); connect(&dialog, SIGNAL(endorseMod(ModInfo::Ptr)), this, SLOT(endorseMod(ModInfo::Ptr))); + + //Open the tab first if we want to use the standard indexes of the tabs. + if (tab != -1) { + dialog.openTab(tab); + } - dialog.openTab(tab); dialog.restoreTabState(m_OrganizerCore.settings().directInterface().value("mod_info_tabs").toByteArray()); + + //If no tab was specified use the first tab from the left based on the user order. + if (tab == -1) { + for (int i = 0; i < dialog.findChild("tabWidget")->count(); ++i) { + if (dialog.findChild("tabWidget")->isTabEnabled(i)) { + dialog.findChild("tabWidget")->setCurrentIndex(i); + break; + } + } + } + dialog.exec(); m_OrganizerCore.settings().directInterface().setValue("mod_info_tabs", dialog.saveTabState()); -- cgit v1.3.1