diff options
| author | Tannin <devnull@localhost> | 2015-05-11 21:39:56 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-05-11 21:39:56 +0200 |
| commit | dbdc2538f98147c7661cac00fe135df59aeb04e3 (patch) | |
| tree | b8c14280cc4b7ba6398612e9b5350ca63934e91e /src/profilesdialog.cpp | |
| parent | 5a908442d646b5f3dbf7d22fc2331c8cc2b0d15a (diff) | |
bugfix: upon closing the profiles dialog, the profile was changed to the
top-most profile and back
Diffstat (limited to 'src/profilesdialog.cpp')
| -rw-r--r-- | src/profilesdialog.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/profilesdialog.cpp b/src/profilesdialog.cpp index 44ee96e9..5443cec0 100644 --- a/src/profilesdialog.cpp +++ b/src/profilesdialog.cpp @@ -42,10 +42,9 @@ using namespace MOShared; Q_DECLARE_METATYPE(Profile::Ptr)
-ProfilesDialog::ProfilesDialog(const QString &gamePath, QWidget *parent)
+ProfilesDialog::ProfilesDialog(const QString &profileName, QWidget *parent)
: TutorableDialog("Profiles", parent)
, ui(new Ui::ProfilesDialog)
- , m_GamePath(gamePath)
, m_FailState(false)
{
ui->setupUi(this);
@@ -58,7 +57,10 @@ ProfilesDialog::ProfilesDialog(const QString &gamePath, QWidget *parent) while (profileIter.hasNext()) {
profileIter.next();
- addItem(profileIter.filePath());
+ QListWidgetItem *item = addItem(profileIter.filePath());
+ if (profileName == profileIter.fileName()) {
+ m_ProfilesList->setCurrentItem(item);
+ }
}
QCheckBox *invalidationBox = findChild<QCheckBox*>("invalidationBox");
@@ -97,7 +99,7 @@ void ProfilesDialog::on_closeButton_clicked() }
-void ProfilesDialog::addItem(const QString &name)
+QListWidgetItem *ProfilesDialog::addItem(const QString &name)
{
QDir profileDir(name);
QListWidgetItem *newItem = new QListWidgetItem(profileDir.dirName(), m_ProfilesList);
@@ -107,6 +109,7 @@ void ProfilesDialog::addItem(const QString &name) } catch (const std::exception& e) {
reportError(tr("failed to create profile: %1").arg(e.what()));
}
+ return newItem;
}
void ProfilesDialog::createProfile(const QString &name, bool useDefaultSettings)
|
