Skip to content

Commit

Permalink
Merge branch 'characters'
Browse files Browse the repository at this point in the history
  • Loading branch information
shivas committed Aug 29, 2021
2 parents 3870992 + 052df05 commit 7f00819
Show file tree
Hide file tree
Showing 15 changed files with 828 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tasks:
resources:
desc: Compile resource file
cmds:
- rsrc -manifest ./cmd/abyss-blackbox/main.manifest -ico ./trig_96x96.ico -o ./cmd/abyss-blackbox/rsrc.syso
- rsrc -manifest ./cmd/abyss-blackbox/main.manifest -ico ./trig_96x96.ico,./images/plus.ico,./images/switch-char.ico -o ./cmd/abyss-blackbox/rsrc.syso

release:
desc: Builds artifacts for release
Expand Down
2 changes: 2 additions & 0 deletions cmd/abyss-blackbox/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ type captureConfig struct {
Weather70ShortcutText string
Weather70Shortcut walk.Shortcut
LootRecordDiscriminator string
ActiveCharacter int32
AutoUpload bool
}

// SetRecorderShortcut satisfies ShortcutSetter interface.
Expand Down
48 changes: 45 additions & 3 deletions cmd/abyss-blackbox/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import (
"github.com/lxn/walk"
"github.com/lxn/win"
"github.com/shivas/abyss-blackbox/combatlog"
"github.com/shivas/abyss-blackbox/internal/charmanager"
"github.com/shivas/abyss-blackbox/internal/mainwindow"
"github.com/shivas/abyss-blackbox/internal/uploader"
"github.com/shivas/abyss-blackbox/screen"
)

Expand Down Expand Up @@ -61,9 +63,35 @@ func main() {
logFiles, _ := clr.GetLogFiles(time.Now(), time.Duration(24)*time.Hour)
charMap := clr.MapCharactersToFiles(logFiles)

armw := mainwindow.NewAbyssRecorderWindow(currentSettings, drawStuff, comboModel)
charManager := charmanager.New(func(s1, s2 string) {
notificationChannel <- NotificationMessage{Title: s1, Message: s2}
})

actions := make(map[string]walk.EventHandler)
actions["add_character"] = charManager.EventHandlerCharAdd

armw := mainwindow.NewAbyssRecorderWindow(currentSettings, drawStuff, comboModel, actions)
_ = charManager.MainWindow(armw).LoadCache() // assign window to control widgets
charManager.RefreshUI()

mainwindow.BuildSettingsWidget(charMap, armw.CombatLogCharacterGroup)

charManager.OnActivateCharacter =
func(char charmanager.Character) {
if char.CharacterID > 0 {
_ = armw.MainWindow.SetTitle("Abyssal.Space Blackbox Recorder - " + char.CharacterName)
}

notificationChannel <- NotificationMessage{Title: "Active character set to:", Message: char.CharacterName}

currentSettings.ActiveCharacter = char.CharacterID
armw.AutoUploadCheckbox.SetEnabled(char.CharacterID > 0)

_ = writeConfig(currentSettings)
}

_ = charManager.SetActiveCharacter(currentSettings.ActiveCharacter)

if len(foundEVEClientWindows) == 0 {
walk.MsgBox(armw.MainWindow, "No signed in EVE clients detected", "Please login with atleast one character and then restart this application", walk.MsgBoxIconWarning)
}
Expand Down Expand Up @@ -125,10 +153,24 @@ func main() {
armw.TestServer.SetEnabled(false)
_ = armw.RecordingButton.SetText("Stop recording")
} else {
err = recorder.Stop()
if err != nil {
filename, errr := recorder.Stop()
if errr != nil {
walk.MsgBox(armw.MainWindow, "Error writing recording", err.Error(), walk.MsgBoxIconWarning)
}

char := charManager.ActiveCharacter()

if armw.AutoUploadCheckbox.Checked() && char != nil {
go func(fn string, t string) {
uploadFile, uploadErr := uploader.Upload(fn, t)
if uploadErr != nil {
walk.MsgBox(armw.MainWindow, "Record uploading error", uploadErr.Error(), walk.MsgBoxIconWarning)
} else {
notificationChannel <- NotificationMessage{Title: "Record uploaded successfully", Message: uploadFile}
}
}(filename, char.CharacterToken)
}

armw.CombatLogCharacterGroup.SetEnabled(true)
armw.CaptureSettingsGroup.SetEnabled(true)
armw.ChooseLogDirButton.SetEnabled(true)
Expand Down
9 changes: 5 additions & 4 deletions cmd/abyss-blackbox/recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ func (r *Recorder) Start(characters []string) {
}

// Stop stops recording and writes .abyss file if frames captured
func (r *Recorder) Stop() error {
func (r *Recorder) Stop() (string, error) {
r.Lock()
defer r.Unlock()

if len(r.frames) == 0 {
r.state = RecorderStopped
return fmt.Errorf("there was no frames captured, skipping recording of abyss run")
return r.recordingName, fmt.Errorf("there was no frames captured, skipping recording of abyss run")
}

file, _ := os.Create(r.recordingName)
Expand All @@ -198,7 +198,7 @@ func (r *Recorder) Stop() error {

err := gif.EncodeAll(&buf, &anim)
if err != nil {
return err
return r.recordingName, err
}

defer func() {
Expand All @@ -220,7 +220,8 @@ func (r *Recorder) Stop() error {
LootRecordDiscriminator: r.config.LootRecordDiscriminator,
}

return abyssFile.Encode(file)
err = abyssFile.Encode(file)
return r.recordingName, err
}

// StopLoop stops main recording loop
Expand Down
Binary file modified cmd/abyss-blackbox/rsrc.syso
Binary file not shown.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ go 1.13
require (
github.com/disintegration/gift v1.2.1
github.com/disintegration/imaging v1.6.2
github.com/gonutz/rsrc v0.0.0-20180911104558-96f130112cb1 // indirect
github.com/lxn/walk v0.0.0-20210112085537-c389da54e794
github.com/lxn/win v0.0.0-20210218163916-a377121e959e
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf
google.golang.org/protobuf v1.27.1
gopkg.in/Knetic/govaluate.v3 v3.0.0 // indirect
)
Expand Down
11 changes: 5 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw=
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/disintegration/gift v1.2.1 h1:Y005a1X4Z7Uc+0gLpSAsKhWi4qLtsdEcMIbbdvdZ6pc=
github.com/disintegration/gift v1.2.1/go.mod h1:Jh2i7f7Q2BM7Ezno3PhfezbR1xpUg9dUg3/RlKGr4HI=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/gonutz/rsrc v0.0.0-20180911104558-96f130112cb1 h1:JBZIm+g0SvPFkGCPmy56YuEbiOXGHcOJpXTlW+4Pj+E=
github.com/gonutz/rsrc v0.0.0-20180911104558-96f130112cb1/go.mod h1:RlfulN6lLdBnR7EiTZBlgS0sD4Uv07qQHaxvNlVj/1A=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 h1:acNfDZXmm28D2Yg/c3ALnZStzNaZMSagpbr96vY6Zjc=
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
github.com/shivas/walk v0.0.0-20210212094857-c0397ac21ff8 h1:XfZohVxBfVEqR8waXYFiLGyWwX/Z5W6BsxQx+T9lqtw=
github.com/shivas/walk v0.0.0-20210212094857-c0397ac21ff8/go.mod h1:mApxRmv/+YmW2b+EFVr2Ve7hhrxDicu73W+uP7Za+VE=
github.com/shivas/win v0.0.0-20210625114026-3e83f2d215c6 h1:8rO0BcQ2beWFsbGqFOsJVF4ABpQlkPGFB/cw9RXILws=
github.com/shivas/win v0.0.0-20210625114026-3e83f2d215c6/go.mod h1:KxxjdtRkfNoYDCUP5ryK7XJJNTnpC8atvtmTheChOtk=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 h1:hVwzHzIUGRjiF7EcUjqNxk3NCfkPxbDKRdnNE1Rpg0U=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf h1:2ucpDCmfkl8Bd/FsLtiD653Wf96cW37s+iGx93zsu4k=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
Binary file added images/plus.ico
Binary file not shown.
Binary file added images/switch-char.ico
Binary file not shown.
Loading

0 comments on commit 7f00819

Please sign in to comment.