forked from Shinonome/dots-hyprland
very small refractor
This commit is contained in:
@@ -16,18 +16,18 @@ Button {
|
|||||||
property string displayText
|
property string displayText
|
||||||
property string url
|
property string url
|
||||||
|
|
||||||
implicitHeight: 30
|
|
||||||
leftPadding: 5
|
|
||||||
rightPadding: 10
|
|
||||||
|
|
||||||
property string downloadUserAgent: ConfigOptions.networking.userAgent
|
property string downloadUserAgent: ConfigOptions.networking.userAgent
|
||||||
property string faviconDownloadPath
|
property string faviconDownloadPath
|
||||||
property string domainName: url.includes("vertexaisearch") ? displayText : StringUtils.getBaseUrl(url)
|
property string domainName: url.includes("vertexaisearch") ? displayText : StringUtils.getBaseUrl(url)
|
||||||
// property string faviconUrl: `https://${domainName}/favicon.ico`
|
|
||||||
property string faviconUrl: `https://www.google.com/s2/favicons?domain=${domainName}&sz=32`
|
property string faviconUrl: `https://www.google.com/s2/favicons?domain=${domainName}&sz=32`
|
||||||
property string fileName: `${domainName}.ico`
|
property string fileName: `${domainName}.ico`
|
||||||
property string faviconFilePath: `${faviconDownloadPath}/${fileName}`
|
property string faviconFilePath: `${faviconDownloadPath}/${fileName}`
|
||||||
|
|
||||||
|
property real faviconSize: 20
|
||||||
|
implicitHeight: 30
|
||||||
|
leftPadding: (implicitHeight - faviconSize) / 2
|
||||||
|
rightPadding: 10
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: faviconDownloadProcess
|
id: faviconDownloadProcess
|
||||||
running: false
|
running: false
|
||||||
@@ -38,7 +38,6 @@ Button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
// console.log("Favicon download:", faviconDownloadProcess.command.join(" "))
|
|
||||||
faviconDownloadProcess.running = true
|
faviconDownloadProcess.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +61,7 @@ Button {
|
|||||||
IconImage {
|
IconImage {
|
||||||
id: iconImage
|
id: iconImage
|
||||||
source: Qt.resolvedUrl(root.faviconUrl)
|
source: Qt.resolvedUrl(root.faviconUrl)
|
||||||
implicitSize: 20
|
implicitSize: root.faviconSize
|
||||||
|
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
layer.effect: OpacityMask {
|
layer.effect: OpacityMask {
|
||||||
|
|||||||
Reference in New Issue
Block a user