|
|
@ -10,19 +10,124 @@ Rectangle |
|
|
|
function push(_level, _type, _content) |
|
|
|
{ |
|
|
|
_content = _content.replace(/\n/g, " ") |
|
|
|
logsModel.insert(0, { "type": _type, "date": Qt.formatDateTime(new Date(), "hh:mm:ss dd.MM.yyyy"), "content": _content, "level": _level }); |
|
|
|
logsModel.insert(0, { "type": _type, "date": Qt.formatDateTime(new Date(), "hh:mm:ss"), "content": _content, "level": _level }); |
|
|
|
} |
|
|
|
|
|
|
|
anchors.fill: parent |
|
|
|
radius: 5 |
|
|
|
color: LogsPaneStyle.generic.layout.backgroundColor |
|
|
|
border.color: LogsPaneStyle.generic.layout.borderColor |
|
|
|
border.width: LogsPaneStyle.generic.layout.borderWidth |
|
|
|
ColumnLayout { |
|
|
|
z: 2 |
|
|
|
height: parent.height |
|
|
|
width: parent.width |
|
|
|
spacing: 0 |
|
|
|
|
|
|
|
ListModel { |
|
|
|
id: logsModel |
|
|
|
} |
|
|
|
|
|
|
|
TableView { |
|
|
|
id: logsTable |
|
|
|
clip: true |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.preferredHeight: parent.height - rowAction.height |
|
|
|
headerVisible : false |
|
|
|
onDoubleClicked: |
|
|
|
{ |
|
|
|
var log = logsModel.get(logsTable.currentRow); |
|
|
|
if (log) |
|
|
|
clipboard.text = (log.type + "\t" + log.level + "\t" + log.date + "\t" + log.content); |
|
|
|
} |
|
|
|
|
|
|
|
model: SortFilterProxyModel { |
|
|
|
id: proxyModel |
|
|
|
source: logsModel |
|
|
|
property var roles: ["-", "javascript", "run", "state"] |
|
|
|
|
|
|
|
Component.onCompleted: { |
|
|
|
filterType = regEx(proxyModel.roles); |
|
|
|
} |
|
|
|
|
|
|
|
function search(_value) |
|
|
|
{ |
|
|
|
filterContent = _value; |
|
|
|
} |
|
|
|
|
|
|
|
function toogleFilter(_value) |
|
|
|
{ |
|
|
|
var count = roles.length; |
|
|
|
for (var i in roles) |
|
|
|
{ |
|
|
|
if (roles[i] === _value) |
|
|
|
{ |
|
|
|
roles.splice(i, 1); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (count === roles.length) |
|
|
|
roles.push(_value); |
|
|
|
|
|
|
|
filterType = regEx(proxyModel.roles); |
|
|
|
} |
|
|
|
|
|
|
|
function regEx(_value) |
|
|
|
{ |
|
|
|
return "(?:" + roles.join('|') + ")"; |
|
|
|
} |
|
|
|
|
|
|
|
filterType: "(?:javascript|run|state)" |
|
|
|
filterContent: "" |
|
|
|
filterSyntax: SortFilterProxyModel.RegExp |
|
|
|
filterCaseSensitivity: Qt.CaseInsensitive |
|
|
|
} |
|
|
|
TableViewColumn |
|
|
|
{ |
|
|
|
role: "date" |
|
|
|
title: qsTr("date") |
|
|
|
width: LogsPaneStyle.generic.layout.dateWidth |
|
|
|
delegate: itemDelegate |
|
|
|
} |
|
|
|
TableViewColumn |
|
|
|
{ |
|
|
|
role: "type" |
|
|
|
title: qsTr("type") |
|
|
|
width: LogsPaneStyle.generic.layout.typeWidth |
|
|
|
delegate: itemDelegate |
|
|
|
} |
|
|
|
TableViewColumn |
|
|
|
{ |
|
|
|
role: "content" |
|
|
|
title: qsTr("content") |
|
|
|
width: LogsPaneStyle.generic.layout.contentWidth |
|
|
|
delegate: itemDelegate |
|
|
|
} |
|
|
|
|
|
|
|
rowDelegate: Item { |
|
|
|
Rectangle { |
|
|
|
width: logsTable.width - 4 |
|
|
|
height: 17 |
|
|
|
color: styleData.alternate ? "transparent" : LogsPaneStyle.generic.layout.logAlternateColor |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Component { |
|
|
|
id: itemDelegate |
|
|
|
DefaultLabel { |
|
|
|
text: styleData.value; |
|
|
|
font.family: LogsPaneStyle.generic.layout.logLabelFont |
|
|
|
font.pointSize: Style.absoluteSize(-1) |
|
|
|
color: { |
|
|
|
if (proxyModel.get(styleData.row).level === "error") |
|
|
|
return "red"; |
|
|
|
else if (proxyModel.get(styleData.row).level === "warning") |
|
|
|
return "orange"; |
|
|
|
else |
|
|
|
return "#808080"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Row |
|
|
|
{ |
|
|
|
id: rowAction |
|
|
@ -178,7 +283,7 @@ Rectangle |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
DefaultTextField |
|
|
|
/*DefaultTextField |
|
|
|
{ |
|
|
|
id: searchBox |
|
|
|
height: LogsPaneStyle.generic.layout.headerButtonHeight |
|
|
@ -190,113 +295,7 @@ Rectangle |
|
|
|
onTextChanged: { |
|
|
|
proxyModel.search(text); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ListModel { |
|
|
|
id: logsModel |
|
|
|
} |
|
|
|
|
|
|
|
TableView { |
|
|
|
id: logsTable |
|
|
|
clip: true |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.preferredHeight: parent.height - rowAction.height |
|
|
|
headerVisible : false |
|
|
|
onDoubleClicked: |
|
|
|
{ |
|
|
|
var log = logsModel.get(logsTable.currentRow); |
|
|
|
if (log) |
|
|
|
clipboard.text = (log.type + "\t" + log.level + "\t" + log.date + "\t" + log.content); |
|
|
|
} |
|
|
|
|
|
|
|
model: SortFilterProxyModel { |
|
|
|
id: proxyModel |
|
|
|
source: logsModel |
|
|
|
property var roles: ["-", "javascript", "run", "state"] |
|
|
|
|
|
|
|
Component.onCompleted: { |
|
|
|
filterType = regEx(proxyModel.roles); |
|
|
|
} |
|
|
|
|
|
|
|
function search(_value) |
|
|
|
{ |
|
|
|
filterContent = _value; |
|
|
|
} |
|
|
|
|
|
|
|
function toogleFilter(_value) |
|
|
|
{ |
|
|
|
var count = roles.length; |
|
|
|
for (var i in roles) |
|
|
|
{ |
|
|
|
if (roles[i] === _value) |
|
|
|
{ |
|
|
|
roles.splice(i, 1); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (count === roles.length) |
|
|
|
roles.push(_value); |
|
|
|
|
|
|
|
filterType = regEx(proxyModel.roles); |
|
|
|
} |
|
|
|
|
|
|
|
function regEx(_value) |
|
|
|
{ |
|
|
|
return "(?:" + roles.join('|') + ")"; |
|
|
|
} |
|
|
|
|
|
|
|
filterType: "(?:javascript|run|state)" |
|
|
|
filterContent: "" |
|
|
|
filterSyntax: SortFilterProxyModel.RegExp |
|
|
|
filterCaseSensitivity: Qt.CaseInsensitive |
|
|
|
} |
|
|
|
TableViewColumn |
|
|
|
{ |
|
|
|
role: "date" |
|
|
|
title: qsTr("date") |
|
|
|
width: LogsPaneStyle.generic.layout.dateWidth |
|
|
|
delegate: itemDelegate |
|
|
|
} |
|
|
|
TableViewColumn |
|
|
|
{ |
|
|
|
role: "type" |
|
|
|
title: qsTr("type") |
|
|
|
width: LogsPaneStyle.generic.layout.typeWidth |
|
|
|
delegate: itemDelegate |
|
|
|
} |
|
|
|
TableViewColumn |
|
|
|
{ |
|
|
|
role: "content" |
|
|
|
title: qsTr("content") |
|
|
|
width: LogsPaneStyle.generic.layout.contentWidth |
|
|
|
delegate: itemDelegate |
|
|
|
} |
|
|
|
|
|
|
|
rowDelegate: Item { |
|
|
|
Rectangle { |
|
|
|
width: logsTable.width - 4 |
|
|
|
height: 17 |
|
|
|
color: styleData.alternate ? "transparent" : LogsPaneStyle.generic.layout.logAlternateColor |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Component { |
|
|
|
id: itemDelegate |
|
|
|
DefaultLabel { |
|
|
|
text: styleData.value; |
|
|
|
font.family: LogsPaneStyle.generic.layout.logLabelFont |
|
|
|
font.pointSize: Style.absoluteSize(-1) |
|
|
|
color: { |
|
|
|
if (proxyModel.get(styleData.row).level === "error") |
|
|
|
return "red"; |
|
|
|
else if (proxyModel.get(styleData.row).level === "warning") |
|
|
|
return "orange"; |
|
|
|
else |
|
|
|
return "#808080"; |
|
|
|
} |
|
|
|
} |
|
|
|
}*/ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|