Skip to content

Commit

Permalink
Remove legacy ini config compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
SaifAqqad committed Jun 10, 2023
1 parent 0d10a80 commit ab99f01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 36 deletions.
37 changes: 3 additions & 34 deletions src/config/Config.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@ class Config {
; Set Json options
JSON.EmptyObjectsAsArrays:= 1
if(!FileExist(A_ScriptDir "\config.json") || util_IsFileEmpty(A_ScriptDir "\config.json")){
if(FileExist(A_ScriptDir "\config.ini")){
isFirstLaunch:=0
this.importIniConfig()
}else{
isFirstLaunch:=1
this.DefaultProfile:= this.createProfile("Default").ProfileName
this.exportConfig()
}
isFirstLaunch:=1
this.DefaultProfile:= this.createProfile("Default").ProfileName
this.exportConfig()
}else{
isFirstLaunch:=0
Try this.importConfig()
Expand Down Expand Up @@ -59,32 +54,6 @@ class Config {
this.Delete("UseCustomSounds")
}

importIniConfig(){
util_log("[Config] Importing config.ini")
iniProfile:= { "afkTimeout":0
, "ExcludeFullscreen":0
, "Microphone":"capture"
, "MuteHotkey":""
, "OnscreenFeedback":0
, "ProfileName":"Default"
, "PushToTalk":0
, "SoundFeedback":0
, "UnmuteHotkey":""
, "UpdateWithSystem":1}
for key in iniProfile {
IniRead, iniVal, %A_ScriptDir%\config.json, settings, %key%
if(iniVal = "ERROR")
continue
if val is number
iniVal+=0
iniProfile[key]:= iniVal
}
dfProfile:= this.createProfile(iniProfile)
this.DefaultProfile:= dfProfile.ProfileName
this.exportConfig()
FileDelete, config.ini
}

exportConfig(){
util_log("[Config] exporting the config object")
jsonStr:= JSON.Dump(this,4)
Expand Down
4 changes: 2 additions & 2 deletions src/config/ProfileTemplate.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class ProfileTemplate {
this.ExcludeFullscreen := 0
this.OSDPos := { x: -1, y: -1 }

this.UpdateWithSystem := 1
this.afkTimeout := 0
this.LinkedApp := ""
this.PTTDelay := 100

this.LinkedApp := ""

this.OverlayPos := { x: -1, y: -1 }
this.OverlayShow := 2
this.OverlayTheme := 0
Expand Down

0 comments on commit ab99f01

Please sign in to comment.