blob: 0e5498e97196d64e2c506a4148c52f57d0fe8c79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
<template>
<div class="fc_settings__container">
<!-- Game folder location -->
<h3>Manage installation</h3>
<el-input
v-model="$store.state.game_path"
class="w-50 m-2"
placeholder="Choose installation folder"
@click="updateGamePath"
>
<template #prepend>
<el-button icon="Folder" @click="updateGamePath"/>
</template>
</el-input>
<h3>About:</h3>
UI design inspired by <el-link :underline="false" target="_blank" href="https://github.com/TFORevive/tforevive_launcher/" type="primary">TFORevive Launcher</el-link> (not yet public)
</div>
</template>
<script lang="ts">
import { open } from '@tauri-apps/api/dialog';
import { appDir } from '@tauri-apps/api/path';
import { invoke } from "@tauri-apps/api";
import { defineComponent } from "vue";
import { ElNotification } from 'element-plus';
export default defineComponent({
name: "SettingsView",
methods: {
async updateGamePath() {
// Open a selection dialog for directories
const selected = await open({
directory: true,
multiple: false,
defaultPath: await appDir(),
});
if (Array.isArray(selected)) {
// user selected multiple directories
alert("Please only select a single directory");
} else if (selected === null) {
// user cancelled the selection
} else {
// user selected a single directory
// Verify if valid Titanfall2 install location
let is_valid_titanfall2_install = await invoke("verify_install_location", { gamePath: selected }) as boolean;
if (is_valid_titanfall2_install) {
this.$store.state.game_path = selected;
// Check for Northstar install
this.$store.commit('checkNorthstarUpdates');
}
else {
// Not valid Titanfall2 install
ElNotification({
title: 'Wrong folder',
message: "Selected folder is not a valid Titanfall2 install.",
type: 'error',
position: 'bottom-right'
});
}
}
}
},
mounted() {
document.querySelector('input')!.disabled = true;
}
});
</script>
<style scoped>
.fc_settings__container {
max-width: 1200px;
padding: 20px 30px;
margin: 0 auto;
color: white;
}
h3:first-of-type {
margin-top: 0;
margin-bottom: 1em;
text-transform: uppercase;
font-weight: unset;
}
.el-input {
width: 50%;
}
</style>
|