Skip to content
Snippets Groups Projects
Commit df4353de authored by hjk's avatar hjk
Browse files

KitChooser: Initialize with last used index


Change-Id: Id9522c973b5d517e7832b92f558a38408cf3fe2b
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
parent 67399fc0
No related branches found
No related tags found
No related merge requests found
...@@ -32,8 +32,13 @@ ...@@ -32,8 +32,13 @@
#include "kitinformation.h" #include "kitinformation.h"
#include "kitmanager.h" #include "kitmanager.h"
#include <coreplugin/icore.h>
#include <QSettings>
namespace ProjectExplorer { namespace ProjectExplorer {
const char lastKitKey[] = "LastSelectedKit";
KitChooser::KitChooser(QWidget *parent) : KitChooser::KitChooser(QWidget *parent) :
QComboBox(parent) QComboBox(parent)
{ {
...@@ -73,11 +78,15 @@ void KitChooser::populate() ...@@ -73,11 +78,15 @@ void KitChooser::populate()
} }
} }
setEnabled(count() > 1); setEnabled(count() > 1);
const int index = Core::ICore::settings()->value(QLatin1String(lastKitKey)).toInt();
setCurrentIndex(qMin(index, count()));
} }
Kit *KitChooser::currentKit() const Kit *KitChooser::currentKit() const
{ {
const int index = currentIndex(); const int index = currentIndex();
Core::ICore::settings()->setValue(QLatin1String(lastKitKey), index);
return index == -1 ? 0 : kitAt(index); return index == -1 ? 0 : kitAt(index);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment