Skip to content

Commit 7bd5638

Browse files
committed
[ui] Rework of MessageDialog for CompatibilityManager and SensorDBDialog
1 parent 58741a3 commit 7bd5638

File tree

3 files changed

+55
-19
lines changed

3 files changed

+55
-19
lines changed

meshroom/ui/qml/Controls/MessageDialog.qml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Dialog {
1212
property alias icon: iconLabel
1313
property alias canCopy: copyButton.visible
1414
property alias preset: presets.state
15+
property alias content: contentComponent.sourceComponent
16+
property alias textMetrics: textMetrics
1517

1618
default property alias children: layout.children
1719

@@ -47,7 +49,6 @@ Dialog {
4749
}
4850

4951
RowLayout {
50-
width: parent.width
5152
// Icon
5253
Label {
5354
id: iconLabel
@@ -58,7 +59,6 @@ Dialog {
5859

5960
Label {
6061
id: titleLabel
61-
Layout.fillWidth: true
6262
text: title + " - " + Qt.application.name + " " + Qt.application.version
6363
font.bold: true
6464
}
@@ -75,7 +75,7 @@ Dialog {
7575
}
7676
}
7777

78-
ColumnLayout {
78+
contentItem: ColumnLayout {
7979
id: layout
8080
// Text
8181
spacing: 12
@@ -84,20 +84,41 @@ Dialog {
8484
font.bold: true
8585
visible: text != ""
8686
onLinkActivated: function(link) { Qt.openUrlExternally(link) }
87+
88+
Layout.preferredWidth: titleLabel.width
89+
wrapMode: Text.WordWrap
8790
}
8891
// Detailed text
8992
Label {
9093
id: detailedLabel
9194
text: text
9295
visible: text != ""
9396
onLinkActivated: function(link) { Qt.openUrlExternally(link) }
97+
98+
Layout.preferredWidth: titleLabel.width
99+
wrapMode: Text.WordWrap
94100
}
95101
// Additional helper text
96102
Label {
97103
id: helperLabel
98104
visible: text != ""
99105
onLinkActivated: function(link) { Qt.openUrlExternally(link) }
106+
107+
Layout.preferredWidth: titleLabel.width
108+
wrapMode: Text.WordWrap
100109
}
110+
111+
Loader {
112+
id: contentComponent
113+
114+
Layout.fillWidth: true
115+
}
116+
}
117+
118+
TextMetrics {
119+
id: textMetrics
120+
121+
text: "A"
101122
}
102123

103124
StateGroup {

meshroom/ui/qml/GraphEditor/CompatibilityManager.qml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ MessageDialog {
5555
+ "This operation is undoable and can also be done manually in the Graph Editor."
5656
: ""
5757

58-
ColumnLayout {
58+
content: ColumnLayout {
5959
spacing: 16
6060

6161
ListView {
@@ -66,6 +66,20 @@ MessageDialog {
6666
clip: true
6767
model: nodesModel
6868

69+
property int longestLabel: {
70+
var longest = 0
71+
for (var i = 0; i < issueCount; ++i) {
72+
var n = nodesModel.at(i)
73+
if (n.defaultLabel.length > longest)
74+
longest = n.defaultLabel.length
75+
}
76+
return longest
77+
}
78+
79+
property int upgradableLabelWidth: {
80+
return "Upgradable".length * root.textMetrics.width
81+
}
82+
6983
ScrollBar.vertical: MScrollBar { id: scrollbar }
7084

7185
spacing: 4
@@ -77,9 +91,9 @@ MessageDialog {
7791
background: Rectangle { color: Qt.darker(parent.palette.window, 1.15) }
7892
RowLayout {
7993
width: parent.width
80-
Label { text: "Node"; Layout.preferredWidth: 150; font.bold: true }
94+
Label { text: "Node"; Layout.preferredWidth: listView.longestLabel * root.textMetrics.width; font.bold: true }
8195
Label { text: "Issue"; Layout.fillWidth: true; font.bold: true }
82-
Label { text: "Upgradable"; font.bold: true }
96+
Label { text: "Upgradable"; Layout.preferredWidth: listView.upgradableLabelWidth; font.bold: true }
8397
}
8498
}
8599

@@ -92,14 +106,16 @@ MessageDialog {
92106
anchors.horizontalCenter: parent != null ? parent.horizontalCenter : undefined
93107

94108
Label {
95-
Layout.preferredWidth: 150
109+
Layout.preferredWidth: listView.longestLabel * root.textMetrics.width
96110
text: compatibilityNodeDelegate.node ? compatibilityNodeDelegate.node.defaultLabel : ""
97111
}
98112
Label {
99113
Layout.fillWidth: true
100114
text: compatibilityNodeDelegate.node ? compatibilityNodeDelegate.node.issueDetails : ""
101115
}
102116
Label {
117+
Layout.preferredWidth: listView.upgradableLabelWidth
118+
horizontalAlignment: Text.AlignHCenter
103119
text: compatibilityNodeDelegate.node && compatibilityNodeDelegate.node.canUpgrade ? MaterialIcons.check : MaterialIcons.clear
104120
color: compatibilityNodeDelegate.node && compatibilityNodeDelegate.node.canUpgrade ? "#4CAF50" : "#F44336"
105121
font.family: MaterialIcons.fontFamily

meshroom/ui/qml/ImageGallery/SensorDBDialog.qml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,19 @@ MessageDialog {
1717
icon.text: MaterialIcons.camera
1818
icon.font.pointSize: 10
1919

20-
modal: true
2120
parent: Overlay.overlay
2221
canCopy: false
2322

2423
title: "Sensor Database"
2524
text: "Add missing Camera Models to the Sensor Database to improve your results."
26-
detailedText: "If a warning is displayed on your images, adding your Camera Model to the Sensor Database\n"+
27-
"can help fix it and improve your reconstruction results."
25+
detailedText: "If a warning is displayed on your images, adding your Camera Model to the Sensor Database can help fix it and improve your reconstruction results."
2826
helperText: 'To update the Sensor Database (<a href="https://github.com/alicevision/meshroom/wiki/Add-Camera-to-database">complete guide</a>):<br>' +
2927
' - Look for the "sensor width" in millimeters of your Camera Model<br>' +
3028
' - Add a new line in the Database following this pattern: Make;Model;SensorWidthInMM<br>' +
31-
' - Click on "' + rebuildIntrinsics.text + '" once the Database has been saved<br>' +
29+
' - Click on "Update Intrinsics" once the Database has been saved<br>' +
3230
' - Contribute to the <a href="https://github.com/alicevision/AliceVision/blob/develop/src/aliceVision/sensorDB/cameraSensors.db">online Database</a>'
3331

34-
ColumnLayout {
32+
content: ColumnLayout {
3533
RowLayout {
3634
Layout.fillWidth: true
3735
spacing: 2
@@ -63,13 +61,14 @@ MessageDialog {
6361
onClicked: Qt.openUrlExternally(sensorDatabase)
6462
}
6563
}
66-
}
67-
Button {
68-
id: rebuildIntrinsics
69-
text: "Update Intrinsics"
70-
enabled: !readOnly
71-
onClicked: updateIntrinsicsRequest()
72-
Layout.alignment: Qt.AlignCenter
64+
65+
Button {
66+
id: rebuildIntrinsics
67+
text: "Update Intrinsics"
68+
enabled: !readOnly
69+
onClicked: updateIntrinsicsRequest()
70+
Layout.alignment: Qt.AlignCenter
71+
}
7372
}
7473
standardButtons: Dialog.Close
7574
onAccepted: close()

0 commit comments

Comments
 (0)