From ba8673432b446852cf8443db794cc1b74449534e Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 22 Sep 2016 18:10:13 +0200 Subject: [PATCH] Changed: Use getVersionFromExecutable in CProfilesDialog, see #279 --HG-- branch : develop --- .../ryzom_installer/src/profilesdialog.cpp | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp index 8a5b84b0a..5bbeb86b2 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp @@ -19,6 +19,7 @@ #include "profilesmodel.h" #include "serversmodel.h" #include "operationdialog.h" +#include "utils.h" #ifdef DEBUG_NEW #define new DEBUG_NEW @@ -222,27 +223,12 @@ void CProfilesDialog::updateExecutableVersion(int index) // file doesn't exist if (executable.isEmpty() || !QFile::exists(executable)) return; - // launch executable with --version argument - QProcess process; - process.setProcessChannelMode(QProcess::MergedChannels); - process.start(executable, QStringList() << "--version", QIODevice::ReadWrite); - - if (!process.waitForStarted()) return; - - QByteArray data; - - // read all output - while (process.waitForReadyRead()) data.append(process.readAll()); - // convert output to string - QString versionString = QString::fromUtf8(data); + QString versionString = getVersionFromExecutable(executable); - // parse version from output - QRegExp reg("([A-Za-z0-1_.]+) ((DEV|FV) ([0-9.]+))"); - - if (reg.indexIn(versionString) > -1) + if (!versionString.isEmpty()) { - executablePathLabel->setText(QString("%1 (%2)").arg(QFileInfo(executable).fileName()).arg(reg.cap(2))); + executablePathLabel->setText(QString("%1 (%2)").arg(QFileInfo(executable).fileName()).arg(versionString)); } }