Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Dialogs #155

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 15 additions & 33 deletions qml/dialogs/accent/AccentDisplay.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import QFRCDashboard
Rectangle {
clip: true

height: 100 * Constants.scalar
height: 85 * Constants.scalar
border {
color: "white"
width: 2 * Constants.scalar
Expand All @@ -23,16 +23,17 @@ Rectangle {
}

RowLayout {
id: fields
anchors {
top: parent.top
left: parent.left
right: parent.right

margins: 5
margins: 5 * Constants.scalar
}

width: parent.width
uniformCellSizes: true
height: 50 * Constants.scalar

TextField {
Layout.fillWidth: true
Expand Down Expand Up @@ -81,76 +82,57 @@ Rectangle {
Component.onCompleted: currentIndex = indexOfValue(getQml())

id: qml
model: [
"Lime",
"Green",
"Emerald",
"Teal",
"Cyan",
"Cobalt",
"Indigo",
"Violet",
"Pink",
"Magenta",
"Crimson",
"Red",
"Orange",
"Amber",
"Yellow",
"Brown",
"Olive",
"Steel",
"Mauve",
"Taupe",
]
model: ["Lime", "Green", "Emerald", "Teal", "Cyan", "Cobalt", "Indigo", "Violet", "Pink", "Magenta", "Crimson", "Red", "Orange", "Amber", "Yellow", "Brown", "Olive", "Steel", "Mauve", "Taupe"]

font.pixelSize: Math.round(15 * Constants.scalar)

onActivated: (index) => setQml(currentText)
onActivated: index => setQml(currentText)
}
}

RowLayout {
id: preview
uniformCellSizes: true
y: 50 * Constants.scalar

anchors {
left: parent.left
right: parent.right

top: fields.bottom

margins: 8 * Constants.scalar
topMargin: 2
}

height: 50 * Constants.scalar

Button {
font.pixelSize: 18 * Constants.scalar
text: "Remove"

onClicked: accents.remove(model.idx)

Layout.alignment: Qt.AlignCenter
}

Rectangle {
Layout.fillWidth: true
height: 40 * Constants.scalar
implicitHeight: 40 * Constants.scalar

color: accent.text
}

Rectangle {
Layout.fillWidth: true
height: 40 * Constants.scalar
implicitHeight: 40 * Constants.scalar

color: light.text
}

Rectangle {
Layout.fillWidth: true

height: 40 * Constants.scalar
implicitHeight: 40 * Constants.scalar

color: accents.qmlColor(qml.currentText)
}
}

}
6 changes: 4 additions & 2 deletions qml/dialogs/accent/AccentEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import QtQuick.Dialogs
import QFRCDashboard

AnimatedDialog {
width: parent.width / 1.5
height: parent.height / 1.1
width: Math.min(window.width, 625 * Constants.scalar)
height: window.height

standardButtons: Dialog.Ok | Dialog.Cancel
title: "Accent Editor"
Expand Down Expand Up @@ -79,13 +79,15 @@ AnimatedDialog {
uniformCellSizes: true

Button {
font.pixelSize: 15 * Constants.scalar
Layout.fillWidth: true
text: "Add"

onClicked: accents.add()
}

Button {
font.pixelSize: 15 * Constants.scalar
Layout.fillWidth: true
text: "Pick Color"

Expand Down
7 changes: 6 additions & 1 deletion qml/widgets/config/BaseConfigDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ AnimatedDialog {

title: "Configure Widget"

width: 400 * Constants.scalar
height: Math.min(
window.height, Math.max(
implicitBackgroundHeight + topInset
+ bottomInset, contentHeight + topPadding + bottomPadding
+ (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0) + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0)) + 50 * Constants.scalar)
width: Math.min(window.width, 625 * Constants.scalar)

standardButtons: Dialog.Ok | Dialog.Cancel
}
5 changes: 4 additions & 1 deletion qml/widgets/config/SectionHeader.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ Column {
font.bold: true
color: Constants.palette.text
text: label

width: parent.width
horizontalAlignment: Text.AlignHCenter
}

Rectangle {
height: 2
width: 350 * Constants.scalar
width: parent.width
color: Constants.palette.text
}
}
12 changes: 4 additions & 8 deletions qml/widgets/misc/CameraView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ BaseWidget {
+ item_quality + "&" : "")
+ (item_fps !== 0 ? "fps=" + item_fps + "&" : "")
+ (item_resH !== Qt.size(
0, 0) ? "resolution=" + item_resW + "x"
+ item_resH : ""))
0, 0) ? "resolution=" + item_resW + "x" + item_resH : ""))
}

function reconnect() {
Expand Down Expand Up @@ -143,9 +142,6 @@ BaseWidget {
BaseConfigDialog {
id: config

height: 450 * Constants.scalar
width: 450 * Constants.scalar

function openDialog() {
topicField.open()
titleFontField.open()
Expand All @@ -167,7 +163,7 @@ BaseWidget {
}

ScrollView {
contentWidth: 380 * Constants.scalar
contentWidth: width - 5 * Constants.scalar - effectiveScrollBarWidth

anchors {
top: parent.top
Expand All @@ -185,6 +181,7 @@ BaseWidget {
spacing: 25 * Constants.scalar

anchors.fill: parent
anchors.leftMargin: 2

SectionHeader {
label: "Font Settings"
Expand Down Expand Up @@ -220,8 +217,8 @@ BaseWidget {
RowLayout {
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
// Layout.preferredWidth: 300

// Layout.preferredWidth: 300
Text {
font.pixelSize: 16 * Constants.scalar
text: "Resolution"
Expand Down Expand Up @@ -301,5 +298,4 @@ BaseWidget {
}
}
}

}
2 changes: 0 additions & 2 deletions qml/widgets/misc/ErrorsWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ BaseWidget {
BaseConfigDialog {
id: config

height: 325 * Constants.scalar

function openDialog() {
topicField.open()
titleFontField.open()
Expand Down
4 changes: 1 addition & 3 deletions qml/widgets/primitive/BoolWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ BaseWidget {
BaseConfigDialog {
id: config

height: 325 * Constants.scalar

function openDialog() {
topicField.open()
titleFontField.open()
Expand All @@ -99,7 +97,7 @@ BaseWidget {
right: parent.right

topMargin: -20

rightMargin: 5
}

Expand Down
4 changes: 1 addition & 3 deletions qml/widgets/primitive/ColorWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ BaseWidget {
BaseConfigDialog {
id: config

height: 500 * Constants.scalar

function openDialog() {
topicField.open()
titleFontField.open()
Expand Down Expand Up @@ -118,7 +116,7 @@ BaseWidget {
right: parent.right

topMargin: -20

rightMargin: 5
}

Expand Down
6 changes: 2 additions & 4 deletions qml/widgets/primitive/DoubleDialWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ BaseWidget {
BaseConfigDialog {
id: config

height: 450 * Constants.scalar
width: 450 * Constants.scalar

function openDialog() {
topicField.open()
titleFontField.open()
Expand Down Expand Up @@ -203,7 +200,7 @@ BaseWidget {

ScrollView {
id: scroll
contentWidth: 380 * Constants.scalar
contentWidth: width - 5 * Constants.scalar - effectiveScrollBarWidth

anchors {
top: parent.top
Expand All @@ -221,6 +218,7 @@ BaseWidget {
spacing: 25 * Constants.scalar

anchors.fill: parent
anchors.leftMargin: 2

SectionHeader {
label: "Font Settings"
Expand Down
2 changes: 0 additions & 2 deletions qml/widgets/primitive/DoubleWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ BaseWidget {
BaseConfigDialog {
id: config

height: 500 * Constants.scalar

function openDialog() {
topicField.open()
titleFontField.open()
Expand Down
12 changes: 6 additions & 6 deletions qml/widgets/primitive/EnumWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ BaseWidget {
}

function colorFromMap(value) {
for (let i = 0 ; i < item_colorMap.length; ++i) {
let obj = item_colorMap[i];
for (var i = 0; i < item_colorMap.length; ++i) {
let obj = item_colorMap[i]

if (obj["Value"] === value) {
return obj["Color"]
Expand Down Expand Up @@ -98,9 +98,6 @@ BaseWidget {
BaseConfigDialog {
id: config

height: 450 * Constants.scalar
width: 450 * Constants.scalar

function openDialog() {
topicField.open()
titleFontField.open()
Expand All @@ -120,7 +117,7 @@ BaseWidget {
ScrollView {
clip: true

contentWidth: 380 * Constants.scalar
contentWidth: width - 5 * Constants.scalar - effectiveScrollBarWidth

anchors {
top: parent.top
Expand All @@ -136,7 +133,10 @@ BaseWidget {
ColumnLayout {
id: layout
spacing: 25 * Constants.scalar

anchors.fill: parent
anchors.leftMargin: 2

clip: true

SectionHeader {
Expand Down
6 changes: 2 additions & 4 deletions qml/widgets/primitive/IntDialWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ BaseWidget {
BaseConfigDialog {
id: config

height: 450 * Constants.scalar
width: 450 * Constants.scalar

function openDialog() {
topicField.open()
titleFontField.open()
Expand All @@ -203,7 +200,7 @@ BaseWidget {
}

ScrollView {
contentWidth: 380 * Constants.scalar
contentWidth: width - 5 * Constants.scalar - effectiveScrollBarWidth

anchors {
top: parent.top
Expand All @@ -221,6 +218,7 @@ BaseWidget {
spacing: 25 * Constants.scalar

anchors.fill: parent
anchors.leftMargin: 2

SectionHeader {
label: "Font Settings"
Expand Down
4 changes: 1 addition & 3 deletions qml/widgets/primitive/IntWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ BaseWidget {
BaseConfigDialog {
id: config

height: 500 * Constants.scalar

function openDialog() {
topicField.open()
titleFontField.open()
Expand Down Expand Up @@ -117,7 +115,7 @@ BaseWidget {
right: parent.right

topMargin: -20

rightMargin: 5
}

Expand Down
Loading
Loading