-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
150eb4e
commit fa0e93f
Showing
9 changed files
with
260 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template> | ||
<div> | ||
<div class="app-region-drag bg-system-background-nav-bar p-2 flex items-baseline space-x-2" style="height: env(titlebar-area-height, 40px); width: env(titlebar-area-width, 0px);"> | ||
<ConnectionState size="small"></ConnectionState> | ||
|
||
<span>obs-layout</span> | ||
</div> | ||
<div class="bg-system-background-nav-bar flex items-center justify-end"> | ||
<Popover class="relative"> | ||
<PopoverButton class="flex items-center hover:bg-gray-300 p-3 space-x-1"> | ||
<CloudUploadIcon class="w-6 h-6 text-gray-600" /> | ||
|
||
<span>Sync</span> | ||
</PopoverButton> | ||
|
||
<PopoverPanel class="absolute z-10 right-0"> | ||
<sync-popover></sync-popover> | ||
</PopoverPanel> | ||
</Popover> | ||
|
||
<button class="flex space-x-1 hover:bg-gray-300 p-3" @click="openSettings"> | ||
<CogIcon class="w-6 h-6 text-gray-600" /> | ||
|
||
<span>Settings</span> | ||
</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
import { CloudUploadIcon, CogIcon } from '@heroicons/vue/outline'; | ||
import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue' | ||
import ConnectionState from './ConnectionState.vue'; | ||
import { ipcRenderer } from 'electron'; | ||
import SyncPopover from './SyncPopover.vue'; | ||
export default defineComponent({ | ||
components: { | ||
CloudUploadIcon, | ||
CogIcon, | ||
ConnectionState, | ||
SyncPopover, | ||
Popover, | ||
PopoverButton, | ||
PopoverPanel | ||
}, | ||
setup() { | ||
const openSettings = () => { | ||
ipcRenderer.send('open-settings'); | ||
} | ||
return { | ||
openSettings | ||
} | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<template> | ||
<div :class="`${backgroundColor} ${sizeClasses} rounded-full`" :title="title"></div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, computed, PropType, toRefs } from 'vue' | ||
import { useStore } from '@/store/app' | ||
import { OBSConnectionState } from '@/obs/connection-state'; | ||
enum Size { | ||
Small = 'small', | ||
Medium = 'medium' | ||
} | ||
export default defineComponent({ | ||
props: { | ||
size: { | ||
type: String as PropType<Size>, | ||
required: true | ||
} | ||
}, | ||
setup(props) { | ||
const store = useStore() | ||
const { size } = toRefs(props); | ||
const sizeClasses = computed(() => { | ||
switch (size.value) { | ||
case Size.Small: | ||
return 'w-2 h-2' | ||
case Size.Medium: | ||
return 'w-4 h-4' | ||
default: | ||
return '' | ||
} | ||
}) | ||
// eslint-disable-next-line vue/return-in-computed-property | ||
const backgroundColor = computed(() => { | ||
switch (store.state.connectionState) { | ||
case OBSConnectionState.Connecting: | ||
return 'bg-yellow-500' | ||
case OBSConnectionState.Connected: | ||
return 'bg-green-500' | ||
case OBSConnectionState.Disconnected: | ||
case OBSConnectionState.Error: | ||
return 'bg-red-500' | ||
} | ||
}) | ||
// eslint-disable-next-line vue/return-in-computed-property | ||
const title = computed(() => { | ||
switch (store.state.connectionState) { | ||
case OBSConnectionState.Disconnected: | ||
return 'Disconnected' | ||
case OBSConnectionState.Connecting: | ||
return 'Connecting' | ||
case OBSConnectionState.Connected: | ||
return 'Connected' | ||
case OBSConnectionState.Error: | ||
return 'Error' | ||
} | ||
}) | ||
return { | ||
backgroundColor, | ||
title, | ||
sizeClasses | ||
} | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<template> | ||
<div class="w-64 p-2 space-y-2 shadow-lg bg-system-background-window"> | ||
<div>Sync current layout to scene:</div> | ||
|
||
<div> | ||
<select class="w-full text-system-text-control bg-system-background-control" v-model="scene"> | ||
<option v-for="scene in scenes" :key="scene" :value="scene" v-text="scene"></option> | ||
</select> | ||
</div> | ||
|
||
<div class="flex justify-end"> | ||
<button class="px-3 py-1 bg-green-500" @click="sync">Sync</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, ref, computed } from 'vue' | ||
import { useStore } from '@/store/app' | ||
import { syncLayout } from '@/integration/obs' | ||
export default defineComponent({ | ||
setup() { | ||
const store = useStore(); | ||
const scene = ref(''); | ||
const scenes = computed(() => store.state.scenes); | ||
const sync = () => { | ||
if (!store.state.rootNode) { return } | ||
syncLayout(store.state.rootNode, scene.value); | ||
} | ||
return { | ||
scene, | ||
scenes, | ||
sync | ||
} | ||
}, | ||
}) | ||
</script> |
Oops, something went wrong.