Skip to content

Commit 6c8fb9c

Browse files
committed
Ported remaining settings and cleaned up Manager.vue
1 parent f055e93 commit 6c8fb9c

18 files changed

Lines changed: 779 additions & 551 deletions
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<script lang="ts" setup>
2+
import { computed } from 'vue';
3+
import ModalCard from '../../components/ModalCard.vue';
4+
import { getStore } from '../../providers/generic/store/StoreProvider';
5+
import { State } from '../../store';
6+
import ManifestV2 from '../../model/ManifestV2';
7+
8+
const store = getStore<State>();
9+
10+
const isOpen = computed(() => store.state.modals.isDependencyStringsModalOpen);
11+
const localModList = computed<ManifestV2[]>(() => store.state.profile.modList);
12+
13+
function close() {
14+
store.commit('closeDependencyStringsModal');
15+
}
16+
</script>
17+
18+
<template>
19+
<ModalCard id="dependency-strings-modal" v-show="isOpen" :is-active="isOpen" @close-modal="close">
20+
<template v-slot:header>
21+
<h2 class="modal-title">Dependency string list</h2>
22+
</template>
23+
<template v-slot:body>
24+
<ul>
25+
<li v-for="(mod, index) in localModList" :key="`dep-str-${index}`">
26+
{{ mod.getName() }}-{{ mod.getVersionNumber().toString() }}
27+
</li>
28+
</ul>
29+
</template>
30+
<template v-slot:footer>
31+
<button class="button is-info" @click="close">Close</button>
32+
</template>
33+
</ModalCard>
34+
</template>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script lang="ts" setup>
2+
import ModalCard from '../../components/ModalCard.vue';
3+
import { computed } from 'vue';
4+
import { getStore } from '../../providers/generic/store/StoreProvider';
5+
import { State } from '../../store';
6+
7+
const store = getStore<State>();
8+
9+
const isOpen = computed(() => store.state.modals.isIncorrectSteamDirectoryModalOpen);
10+
11+
function close() {
12+
store.commit("closeIncorrectSteamDirectoryModal");
13+
}
14+
</script>
15+
16+
<template>
17+
<ModalCard id="incorrect-steam-directory-modal" v-show="isOpen" :is-active="isOpen" @close-modal="close">
18+
<template v-slot:header>
19+
<h2 class="modal-title">Failed to set the Steam folder</h2>
20+
</template>
21+
<template v-slot:body>
22+
<p>The Steam executable was not selected.</p>
23+
<p>If this error has appeared but the executable is correct, please run as administrator.</p>
24+
</template>
25+
<template v-slot:footer>
26+
<button class="button is-info" @click="close">
27+
I understand
28+
</button>
29+
</template>
30+
</ModalCard>
31+
</template>
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<script lang="ts" setup>
2+
import { computed, ref, watch } from 'vue';
3+
import ModalCard from '../../components/ModalCard.vue';
4+
import { getStore } from '../../providers/generic/store/StoreProvider';
5+
import { State } from '../../store';
6+
import ManagerSettings from '../../r2mm/manager/ManagerSettings';
7+
import GameInstructions from '../../r2mm/launching/instructions/GameInstructions';
8+
import GameRunnerProvider from '../../providers/generic/game/GameRunnerProvider';
9+
import GameInstructionParser from '../../r2mm/launching/instructions/GameInstructionParser';
10+
import R2Error from '../../model/errors/R2Error';
11+
12+
const store = getStore<State>();
13+
14+
const isOpen = computed(() => store.state.modals.isLaunchArgumentsModalOpen);
15+
16+
const activeGame = computed(() => store.state.activeGame);
17+
const profile = computed(() => store.getters['profile/activeProfile']);
18+
19+
const settings = ref<ManagerSettings | null>(null);
20+
const launchArguments = ref<string>('');
21+
const doorstopTarget = ref<string>('');
22+
const vanillaLaunchArgs = ref<string>('');
23+
24+
async function load() {
25+
settings.value = await ManagerSettings.getSingleton(activeGame.value);
26+
launchArguments.value = settings.value.getContext().gameSpecific.launchParameters;
27+
28+
GameInstructions.getInstructionsForGame(activeGame.value, profile.value).then(instructions => {
29+
vanillaLaunchArgs.value = instructions.vanillaParameterList.map(value => `"${value}"`).join(' ');
30+
});
31+
32+
GameRunnerProvider.instance.getGameArguments(activeGame.value, profile.value).then(target => {
33+
if (target instanceof R2Error) {
34+
doorstopTarget.value = '';
35+
} else {
36+
GameInstructionParser.parseList(target, activeGame.value, profile.value).then(instructions => {
37+
if (instructions instanceof R2Error) {
38+
throw instructions;
39+
}
40+
doorstopTarget.value = instructions.map(value => `"${value}"`).join(' ');
41+
});
42+
}
43+
});
44+
}
45+
46+
watch(isOpen, (open) => {
47+
if (open) {
48+
load();
49+
}
50+
});
51+
52+
async function updateLaunchArguments() {
53+
if (settings.value) {
54+
await settings.value.setLaunchParameters(launchArguments.value);
55+
}
56+
close();
57+
}
58+
59+
function close() {
60+
store.commit('closeLaunchArgumentsModal');
61+
}
62+
</script>
63+
64+
<template>
65+
<ModalCard id="launch-arguments-modal" v-show="isOpen" :is-active="isOpen" @close-modal="close">
66+
<template v-slot:header>
67+
<h2 class="modal-title">Set custom launch arguments</h2>
68+
</template>
69+
<template v-slot:body>
70+
<p>Some arguments are provided by default:</p>
71+
<br/>
72+
<p>Modded:
73+
<br/>
74+
<code v-if="doorstopTarget.length > 0">{{ doorstopTarget }}</code>
75+
<code v-else>These arguments will be available after installing a mod loader.</code>
76+
</p>
77+
<br/>
78+
<p>Vanilla:
79+
<br/>
80+
<code>{{ vanillaLaunchArgs }}</code>
81+
</p>
82+
<br/>
83+
<p>
84+
<strong>Please note that these are called against the Steam executable. Be careful when
85+
entering custom launch arguments.</strong>
86+
</p>
87+
<br/>
88+
<input
89+
v-model="launchArguments"
90+
id="launch-arguments-modal-input"
91+
class="input"
92+
placeholder="Enter arguments"
93+
autocomplete="off"
94+
/>
95+
</template>
96+
<template v-slot:footer>
97+
<button class="button is-info" @click="updateLaunchArguments">
98+
Update launch arguments
99+
</button>
100+
</template>
101+
</ModalCard>
102+
</template>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<script lang="ts" setup>
2+
import { computed } from 'vue';
3+
import ModalCard from '../../components/ModalCard.vue';
4+
import { getStore } from '../../providers/generic/store/StoreProvider';
5+
import { State } from '../../store';
6+
7+
const store = getStore<State>();
8+
9+
const isOpen = computed(() => store.state.modals.isSteamInstallationValidationModalOpen);
10+
const activeGame = computed(() => store.state.activeGame);
11+
12+
function close() {
13+
store.commit('closeSteamInstallationValidationModal');
14+
}
15+
</script>
16+
17+
<template>
18+
<ModalCard id="steam-installation-validation-modal" v-show="isOpen" :is-active="isOpen" @close-modal="close">
19+
<template v-slot:header>
20+
<h2 class="modal-title">Clearing the {{ activeGame.displayName }} installation directory</h2>
21+
</template>
22+
<template v-slot:body>
23+
<div class="notification is-warning">
24+
<p>
25+
You will not be able to launch the game until
26+
Steam has verified the integrity of the game files.
27+
</p>
28+
</div>
29+
<p>
30+
Steam will be started and will attempt to verify the
31+
integrity of {{ activeGame.displayName }}.
32+
</p>
33+
<br/>
34+
<p>
35+
Please check the Steam window for validation progress.
36+
If the window has not yet appeared, please be patient.
37+
</p>
38+
</template>
39+
<template v-slot:footer>
40+
<button class="button is-info" @click="close">
41+
I understand
42+
</button>
43+
</template>
44+
</ModalCard>
45+
</template>

src/components/settings-components/v2/SettingsView.vue

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,41 @@
22
import { computed, ref } from 'vue';
33
import VersionNumber from '../../../model/VersionNumber';
44
import ManagerInformation from '../../../_managerinf/ManagerInformation';
5+
import { getStore } from '../../../providers/generic/store/StoreProvider';
6+
import { State } from '../../../store';
7+
import appWindow from '../../../providers/node/app/app_window';
58
import { Hero } from '../../all';
69
import SettingsSection from './SettingsSection.vue';
710
import GameDirectory from './entries/GameDirectory.vue';
811
import DataDirectory from './entries/DataDirectory.vue';
12+
import SteamDirectory from './entries/SteamDirectory.vue';
913
import ExportProfile from './entries/ExportProfile.vue';
1014
import Theme from './entries/Theme.vue';
1115
import ExpandCards from './entries/ExpandCards.vue';
1216
import FunkyMode from './entries/FunkyMode.vue';
13-
import RefreshOnlineModList from './entries/RefreshOnlineModList.vue';
17+
import OnlineModList from './entries/OnlineModList.vue';
1418
import ModState from './entries/ModState.vue';
1519
import UpdateAllMods from './entries/UpdateAllMods.vue';
16-
import DownloadCache from './entries/DownloadCache.vue';
20+
import ModCache from './entries/ModCache.vue';
1721
import CopyLogToClipboard from './entries/CopyLogToClipboard.vue';
1822
import CopyTroubleshooting from './entries/CopyTroubleshooting.vue';
1923
import ImportLocalMod from './entries/ImportLocalMod.vue';
20-
import CleanModCache from './entries/CleanModCache.vue';
21-
import CleanOnlineModListCache from './entries/CleanOnlineModListCache.vue';
2224
import ToggleCdn from './entries/ToggleCdn.vue';
25+
import LaunchArguments from './entries/LaunchArguments.vue';
26+
import ShowDependencyStrings from './entries/ShowDependencyStrings.vue';
27+
import ResetGameInstallation from './entries/ResetGameInstallation.vue';
28+
import ChangeLaunchBehaviour from './entries/ChangeLaunchBehaviour.vue';
2329
2430
const searchTerm = ref<string>('');
2531
2632
const managerVersionNumber = ref<VersionNumber>(ManagerInformation.VERSION);
2733
const appName = computed(() => ManagerInformation.APP_NAME);
2834
29-
const categories = ['All', 'Directories', 'Profile', 'Appearance', 'Debugging', 'Other'] as const;
35+
const store = getStore<State>();
36+
const isSteamGame = computed<boolean>(() => store.state.activeGame.isInstalledViaSteam);
37+
const isSteamAndNotWindows = computed<boolean>(() => ['linux', 'darwin'].includes(appWindow.getPlatform()) && isSteamGame.value);
38+
39+
const categories = ['All', 'Directories', 'Profile', 'Appearance', 'Debugging', 'Modpacks', 'Other'] as const;
3040
type Category = typeof categories[number];
3141
3242
const activeCategory = ref<Category>('All');
@@ -74,6 +84,9 @@ function isVisible(section: Category): boolean {
7484
<SettingsSection v-if="isVisible('Directories')" name="Directories">
7585
<DataDirectory :search-term="searchTerm"/>
7686
<GameDirectory :search-term="searchTerm"/>
87+
<template v-if="isSteamGame">
88+
<SteamDirectory :search-term="searchTerm"/>
89+
</template>
7790
</SettingsSection>
7891

7992
<SettingsSection v-if="isVisible('Profile')" name="Profile">
@@ -90,16 +103,25 @@ function isVisible(section: Category): boolean {
90103
</SettingsSection>
91104

92105
<SettingsSection v-if="isVisible('Debugging')" name="Debugging">
106+
<LaunchArguments :search-term="searchTerm"/>
107+
<template v-if="isSteamGame">
108+
<ResetGameInstallation :search-term="searchTerm"/>
109+
</template>
110+
<template v-if="isSteamAndNotWindows">
111+
<ChangeLaunchBehaviour :search-term="searchTerm"/>
112+
</template>
93113
<CopyLogToClipboard :search-term="searchTerm"/>
94114
<CopyTroubleshooting :search-term="searchTerm"/>
95-
<DownloadCache :search-term="searchTerm"/>
96-
<CleanModCache :search-term="searchTerm"/>
97-
<CleanOnlineModListCache :search-term="searchTerm"/>
115+
<ModCache :search-term="searchTerm"/>
98116
<ToggleCdn :search-term="searchTerm"/>
99117
</SettingsSection>
100118

119+
<SettingsSection v-if="isVisible('Modpacks')" name="Modpacks">
120+
<ShowDependencyStrings :search-term="searchTerm"/>
121+
</SettingsSection>
122+
101123
<SettingsSection v-if="isVisible('Other')" name="Other">
102-
<RefreshOnlineModList :search-term="searchTerm"/>
124+
<OnlineModList :search-term="searchTerm"/>
103125
</SettingsSection>
104126
</div>
105127
</div>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<script lang="ts" setup>
2+
import { computed, onMounted, ref, watch } from 'vue';
3+
import Game from '../../../../model/game/Game';
4+
import { getStore } from '../../../../providers/generic/store/StoreProvider';
5+
import { State } from '../../../../store';
6+
import SettingsViewWrapper from '../SettingsViewWrapper.vue';
7+
import { useSettingSearch } from 'src/components/composables/SettingSearchComposable';
8+
import { getLaunchType, LaunchType } from '../../../../model/real_enums/launch/LaunchType';
9+
import { LaunchTypeModalOpen } from '../../../../components/modals/launch-type/LaunchTypeRefs';
10+
11+
const store = getStore<State>();
12+
13+
const props = defineProps<{
14+
searchTerm?: string;
15+
}>();
16+
17+
const activeGame = computed<Game>(() => store.state.activeGame);
18+
const launchType = ref<LaunchType>(LaunchType.AUTO);
19+
20+
const { isVisible } = useSettingSearch(() => props.searchTerm, () => [
21+
'Change launch behaviour',
22+
'Set launch mode',
23+
'Proton',
24+
'Native',
25+
'Auto',
26+
launchType.value,
27+
]);
28+
29+
async function refreshLaunchType() {
30+
launchType.value = await getLaunchType(activeGame.value);
31+
}
32+
33+
onMounted(refreshLaunchType);
34+
watch(activeGame, refreshLaunchType);
35+
36+
watch(LaunchTypeModalOpen, (open) => {
37+
if (!open) {
38+
refreshLaunchType();
39+
}
40+
});
41+
42+
function openLaunchTypeModal() {
43+
LaunchTypeModalOpen.value = true;
44+
}
45+
</script>
46+
47+
<template>
48+
<SettingsViewWrapper >
49+
<template #title>Change launch behaviour</template>
50+
<template #description>
51+
<p>Select a specific launch behaviour. You can tell the manager that a game is explicitly using either Native or Proton.</p>
52+
<p>The current launch behaviour is set to: <strong>{{ launchType }}</strong>.</p>
53+
</template>
54+
<button class="button" @click="openLaunchTypeModal">Change launch behaviour</button>
55+
</SettingsViewWrapper>
56+
</template>

0 commit comments

Comments
 (0)