mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-23 21:07:45 +00:00
Query installed dalamud version at startup
This also shows the dalamud version in your settings
This commit is contained in:
parent
efc3767134
commit
02301e5b0d
5 changed files with 43 additions and 25 deletions
|
@ -45,28 +45,11 @@ void AssetUpdater::update(const ProfileSettings& profile) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (QFile::exists(dataDir + "/Dalamud/Dalamud.deps.json")) {
|
if (profile.dalamudVersion != remoteDalamudVersion) {
|
||||||
QFile depsJson(dataDir + "/Dalamud/Dalamud.deps.json");
|
isDalamudUpdated = false;
|
||||||
depsJson.open(QFile::ReadOnly);
|
} else {
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(depsJson.readAll());
|
qInfo() << "No need to update Dalamud.";
|
||||||
|
isDalamudUpdated = true;
|
||||||
// TODO: UGLY
|
|
||||||
QString versionString =
|
|
||||||
doc["targets"]
|
|
||||||
.toObject()[".NETCoreApp,Version=v5.0"]
|
|
||||||
.toObject()
|
|
||||||
.keys()
|
|
||||||
.filter("Dalamud")[0];
|
|
||||||
versionString = versionString.remove("Dalamud/");
|
|
||||||
|
|
||||||
qInfo() << "Dalamud version installed: " << versionString;
|
|
||||||
|
|
||||||
if (versionString != remoteDalamudVersion) {
|
|
||||||
isDalamudUpdated = false;
|
|
||||||
} else {
|
|
||||||
qInfo() << "No need to update Dalamud.";
|
|
||||||
isDalamudUpdated = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,6 +289,27 @@ void LauncherCore::readInitialInformation() {
|
||||||
#endif
|
#endif
|
||||||
readWineInfo(profile);
|
readWineInfo(profile);
|
||||||
|
|
||||||
|
const QString dataDir =
|
||||||
|
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||||
|
|
||||||
|
const bool hasDalamud = QFile::exists(dataDir + "/Dalamud");
|
||||||
|
if (hasDalamud) {
|
||||||
|
if (QFile::exists(dataDir + "/Dalamud/Dalamud.deps.json")) {
|
||||||
|
QFile depsJson(dataDir + "/Dalamud/Dalamud.deps.json");
|
||||||
|
depsJson.open(QFile::ReadOnly);
|
||||||
|
QJsonDocument doc = QJsonDocument::fromJson(depsJson.readAll());
|
||||||
|
|
||||||
|
// TODO: UGLY
|
||||||
|
QString versionString =
|
||||||
|
doc["targets"]
|
||||||
|
.toObject()[".NETCoreApp,Version=v5.0"]
|
||||||
|
.toObject()
|
||||||
|
.keys()
|
||||||
|
.filter("Dalamud")[0];
|
||||||
|
profile.dalamudVersion = versionString.remove("Dalamud/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(settings.contains("gamePath") && settings.value("gamePath").canConvert<QString>() && !settings.value("gamePath").toString().isEmpty()) {
|
if(settings.contains("gamePath") && settings.value("gamePath").canConvert<QString>() && !settings.value("gamePath").toString().isEmpty()) {
|
||||||
profile.gamePath = settings.value("gamePath").toString();
|
profile.gamePath = settings.value("gamePath").toString();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -47,6 +47,8 @@ struct ProfileSettings {
|
||||||
int refreshRate = 0;
|
int refreshRate = 0;
|
||||||
} gamescope;
|
} gamescope;
|
||||||
|
|
||||||
|
QString dalamudVersion; // TODO: move out of profile settings
|
||||||
|
|
||||||
// login
|
// login
|
||||||
bool encryptArguments = true;
|
bool encryptArguments = true;
|
||||||
bool isSapphire = false;
|
bool isSapphire = false;
|
||||||
|
|
|
@ -105,7 +105,7 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
expansionVersionLabel = new QLabel();
|
expansionVersionLabel = new QLabel();
|
||||||
gameBoxLayout->addRow("Version Info", expansionVersionLabel);
|
gameBoxLayout->addRow("Game Version", expansionVersionLabel);
|
||||||
|
|
||||||
auto loginBox = new QGroupBox("Login Options");
|
auto loginBox = new QGroupBox("Login Options");
|
||||||
auto loginBoxLayout = new QFormLayout();
|
auto loginBoxLayout = new QFormLayout();
|
||||||
|
@ -291,6 +291,8 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg
|
||||||
auto dalamudBoxLayout = new QFormLayout();
|
auto dalamudBoxLayout = new QFormLayout();
|
||||||
dalamudBox->setLayout(dalamudBoxLayout);
|
dalamudBox->setLayout(dalamudBoxLayout);
|
||||||
|
|
||||||
|
mainLayout->addWidget(dalamudBox, 2, 2, 1, 1);
|
||||||
|
|
||||||
enableDalamudBox = new QCheckBox();
|
enableDalamudBox = new QCheckBox();
|
||||||
connect(enableDalamudBox, &QCheckBox::stateChanged, [=](int) {
|
connect(enableDalamudBox, &QCheckBox::stateChanged, [=](int) {
|
||||||
getCurrentProfile().enableDalamud = enableDalamudBox->isChecked();
|
getCurrentProfile().enableDalamud = enableDalamudBox->isChecked();
|
||||||
|
@ -299,7 +301,8 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg
|
||||||
});
|
});
|
||||||
dalamudBoxLayout->addRow("Enable Dalamud Injection", enableDalamudBox);
|
dalamudBoxLayout->addRow("Enable Dalamud Injection", enableDalamudBox);
|
||||||
|
|
||||||
mainLayout->addWidget(dalamudBox, 2, 2, 1, 1);
|
dalamudVersionLabel = new QLabel();
|
||||||
|
dalamudBoxLayout->addRow("Dalamud Version", dalamudVersionLabel);
|
||||||
|
|
||||||
reloadControls();
|
reloadControls();
|
||||||
}
|
}
|
||||||
|
@ -390,7 +393,13 @@ void SettingsWindow::reloadControls() {
|
||||||
rememberPasswordBox->setChecked(profile.rememberPassword);
|
rememberPasswordBox->setChecked(profile.rememberPassword);
|
||||||
useSteamBox->setChecked(profile.useSteam);
|
useSteamBox->setChecked(profile.useSteam);
|
||||||
|
|
||||||
|
// dalamud
|
||||||
enableDalamudBox->setChecked(profile.enableDalamud);
|
enableDalamudBox->setChecked(profile.enableDalamud);
|
||||||
|
if(profile.dalamudVersion.isEmpty()) {
|
||||||
|
dalamudVersionLabel->setText("Dalamud is not installed.");
|
||||||
|
} else {
|
||||||
|
dalamudVersionLabel->setText(profile.dalamudVersion);
|
||||||
|
}
|
||||||
|
|
||||||
window.reloadControls();
|
window.reloadControls();
|
||||||
|
|
||||||
|
|
|
@ -43,12 +43,15 @@ private:
|
||||||
|
|
||||||
// login
|
// login
|
||||||
QCheckBox* encryptArgumentsBox = nullptr;
|
QCheckBox* encryptArgumentsBox = nullptr;
|
||||||
QCheckBox* enableDalamudBox = nullptr;
|
|
||||||
QComboBox* serverType = nullptr;
|
QComboBox* serverType = nullptr;
|
||||||
QLineEdit* lobbyServerURL = nullptr;
|
QLineEdit* lobbyServerURL = nullptr;
|
||||||
QCheckBox* rememberUsernameBox = nullptr, *rememberPasswordBox = nullptr;
|
QCheckBox* rememberUsernameBox = nullptr, *rememberPasswordBox = nullptr;
|
||||||
QCheckBox* useSteamBox = nullptr;
|
QCheckBox* useSteamBox = nullptr;
|
||||||
|
|
||||||
|
// dalamud
|
||||||
|
QCheckBox* enableDalamudBox = nullptr;
|
||||||
|
QLabel* dalamudVersionLabel = nullptr;
|
||||||
|
|
||||||
bool currentlyReloadingControls = false;
|
bool currentlyReloadingControls = false;
|
||||||
|
|
||||||
LauncherWindow& window;
|
LauncherWindow& window;
|
||||||
|
|
Loading…
Add table
Reference in a new issue