forked from Shinonome/dots-hyprland
overlay: fps limiter: fix weird container and button size
This commit is contained in:
@@ -109,8 +109,8 @@ Singleton {
|
|||||||
property JsonObject fpsLimiter: JsonObject {
|
property JsonObject fpsLimiter: JsonObject {
|
||||||
property bool pinned: false
|
property bool pinned: false
|
||||||
property bool clickthrough: false
|
property bool clickthrough: false
|
||||||
property real x: 100
|
property real x: 1600
|
||||||
property real y: 100
|
property real y: 630
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,5 +18,6 @@ ToolbarButton {
|
|||||||
iconSize: 22
|
iconSize: 22
|
||||||
text: iconBtn.text
|
text: iconBtn.text
|
||||||
color: iconBtn.colText
|
color: iconBtn.colText
|
||||||
|
animateChange: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,7 @@ import qs.modules.overlay
|
|||||||
StyledOverlayWidget {
|
StyledOverlayWidget {
|
||||||
id: root
|
id: root
|
||||||
title: "MangoHud FPS"
|
title: "MangoHud FPS"
|
||||||
contentItem: FpsLimiterContent {}
|
contentItem: FpsLimiterContent {
|
||||||
|
radius: root.contentRadius
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ Rectangle {
|
|||||||
color: Appearance.m3colors.m3surfaceContainer
|
color: Appearance.m3colors.m3surfaceContainer
|
||||||
property real padding: 16
|
property real padding: 16
|
||||||
property string iconState: "normal"
|
property string iconState: "normal"
|
||||||
implicitWidth: contentColumn.implicitWidth + padding * 2
|
anchors.fill: parent
|
||||||
implicitHeight: contentColumn.implicitHeight + padding * 2
|
implicitWidth: content.implicitWidth + (padding * 2)
|
||||||
|
implicitHeight: content.implicitHeight + (padding * 2)
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: iconResetTimer
|
id: iconResetTimer
|
||||||
@@ -54,57 +55,35 @@ Rectangle {
|
|||||||
fpsField.text = "";
|
fpsField.text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
Process {
|
||||||
id: contentColumn
|
id: fpsSetter
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: content
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: 15
|
spacing: 4
|
||||||
|
|
||||||
RowLayout {
|
ToolbarTextField {
|
||||||
|
id: fpsField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: 10
|
Layout.preferredWidth: 200
|
||||||
|
placeholderText: root.iconState === "error" ? Translation.tr("Insert a valid number") : Translation.tr("Set FPS limit (e.g. 80)")
|
||||||
|
inputMethodHints: Qt.ImhDigitsOnly
|
||||||
|
focus: true
|
||||||
|
|
||||||
ToolbarTextField {
|
onAccepted: {
|
||||||
id: fpsField
|
root.applyLimit();
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredWidth: 180
|
|
||||||
placeholderText: root.iconState === "error" ? Translation.tr("Insert a valid number") : Translation.tr("Set FPS limit (e.g. 80)")
|
|
||||||
inputMethodHints: Qt.ImhDigitsOnly
|
|
||||||
focus: true
|
|
||||||
|
|
||||||
onAccepted: {
|
|
||||||
root.applyLimit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RippleButton {
|
|
||||||
id: applyButton
|
|
||||||
implicitWidth: 25
|
|
||||||
implicitHeight: 25
|
|
||||||
buttonRadius: Appearance.rounding.full
|
|
||||||
onClicked: {
|
|
||||||
root.applyLimit();
|
|
||||||
}
|
|
||||||
contentItem: MaterialSymbol {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
font.pixelSize: Appearance.font.pixelSize.title
|
|
||||||
text: root.iconState === "error" ? "close" : (root.iconState === "success" ? "check" : "save")
|
|
||||||
rotation: root.iconState !== "normal" ? 360 : 0
|
|
||||||
color: root.iconState === "error" ? "#ef5350" : (root.iconState === "success" ? Appearance.m3colors.m3primary : Appearance.m3colors.m3onSurface)
|
|
||||||
|
|
||||||
Behavior on rotation {
|
|
||||||
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
IconToolbarButton {
|
||||||
id: fpsSetter
|
id: applyButton
|
||||||
|
text: root.iconState === "error" ? "close" : (root.iconState === "success" ? "check" : "save")
|
||||||
|
enabled: root.iconState === "normal" && fpsField.text.length > 0
|
||||||
|
onClicked: {
|
||||||
|
root.applyLimit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user