Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into resource_size
This commit is contained in:
commit
b47ec7f2dc
@ -1,4 +1,5 @@
|
||||
Checks:
|
||||
- modernize-use-using
|
||||
- readability-avoid-const-params-in-decls
|
||||
|
||||
SystemHeaders: false
|
||||
|
@ -68,6 +68,8 @@ function(
|
||||
/w14906 # string literal cast to 'LPWSTR'
|
||||
/w14928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied
|
||||
/permissive- # standards conformance mode for MSVC compiler.
|
||||
|
||||
/we4062 # forbid omitting a possible value of an enum in a switch statement
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -93,6 +95,8 @@ function(
|
||||
# in a lot of noise. This warning is only notifying us that clang is emulating the GCC behaviour
|
||||
# instead of the exact standard wording so we can safely ignore it
|
||||
-Wno-gnu-zero-variadic-macro-arguments
|
||||
|
||||
-Werror=switch # forbid omitting a possible value of an enum in a switch statement
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -104,6 +108,8 @@ function(
|
||||
-Wduplicated-branches # warn if if / else branches have duplicated code
|
||||
-Wlogical-op # warn about logical operations being used where bitwise were probably wanted
|
||||
-Wuseless-cast # warn if you perform a cast to the same type
|
||||
|
||||
-Werror=switch # forbid omitting a possible value of an enum in a switch statement
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -128,6 +134,8 @@ function(
|
||||
-Woverloaded-virtual
|
||||
-Wuseless-cast
|
||||
-Wextra-semi
|
||||
|
||||
-Werror=switch # forbid omitting a possible value of an enum in a switch statement
|
||||
)
|
||||
|
||||
target_compile_options(
|
||||
|
@ -18,7 +18,7 @@
|
||||
class DataMigrationTask : public Task {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DataMigrationTask(QObject* parent, const QString& sourcePath, const QString& targetPath, const IPathMatcher::Ptr pathmatcher);
|
||||
explicit DataMigrationTask(QObject* parent, const QString& sourcePath, const QString& targetPath, IPathMatcher::Ptr pathmatcher);
|
||||
~DataMigrationTask() override = default;
|
||||
|
||||
protected:
|
||||
|
@ -59,7 +59,7 @@
|
||||
|
||||
#include <quazip/quazipdir.h>
|
||||
|
||||
InstanceImportTask::InstanceImportTask(const QUrl sourceUrl, QWidget* parent, QMap<QString, QString>&& extra_info)
|
||||
InstanceImportTask::InstanceImportTask(const QUrl& sourceUrl, QWidget* parent, QMap<QString, QString>&& extra_info)
|
||||
: m_sourceUrl(sourceUrl), m_extra_info(extra_info), m_parent(parent)
|
||||
{}
|
||||
|
||||
|
@ -54,7 +54,7 @@ class FileResolvingTask;
|
||||
class InstanceImportTask : public InstanceTask {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InstanceImportTask(const QUrl sourceUrl, QWidget* parent = nullptr, QMap<QString, QString>&& extra_info = {});
|
||||
explicit InstanceImportTask(const QUrl& sourceUrl, QWidget* parent = nullptr, QMap<QString, QString>&& extra_info = {});
|
||||
|
||||
bool abort() override;
|
||||
const QVector<Flame::File>& getBlockedFiles() const { return m_blockedMods; }
|
||||
|
@ -823,6 +823,9 @@ void InstanceList::on_InstFolderChanged([[maybe_unused]] const Setting& setting,
|
||||
}
|
||||
m_instDir = newInstDir;
|
||||
m_groupsLoaded = false;
|
||||
beginRemoveRows(QModelIndex(), 0, count());
|
||||
m_instances.erase(m_instances.begin(), m_instances.end());
|
||||
endRemoveRows();
|
||||
emit instancesChanged();
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include "LaunchController.h"
|
||||
#include "Application.h"
|
||||
#include "minecraft/auth/AccountData.h"
|
||||
#include "minecraft/auth/AccountList.h"
|
||||
|
||||
#include "ui/InstanceWindow.h"
|
||||
@ -161,7 +162,7 @@ void LaunchController::login()
|
||||
m_accountToUse->fillSession(m_session);
|
||||
|
||||
// Launch immediately in true offline mode
|
||||
if (m_accountToUse->isOffline()) {
|
||||
if (m_accountToUse->accountType() == AccountType::Offline) {
|
||||
launchInstance();
|
||||
return;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
namespace MMCZip {
|
||||
// ours
|
||||
bool mergeZipFiles(QuaZip* into, QFileInfo from, QSet<QString>& contained, const FilterFunction filter)
|
||||
bool mergeZipFiles(QuaZip* into, QFileInfo from, QSet<QString>& contained, const FilterFunction& filter)
|
||||
{
|
||||
QuaZip modZip(from.filePath());
|
||||
modZip.open(QuaZip::mdUnzip);
|
||||
|
@ -60,7 +60,7 @@ using FilterFunction = std::function<bool(const QString&)>;
|
||||
/**
|
||||
* Merge two zip files, using a filter function
|
||||
*/
|
||||
bool mergeZipFiles(QuaZip* into, QFileInfo from, QSet<QString>& contained, const FilterFunction filter = nullptr);
|
||||
bool mergeZipFiles(QuaZip* into, QFileInfo from, QSet<QString>& contained, const FilterFunction& filter = nullptr);
|
||||
|
||||
/**
|
||||
* Compress directory, by providing a list of files to compress
|
||||
|
@ -13,7 +13,7 @@ class RecursiveFileSystemWatcher : public QObject {
|
||||
QDir rootDir() const { return m_root; }
|
||||
|
||||
// WARNING: setting this to true may be bad for performance
|
||||
void setWatchFiles(const bool watchFiles);
|
||||
void setWatchFiles(bool watchFiles);
|
||||
bool watchFiles() const { return m_watchFiles; }
|
||||
|
||||
void setMatcher(IPathMatcher::Ptr matcher) { m_matcher = matcher; }
|
||||
|
@ -32,7 +32,7 @@ class ResourceDownloadTask : public SequentialTask {
|
||||
public:
|
||||
explicit ResourceDownloadTask(ModPlatform::IndexedPack::Ptr pack,
|
||||
ModPlatform::IndexedVersion version,
|
||||
const std::shared_ptr<ResourceFolderModel> packs,
|
||||
std::shared_ptr<ResourceFolderModel> packs,
|
||||
bool is_indexed = true,
|
||||
QString custom_target_folder = {});
|
||||
const QString& getFilename() const { return m_pack_version.fileName; }
|
||||
|
@ -28,7 +28,7 @@ class VersionProxyModel : public QAbstractProxyModel {
|
||||
|
||||
const FilterMap& filters() const;
|
||||
const QString& search() const;
|
||||
void setFilter(const BaseVersionList::ModelRoles column, Filter* filter);
|
||||
void setFilter(BaseVersionList::ModelRoles column, Filter* filter);
|
||||
void setSearch(const QString& search);
|
||||
void clearFilters();
|
||||
QModelIndex getRecommended() const;
|
||||
|
@ -67,7 +67,7 @@ class IconList : public QAbstractListModel {
|
||||
virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||
|
||||
bool addThemeIcon(const QString& key);
|
||||
bool addIcon(const QString& key, const QString& name, const QString& path, const IconType type);
|
||||
bool addIcon(const QString& key, const QString& name, const QString& path, IconType type);
|
||||
void saveIcon(const QString& key, const QString& path, const char* format) const;
|
||||
bool deleteIcon(const QString& key);
|
||||
bool trashIcon(const QString& key);
|
||||
|
@ -55,6 +55,6 @@ class Index : public QAbstractListModel, public BaseEntity {
|
||||
QVector<VersionList::Ptr> m_lists;
|
||||
QHash<QString, VersionList::Ptr> m_uids;
|
||||
|
||||
void connectVersionList(const int row, const VersionList::Ptr& list);
|
||||
void connectVersionList(int row, const VersionList::Ptr& list);
|
||||
};
|
||||
} // namespace Meta
|
||||
|
@ -64,7 +64,7 @@ class Version : public QObject, public BaseVersion, public BaseEntity {
|
||||
|
||||
public: // for usage by format parsers only
|
||||
void setType(const QString& type);
|
||||
void setTime(const qint64 time);
|
||||
void setTime(qint64 time);
|
||||
void setRequires(const Meta::RequireSet& reqs, const Meta::RequireSet& conflicts);
|
||||
void setVolatile(bool volatile_);
|
||||
void setRecommended(bool recommended);
|
||||
|
@ -79,7 +79,7 @@ class VersionList : public BaseVersionList, public BaseEntity {
|
||||
|
||||
Version::Ptr m_recommended;
|
||||
|
||||
void setupAddedVersion(const int row, const Version::Ptr& version);
|
||||
void setupAddedVersion(int row, const Version::Ptr& version);
|
||||
};
|
||||
} // namespace Meta
|
||||
Q_DECLARE_METATYPE(Meta::VersionList::Ptr)
|
||||
|
@ -601,11 +601,17 @@ QProcessEnvironment MinecraftInstance::createLaunchEnvironment()
|
||||
auto mangoHudLibString = MangoHud::getLibraryString();
|
||||
if (!mangoHudLibString.isEmpty()) {
|
||||
QFileInfo mangoHudLib(mangoHudLibString);
|
||||
QString libPath = mangoHudLib.absolutePath();
|
||||
auto appendLib = [libPath, &preloadList](QString fileName) {
|
||||
if (QFileInfo(FS::PathCombine(libPath, fileName)).exists())
|
||||
preloadList << fileName;
|
||||
};
|
||||
|
||||
// dlsym variant is only needed for OpenGL and not included in the vulkan layer
|
||||
preloadList << "libMangoHud_dlsym.so"
|
||||
<< "libMangoHud_opengl.so" << mangoHudLib.fileName();
|
||||
libPaths << mangoHudLib.absolutePath();
|
||||
appendLib("libMangoHud_dlsym.so");
|
||||
appendLib("libMangoHud_opengl.so");
|
||||
appendLib(mangoHudLib.fileName());
|
||||
libPaths << libPath;
|
||||
}
|
||||
|
||||
env.insert("LD_PRELOAD", preloadList.join(QLatin1String(":")));
|
||||
|
@ -9,7 +9,7 @@
|
||||
class OneSixVersionFormat {
|
||||
public:
|
||||
// version files / profile patches
|
||||
static VersionFilePtr versionFileFromJson(const QJsonDocument& doc, const QString& filename, const bool requireOrder);
|
||||
static VersionFilePtr versionFileFromJson(const QJsonDocument& doc, const QString& filename, bool requireOrder);
|
||||
static QJsonDocument versionFileToJson(const VersionFilePtr& patch);
|
||||
|
||||
// libraries
|
||||
|
@ -430,7 +430,7 @@ bool PackProfile::remove(const int index)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PackProfile::remove(const QString id)
|
||||
bool PackProfile::remove(const QString& id)
|
||||
{
|
||||
int i = 0;
|
||||
for (auto patch : d->components) {
|
||||
|
@ -89,13 +89,13 @@ class PackProfile : public QAbstractListModel {
|
||||
|
||||
enum MoveDirection { MoveUp, MoveDown };
|
||||
/// move component file # up or down the list
|
||||
void move(const int index, const MoveDirection direction);
|
||||
void move(int index, MoveDirection direction);
|
||||
|
||||
/// remove component file # - including files/records
|
||||
bool remove(const int index);
|
||||
bool remove(int index);
|
||||
|
||||
/// remove component file by id - including files/records
|
||||
bool remove(const QString id);
|
||||
bool remove(const QString& id);
|
||||
|
||||
bool customize(int index);
|
||||
|
||||
|
@ -140,7 +140,7 @@ VersionFilePtr parseJsonFile(const QFileInfo& fileInfo, const bool requireOrder)
|
||||
return guardedParseJson(doc, fileInfo.completeBaseName(), fileInfo.absoluteFilePath(), requireOrder);
|
||||
}
|
||||
|
||||
bool saveJsonFile(const QJsonDocument doc, const QString& filename)
|
||||
bool saveJsonFile(const QJsonDocument& doc, const QString& filename)
|
||||
{
|
||||
auto data = doc.toJson();
|
||||
QSaveFile jsonFile(filename);
|
||||
|
@ -47,10 +47,10 @@ bool readOverrideOrders(QString path, PatchOrder& order);
|
||||
bool writeOverrideOrders(QString path, const PatchOrder& order);
|
||||
|
||||
/// Parse a version file in JSON format
|
||||
VersionFilePtr parseJsonFile(const QFileInfo& fileInfo, const bool requireOrder);
|
||||
VersionFilePtr parseJsonFile(const QFileInfo& fileInfo, bool requireOrder);
|
||||
|
||||
/// Save a JSON file (in any format)
|
||||
bool saveJsonFile(const QJsonDocument doc, const QString& filename);
|
||||
bool saveJsonFile(const QJsonDocument& doc, const QString& filename);
|
||||
|
||||
/// Remove LWJGL from a patch file. This is applied to all Mojang-like profile files.
|
||||
void removeLwjglFromPatch(VersionFilePtr patch);
|
||||
|
@ -283,9 +283,15 @@ QVariant AccountList::data(const QModelIndex& index, int role) const
|
||||
return account->accountDisplayString();
|
||||
|
||||
case TypeColumn: {
|
||||
auto typeStr = account->typeString();
|
||||
typeStr[0] = typeStr[0].toUpper();
|
||||
return typeStr;
|
||||
switch (account->accountType()) {
|
||||
case AccountType::MSA: {
|
||||
return tr("MSA", "Account type");
|
||||
}
|
||||
case AccountType::Offline: {
|
||||
return tr("Offline", "Account type");
|
||||
}
|
||||
}
|
||||
return tr("Unknown", "Account type");
|
||||
}
|
||||
|
||||
case StatusColumn: {
|
||||
|
@ -75,7 +75,7 @@ class AccountList : public QAbstractListModel {
|
||||
virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||
virtual bool setData(const QModelIndex& index, const QVariant& value, int role) override;
|
||||
|
||||
void addAccount(const MinecraftAccountPtr account);
|
||||
void addAccount(MinecraftAccountPtr account);
|
||||
void removeAccount(QModelIndex index);
|
||||
int findAccountByProfileId(const QString& profileId) const;
|
||||
MinecraftAccountPtr getAccountByProfileName(const QString& profileName) const;
|
||||
|
@ -52,6 +52,7 @@
|
||||
|
||||
#include "flows/MSA.h"
|
||||
#include "flows/Offline.h"
|
||||
#include "minecraft/auth/AccountData.h"
|
||||
|
||||
MinecraftAccount::MinecraftAccount(QObject* parent) : QObject(parent)
|
||||
{
|
||||
@ -185,7 +186,7 @@ void MinecraftAccount::authFailed(QString reason)
|
||||
// NOTE: this doesn't do much. There was an error of some sort.
|
||||
} break;
|
||||
case AccountTaskState::STATE_FAILED_HARD: {
|
||||
if (isMSA()) {
|
||||
if (accountType() == AccountType::MSA) {
|
||||
data.msaToken.token = QString();
|
||||
data.msaToken.refresh_token = QString();
|
||||
data.msaToken.validity = Katabasis::Validity::None;
|
||||
|
@ -118,9 +118,7 @@ class MinecraftAccount : public QObject, public Usable {
|
||||
|
||||
bool isActive() const;
|
||||
|
||||
bool isMSA() const { return data.type == AccountType::MSA; }
|
||||
|
||||
bool isOffline() const { return data.type == AccountType::Offline; }
|
||||
[[nodiscard]] AccountType accountType() const noexcept { return data.type; }
|
||||
|
||||
bool ownsMinecraft() const { return data.minecraftEntitlement.ownsMinecraft; }
|
||||
|
||||
|
@ -47,7 +47,7 @@ ResourceFolderModel::~ResourceFolderModel()
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
||||
bool ResourceFolderModel::startWatching(const QStringList paths)
|
||||
bool ResourceFolderModel::startWatching(const QStringList& paths)
|
||||
{
|
||||
if (m_is_watching)
|
||||
return false;
|
||||
@ -66,7 +66,7 @@ bool ResourceFolderModel::startWatching(const QStringList paths)
|
||||
return m_is_watching;
|
||||
}
|
||||
|
||||
bool ResourceFolderModel::stopWatching(const QStringList paths)
|
||||
bool ResourceFolderModel::stopWatching(const QStringList& paths)
|
||||
{
|
||||
if (!m_is_watching)
|
||||
return false;
|
||||
@ -464,9 +464,9 @@ bool ResourceFolderModel::setData(const QModelIndex& index, [[maybe_unused]] con
|
||||
if (role == Qt::CheckStateRole) {
|
||||
if (m_instance != nullptr && m_instance->isRunning()) {
|
||||
auto response =
|
||||
CustomMessageBox::selectable(nullptr, "Confirm toggle",
|
||||
"If you enable/disable this resource while the game is running it may crash your game.\n"
|
||||
"Are you sure you want to do this?",
|
||||
CustomMessageBox::selectable(nullptr, tr("Confirm toggle"),
|
||||
tr("If you enable/disable this resource while the game is running it may crash your game.\n"
|
||||
"Are you sure you want to do this?"),
|
||||
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
|
||||
->exec();
|
||||
|
||||
|
@ -39,14 +39,14 @@ class ResourceFolderModel : public QAbstractListModel {
|
||||
* Returns whether starting to watch all the paths was successful.
|
||||
* If one or more fails, it returns false.
|
||||
*/
|
||||
bool startWatching(const QStringList paths);
|
||||
bool startWatching(const QStringList& paths);
|
||||
|
||||
/** Stops watching the paths for changes.
|
||||
*
|
||||
* Returns whether stopping to watch all the paths was successful.
|
||||
* If one or more fails, it returns false.
|
||||
*/
|
||||
bool stopWatching(const QStringList paths);
|
||||
bool stopWatching(const QStringList& paths);
|
||||
|
||||
/* Helper methods for subclasses, using a predetermined list of paths. */
|
||||
virtual bool startWatching() { return startWatching({ m_dir.absolutePath() }); }
|
||||
|
@ -137,10 +137,11 @@ Task::Ptr GetModDependenciesTask::getProjectInfoTask(std::shared_ptr<PackDepende
|
||||
auto provider = pDep->pack->provider == m_flame_provider.name ? m_flame_provider : m_modrinth_provider;
|
||||
auto responseInfo = std::make_shared<QByteArray>();
|
||||
auto info = provider.api->getProject(pDep->pack->addonId.toString(), responseInfo);
|
||||
QObject::connect(info.get(), &NetJob::succeeded, [responseInfo, provider, pDep] {
|
||||
QObject::connect(info.get(), &NetJob::succeeded, [this, responseInfo, provider, pDep] {
|
||||
QJsonParseError parse_error{};
|
||||
QJsonDocument doc = QJsonDocument::fromJson(*responseInfo, &parse_error);
|
||||
if (parse_error.error != QJsonParseError::NoError) {
|
||||
removePack(pDep->pack->addonId);
|
||||
qWarning() << "Error while parsing JSON response for mod info at " << parse_error.offset
|
||||
<< " reason: " << parse_error.errorString();
|
||||
qDebug() << *responseInfo;
|
||||
@ -151,6 +152,7 @@ Task::Ptr GetModDependenciesTask::getProjectInfoTask(std::shared_ptr<PackDepende
|
||||
: Json::requireObject(doc);
|
||||
provider.mod->loadIndexedPack(*pDep->pack, obj);
|
||||
} catch (const JSONValidationError& e) {
|
||||
removePack(pDep->pack->addonId);
|
||||
qDebug() << doc;
|
||||
qWarning() << "Error while reading mod info: " << e.cause();
|
||||
}
|
||||
@ -211,11 +213,13 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
|
||||
pDep->pack->versionsLoaded = true;
|
||||
|
||||
} catch (const JSONValidationError& e) {
|
||||
removePack(dep.addonId);
|
||||
qDebug() << doc;
|
||||
qWarning() << "Error while reading mod version: " << e.cause();
|
||||
return;
|
||||
}
|
||||
if (level == 0) {
|
||||
removePack(dep.addonId);
|
||||
qWarning() << "Dependency cycle exceeded";
|
||||
return;
|
||||
}
|
||||
@ -238,7 +242,7 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
|
||||
return tasks;
|
||||
}
|
||||
|
||||
void GetModDependenciesTask::removePack(const QVariant addonId)
|
||||
void GetModDependenciesTask::removePack(const QVariant& addonId)
|
||||
{
|
||||
auto pred = [addonId](const std::shared_ptr<PackDependency>& v) { return v->pack->addonId == addonId; };
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 1, 0)
|
||||
|
@ -65,13 +65,13 @@ class GetModDependenciesTask : public SequentialTask {
|
||||
QHash<QString, QStringList> getRequiredBy();
|
||||
|
||||
protected slots:
|
||||
Task::Ptr prepareDependencyTask(const ModPlatform::Dependency&, const ModPlatform::ResourceProvider, int);
|
||||
Task::Ptr prepareDependencyTask(const ModPlatform::Dependency&, ModPlatform::ResourceProvider, int);
|
||||
QList<ModPlatform::Dependency> getDependenciesForVersion(const ModPlatform::IndexedVersion&,
|
||||
const ModPlatform::ResourceProvider providerName);
|
||||
ModPlatform::ResourceProvider providerName);
|
||||
void prepare();
|
||||
Task::Ptr getProjectInfoTask(std::shared_ptr<PackDependency> pDep);
|
||||
ModPlatform::Dependency getOverride(const ModPlatform::Dependency&, const ModPlatform::ResourceProvider providerName);
|
||||
void removePack(const QVariant addonId);
|
||||
ModPlatform::Dependency getOverride(const ModPlatform::Dependency&, ModPlatform::ResourceProvider providerName);
|
||||
void removePack(const QVariant& addonId);
|
||||
|
||||
private:
|
||||
QList<std::shared_ptr<PackDependency>> m_pack_dependencies;
|
||||
|
@ -68,7 +68,7 @@ class ModrinthPackExportTask : public Task {
|
||||
void collectFiles();
|
||||
void collectHashes();
|
||||
void makeApiRequest();
|
||||
void parseApiResponse(const std::shared_ptr<QByteArray> response);
|
||||
void parseApiResponse(std::shared_ptr<QByteArray> response);
|
||||
void buildZip();
|
||||
|
||||
QByteArray generateIndex();
|
||||
|
@ -33,6 +33,6 @@ class TechnicPackProcessor : public QObject {
|
||||
const QString& instIcon,
|
||||
const QString& stagingPath,
|
||||
const QString& minecraftVersion = QString(),
|
||||
const bool isSolder = false);
|
||||
bool isSolder = false);
|
||||
};
|
||||
} // namespace Technic
|
||||
|
@ -16,9 +16,10 @@ class ConcurrentTask;
|
||||
class ModUpdateDialog final : public ReviewMessageBox {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ModUpdateDialog(QWidget* parent, BaseInstance* instance, std::shared_ptr<ModFolderModel> mod_model, QList<Mod*>& search_for);
|
||||
explicit ModUpdateDialog(QWidget* parent,
|
||||
BaseInstance* instance,
|
||||
const std::shared_ptr<ModFolderModel> mod_model,
|
||||
std::shared_ptr<ModFolderModel> mod_model,
|
||||
QList<Mod*>& search_for,
|
||||
bool includeDeps);
|
||||
|
||||
|
@ -50,7 +50,7 @@ class ResourceDownloadDialog : public QDialog, public BasePageProvider {
|
||||
public:
|
||||
using DownloadTaskPtr = shared_qobject_ptr<ResourceDownloadTask>;
|
||||
|
||||
ResourceDownloadDialog(QWidget* parent, const std::shared_ptr<ResourceFolderModel> base_model);
|
||||
ResourceDownloadDialog(QWidget* parent, std::shared_ptr<ResourceFolderModel> base_model);
|
||||
|
||||
void initializeContainer();
|
||||
void connectButtons();
|
||||
|
@ -65,7 +65,7 @@ class InstanceView : public QAbstractItemView {
|
||||
/// get the model index at the specified visual point
|
||||
virtual QModelIndex indexAt(const QPoint& point) const override;
|
||||
QString groupNameAt(const QPoint& point);
|
||||
void setSelection(const QRect& rect, const QItemSelectionModel::SelectionFlags commands) override;
|
||||
void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags commands) override;
|
||||
|
||||
virtual int horizontalOffset() const override;
|
||||
virtual int verticalOffset() const override;
|
||||
|
@ -35,6 +35,7 @@
|
||||
*/
|
||||
|
||||
#include "AccountListPage.h"
|
||||
#include "minecraft/auth/AccountData.h"
|
||||
#include "ui_AccountListPage.h"
|
||||
|
||||
#include <QItemSelectionModel>
|
||||
@ -216,7 +217,7 @@ void AccountListPage::updateButtonStates()
|
||||
QModelIndex selected = selection.first();
|
||||
MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>();
|
||||
accountIsReady = !account->isActive();
|
||||
accountIsOnline = !account->isOffline();
|
||||
accountIsOnline = account->accountType() != AccountType::Offline;
|
||||
}
|
||||
ui->actionRemove->setEnabled(accountIsReady);
|
||||
ui->actionSetDefault->setEnabled(accountIsReady);
|
||||
|
@ -254,9 +254,9 @@ void ExternalResourcesPage::removeItem()
|
||||
void ExternalResourcesPage::removeItems(const QItemSelection& selection)
|
||||
{
|
||||
if (m_instance != nullptr && m_instance->isRunning()) {
|
||||
auto response = CustomMessageBox::selectable(this, "Confirm Delete",
|
||||
"If you remove this resource while the game is running it may crash your game.\n"
|
||||
"Are you sure you want to do this?",
|
||||
auto response = CustomMessageBox::selectable(this, tr("Confirm Delete"),
|
||||
tr("If you remove this resource while the game is running it may crash your game.\n"
|
||||
"Are you sure you want to do this?"),
|
||||
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
|
||||
->exec();
|
||||
|
||||
@ -275,9 +275,9 @@ void ExternalResourcesPage::enableItem()
|
||||
void ExternalResourcesPage::disableItem()
|
||||
{
|
||||
if (m_instance != nullptr && m_instance->isRunning()) {
|
||||
auto response = CustomMessageBox::selectable(this, "Confirm disable",
|
||||
"If you disable this resource while the game is running it may crash your game.\n"
|
||||
"Are you sure you want to do this?",
|
||||
auto response = CustomMessageBox::selectable(this, tr("Confirm disable"),
|
||||
tr("If you disable this resource while the game is running it may crash your game.\n"
|
||||
"Are you sure you want to do this?"),
|
||||
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
|
||||
->exec();
|
||||
|
||||
|
@ -171,9 +171,9 @@ bool ModFolderPage::onSelectionChanged(const QModelIndex& current, [[maybe_unuse
|
||||
void ModFolderPage::removeItems(const QItemSelection& selection)
|
||||
{
|
||||
if (m_instance != nullptr && m_instance->isRunning()) {
|
||||
auto response = CustomMessageBox::selectable(this, "Confirm Delete",
|
||||
"If you remove mods while the game is running it may crash your game.\n"
|
||||
"Are you sure you want to do this?",
|
||||
auto response = CustomMessageBox::selectable(this, tr("Confirm Delete"),
|
||||
tr("If you remove mods while the game is running it may crash your game.\n"
|
||||
"Are you sure you want to do this?"),
|
||||
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
|
||||
->exec();
|
||||
|
||||
@ -239,6 +239,18 @@ void ModFolderPage::updateMods(bool includeDeps)
|
||||
QMessageBox::critical(this, tr("Error"), tr("Mod updates are unavailable when metadata is disabled!"));
|
||||
return;
|
||||
}
|
||||
if (m_instance != nullptr && m_instance->isRunning()) {
|
||||
auto response =
|
||||
CustomMessageBox::selectable(this, tr("Confirm Update"),
|
||||
tr("If you update mods while the game is running may cause mod duplication and game crashes.\n"
|
||||
"The old files may not be deleted as they are in use.\n"
|
||||
"Are you sure you want to do this?"),
|
||||
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
|
||||
->exec();
|
||||
|
||||
if (response != QMessageBox::Yes)
|
||||
return;
|
||||
}
|
||||
auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()).indexes();
|
||||
|
||||
auto mods_list = m_model->selectedMods(selection);
|
||||
|
@ -65,7 +65,7 @@ class OtherLogsPage : public QWidget, public BasePage {
|
||||
|
||||
private slots:
|
||||
void populateSelectLogBox();
|
||||
void on_selectLogBox_currentIndexChanged(const int index);
|
||||
void on_selectLogBox_currentIndexChanged(int index);
|
||||
void on_btnReload_clicked();
|
||||
void on_btnPaste_clicked();
|
||||
void on_btnCopy_clicked();
|
||||
@ -78,7 +78,7 @@ class OtherLogsPage : public QWidget, public BasePage {
|
||||
void findPreviousActivated();
|
||||
|
||||
private:
|
||||
void setControlsEnabled(const bool enabled);
|
||||
void setControlsEnabled(bool enabled);
|
||||
|
||||
private:
|
||||
Ui::OtherLogsPage* ui;
|
||||
|
@ -49,9 +49,7 @@ class ModPage : public ResourcePage {
|
||||
|
||||
[[nodiscard]] QMap<QString, QString> urlHandlers() const override;
|
||||
|
||||
void addResourceToPage(ModPlatform::IndexedPack::Ptr,
|
||||
ModPlatform::IndexedVersion&,
|
||||
const std::shared_ptr<ResourceFolderModel>) override;
|
||||
void addResourceToPage(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&, std::shared_ptr<ResourceFolderModel>) override;
|
||||
|
||||
virtual auto validateVersion(ModPlatform::IndexedVersion& ver,
|
||||
QString mineVer,
|
||||
|
@ -88,7 +88,7 @@ class ResourceModel : public QAbstractListModel {
|
||||
|
||||
void addPack(ModPlatform::IndexedPack::Ptr pack,
|
||||
ModPlatform::IndexedVersion& version,
|
||||
const std::shared_ptr<ResourceFolderModel> packs,
|
||||
std::shared_ptr<ResourceFolderModel> packs,
|
||||
bool is_indexed = false,
|
||||
QString custom_target_folder = {});
|
||||
void removePack(const QString& rem);
|
||||
|
@ -78,7 +78,7 @@ class ResourcePage : public QWidget, public BasePage {
|
||||
void addResourceToDialog(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&);
|
||||
void removeResourceFromDialog(const QString& pack_name);
|
||||
virtual void removeResourceFromPage(const QString& name);
|
||||
virtual void addResourceToPage(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&, const std::shared_ptr<ResourceFolderModel>);
|
||||
virtual void addResourceToPage(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&, std::shared_ptr<ResourceFolderModel>);
|
||||
|
||||
QList<DownloadTaskPtr> selectedPacks() { return m_model->selectedPacks(); }
|
||||
bool hasSelectedPacks() { return !(m_model->selectedPacks().isEmpty()); }
|
||||
|
@ -38,9 +38,7 @@ class ShaderPackResourcePage : public ResourcePage {
|
||||
|
||||
[[nodiscard]] bool supportsFiltering() const override { return false; };
|
||||
|
||||
void addResourceToPage(ModPlatform::IndexedPack::Ptr,
|
||||
ModPlatform::IndexedVersion&,
|
||||
const std::shared_ptr<ResourceFolderModel>) override;
|
||||
void addResourceToPage(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&, std::shared_ptr<ResourceFolderModel>) override;
|
||||
|
||||
[[nodiscard]] QMap<QString, QString> urlHandlers() const override;
|
||||
|
||||
|
@ -38,7 +38,7 @@ class ListModel : public QAbstractListModel {
|
||||
void fetchMore(const QModelIndex& parent) override;
|
||||
|
||||
void getLogo(const QString& logo, const QString& logoUrl, LogoCallback callback);
|
||||
void searchWithTerm(const QString& term, const int sort);
|
||||
void searchWithTerm(const QString& term, int sort);
|
||||
|
||||
[[nodiscard]] bool hasActiveSearchJob() const { return jobPtr && jobPtr->isRunning(); }
|
||||
[[nodiscard]] Task::Ptr activeSearchJob() { return hasActiveSearchJob() ? jobPtr : nullptr; }
|
||||
|
@ -71,7 +71,7 @@ class ModpackListModel : public QAbstractListModel {
|
||||
/* Ask the API for more information */
|
||||
void fetchMore(const QModelIndex& parent) override;
|
||||
void refresh();
|
||||
void searchWithTerm(const QString& term, const int sort);
|
||||
void searchWithTerm(const QString& term, int sort);
|
||||
|
||||
[[nodiscard]] bool hasActiveSearchJob() const { return jobPtr && jobPtr->isRunning(); }
|
||||
[[nodiscard]] Task::Ptr activeSearchJob() { return hasActiveSearchJob() ? jobPtr : nullptr; }
|
||||
|
@ -43,7 +43,7 @@
|
||||
QString BasicCatPack::path()
|
||||
{
|
||||
const auto now = QDate::currentDate();
|
||||
const auto birthday = QDate(now.year(), 11, 30);
|
||||
const auto birthday = QDate(now.year(), 11, 1);
|
||||
const auto xmas = QDate(now.year(), 12, 25);
|
||||
const auto halloween = QDate(now.year(), 10, 31);
|
||||
|
||||
|
@ -76,7 +76,7 @@ void LanguageSelectionWidget::languageRowChanged(const QModelIndex& current, con
|
||||
translations->updateLanguage(key);
|
||||
}
|
||||
|
||||
void LanguageSelectionWidget::languageSettingChanged(const Setting&, const QVariant)
|
||||
void LanguageSelectionWidget::languageSettingChanged(const Setting&, const QVariant&)
|
||||
{
|
||||
auto translations = APPLICATION->translations();
|
||||
auto index = translations->selectedIndex();
|
||||
|
@ -34,7 +34,7 @@ class LanguageSelectionWidget : public QWidget {
|
||||
|
||||
protected slots:
|
||||
void languageRowChanged(const QModelIndex& current, const QModelIndex& previous);
|
||||
void languageSettingChanged(const Setting&, const QVariant);
|
||||
void languageSettingChanged(const Setting&, const QVariant&);
|
||||
|
||||
private:
|
||||
QVBoxLayout* verticalLayout = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user