Commit 7c632f65 authored by Robert Loehning's avatar Robert Loehning Committed by Eike Ziller

Beautifier: Fix ArtisticStyleSettings

Done-by: default avatarEike Ziller <eike.ziller@digia.com>
Change-Id: I6dd22f9519d4b14345d27ed2128559efac2cb697
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
Reviewed-by: default avatarRobert Loehning <robert.loehning@digia.com>
parent 388462d1
......@@ -74,17 +74,18 @@ void ArtisticStyleSettings::updateVersion()
if (m_versionFuture.isRunning())
m_versionFuture.cancel();
m_versionFuture = QtConcurrent::run(this, &ArtisticStyleSettings::helperUpdateVersion);
m_versionFuture = QtConcurrent::run(&ArtisticStyleSettings::helperUpdateVersion, this);
m_versionWatcher.setFuture(m_versionFuture);
}
int ArtisticStyleSettings::helperUpdateVersion() const
void ArtisticStyleSettings::helperUpdateVersion(QFutureInterface<int> &future)
{
QProcess process;
process.start(command(), QStringList() << QLatin1String("--version"));
if (!process.waitForFinished()) {
process.kill();
return 0;
future.reportResult(0);
return;
}
// The version in Artistic Style is printed like "Artistic Style Version 2.04"
......@@ -93,9 +94,11 @@ int ArtisticStyleSettings::helperUpdateVersion() const
if (rx.indexIn(version) != -1) {
const int major = rx.cap(1).toInt() * 100;
const int minor = rx.cap(2).toInt();
return major + minor;
future.reportResult(major + minor);
return;
}
return 0;
future.reportResult(0);
return;
}
void ArtisticStyleSettings::helperSetVersion()
......
......@@ -75,7 +75,7 @@ private slots:
private:
QFuture<int> m_versionFuture;
QFutureWatcher<int> m_versionWatcher;
int helperUpdateVersion() const;
void helperUpdateVersion(QFutureInterface<int> &future);
};
} // namespace ArtisticStyle
......
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