mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-21 20:27:45 +00:00
Begin consolidating GUI work
Also contains some stuff for future Qt6 version
This commit is contained in:
parent
8bef7274e1
commit
59d7d842aa
29 changed files with 326 additions and 299 deletions
|
@ -17,8 +17,7 @@ If you still have questions, please read the [FAQ](https://xiv.zone/astra/faq) f
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Traditional desktop interface which looks native to your system, utilizing Qt - a proven application framework.
|
* Traditional desktop interface which looks native to your system, utilizing Qt - a proven application framework.
|
||||||
* A Tablet/TV interface designed for touchscreens or handhelds such as the Steam Deck is also available.
|
* Supports single-window scenarios such as the Steam Deck seamlessly.
|
||||||
* Can even run without a GUI, ideal for users comfortable with a CLI or for automation.
|
|
||||||
* Native support for Windows, macOS and Linux!
|
* Native support for Windows, macOS and Linux!
|
||||||
* Handles running Wine for macOS and Linux users - creating a seamless and native-feeling launcher experience, compared
|
* Handles running Wine for macOS and Linux users - creating a seamless and native-feeling launcher experience, compared
|
||||||
to running other FFXIV launchers in Wine.
|
to running other FFXIV launchers in Wine.
|
||||||
|
|
|
@ -1,39 +1,12 @@
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
|
add_subdirectory(desktop)
|
||||||
if(ENABLE_CLI)
|
|
||||||
add_subdirectory(cli)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_DESKTOP)
|
|
||||||
add_subdirectory(desktop)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_TABLET)
|
|
||||||
add_subdirectory(tablet)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(astra
|
add_executable(astra
|
||||||
main.cpp
|
main.cpp)
|
||||||
tablet/qml/qml.qrc)
|
|
||||||
|
|
||||||
if(ENABLE_DESKTOP)
|
|
||||||
set(INTERFACES ${INTERFACES} astra_desktop)
|
|
||||||
target_compile_definitions(astra PRIVATE ENABLE_DESKTOP)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_TABLET)
|
|
||||||
set(INTERFACES ${INTERFACES} astra_tablet)
|
|
||||||
target_compile_definitions(astra PRIVATE ENABLE_TABLET)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_CLI)
|
|
||||||
set(INTERFACES ${INTERFACES} astra_cli)
|
|
||||||
target_compile_definitions(astra PRIVATE ENABLE_CLI)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(astra PUBLIC
|
target_link_libraries(astra PUBLIC
|
||||||
astra_core
|
astra_core
|
||||||
${INTERFACES})
|
astra_desktop)
|
||||||
target_compile_features(astra PUBLIC cxx_std_17)
|
target_compile_features(astra PUBLIC cxx_std_17)
|
||||||
set_target_properties(astra PROPERTIES CXX_EXTENSIONS OFF)
|
set_target_properties(astra PROPERTIES CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
set(HEADERS
|
|
||||||
include/cmdinterface.h)
|
|
||||||
|
|
||||||
set(SRC
|
|
||||||
src/cmdinterface.cpp)
|
|
||||||
|
|
||||||
add_library(astra_cli STATIC ${HEADERS} ${SRC})
|
|
||||||
target_include_directories(astra_cli PUBLIC include)
|
|
||||||
target_link_libraries(astra_cli PUBLIC
|
|
||||||
astra_core
|
|
||||||
Qt5::Core
|
|
||||||
Qt5::Network)
|
|
|
@ -1,23 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "launchercore.h"
|
|
||||||
#include <QCommandLineParser>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The CLI interface for Astra, driven primarily by the command-line.
|
|
||||||
*/
|
|
||||||
class CMDInterface {
|
|
||||||
public:
|
|
||||||
explicit CMDInterface(QCommandLineParser& parser);
|
|
||||||
|
|
||||||
bool parse(QCommandLineParser& parser, LauncherCore& core);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QCommandLineOption profileOption = {
|
|
||||||
"default-profile",
|
|
||||||
"Profile to use for default profile and autologin.",
|
|
||||||
"profile"};
|
|
||||||
QCommandLineOption autologinOption = {
|
|
||||||
"autologin",
|
|
||||||
"Auto-login with the default profile. This requires the profile to have remember username/password enabled!"};
|
|
||||||
};
|
|
|
@ -1,25 +0,0 @@
|
||||||
#include "cmdinterface.h"
|
|
||||||
|
|
||||||
CMDInterface::CMDInterface(QCommandLineParser& parser) {
|
|
||||||
parser.addOption(autologinOption);
|
|
||||||
parser.addOption(profileOption);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CMDInterface::parse(QCommandLineParser& parser, LauncherCore& core) {
|
|
||||||
if (parser.isSet(profileOption)) {
|
|
||||||
core.defaultProfileIndex = core.getProfileIndex(parser.value(profileOption));
|
|
||||||
|
|
||||||
if (core.defaultProfileIndex == -1) {
|
|
||||||
qInfo() << "The profile \"" << parser.value(profileOption) << "\" does not exist!";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parser.isSet(autologinOption)) {
|
|
||||||
auto& profile = core.getProfile(core.defaultProfileIndex);
|
|
||||||
|
|
||||||
return core.autoLogin(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
|
#include <QRegExp>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -33,7 +34,7 @@ void Patcher::processPatchList(QNetworkAccessManager& mgr, const QString& patchL
|
||||||
dialog->setLabelText("Updating the FINAL FANTASY XIV Game version.");
|
dialog->setLabelText("Updating the FINAL FANTASY XIV Game version.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList parts = patchList.split(QRegExp("\n|\r\n|\r"));
|
const QStringList parts = patchList.split("\n|\r\n|\r");
|
||||||
|
|
||||||
remainingPatches = parts.size() - 7;
|
remainingPatches = parts.size() - 7;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ set(SRC
|
||||||
src/gamescopesettingswindow.cpp
|
src/gamescopesettingswindow.cpp
|
||||||
src/launcherwindow.cpp
|
src/launcherwindow.cpp
|
||||||
src/settingswindow.cpp
|
src/settingswindow.cpp
|
||||||
src/autologinwindow.cpp)
|
src/autologinwindow.cpp include/virtualwindow.h src/virtualwindow.cpp src/virtualdialog.cpp include/virtualdialog.h)
|
||||||
|
|
||||||
add_library(astra_desktop STATIC ${HEADERS} ${SRC})
|
add_library(astra_desktop STATIC ${HEADERS} ${SRC})
|
||||||
target_include_directories(astra_desktop PUBLIC include)
|
target_include_directories(astra_desktop PUBLIC include)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QDialog>
|
#include "virtualdialog.h"
|
||||||
|
|
||||||
class AboutWindow : public QDialog {
|
class AboutWindow : public VirtualDialog {
|
||||||
public:
|
public:
|
||||||
explicit AboutWindow(QWidget* widget = nullptr);
|
explicit AboutWindow(DesktopInterface& interface, QWidget* widget = nullptr);
|
||||||
};
|
};
|
|
@ -1,15 +1,15 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QDialog>
|
#include "virtualdialog.h"
|
||||||
|
|
||||||
class LauncherCore;
|
class LauncherCore;
|
||||||
class LauncherWindow;
|
class LauncherWindow;
|
||||||
struct ProfileSettings;
|
struct ProfileSettings;
|
||||||
|
|
||||||
class AutoLoginWindow : public QDialog {
|
class AutoLoginWindow : public VirtualDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AutoLoginWindow(ProfileSettings& settings, LauncherCore& core, QWidget* parent = nullptr);
|
AutoLoginWindow(DesktopInterface& interface, ProfileSettings& settings, LauncherCore& core, QWidget* parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void loginCanceled();
|
void loginCanceled();
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QMdiArea>
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
#include "launcherwindow.h"
|
#include "launcherwindow.h"
|
||||||
#include "autologinwindow.h"
|
#include "autologinwindow.h"
|
||||||
|
#include "virtualdialog.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The desktop, mouse and keyboard-driven interface for Astra. Primarily meant
|
* The desktop, mouse and keyboard-driven interface for Astra. Primarily meant
|
||||||
|
@ -11,7 +15,16 @@ class DesktopInterface {
|
||||||
public:
|
public:
|
||||||
explicit DesktopInterface(LauncherCore& core);
|
explicit DesktopInterface(LauncherCore& core);
|
||||||
|
|
||||||
|
void addWindow(VirtualWindow* window);
|
||||||
|
void addDialog(VirtualDialog* dialog);
|
||||||
|
|
||||||
|
bool oneWindow = true;
|
||||||
|
bool isSteamDeck = true;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QMdiArea* mdiArea = nullptr;
|
||||||
|
QMainWindow* mdiWindow = nullptr;
|
||||||
|
|
||||||
LauncherWindow* window = nullptr;
|
LauncherWindow* window = nullptr;
|
||||||
AutoLoginWindow* autoLoginWindow = nullptr;
|
AutoLoginWindow* autoLoginWindow = nullptr;
|
||||||
};
|
};
|
|
@ -8,11 +8,13 @@
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
|
#include "virtualdialog.h"
|
||||||
|
|
||||||
class LauncherCore;
|
class LauncherCore;
|
||||||
class LauncherWindow;
|
class LauncherWindow;
|
||||||
struct ProfileSettings;
|
struct ProfileSettings;
|
||||||
|
|
||||||
class GamescopeSettingsWindow : public QDialog {
|
class GamescopeSettingsWindow : public VirtualDialog {
|
||||||
public:
|
public:
|
||||||
GamescopeSettingsWindow(ProfileSettings& settings, LauncherCore& core, QWidget* parent = nullptr);
|
GamescopeSettingsWindow(DesktopInterface& interface, ProfileSettings& settings, LauncherCore& core, QWidget* parent = nullptr);
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,11 +11,14 @@
|
||||||
|
|
||||||
#include "headline.h"
|
#include "headline.h"
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
|
#include "virtualwindow.h"
|
||||||
|
|
||||||
class LauncherWindow : public QMainWindow {
|
class DesktopInterface;
|
||||||
|
|
||||||
|
class LauncherWindow : public VirtualWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit LauncherWindow(LauncherCore& new_headline, QWidget* parent = nullptr);
|
explicit LauncherWindow(DesktopInterface& interface, LauncherCore& new_headline, QWidget* parent = nullptr);
|
||||||
|
|
||||||
ProfileSettings& currentProfile();
|
ProfileSettings& currentProfile();
|
||||||
|
|
||||||
|
@ -59,4 +62,6 @@ private:
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
||||||
QAction* wineCfg;
|
QAction* wineCfg;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
DesktopInterface& interface;
|
||||||
};
|
};
|
|
@ -9,13 +9,15 @@
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
|
#include "virtualdialog.h"
|
||||||
|
|
||||||
class LauncherCore;
|
class LauncherCore;
|
||||||
class LauncherWindow;
|
class LauncherWindow;
|
||||||
struct ProfileSettings;
|
struct ProfileSettings;
|
||||||
|
|
||||||
class SettingsWindow : public QDialog {
|
class SettingsWindow : public VirtualDialog {
|
||||||
public:
|
public:
|
||||||
SettingsWindow(int defaultTab, LauncherWindow& window, LauncherCore& core, QWidget* parent = nullptr);
|
SettingsWindow(DesktopInterface& interface, int defaultTab, LauncherWindow& window, LauncherCore& core, QWidget* parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void reloadControls();
|
void reloadControls();
|
||||||
|
@ -79,4 +81,6 @@ private:
|
||||||
|
|
||||||
LauncherWindow& window;
|
LauncherWindow& window;
|
||||||
LauncherCore& core;
|
LauncherCore& core;
|
||||||
|
|
||||||
|
DesktopInterface& interface;
|
||||||
};
|
};
|
||||||
|
|
28
launcher/desktop/include/virtualdialog.h
Normal file
28
launcher/desktop/include/virtualdialog.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QMdiSubWindow>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class DesktopInterface;
|
||||||
|
|
||||||
|
class VirtualDialog : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
VirtualDialog(DesktopInterface& interface, QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
void setWindowTitle(QString title);
|
||||||
|
void show();
|
||||||
|
void hide();
|
||||||
|
void close();
|
||||||
|
void setWindowModality(Qt::WindowModality modality);
|
||||||
|
void setLayout(QLayout* layout);
|
||||||
|
|
||||||
|
QWidget* getRootWidget();
|
||||||
|
|
||||||
|
QMdiSubWindow* mdi_window = nullptr;
|
||||||
|
QDialog* normal_dialog = nullptr;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DesktopInterface& interface;
|
||||||
|
};
|
29
launcher/desktop/include/virtualwindow.h
Normal file
29
launcher/desktop/include/virtualwindow.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QMdiSubWindow>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
class DesktopInterface;
|
||||||
|
|
||||||
|
class VirtualWindow : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
VirtualWindow(DesktopInterface& interface, QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
void setWindowTitle(QString title);
|
||||||
|
void setCentralWidget(QWidget* widget);
|
||||||
|
void show();
|
||||||
|
void showMaximized();
|
||||||
|
void hide();
|
||||||
|
|
||||||
|
QMenuBar* menuBar();
|
||||||
|
|
||||||
|
QWidget* getRootWidget();
|
||||||
|
|
||||||
|
QMdiSubWindow* mdi_window = nullptr;
|
||||||
|
QMainWindow* normal_window = nullptr;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DesktopInterface& interface;
|
||||||
|
};
|
|
@ -8,11 +8,11 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "license.h"
|
#include "license.h"
|
||||||
|
|
||||||
AboutWindow::AboutWindow(QWidget* widget) : QDialog(widget) {
|
AboutWindow::AboutWindow(DesktopInterface& interface, QWidget* widget) : VirtualDialog(interface, widget) {
|
||||||
setWindowTitle("About");
|
setWindowTitle("About");
|
||||||
setWindowModality(Qt::WindowModality::ApplicationModal);
|
setWindowModality(Qt::WindowModality::ApplicationModal);
|
||||||
|
|
||||||
auto mainLayout = new QVBoxLayout(this);
|
auto mainLayout = new QVBoxLayout();
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
auto mainLabel = new QLabel();
|
auto mainLabel = new QLabel();
|
||||||
|
@ -34,8 +34,8 @@ AboutWindow::AboutWindow(QWidget* widget) : QDialog(widget) {
|
||||||
|
|
||||||
auto licenseLabel = new QLabel();
|
auto licenseLabel = new QLabel();
|
||||||
licenseLabel->setText("<a href='a'>License: GNU General Public License Version 3</a>");
|
licenseLabel->setText("<a href='a'>License: GNU General Public License Version 3</a>");
|
||||||
connect(licenseLabel, &QLabel::linkActivated, [this] {
|
connect(licenseLabel, &QLabel::linkActivated, [&interface] {
|
||||||
auto licenseDialog = new QDialog(this);
|
auto licenseDialog = new VirtualDialog(interface);
|
||||||
licenseDialog->setWindowTitle("License Agreement");
|
licenseDialog->setWindowTitle("License Agreement");
|
||||||
|
|
||||||
auto layout = new QVBoxLayout();
|
auto layout = new QVBoxLayout();
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
#include "launcherwindow.h"
|
#include "launcherwindow.h"
|
||||||
#include "sapphirelauncher.h"
|
#include "sapphirelauncher.h"
|
||||||
|
|
||||||
AutoLoginWindow::AutoLoginWindow(ProfileSettings& profile, LauncherCore& core, QWidget* parent)
|
AutoLoginWindow::AutoLoginWindow(DesktopInterface& interface, ProfileSettings& profile, LauncherCore& core, QWidget* parent)
|
||||||
: QDialog(parent) {
|
: VirtualDialog(interface, parent) {
|
||||||
setWindowTitle("Auto Login");
|
setWindowTitle("Auto Login");
|
||||||
setWindowModality(Qt::WindowModality::ApplicationModal);
|
setWindowModality(Qt::WindowModality::ApplicationModal);
|
||||||
|
|
||||||
auto mainLayout = new QFormLayout(this);
|
auto mainLayout = new QFormLayout();
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
auto label = new QLabel("Currently logging in...");
|
auto label = new QLabel("Currently logging in...");
|
||||||
|
|
|
@ -3,12 +3,20 @@
|
||||||
#include "gameinstaller.h"
|
#include "gameinstaller.h"
|
||||||
|
|
||||||
DesktopInterface::DesktopInterface(LauncherCore& core) {
|
DesktopInterface::DesktopInterface(LauncherCore& core) {
|
||||||
window = new LauncherWindow(core);
|
if(oneWindow) {
|
||||||
|
mdiArea = new QMdiArea();
|
||||||
|
mdiWindow = new QMainWindow();
|
||||||
|
mdiWindow->setWindowTitle("Combined Interface");
|
||||||
|
mdiWindow->setCentralWidget(mdiArea);
|
||||||
|
mdiWindow->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
window = new LauncherWindow(*this, core);
|
||||||
|
|
||||||
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();
|
||||||
messageBox->setIcon(QMessageBox::Icon::Question);
|
messageBox->setIcon(QMessageBox::Icon::Question);
|
||||||
messageBox->setText("No Game Found");
|
messageBox->setText("No Game Found");
|
||||||
messageBox->setInformativeText("FFXIV is not installed. Would you like to install it now?");
|
messageBox->setInformativeText("FFXIV is not installed. Would you like to install it now?");
|
||||||
|
@ -38,21 +46,22 @@ DesktopInterface::DesktopInterface(LauncherCore& core) {
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
if (!core.isSteam && !defaultProfile.isWineInstalled()) {
|
if (!core.isSteam && !defaultProfile.isWineInstalled()) {
|
||||||
auto messageBox = new QMessageBox(window);
|
auto messageBox = new QMessageBox();
|
||||||
messageBox->setIcon(QMessageBox::Icon::Critical);
|
messageBox->setIcon(QMessageBox::Icon::Critical);
|
||||||
|
messageBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
messageBox->setText("No Wine Found");
|
messageBox->setText("No Wine Found");
|
||||||
messageBox->setInformativeText("Wine is not installed but is required to FFXIV on this operating system.");
|
messageBox->setInformativeText("Wine is not installed but is required to FFXIV on this operating system.");
|
||||||
messageBox->setWindowModality(Qt::WindowModal);
|
//messageBox->setWindowModality(Qt::WindowModal);
|
||||||
|
|
||||||
messageBox->addButton(QMessageBox::StandardButton::Ok);
|
messageBox->addButton(QMessageBox::StandardButton::Ok);
|
||||||
messageBox->setDefaultButton(QMessageBox::StandardButton::Ok);
|
messageBox->setDefaultButton(QMessageBox::StandardButton::Ok);
|
||||||
|
|
||||||
messageBox->exec();
|
messageBox->show();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(defaultProfile.autoLogin) {
|
if(defaultProfile.autoLogin) {
|
||||||
autoLoginWindow = new AutoLoginWindow(defaultProfile, core);
|
autoLoginWindow = new AutoLoginWindow(*this, defaultProfile, core);
|
||||||
autoLoginWindow->show();
|
autoLoginWindow->show();
|
||||||
|
|
||||||
QObject::connect(autoLoginWindow, &AutoLoginWindow::loginCanceled,[=] {
|
QObject::connect(autoLoginWindow, &AutoLoginWindow::loginCanceled,[=] {
|
||||||
|
@ -60,6 +69,22 @@ DesktopInterface::DesktopInterface(LauncherCore& core) {
|
||||||
window->show();
|
window->show();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
window->show();
|
if(oneWindow) {
|
||||||
|
window->showMaximized();
|
||||||
|
} else {
|
||||||
|
window->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DesktopInterface::addWindow(VirtualWindow* window) {
|
||||||
|
if(oneWindow) {
|
||||||
|
mdiArea->addSubWindow(window->mdi_window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DesktopInterface::addDialog(VirtualDialog* dialog) {
|
||||||
|
if(oneWindow) {
|
||||||
|
mdiArea->addSubWindow(dialog->mdi_window);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,12 +9,12 @@
|
||||||
|
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
|
|
||||||
GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, LauncherCore& core, QWidget* parent)
|
GamescopeSettingsWindow::GamescopeSettingsWindow(DesktopInterface& interface, ProfileSettings& settings, LauncherCore& core, QWidget* parent)
|
||||||
: QDialog(parent) {
|
: VirtualDialog(interface, parent) {
|
||||||
setWindowTitle("Gamescope Settings");
|
setWindowTitle("Gamescope Settings");
|
||||||
setWindowModality(Qt::WindowModality::ApplicationModal);
|
setWindowModality(Qt::WindowModality::ApplicationModal);
|
||||||
|
|
||||||
auto mainLayout = new QFormLayout(this);
|
auto mainLayout = new QFormLayout();
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
auto fullscreenBox = new QCheckBox("Fullscreen");
|
auto fullscreenBox = new QCheckBox("Fullscreen");
|
||||||
|
|
|
@ -21,8 +21,9 @@
|
||||||
#include "sapphirelauncher.h"
|
#include "sapphirelauncher.h"
|
||||||
#include "settingswindow.h"
|
#include "settingswindow.h"
|
||||||
#include "squarelauncher.h"
|
#include "squarelauncher.h"
|
||||||
|
#include "desktopinterface.h"
|
||||||
|
|
||||||
LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindow(parent), core(core) {
|
LauncherWindow::LauncherWindow(DesktopInterface& interface, LauncherCore& core, QWidget* parent) : VirtualWindow(interface, parent), core(core), interface(interface) {
|
||||||
setWindowTitle("Astra");
|
setWindowTitle("Astra");
|
||||||
|
|
||||||
connect(&core, &LauncherCore::settingsChanged, this, &LauncherWindow::reloadControls);
|
connect(&core, &LauncherCore::settingsChanged, this, &LauncherWindow::reloadControls);
|
||||||
|
@ -125,7 +126,7 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
auto installGameAction = gameMenu->addAction("Install game...");
|
auto installGameAction = gameMenu->addAction("Install game...");
|
||||||
connect(installGameAction, &QAction::triggered, [this] {
|
connect(installGameAction, &QAction::triggered, [this] {
|
||||||
// TODO: lol duplication
|
// TODO: lol duplication
|
||||||
auto messageBox = new QMessageBox(this);
|
auto messageBox = new QMessageBox();
|
||||||
messageBox->setIcon(QMessageBox::Icon::Question);
|
messageBox->setIcon(QMessageBox::Icon::Question);
|
||||||
messageBox->setText("Warning");
|
messageBox->setText("Warning");
|
||||||
messageBox->setInformativeText("FFXIV will be installed to your selected game directory.");
|
messageBox->setInformativeText("FFXIV will be installed to your selected game directory.");
|
||||||
|
@ -157,8 +158,8 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
QAction* settingsAction = fileMenu->addAction("Configure Astra...");
|
QAction* settingsAction = fileMenu->addAction("Configure Astra...");
|
||||||
settingsAction->setIcon(QIcon::fromTheme("configure"));
|
settingsAction->setIcon(QIcon::fromTheme("configure"));
|
||||||
settingsAction->setMenuRole(QAction::MenuRole::PreferencesRole);
|
settingsAction->setMenuRole(QAction::MenuRole::PreferencesRole);
|
||||||
connect(settingsAction, &QAction::triggered, [=] {
|
connect(settingsAction, &QAction::triggered, [=, &interface] {
|
||||||
auto window = new SettingsWindow(0, *this, this->core, this);
|
auto window = new SettingsWindow(interface, 0, *this, this->core);
|
||||||
connect(&this->core, &LauncherCore::settingsChanged, window, &SettingsWindow::reloadControls);
|
connect(&this->core, &LauncherCore::settingsChanged, window, &SettingsWindow::reloadControls);
|
||||||
window->show();
|
window->show();
|
||||||
});
|
});
|
||||||
|
@ -166,8 +167,8 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
QAction* profilesAction = fileMenu->addAction("Configure Profiles...");
|
QAction* profilesAction = fileMenu->addAction("Configure Profiles...");
|
||||||
profilesAction->setIcon(QIcon::fromTheme("configure"));
|
profilesAction->setIcon(QIcon::fromTheme("configure"));
|
||||||
profilesAction->setMenuRole(QAction::MenuRole::NoRole);
|
profilesAction->setMenuRole(QAction::MenuRole::NoRole);
|
||||||
connect(profilesAction, &QAction::triggered, [=] {
|
connect(profilesAction, &QAction::triggered, [=, &interface] {
|
||||||
auto window = new SettingsWindow(1, *this, this->core, this);
|
auto window = new SettingsWindow(interface, 1, *this, this->core);
|
||||||
connect(&this->core, &LauncherCore::settingsChanged, window, &SettingsWindow::reloadControls);
|
connect(&this->core, &LauncherCore::settingsChanged, window, &SettingsWindow::reloadControls);
|
||||||
window->show();
|
window->show();
|
||||||
});
|
});
|
||||||
|
@ -191,15 +192,15 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
QMenu* helpMenu = menuBar()->addMenu("Help");
|
QMenu* helpMenu = menuBar()->addMenu("Help");
|
||||||
QAction* showAbout = helpMenu->addAction("About Astra");
|
QAction* showAbout = helpMenu->addAction("About Astra");
|
||||||
showAbout->setIcon(QIcon::fromTheme("help-about"));
|
showAbout->setIcon(QIcon::fromTheme("help-about"));
|
||||||
connect(showAbout, &QAction::triggered, [=] {
|
connect(showAbout, &QAction::triggered, [=, &interface] {
|
||||||
auto window = new AboutWindow(this);
|
auto window = new AboutWindow(interface);
|
||||||
window->show();
|
window->show();
|
||||||
});
|
});
|
||||||
|
|
||||||
QAction* showAboutQt = helpMenu->addAction("About Qt");
|
QAction* showAboutQt = helpMenu->addAction("About Qt");
|
||||||
showAboutQt->setIcon(QIcon::fromTheme("help-about"));
|
showAboutQt->setIcon(QIcon::fromTheme("help-about"));
|
||||||
connect(showAboutQt, &QAction::triggered, [=] {
|
connect(showAboutQt, &QAction::triggered, [=] {
|
||||||
QMessageBox::aboutQt(this);
|
QMessageBox::aboutQt(nullptr);
|
||||||
});
|
});
|
||||||
|
|
||||||
layout = new QGridLayout();
|
layout = new QGridLayout();
|
||||||
|
@ -393,7 +394,13 @@ void LauncherWindow::reloadControls() {
|
||||||
launchOfficial->setEnabled(currentProfile().isGameInstalled());
|
launchOfficial->setEnabled(currentProfile().isGameInstalled());
|
||||||
launchSysInfo->setEnabled(currentProfile().isGameInstalled());
|
launchSysInfo->setEnabled(currentProfile().isGameInstalled());
|
||||||
launchCfgBackup->setEnabled(currentProfile().isGameInstalled());
|
launchCfgBackup->setEnabled(currentProfile().isGameInstalled());
|
||||||
openGameDir->setEnabled(currentProfile().isGameInstalled());
|
|
||||||
|
// Steam Deck's Game session has no file manager, so no point in having it here...
|
||||||
|
if(interface.isSteamDeck) {
|
||||||
|
openGameDir->setDisabled(true);
|
||||||
|
} else {
|
||||||
|
openGameDir->setEnabled(currentProfile().isGameInstalled());
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
||||||
wineCfg->setEnabled(currentProfile().isWineInstalled());
|
wineCfg->setEnabled(currentProfile().isWineInstalled());
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
#include "launcherwindow.h"
|
#include "launcherwindow.h"
|
||||||
|
|
||||||
SettingsWindow::SettingsWindow(int defaultTab, LauncherWindow& window, LauncherCore& core, QWidget* parent)
|
SettingsWindow::SettingsWindow(DesktopInterface& interface, int defaultTab, LauncherWindow& window, LauncherCore& core, QWidget* parent)
|
||||||
: core(core), window(window), QDialog(parent) {
|
: core(core), window(window), interface(interface), VirtualDialog(interface, parent) {
|
||||||
setWindowTitle("Settings");
|
setWindowTitle("Settings");
|
||||||
setWindowModality(Qt::WindowModality::ApplicationModal);
|
setWindowModality(Qt::WindowModality::ApplicationModal);
|
||||||
|
|
||||||
auto mainLayout = new QVBoxLayout(this);
|
auto mainLayout = new QVBoxLayout();
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
auto tabWidget = new QTabWidget();
|
auto tabWidget = new QTabWidget();
|
||||||
|
@ -332,7 +332,7 @@ void SettingsWindow::setupGameTab(QFormLayout& layout) {
|
||||||
|
|
||||||
auto selectDirectoryButton = new QPushButton("Select Game Directory");
|
auto selectDirectoryButton = new QPushButton("Select Game Directory");
|
||||||
connect(selectDirectoryButton, &QPushButton::pressed, [this] {
|
connect(selectDirectoryButton, &QPushButton::pressed, [this] {
|
||||||
getCurrentProfile().gamePath = QFileDialog::getExistingDirectory(this, "Open Game Directory");
|
getCurrentProfile().gamePath = QFileDialog::getExistingDirectory(nullptr, "Open Game Directory");
|
||||||
|
|
||||||
this->reloadControls();
|
this->reloadControls();
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
|
@ -445,7 +445,7 @@ void SettingsWindow::setupLoginTab(QFormLayout& layout) {
|
||||||
|
|
||||||
otpSecretButton = new QPushButton("Enter OTP Secret");
|
otpSecretButton = new QPushButton("Enter OTP Secret");
|
||||||
connect(otpSecretButton, &QPushButton::pressed, [=] {
|
connect(otpSecretButton, &QPushButton::pressed, [=] {
|
||||||
auto otpSecret = QInputDialog::getText(this, "OTP Input", "Enter your OTP Secret:");
|
auto otpSecret = QInputDialog::getText(nullptr, "OTP Input", "Enter your OTP Secret:");
|
||||||
|
|
||||||
getCurrentProfile().setKeychainValue("otpsecret", otpSecret);
|
getCurrentProfile().setKeychainValue("otpsecret", otpSecret);
|
||||||
});
|
});
|
||||||
|
@ -511,7 +511,7 @@ void SettingsWindow::setupWineTab(QFormLayout& layout) {
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(selectWineButton, &QPushButton::pressed, [this] {
|
connect(selectWineButton, &QPushButton::pressed, [this] {
|
||||||
getCurrentProfile().winePath = QFileDialog::getOpenFileName(this, "Open Wine Executable");
|
getCurrentProfile().winePath = QFileDialog::getOpenFileName(nullptr, "Open Wine Executable");
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
this->reloadControls();
|
this->reloadControls();
|
||||||
|
@ -535,7 +535,7 @@ void SettingsWindow::setupWineTab(QFormLayout& layout) {
|
||||||
|
|
||||||
auto selectPrefixButton = new QPushButton("Select Wine Prefix");
|
auto selectPrefixButton = new QPushButton("Select Wine Prefix");
|
||||||
connect(selectPrefixButton, &QPushButton::pressed, [this] {
|
connect(selectPrefixButton, &QPushButton::pressed, [this] {
|
||||||
getCurrentProfile().winePrefixPath = QFileDialog::getExistingDirectory(this, "Open Wine Prefix");
|
getCurrentProfile().winePrefixPath = QFileDialog::getExistingDirectory(nullptr, "Open Wine Prefix");
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
this->reloadControls();
|
this->reloadControls();
|
||||||
|
@ -588,7 +588,7 @@ void SettingsWindow::setupWineTab(QFormLayout& layout) {
|
||||||
|
|
||||||
configureGamescopeButton = new QPushButton("Configure...");
|
configureGamescopeButton = new QPushButton("Configure...");
|
||||||
connect(configureGamescopeButton, &QPushButton::pressed, [&] {
|
connect(configureGamescopeButton, &QPushButton::pressed, [&] {
|
||||||
auto gamescopeSettingsWindow = new GamescopeSettingsWindow(getCurrentProfile(), this->core, this);
|
auto gamescopeSettingsWindow = new GamescopeSettingsWindow(interface, getCurrentProfile(), this->core, this->getRootWidget());
|
||||||
gamescopeSettingsWindow->show();
|
gamescopeSettingsWindow->show();
|
||||||
});
|
});
|
||||||
gamescopeButtonLayout->addWidget(configureGamescopeButton);
|
gamescopeButtonLayout->addWidget(configureGamescopeButton);
|
||||||
|
|
75
launcher/desktop/src/virtualdialog.cpp
Normal file
75
launcher/desktop/src/virtualdialog.cpp
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
#include "virtualdialog.h"
|
||||||
|
|
||||||
|
#include <QLayout>
|
||||||
|
|
||||||
|
#include "desktopinterface.h"
|
||||||
|
|
||||||
|
VirtualDialog::VirtualDialog(DesktopInterface& interface, QWidget* widget) : interface(interface) {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
mdi_window = new QMdiSubWindow();
|
||||||
|
mdi_window->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
} else {
|
||||||
|
normal_dialog = new QDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
interface.addDialog(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualDialog::setWindowTitle(QString title) {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
mdi_window->setWindowTitle(title);
|
||||||
|
} else {
|
||||||
|
normal_dialog->setWindowTitle(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualDialog::show() {
|
||||||
|
if (interface.oneWindow) {
|
||||||
|
mdi_window->show();
|
||||||
|
} else {
|
||||||
|
normal_dialog->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualDialog::hide() {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
mdi_window->hide();
|
||||||
|
} else {
|
||||||
|
normal_dialog->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualDialog::close() {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
mdi_window->close();
|
||||||
|
} else {
|
||||||
|
normal_dialog->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualDialog::setWindowModality(Qt::WindowModality modality) {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
mdi_window->setWindowModality(modality);
|
||||||
|
} else {
|
||||||
|
normal_dialog->setWindowModality(modality);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualDialog::setLayout(QLayout* layout) {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
QWidget* emptyWidget = new QWidget();
|
||||||
|
emptyWidget->setLayout(layout);
|
||||||
|
|
||||||
|
mdi_window->layout()->addWidget(emptyWidget);
|
||||||
|
} else {
|
||||||
|
normal_dialog->setLayout(layout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget* VirtualDialog::getRootWidget() {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
return mdi_window;
|
||||||
|
} else {
|
||||||
|
return normal_dialog;
|
||||||
|
}
|
||||||
|
}
|
82
launcher/desktop/src/virtualwindow.cpp
Normal file
82
launcher/desktop/src/virtualwindow.cpp
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
#include "virtualwindow.h"
|
||||||
|
|
||||||
|
#include <QLayout>
|
||||||
|
#include <QMenuBar>
|
||||||
|
|
||||||
|
#include "desktopinterface.h"
|
||||||
|
|
||||||
|
VirtualWindow::VirtualWindow(DesktopInterface& interface, QWidget* widget) : interface(interface) {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
mdi_window = new QMdiSubWindow();
|
||||||
|
mdi_window->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
} else {
|
||||||
|
normal_window = new QMainWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
interface.addWindow(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualWindow::setWindowTitle(QString title) {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
mdi_window->setWindowTitle(title);
|
||||||
|
} else {
|
||||||
|
normal_window->setWindowTitle(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualWindow::show() {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
mdi_window->show();
|
||||||
|
} else {
|
||||||
|
normal_window->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualWindow::setCentralWidget(QWidget* widget) {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
mdi_window->layout()->addWidget(widget);
|
||||||
|
} else {
|
||||||
|
normal_window->setCentralWidget(widget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualWindow::hide() {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
mdi_window->hide();
|
||||||
|
} else {
|
||||||
|
normal_window->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenuBar* VirtualWindow::menuBar() {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
if(mdi_window->layout()->menuBar() == nullptr) {
|
||||||
|
auto bar = new QMenuBar();
|
||||||
|
bar->setObjectName("test");
|
||||||
|
qDebug() << "new obj name: " << bar->objectName();
|
||||||
|
mdi_window->layout()->setMenuBar(bar);
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << mdi_window->layout()->menuBar()->objectName();
|
||||||
|
|
||||||
|
return dynamic_cast<QMenuBar*>(mdi_window->layout()->menuBar());
|
||||||
|
} else {
|
||||||
|
return normal_window->menuBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualWindow::showMaximized() {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
mdi_window->showMaximized();
|
||||||
|
} else {
|
||||||
|
normal_window->showMaximized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget* VirtualWindow::getRootWidget() {
|
||||||
|
if(interface.oneWindow) {
|
||||||
|
return mdi_window;
|
||||||
|
} else {
|
||||||
|
return normal_window;
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,8 +3,6 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
|
|
||||||
#include "../launcher/tablet/include/tabletinterface.h"
|
|
||||||
#include "cmdinterface.h"
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "desktopinterface.h"
|
#include "desktopinterface.h"
|
||||||
#include "gameinstaller.h"
|
#include "gameinstaller.h"
|
||||||
|
@ -14,6 +12,7 @@
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
|
QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar);
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
@ -31,28 +30,11 @@ int main(int argc, char* argv[]) {
|
||||||
auto helpOption = parser.addHelpOption();
|
auto helpOption = parser.addHelpOption();
|
||||||
auto versionOption = parser.addVersionOption();
|
auto versionOption = parser.addVersionOption();
|
||||||
|
|
||||||
QCommandLineOption desktopOption("desktop", "Open a desktop interface.");
|
|
||||||
#ifdef ENABLE_DESKTOP
|
|
||||||
parser.addOption(desktopOption);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QCommandLineOption tabletOption("tablet", "Open a tablet interface.");
|
|
||||||
#ifdef ENABLE_TABLET
|
|
||||||
parser.addOption(tabletOption);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QCommandLineOption cliOption("cli", "Don't open a main window, and use the cli interface.");
|
|
||||||
#ifdef ENABLE_CLI
|
|
||||||
parser.addOption(cliOption);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QCommandLineOption steamOption("steam", "Simulate booting the launcher via Steam.");
|
QCommandLineOption steamOption("steam", "Simulate booting the launcher via Steam.");
|
||||||
#ifdef ENABLE_STEAM
|
#ifdef ENABLE_STEAM
|
||||||
parser.addOption(steamOption);
|
parser.addOption(steamOption);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto cmd = std::make_unique<CMDInterface>(parser);
|
|
||||||
|
|
||||||
parser.process(app);
|
parser.process(app);
|
||||||
|
|
||||||
if (parser.isSet(versionOption)) {
|
if (parser.isSet(versionOption)) {
|
||||||
|
@ -68,23 +50,7 @@ int main(int argc, char* argv[]) {
|
||||||
#else
|
#else
|
||||||
LauncherCore c(false);
|
LauncherCore c(false);
|
||||||
#endif
|
#endif
|
||||||
std::unique_ptr<DesktopInterface> desktopInterface;
|
std::unique_ptr<DesktopInterface> desktopInterface = std::make_unique<DesktopInterface>(c);
|
||||||
std::unique_ptr<TabletInterface> tabletInterface;
|
|
||||||
|
|
||||||
if (parser.isSet(tabletOption)) {
|
|
||||||
#ifdef ENABLE_TABLET
|
|
||||||
tabletInterface = std::make_unique<TabletInterface>(c);
|
|
||||||
#endif
|
|
||||||
} else if (parser.isSet(cliOption)) {
|
|
||||||
#ifdef ENABLE_CLI
|
|
||||||
if (!cmd->parse(parser, c))
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
#ifdef ENABLE_DESKTOP
|
|
||||||
desktopInterface = std::make_unique<DesktopInterface>(c);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return QApplication::exec();
|
return QApplication::exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
set(HEADERS
|
|
||||||
include/tabletinterface.h)
|
|
||||||
|
|
||||||
set(SRC
|
|
||||||
src/tabletinterface.cpp)
|
|
||||||
|
|
||||||
add_library(astra_tablet STATIC ${HEADERS} ${SRC})
|
|
||||||
target_include_directories(astra_tablet PUBLIC include)
|
|
||||||
target_link_libraries(astra_tablet PUBLIC
|
|
||||||
astra_core
|
|
||||||
Qt5::Core
|
|
||||||
Qt5::Network
|
|
||||||
Qt5::Quick)
|
|
|
@ -1,17 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QQmlApplicationEngine>
|
|
||||||
|
|
||||||
#include "launchercore.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The tablet-oriented (name to change), touch and gamepad-driven interface for Astra. The interface is
|
|
||||||
* simpler due to size constraints.
|
|
||||||
*/
|
|
||||||
class TabletInterface {
|
|
||||||
public:
|
|
||||||
explicit TabletInterface(LauncherCore& core);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QQmlApplicationEngine* applicationEngine = nullptr;
|
|
||||||
};
|
|
|
@ -1,73 +0,0 @@
|
||||||
import QtQuick 2.7
|
|
||||||
import QtQuick.Controls 2.15
|
|
||||||
import QtQuick.Window 2.0
|
|
||||||
import Astra 1.0
|
|
||||||
|
|
||||||
ApplicationWindow {
|
|
||||||
id: window
|
|
||||||
|
|
||||||
width: 640
|
|
||||||
height: 480
|
|
||||||
|
|
||||||
visible: true
|
|
||||||
|
|
||||||
Label {
|
|
||||||
id: usernameLabel
|
|
||||||
|
|
||||||
text: "Username"
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: usernameField
|
|
||||||
|
|
||||||
anchors.top: usernameLabel.bottom
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
id: passwordLabel
|
|
||||||
|
|
||||||
text: "Password"
|
|
||||||
|
|
||||||
anchors.top: usernameField.bottom
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: passwordField
|
|
||||||
|
|
||||||
echoMode: TextInput.Password
|
|
||||||
|
|
||||||
anchors.top: passwordLabel.bottom
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
id: otpLabel
|
|
||||||
|
|
||||||
text: "One-Time Password"
|
|
||||||
|
|
||||||
anchors.top: passwordField.bottom
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: otpField
|
|
||||||
|
|
||||||
anchors.top: otpLabel.bottom
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: loginButton
|
|
||||||
|
|
||||||
text: "Login"
|
|
||||||
|
|
||||||
anchors.top: otpField.bottom
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
var info = core.createNewLoginInfo();
|
|
||||||
info.settings = core.getProfileQML(0);
|
|
||||||
info.username = usernameField.text
|
|
||||||
info.password = passwordField.text
|
|
||||||
info.oneTimePassword = otpField.text
|
|
||||||
|
|
||||||
core.login(info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
<RCC>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>main.qml</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
|
@ -1,14 +0,0 @@
|
||||||
#include "tabletinterface.h"
|
|
||||||
|
|
||||||
#include <QQmlContext>
|
|
||||||
#include <QQuickView>
|
|
||||||
|
|
||||||
TabletInterface::TabletInterface(LauncherCore& core) {
|
|
||||||
qmlRegisterType<ProfileSettings>("Astra", 1, 0, "ProfileSettings");
|
|
||||||
qmlRegisterType<LoginInformation>("Astra", 1, 0, "LoginInformation");
|
|
||||||
|
|
||||||
applicationEngine = new QQmlApplicationEngine();
|
|
||||||
|
|
||||||
applicationEngine->rootContext()->setContextProperty("core", &core);
|
|
||||||
applicationEngine->load("qrc:/main.qml");
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue