Python: Check for changes before applying

Storing the python settings seems to be rather costly
and may take some time.
Perform an early return if nothing has changed.

Change-Id: I509e83f503d2af31a7464df893e0e4e69e99a277
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2019-10-30 07:47:19 +01:00
parent aad5fb339d
commit b2ede6ff51
2 changed files with 9 additions and 0 deletions

View File

@@ -467,6 +467,10 @@ void PythonSettings::init()
void PythonSettings::setInterpreter(const QList<Interpreter> &interpreters, const QString &defaultId)
{
if (defaultId == interpreterOptionsPage().defaultInterpreter().id
&& interpreters == interpreterOptionsPage().interpreters()) {
return;
}
interpreterOptionsPage().setInterpreter(interpreters);
interpreterOptionsPage().setDefaultInterpreter(defaultId);
saveSettings();

View File

@@ -44,6 +44,11 @@ public:
const QString &name,
const Utils::FilePath &command);
inline bool operator==(const Interpreter &other) const
{
return id == other.id && name == other.name && command == other.command;
}
QString id = QUuid::createUuid().toString();
QString name;
Utils::FilePath command;