forked from mirror/openmw-tes3mp
Launcher: fix bugs deleting profiles (Fixes #2188)
This commit is contained in:
parent
46cf2a7a77
commit
9ef6e95bf6
2 changed files with 12 additions and 8 deletions
|
@ -154,9 +154,11 @@ void Launcher::DataFilesPage::setProfile(int index, bool savePrevious)
|
|||
{
|
||||
if (index >= -1 && index < ui.profilesComboBox->count())
|
||||
{
|
||||
QString previous = ui.profilesComboBox->itemText(ui.profilesComboBox->currentIndex());
|
||||
QString previous = mPreviousProfile;
|
||||
QString current = ui.profilesComboBox->itemText(index);
|
||||
|
||||
mPreviousProfile = current;
|
||||
|
||||
setProfile (previous, current, savePrevious);
|
||||
}
|
||||
}
|
||||
|
@ -167,9 +169,6 @@ void Launcher::DataFilesPage::setProfile (const QString &previous, const QString
|
|||
if (previous == current)
|
||||
return;
|
||||
|
||||
if (previous.isEmpty())
|
||||
return;
|
||||
|
||||
if (!previous.isEmpty() && savePrevious)
|
||||
saveSettings (previous);
|
||||
|
||||
|
@ -212,7 +211,7 @@ void Launcher::DataFilesPage::slotProfileChanged(int index)
|
|||
|
||||
void Launcher::DataFilesPage::on_newProfileAction_triggered()
|
||||
{
|
||||
if (!mProfileDialog->exec() == QDialog::Accepted)
|
||||
if (mProfileDialog->exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
QString profile = mProfileDialog->lineEdit()->text();
|
||||
|
@ -222,9 +221,10 @@ void Launcher::DataFilesPage::on_newProfileAction_triggered()
|
|||
|
||||
saveSettings();
|
||||
|
||||
mSelector->clearCheckStates();
|
||||
mLauncherSettings.setValue(QString("Profiles/currentprofile"), profile);
|
||||
|
||||
addProfile(profile, true);
|
||||
mSelector->clearCheckStates();
|
||||
|
||||
mSelector->setGameFile();
|
||||
|
||||
|
@ -257,10 +257,12 @@ void Launcher::DataFilesPage::on_deleteProfileAction_triggered()
|
|||
if (!showDeleteMessageBox (profile))
|
||||
return;
|
||||
|
||||
// Remove the profile from the combobox
|
||||
ui.profilesComboBox->removeItem (ui.profilesComboBox->findText (profile));
|
||||
// this should work since the Default profile can't be deleted and is always index 0
|
||||
int next = ui.profilesComboBox->currentIndex()-1;
|
||||
ui.profilesComboBox->setCurrentIndex(next);
|
||||
|
||||
removeProfile(profile);
|
||||
ui.profilesComboBox->removeItem(ui.profilesComboBox->findText(profile));
|
||||
|
||||
saveSettings();
|
||||
|
||||
|
|
|
@ -67,6 +67,8 @@ namespace Launcher
|
|||
Config::GameSettings &mGameSettings;
|
||||
Config::LauncherSettings &mLauncherSettings;
|
||||
|
||||
QString mPreviousProfile;
|
||||
|
||||
QString mDataLocal;
|
||||
|
||||
void setPluginsCheckstates(Qt::CheckState state);
|
||||
|
|
Loading…
Reference in a new issue