From 8ef77b488b5720152bd73b9799cee9406a082d5b Mon Sep 17 00:00:00 2001 From: xgui4 <134389196+xgui4@users.noreply.github.com> Date: Fri, 15 May 2026 17:47:54 -0400 Subject: [PATCH] refactor: remove deprecated username field and update instance configurations --- data/defaults_instances/360Revived.lce_inst | 1 - data/defaults_instances/aether.lce_inst | 1 - data/defaults_instances/default.lce_inst | 3 +- data/defaults_instances/hellishends.lce_inst | 1 - data/defaults_instances/revelation.lce_inst | 1 - data/lce_qt_launcher.ini | 6 +- packages/windows/setup-nigthly-preview.iss | 2 +- packages/windows/setup-nigthly.iss | 2 +- schemas/x-application-lce_inst_config.json | 1 + src/form.ui | 20 ++- .../managers/instance_manager.py | 10 +- src/lce_qt_launcher/models/preferences.py | 35 +++- src/lce_qt_launcher/views/launcher.py | 74 ++++----- src/settingDialog.ui | 155 ++++++++++-------- 14 files changed, 178 insertions(+), 134 deletions(-) diff --git a/data/defaults_instances/360Revived.lce_inst b/data/defaults_instances/360Revived.lce_inst index 811fe9e..1a2607c 100644 --- a/data/defaults_instances/360Revived.lce_inst +++ b/data/defaults_instances/360Revived.lce_inst @@ -2,7 +2,6 @@ "$schema" : "https://raw.githubusercontent.com/xgui4/LCE-Qt-Launcher/refs/heads/nightly/schemas/x-application-lce_inst_config.json", "name": "360Revived", "installation_path": ".lce-360Revived", - "username": "Steve", "archive_file": "LCEWindows64.zip", "exe_name": "Minecraft.Client.exe", "repo_url": "https://github.com/BluTac10/360Revived", diff --git a/data/defaults_instances/aether.lce_inst b/data/defaults_instances/aether.lce_inst index 6ac7497..29a351b 100644 --- a/data/defaults_instances/aether.lce_inst +++ b/data/defaults_instances/aether.lce_inst @@ -3,7 +3,6 @@ "name": "aRockefeler Aether Mod", "installation_path": ".lce-aether", "archive_file": "Release", - "username": "Steve", "image": ":/aether.png", "exe_name": "Minecraft.Client.exe", "url": "https://github.com/Frcoxd/aether-papu", diff --git a/data/defaults_instances/default.lce_inst b/data/defaults_instances/default.lce_inst index 5f3bcaa..c441034 100644 --- a/data/defaults_instances/default.lce_inst +++ b/data/defaults_instances/default.lce_inst @@ -2,13 +2,12 @@ "$schema" : "https://raw.githubusercontent.com/xgui4/LCE-Qt-Launcher/refs/heads/nightly/schemas/x-application-lce_inst_config.json", "name": "Default", "installation_path": ".default", - "username": "Steve", "archive_file": "LCEWindows64.zip", "exe_name": "Minecraft.Client.exe", "repo_url": "https://git.minecraftlegacy.com/backups/MinecraftConsoles", "image" : ":/assets/mclce-ico.png", "news_feed" : "https://git.minecraftlegacy.com/backups/MinecraftConsoles/commits/branch/main", - "instance_source": InstanceSource.REMOTE_GIT_SOURCE", + "instance_source": "InstanceSource.REMOTE_GIT_SOURCE", "instance_type": "InstanceType.CLIENT_VANILLA", "version": "main" } \ No newline at end of file diff --git a/data/defaults_instances/hellishends.lce_inst b/data/defaults_instances/hellishends.lce_inst index 0e1cff5..dd59069 100644 --- a/data/defaults_instances/hellishends.lce_inst +++ b/data/defaults_instances/hellishends.lce_inst @@ -2,7 +2,6 @@ "$schema" : "https://raw.githubusercontent.com/xgui4/LCE-Qt-Launcher/refs/heads/nightly/schemas/x-application-lce_inst_config.json", "name": "HellishEnds", "installation_path": ".lce-HellishEnds", - "username": "Steve", "archive_file": "LCEWindows64.zip", "exe_name": "Minecraft.Client.exe", "repo_url": "hhttps://github.com/deadvoxelx/HellishEnds", diff --git a/data/defaults_instances/revelation.lce_inst b/data/defaults_instances/revelation.lce_inst index 686f7f0..3dd3de7 100644 --- a/data/defaults_instances/revelation.lce_inst +++ b/data/defaults_instances/revelation.lce_inst @@ -2,7 +2,6 @@ "$schema" : "https://raw.githubusercontent.com/xgui4/LCE-Qt-Launcher/refs/heads/nightly/schemas/x-application-lce_inst_config.json", "name": "Revelations", "installation_path": ".lce-revelations ", - "username": "Steve", "archive_file": "LCE-Revelations-Client-Win64.zip", "exe_name": "Minecraft.Client.exe", "repo_url": "https://github.com/itsRevela/LCE-Revelations", diff --git a/data/lce_qt_launcher.ini b/data/lce_qt_launcher.ini index 23922f7..5c59812 100644 --- a/data/lce_qt_launcher.ini +++ b/data/lce_qt_launcher.ini @@ -1,10 +1,14 @@ [customisation] theme=":/styles/minecraft.qss" [preferences] -default_path="~/.local/share/lce_qt_launcher/default" +language="en" +default_path="{appData}/instances" +experimental_mode_enabled=0 [views] show_holyday_enabled=1 [developper] dev_mode_enabled=0 [accesibility] accesibility_mode_enabled=0 +[user_profile] +username="Steve" \ No newline at end of file diff --git a/packages/windows/setup-nigthly-preview.iss b/packages/windows/setup-nigthly-preview.iss index 9845c62..0f22d6e 100644 --- a/packages/windows/setup-nigthly-preview.iss +++ b/packages/windows/setup-nigthly-preview.iss @@ -3,7 +3,7 @@ ; Non-commercial use only #define MyAppName "LCE Qt Launcher (Nightly)" -#define MyAppVersion "0.0.20.0" +#define MyAppVersion "2026.05.15" #define MyAppPublisher "Xgui4" #define MyAppURL "https://github.com/xgui4/lce-qt-launcher" #define MyAppExeName "main.exe" diff --git a/packages/windows/setup-nigthly.iss b/packages/windows/setup-nigthly.iss index c11a38b..d6667e1 100644 --- a/packages/windows/setup-nigthly.iss +++ b/packages/windows/setup-nigthly.iss @@ -3,7 +3,7 @@ ; Non-commercial use only #define MyAppName "LCE Qt Launcher (Nightly)" -#define MyAppVersion "0.0.20.0" +#define MyAppVersion "2026.05.15" #define MyAppPublisher "Xgui4" #define MyAppURL "https://github.com/xgui4/lce-qt-launcher" #define MyAppExeName "main.exe" diff --git a/schemas/x-application-lce_inst_config.json b/schemas/x-application-lce_inst_config.json index e3ad2a4..a5acc50 100644 --- a/schemas/x-application-lce_inst_config.json +++ b/schemas/x-application-lce_inst_config.json @@ -21,6 +21,7 @@ ] }, "username" : { + "$comment": "DEPRECIATED : will be soon removed and replaced by the username config settng", "description": "The username of the player for the instance", "type" : "string", "default" : "Steve" diff --git a/src/form.ui b/src/form.ui index e2919c8..1660b14 100644 --- a/src/form.ui +++ b/src/form.ui @@ -7,7 +7,7 @@ 0 0 1205 - 891 + 897 @@ -255,7 +255,7 @@ - false + true @@ -264,7 +264,7 @@ - Setting + Setting (Experimental) @@ -632,7 +632,7 @@ - https://lce-hub.github.io/piston/ + https://github.com/LCE-Hub/LCE-Workshop @@ -993,7 +993,7 @@ - Setting + Setting (Experimental) @@ -1026,7 +1026,7 @@ true - Setting + Setting (Experiment) @@ -1037,7 +1037,7 @@ - Setting + Setting (Experiment) @@ -1162,6 +1162,12 @@ true + + true + + + false + Enable Experiments diff --git a/src/lce_qt_launcher/managers/instance_manager.py b/src/lce_qt_launcher/managers/instance_manager.py index 7ebdc58..50b7097 100644 --- a/src/lce_qt_launcher/managers/instance_manager.py +++ b/src/lce_qt_launcher/managers/instance_manager.py @@ -77,7 +77,7 @@ def from_str_to_InstanceSource(string : str)-> InstanceSource: return InstanceSource.GITHUB_RELEASE case "InstanceSource.FORGEJO_RELEASE": return InstanceSource.FORGEJO_RELEASE - case "InstanceSource.REMOTE_GIT_SOURCE ": + case "InstanceSource.REMOTE_GIT_SOURCE": return InstanceSource.REMOTE_GIT_SOURCE case "InstanceSource.LOCAL_INSTALLATION": return InstanceSource.LOCAL_INSTALLATION @@ -342,3 +342,11 @@ class InstanceManager: json_data = json.load(json_file) inst_dict : dict[str, str] = json_data self.instance.load_inst_from_dict(inst_dict) + + def is_installable(self) -> bool: + """_summary_ #TODO + """ + #Note : Right now the remote git location is not installable via this launcher, it will added in the next version + if self.instance.instance_source in [InstanceSource.LOCAL_INSTALLATION, InstanceSource.LOCAL_SOURCE_CODE, InstanceSource.REMOTE_GIT_SOURCE]: + return False + return True diff --git a/src/lce_qt_launcher/models/preferences.py b/src/lce_qt_launcher/models/preferences.py index 44ea08a..e021014 100644 --- a/src/lce_qt_launcher/models/preferences.py +++ b/src/lce_qt_launcher/models/preferences.py @@ -7,11 +7,12 @@ from lce_qt_launcher.models.theme import StrTheme _THEME_OPTION : str = "customisation/theme" _INSTANCE_PATH_OPTION : str = "preferences/default_path" -_LANGUAGE_OPTION : str = "preferences/languages" +_LANGUAGE_OPTION : str = "preferences/language" _SHOW_HOLIDAY_OPTION : str = "views/show_hoyday_enabled" -_DEVELOPPER_MODE_OPTION : str = "developper/dev_mode_enabled" -_ACCESIBLE_MODE_OPTION : str = "accesibility/accesibility_mode_enabled" -_EXPERIMENTAL_MODE_OPTION : str = "preferenses/experimental_mode_enabled" +_DEVELOPPER_MODE_OPTION : str = "developper/dev_mode_enabled" +_ACCESIBLE_MODE_OPTION : str = "accesibility/accesibility_mode_enabled" +_EXPERIMENTAL_MODE_OPTION : str = "preferences/experimental_mode_enabled" +_USERNAME_OPTION : str = "user_profile/username" class UserPref (QSettings): """_summary_ The UserPref managed by QtSettings @@ -19,15 +20,16 @@ class UserPref (QSettings): Args: QSettings (_type_): _description_ : Inherit QtSettings """ - def __init__(self, build_info : BuildInfo) -> None: - super().__init__(QSettings.Format.IniFormat, QSettings.Scope.UserScope, "Xgui4", build_info.app_name) + def __init__(self, buildInfo : BuildInfo) -> None: + super().__init__(QSettings.Format.IniFormat, QSettings.Scope.UserScope, "Xgui4", buildInfo.app_name) self.default_theme : StrTheme = StrTheme.MINECRAFT - self.default_instance_path : str = "~/.local/share/lce_qt_launcher/default" + self.default_instance_path : str = "{appData}/instances" self.default_language : str = "en" self.default_show_holiday : bool = True self.default_accesibility_mode : bool = False self.default_developper_mode : bool = False self.default_experiment_mode : bool = False + self.default_username : str = "Steve" def set_theme_pref(self, theme : str) -> None: """_summary_ Theme Setter @@ -115,7 +117,7 @@ class UserPref (QSettings): """_summary_ Experimental Mode Setter Args: - developper_mode_bool (bool): _description_ #TODO DOCSTRINGS + experimental_mode_bool (bool): _description_ #TODO DOCSTRINGS """ super().setValue(_EXPERIMENTAL_MODE_OPTION, experimental_mode_bool) super().sync() @@ -127,6 +129,22 @@ class UserPref (QSettings): """ return str(self.value(_EXPERIMENTAL_MODE_OPTION, self.default_experiment_mode, type=str)) + def set_username(self, new_username : str) -> None: + """_summary_ Username Setter + + Args: + new_username (str): _description_ #TODO DOCSTRINGS + """ + super().setValue(_USERNAME_OPTION, new_username) + super().sync() + def get_username(self) -> str: + """_summary_ Experimental Mode Getter + + Returns: + str: _description_ #TODO DOCSTRINGS + """ + return str(self.value(_USERNAME_OPTION, self.default_username, type=str)) + def generate_default_config(self) -> None: """_summary_ Generate the default config for the users """ @@ -137,4 +155,5 @@ class UserPref (QSettings): self.set_accesible_mode(self.default_accesibility_mode) self.set_accesible_mode(self.default_developper_mode) self.set_experimental_mode(self.default_experiment_mode) + self.set_username(self.default_username) super().sync() diff --git a/src/lce_qt_launcher/views/launcher.py b/src/lce_qt_launcher/views/launcher.py index a3d4b9c..76ee51f 100644 --- a/src/lce_qt_launcher/views/launcher.py +++ b/src/lce_qt_launcher/views/launcher.py @@ -138,18 +138,7 @@ class LauncherView(QMainWindow): """_summary_ Open the Load Save File Dialog """ features.load_instance_from_file(self, instanceManager, appContext, buildInfo, appData) - self.ui.instanceNameLabel.setText(instanceManager.instance.name) - self.image_label = instanceManager.instance.image - self.news_feed = instanceManager.instance.news_feed - self.instance_name = instanceManager.instance.name - self.ui.usernameInputBox.setText(instanceManager.instance.username) - self.ui.versionsComboBox.setEditText(instanceManager.instance.version) - self.ui.pathInputBox.setText(instanceManager.instance.installation_path) - self.ui.repoURLInputBox.setText(instanceManager.instance.repo_url) - pixmap = QPixmap(self.image_label) - self.ui.instance_img.setPixmap(pixmap) - self.ui.repo_name_branch.setText(self.instance_name) - self.ui.newsEngineView.setUrl(self.news_feed) + self.loadInstanceInForm(instanceManager) def showSystemInformationActionCommand() -> None: """_summary_ Show the system info dialog @@ -202,19 +191,6 @@ class LauncherView(QMainWindow): inst_dict: dict[str, str] = json.load(instance) instanceManager.instance.load_inst_from_dict(inst_dict) instanceManager.instance.display() - self.ui.instanceNameInputBox.setText(instanceManager.instance.name) - self.image_label = instanceManager.instance.image - self.news_feed = instanceManager.instance.news_feed - self.instance_name = instanceManager.instance.name - self.ui.usernameInputBox.setText(instanceManager.instance.username) - self.ui.versionsComboBox.setEditText(instanceManager.instance.version) - self.ui.pathInputBox.setText(instanceManager.instance.installation_path) - self.ui.repoURLInputBox.setText(instanceManager.instance.repo_url) - pixmap = QPixmap(self.image_label) - self.ui.instance_img.setPixmap(pixmap) - self.ui.repo_name_branch.setText(self.instance_name) - self.ui.newsEngineView.setUrl(self.news_feed) - self.ui.steamLinkValue.setText(instanceManager.instance.steam_link) else: term_service.print_information("No file argument given or file not found. Loading default instance.") except json.JSONDecodeError as err: @@ -396,32 +372,51 @@ class LauncherView(QMainWindow): self.ui.InstancesList.setEnabled(False) - self.profile: QWebEngineProfile = self.ui.marketplacesWebsiteEngine.page().profile() - self.profile.downloadRequested.connect(self.handleDownloadCommand) + self.setup_web_engine() self.versionlabel: QLabel = QLabel(f"Version {buildInfo.version}") self.ui.statusbar.addPermanentWidget(self.versionlabel) holyday_label: QLabel = QLabel(holiday.get_holiday()) self.ui.statusbar.addWidget(holyday_label) + + self.loadInstanceInForm(instanceManager) + + if not instanceManager.is_installable(): + self.ui.installButton.setEnabled(False) + + def setup_web_engine(self): + # 1. Get the current active page + page = self.ui.marketplacesWebsiteEngine.page() + + # 2. Extract and strictly bind the profile + self.browser_profile = page.profile() + + # 3. Connect the signal + self.browser_profile.downloadRequested.connect(self.handleDownloadCommand) def handleDownloadCommand(self, download: QWebEngineDownloadRequest): """Processes the PySide6 download stream request.""" - suggested_path = str(Path.home() / download.suggestedFileName()) - file_path, _ = QFileDialog.getSaveFileName(self, "Save Downloaded File", suggested_path) - - if file_path: - target_path = Path(file_path) - download.setDownloadDirectory(str(target_path.parent)) - download.setDownloadFileName(target_path.name) - download.accept() - download.finished.connect(lambda: print("File download completed successfully.")) + print("Download Started!") + + path_str, _ = QFileDialog.getSaveFileName(None, "Save File", download.downloadFileName()) + + if path_str: + save_path = Path(path_str) + # Safely extract directory and filename regardless of OS (Windows/Mac/Linux) + download.setDownloadDirectory(str(save_path.parent)) + download.setDownloadFileName(save_path.name) + download.accept() else: download.cancel() + def loadInstanceCommand(self, data : dict[str, str], instanceManager : InstanceManager, ) -> None: instance = Instance() instance.load_inst_from_dict(data) features.load_instance_from_instance(instanceManager, instance) + self.loadInstanceInForm(instanceManager) + + def loadInstanceInForm(self, instanceManager : InstanceManager): self.ui.instanceNameInputBox.setText(instanceManager.instance.name) self.image_label = instanceManager.instance.image self.news_feed = instanceManager.instance.news_feed @@ -430,8 +425,9 @@ class LauncherView(QMainWindow): self.ui.versionsComboBox.setEditText(instanceManager.instance.version) self.ui.pathInputBox.setText(instanceManager.instance.installation_path) self.ui.repoURLInputBox.setText(instanceManager.instance.repo_url) - pixmap: QPixmap = QPixmap(self.image_label) + pixmap = QPixmap(self.image_label) self.ui.instance_img.setPixmap(pixmap) self.ui.repo_name_branch.setText(self.instance_name) - self.ui.newsEngineView.setUrl(self.news_feed) - self.ui.steamLinkValue.setText(instanceManager.instance.steam_link) \ No newline at end of file + self.ui.newsEngineView.setUrl(self.news_feed) + if not instanceManager.is_installable(): + self.ui.installButton.setEnabled(False) \ No newline at end of file diff --git a/src/settingDialog.ui b/src/settingDialog.ui index 0b13c7c..3d2fb4d 100644 --- a/src/settingDialog.ui +++ b/src/settingDialog.ui @@ -7,7 +7,7 @@ 0 0 692 - 284 + 378 @@ -27,7 +27,57 @@ QFrame::Shadow::Raised - + + + + + + + :/assets/gear.gif + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + true + + + + true + PreferFullHinting + + + + Check Holiday + + + Check Holiday and display them + + + checkboxHoliday + + + Qt::LayoutDirection::LeftToRight + + + Show Holiday + + + + + + false + + + false + + + + @@ -54,19 +104,6 @@ - - - - - - - :/assets/gear.gif - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - @@ -108,15 +145,16 @@ - - + + + 19 true - Languages + Settings (Experimental GUI) @@ -147,7 +185,7 @@ - + true @@ -187,6 +225,18 @@ + + + + + true + + + + Languages + + + @@ -199,57 +249,7 @@ - - - - true - - - - true - PreferFullHinting - - - - Check Holiday - - - Check Holiday and display them - - - checkboxHoliday - - - Qt::LayoutDirection::LeftToRight - - - Show Holiday - - - - - - false - - - false - - - - - - - - 19 - true - - - - Settings (Experimental GUI) - - - - + @@ -264,6 +264,21 @@ + + + + + true + + + + Username + + + + + +