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