mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-15 04:32:13 +00:00
refactor ternary to if statement in window-manager, update constant definitions for better clarity
This commit is contained in:
parent
94b7c8aefe
commit
315d03ae69
6 changed files with 18 additions and 12 deletions
|
@ -136,7 +136,7 @@
|
||||||
"telemetry": "Telemetry",
|
"telemetry": "Telemetry",
|
||||||
"telemetry_description": "Enable anonymous usage statistics",
|
"telemetry_description": "Enable anonymous usage statistics",
|
||||||
"behavior": "Behavior",
|
"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": {
|
"notifications": {
|
||||||
"download_complete": "Download complete",
|
"download_complete": "Download complete",
|
||||||
|
|
|
@ -132,7 +132,7 @@
|
||||||
"telemetry": "Telemetria",
|
"telemetry": "Telemetria",
|
||||||
"telemetry_description": "Habilitar estatísticas de uso anônimas",
|
"telemetry_description": "Habilitar estatísticas de uso anônimas",
|
||||||
"behavior": "Comportamento",
|
"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": {
|
"notifications": {
|
||||||
"download_complete": "Download concluído",
|
"download_complete": "Download concluído",
|
||||||
|
|
|
@ -27,7 +27,7 @@ export class UserPreferences {
|
||||||
telemetryEnabled: boolean;
|
telemetryEnabled: boolean;
|
||||||
|
|
||||||
@Column("boolean", { default: false })
|
@Column("boolean", { default: false })
|
||||||
quitInXButtonEnabled: boolean;
|
preferQuitInsteadOfHiding: boolean;
|
||||||
|
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
|
|
|
@ -51,11 +51,14 @@ export class WindowManager {
|
||||||
this.mainWindow.removeMenu();
|
this.mainWindow.removeMenu();
|
||||||
|
|
||||||
const userPreferences = await userPreferencesRepository.findOne({
|
const userPreferences = await userPreferencesRepository.findOne({
|
||||||
where: {id: 1},
|
where: { id: 1 },
|
||||||
});
|
});
|
||||||
|
|
||||||
this.mainWindow.on("close", () => {
|
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,
|
downloadNotificationsEnabled: false,
|
||||||
repackUpdatesNotificationsEnabled: false,
|
repackUpdatesNotificationsEnabled: false,
|
||||||
telemetryEnabled: false,
|
telemetryEnabled: false,
|
||||||
quitInXButtonEnabled: false,
|
preferQuitInsteadOfHiding: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useTranslation("settings");
|
const { t } = useTranslation("settings");
|
||||||
|
@ -28,7 +28,8 @@ export function Settings() {
|
||||||
repackUpdatesNotificationsEnabled:
|
repackUpdatesNotificationsEnabled:
|
||||||
userPreferences?.repackUpdatesNotificationsEnabled ?? false,
|
userPreferences?.repackUpdatesNotificationsEnabled ?? false,
|
||||||
telemetryEnabled: userPreferences?.telemetryEnabled ?? false,
|
telemetryEnabled: userPreferences?.telemetryEnabled ?? false,
|
||||||
quitInXButtonEnabled: userPreferences?.quitInXButtonEnabled ?? false,
|
preferQuitInsteadOfHiding:
|
||||||
|
userPreferences?.preferQuitInsteadOfHiding ?? false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -113,13 +114,15 @@ export function Settings() {
|
||||||
<h3>{t("behavior")}</h3>
|
<h3>{t("behavior")}</h3>
|
||||||
|
|
||||||
<CheckboxField
|
<CheckboxField
|
||||||
label={t("quit_app_instead_minimizing")}
|
label={t("quit_app_instead_hiding")}
|
||||||
checked={form.quitInXButtonEnabled}
|
checked={form.preferQuitInsteadOfHiding}
|
||||||
onChange={() =>
|
onChange={() =>
|
||||||
updateUserPreferences("quitInXButtonEnabled", !form.quitInXButtonEnabled)
|
updateUserPreferences(
|
||||||
|
"preferQuitInsteadOfHiding",
|
||||||
|
!form.preferQuitInsteadOfHiding
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|
|
@ -105,7 +105,7 @@ export interface UserPreferences {
|
||||||
downloadNotificationsEnabled: boolean;
|
downloadNotificationsEnabled: boolean;
|
||||||
repackUpdatesNotificationsEnabled: boolean;
|
repackUpdatesNotificationsEnabled: boolean;
|
||||||
telemetryEnabled: boolean;
|
telemetryEnabled: boolean;
|
||||||
quitInXButtonEnabled: boolean;
|
preferQuitInsteadOfHiding: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HowLongToBeatCategory {
|
export interface HowLongToBeatCategory {
|
||||||
|
|
Loading…
Reference in a new issue