Compare commits

...

1 Commits

Author SHA1 Message Date
60234a550b feat: auto install modpack & choise nickname
Some checks failed
CodeQL Code Scanning / CodeQL (push) Has been cancelled
Build Application / Build Debug (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (macos-13, x86_64-darwin) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (macos-14, aarch64-darwin) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (ubuntu-22.04, x86_64-linux) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (ubuntu-22.04-arm, aarch64-linux) (push) Has been cancelled
Update Flake Lockfile / update-flake (push) Has been cancelled
2025-04-15 11:13:45 +03:00
1607 changed files with 11250 additions and 624 deletions

25
launcher/Application.cpp Normal file → Executable file
View File

@ -160,13 +160,14 @@
#if defined Q_OS_WIN32 #if defined Q_OS_WIN32
#include <windows.h> #include <windows.h>
#include <QStyleHints>
#include "WindowsConsole.h" #include "WindowsConsole.h"
#endif #endif
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x) #define TOSTRING(x) STRINGIFY(x)
#include "onimai.h"
static const QLatin1String liveCheckFile("live.check"); static const QLatin1String liveCheckFile("live.check");
PixmapCache* PixmapCache::s_instance = nullptr; PixmapCache* PixmapCache::s_instance = nullptr;
@ -232,7 +233,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
setApplicationDisplayName(QString("%1 %2").arg(BuildConfig.LAUNCHER_DISPLAYNAME, BuildConfig.printableVersionString())); setApplicationDisplayName(QString("%1 %2").arg(BuildConfig.LAUNCHER_DISPLAYNAME, BuildConfig.printableVersionString()));
setApplicationVersion(BuildConfig.printableVersionString() + "\n" + BuildConfig.GIT_COMMIT); setApplicationVersion(BuildConfig.printableVersionString() + "\n" + BuildConfig.GIT_COMMIT);
setDesktopFileName(BuildConfig.LAUNCHER_DESKTOPFILENAME); setDesktopFileName(BuildConfig.LAUNCHER_DESKTOPFILENAME);
m_startTime = QDateTime::currentDateTime(); startTime = QDateTime::currentDateTime();
// Don't quit on hiding the last window // Don't quit on hiding the last window
this->setQuitOnLastWindowClosed(false); this->setQuitOnLastWindowClosed(false);
@ -933,6 +934,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
connect(this, &Application::clickedOnDock, [this]() { this->showMainWindow(); }); connect(this, &Application::clickedOnDock, [this]() { this->showMainWindow(); });
#endif #endif
onimaiLoadLauncher(this);
connect(this, &Application::aboutToQuit, [this]() { connect(this, &Application::aboutToQuit, [this]() {
if (m_instances) { if (m_instances) {
// save any remaining instance state // save any remaining instance state
@ -1125,16 +1128,8 @@ bool Application::createSetupWizard()
// set default theme after going into theme wizard // set default theme after going into theme wizard
if (!validIcons) if (!validIcons)
settings()->set("IconTheme", QString("pe_colored")); settings()->set("IconTheme", QString("pe_colored"));
if (!validWidgets) { if (!validWidgets)
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) settings()->set("ApplicationTheme", QString("system"));
const QString style =
QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark ? QStringLiteral("dark") : QStringLiteral("bright");
#else
const QString style = QStringLiteral("system");
#endif
settings()->set("ApplicationTheme", style);
}
m_themeManager->applyCurrentlySelectedTheme(true); m_themeManager->applyCurrentlySelectedTheme(true);
@ -1201,9 +1196,6 @@ bool Application::event(QEvent* event)
#endif #endif
if (event->type() == QEvent::FileOpen) { if (event->type() == QEvent::FileOpen) {
if (!m_mainWindow) {
showMainWindow(false);
}
auto ev = static_cast<QFileOpenEvent*>(event); auto ev = static_cast<QFileOpenEvent*>(event);
m_mainWindow->processURLs({ ev->url() }); m_mainWindow->processURLs({ ev->url() });
} }
@ -1362,9 +1354,6 @@ void Application::messageReceived(const QByteArray& message)
qWarning() << "Received" << command << "message without a zip path/URL."; qWarning() << "Received" << command << "message without a zip path/URL.";
return; return;
} }
if (!m_mainWindow) {
showMainWindow(false);
}
m_mainWindow->processURLs({ normalizeImportUrl(url) }); m_mainWindow->processURLs({ normalizeImportUrl(url) });
} else if (command == "launch") { } else if (command == "launch") {
QString id = received.args["id"]; QString id = received.args["id"];

4
launcher/Application.h Normal file → Executable file
View File

@ -112,7 +112,7 @@ class Application : public QApplication {
std::shared_ptr<SettingsObject> settings() const { return m_settings; } std::shared_ptr<SettingsObject> settings() const { return m_settings; }
qint64 timeSinceStart() const { return m_startTime.msecsTo(QDateTime::currentDateTime()); } qint64 timeSinceStart() const { return startTime.msecsTo(QDateTime::currentDateTime()); }
QIcon getThemedIcon(const QString& name); QIcon getThemedIcon(const QString& name);
@ -236,7 +236,7 @@ class Application : public QApplication {
bool shouldExitNow() const; bool shouldExitNow() const;
private: private:
QDateTime m_startTime; QDateTime startTime;
shared_qobject_ptr<QNetworkAccessManager> m_network; shared_qobject_ptr<QNetworkAccessManager> m_network;

0
launcher/ApplicationMessage.cpp Normal file → Executable file
View File

0
launcher/ApplicationMessage.h Normal file → Executable file
View File

0
launcher/BaseInstaller.cpp Normal file → Executable file
View File

0
launcher/BaseInstaller.h Normal file → Executable file
View File

2
launcher/BaseInstance.cpp Normal file → Executable file
View File

@ -58,6 +58,8 @@ BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr s
m_global_settings = globalSettings; m_global_settings = globalSettings;
m_rootDir = rootDir; m_rootDir = rootDir;
qDebug() << "BaseInstance: " << rootDir;
m_settings->registerSetting("name", "Unnamed Instance"); m_settings->registerSetting("name", "Unnamed Instance");
m_settings->registerSetting("iconKey", "default"); m_settings->registerSetting("iconKey", "default");
m_settings->registerSetting("notes", ""); m_settings->registerSetting("notes", "");

0
launcher/BaseInstance.h Normal file → Executable file
View File

0
launcher/BaseVersion.h Normal file → Executable file
View File

0
launcher/BaseVersionList.cpp Normal file → Executable file
View File

0
launcher/BaseVersionList.h Normal file → Executable file
View File

10
launcher/CMakeLists.txt Normal file → Executable file
View File

@ -5,6 +5,7 @@ project(application)
######## Sources and headers ######## ######## Sources and headers ########
set(CORE_SOURCES set(CORE_SOURCES
onimai.cpp
# LOGIC - Base classes and infrastructure # LOGIC - Base classes and infrastructure
BaseInstaller.h BaseInstaller.h
BaseInstaller.cpp BaseInstaller.cpp
@ -238,8 +239,6 @@ set(MINECRAFT_SOURCES
minecraft/auth/AuthFlow.cpp minecraft/auth/AuthFlow.cpp
minecraft/auth/AuthFlow.h minecraft/auth/AuthFlow.h
minecraft/auth/steps/AuthlibInjectorMetadataStep.cpp
minecraft/auth/steps/AuthlibInjectorMetadataStep.h
minecraft/auth/steps/EntitlementsStep.cpp minecraft/auth/steps/EntitlementsStep.cpp
minecraft/auth/steps/EntitlementsStep.h minecraft/auth/steps/EntitlementsStep.h
minecraft/auth/steps/GetSkinStep.cpp minecraft/auth/steps/GetSkinStep.cpp
@ -387,10 +386,6 @@ set(MINECRAFT_SOURCES
minecraft/AssetsUtils.cpp minecraft/AssetsUtils.cpp
# Minecraft skins # Minecraft skins
minecraft/skins/AuthlibInjectorTextureDelete.cpp
minecraft/skins/AuthlibInjectorTextureDelete.h
minecraft/skins/AuthlibInjectorTextureUpload.cpp
minecraft/skins/AuthlibInjectorTextureUpload.h
minecraft/skins/CapeChange.cpp minecraft/skins/CapeChange.cpp
minecraft/skins/CapeChange.h minecraft/skins/CapeChange.h
minecraft/skins/SkinUpload.cpp minecraft/skins/SkinUpload.cpp
@ -1066,6 +1061,8 @@ SET(LAUNCHER_SOURCES
ui/dialogs/CopyInstanceDialog.h ui/dialogs/CopyInstanceDialog.h
ui/dialogs/CustomMessageBox.cpp ui/dialogs/CustomMessageBox.cpp
ui/dialogs/CustomMessageBox.h ui/dialogs/CustomMessageBox.h
ui/dialogs/EditAccountDialog.cpp
ui/dialogs/EditAccountDialog.h
ui/dialogs/ExportInstanceDialog.cpp ui/dialogs/ExportInstanceDialog.cpp
ui/dialogs/ExportInstanceDialog.h ui/dialogs/ExportInstanceDialog.h
ui/dialogs/ExportPackDialog.cpp ui/dialogs/ExportPackDialog.cpp
@ -1255,6 +1252,7 @@ qt_wrap_ui(LAUNCHER_UI
ui/dialogs/OfflineLoginDialog.ui ui/dialogs/OfflineLoginDialog.ui
ui/dialogs/AuthlibInjectorLoginDialog.ui ui/dialogs/AuthlibInjectorLoginDialog.ui
ui/dialogs/AboutDialog.ui ui/dialogs/AboutDialog.ui
ui/dialogs/EditAccountDialog.ui
ui/dialogs/ReviewMessageBox.ui ui/dialogs/ReviewMessageBox.ui
ui/dialogs/ScrollMessageBox.ui ui/dialogs/ScrollMessageBox.ui
ui/dialogs/BlockedModsDialog.ui ui/dialogs/BlockedModsDialog.ui

0
launcher/Commandline.cpp Normal file → Executable file
View File

0
launcher/Commandline.h Normal file → Executable file
View File

0
launcher/DataMigrationTask.cpp Normal file → Executable file
View File

0
launcher/DataMigrationTask.h Normal file → Executable file
View File

0
launcher/DefaultVariable.h Normal file → Executable file
View File

0
launcher/DesktopServices.cpp Normal file → Executable file
View File

0
launcher/DesktopServices.h Normal file → Executable file
View File

0
launcher/Exception.h Normal file → Executable file
View File

0
launcher/ExponentialSeries.h Normal file → Executable file
View File

0
launcher/FastFileIconProvider.cpp Normal file → Executable file
View File

0
launcher/FastFileIconProvider.h Normal file → Executable file
View File

0
launcher/FileIgnoreProxy.cpp Normal file → Executable file
View File

0
launcher/FileIgnoreProxy.h Normal file → Executable file
View File

0
launcher/FileSystem.cpp Normal file → Executable file
View File

0
launcher/FileSystem.h Normal file → Executable file
View File

0
launcher/Filter.cpp Normal file → Executable file
View File

0
launcher/Filter.h Normal file → Executable file
View File

0
launcher/GZip.cpp Normal file → Executable file
View File

0
launcher/GZip.h Normal file → Executable file
View File

3
launcher/GetAuthlibInjectorApiLocation.cpp Normal file → Executable file
View File

@ -72,8 +72,7 @@ auto GetAuthlibInjectorApiLocation::Sink::finalize(QNetworkReply& reply) -> Task
qDebug() << "X-Authlib-Injector-API-Location header not found!"; qDebug() << "X-Authlib-Injector-API-Location header not found!";
} }
const auto& encodedUrl = url.toEncoded(QUrl::FullyEncoded); m_outer.m_account.reset(MinecraftAccount::createFromUsernameAuthlibInjector(m_outer.m_username, url.toString()));
m_outer.m_account.reset(MinecraftAccount::createFromUsernameAuthlibInjector(m_outer.m_username, encodedUrl));
return Task::State::Succeeded; return Task::State::Succeeded;
} }

0
launcher/GetAuthlibInjectorApiLocation.h Normal file → Executable file
View File

0
launcher/InstanceCopyPrefs.cpp Normal file → Executable file
View File

0
launcher/InstanceCopyPrefs.h Normal file → Executable file
View File

0
launcher/InstanceCopyTask.cpp Normal file → Executable file
View File

0
launcher/InstanceCopyTask.h Normal file → Executable file
View File

0
launcher/InstanceCreationTask.cpp Normal file → Executable file
View File

0
launcher/InstanceCreationTask.h Normal file → Executable file
View File

8
launcher/InstanceImportTask.cpp Normal file → Executable file
View File

@ -159,7 +159,7 @@ void InstanceImportTask::processZipPack()
} }
QuaZipDir packZipDir(packZip.get()); QuaZipDir packZipDir(packZip.get());
qDebug() << "Attempting to determine instance type"; qDebug() << "Attempting to determine instance type ";
QString root; QString root;
@ -244,6 +244,8 @@ void InstanceImportTask::extractFinished()
} }
} }
qDebug() << "extractFinished " << static_cast<int>(m_modpackType);
switch (m_modpackType) { switch (m_modpackType) {
case ModpackType::MultiMC: case ModpackType::MultiMC:
processMultiMC(); processMultiMC();
@ -326,6 +328,8 @@ void InstanceImportTask::processMultiMC()
QString configPath = FS::PathCombine(m_stagingPath, "instance.cfg"); QString configPath = FS::PathCombine(m_stagingPath, "instance.cfg");
auto instanceSettings = std::make_shared<INISettingsObject>(configPath); auto instanceSettings = std::make_shared<INISettingsObject>(configPath);
qDebug() << "processMultiMC: " << m_stagingPath;
NullInstance instance(m_globalSettings, instanceSettings, m_stagingPath); NullInstance instance(m_globalSettings, instanceSettings, m_stagingPath);
// reset time played on import... because packs. // reset time played on import... because packs.
@ -334,6 +338,8 @@ void InstanceImportTask::processMultiMC()
// set a new nice name // set a new nice name
instance.setName(name()); instance.setName(name());
qDebug() << "processMultiMC2 " << instance.instanceRoot() << name();
// if the icon was specified by user, use that. otherwise pull icon from the pack // if the icon was specified by user, use that. otherwise pull icon from the pack
if (m_instIcon != "default") { if (m_instIcon != "default") {
instance.setIconKey(m_instIcon); instance.setIconKey(m_instIcon);

0
launcher/InstanceImportTask.h Normal file → Executable file
View File

5
launcher/InstanceList.cpp Normal file → Executable file
View File

@ -449,6 +449,7 @@ QList<InstanceId> InstanceList::discoverInstances()
out.append(id); out.append(id);
qDebug() << "Found instance ID" << id; qDebug() << "Found instance ID" << id;
} }
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
instanceSet = QSet<QString>(out.begin(), out.end()); instanceSet = QSet<QString>(out.begin(), out.end());
#else #else
@ -977,6 +978,7 @@ QString InstanceList::getStagedInstancePath()
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
SetFileAttributesA(tempRoot.toStdString().c_str(), FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED); SetFileAttributesA(tempRoot.toStdString().c_str(), FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED);
#endif #endif
qDebug() << "get Debug" << result;
return result; return result;
} }
@ -994,7 +996,7 @@ bool InstanceList::commitStagedInstance(const QString& path,
auto should_override = commiting.shouldOverride(); auto should_override = commiting.shouldOverride();
if (should_override) { if (should_override) {
instID = commiting.originalInstanceID(); instID = instanceName.modifiedName();
} else { } else {
instID = FS::DirNameFromString(instanceName.modifiedName(), m_instDir); instID = FS::DirNameFromString(instanceName.modifiedName(), m_instDir);
} }
@ -1010,6 +1012,7 @@ bool InstanceList::commitStagedInstance(const QString& path,
qWarning() << "Failed to override" << path << "to" << destination; qWarning() << "Failed to override" << path << "to" << destination;
return false; return false;
} }
FS::deletePath(path);
} else { } else {
if (!FS::move(path, destination)) { if (!FS::move(path, destination)) {
qWarning() << "Failed to move" << path << "to" << destination; qWarning() << "Failed to move" << path << "to" << destination;

0
launcher/InstanceList.h Normal file → Executable file
View File

0
launcher/InstancePageProvider.h Normal file → Executable file
View File

0
launcher/InstanceTask.cpp Normal file → Executable file
View File

31
launcher/InstanceTask.h Normal file → Executable file
View File

@ -30,26 +30,31 @@ struct InstanceName {
}; };
class InstanceTask : public Task, public InstanceName { class InstanceTask : public Task, public InstanceName {
Q_OBJECT Q_OBJECT
public: public:
InstanceTask(); InstanceTask();
~InstanceTask() override = default; ~InstanceTask() override = default;
void setParentSettings(SettingsObjectPtr settings) { m_globalSettings = settings; } void setParentSettings(SettingsObjectPtr settings) { m_globalSettings = settings; }
void setStagingPath(const QString& stagingPath) { m_stagingPath = stagingPath; } void setStagingPath(const QString& stagingPath) { m_stagingPath = stagingPath; }
void setIcon(const QString& icon) { m_instIcon = icon; } void setIcon(const QString& icon) { m_instIcon = icon; }
void setGroup(const QString& group) { m_instGroup = group; } void setGroup(const QString& group) { m_instGroup = group; }
QString group() const { return m_instGroup; } QString group() const { return m_instGroup; }
[[nodiscard]] bool shouldConfirmUpdate() const { return m_confirm_update; } [[nodiscard]] bool shouldConfirmUpdate() const { return m_confirm_update; }
void setConfirmUpdate(bool confirm) { m_confirm_update = confirm; } void setConfirmUpdate(bool confirm) { m_confirm_update = confirm; }
bool shouldOverride() const { return m_override_existing; } bool shouldOverride() const { return m_override_existing; }
[[nodiscard]] QString originalInstanceID() const { return m_original_instance_id; }; [[nodiscard]] QString originalInstanceID() const { return m_original_instance_id; };
void setShouldOverride(bool should)
{
m_override_existing = should;
}
protected: protected:
void setOverride(bool override, QString instance_id_to_override = {}) void setOverride(bool override, QString instance_id_to_override = {})

0
launcher/JavaCommon.cpp Normal file → Executable file
View File

0
launcher/JavaCommon.h Normal file → Executable file
View File

0
launcher/Json.cpp Normal file → Executable file
View File

0
launcher/Json.h Normal file → Executable file
View File

0
launcher/KonamiCode.cpp Normal file → Executable file
View File

0
launcher/KonamiCode.h Normal file → Executable file
View File

0
launcher/LaunchController.cpp Normal file → Executable file
View File

0
launcher/LaunchController.h Normal file → Executable file
View File

0
launcher/LoggedProcess.cpp Normal file → Executable file
View File

0
launcher/LoggedProcess.h Normal file → Executable file
View File

7
launcher/Logging.cpp Normal file
View File

@ -0,0 +1,7 @@
// This file was generated by ecm_qt_declare_logging_category(): DO NOT EDIT!
#include "Logging.h"
Q_LOGGING_CATEGORY(authCredentials, "launcher.auth.credentials", QtWarningMsg)

11
launcher/Logging.h Normal file
View File

@ -0,0 +1,11 @@
// This file was generated by ecm_qt_declare_logging_category(): DO NOT EDIT!
#ifndef ECM_QLOGGINGCATEGORY_AUTHCREDENTIALS_LOGGING_H
#define ECM_QLOGGINGCATEGORY_AUTHCREDENTIALS_LOGGING_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(authCredentials)
#endif

0
launcher/MMCTime.cpp Normal file → Executable file
View File

0
launcher/MMCTime.h Normal file → Executable file
View File

0
launcher/MMCZip.cpp Normal file → Executable file
View File

0
launcher/MMCZip.h Normal file → Executable file
View File

0
launcher/MTPixmapCache.h Normal file → Executable file
View File

10388
launcher/Makefile Executable file

File diff suppressed because it is too large Load Diff

0
launcher/MangoHud.cpp Normal file → Executable file
View File

0
launcher/MangoHud.h Normal file → Executable file
View File

0
launcher/Manifest.cpp Normal file → Executable file
View File

0
launcher/Manifest.h Normal file → Executable file
View File

0
launcher/Markdown.cpp Normal file → Executable file
View File

0
launcher/Markdown.h Normal file → Executable file
View File

0
launcher/MessageLevel.cpp Normal file → Executable file
View File

0
launcher/MessageLevel.h Normal file → Executable file
View File

0
launcher/NullInstance.h Normal file → Executable file
View File

0
launcher/PSaveFile.h Normal file → Executable file
View File

0
launcher/ProblemProvider.h Normal file → Executable file
View File

0
launcher/QObjectPtr.h Normal file → Executable file
View File

0
launcher/QVariantUtils.h Normal file → Executable file
View File

0
launcher/RWStorage.h Normal file → Executable file
View File

0
launcher/RecursiveFileSystemWatcher.cpp Normal file → Executable file
View File

0
launcher/RecursiveFileSystemWatcher.h Normal file → Executable file
View File

0
launcher/ResourceDownloadTask.cpp Normal file → Executable file
View File

0
launcher/ResourceDownloadTask.h Normal file → Executable file
View File

0
launcher/RuntimeContext.h Normal file → Executable file
View File

0
launcher/SeparatorPrefixTree.h Normal file → Executable file
View File

0
launcher/StringUtils.cpp Normal file → Executable file
View File

0
launcher/StringUtils.h Normal file → Executable file
View File

0
launcher/SysInfo.cpp Normal file → Executable file
View File

0
launcher/SysInfo.h Normal file → Executable file
View File

0
launcher/Untar.cpp Normal file → Executable file
View File

0
launcher/Untar.h Normal file → Executable file
View File

0
launcher/Usable.h Normal file → Executable file
View File

0
launcher/Version.cpp Normal file → Executable file
View File

0
launcher/Version.h Normal file → Executable file
View File

1
launcher/VersionProxyModel.cpp Normal file → Executable file
View File

@ -307,7 +307,6 @@ void VersionProxyModel::setSourceModel(QAbstractItemModel* replacingRaw)
if (!replacing) { if (!replacing) {
roles.clear(); roles.clear();
filterModel->setSourceModel(replacing); filterModel->setSourceModel(replacing);
endResetModel();
return; return;
} }

0
launcher/VersionProxyModel.h Normal file → Executable file
View File

0
launcher/WatchLock.h Normal file → Executable file
View File

0
launcher/WindowsConsole.cpp Normal file → Executable file
View File

0
launcher/WindowsConsole.h Normal file → Executable file
View File

0
launcher/filelink/FileLink.cpp Normal file → Executable file
View File

0
launcher/filelink/FileLink.h Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More