Commit a466a3eb authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: show notes in range details

Change-Id: Iaee0c3488e3eaa2c347e8533d57b16e47d1a9328
Reviewed-by: default avatarKai Koehne <kai.koehne@theqtcompany.com>
parent 97c955a3
......@@ -107,7 +107,7 @@ Rectangle {
flick.contentWidth = 0;
view.clearData();
view.startTime = view.endTime = 0;
hideRangeDetails();
rangeDetails.hide();
selectionRangeMode = false;
buttonsBar.updateRangeButton(selectionRangeMode);
zoomControl.setRange(0,0);
......@@ -151,16 +151,6 @@ Rectangle {
Math.max(0, totalRowOffset - flick.height / 2));
}
function hideRangeDetails() {
rangeDetails.visible = false;
rangeDetails.duration = "";
rangeDetails.label = "";
rangeDetails.file = "";
rangeDetails.line = -1;
rangeDetails.column = 0;
rangeDetails.isBindingLoop = false;
}
function selectBySelectionId(modelIndex, selectionId)
{
if (selectionId === -1 || (modelIndex === view.selectedModel && view.selectedItem !== -1 &&
......@@ -368,10 +358,7 @@ Rectangle {
onSelectionChanged: {
if (selectedItem !== -1) {
// display details
rangeDetails.showInfo(qmlProfilerModelProxy.details(selectedModel,
selectedItem));
rangeDetails.setLocation(qmlProfilerModelProxy.location(selectedModel,
selectedItem));
rangeDetails.showInfo(selectedModel, selectedItem);
// center view (horizontally)
recenterOnItem(selectedModel, selectedItem);
......@@ -388,7 +375,7 @@ Rectangle {
lockItemSelection = false;
}
} else {
root.hideRangeDetails();
rangeDetails.hide();
}
}
......
......@@ -42,6 +42,9 @@ Item {
property int column
property bool isBindingLoop
property int selectedModel: -1
property int selectedItem: -1
property bool locked: view.selectionLocked
width: col.width + 25
......@@ -51,6 +54,19 @@ Item {
x: 200
y: 25
function hide() {
noteEdit.focus = false;
visible = false;
selectedModel = selectedItem = -1;
noteEdit.text = "";
duration = "";
label = "";
file = "";
line = -1;
column = 0;
isBindingLoop = false;
}
// keep inside view
Connections {
target: root
......@@ -62,7 +78,13 @@ Item {
id: eventInfo
}
function showInfo(eventData) {
function showInfo(model, item) {
// make sure we don't accidentally save the old text for the new event
noteEdit.focus = false;
selectedModel = model;
selectedItem = item;
var eventData = qmlProfilerModelProxy.details(selectedModel, selectedItem)
eventInfo.clear();
for (var k in eventData) {
if (k === "displayName") {
......@@ -73,9 +95,8 @@ Item {
}
}
rangeDetails.visible = true;
}
function setLocation(location) {
var location = qmlProfilerModelProxy.location(selectedModel, selectedItem)
if (location.hasOwnProperty("file")) { // not empty
file = location.file;
line = location.line;
......@@ -86,6 +107,9 @@ Item {
line = 0;
column = -1;
}
noteEdit.focus = false;
noteEdit.text = qmlProfilerModelProxy.noteText(selectedModel, selectedItem);
}
function fitInView() {
......@@ -160,7 +184,7 @@ Item {
Rectangle {
color: "white"
width: parent.width
height: col.height + 10
height: 10 + col.height + (noteEdit.visible ? (noteEdit.height + 5) : 0)
y: 20
border.width: 1
border.color: "#a0a0a0"
......@@ -181,6 +205,40 @@ Item {
}
}
}
TextEdit {
id: noteEdit
x: 10
anchors.topMargin: 5
anchors.bottomMargin: 5
anchors.top: col.bottom
visible: text.length > 0 || focus
width: col.width
wrapMode: Text.Wrap
color: "orange"
font.italic: true
renderType: Text.NativeRendering
selectByMouse: true
onTextChanged: saveTimer.restart()
onFocusChanged: {
if (!focus && selectedModel != -1 && selectedItem != -1) {
saveTimer.stop();
qmlProfilerModelProxy.setNoteText(selectedModel, selectedItem, text);
}
}
Timer {
id: saveTimer
onTriggered: {
if (selectedModel != -1 && selectedItem != -1)
qmlProfilerModelProxy.setNoteText(selectedModel, selectedItem,
noteEdit.text);
}
interval: 1000
}
}
}
MouseArea {
......@@ -196,6 +254,20 @@ Item {
}
}
Image {
id: editIcon
source: "ico_edit.png"
anchors.top: closeIcon.top
anchors.right: lockIcon.left
anchors.rightMargin: 4
width: 8
height: 12
MouseArea {
anchors.fill: parent
onClicked: noteEdit.focus = true
}
}
Image {
id: lockIcon
source: locked?"lock_closed.png" : "lock_open.png"
......@@ -223,7 +295,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
root.hideRangeDetails();
rangeDetails.hide();
view.selectFromEventIndex(view.selectedModel, -1);
}
}
......
......@@ -11,6 +11,7 @@
<file>recordOn.png</file>
<file>lock_closed.png</file>
<file>lock_open.png</file>
<file>ico_edit.png</file>
<file>TimeMarks.qml</file>
<file>Overview.qml</file>
<file>Overview.js</file>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment