Skip to content

Commit

Permalink
NOISSUE Overhaul the account management
Browse files Browse the repository at this point in the history
There's now a new Accounts UI with a 3d skin preview and fully
functional skin and cape selection.

Minimum Qt version on Linux has been raised to 5.6.3 (from 5.4.x)
  • Loading branch information
peterix committed Jan 12, 2025
1 parent 4690534 commit 1a673cf
Show file tree
Hide file tree
Showing 120 changed files with 5,526 additions and 2,897 deletions.
9 changes: 9 additions & 0 deletions COPYING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ Portions are licensed under MS-PL:
laws, the contributors exclude the implied warranties of merchantability,
fitness for a particular purpose and non-infringement.

# Mojang assets

MultiMC contains some Minecraft assets owned by Mojang/Microsoft.
These are included, because MultiMC is, after all, a Minecraft launcher.
And without some creeper faces, what is even the point.

If someone from Mojang finds this objectionable, we'll replace these
with suitable substitutes. Until then, enjoy the Minecraft vibes.

# MinGW runtime (Windows)

Copyright (c) 2012 MinGW.org project
Expand Down
42 changes: 36 additions & 6 deletions launcher/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "ui/pages/global/LanguagePage.h"
#include "ui/pages/global/ProxyPage.h"
#include "ui/pages/global/ExternalToolsPage.h"
#include "ui/pages/global/AccountListPage.h"
#include "ui/pages/global/PasteEEPage.h"
#include "ui/pages/global/CustomCommandsPage.h"

Expand All @@ -27,6 +26,7 @@
#include "ui/setupwizard/LanguageWizardPage.h"
#include "ui/setupwizard/JavaWizardPage.h"

#include "ui/dialogs/AccountsDialog.h"
#include "ui/dialogs/CustomMessageBox.h"

#include "ui/pagedialog/PageDialog.h"
Expand All @@ -52,6 +52,9 @@
#include "icons/IconList.h"
#include "net/HttpMetaCache.h"

#include "skins/CapeCache.h"
#include "skins/SkinsModel.h"

#include "java/JavaUtils.h"

#include "updater/UpdateChecker.h"
Expand Down Expand Up @@ -686,6 +689,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_settings->registerSetting("InstanceDir", "instances");
m_settings->registerSetting({"CentralModsDir", "ModsDir"}, "mods");
m_settings->registerSetting("IconsDir", "icons");
m_settings->registerSetting("SkinsDir", "skins");

// Editors
m_settings->registerSetting("JsonEditor", QString());
Expand Down Expand Up @@ -782,7 +786,6 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_globalSettingsProvider->addPage<CustomCommandsPage>();
m_globalSettingsProvider->addPage<ProxyPage>();
m_globalSettingsProvider->addPage<ExternalToolsPage>();
m_globalSettingsProvider->addPage<AccountListPage>();
m_globalSettingsProvider->addPage<PasteEEPage>();
}
qDebug() << "<> Settings loaded.";
Expand Down Expand Up @@ -865,6 +868,17 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
qDebug() << "<> Widget themes initialized.";
}

// Skins
{
auto setting = APPLICATION->settings()->getSetting("SkinsDir");
m_skinsModel.reset(new SkinsModel(setting->get().toString()));
connect(setting.get(), &Setting::SettingChanged,[&](const Setting &, QVariant value)
{
m_skinsModel->directoryChanged(value.toString());
});
qDebug() << "<> Skins intialized.";
}

// initialize and load all instances
{
auto InstDirSetting = m_settings->getSetting("InstanceDir");
Expand Down Expand Up @@ -1038,8 +1052,8 @@ void Application::performMainStartupAction()

if(!m_profileToUse.isEmpty())
{
accountToUse = accounts()->getAccountByProfileName(m_profileToUse);
if(!accountToUse) {
int dummyRow;
if(!accounts()->getAccountByProfileName(m_profileToUse, accountToUse, dummyRow)) {
return;
}
qDebug() << " Launching with account" << m_profileToUse;
Expand Down Expand Up @@ -1144,8 +1158,8 @@ void Application::messageReceived(const QByteArray& message)

MinecraftAccountPtr accountObject;
if(!profile.isEmpty()) {
accountObject = accounts()->getAccountByProfileName(profile);
if(!accountObject) {
int dummyRow;
if(!accounts()->getAccountByProfileName(profile, accountObject, dummyRow)) {
qWarning() << "Launch command requires the specified profile to be valid. " << profile << "does not resolve to any account.";
return;
}
Expand Down Expand Up @@ -1410,6 +1424,13 @@ void Application::ShowGlobalSettings(class QWidget* parent, QString open_page)
emit globalSettingsClosed();
}

void Application::ShowAccountsDialog(class QWidget* parent)
{
AccountsDialog dialog(parent);
dialog.exec();
}


MainWindow* Application::showMainWindow(bool minimized)
{
if(m_mainWindow)
Expand Down Expand Up @@ -1579,6 +1600,15 @@ shared_qobject_ptr<Meta::Index> Application::metadataIndex()
return m_metadataIndex;
}

shared_qobject_ptr<CapeCache> Application::capeCache()
{
if (!m_capeCache)
{
m_capeCache.reset(new CapeCache(this));
}
return m_capeCache;
}

QString Application::getJarsPath()
{
if(m_jarsPath.isEmpty())
Expand Down
13 changes: 13 additions & 0 deletions launcher/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class BaseDetachedToolFactory;
class TranslationsModel;
class ITheme;
class MCEditTool;
class CapeCache;
class SkinsModel;

namespace Meta {
class Index;
Expand Down Expand Up @@ -91,6 +93,10 @@ class Application : public QApplication
return m_icons;
}

shared_qobject_ptr<SkinsModel> skinsModel() const {
return m_skinsModel;
}

MCEditTool *mcedit() const {
return m_mcedit.get();
}
Expand All @@ -117,6 +123,8 @@ class Application : public QApplication

shared_qobject_ptr<Meta::Index> metadataIndex();

shared_qobject_ptr<CapeCache> capeCache();

QString getJarsPath();

/// this is the root of the 'installation'. Used for automatic updates
Expand All @@ -133,6 +141,8 @@ class Application : public QApplication
InstanceWindow *showInstanceWindow(InstancePtr instance, QString page = QString());
MainWindow *showMainWindow(bool minimized = false);

void ShowAccountsDialog(class QWidget * parent);

void updateIsRunning(bool running);
bool updatesAreAllowed();

Expand Down Expand Up @@ -184,6 +194,9 @@ private slots:
shared_qobject_ptr<HttpMetaCache> m_metacache;
shared_qobject_ptr<Meta::Index> m_metadataIndex;

shared_qobject_ptr<CapeCache> m_capeCache;
shared_qobject_ptr<SkinsModel> m_skinsModel;

std::shared_ptr<SettingsObject> m_settings;
std::shared_ptr<InstanceList> m_instances;
std::shared_ptr<IconList> m_icons;
Expand Down
70 changes: 29 additions & 41 deletions launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,13 @@ set(MINECRAFT_SOURCES
minecraft/auth/flows/MSA.cpp
minecraft/auth/flows/MSA.h

# Auth steps
minecraft/auth/steps/EntitlementsStep.cpp
minecraft/auth/steps/EntitlementsStep.h
minecraft/auth/steps/ForcedMigrationStep.cpp
minecraft/auth/steps/ForcedMigrationStep.h
minecraft/auth/steps/GetSkinStep.cpp
minecraft/auth/steps/GetSkinStep.h
minecraft/auth/steps/LauncherLoginStep.cpp
minecraft/auth/steps/LauncherLoginStep.h
minecraft/auth/steps/MigrationEligibilityStep.cpp
minecraft/auth/steps/MigrationEligibilityStep.h
minecraft/auth/steps/MinecraftProfileStep.cpp
minecraft/auth/steps/MinecraftProfileStep.h
minecraft/auth/steps/MSAStep.cpp
Expand All @@ -239,6 +236,14 @@ set(MINECRAFT_SOURCES
minecraft/auth/steps/XboxUserStep.cpp
minecraft/auth/steps/XboxUserStep.h

# API call steps
minecraft/auth/steps/SetSkinStep.cpp
minecraft/auth/steps/SetSkinStep.h
minecraft/auth/steps/SetCapeStep.cpp
minecraft/auth/steps/SetCapeStep.h
minecraft/auth/steps/MinecraftProfileCreateStep.cpp
minecraft/auth/steps/MinecraftProfileCreateStep.h

minecraft/gameoptions/GameOptions.h
minecraft/gameoptions/GameOptions.cpp

Expand Down Expand Up @@ -338,14 +343,6 @@ set(MINECRAFT_SOURCES
minecraft/AssetsUtils.h
minecraft/AssetsUtils.cpp

# Minecraft services
minecraft/services/CapeChange.cpp
minecraft/services/CapeChange.h
minecraft/services/SkinUpload.cpp
minecraft/services/SkinUpload.h
minecraft/services/SkinDelete.cpp
minecraft/services/SkinDelete.h

mojang/PackageManifest.h
mojang/PackageManifest.cpp
)
Expand Down Expand Up @@ -581,25 +578,31 @@ SET(LAUNCHER_SOURCES
KonamiCode.h
KonamiCode.cpp

# Bundled resources
resources/backgrounds/backgrounds.qrc
resources/multimc/multimc.qrc
resources/pe_dark/pe_dark.qrc
resources/pe_light/pe_light.qrc
resources/pe_colored/pe_colored.qrc
resources/pe_blue/pe_blue.qrc
resources/OSX/OSX.qrc
resources/iOS/iOS.qrc
resources/flat/flat.qrc
resources/documents/documents.qrc
${Launcher_Branding_LogoQRC}

# Icons
icons/MMCIcon.h
icons/MMCIcon.cpp
icons/IconList.h
icons/IconList.cpp

# Skins
skins/CapeCache.h
skins/CapeCache.cpp
skins/CapesModel.h
skins/CapesModel.cpp
skins/SkinsModel.h
skins/SkinsModel.cpp
skins/SkinRenderer.h
skins/SkinRenderer.cpp
skins/SkinWidget.h
skins/SkinWidget.cpp
skins/SkinTypes.h
skins/SkinTypes.cpp
skins/SkinUtils.h
skins/SkinUtils.cpp
skins/TextureMappings.h
skins/TextureMappings.cpp


# GUI - windows
ui/GuiUtil.h
ui/GuiUtil.cpp
Expand All @@ -610,10 +613,6 @@ SET(LAUNCHER_SOURCES
ui/InstanceWindow.h
ui/InstanceWindow.cpp

# FIXME: maybe find a better home for this.
SkinUtils.cpp
SkinUtils.h

# GUI - setup wizard
ui/setupwizard/SetupWizard.h
ui/setupwizard/SetupWizard.cpp
Expand Down Expand Up @@ -681,8 +680,6 @@ SET(LAUNCHER_SOURCES
ui/pages/instance/WorldListPage.h

# GUI - global settings pages
ui/pages/global/AccountListPage.cpp
ui/pages/global/AccountListPage.h
ui/pages/global/CustomCommandsPage.cpp
ui/pages/global/CustomCommandsPage.h
ui/pages/global/ExternalToolsPage.cpp
Expand Down Expand Up @@ -748,8 +745,6 @@ SET(LAUNCHER_SOURCES
ui/dialogs/AccountsDialog.h
ui/dialogs/ProfileSelectDialog.cpp
ui/dialogs/ProfileSelectDialog.h
ui/dialogs/ProfileSetupDialog.cpp
ui/dialogs/ProfileSetupDialog.h
ui/dialogs/CopyInstanceDialog.cpp
ui/dialogs/CopyInstanceDialog.h
ui/dialogs/CustomMessageBox.cpp
Expand All @@ -758,8 +753,6 @@ SET(LAUNCHER_SOURCES
ui/dialogs/ExportInstanceDialog.h
ui/dialogs/IconPickerDialog.cpp
ui/dialogs/IconPickerDialog.h
ui/dialogs/MSALoginDialog.cpp
ui/dialogs/MSALoginDialog.h
ui/dialogs/NewComponentDialog.cpp
ui/dialogs/NewComponentDialog.h
ui/dialogs/NewInstanceDialog.cpp
Expand All @@ -776,8 +769,6 @@ SET(LAUNCHER_SOURCES
ui/dialogs/UpdateDialog.h
ui/dialogs/VersionSelectDialog.cpp
ui/dialogs/VersionSelectDialog.h
ui/dialogs/SkinUploadDialog.cpp
ui/dialogs/SkinUploadDialog.h
ui/dialogs/CreateShortcutDialog.cpp
ui/dialogs/CreateShortcutDialog.h
ui/dialogs/ModrinthExportDialog.cpp
Expand Down Expand Up @@ -843,17 +834,13 @@ qt5_wrap_ui(LAUNCHER_UI
ui/dialogs/CreateShortcutDialog.ui
ui/dialogs/ExportInstanceDialog.ui
ui/dialogs/IconPickerDialog.ui
ui/dialogs/MSALoginDialog.ui
ui/dialogs/ModrinthExportDialog.ui
ui/dialogs/NewComponentDialog.ui
ui/dialogs/NewInstanceDialog.ui
ui/dialogs/NotificationDialog.ui
ui/dialogs/ProfileSelectDialog.ui
ui/dialogs/ProfileSetupDialog.ui
ui/dialogs/ProgressDialog.ui
ui/dialogs/SkinUploadDialog.ui
ui/dialogs/UpdateDialog.ui
ui/pages/global/AccountListPage.ui
ui/pages/global/ExternalToolsPage.ui
ui/pages/global/JavaPage.ui
ui/pages/global/LauncherPage.ui
Expand Down Expand Up @@ -898,6 +885,7 @@ qt5_add_resources(LAUNCHER_RESOURCES
resources/iOS/iOS.qrc
resources/flat/flat.qrc
resources/documents/documents.qrc
resources/skins/skins.qrc
${Launcher_Branding_LogoQRC}
)

Expand Down
Loading

0 comments on commit 1a673cf

Please sign in to comment.