mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:51:20 +02:00
Add proper version checking to qt launcher
This commit is contained in:
parent
e21885905f
commit
05e9329635
5 changed files with 50 additions and 9 deletions
|
@ -37,8 +37,8 @@ if (WIN32)
|
||||||
|
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
qtlite
|
qtlite
|
||||||
URL "https://hifi-public.s3.amazonaws.com/huffman/launcher/qt-lite-ssl.zip"
|
URL "https://hifi-public.s3.amazonaws.com/huffman/launcher/qt-lite-ssl_2019-9-19.zip"
|
||||||
URL_HASH MD5=83eeba1565e5727aef11655acf893c15
|
URL_HASH MD5=8b7a0b8fb772a014a3276274f40a9d14 #83eeba1565e5727aef11655acf893c15
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
void launchClient(const QString& clientPath, const QString& homePath, const QString& defaultScriptOverride,
|
void launchClient(const QString& clientPath, const QString& homePath, const QString& defaultScriptOverride,
|
||||||
<<<<<<< HEAD
|
|
||||||
const QString& displayName, const QString& contentCachePath, QString loginResponseToken = QString());
|
const QString& displayName, const QString& contentCachePath, QString loginResponseToken = QString());
|
||||||
=======
|
|
||||||
const QString& displayName, const QString& contentCachePath, const QString& loginResponseToken = QString());
|
|
||||||
|
|
||||||
|
|
||||||
void launchAutoUpdater(const QString& autoUpdaterPath);
|
void launchAutoUpdater(const QString& autoUpdaterPath);
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#endif
|
#endif
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
|
||||||
|
@ -23,10 +25,30 @@
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
#include <QEventLoop>
|
||||||
|
|
||||||
QString getCurrentClientVersion() {
|
#include <qregularexpression.h>
|
||||||
// TODO Implement client version checking
|
|
||||||
return "";
|
QString LauncherState::getCurrentClientVersion() {
|
||||||
|
QProcess client;
|
||||||
|
|
||||||
|
client.start(getClientExecutablePath(), { "--version" });
|
||||||
|
|
||||||
|
QEventLoop loop;
|
||||||
|
connect(&client, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), &loop, &QEventLoop::exit);
|
||||||
|
loop.exec();
|
||||||
|
|
||||||
|
auto output = client.readAllStandardOutput();
|
||||||
|
|
||||||
|
QRegularExpression regex { "Interface (?<version>\\d+)(-.*)?" };
|
||||||
|
|
||||||
|
auto match = regex.match(output);
|
||||||
|
|
||||||
|
if (match.hasMatch()) {
|
||||||
|
return match.captured("version");
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,6 +283,19 @@ QString LauncherState::getContentCachePath() const {
|
||||||
return _launcherDirectory.filePath("cache");
|
return _launcherDirectory.filePath("cache");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString LauncherState::getClientDirectory() const {
|
||||||
|
return _launcherDirectory.filePath("interface_install");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LauncherState::getClientExecutablePath() const {
|
||||||
|
QDir clientDirectory = getClientDirectory();
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
return clientDirectory.absoluteFilePath("interface.exe");
|
||||||
|
#elif defined(Q_OS_MACOS)
|
||||||
|
return clientDirectory.absoluteFilePath("interface.app/Contents/MacOS/interface");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool LauncherState::shouldDownloadContentCache() const {
|
bool LauncherState::shouldDownloadContentCache() const {
|
||||||
return !_contentCacheURL.isNull() && !QFile::exists(getContentCachePath());
|
return !_contentCacheURL.isNull() && !QFile::exists(getContentCachePath());
|
||||||
}
|
}
|
||||||
|
@ -500,7 +535,11 @@ void LauncherState::installContentCache() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherState::launchClient() {
|
void LauncherState::launchClient() {
|
||||||
ASSERT_STATE({ ApplicationState::InstallingClient, ApplicationState::InstallingContentCache });
|
ASSERT_STATE({
|
||||||
|
ApplicationState::RequestingLogin,
|
||||||
|
ApplicationState::InstallingClient,
|
||||||
|
ApplicationState::InstallingContentCache
|
||||||
|
});
|
||||||
|
|
||||||
setApplicationState(ApplicationState::LaunchingHighFidelity);
|
setApplicationState(ApplicationState::LaunchingHighFidelity);
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,11 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool shouldDownloadContentCache() const;
|
bool shouldDownloadContentCache() const;
|
||||||
|
QString getCurrentClientVersion();
|
||||||
|
|
||||||
QString getContentCachePath() const;
|
QString getContentCachePath() const;
|
||||||
|
QString getClientDirectory() const;
|
||||||
|
QString getClientExecutablePath() const;
|
||||||
|
|
||||||
QNetworkAccessManager _networkAccessManager;
|
QNetworkAccessManager _networkAccessManager;
|
||||||
LatestBuilds _latestBuilds;
|
LatestBuilds _latestBuilds;
|
||||||
|
|
Loading…
Reference in a new issue