diff --git a/src/components/ProfileButton.vue b/src/components/ProfileButton.vue
index a4e2160..9c826d4 100644
--- a/src/components/ProfileButton.vue
+++ b/src/components/ProfileButton.vue
@@ -2,42 +2,50 @@
+
-
+ @select="currentProfileId=profile.id"
+ @duplicate="duplicateProfile(profile.id)"
+ @delete="deleteProfile(profile.id)" />
@@ -92,6 +94,47 @@ const filteredProfiles = computed(() => {
})
})
+function newProfileId(originalId = '') {
+ let id = originalId
+ if (originalId) {
+ do {
+ id = Math.floor((parseInt(id) + 1) % 9999).toString().padStart(4, '0')
+ } while (store.profileIds.includes(id))
+ } else {
+ do {
+ id = Math.floor(Math.random() * 9999).toString().padStart(4, '0')
+ } while (store.profileIds.includes(id))
+ }
+ return id
+}
+
+function newProfileName(originalName) {
+ let name = originalName
+ let i = 1
+ while (profiles.value.find(p => p.name === name)) {
+ name = `${originalName}-${i++}`
+ }
+ return name
+}
+
+const duplicateProfile = (id) => {
+ const profile = profiles.value.find(p => p.id === id)
+ const profileIndex = profiles.value.indexOf(profile)
+ const newProfile = JSON.parse(JSON.stringify(profile))
+ newProfile.id = newProfileId(id)
+ newProfile.name = newProfileName(profile.name)
+ profiles.value.splice(profileIndex + 1, 0, newProfile)
+}
+
+const deleteProfile = (id) => {
+ const profile = profiles.value.find(p => p.id === id)
+ const profileIndex = profiles.value.indexOf(profile)
+ profiles.value.splice(profileIndex, 1)
+ if (currentProfileId.value === id && profiles.value.length > 0) {
+ currentProfileId.value = profiles.value[0].id
+ }
+}
+
const filteredProfilesByTag = computed(() => {
const map = new Map()
filteredProfiles.value.forEach(profile => {
diff --git a/src/data/nanoConfig.json b/src/data/nanoConfig.json
index 1b8b907..b86c842 100644
--- a/src/data/nanoConfig.json
+++ b/src/data/nanoConfig.json
@@ -1,8 +1,8 @@
{
"profiles": [
{
- "id": "5867",
- "name": "NEW PROFILE",
+ "id": "1732",
+ "name": "Official Profile #1",
"profileTag": "Binaris",
"profileConfig": {
"profileDesc": "KORG MINILOGUE OSCILLATOR 1",
@@ -52,10 +52,62 @@
"guiEnable": true
}
},
+ {
+ "id": "5867",
+ "name": "My First Profile 😳",
+ "profileTag": "Custom",
+ "profileConfig": {
+ "profileDesc": "KORG MINILOGUE OSCILLATOR 1",
+ "profileType": 1,
+ "showDesc": true
+ },
+ "feedbackConfig": {
+ "feedbackEn": true,
+ "feedbackType": "fd",
+ "multiRev": false,
+ "feedbackStrength": 1,
+ "endstopStrength": 1,
+ "outputRamp": 10000,
+ "pos": 140,
+ "secondaryHaptic": true,
+ "secondaryVol": 5
+ },
+ "mappingConfig": {
+ "internalMacro": false,
+ "knobMap": "arrL",
+ "switchA": "shift",
+ "switchB": "ctrl",
+ "switchC": "alt",
+ "switchD": "esc"
+ },
+ "ledConfig": {
+ "ledEnable": true,
+ "ledBrightness": 100,
+ "ledMode": 1,
+ "primary": {
+ "h": 255,
+ "s": 255,
+ "v": 100
+ },
+ "secondary": {
+ "h": 255,
+ "s": 255,
+ "v": 100
+ },
+ "pointer": {
+ "h": 255,
+ "s": 255,
+ "v": 10
+ }
+ },
+ "guiConfig": {
+ "guiEnable": true
+ }
+ },
{
"id": "1232",
- "name": "Another",
- "profileTag": "Binaris",
+ "name": "AN0Th3R Pr0f1l3",
+ "profileTag": "Custom",
"profileConfig": {
"profileDesc": "KORG MINILOGUE OSCILLATOR 1",
"profileType": 1,
@@ -156,9 +208,61 @@
"guiEnable": true
}
},
+ {
+ "id": "2891",
+ "name": "Color Grading M-2",
+ "profileTag": "Third Party",
+ "profileConfig": {
+ "profileDesc": "KORG MINILOGUE OSCILLATOR 1",
+ "profileType": 1,
+ "showDesc": true
+ },
+ "feedbackConfig": {
+ "feedbackEn": true,
+ "feedbackType": "fd",
+ "multiRev": false,
+ "feedbackStrength": 1,
+ "endstopStrength": 1,
+ "outputRamp": 10000,
+ "pos": 140,
+ "secondaryHaptic": true,
+ "secondaryVol": 5
+ },
+ "mappingConfig": {
+ "internalMacro": false,
+ "knobMap": "arrL",
+ "switchA": "shift",
+ "switchB": "ctrl",
+ "switchC": "alt",
+ "switchD": "esc"
+ },
+ "ledConfig": {
+ "ledEnable": true,
+ "ledBrightness": 100,
+ "ledMode": 1,
+ "primary": {
+ "h": 255,
+ "s": 255,
+ "v": 100
+ },
+ "secondary": {
+ "h": 255,
+ "s": 255,
+ "v": 100
+ },
+ "pointer": {
+ "h": 255,
+ "s": 255,
+ "v": 10
+ }
+ },
+ "guiConfig": {
+ "guiEnable": true
+ }
+ },
{
"id": "5238",
- "name": "sdfsdf",
+ "name": "sdfsdf (Invalid)",
"profileTag": "Uncategorized",
"profileConfig": {
"profileDesc": "",
diff --git a/src/store.js b/src/store.js
index 434f267..950623c 100644
--- a/src/store.js
+++ b/src/store.js
@@ -12,4 +12,5 @@ export const store = reactive({
currentProfile: computed(() => {
return store.device.profiles.find(p => p.id === store.currentProfileId)
}),
+ profileIds: computed(() => store.device.profiles.map(p => p.id)),
})
\ No newline at end of file