mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 21:44:55 +03:00
refactor ternary to if statement in window-manager, update constant definitions for better clarity
This commit is contained in:
parent
94b7c8aefe
commit
315d03ae69
@ -136,7 +136,7 @@
|
||||
"telemetry": "Telemetry",
|
||||
"telemetry_description": "Enable anonymous usage statistics",
|
||||
"behavior": "Behavior",
|
||||
"quit_app_instead_minimizing": "Close app instead of minimizing to tray"
|
||||
"quit_app_instead_hiding": "Close app instead of minimizing to tray"
|
||||
},
|
||||
"notifications": {
|
||||
"download_complete": "Download complete",
|
||||
|
@ -132,7 +132,7 @@
|
||||
"telemetry": "Telemetria",
|
||||
"telemetry_description": "Habilitar estatísticas de uso anônimas",
|
||||
"behavior": "Comportamento",
|
||||
"quit_app_instead_minimizing": "Fechar o aplicativo em vez de minimizá-lo"
|
||||
"quit_app_instead_hiding": "Fechar o aplicativo em vez de minimizá-lo"
|
||||
},
|
||||
"notifications": {
|
||||
"download_complete": "Download concluído",
|
||||
|
@ -27,7 +27,7 @@ export class UserPreferences {
|
||||
telemetryEnabled: boolean;
|
||||
|
||||
@Column("boolean", { default: false })
|
||||
quitInXButtonEnabled: boolean;
|
||||
preferQuitInsteadOfHiding: boolean;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
@ -51,11 +51,14 @@ export class WindowManager {
|
||||
this.mainWindow.removeMenu();
|
||||
|
||||
const userPreferences = await userPreferencesRepository.findOne({
|
||||
where: {id: 1},
|
||||
where: { id: 1 },
|
||||
});
|
||||
|
||||
this.mainWindow.on("close", () => {
|
||||
userPreferences?.quitInXButtonEnabled ? app.quit() : WindowManager.mainWindow?.setProgressBar(-1);
|
||||
if (userPreferences?.preferQuitInsteadOfHiding) {
|
||||
app.quit();
|
||||
}
|
||||
WindowManager.mainWindow?.setProgressBar(-1);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ export function Settings() {
|
||||
downloadNotificationsEnabled: false,
|
||||
repackUpdatesNotificationsEnabled: false,
|
||||
telemetryEnabled: false,
|
||||
quitInXButtonEnabled: false,
|
||||
preferQuitInsteadOfHiding: false,
|
||||
});
|
||||
|
||||
const { t } = useTranslation("settings");
|
||||
@ -28,7 +28,8 @@ export function Settings() {
|
||||
repackUpdatesNotificationsEnabled:
|
||||
userPreferences?.repackUpdatesNotificationsEnabled ?? false,
|
||||
telemetryEnabled: userPreferences?.telemetryEnabled ?? false,
|
||||
quitInXButtonEnabled: userPreferences?.quitInXButtonEnabled ?? false,
|
||||
preferQuitInsteadOfHiding:
|
||||
userPreferences?.preferQuitInsteadOfHiding ?? false,
|
||||
});
|
||||
});
|
||||
}, []);
|
||||
@ -113,13 +114,15 @@ export function Settings() {
|
||||
<h3>{t("behavior")}</h3>
|
||||
|
||||
<CheckboxField
|
||||
label={t("quit_app_instead_minimizing")}
|
||||
checked={form.quitInXButtonEnabled}
|
||||
label={t("quit_app_instead_hiding")}
|
||||
checked={form.preferQuitInsteadOfHiding}
|
||||
onChange={() =>
|
||||
updateUserPreferences("quitInXButtonEnabled", !form.quitInXButtonEnabled)
|
||||
updateUserPreferences(
|
||||
"preferQuitInsteadOfHiding",
|
||||
!form.preferQuitInsteadOfHiding
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
@ -105,7 +105,7 @@ export interface UserPreferences {
|
||||
downloadNotificationsEnabled: boolean;
|
||||
repackUpdatesNotificationsEnabled: boolean;
|
||||
telemetryEnabled: boolean;
|
||||
quitInXButtonEnabled: boolean;
|
||||
preferQuitInsteadOfHiding: boolean;
|
||||
}
|
||||
|
||||
export interface HowLongToBeatCategory {
|
||||
|
Loading…
Reference in New Issue
Block a user