mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-23 12:57: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;
|
||||
} else {
|
||||
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];
|
||||
versionString = versionString.remove("Dalamud/");
|
||||
|
||||
qInfo() << "Dalamud version installed: " << versionString;
|
||||
|
||||
if (versionString != remoteDalamudVersion) {
|
||||
isDalamudUpdated = false;
|
||||
} else {
|
||||
qInfo() << "No need to update Dalamud.";
|
||||
isDalamudUpdated = true;
|
||||
}
|
||||
if (profile.dalamudVersion != remoteDalamudVersion) {
|
||||
isDalamudUpdated = false;
|
||||
} else {
|
||||
qInfo() << "No need to update Dalamud.";
|
||||
isDalamudUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,6 +289,27 @@ void LauncherCore::readInitialInformation() {
|
|||
#endif
|
||||
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()) {
|
||||
profile.gamePath = settings.value("gamePath").toString();
|
||||
} else {
|
||||
|
|
|
@ -47,6 +47,8 @@ struct ProfileSettings {
|
|||
int refreshRate = 0;
|
||||
} gamescope;
|
||||
|
||||
QString dalamudVersion; // TODO: move out of profile settings
|
||||
|
||||
// login
|
||||
bool encryptArguments = true;
|
||||
bool isSapphire = false;
|
||||
|
|
|
@ -105,7 +105,7 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg
|
|||
#endif
|
||||
|
||||
expansionVersionLabel = new QLabel();
|
||||
gameBoxLayout->addRow("Version Info", expansionVersionLabel);
|
||||
gameBoxLayout->addRow("Game Version", expansionVersionLabel);
|
||||
|
||||
auto loginBox = new QGroupBox("Login Options");
|
||||
auto loginBoxLayout = new QFormLayout();
|
||||
|
@ -291,6 +291,8 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg
|
|||
auto dalamudBoxLayout = new QFormLayout();
|
||||
dalamudBox->setLayout(dalamudBoxLayout);
|
||||
|
||||
mainLayout->addWidget(dalamudBox, 2, 2, 1, 1);
|
||||
|
||||
enableDalamudBox = new QCheckBox();
|
||||
connect(enableDalamudBox, &QCheckBox::stateChanged, [=](int) {
|
||||
getCurrentProfile().enableDalamud = enableDalamudBox->isChecked();
|
||||
|
@ -299,7 +301,8 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg
|
|||
});
|
||||
dalamudBoxLayout->addRow("Enable Dalamud Injection", enableDalamudBox);
|
||||
|
||||
mainLayout->addWidget(dalamudBox, 2, 2, 1, 1);
|
||||
dalamudVersionLabel = new QLabel();
|
||||
dalamudBoxLayout->addRow("Dalamud Version", dalamudVersionLabel);
|
||||
|
||||
reloadControls();
|
||||
}
|
||||
|
@ -390,7 +393,13 @@ void SettingsWindow::reloadControls() {
|
|||
rememberPasswordBox->setChecked(profile.rememberPassword);
|
||||
useSteamBox->setChecked(profile.useSteam);
|
||||
|
||||
// dalamud
|
||||
enableDalamudBox->setChecked(profile.enableDalamud);
|
||||
if(profile.dalamudVersion.isEmpty()) {
|
||||
dalamudVersionLabel->setText("Dalamud is not installed.");
|
||||
} else {
|
||||
dalamudVersionLabel->setText(profile.dalamudVersion);
|
||||
}
|
||||
|
||||
window.reloadControls();
|
||||
|
||||
|
|
|
@ -43,12 +43,15 @@ private:
|
|||
|
||||
// login
|
||||
QCheckBox* encryptArgumentsBox = nullptr;
|
||||
QCheckBox* enableDalamudBox = nullptr;
|
||||
QComboBox* serverType = nullptr;
|
||||
QLineEdit* lobbyServerURL = nullptr;
|
||||
QCheckBox* rememberUsernameBox = nullptr, *rememberPasswordBox = nullptr;
|
||||
QCheckBox* useSteamBox = nullptr;
|
||||
|
||||
// dalamud
|
||||
QCheckBox* enableDalamudBox = nullptr;
|
||||
QLabel* dalamudVersionLabel = nullptr;
|
||||
|
||||
bool currentlyReloadingControls = false;
|
||||
|
||||
LauncherWindow& window;
|
||||
|
|
Loading…
Add table
Reference in a new issue