Skip to content

Commit 0ef1715

Browse files
Just-Kielcbentejac
authored andcommitted
[ui] Rework of MessageDialog for CompatibilityManager and SensorDBDialog
1 parent 648b095 commit 0ef1715

File tree

3 files changed

+55
-19
lines changed

3 files changed

+55
-19
lines changed

meshroom/ui/qml/Controls/MessageDialog.qml

+24-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Dialog {
1313
property alias icon: iconLabel
1414
property alias canCopy: copyButton.visible
1515
property alias preset: presets.state
16+
property alias content: contentComponent.sourceComponent
17+
property alias textMetrics: textMetrics
1618

1719
default property alias children: layout.children
1820

@@ -48,7 +50,6 @@ Dialog {
4850
}
4951

5052
RowLayout {
51-
width: parent.width
5253
// Icon
5354
Label {
5455
id: iconLabel
@@ -59,7 +60,6 @@ Dialog {
5960

6061
Label {
6162
id: titleLabel
62-
Layout.fillWidth: true
6363
text: title + " - " + Qt.application.name + " " + Qt.application.version
6464
font.bold: true
6565
}
@@ -76,7 +76,7 @@ Dialog {
7676
}
7777
}
7878

79-
ColumnLayout {
79+
contentItem: ColumnLayout {
8080
id: layout
8181
// Text
8282
spacing: 12
@@ -85,20 +85,41 @@ Dialog {
8585
font.bold: true
8686
visible: text != ""
8787
onLinkActivated: function(link) { Qt.openUrlExternally(link) }
88+
89+
Layout.preferredWidth: titleLabel.width
90+
wrapMode: Text.WordWrap
8891
}
8992
// Detailed text
9093
Label {
9194
id: detailedLabel
9295
text: text
9396
visible: text != ""
9497
onLinkActivated: function(link) { Qt.openUrlExternally(link) }
98+
99+
Layout.preferredWidth: titleLabel.width
100+
wrapMode: Text.WordWrap
95101
}
96102
// Additional helper text
97103
Label {
98104
id: helperLabel
99105
visible: text != ""
100106
onLinkActivated: function(link) { Qt.openUrlExternally(link) }
107+
108+
Layout.preferredWidth: titleLabel.width
109+
wrapMode: Text.WordWrap
101110
}
111+
112+
Loader {
113+
id: contentComponent
114+
115+
Layout.fillWidth: true
116+
}
117+
}
118+
119+
TextMetrics {
120+
id: textMetrics
121+
122+
text: "A"
102123
}
103124

104125
StateGroup {

meshroom/ui/qml/GraphEditor/CompatibilityManager.qml

+20-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ MessageDialog {
5757
+ "This operation is undoable and can also be done manually in the Graph Editor."
5858
: ""
5959

60-
ColumnLayout {
60+
content: ColumnLayout {
6161
spacing: 16
6262

6363
ListView {
@@ -68,6 +68,20 @@ MessageDialog {
6868
clip: true
6969
model: nodesModel
7070

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

7387
spacing: 4
@@ -79,9 +93,9 @@ MessageDialog {
7993
background: Rectangle { color: Qt.darker(parent.palette.window, 1.15) }
8094
RowLayout {
8195
width: parent.width
82-
Label { text: "Node"; Layout.preferredWidth: 150; font.bold: true }
96+
Label { text: "Node"; Layout.preferredWidth: listView.longestLabel * root.textMetrics.width; font.bold: true }
8397
Label { text: "Issue"; Layout.fillWidth: true; font.bold: true }
84-
Label { text: "Upgradable"; font.bold: true }
98+
Label { text: "Upgradable"; Layout.preferredWidth: listView.upgradableLabelWidth; font.bold: true }
8599
}
86100
}
87101

@@ -94,14 +108,16 @@ MessageDialog {
94108
anchors.horizontalCenter: parent != null ? parent.horizontalCenter : undefined
95109

96110
Label {
97-
Layout.preferredWidth: 150
111+
Layout.preferredWidth: listView.longestLabel * root.textMetrics.width
98112
text: compatibilityNodeDelegate.node ? compatibilityNodeDelegate.node.defaultLabel : ""
99113
}
100114
Label {
101115
Layout.fillWidth: true
102116
text: compatibilityNodeDelegate.node ? compatibilityNodeDelegate.node.issueDetails : ""
103117
}
104118
Label {
119+
Layout.preferredWidth: listView.upgradableLabelWidth
120+
horizontalAlignment: Text.AlignHCenter
105121
text: compatibilityNodeDelegate.node && compatibilityNodeDelegate.node.canUpgrade ? MaterialIcons.check : MaterialIcons.clear
106122
color: compatibilityNodeDelegate.node && compatibilityNodeDelegate.node.canUpgrade ? "#4CAF50" : "#F44336"
107123
font.family: MaterialIcons.fontFamily

meshroom/ui/qml/ImageGallery/SensorDBDialog.qml

+11-12
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,19 @@ MessageDialog {
1616
icon.text: MaterialIcons.camera
1717
icon.font.pointSize: 10
1818

19-
modal: true
2019
parent: Overlay.overlay
2120
canCopy: false
2221

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

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

0 commit comments

Comments
 (0)