Fix imports and QR module dependency
This commit is contained in:
parent
00788d1cf0
commit
c0eb9b6136
1
go.mod
1
go.mod
|
|
@ -5,6 +5,7 @@ go 1.25.1
|
|||
require (
|
||||
fyne.io/fyne/v2 v2.7.1
|
||||
github.com/hajimehoshi/oto v0.7.1
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
|
|||
50
main.go
50
main.go
|
|
@ -28,31 +28,18 @@ import (
|
|||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
|
||||
"git.leaktechnologies.dev/stu/VideoTools/audio_module"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/author_module"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/filters_module"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/inspect_module"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/app"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/benchmark"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/convert"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/convert/presets"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/enhancement"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/logging"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/metadata"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/modules"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/player"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/queue"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/thumb"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/ui"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/internal/utils"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/rip_module"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/settings_module"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/subtitles_module"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/thumb_module"
|
||||
"git.leaktechnologies.dev/stu/VideoTools/upscale_module"
|
||||
|
||||
"github.com/yeqown/go-qrcode/v2"
|
||||
"github.com/yeqown/go-qrcode/writer/standard"
|
||||
"github.com/skip2/go-qrcode"
|
||||
)
|
||||
|
||||
// Module describes a high level tool surface that gets a tile on the menu.
|
||||
|
|
@ -489,35 +476,22 @@ func openFolder(path string) error {
|
|||
return cmd.Start()
|
||||
}
|
||||
|
||||
// openFile tries to open a file in the OS default viewer.
|
||||
func openFile(path string) error {
|
||||
if strings.TrimSpace(path) == "" {
|
||||
return fmt.Errorf("path is empty")
|
||||
}
|
||||
var cmd *exec.Cmd
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
cmd = utils.CreateCommandRaw("explorer", path)
|
||||
case "darwin":
|
||||
cmd = utils.CreateCommandRaw("open", path)
|
||||
default:
|
||||
cmd = utils.CreateCommandRaw("xdg-open", path)
|
||||
}
|
||||
return cmd.Start()
|
||||
}
|
||||
|
||||
func generatePixelatedQRCode() (fyne.CanvasObject, error) {
|
||||
docURL := "https://docs.leaktechnologies.dev/VideoTools"
|
||||
|
||||
// Create chunky QR code with large pixel blocks
|
||||
qrc, err := qrcode.New(docURL,
|
||||
qrcode.WithQRWidth(6), // Large pixel blocks for chunky look
|
||||
qrcode.WithBorderWidth(2), // Small border
|
||||
qrcode.WithErrorCorrectionLevel(qrcode.ErrorCorrectionMedium),
|
||||
)
|
||||
|
||||
// Generate QR code with large pixels for blocky look
|
||||
qrBytes, err := qrcode.Encode(docURL, qrcode.Medium, 160)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Convert to Fyne image with pixelated look
|
||||
img := canvas.NewImageFromBytes(qrBytes)
|
||||
img.FillMode = canvas.ImageFillOriginal // Keep pixelated look
|
||||
img.SetMinSize(fyne.NewSize(160, 160))
|
||||
|
||||
return img, nil
|
||||
}
|
||||
|
||||
// Generate to memory
|
||||
var buf bytes.Buffer
|
||||
|
|
|
|||
102
qr_about_demo.go
Normal file
102
qr_about_demo.go
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
//go:build demo
|
||||
// +build demo
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/app"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
|
||||
"github.com/skip2/go-qrcode"
|
||||
)
|
||||
|
||||
func generatePixelatedQRCode() (fyne.CanvasObject, error) {
|
||||
docURL := "https://docs.leaktechnologies.dev/VideoTools"
|
||||
|
||||
// Generate QR code with large pixels for blocky look (160x160 with 8x8 pixel blocks)
|
||||
qrBytes, err := qrcode.Encode(docURL, qrcode.Medium, 160)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Convert to Fyne image with pixelated look
|
||||
img := canvas.NewImageFromBytes(qrBytes)
|
||||
img.FillMode = canvas.ImageFillOriginal // Keep pixelated look
|
||||
img.SetMinSize(fyne.NewSize(160, 160))
|
||||
|
||||
return img, nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
myApp := app.New()
|
||||
myWindow := myApp.NewWindow("QR Code Test - About Dialog Demo")
|
||||
|
||||
// Test QR generation
|
||||
qrCode, err := generatePixelatedQRCode()
|
||||
if err != nil {
|
||||
log.Printf("Failed to generate QR code: %v", err)
|
||||
fallback := widget.NewLabel("QR generation failed - using fallback")
|
||||
myWindow.SetContent(container.NewVBox(fallback))
|
||||
} else {
|
||||
// Recreate about dialog layout with QR code
|
||||
title := canvas.NewText("About & Support", color.Color{} /*textColor*/)
|
||||
title.TextSize = 20
|
||||
|
||||
versionText := widget.NewLabel("VideoTools QR Code Demo")
|
||||
devText := widget.NewLabel("Developer: Leak Technologies")
|
||||
|
||||
// QR code with label
|
||||
qrLabel := widget.NewLabel("Scan for docs")
|
||||
qrLabel.Alignment = fyne.TextAlignCenter
|
||||
|
||||
// Logs button
|
||||
logsLink := widget.NewButton("Logs Folder", func() {
|
||||
fmt.Println("Logs folder clicked")
|
||||
})
|
||||
logsLink.Importance = widget.LowImportance
|
||||
|
||||
feedbackLabel := widget.NewLabel("Feedback: use Logs button on main menu to view logs; send issues with attached logs.")
|
||||
feedbackLabel.Wrapping = fyne.TextWrapWord
|
||||
|
||||
mainContent := container.NewVBox(
|
||||
versionText,
|
||||
devText,
|
||||
widget.NewLabel(""),
|
||||
widget.NewLabel("Support Development"),
|
||||
widget.NewLabel("QR code demo for docs"),
|
||||
feedbackLabel,
|
||||
)
|
||||
|
||||
logoColumn := container.NewVBox()
|
||||
logoColumn.Add(qrCode)
|
||||
logoColumn.Add(qrLabel)
|
||||
logoColumn.Add(layout.NewSpacer())
|
||||
logoColumn.Add(logsLink)
|
||||
|
||||
body := container.NewBorder(
|
||||
container.NewHBox(title),
|
||||
nil,
|
||||
nil,
|
||||
logoColumn,
|
||||
mainContent,
|
||||
)
|
||||
body = container.NewPadded(body)
|
||||
sizeShim := canvas.NewRectangle(color.Transparent{})
|
||||
sizeShim.SetMinSize(fyne.NewSize(560, 280))
|
||||
|
||||
content := container.NewMax(sizeShim, body)
|
||||
myWindow.SetContent(content)
|
||||
}
|
||||
|
||||
myWindow.Resize(fyne.NewSize(600, 400))
|
||||
myWindow.CenterOnScreen()
|
||||
myWindow.ShowAndRun()
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user