mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 11:47:46 +00:00
Add CMake option for sync support
This is to ease the amount of work for me packaging at first, so I can focus on the actual feature. Once all packages support it, this option can go away.
This commit is contained in:
parent
3ec355e79e
commit
3d989d5790
5 changed files with 48 additions and 7 deletions
|
@ -8,6 +8,9 @@ project(Astra VERSION 0.6.0 LANGUAGES CXX)
|
||||||
option(BUILD_FLATPAK "Build for Flatpak." OFF)
|
option(BUILD_FLATPAK "Build for Flatpak." OFF)
|
||||||
option(BUILD_WEBVIEW "Build support for the integrated web browser. Only used on the Steam Deck." OFF)
|
option(BUILD_WEBVIEW "Build support for the integrated web browser. Only used on the Steam Deck." OFF)
|
||||||
|
|
||||||
|
# TODO: phase out once all supported builds can turn on this option
|
||||||
|
option(BUILD_SYNC "Build Matrix sync support." OFF)
|
||||||
|
|
||||||
# options for features you may want or need
|
# options for features you may want or need
|
||||||
if (NOT WIN32 AND NOT APPLE)
|
if (NOT WIN32 AND NOT APPLE)
|
||||||
option(ENABLE_GAMEMODE "Build with Feral GameMode support, requires the daemon to be installed." ON)
|
option(ENABLE_GAMEMODE "Build with Feral GameMode support, requires the daemon to be installed." ON)
|
||||||
|
@ -51,7 +54,9 @@ find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami I18n Config Core
|
||||||
find_package(KF6KirigamiAddons 1.2.1 REQUIRED)
|
find_package(KF6KirigamiAddons 1.2.1 REQUIRED)
|
||||||
find_package(QCoro6 REQUIRED COMPONENTS Core Network Qml)
|
find_package(QCoro6 REQUIRED COMPONENTS Core Network Qml)
|
||||||
qcoro_enable_coroutines()
|
qcoro_enable_coroutines()
|
||||||
|
if (BUILD_SYNC)
|
||||||
find_package(QuotientQt6 REQUIRED)
|
find_package(QuotientQt6 REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
qt_policy(SET QTP0001 NEW)
|
qt_policy(SET QTP0001 NEW)
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ target_sources(astra PRIVATE
|
||||||
include/accountmanager.h
|
include/accountmanager.h
|
||||||
include/assetupdater.h
|
include/assetupdater.h
|
||||||
include/benchmarkinstaller.h
|
include/benchmarkinstaller.h
|
||||||
include/charactersync.h
|
|
||||||
include/compatibilitytoolinstaller.h
|
include/compatibilitytoolinstaller.h
|
||||||
include/encryptedarg.h
|
include/encryptedarg.h
|
||||||
include/existinginstallmodel.h
|
include/existinginstallmodel.h
|
||||||
|
@ -63,14 +62,12 @@ target_sources(astra PRIVATE
|
||||||
include/sapphirelogin.h
|
include/sapphirelogin.h
|
||||||
include/squareenixlogin.h
|
include/squareenixlogin.h
|
||||||
include/steamapi.h
|
include/steamapi.h
|
||||||
include/syncmanager.h
|
|
||||||
include/utility.h
|
include/utility.h
|
||||||
|
|
||||||
src/account.cpp
|
src/account.cpp
|
||||||
src/accountmanager.cpp
|
src/accountmanager.cpp
|
||||||
src/assetupdater.cpp
|
src/assetupdater.cpp
|
||||||
src/benchmarkinstaller.cpp
|
src/benchmarkinstaller.cpp
|
||||||
src/charactersync.cpp
|
|
||||||
src/compatibilitytoolinstaller.cpp
|
src/compatibilitytoolinstaller.cpp
|
||||||
src/encryptedarg.cpp
|
src/encryptedarg.cpp
|
||||||
src/existinginstallmodel.cpp
|
src/existinginstallmodel.cpp
|
||||||
|
@ -89,7 +86,6 @@ target_sources(astra PRIVATE
|
||||||
src/sapphirelogin.cpp
|
src/sapphirelogin.cpp
|
||||||
src/squareenixlogin.cpp
|
src/squareenixlogin.cpp
|
||||||
src/steamapi.cpp
|
src/steamapi.cpp
|
||||||
src/syncmanager.cpp
|
|
||||||
src/utility.cpp
|
src/utility.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -122,6 +118,16 @@ qt_target_qml_sources(astra
|
||||||
ui/Setup/SetupPage.qml
|
ui/Setup/SetupPage.qml
|
||||||
ui/Main.qml
|
ui/Main.qml
|
||||||
)
|
)
|
||||||
|
if (BUILD_SYNC)
|
||||||
|
target_sources(astra PRIVATE
|
||||||
|
include/charactersync.h
|
||||||
|
include/syncmanager.h
|
||||||
|
|
||||||
|
src/charactersync.cpp
|
||||||
|
src/syncmanager.cpp
|
||||||
|
)
|
||||||
|
target_compile_definitions(astra PRIVATE BUILD_SYNC)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_source_files_properties(../zone.xiv.astra.svg PROPERTIES
|
set_source_files_properties(../zone.xiv.astra.svg PROPERTIES
|
||||||
QT_RESOURCE_ALIAS /zone.xiv.astra.svg
|
QT_RESOURCE_ALIAS /zone.xiv.astra.svg
|
||||||
|
|
|
@ -68,7 +68,10 @@ class LauncherCore : public QObject
|
||||||
Q_PROPERTY(Headline *headline READ headline NOTIFY newsChanged)
|
Q_PROPERTY(Headline *headline READ headline NOTIFY newsChanged)
|
||||||
Q_PROPERTY(Profile *currentProfile READ currentProfile WRITE setCurrentProfile NOTIFY currentProfileChanged)
|
Q_PROPERTY(Profile *currentProfile READ currentProfile WRITE setCurrentProfile NOTIFY currentProfileChanged)
|
||||||
Q_PROPERTY(Profile *autoLoginProfile READ autoLoginProfile WRITE setAutoLoginProfile NOTIFY autoLoginProfileChanged)
|
Q_PROPERTY(Profile *autoLoginProfile READ autoLoginProfile WRITE setAutoLoginProfile NOTIFY autoLoginProfileChanged)
|
||||||
|
|
||||||
|
#ifdef BUILD_SYNC
|
||||||
Q_PROPERTY(SyncManager *syncManager READ syncManager CONSTANT)
|
Q_PROPERTY(SyncManager *syncManager READ syncManager CONSTANT)
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LauncherCore();
|
LauncherCore();
|
||||||
|
@ -117,6 +120,7 @@ public:
|
||||||
[[nodiscard]] static bool isWindows();
|
[[nodiscard]] static bool isWindows();
|
||||||
[[nodiscard]] static bool needsCompatibilityTool();
|
[[nodiscard]] static bool needsCompatibilityTool();
|
||||||
[[nodiscard]] Q_INVOKABLE bool isPatching() const;
|
[[nodiscard]] Q_INVOKABLE bool isPatching() const;
|
||||||
|
[[nodiscard]] Q_INVOKABLE bool supportsSync() const;
|
||||||
|
|
||||||
[[nodiscard]] QNetworkAccessManager *mgr();
|
[[nodiscard]] QNetworkAccessManager *mgr();
|
||||||
[[nodiscard]] LauncherSettings *settings();
|
[[nodiscard]] LauncherSettings *settings();
|
||||||
|
@ -124,7 +128,10 @@ public:
|
||||||
[[nodiscard]] AccountManager *accountManager();
|
[[nodiscard]] AccountManager *accountManager();
|
||||||
[[nodiscard]] Headline *headline() const;
|
[[nodiscard]] Headline *headline() const;
|
||||||
[[nodiscard]] QString cachedLogoImage() const;
|
[[nodiscard]] QString cachedLogoImage() const;
|
||||||
|
|
||||||
|
#ifdef BUILD_SYNC
|
||||||
[[nodiscard]] SyncManager *syncManager() const;
|
[[nodiscard]] SyncManager *syncManager() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void loadingFinished();
|
void loadingFinished();
|
||||||
|
@ -166,7 +173,10 @@ private:
|
||||||
LauncherSettings *m_settings = nullptr;
|
LauncherSettings *m_settings = nullptr;
|
||||||
GameRunner *m_runner = nullptr;
|
GameRunner *m_runner = nullptr;
|
||||||
QString m_cachedLogoImage;
|
QString m_cachedLogoImage;
|
||||||
|
|
||||||
|
#ifdef BUILD_SYNC
|
||||||
SyncManager *m_syncManager = nullptr;
|
SyncManager *m_syncManager = nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
int m_currentProfileIndex = 0;
|
int m_currentProfileIndex = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,15 +15,18 @@
|
||||||
#include "assetupdater.h"
|
#include "assetupdater.h"
|
||||||
#include "astra_log.h"
|
#include "astra_log.h"
|
||||||
#include "benchmarkinstaller.h"
|
#include "benchmarkinstaller.h"
|
||||||
#include "charactersync.h"
|
|
||||||
#include "compatibilitytoolinstaller.h"
|
#include "compatibilitytoolinstaller.h"
|
||||||
#include "gamerunner.h"
|
#include "gamerunner.h"
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
#include "sapphirelogin.h"
|
#include "sapphirelogin.h"
|
||||||
#include "squareenixlogin.h"
|
#include "squareenixlogin.h"
|
||||||
#include "syncmanager.h"
|
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
|
||||||
|
#ifdef BUILD_SYNC
|
||||||
|
#include "charactersync.h"
|
||||||
|
#include "syncmanager.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace Qt::StringLiterals;
|
using namespace Qt::StringLiterals;
|
||||||
|
|
||||||
LauncherCore::LauncherCore()
|
LauncherCore::LauncherCore()
|
||||||
|
@ -36,7 +39,10 @@ LauncherCore::LauncherCore()
|
||||||
m_profileManager = new ProfileManager(*this, this);
|
m_profileManager = new ProfileManager(*this, this);
|
||||||
m_accountManager = new AccountManager(*this, this);
|
m_accountManager = new AccountManager(*this, this);
|
||||||
m_runner = new GameRunner(*this, this);
|
m_runner = new GameRunner(*this, this);
|
||||||
|
|
||||||
|
#ifdef BUILD_SYNC
|
||||||
m_syncManager = new SyncManager(this);
|
m_syncManager = new SyncManager(this);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_profileManager->load();
|
m_profileManager->load();
|
||||||
m_accountManager->load();
|
m_accountManager->load();
|
||||||
|
@ -327,6 +333,15 @@ bool LauncherCore::isPatching() const
|
||||||
return m_isPatching;
|
return m_isPatching;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LauncherCore::supportsSync() const
|
||||||
|
{
|
||||||
|
#ifdef BUILD_SYNC
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
QNetworkAccessManager *LauncherCore::mgr()
|
QNetworkAccessManager *LauncherCore::mgr()
|
||||||
{
|
{
|
||||||
return m_mgr;
|
return m_mgr;
|
||||||
|
@ -357,10 +372,12 @@ QString LauncherCore::cachedLogoImage() const
|
||||||
return m_cachedLogoImage;
|
return m_cachedLogoImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BUILD_SYNC
|
||||||
SyncManager *LauncherCore::syncManager() const
|
SyncManager *LauncherCore::syncManager() const
|
||||||
{
|
{
|
||||||
return m_syncManager;
|
return m_syncManager;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QCoro::Task<> LauncherCore::beginLogin(LoginInformation &info)
|
QCoro::Task<> LauncherCore::beginLogin(LoginInformation &info)
|
||||||
{
|
{
|
||||||
|
@ -369,10 +386,12 @@ QCoro::Task<> LauncherCore::beginLogin(LoginInformation &info)
|
||||||
info.profile->account()->updateConfig();
|
info.profile->account()->updateConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BUILD_SYNC
|
||||||
const auto characterSync = new CharacterSync(*info.profile->account(), *this, this);
|
const auto characterSync = new CharacterSync(*info.profile->account(), *this, this);
|
||||||
if (!co_await characterSync->sync()) {
|
if (!co_await characterSync->sync()) {
|
||||||
co_return;
|
co_return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::optional<LoginAuth> auth;
|
std::optional<LoginAuth> auth;
|
||||||
if (!info.profile->isBenchmark()) {
|
if (!info.profile->isBenchmark()) {
|
||||||
|
|
|
@ -51,6 +51,7 @@ KirigamiSettings.CategorizedSettings {
|
||||||
text: i18n("Sync")
|
text: i18n("Sync")
|
||||||
icon.name: "state-sync-symbolic"
|
icon.name: "state-sync-symbolic"
|
||||||
page: Qt.resolvedUrl("/qt/qml/zone/xiv/astra/ui/Settings/SyncSettings.qml")
|
page: Qt.resolvedUrl("/qt/qml/zone/xiv/astra/ui/Settings/SyncSettings.qml")
|
||||||
|
visible: LauncherCore.supportsSync()
|
||||||
},
|
},
|
||||||
KirigamiSettings.SettingAction {
|
KirigamiSettings.SettingAction {
|
||||||
actionName: "compattool"
|
actionName: "compattool"
|
||||||
|
|
Loading…
Add table
Reference in a new issue