aboutsummaryrefslogtreecommitdiff
path: root/src-vue
diff options
context:
space:
mode:
Diffstat (limited to 'src-vue')
-rw-r--r--src-vue/src/plugins/store.ts15
-rw-r--r--src-vue/src/views/SettingsView.vue18
2 files changed, 29 insertions, 4 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts
index 8f0c3fee..0a3b3e21 100644
--- a/src-vue/src/plugins/store.ts
+++ b/src-vue/src/plugins/store.ts
@@ -61,7 +61,7 @@ export const store = createStore<FlightCoreStore>({
state(): FlightCoreStore {
return {
developer_mode: false,
- game_install: {} as unknown as GameInstall,
+ game_install: {game_path: undefined, profile: undefined, install_type: "UNKNOWN"} as unknown as GameInstall,
available_profiles: [],
@@ -151,8 +151,15 @@ export const store = createStore<FlightCoreStore>({
await persistentStore.set('game-install', { value: state.game_install });
await persistentStore.save(); // explicit save to disk
+ // We can no longer be sure if our last profile is valid, lets reset to be sure
+ state.game_install.profile = "R2Northstar";
+
// Check for Northstar install
store.commit('checkNorthstarUpdates');
+
+ // Since we are in a new game directory, lets see if there are any profiles
+ store.commit('fetchProfiles');
+
}
else {
// Not valid Titanfall2 install
@@ -320,6 +327,12 @@ export const store = createStore<FlightCoreStore>({
);
},
async fetchProfiles(state: FlightCoreStore) {
+ // To fetch profiles we need a valid game path
+ if (!state.game_install.game_path) {
+ return;
+ }
+
+
await invoke("fetch_profiles", { gameInstall: state.game_install })
.then((message) => {
state.available_profiles = message as string[];
diff --git a/src-vue/src/views/SettingsView.vue b/src-vue/src/views/SettingsView.vue
index b1a62c56..88a5d588 100644
--- a/src-vue/src/views/SettingsView.vue
+++ b/src-vue/src/views/SettingsView.vue
@@ -34,9 +34,9 @@
<!-- Northstar Active Profile -->
<div class="fc_parameter__panel" v-if="$store.state.developer_mode">
<h3>{{ $t('settings.profile.active') }}</h3>
- <el-dropdown trigger="click">
+ <el-dropdown trigger="click" :disabled="!availableProfiles.length">
<el-button>
- {{ $store.state.game_install.profile }} <el-icon class="el-icon--right"><arrow-down /></el-icon>
+ {{ activeProfile }} <el-icon class="el-icon--right" v-if="availableProfiles.length"><arrow-down /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
@@ -173,7 +173,10 @@ export default defineComponent({
await persistentStore.save(); // explicit save to disk
}
},
- availableProfiles(): Object {
+ activeProfile(): String {
+ return this.$store.state.game_install.profile || "None";
+ },
+ availableProfiles(): Object[] {
let profiles = this.$store.state.available_profiles
// convert string array to object array so we can fill a table
@@ -209,6 +212,15 @@ export default defineComponent({
});
},
async openGameInstallFolder() {
+ // Verify the game path is actually set
+ if (!this.$store.state.game_install.game_path) {
+ showErrorNotification(
+ i18n.global.tc('notification.game_folder.not_found.text'),
+ i18n.global.tc('notification.game_folder.not_found.title')
+ );
+ return;
+ }
+
// Opens the folder in default file explorer application
await open(`${this.$store.state.game_install.game_path}`);
},