forked from akanyan/STARTLINER
feat: groundwork for multi-profile support
This commit is contained in:
@ -7,53 +7,31 @@ import TabPanel from 'primevue/tabpanel';
|
||||
import TabPanels from 'primevue/tabpanels';
|
||||
import Tabs from 'primevue/tabs';
|
||||
import { onOpenUrl } from '@tauri-apps/plugin-deep-link';
|
||||
import { open } from '@tauri-apps/plugin-dialog';
|
||||
import ModList from './ModList.vue';
|
||||
import ModStore from './ModStore.vue';
|
||||
import Options from './Options.vue';
|
||||
import ProfileList from './ProfileList.vue';
|
||||
import StartButton from './StartButton.vue';
|
||||
import { usePkgStore } from '../stores';
|
||||
import { changePrimaryColor } from '../util';
|
||||
import { usePkgStore, usePrfStore } from '../stores';
|
||||
|
||||
const store = usePkgStore();
|
||||
store.setupListeners();
|
||||
const pkg = usePkgStore();
|
||||
const prf = usePrfStore();
|
||||
|
||||
pkg.setupListeners();
|
||||
prf.setupListeners();
|
||||
|
||||
const currentTab = ref('3');
|
||||
|
||||
const loadProfile = async (openWindow: boolean) => {
|
||||
await store.reloadProfile();
|
||||
|
||||
if (store.profile === null && openWindow) {
|
||||
const exePath = await open({
|
||||
multiple: false,
|
||||
directory: false,
|
||||
filters: [
|
||||
{
|
||||
name: 'mu3.exe' /* or chusanApp.exe'*/,
|
||||
extensions: ['exe'],
|
||||
},
|
||||
],
|
||||
});
|
||||
if (exePath !== null) {
|
||||
await store.initProfile(exePath);
|
||||
}
|
||||
}
|
||||
if (store.profile !== null) {
|
||||
changePrimaryColor(store.profile.game);
|
||||
currentTab.value = '0';
|
||||
}
|
||||
|
||||
await store.reloadAll();
|
||||
};
|
||||
|
||||
const isProfileDisabled = computed(() => store.profile === null);
|
||||
|
||||
onOpenUrl((urls) => {
|
||||
console.log('deep link:', urls);
|
||||
});
|
||||
const isProfileDisabled = computed(() => prf.current === null);
|
||||
|
||||
onMounted(async () => {
|
||||
await loadProfile(false);
|
||||
await prf.reloadList();
|
||||
await prf.reload();
|
||||
|
||||
if (prf.current !== null) {
|
||||
await pkg.reloadAll();
|
||||
currentTab.value = '0';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -93,14 +71,10 @@ onMounted(async () => {
|
||||
missing.<br />Existing features are expected to break any
|
||||
time.
|
||||
<div v-if="isProfileDisabled">
|
||||
<br />Select <code>mu3.exe</code> to create a
|
||||
profile:<br />
|
||||
<Button
|
||||
label="Create profile"
|
||||
icon="pi pi-plus"
|
||||
aria-label="open-executable"
|
||||
@click="loadProfile(true)"
|
||||
/><br />
|
||||
<br />Select <code>mu3.exe</code> to create a profile:
|
||||
</div>
|
||||
<ProfileList />
|
||||
<div v-if="isProfileDisabled">
|
||||
<div
|
||||
style="
|
||||
margin-top: 5px;
|
||||
@ -115,10 +89,15 @@ onMounted(async () => {
|
||||
(this will change in the future)
|
||||
</div>
|
||||
<img
|
||||
v-if="store.profile?.game === 'Ongeki'"
|
||||
v-if="prf.current?.game === 'ongeki'"
|
||||
src="/sticker-ongeki.svg"
|
||||
class="fixed bottom-0 right-0"
|
||||
/>
|
||||
<img
|
||||
v-else-if="prf.current?.game === 'chunithm'"
|
||||
src="/sticker-chunithm.svg"
|
||||
class="fixed bottom-0 right-0"
|
||||
/>
|
||||
<br /><br /><br />
|
||||
<Button
|
||||
style="position: fixed; left: 10px; bottom: 10px"
|
||||
|
Reference in New Issue
Block a user