Commit df4353de authored by hjk's avatar hjk

KitChooser: Initialize with last used index

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