From 47262155aa1533c224f1557cdf7ff24b0e510b76 Mon Sep 17 00:00:00 2001 From: bbedward Date: Tue, 17 Feb 2026 12:58:09 -0500 Subject: [PATCH] doctor: add qt6-imageformats check --- .github/ISSUE_TEMPLATE/bug_report.yml | 6 +- .github/ISSUE_TEMPLATE/support_request.yml | 6 +- core/cmd/dms/commands_doctor.go | 81 +++++++++++++++------- 3 files changed, 63 insertions(+), 30 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 5f091ff8..0cb0ace9 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -45,9 +45,9 @@ body: - type: textarea id: dms_doctor attributes: - label: dms doctor -v - description: Output of `dms doctor -v` command - placeholder: Paste the output of `dms doctor -v` here + label: dms doctor -vC + description: Output of `dms doctor -vC` command + placeholder: Paste the output of `dms doctor -vC` here validations: required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/support_request.yml b/.github/ISSUE_TEMPLATE/support_request.yml index fd4e2c84..f5aaa02e 100644 --- a/.github/ISSUE_TEMPLATE/support_request.yml +++ b/.github/ISSUE_TEMPLATE/support_request.yml @@ -30,9 +30,9 @@ body: - type: textarea id: dms_doctor attributes: - label: dms doctor -v - description: Output of `dms doctor -v` command - placeholder: Paste the output of `dms doctor -v` here + label: dms doctor -vC + description: Output of `dms doctor -vC` command + placeholder: Paste the output of `dms doctor -vC` here validations: required: false - type: textarea diff --git a/core/cmd/dms/commands_doctor.go b/core/cmd/dms/commands_doctor.go index 569fff16..1538e961 100644 --- a/core/cmd/dms/commands_doctor.go +++ b/core/cmd/dms/commands_doctor.go @@ -649,40 +649,73 @@ func checkI2CAvailability() checkResult { return checkResult{catOptionalFeatures, "I2C/DDC", statusOK, fmt.Sprintf("%d monitor(s) detected", len(devices)), "External monitor brightness control", doctorDocsURL + "#optional-features"} } -func checkKImageFormats() checkResult { +func checkImageFormatPlugins() []checkResult { url := doctorDocsURL + "#optional-features" - desc := "Extra image format support (AVIF, HEIF, JXL)" pluginDir := findQtPluginDir() if pluginDir == "" { - return checkResult{catOptionalFeatures, "kimageformats", statusInfo, "Cannot detect (qtpaths not found)", desc, url} - } - - imageFormatsDir := filepath.Join(pluginDir, "imageformats") - keyPlugins := []struct{ file, format string }{ - {"kimg_avif.so", "AVIF"}, - {"kimg_heif.so", "HEIF"}, - {"kimg_jxl.so", "JXL"}, - {"kimg_exr.so", "EXR"}, - } - - var found []string - for _, p := range keyPlugins { - if _, err := os.Stat(filepath.Join(imageFormatsDir, p.file)); err == nil { - found = append(found, p.format) + return []checkResult{ + {catOptionalFeatures, "qt6-imageformats", statusInfo, "Cannot detect (plugin dir not found)", "WebP, TIFF, JP2 support", url}, + {catOptionalFeatures, "kimageformats", statusInfo, "Cannot detect (plugin dir not found)", "AVIF, HEIF, JXL support", url}, } } - if len(found) == 0 { - return checkResult{catOptionalFeatures, "kimageformats", statusWarn, "Not installed", desc, url} + imageFormatsDir := filepath.Join(pluginDir, "imageformats") + + type pluginCheck struct { + name string + desc string + plugins []struct{ file, format string } } - details := "" - if doctorVerbose { - details = fmt.Sprintf("Formats: %s (%s)", strings.Join(found, ", "), imageFormatsDir) + checks := []pluginCheck{ + { + name: "qt6-imageformats", + desc: "WebP, TIFF, GIF, JP2 support", + plugins: []struct{ file, format string }{ + {"libqwebp.so", "WebP"}, + {"libqtiff.so", "TIFF"}, + {"libqgif.so", "GIF"}, + {"libqjp2.so", "JP2"}, + {"libqicns.so", "ICNS"}, + }, + }, + { + name: "kimageformats", + desc: "AVIF, HEIF, JXL support", + plugins: []struct{ file, format string }{ + {"kimg_avif.so", "AVIF"}, + {"kimg_heif.so", "HEIF"}, + {"kimg_jxl.so", "JXL"}, + {"kimg_exr.so", "EXR"}, + }, + }, } - return checkResult{catOptionalFeatures, "kimageformats", statusOK, fmt.Sprintf("Installed (%d formats)", len(found)), details, url} + var results []checkResult + for _, c := range checks { + var found []string + for _, p := range c.plugins { + if _, err := os.Stat(filepath.Join(imageFormatsDir, p.file)); err == nil { + found = append(found, p.format) + } + } + + var result checkResult + switch { + case len(found) == 0: + result = checkResult{catOptionalFeatures, c.name, statusWarn, "Not installed", c.desc, url} + default: + details := "" + if doctorVerbose { + details = fmt.Sprintf("Formats: %s (%s)", strings.Join(found, ", "), imageFormatsDir) + } + result = checkResult{catOptionalFeatures, c.name, statusOK, fmt.Sprintf("Installed (%d formats)", len(found)), details, url} + } + results = append(results, result) + } + + return results } func findQtPluginDir() string { @@ -773,7 +806,7 @@ func checkOptionalDependencies() []checkResult { results = append(results, checkResult{catOptionalFeatures, "cups-pk-helper", cupsPkStatus, cupsPkMsg, "Printer management", optionalFeaturesURL}) results = append(results, checkI2CAvailability()) - results = append(results, checkKImageFormats()) + results = append(results, checkImageFormatPlugins()...) terminals := []string{"ghostty", "kitty", "alacritty", "foot", "wezterm"} if idx := slices.IndexFunc(terminals, utils.CommandExists); idx >= 0 {