summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2020-12-30 20:24:34 +0100
committerMikaël Capelle <capelle.mikael@gmail.com>2021-01-02 15:38:17 +0100
commit07c2badd174059f7cc4ca404c22c6741b679cc7f (patch)
treeca2cc630afa08187a8cc1a675c42c725fc9a02a4 /src
parent89ff59da4613f06a05a633b4aa4387470831ce94 (diff)
Fix rebase from 54736a6.
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp42
-rw-r--r--src/modlistview.cpp2
2 files changed, 33 insertions, 11 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 3af7079f..bafe05f5 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -477,7 +477,6 @@ MainWindow::MainWindow(Settings &settings
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Enter), this, SLOT(openExplorer_activated()));
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return), this, SLOT(openExplorer_activated()));
- new QShortcut(QKeySequence::Refresh, this, SLOT(refreshProfile_activated()));
setFilterShortcuts(ui->modList, ui->modFilterEdit);
setFilterShortcuts(ui->espList, ui->espFilterEdit);
@@ -1580,17 +1579,17 @@ void MainWindow::on_profileBox_currentIndexChanged(int index)
m_OldProfileIndex = index;
if ((previousIndex != -1) &&
- (m_OrganizerCore.currentProfile() != nullptr) &&
- m_OrganizerCore.currentProfile()->exists()) {
+ (m_OrganizerCore.currentProfile() != nullptr) &&
+ m_OrganizerCore.currentProfile()->exists()) {
m_OrganizerCore.saveCurrentLists();
}
// Avoid doing any refresh if currentProfile is already set but previous index was -1
// as it means that this is happening during initialization so everything has already been set.
if (previousIndex == -1
- && m_OrganizerCore.currentProfile() != nullptr
- && m_OrganizerCore.currentProfile()->exists()
- && ui->profileBox->currentText() == m_OrganizerCore.currentProfile()->name()){
+ && m_OrganizerCore.currentProfile() != nullptr
+ && m_OrganizerCore.currentProfile()->exists()
+ && ui->profileBox->currentText() == m_OrganizerCore.currentProfile()->name()) {
return;
}
@@ -1602,22 +1601,36 @@ void MainWindow::on_profileBox_currentIndexChanged(int index)
if (ui->profileBox->currentIndex() == 0) {
ui->profileBox->setCurrentIndex(previousIndex);
- ProfilesDialog(ui->profileBox->currentText(), m_OrganizerCore, this).exec();
+
+ std::optional<QString> newSelection;
+
+ ProfilesDialog dlg(ui->profileBox->currentText(), m_OrganizerCore, this);
+ dlg.exec();
+ newSelection = dlg.selectedProfile();
+
while (!refreshProfiles()) {
- ProfilesDialog(ui->profileBox->currentText(), m_OrganizerCore, this).exec();
+ ProfilesDialog dlg(ui->profileBox->currentText(), m_OrganizerCore, this);
+ dlg.exec();
+ newSelection = dlg.selectedProfile();
}
- } else {
+
+ if (newSelection) {
+ ui->profileBox->setCurrentText(*newSelection);
+ activateSelectedProfile();
+ }
+ }
+ else {
activateSelectedProfile();
}
- LocalSavegames *saveGames = m_OrganizerCore.managedGame()->feature<LocalSavegames>();
+ LocalSavegames* saveGames = m_OrganizerCore.managedGame()->feature<LocalSavegames>();
if (saveGames != nullptr) {
if (saveGames->prepareProfile(m_OrganizerCore.currentProfile())) {
m_SavesTab->refreshSaveList();
}
}
- BSAInvalidation *invalidation = m_OrganizerCore.managedGame()->feature<BSAInvalidation>();
+ BSAInvalidation* invalidation = m_OrganizerCore.managedGame()->feature<BSAInvalidation>();
if (invalidation != nullptr) {
if (invalidation->prepareProfile(m_OrganizerCore.currentProfile())) {
QTimer::singleShot(5, &m_OrganizerCore, SLOT(profileRefresh()));
@@ -2182,6 +2195,11 @@ void MainWindow::on_actionInstallMod_triggered()
installMod();
}
+void MainWindow::on_action_Refresh_triggered()
+{
+ refreshProfile_activated();
+}
+
void MainWindow::on_actionAdd_Profile_triggered()
{
for (;;) {
@@ -2390,6 +2408,7 @@ void MainWindow::restoreBackup_clicked(int modIndex)
reportError(tr("failed to rename \"%1\" to \"%2\"").arg(modInfo->absolutePath()).arg(destinationPath));
}
m_OrganizerCore.refresh();
+ ui->modList->updateModCount();
}
}
}
@@ -2528,6 +2547,7 @@ void MainWindow::backupMod_clicked(int modIndex)
tr("Failed to create backup."));
}
m_OrganizerCore.refresh();
+ ui->modList->updateModCount();
}
diff --git a/src/modlistview.cpp b/src/modlistview.cpp
index be173478..b36a77d9 100644
--- a/src/modlistview.cpp
+++ b/src/modlistview.cpp
@@ -438,6 +438,8 @@ void ModListView::onModFilterActive(bool filterActive)
void ModListView::updateModCount()
{
+ TimeThis tt("updateModCount");
+
int activeCount = 0;
int visActiveCount = 0;
int backupCount = 0;