diff --git a/meshroom/ui/qml/Utils/format.js b/meshroom/ui/qml/Utils/format.js
index 6f70173941..139dc11ced 100644
--- a/meshroom/ui/qml/Utils/format.js
+++ b/meshroom/ui/qml/Utils/format.js
@@ -10,16 +10,16 @@ function intToString(v) {
// Convert a plain text to an html escaped string.
function plainToHtml(t) {
- var escaped = t.replace(/&/g, '&').replace(//g, '>') // escape text
- return escaped.replace(/\n/g, '
') // replace line breaks
+ var escaped = t.replace(/&/g, '&').replace(//g, '>') // escape text
+ return escaped.replace(/\n/g, '
') // replace line breaks
}
function divmod(x, y) {
// Perform the division and get the quotient
- const quotient = Math.floor(x / y);
+ const quotient = Math.floor(x / y)
// Compute the remainder
- const remainder = x % y;
- return [quotient, remainder];
+ const remainder = x % y
+ return [quotient, remainder]
}
function sec2timeHMS(totalSeconds) {
@@ -30,7 +30,7 @@ function sec2timeHMS(totalSeconds) {
hours: hours,
minutes: minutes,
seconds: seconds
- };
+ }
}
function sec2timecode(timeSeconds) {
@@ -43,22 +43,22 @@ function sec2timecode(timeSeconds) {
function sec2timeStr(timeSeconds) {
// Need to decide the rounding precision first
// to propagate the right values
- if(timeSeconds >= 60.0) {
+ if (timeSeconds >= 60.0) {
timeSeconds = Math.round(timeSeconds)
} else {
timeSeconds = parseFloat(timeSeconds.toFixed(2))
}
var timeObj = sec2timeHMS(timeSeconds)
var timeStr = ""
- if(timeObj.hours > 0) {
+ if (timeObj.hours > 0) {
timeStr += timeObj.hours + "h"
}
- if(timeObj.hours > 0 || timeObj.minutes > 0) {
+ if (timeObj.hours > 0 || timeObj.minutes > 0) {
timeStr += timeObj.minutes + "m"
}
- if(timeObj.hours === 0) {
+ if (timeObj.hours === 0) {
// seconds only matter if the elapsed time is less than 1 hour
- if(timeObj.minutes === 0) {
+ if (timeObj.minutes === 0) {
// If less than a minute, keep millisecond precision
timeStr += timeObj.seconds.toFixed(2) + "s"
} else {
@@ -68,3 +68,39 @@ function sec2timeStr(timeSeconds) {
}
return timeStr
}
+
+function GB2GBMBKB(GB) {
+ // Convert GB to GB, MB, KB
+ var GBInt = Math.floor(GB)
+ var MB = Math.floor((GB - GBInt) * 1024)
+ var KB = Math.floor(((GB - GBInt) * 1024 - MB) * 1024)
+ return {
+ GB: GBInt,
+ MB: MB,
+ KB: KB
+ }
+}
+
+function GB2SizeStr(GB) {
+ // Convert GB to a human readable size string
+ // e.g. 1.23GB, 456MB, 789KB
+ // We only use one unit at a time
+ var sizeObj = GB2GBMBKB(GB)
+ var sizeStr = ""
+ if (sizeObj.GB > 0) {
+ sizeStr += sizeObj.GB
+ if (sizeObj.MB > 0 && sizeObj.GB < 10) {
+ sizeStr += "." + Math.floor(sizeObj.MB / 1024 * 1000)
+ }
+ sizeStr += "GB"
+ } else if (sizeObj.MB > 0) {
+ sizeStr = sizeObj.MB
+ if (sizeObj.KB > 0 && sizeObj.MB < 10) {
+ sizeStr += "." + Math.floor(sizeObj.KB / 1024 * 1000)
+ }
+ sizeStr += "MB"
+ } else if (sizeObj.GB === 0 && sizeObj.MB === 0) {
+ sizeStr += sizeObj.KB + "KB"
+ }
+ return sizeStr
+}
\ No newline at end of file
diff --git a/meshroom/ui/qml/Viewer/SequencePlayer.qml b/meshroom/ui/qml/Viewer/SequencePlayer.qml
index ca89df2b40..647017a7a9 100644
--- a/meshroom/ui/qml/Viewer/SequencePlayer.qml
+++ b/meshroom/ui/qml/Viewer/SequencePlayer.qml
@@ -190,6 +190,8 @@ FloatingPane {
color: palette.text
horizontalAlignment: Text.AlignHCenter
+ selectByMouse: true
+
text: m.frame
onEditingFinished: {
@@ -308,6 +310,7 @@ FloatingPane {
id: fpsTextInput
Layout.preferredWidth: fpsMetrics.width
+ selectByMouse: true
text: !focus ? m.fps + " FPS" : m.fps
color: palette.text
@@ -482,18 +485,15 @@ FloatingPane {
ProgressBar {
id: occupiedCacheProgressBar
+ property string occupiedCache: viewer.ramInfo ? Format.GB2SizeStr(viewer.ramInfo.y) : 0
+
width: parent.width
from: 0
to: settings_SequencePlayer.maxCacheMemory
value: viewer && viewer.ramInfo != undefined ? viewer.ramInfo.y : 0
- ToolTip.text: {
- if (viewer && viewer.ramInfo != undefined) {
- return "Occupied cache: "+ viewer.ramInfo.y + " GB" + "\n" + "On max cache memory set: " + settings_SequencePlayer.maxCacheMemory + " GB"
- }
- return "Unknown occupied cache (max cache memory set: " + settings_SequencePlayer.maxCacheMemory + ")"
- }
+ ToolTip.text: "Occupied cache: " + occupiedCache + "\n" + "On max cache memory set: " + settings_SequencePlayer.maxCacheMemory + " GB"
ToolTip.visible: hovered
ToolTip.delay: 100
}
diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml
index 223a5ff1cc..c3a61a5a15 100644
--- a/meshroom/ui/qml/Viewer/Viewer2D.qml
+++ b/meshroom/ui/qml/Viewer/Viewer2D.qml
@@ -508,8 +508,7 @@ FocusScope {
'sequence': Qt.binding(function() { return ((root.enableSequencePlayer && (_reconstruction || (root.displayedNode && root.displayedNode.hasSequenceOutput))) ? getSequence() : []) }),
'targetSize': Qt.binding(function() { return floatImageViewerLoader.targetSize }),
'useSequence': Qt.binding(function() {
- let attr = root.displayedNode ? root.displayedNode.attributes.get(outputAttribute.name) : undefined
- return (root.enableSequencePlayer && !useExternal && (_reconstruction || (root.displayedNode && root.displayedNode.hasSequenceOutput)) && (attr.desc.semantic === "imageList" || attr.desc.semantic === "sequence"))
+ return (root.enableSequencePlayer && !useExternal && (_reconstruction || (root.displayedNode && root.displayedNode.hasSequenceOutput && (displayedAttr.desc.semantic === "imageList" || displayedAttr.desc.semantic === "sequence"))))
}),
'fetchingSequence': Qt.binding(function() { return sequencePlayer.loading }),
'memoryLimit': Qt.binding(function() { return sequencePlayer.settings_SequencePlayer.maxCacheMemory }),