mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-21 20:27:45 +00:00
More boring code cleanup
This commit is contained in:
parent
cd2723ebfb
commit
474de3fedc
26 changed files with 48 additions and 73 deletions
|
@ -8,7 +8,7 @@
|
||||||
*/
|
*/
|
||||||
class CMDInterface {
|
class CMDInterface {
|
||||||
public:
|
public:
|
||||||
CMDInterface(QCommandLineParser& parser);
|
explicit CMDInterface(QCommandLineParser& parser);
|
||||||
|
|
||||||
bool parse(QCommandLineParser& parser, LauncherCore& core);
|
bool parse(QCommandLineParser& parser, LauncherCore& core);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "cmdinterface.h"
|
#include "cmdinterface.h"
|
||||||
#include "sapphirelauncher.h"
|
#include "sapphirelauncher.h"
|
||||||
#include "squareboot.h"
|
|
||||||
#include <keychain.h>
|
#include <keychain.h>
|
||||||
|
|
||||||
CMDInterface::CMDInterface(QCommandLineParser& parser) {
|
CMDInterface::CMDInterface(QCommandLineParser& parser) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct ProfileSettings;
|
||||||
class AssetUpdater : public QObject {
|
class AssetUpdater : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AssetUpdater(LauncherCore& launcher);
|
explicit AssetUpdater(LauncherCore& launcher);
|
||||||
|
|
||||||
void update(const ProfileSettings& profile);
|
void update(const ProfileSettings& profile);
|
||||||
void beginInstall();
|
void beginInstall();
|
||||||
|
|
|
@ -13,7 +13,7 @@ inline char GetChecksum(unsigned int key) {
|
||||||
|
|
||||||
uint32_t TickCount();
|
uint32_t TickCount();
|
||||||
|
|
||||||
inline QString encryptGameArg(QString arg) {
|
inline QString encryptGameArg(const QString& arg) {
|
||||||
unsigned int rawTicks = TickCount();
|
unsigned int rawTicks = TickCount();
|
||||||
unsigned int ticks = rawTicks & 0xFFFFFFFFu;
|
unsigned int ticks = rawTicks & 0xFFFFFFFFu;
|
||||||
unsigned int key = ticks & 0xFFFF0000u;
|
unsigned int key = ticks & 0xFFFF0000u;
|
||||||
|
|
|
@ -7,4 +7,4 @@ class LauncherCore;
|
||||||
class ProfileSettings;
|
class ProfileSettings;
|
||||||
|
|
||||||
// TODO: convert to a nice signal/slots class like assetupdater
|
// TODO: convert to a nice signal/slots class like assetupdater
|
||||||
void installGame(LauncherCore& launcher, ProfileSettings& profile, std::function<void()> returnFunc);
|
void installGame(LauncherCore& launcher, ProfileSettings& profile, const std::function<void()>& returnFunc);
|
|
@ -28,4 +28,4 @@ struct Headline {
|
||||||
|
|
||||||
class LauncherCore;
|
class LauncherCore;
|
||||||
|
|
||||||
void getHeadline(LauncherCore& core, std::function<void(Headline)> return_func);
|
void getHeadline(LauncherCore& core, const std::function<void(Headline)>& return_func);
|
|
@ -148,10 +148,10 @@ public:
|
||||||
return profileSettings[index];
|
return profileSettings[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
int getProfileIndex(QString name);
|
int getProfileIndex(const QString& name);
|
||||||
Q_INVOKABLE QList<QString> profileList() const;
|
Q_INVOKABLE QList<QString> profileList() const;
|
||||||
int addProfile();
|
int addProfile();
|
||||||
int deleteProfile(QString name);
|
int deleteProfile(const QString& name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Begins the login process, and may call SquareBoot or SapphireLauncher depending on the profile type.
|
* Begins the login process, and may call SquareBoot or SapphireLauncher depending on the profile type.
|
||||||
|
@ -181,7 +181,7 @@ public:
|
||||||
void launchExecutable(
|
void launchExecutable(
|
||||||
const ProfileSettings& settings,
|
const ProfileSettings& settings,
|
||||||
QProcess* process,
|
QProcess* process,
|
||||||
QStringList args,
|
const QStringList& args,
|
||||||
bool isGame,
|
bool isGame,
|
||||||
bool needsRegistrySetup);
|
bool needsRegistrySetup);
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ private:
|
||||||
*/
|
*/
|
||||||
QString getGameArgs(const ProfileSettings& profile, const LoginAuth& auth);
|
QString getGameArgs(const ProfileSettings& profile, const LoginAuth& auth);
|
||||||
|
|
||||||
bool checkIfInPath(QString program);
|
bool checkIfInPath(const QString& program);
|
||||||
void readGameData(ProfileSettings& profile);
|
void readGameData(ProfileSettings& profile);
|
||||||
|
|
||||||
QString getDefaultGamePath();
|
QString getDefaultGamePath();
|
||||||
|
|
|
@ -29,7 +29,7 @@ private:
|
||||||
QString name, repository, version, path;
|
QString name, repository, version, path;
|
||||||
};
|
};
|
||||||
|
|
||||||
void processPatch(QueuedPatch patch);
|
void processPatch(const QueuedPatch& patch);
|
||||||
|
|
||||||
QVector<QueuedPatch> patchQueue;
|
QVector<QueuedPatch> patchQueue;
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
class SapphireLauncher : QObject {
|
class SapphireLauncher : QObject {
|
||||||
public:
|
public:
|
||||||
SapphireLauncher(LauncherCore& window);
|
explicit SapphireLauncher(LauncherCore& window);
|
||||||
|
|
||||||
void login(QString lobbyUrl, const LoginInformation& info);
|
void login(const QString& lobbyUrl, const LoginInformation& info);
|
||||||
void registerAccount(QString lobbyUrl, const LoginInformation& info);
|
void registerAccount(const QString& lobbyUrl, const LoginInformation& info);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LauncherCore& window;
|
LauncherCore& window;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
class SquareLauncher : public QObject {
|
class SquareLauncher : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SquareLauncher(LauncherCore& window);
|
explicit SquareLauncher(LauncherCore& window);
|
||||||
|
|
||||||
void getStored(const LoginInformation& info);
|
void getStored(const LoginInformation& info);
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,7 @@ void AssetUpdater::checkIfCheckingIsDone() {
|
||||||
const QList<QString> dirPath = fileName.left(fileName.lastIndexOf("/")).split('/');
|
const QList<QString> dirPath = fileName.left(fileName.lastIndexOf("/")).split('/');
|
||||||
|
|
||||||
QString build = dataDir + "/DalamudAssets/";
|
QString build = dataDir + "/DalamudAssets/";
|
||||||
for (auto dir : dirPath) {
|
for (const auto& dir : dirPath) {
|
||||||
if (!QDir().exists(build + dir))
|
if (!QDir().exists(build + dir))
|
||||||
QDir().mkdir(build + dir);
|
QDir().mkdir(build + dir);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ uint32_t TickCount() {
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
uint32_t TickCount() {
|
uint32_t TickCount() {
|
||||||
struct timespec ts;
|
struct timespec ts{};
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
|
|
||||||
void installGame(LauncherCore& launcher, ProfileSettings& profile, std::function<void()> returnFunc) {
|
void installGame(LauncherCore& launcher, ProfileSettings& profile, const std::function<void()>& returnFunc) {
|
||||||
QString installDirectory = profile.gamePath;
|
QString installDirectory = profile.gamePath;
|
||||||
qDebug() << "Installing game to " << installDirectory << "!";
|
qDebug() << "Installing game to " << installDirectory << "!";
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ void installGame(LauncherCore& launcher, ProfileSettings& profile, std::function
|
||||||
QNetworkRequest request(QUrl("https://gdl.square-enix.com/ffxiv/inst/ffxivsetup.exe"));
|
QNetworkRequest request(QUrl("https://gdl.square-enix.com/ffxiv/inst/ffxivsetup.exe"));
|
||||||
|
|
||||||
auto reply = launcher.mgr->get(request);
|
auto reply = launcher.mgr->get(request);
|
||||||
launcher.connect(reply, &QNetworkReply::finished, [reply, installDirectory, returnFunc] {
|
QObject::connect(reply, &QNetworkReply::finished, [reply, installDirectory, returnFunc] {
|
||||||
QString dataDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
QString dataDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
||||||
|
|
||||||
QFile file(dataDir + "/ffxivsetup.exe");
|
QFile file(dataDir + "/ffxivsetup.exe");
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
|
|
||||||
void getHeadline(LauncherCore& core, std::function<void(Headline)> return_func) {
|
void getHeadline(LauncherCore& core, const std::function<void(Headline)>& return_func) {
|
||||||
QUrlQuery query;
|
QUrlQuery query;
|
||||||
query.addQueryItem("lang", "en-us");
|
query.addQueryItem("lang", "en-us");
|
||||||
query.addQueryItem("media", "pcapp");
|
query.addQueryItem("media", "pcapp");
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
@ -7,17 +6,12 @@
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QRegularExpression>
|
|
||||||
#include <QRegularExpressionMatch>
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QTcpServer>
|
|
||||||
#include <QUrlQuery>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <utility>
|
||||||
#include <keychain.h>
|
#include <keychain.h>
|
||||||
#include <cotp.h>
|
#include <cotp.h>
|
||||||
|
|
||||||
|
@ -179,7 +173,7 @@ QString LauncherCore::getGameArgs(const ProfileSettings& profile, const LoginAut
|
||||||
void LauncherCore::launchExecutable(
|
void LauncherCore::launchExecutable(
|
||||||
const ProfileSettings& profile,
|
const ProfileSettings& profile,
|
||||||
QProcess* process,
|
QProcess* process,
|
||||||
const QStringList args,
|
const QStringList& args,
|
||||||
bool isGame,
|
bool isGame,
|
||||||
bool needsRegistrySetup) {
|
bool needsRegistrySetup) {
|
||||||
QList<QString> arguments;
|
QList<QString> arguments;
|
||||||
|
@ -482,7 +476,7 @@ ProfileSettings& LauncherCore::getProfile(int index) {
|
||||||
return *profileSettings[index];
|
return *profileSettings[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
int LauncherCore::getProfileIndex(QString name) {
|
int LauncherCore::getProfileIndex(const 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;
|
||||||
|
@ -501,7 +495,7 @@ QList<QString> LauncherCore::profileList() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int LauncherCore::addProfile() {
|
int LauncherCore::addProfile() {
|
||||||
ProfileSettings* newProfile = new ProfileSettings();
|
auto newProfile = new ProfileSettings();
|
||||||
newProfile->uuid = QUuid::createUuid();
|
newProfile->uuid = QUuid::createUuid();
|
||||||
newProfile->name = "New Profile";
|
newProfile->name = "New Profile";
|
||||||
|
|
||||||
|
@ -517,7 +511,7 @@ int LauncherCore::addProfile() {
|
||||||
return profileSettings.size() - 1;
|
return profileSettings.size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LauncherCore::deleteProfile(QString name) {
|
int LauncherCore::deleteProfile(const 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)
|
||||||
|
@ -589,7 +583,7 @@ void LauncherCore::saveSettings() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LauncherCore::checkIfInPath(const QString program) {
|
bool LauncherCore::checkIfInPath(const QString& program) {
|
||||||
// TODO: also check /usr/local/bin, /bin32 etc (basically read $PATH)
|
// TODO: also check /usr/local/bin, /bin32 etc (basically read $PATH)
|
||||||
const QString directory = "/usr/bin";
|
const QString directory = "/usr/bin";
|
||||||
|
|
||||||
|
@ -629,7 +623,7 @@ QString LauncherCore::getDefaultGamePath() {
|
||||||
void LauncherCore::addRegistryKey(const ProfileSettings& settings, QString key, QString value, QString data) {
|
void LauncherCore::addRegistryKey(const ProfileSettings& settings, QString key, QString value, QString data) {
|
||||||
auto process = new QProcess(this);
|
auto process = new QProcess(this);
|
||||||
process->setProcessEnvironment(QProcessEnvironment::systemEnvironment());
|
process->setProcessEnvironment(QProcessEnvironment::systemEnvironment());
|
||||||
launchExecutable(settings, process, {"reg", "add", key, "/v", value, "/d", data, "/f"}, false, false);
|
launchExecutable(settings, process, {"reg", "add", std::move(key), "/v", value, "/d", data, "/f"}, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::readGameData(ProfileSettings& profile) {
|
void LauncherCore::readGameData(ProfileSettings& profile) {
|
||||||
|
|
|
@ -105,7 +105,7 @@ void Patcher::processPatchList(QNetworkAccessManager& mgr, QString patchList) {
|
||||||
|
|
||||||
void Patcher::checkIfDone() {
|
void Patcher::checkIfDone() {
|
||||||
if (remainingPatches <= 0) {
|
if (remainingPatches <= 0) {
|
||||||
for (auto patch : patchQueue) {
|
for (const auto& patch : patchQueue) {
|
||||||
processPatch(patch);
|
processPatch(patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ void Patcher::checkIfDone() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patcher::processPatch(QueuedPatch patch) {
|
void Patcher::processPatch(const QueuedPatch& patch) {
|
||||||
if (isBoot()) {
|
if (isBoot()) {
|
||||||
physis_bootdata_apply_patch(boot_data, patch.path.toStdString().c_str());
|
physis_bootdata_apply_patch(boot_data, patch.path.toStdString().c_str());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
SapphireLauncher::SapphireLauncher(LauncherCore& window) : window(window), QObject(&window) {}
|
SapphireLauncher::SapphireLauncher(LauncherCore& window) : window(window), QObject(&window) {}
|
||||||
|
|
||||||
void SapphireLauncher::login(QString lobbyUrl, const LoginInformation& info) {
|
void SapphireLauncher::login(const QString& lobbyUrl, const LoginInformation& info) {
|
||||||
QJsonObject data{{"username", info.username}, {"pass", info.password}};
|
QJsonObject data{{"username", info.username}, {"pass", info.password}};
|
||||||
|
|
||||||
QUrl url;
|
QUrl url;
|
||||||
|
@ -37,7 +37,7 @@ void SapphireLauncher::login(QString lobbyUrl, const LoginInformation& info) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SapphireLauncher::registerAccount(QString lobbyUrl, const LoginInformation& info) {
|
void SapphireLauncher::registerAccount(const QString& lobbyUrl, const LoginInformation& info) {
|
||||||
QJsonObject data{{"username", info.username}, {"pass", info.password}};
|
QJsonObject data{{"username", info.username}, {"pass", info.password}};
|
||||||
QUrl url;
|
QUrl url;
|
||||||
url.setScheme("http");
|
url.setScheme("http");
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
|
|
||||||
class AboutWindow : public QDialog {
|
class AboutWindow : public QDialog {
|
||||||
public:
|
public:
|
||||||
AboutWindow(QWidget* widget = nullptr);
|
explicit AboutWindow(QWidget* widget = nullptr);
|
||||||
};
|
};
|
|
@ -19,7 +19,7 @@ public:
|
||||||
|
|
||||||
ProfileSettings& currentProfile();
|
ProfileSettings& currentProfile();
|
||||||
|
|
||||||
void openPath(const QString path);
|
void openPath(const QString& path);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void reloadControls();
|
void reloadControls();
|
||||||
|
|
|
@ -35,13 +35,13 @@ 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, [this] {
|
||||||
QDialog* licenseDialog = new QDialog(this);
|
auto licenseDialog = new QDialog(this);
|
||||||
licenseDialog->setWindowTitle("License Agreement");
|
licenseDialog->setWindowTitle("License Agreement");
|
||||||
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout();
|
auto layout = new QVBoxLayout();
|
||||||
licenseDialog->setLayout(layout);
|
licenseDialog->setLayout(layout);
|
||||||
|
|
||||||
QPlainTextEdit* licenseEdit = new QPlainTextEdit();
|
auto licenseEdit = new QPlainTextEdit();
|
||||||
licenseEdit->setPlainText(license);
|
licenseEdit->setPlainText(license);
|
||||||
licenseEdit->setReadOnly(true);
|
licenseEdit->setReadOnly(true);
|
||||||
layout->addWidget(licenseEdit);
|
layout->addWidget(licenseEdit);
|
||||||
|
|
|
@ -1,18 +1,12 @@
|
||||||
#include "autologinwindow.h"
|
#include "autologinwindow.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QGroupBox>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QProcess>
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
#include <keychain.h>
|
|
||||||
|
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
#include "launcherwindow.h"
|
#include "launcherwindow.h"
|
||||||
|
|
|
@ -12,6 +12,6 @@ void BannerWidget::mousePressEvent(QMouseEvent* event) {
|
||||||
QDesktopServices::openUrl(url);
|
QDesktopServices::openUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BannerWidget::setUrl(QUrl url) {
|
void BannerWidget::setUrl(QUrl newUrl) {
|
||||||
this->url = url;
|
this->url = newUrl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,8 @@
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QGroupBox>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QProcess>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
|
|
||||||
|
|
|
@ -10,18 +10,15 @@
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
#include <keychain.h>
|
|
||||||
|
|
||||||
#include "aboutwindow.h"
|
#include "aboutwindow.h"
|
||||||
#include "assetupdater.h"
|
#include "assetupdater.h"
|
||||||
#include "bannerwidget.h"
|
#include "bannerwidget.h"
|
||||||
#include "config.h"
|
|
||||||
#include "encryptedarg.h"
|
#include "encryptedarg.h"
|
||||||
#include "gameinstaller.h"
|
#include "gameinstaller.h"
|
||||||
#include "headline.h"
|
#include "headline.h"
|
||||||
#include "sapphirelauncher.h"
|
#include "sapphirelauncher.h"
|
||||||
#include "settingswindow.h"
|
#include "settingswindow.h"
|
||||||
#include "squareboot.h"
|
|
||||||
#include "squarelauncher.h"
|
#include "squarelauncher.h"
|
||||||
|
|
||||||
LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindow(parent), core(core) {
|
LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindow(parent), core(core) {
|
||||||
|
@ -485,7 +482,7 @@ void LauncherWindow::reloadNews() {
|
||||||
|
|
||||||
if (!headline.banner.empty()) {
|
if (!headline.banner.empty()) {
|
||||||
if (core.appSettings.showBanners) {
|
if (core.appSettings.showBanners) {
|
||||||
for (auto banner : headline.banner) {
|
for (const auto& banner : headline.banner) {
|
||||||
auto request = QNetworkRequest(banner.bannerImage);
|
auto request = QNetworkRequest(banner.bannerImage);
|
||||||
core.buildRequest(currentProfile(), request);
|
core.buildRequest(currentProfile(), request);
|
||||||
|
|
||||||
|
@ -524,9 +521,9 @@ void LauncherWindow::reloadNews() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (core.appSettings.showNewsList) {
|
if (core.appSettings.showNewsList) {
|
||||||
QTreeWidgetItem* newsItem = new QTreeWidgetItem((QTreeWidgetItem*)nullptr, QStringList("News"));
|
auto newsItem = new QTreeWidgetItem((QTreeWidgetItem*)nullptr, QStringList("News"));
|
||||||
for (auto news : headline.news) {
|
for (const auto& news : headline.news) {
|
||||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
auto item = new QTreeWidgetItem();
|
||||||
item->setText(0, news.title);
|
item->setText(0, news.title);
|
||||||
item->setText(1, QLocale().toString(news.date, QLocale::ShortFormat));
|
item->setText(1, QLocale().toString(news.date, QLocale::ShortFormat));
|
||||||
item->setData(0, Qt::UserRole, news.url);
|
item->setData(0, Qt::UserRole, news.url);
|
||||||
|
@ -534,9 +531,9 @@ void LauncherWindow::reloadNews() {
|
||||||
newsItem->addChild(item);
|
newsItem->addChild(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem* pinnedItem = new QTreeWidgetItem((QTreeWidgetItem*)nullptr, QStringList("Pinned"));
|
auto pinnedItem = new QTreeWidgetItem((QTreeWidgetItem*)nullptr, QStringList("Pinned"));
|
||||||
for (auto pinned : headline.pinned) {
|
for (const auto& pinned : headline.pinned) {
|
||||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
auto item = new QTreeWidgetItem();
|
||||||
item->setText(0, pinned.title);
|
item->setText(0, pinned.title);
|
||||||
item->setText(1, QLocale().toString(pinned.date, QLocale::ShortFormat));
|
item->setText(1, QLocale().toString(pinned.date, QLocale::ShortFormat));
|
||||||
item->setData(0, Qt::UserRole, pinned.url);
|
item->setData(0, Qt::UserRole, pinned.url);
|
||||||
|
@ -544,9 +541,9 @@ void LauncherWindow::reloadNews() {
|
||||||
pinnedItem->addChild(item);
|
pinnedItem->addChild(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem* topicsItem = new QTreeWidgetItem((QTreeWidgetItem*)nullptr, QStringList("Topics"));
|
auto topicsItem = new QTreeWidgetItem((QTreeWidgetItem*)nullptr, QStringList("Topics"));
|
||||||
for (auto news : headline.topics) {
|
for (const auto& news : headline.topics) {
|
||||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
auto item = new QTreeWidgetItem();
|
||||||
item->setText(0, news.title);
|
item->setText(0, news.title);
|
||||||
item->setText(1, QLocale().toString(news.date, QLocale::ShortFormat));
|
item->setText(1, QLocale().toString(news.date, QLocale::ShortFormat));
|
||||||
item->setData(0, Qt::UserRole, news.url);
|
item->setData(0, Qt::UserRole, news.url);
|
||||||
|
@ -565,7 +562,7 @@ void LauncherWindow::reloadNews() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherWindow::openPath(const QString path) {
|
void LauncherWindow::openPath(const QString& path) {
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
// for some reason, windows requires special treatment (what else is new?)
|
// for some reason, windows requires special treatment (what else is new?)
|
||||||
const QFileInfo fileInfo(path);
|
const QFileInfo fileInfo(path);
|
||||||
|
|
|
@ -5,11 +5,9 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QGroupBox>
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QProcess>
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
#include <keychain.h>
|
#include <keychain.h>
|
||||||
|
|
Loading…
Add table
Reference in a new issue