mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 11:47:46 +00:00
Make tablet interface functional
Right now OTP and other stuff is missing for an actual login, but it calls!
This commit is contained in:
parent
a007f8567e
commit
55aaf7c1f6
14 changed files with 170 additions and 123 deletions
|
@ -19,7 +19,7 @@ bool CMDInterface::parse(QCommandLineParser &parser, LauncherCore &core) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(parser.isSet(autologinOption)) {
|
if(parser.isSet(autologinOption)) {
|
||||||
auto profile = core.getProfile(core.defaultProfileIndex);
|
auto& profile = core.getProfile(core.defaultProfileIndex);
|
||||||
|
|
||||||
if(!profile.rememberUsername || !profile.rememberPassword) {
|
if(!profile.rememberUsername || !profile.rememberPassword) {
|
||||||
qInfo() << "Profile does not have a username and/or password saved, autologin disabled.";
|
qInfo() << "Profile does not have a username and/or password saved, autologin disabled.";
|
||||||
|
@ -52,12 +52,15 @@ bool CMDInterface::parse(QCommandLineParser &parser, LauncherCore &core) {
|
||||||
|
|
||||||
loop->exec();
|
loop->exec();
|
||||||
|
|
||||||
auto info = LoginInformation{&profile, username, password, ""};
|
auto info = new LoginInformation();
|
||||||
|
info->settings = &profile;
|
||||||
|
info->username = username;
|
||||||
|
info->password = password;
|
||||||
|
|
||||||
if(profile.isSapphire) {
|
if(profile.isSapphire) {
|
||||||
core.sapphireLauncher->login(profile.lobbyURL, info);
|
core.sapphireLauncher->login(profile.lobbyURL, *info);
|
||||||
} else {
|
} else {
|
||||||
core.squareBoot->bootCheck(info);
|
core.squareBoot->bootCheck(*info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ target_link_libraries(astra_core PUBLIC
|
||||||
Qt5::Core
|
Qt5::Core
|
||||||
Qt5::Network
|
Qt5::Network
|
||||||
Qt5::Widgets # widgets is required by watchdog, to be fixed/removed later
|
Qt5::Widgets # widgets is required by watchdog, to be fixed/removed later
|
||||||
|
Qt5::Quick # required for some type registrations
|
||||||
PRIVATE
|
PRIVATE
|
||||||
astra_desktop) # desktop is currently required by the core, to be fixed/removed later
|
astra_desktop) # desktop is currently required by the core, to be fixed/removed later
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,12 @@
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QtQml>
|
||||||
|
|
||||||
|
#include "squareboot.h"
|
||||||
|
|
||||||
class SapphireLauncher;
|
class SapphireLauncher;
|
||||||
class SquareLauncher;
|
class SquareLauncher;
|
||||||
class SquareBoot;
|
|
||||||
class AssetUpdater;
|
class AssetUpdater;
|
||||||
class Watchdog;
|
class Watchdog;
|
||||||
|
|
||||||
|
@ -33,7 +35,10 @@ enum class DalamudChannel {
|
||||||
Net5
|
Net5
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ProfileSettings {
|
class ProfileSettings : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
public:
|
||||||
QUuid uuid;
|
QUuid uuid;
|
||||||
QString name;
|
QString name;
|
||||||
|
|
||||||
|
@ -94,7 +99,14 @@ struct AppSettings {
|
||||||
bool showNewsList = true;
|
bool showNewsList = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LoginInformation {
|
class LoginInformation : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QString username MEMBER username)
|
||||||
|
Q_PROPERTY(QString password MEMBER password)
|
||||||
|
Q_PROPERTY(QString oneTimePassword MEMBER oneTimePassword)
|
||||||
|
Q_PROPERTY(ProfileSettings* settings MEMBER settings)
|
||||||
|
QML_ELEMENT
|
||||||
|
public:
|
||||||
ProfileSettings* settings = nullptr;
|
ProfileSettings* settings = nullptr;
|
||||||
|
|
||||||
QString username, password, oneTimePassword;
|
QString username, password, oneTimePassword;
|
||||||
|
@ -111,17 +123,27 @@ struct LoginAuth {
|
||||||
|
|
||||||
class LauncherCore : public QObject {
|
class LauncherCore : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(SquareBoot* squareBoot MEMBER squareBoot)
|
||||||
public:
|
public:
|
||||||
LauncherCore();
|
LauncherCore();
|
||||||
~LauncherCore();
|
~LauncherCore();
|
||||||
|
|
||||||
|
// used for qml only, TODO: move this to a dedicated factory
|
||||||
|
Q_INVOKABLE LoginInformation* createNewLoginInfo() {
|
||||||
|
return new LoginInformation();
|
||||||
|
}
|
||||||
|
|
||||||
QNetworkAccessManager* mgr;
|
QNetworkAccessManager* mgr;
|
||||||
|
|
||||||
ProfileSettings getProfile(int index) const;
|
|
||||||
ProfileSettings& getProfile(int index);
|
ProfileSettings& getProfile(int index);
|
||||||
|
|
||||||
|
// used for qml only
|
||||||
|
Q_INVOKABLE ProfileSettings* getProfileQML(int index) {
|
||||||
|
return profileSettings[index];
|
||||||
|
}
|
||||||
|
|
||||||
int getProfileIndex(QString name);
|
int getProfileIndex(QString name);
|
||||||
QList<QString> profileList() const;
|
Q_INVOKABLE QList<QString> profileList() const;
|
||||||
int addProfile();
|
int addProfile();
|
||||||
int deleteProfile(QString name);
|
int deleteProfile(QString name);
|
||||||
|
|
||||||
|
@ -190,5 +212,5 @@ private:
|
||||||
QString getDefaultGamePath();
|
QString getDefaultGamePath();
|
||||||
QString getDefaultWinePrefixPath();
|
QString getDefaultWinePrefixPath();
|
||||||
|
|
||||||
QVector<ProfileSettings> profileSettings;
|
QVector<ProfileSettings*> profileSettings;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QProgressDialog>
|
#include <QProgressDialog>
|
||||||
#include "launchercore.h"
|
|
||||||
|
|
||||||
class SquareLauncher;
|
class SquareLauncher;
|
||||||
|
class LauncherCore;
|
||||||
|
struct LoginInformation;
|
||||||
|
|
||||||
class SquareBoot : public QObject {
|
class SquareBoot : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SquareBoot(LauncherCore& window, SquareLauncher& launcher);
|
SquareBoot(LauncherCore& window, SquareLauncher& launcher);
|
||||||
|
|
||||||
void checkGateStatus(const LoginInformation& info);
|
Q_INVOKABLE void checkGateStatus(LoginInformation* info);
|
||||||
|
|
||||||
void bootCheck(const LoginInformation& info);
|
void bootCheck(const LoginInformation& info);
|
||||||
|
|
||||||
|
|
|
@ -134,10 +134,10 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
|
||||||
if(profile.dalamud.enabled) {
|
if(profile.dalamud.enabled) {
|
||||||
auto socket = new QTcpServer();
|
auto socket = new QTcpServer();
|
||||||
|
|
||||||
connect(socket, &QTcpServer::newConnection, [this, profile, socket] {
|
connect(socket, &QTcpServer::newConnection, [this, &profile, socket] {
|
||||||
auto connection = socket->nextPendingConnection();
|
auto connection = socket->nextPendingConnection();
|
||||||
|
|
||||||
connect(connection, &QTcpSocket::readyRead, [this, connection, profile, socket] {
|
connect(connection, &QTcpSocket::readyRead, [this, connection, &profile, socket] {
|
||||||
QString output = connection->readAll();
|
QString output = connection->readAll();
|
||||||
bool success;
|
bool success;
|
||||||
int exitCode = output.toInt(&success, 10);
|
int exitCode = output.toInt(&success, 10);
|
||||||
|
@ -381,69 +381,68 @@ void LauncherCore::readInitialInformation() {
|
||||||
profileSettings.resize(profiles.size());
|
profileSettings.resize(profiles.size());
|
||||||
|
|
||||||
for(const auto& uuid : profiles) {
|
for(const auto& uuid : profiles) {
|
||||||
ProfileSettings profile;
|
ProfileSettings* profile = new ProfileSettings();
|
||||||
profile.uuid = QUuid(uuid);
|
profile->uuid = QUuid(uuid);
|
||||||
|
|
||||||
settings.beginGroup(uuid);
|
settings.beginGroup(uuid);
|
||||||
|
|
||||||
profile.name = settings.value("name", "Default").toString();
|
profile->name = settings.value("name", "Default").toString();
|
||||||
|
|
||||||
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 {
|
||||||
profile.gamePath = getDefaultGamePath();
|
profile->gamePath = getDefaultGamePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(settings.contains("winePrefixPath") && settings.value("winePrefixPath").canConvert<QString>() && !settings.value("winePrefixPath").toString().isEmpty()) {
|
if(settings.contains("winePrefixPath") && settings.value("winePrefixPath").canConvert<QString>() && !settings.value("winePrefixPath").toString().isEmpty()) {
|
||||||
profile.winePrefixPath = settings.value("winePrefixPath").toString();
|
profile->winePrefixPath = settings.value("winePrefixPath").toString();
|
||||||
} else {
|
} else {
|
||||||
profile.winePrefixPath = getDefaultWinePrefixPath();
|
profile->winePrefixPath = getDefaultWinePrefixPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(settings.contains("winePath") && settings.value("winePath").canConvert<QString>() && !settings.value("winePath").toString().isEmpty()) {
|
if(settings.contains("winePath") && settings.value("winePath").canConvert<QString>() && !settings.value("winePath").toString().isEmpty()) {
|
||||||
profile.winePath = settings.value("winePath").toString();
|
profile->winePath = settings.value("winePath").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileSettings defaultSettings;
|
ProfileSettings defaultSettings;
|
||||||
|
|
||||||
// login
|
// login
|
||||||
profile.encryptArguments = settings.value("encryptArguments", defaultSettings.encryptArguments).toBool();
|
profile->encryptArguments = settings.value("encryptArguments", defaultSettings.encryptArguments).toBool();
|
||||||
profile.isSapphire = settings.value("isSapphire", defaultSettings.isSapphire).toBool();
|
profile->isSapphire = settings.value("isSapphire", defaultSettings.isSapphire).toBool();
|
||||||
profile.lobbyURL = settings.value("lobbyURL", defaultSettings.lobbyURL).toString();
|
profile->lobbyURL = settings.value("lobbyURL", defaultSettings.lobbyURL).toString();
|
||||||
profile.rememberUsername = settings.value("rememberUsername", defaultSettings.rememberUsername).toBool();
|
profile->rememberUsername = settings.value("rememberUsername", defaultSettings.rememberUsername).toBool();
|
||||||
profile.rememberPassword = settings.value("rememberPassword", defaultSettings.rememberPassword).toBool();
|
profile->rememberPassword = settings.value("rememberPassword", defaultSettings.rememberPassword).toBool();
|
||||||
profile.useOneTimePassword = settings.value("useOneTimePassword", defaultSettings.useOneTimePassword).toBool();
|
profile->useOneTimePassword = settings.value("useOneTimePassword", defaultSettings.useOneTimePassword).toBool();
|
||||||
profile.license = (GameLicense)settings.value("license", (int)defaultSettings.license).toInt();
|
profile->license = (GameLicense)settings.value("license", (int)defaultSettings.license).toInt();
|
||||||
profile.isFreeTrial = settings.value("isFreeTrial", defaultSettings.isFreeTrial).toBool();
|
profile->isFreeTrial = settings.value("isFreeTrial", defaultSettings.isFreeTrial).toBool();
|
||||||
|
|
||||||
profile.useDX9 = settings.value("useDX9", defaultSettings.useDX9).toBool();
|
profile->useDX9 = settings.value("useDX9", defaultSettings.useDX9).toBool();
|
||||||
|
|
||||||
// wine
|
// wine
|
||||||
profile.wineType = (WineType)settings.value("wineType", (int)defaultSettings.wineType).toInt();
|
profile->wineType = (WineType)settings.value("wineType", (int)defaultSettings.wineType).toInt();
|
||||||
profile.useEsync = settings.value("useEsync", defaultSettings.useEsync).toBool();
|
profile->useEsync = settings.value("useEsync", defaultSettings.useEsync).toBool();
|
||||||
|
|
||||||
readWineInfo(profile);
|
readWineInfo(*profile);
|
||||||
|
|
||||||
if(gamescopeAvailable)
|
if(gamescopeAvailable)
|
||||||
profile.useGamescope = settings.value("useGamescope", defaultSettings.useGamescope).toBool();
|
profile->useGamescope = settings.value("useGamescope", defaultSettings.useGamescope).toBool();
|
||||||
|
|
||||||
if(gamemodeAvailable)
|
if(gamemodeAvailable)
|
||||||
profile.useGamemode = settings.value("useGamemode", defaultSettings.useGamemode).toBool();
|
profile->useGamemode = settings.value("useGamemode", defaultSettings.useGamemode).toBool();
|
||||||
|
|
||||||
profile.enableDXVKhud = settings.value("enableDXVKhud", defaultSettings.enableDXVKhud).toBool();
|
profile->enableDXVKhud = settings.value("enableDXVKhud", defaultSettings.enableDXVKhud).toBool();
|
||||||
|
|
||||||
profile.enableWatchdog = settings.value("enableWatchdog", defaultSettings.enableWatchdog).toBool();
|
profile->enableWatchdog = settings.value("enableWatchdog", defaultSettings.enableWatchdog).toBool();
|
||||||
|
|
||||||
// gamescope
|
// gamescope
|
||||||
profile.gamescope.fullscreen = settings.value("gamescopeFullscreen", defaultSettings.gamescope.fullscreen).toBool();
|
profile->gamescope.borderless = settings.value("gamescopeBorderless", defaultSettings.gamescope.borderless).toBool();
|
||||||
profile.gamescope.borderless = settings.value("gamescopeBorderless", defaultSettings.gamescope.borderless).toBool();
|
profile->gamescope.width = settings.value("gamescopeWidth", defaultSettings.gamescope.width).toInt();
|
||||||
profile.gamescope.width = settings.value("gamescopeWidth", defaultSettings.gamescope.width).toInt();
|
profile->gamescope.height = settings.value("gamescopeHeight", defaultSettings.gamescope.height).toInt();
|
||||||
profile.gamescope.height = settings.value("gamescopeHeight", defaultSettings.gamescope.height).toInt();
|
profile->gamescope.refreshRate = settings.value("gamescopeRefreshRate", defaultSettings.gamescope.refreshRate).toInt();
|
||||||
profile.gamescope.refreshRate = settings.value("gamescopeRefreshRate", defaultSettings.gamescope.refreshRate).toInt();
|
|
||||||
|
|
||||||
profile.dalamud.enabled = settings.value("enableDalamud", defaultSettings.dalamud.enabled).toBool();
|
profile->dalamud.enabled = settings.value("enableDalamud", defaultSettings.dalamud.enabled).toBool();
|
||||||
profile.dalamud.optOutOfMbCollection = settings.value("dalamudOptOut", defaultSettings.dalamud.optOutOfMbCollection).toBool();
|
profile->dalamud.optOutOfMbCollection = settings.value("dalamudOptOut", defaultSettings.dalamud.optOutOfMbCollection).toBool();
|
||||||
profile.dalamud.channel = (DalamudChannel)settings.value("dalamudChannel", (int)defaultSettings.dalamud.channel).toInt();
|
profile->dalamud.channel = (DalamudChannel)settings.value("dalamudChannel", (int)defaultSettings.dalamud.channel).toInt();
|
||||||
|
|
||||||
profileSettings[settings.value("index").toInt()] = profile;
|
profileSettings[settings.value("index").toInt()] = profile;
|
||||||
|
|
||||||
|
@ -498,11 +497,11 @@ void LauncherCore::readWineInfo(ProfileSettings& profile) {
|
||||||
|
|
||||||
void LauncherCore::readGameVersion() {
|
void LauncherCore::readGameVersion() {
|
||||||
for(auto& profile : profileSettings) {
|
for(auto& profile : profileSettings) {
|
||||||
profile.bootVersion = readVersion(profile.gamePath + "/boot/ffxivboot.ver");
|
profile->bootVersion = readVersion(profile->gamePath + "/boot/ffxivboot.ver");
|
||||||
profile.installedMaxExpansion = 0;
|
profile->installedMaxExpansion = 0;
|
||||||
|
|
||||||
auto sqpackDirectories = QDir(profile.gamePath + "/game/sqpack/").entryList(QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot);
|
auto sqpackDirectories = QDir(profile->gamePath + "/game/sqpack/").entryList(QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot);
|
||||||
profile.gameVersions.resize(sqpackDirectories.size());
|
profile->gameVersions.resize(sqpackDirectories.size());
|
||||||
|
|
||||||
for(auto dir : sqpackDirectories) {
|
for(auto dir : sqpackDirectories) {
|
||||||
if(dir.contains("ex") || dir == "ffxiv") {
|
if(dir.contains("ex") || dir == "ffxiv") {
|
||||||
|
@ -512,7 +511,7 @@ void LauncherCore::readGameVersion() {
|
||||||
if(dir == "ffxiv") {
|
if(dir == "ffxiv") {
|
||||||
expansion = 0;
|
expansion = 0;
|
||||||
|
|
||||||
profile.gameVersions[0] = readVersion(profile.gamePath + QString("/game/ffxivgame.ver"));
|
profile->gameVersions[0] = readVersion(profile->gamePath + QString("/game/ffxivgame.ver"));
|
||||||
} else {
|
} else {
|
||||||
QString originalName = dir.remove("ex");
|
QString originalName = dir.remove("ex");
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
@ -520,17 +519,17 @@ void LauncherCore::readGameVersion() {
|
||||||
if(ok)
|
if(ok)
|
||||||
expansion = convertedInt;
|
expansion = convertedInt;
|
||||||
|
|
||||||
profile.gameVersions[convertedInt] = readVersion(QString("%1/game/sqpack/ex%2/ex%2.ver").arg(profile.gamePath, QString::number(expansion)));
|
profile->gameVersions[convertedInt] = readVersion(QString("%1/game/sqpack/ex%2/ex%2.ver").arg(profile->gamePath, QString::number(expansion)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(expansion != -1) {
|
if(expansion != -1) {
|
||||||
profile.installedMaxExpansion = std::max(profile.installedMaxExpansion, expansion);
|
profile->installedMaxExpansion = std::max(profile->installedMaxExpansion, expansion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(profile.installedMaxExpansion >= 0)
|
if(profile->installedMaxExpansion >= 0)
|
||||||
readGameData(profile);
|
readGameData(*profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,17 +553,13 @@ LauncherCore::~LauncherCore() noexcept {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileSettings LauncherCore::getProfile(int index) const {
|
|
||||||
return profileSettings[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
ProfileSettings& LauncherCore::getProfile(int index) {
|
ProfileSettings& LauncherCore::getProfile(int index) {
|
||||||
return profileSettings[index];
|
return *profileSettings[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
int LauncherCore::getProfileIndex(QString name) {
|
int LauncherCore::getProfileIndex(QString name) {
|
||||||
for(int i = 0; i < profileSettings.size(); i++) {
|
for(int i = 0; i < profileSettings.size(); i++) {
|
||||||
if(profileSettings[i].name == name)
|
if(profileSettings[i]->name == name)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,21 +569,21 @@ int LauncherCore::getProfileIndex(QString name) {
|
||||||
QList<QString> LauncherCore::profileList() const {
|
QList<QString> LauncherCore::profileList() const {
|
||||||
QList<QString> list;
|
QList<QString> list;
|
||||||
for(auto profile : profileSettings) {
|
for(auto profile : profileSettings) {
|
||||||
list.append(profile.name);
|
list.append(profile->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LauncherCore::addProfile() {
|
int LauncherCore::addProfile() {
|
||||||
ProfileSettings newProfile;
|
ProfileSettings* newProfile = new ProfileSettings();
|
||||||
newProfile.uuid = QUuid::createUuid();
|
newProfile->uuid = QUuid::createUuid();
|
||||||
newProfile.name = "New Profile";
|
newProfile->name = "New Profile";
|
||||||
|
|
||||||
readWineInfo(newProfile);
|
readWineInfo(*newProfile);
|
||||||
|
|
||||||
newProfile.gamePath = getDefaultGamePath();
|
newProfile->gamePath = getDefaultGamePath();
|
||||||
newProfile.winePrefixPath = getDefaultWinePrefixPath();
|
newProfile->winePrefixPath = getDefaultWinePrefixPath();
|
||||||
|
|
||||||
profileSettings.append(newProfile);
|
profileSettings.append(newProfile);
|
||||||
|
|
||||||
|
@ -600,12 +595,12 @@ int LauncherCore::addProfile() {
|
||||||
int LauncherCore::deleteProfile(QString name) {
|
int LauncherCore::deleteProfile(QString name) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for(int i = 0; i < profileSettings.size(); i++) {
|
for(int i = 0; i < profileSettings.size(); i++) {
|
||||||
if(profileSettings[i].name == name)
|
if(profileSettings[i]->name == name)
|
||||||
index = i;
|
index = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove group so it doesnt stay
|
// remove group so it doesnt stay
|
||||||
settings.beginGroup(profileSettings[index].uuid.toString(QUuid::StringFormat::WithoutBraces));
|
settings.beginGroup(profileSettings[index]->uuid.toString(QUuid::StringFormat::WithoutBraces));
|
||||||
settings.remove("");
|
settings.remove("");
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
@ -623,45 +618,45 @@ void LauncherCore::saveSettings() {
|
||||||
for(int i = 0; i < profileSettings.size(); i++) {
|
for(int i = 0; i < profileSettings.size(); i++) {
|
||||||
const auto& profile = profileSettings[i];
|
const auto& profile = profileSettings[i];
|
||||||
|
|
||||||
settings.beginGroup(profile.uuid.toString(QUuid::StringFormat::WithoutBraces));
|
settings.beginGroup(profile->uuid.toString(QUuid::StringFormat::WithoutBraces));
|
||||||
|
|
||||||
settings.setValue("name", profile.name);
|
settings.setValue("name", profile->name);
|
||||||
settings.setValue("index", i);
|
settings.setValue("index", i);
|
||||||
|
|
||||||
// game
|
// game
|
||||||
settings.setValue("useDX9", profile.useDX9);
|
settings.setValue("useDX9", profile->useDX9);
|
||||||
settings.setValue("gamePath", profile.gamePath);
|
settings.setValue("gamePath", profile->gamePath);
|
||||||
|
|
||||||
// wine
|
// wine
|
||||||
settings.setValue("wineType", (int)profile.wineType);
|
settings.setValue("wineType", (int)profile->wineType);
|
||||||
settings.setValue("winePath", profile.winePath);
|
settings.setValue("winePath", profile->winePath);
|
||||||
settings.setValue("winePrefixPath", profile.winePrefixPath);
|
settings.setValue("winePrefixPath", profile->winePrefixPath);
|
||||||
|
|
||||||
settings.setValue("useEsync", profile.useEsync);
|
settings.setValue("useEsync", profile->useEsync);
|
||||||
settings.setValue("useGamescope", profile.useGamescope);
|
settings.setValue("useGamescope", profile->useGamescope);
|
||||||
settings.setValue("useGamemode", profile.useGamemode);
|
settings.setValue("useGamemode", profile->useGamemode);
|
||||||
|
|
||||||
// gamescope
|
// gamescope
|
||||||
settings.setValue("gamescopeFullscreen", profile.gamescope.fullscreen);
|
settings.setValue("gamescopeFullscreen", profile->gamescope.fullscreen);
|
||||||
settings.setValue("gamescopeBorderless", profile.gamescope.borderless);
|
settings.setValue("gamescopeBorderless", profile->gamescope.borderless);
|
||||||
settings.setValue("gamescopeWidth", profile.gamescope.width);
|
settings.setValue("gamescopeWidth", profile->gamescope.width);
|
||||||
settings.setValue("gamescopeHeight", profile.gamescope.height);
|
settings.setValue("gamescopeHeight", profile->gamescope.height);
|
||||||
settings.setValue("gamescopeRefreshRate", profile.gamescope.refreshRate);
|
settings.setValue("gamescopeRefreshRate", profile->gamescope.refreshRate);
|
||||||
|
|
||||||
// login
|
// login
|
||||||
settings.setValue("encryptArguments", profile.encryptArguments);
|
settings.setValue("encryptArguments", profile->encryptArguments);
|
||||||
settings.setValue("isSapphire", profile.isSapphire);
|
settings.setValue("isSapphire", profile->isSapphire);
|
||||||
settings.setValue("lobbyURL", profile.lobbyURL);
|
settings.setValue("lobbyURL", profile->lobbyURL);
|
||||||
settings.setValue("rememberUsername", profile.rememberUsername);
|
settings.setValue("rememberUsername", profile->rememberUsername);
|
||||||
settings.setValue("rememberPassword", profile.rememberPassword);
|
settings.setValue("rememberPassword", profile->rememberPassword);
|
||||||
settings.setValue("useOneTimePassword", profile.useOneTimePassword);
|
settings.setValue("useOneTimePassword", profile->useOneTimePassword);
|
||||||
settings.setValue("license", (int)profile.license);
|
settings.setValue("license", (int)profile->license);
|
||||||
settings.setValue("isFreeTrial", profile.isFreeTrial);
|
settings.setValue("isFreeTrial", profile->isFreeTrial);
|
||||||
|
|
||||||
settings.setValue("enableDalamud", profile.dalamud.enabled);
|
settings.setValue("enableDalamud", profile->dalamud.enabled);
|
||||||
settings.setValue("dalamudOptOut", profile.dalamud.optOutOfMbCollection);
|
settings.setValue("dalamudOptOut", profile->dalamud.optOutOfMbCollection);
|
||||||
settings.setValue("dalamudChannel", (int)profile.dalamud.channel);
|
settings.setValue("dalamudChannel", (int)profile->dalamud.channel);
|
||||||
settings.setValue("enableWatchdog", profile.enableWatchdog);
|
settings.setValue("enableWatchdog", profile->enableWatchdog);
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
@ -669,7 +664,7 @@ void LauncherCore::saveSettings() {
|
||||||
|
|
||||||
void LauncherCore::addUpdateButtons(const ProfileSettings& settings, QMessageBox& messageBox) {
|
void LauncherCore::addUpdateButtons(const ProfileSettings& settings, QMessageBox& messageBox) {
|
||||||
auto launcherButton = messageBox.addButton("Launch Official Launcher", QMessageBox::NoRole);
|
auto launcherButton = messageBox.addButton("Launch Official Launcher", QMessageBox::NoRole);
|
||||||
connect(launcherButton, &QPushButton::clicked, [=] {
|
connect(launcherButton, &QPushButton::clicked, [&] {
|
||||||
launchExecutable(settings, {settings.gamePath + "/boot/ffxivboot.exe"});
|
launchExecutable(settings, {settings.gamePath + "/boot/ffxivboot.exe"});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ void SapphireLauncher::login(QString lobbyUrl, const LoginInformation& info) {
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
|
request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
|
||||||
|
|
||||||
auto reply = window.mgr->post(request, QJsonDocument(data).toJson(QJsonDocument::JsonFormat::Compact));
|
auto reply = window.mgr->post(request, QJsonDocument(data).toJson(QJsonDocument::JsonFormat::Compact));
|
||||||
connect(reply, &QNetworkReply::finished, [=] {
|
connect(reply, &QNetworkReply::finished, [&] {
|
||||||
QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
|
QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
|
||||||
if(!document.isEmpty()) {
|
if(!document.isEmpty()) {
|
||||||
LoginAuth auth;
|
LoginAuth auth;
|
||||||
|
@ -55,7 +55,7 @@ void SapphireLauncher::registerAccount(QString lobbyUrl, const LoginInformation&
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
|
request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
|
||||||
|
|
||||||
auto reply = window.mgr->post(request, QJsonDocument(data).toJson(QJsonDocument::JsonFormat::Compact));
|
auto reply = window.mgr->post(request, QJsonDocument(data).toJson(QJsonDocument::JsonFormat::Compact));
|
||||||
connect(reply, &QNetworkReply::finished, [=] {
|
connect(reply, &QNetworkReply::finished, [&] {
|
||||||
QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
|
QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
|
||||||
|
|
||||||
LoginAuth auth;
|
LoginAuth auth;
|
||||||
|
|
|
@ -40,7 +40,7 @@ void SquareBoot::bootCheck(const LoginInformation& info) {
|
||||||
request.setRawHeader("Host", "patch-bootver.ffxiv.com");
|
request.setRawHeader("Host", "patch-bootver.ffxiv.com");
|
||||||
|
|
||||||
auto reply = window.mgr->get(request);
|
auto reply = window.mgr->get(request);
|
||||||
connect(reply, &QNetworkReply::finished, [=] {
|
connect(reply, &QNetworkReply::finished, [=, &info] {
|
||||||
const QString response = reply->readAll();
|
const QString response = reply->readAll();
|
||||||
|
|
||||||
if(response.isEmpty()) {
|
if(response.isEmpty()) {
|
||||||
|
@ -77,7 +77,7 @@ void SquareBoot::bootCheck(const LoginInformation& info) {
|
||||||
dialog->setValue(recieved);
|
dialog->setValue(recieved);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(patchReply, &QNetworkReply::finished, [=] {
|
connect(patchReply, &QNetworkReply::finished, [&] {
|
||||||
const QString dataDir =
|
const QString dataDir =
|
||||||
QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ void SquareBoot::bootCheck(const LoginInformation& info) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SquareBoot::checkGateStatus(const LoginInformation& info) {
|
void SquareBoot::checkGateStatus(LoginInformation* info) {
|
||||||
QUrlQuery query;
|
QUrlQuery query;
|
||||||
query.addQueryItem("", QString::number(QDateTime::currentMSecsSinceEpoch()));
|
query.addQueryItem("", QString::number(QDateTime::currentMSecsSinceEpoch()));
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ void SquareBoot::checkGateStatus(const LoginInformation& info) {
|
||||||
request.setUrl(url);
|
request.setUrl(url);
|
||||||
|
|
||||||
// TODO: really?
|
// TODO: really?
|
||||||
window.buildRequest(*info.settings, request);
|
window.buildRequest(*info->settings, request);
|
||||||
|
|
||||||
auto reply = window.mgr->get(request);
|
auto reply = window.mgr->get(request);
|
||||||
connect(reply, &QNetworkReply::finished, [=] {
|
connect(reply, &QNetworkReply::finished, [=] {
|
||||||
|
@ -132,7 +132,7 @@ void SquareBoot::checkGateStatus(const LoginInformation& info) {
|
||||||
const bool isGateOpen = !document.isEmpty() && document.object()["status"].toInt() != 0;
|
const bool isGateOpen = !document.isEmpty() && document.object()["status"].toInt() != 0;
|
||||||
|
|
||||||
if(isGateOpen) {
|
if(isGateOpen) {
|
||||||
bootCheck(info);
|
bootCheck(*info);
|
||||||
} else {
|
} else {
|
||||||
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical,
|
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical,
|
||||||
"Failed to Login",
|
"Failed to Login",
|
||||||
|
|
|
@ -58,7 +58,7 @@ void SquareLauncher::getStored(const LoginInformation& info) {
|
||||||
|
|
||||||
QNetworkReply* reply = window.mgr->get(request);
|
QNetworkReply* reply = window.mgr->get(request);
|
||||||
|
|
||||||
connect(reply, &QNetworkReply::finished, [=] {
|
connect(reply, &QNetworkReply::finished, [=, &info] {
|
||||||
auto str = QString(reply->readAll());
|
auto str = QString(reply->readAll());
|
||||||
|
|
||||||
// fetches Steam username
|
// fetches Steam username
|
||||||
|
@ -102,7 +102,7 @@ void SquareLauncher::login(const LoginInformation& info, const QUrl referer) {
|
||||||
request.setRawHeader("Cache-Control", "no-cache");
|
request.setRawHeader("Cache-Control", "no-cache");
|
||||||
|
|
||||||
auto reply = window.mgr->post(request, postData.toString(QUrl::FullyEncoded).toUtf8());
|
auto reply = window.mgr->post(request, postData.toString(QUrl::FullyEncoded).toUtf8());
|
||||||
connect(reply, &QNetworkReply::finished, [=] {
|
connect(reply, &QNetworkReply::finished, [=, &info] {
|
||||||
auto str = QString(reply->readAll());
|
auto str = QString(reply->readAll());
|
||||||
|
|
||||||
QRegularExpression re(R"lit(window.external.user\("login=auth,ok,(?<launchParams>.*)\);)lit");
|
QRegularExpression re(R"lit(window.external.user\("login=auth,ok,(?<launchParams>.*)\);)lit");
|
||||||
|
@ -175,7 +175,7 @@ void SquareLauncher::registerSession(const LoginInformation& info) {
|
||||||
report += QString("\nex%1\t%2").arg(QString::number(i), info.settings->gameVersions[i]);
|
report += QString("\nex%1\t%2").arg(QString::number(i), info.settings->gameVersions[i]);
|
||||||
|
|
||||||
auto reply = window.mgr->post(request, report.toUtf8());
|
auto reply = window.mgr->post(request, report.toUtf8());
|
||||||
connect(reply, &QNetworkReply::finished, [=] {
|
connect(reply, &QNetworkReply::finished, [&] {
|
||||||
if(reply->rawHeaderList().contains("X-Patch-Unique-Id")) {
|
if(reply->rawHeaderList().contains("X-Patch-Unique-Id")) {
|
||||||
auth.SID = reply->rawHeader("X-Patch-Unique-Id");
|
auth.SID = reply->rawHeader("X-Patch-Unique-Id");
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ class LauncherWindow : public QMainWindow {
|
||||||
public:
|
public:
|
||||||
explicit LauncherWindow(LauncherCore& core, QWidget* parent = nullptr);
|
explicit LauncherWindow(LauncherCore& core, QWidget* parent = nullptr);
|
||||||
|
|
||||||
ProfileSettings currentProfile() const;
|
|
||||||
ProfileSettings& currentProfile();
|
ProfileSettings& currentProfile();
|
||||||
|
|
||||||
void openPath(const QString path);
|
void openPath(const QString path);
|
||||||
|
|
|
@ -73,7 +73,7 @@ void AssetUpdater::update(const ProfileSettings& profile) {
|
||||||
QNetworkRequest request(dalamudAssetManifestURL);
|
QNetworkRequest request(dalamudAssetManifestURL);
|
||||||
|
|
||||||
auto reply = launcher.mgr->get(request);
|
auto reply = launcher.mgr->get(request);
|
||||||
connect(reply, &QNetworkReply::finished, [reply, this, profile] {
|
connect(reply, &QNetworkReply::finished, [reply, this, &profile] {
|
||||||
dialog->setLabelText("Checking for Dalamud asset updates...");
|
dialog->setLabelText("Checking for Dalamud asset updates...");
|
||||||
|
|
||||||
// TODO: handle asset failure
|
// TODO: handle asset failure
|
||||||
|
@ -97,7 +97,7 @@ void AssetUpdater::update(const ProfileSettings& profile) {
|
||||||
remoteNativeLauncherVersion.clear();
|
remoteNativeLauncherVersion.clear();
|
||||||
|
|
||||||
auto reply = launcher.mgr->get(request);
|
auto reply = launcher.mgr->get(request);
|
||||||
connect(reply, &QNetworkReply::finished, [this, profile, reply] {
|
connect(reply, &QNetworkReply::finished, [this, &profile, reply] {
|
||||||
dialog->setLabelText("Checking for native launcher updates...");
|
dialog->setLabelText("Checking for native launcher updates...");
|
||||||
|
|
||||||
remoteNativeLauncherVersion = reply->readAll().trimmed();
|
remoteNativeLauncherVersion = reply->readAll().trimmed();
|
||||||
|
@ -119,7 +119,7 @@ void AssetUpdater::update(const ProfileSettings& profile) {
|
||||||
remoteRuntimeVersion.clear();
|
remoteRuntimeVersion.clear();
|
||||||
|
|
||||||
auto reply = launcher.mgr->get(request);
|
auto reply = launcher.mgr->get(request);
|
||||||
connect(reply, &QNetworkReply::finished, [this, profile, reply] {
|
connect(reply, &QNetworkReply::finished, [this, &profile, reply] {
|
||||||
dialog->setLabelText("Checking for Dalamud updates...");
|
dialog->setLabelText("Checking for Dalamud updates...");
|
||||||
|
|
||||||
QByteArray str = reply->readAll();
|
QByteArray str = reply->readAll();
|
||||||
|
|
|
@ -5,7 +5,7 @@ DesktopInterface::DesktopInterface(LauncherCore& core) {
|
||||||
window = new LauncherWindow(core);
|
window = new LauncherWindow(core);
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
auto defaultProfile = core.getProfile(core.defaultProfileIndex);
|
auto& defaultProfile = core.getProfile(core.defaultProfileIndex);
|
||||||
|
|
||||||
if(!defaultProfile.isGameInstalled()) {
|
if(!defaultProfile.isGameInstalled()) {
|
||||||
auto messageBox = new QMessageBox(window);
|
auto messageBox = new QMessageBox(window);
|
||||||
|
|
|
@ -258,7 +258,13 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
setCentralWidget(emptyWidget);
|
setCentralWidget(emptyWidget);
|
||||||
|
|
||||||
connect(core.assetUpdater, &AssetUpdater::finishedUpdating, [=] {
|
connect(core.assetUpdater, &AssetUpdater::finishedUpdating, [=] {
|
||||||
auto info = LoginInformation{¤tProfile(), usernameEdit->text(), passwordEdit->text(), otpEdit->text()};
|
auto& profile = currentProfile();
|
||||||
|
|
||||||
|
LoginInformation info;
|
||||||
|
info.settings = &profile;
|
||||||
|
info.username = usernameEdit->text();
|
||||||
|
info.password = passwordEdit->text();
|
||||||
|
info.oneTimePassword = otpEdit->text();
|
||||||
|
|
||||||
#ifndef QT_DEBUG
|
#ifndef QT_DEBUG
|
||||||
if(currentProfile().rememberUsername) {
|
if(currentProfile().rememberUsername) {
|
||||||
|
@ -281,7 +287,7 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
if(currentProfile().isSapphire) {
|
if(currentProfile().isSapphire) {
|
||||||
this->core.sapphireLauncher->login(currentProfile().lobbyURL, info);
|
this->core.sapphireLauncher->login(currentProfile().lobbyURL, info);
|
||||||
} else {
|
} else {
|
||||||
this->core.squareBoot->checkGateStatus(info);
|
this->core.squareBoot->checkGateStatus(&info);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -292,7 +298,14 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
|
|
||||||
connect(registerButton, &QPushButton::released, [=] {
|
connect(registerButton, &QPushButton::released, [=] {
|
||||||
if(currentProfile().isSapphire) {
|
if(currentProfile().isSapphire) {
|
||||||
auto info = LoginInformation{¤tProfile(), usernameEdit->text(), passwordEdit->text(), otpEdit->text()};
|
auto& profile = currentProfile();
|
||||||
|
|
||||||
|
LoginInformation info;
|
||||||
|
info.settings = &profile;
|
||||||
|
info.username = usernameEdit->text();
|
||||||
|
info.password = passwordEdit->text();
|
||||||
|
info.oneTimePassword = otpEdit->text();
|
||||||
|
|
||||||
this->core.sapphireLauncher->registerAccount(currentProfile().lobbyURL, info);
|
this->core.sapphireLauncher->registerAccount(currentProfile().lobbyURL, info);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -315,10 +328,6 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
reloadControls();
|
reloadControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileSettings LauncherWindow::currentProfile() const {
|
|
||||||
return core.getProfile(profileSelect->currentIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
ProfileSettings& LauncherWindow::currentProfile() {
|
ProfileSettings& LauncherWindow::currentProfile() {
|
||||||
return core.getProfile(profileSelect->currentIndex());
|
return core.getProfile(profileSelect->currentIndex());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Window 2.0
|
import QtQuick.Window 2.0
|
||||||
|
import Astra 1.0
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
id: window
|
id: window
|
||||||
|
@ -45,6 +46,14 @@ ApplicationWindow {
|
||||||
|
|
||||||
anchors.top: passwordField.bottom
|
anchors.top: passwordField.bottom
|
||||||
|
|
||||||
onClicked: print("Hooray!");
|
onClicked: {
|
||||||
|
var info = core.createNewLoginInfo();
|
||||||
|
info.settings = core.getProfileQML(0);
|
||||||
|
info.username = usernameField.text
|
||||||
|
info.password = passwordField.text
|
||||||
|
|
||||||
|
print(info);
|
||||||
|
core.squareBoot.checkGateStatus(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,14 @@
|
||||||
#include "../launcher/tablet/include/tabletinterface.h"
|
#include "tabletinterface.h"
|
||||||
|
|
||||||
|
#include <QQuickView>
|
||||||
|
#include <QQmlContext>
|
||||||
|
|
||||||
TabletInterface::TabletInterface(LauncherCore &core) {
|
TabletInterface::TabletInterface(LauncherCore &core) {
|
||||||
|
qmlRegisterType<ProfileSettings>("Astra", 1, 0, "ProfileSettings");
|
||||||
|
qmlRegisterType<LoginInformation>("Astra", 1, 0, "LoginInformation");
|
||||||
|
|
||||||
applicationEngine = new QQmlApplicationEngine();
|
applicationEngine = new QQmlApplicationEngine();
|
||||||
|
|
||||||
|
applicationEngine->rootContext()->setContextProperty("core", &core);
|
||||||
applicationEngine->load("qrc:/main.qml");
|
applicationEngine->load("qrc:/main.qml");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue