Browse Source

- UI changes

- Filter by message type
cl-refactor
yann300 10 years ago
parent
commit
b020371743
  1. 213
      mix/qml/LogsPane.qml
  2. 27
      mix/qml/StatusPane.qml
  3. 1
      mix/res.qrc

213
mix/qml/LogsPane.qml

@ -1,6 +1,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.3
import org.ethereum.qml.SortFilterProxyModel 1.0
import "."
@ -15,10 +16,10 @@ Rectangle
radius: 5
color: "#f7f7f7"
border.color: "#808080"
border.width: 2
border.width: 1
ColumnLayout {
height: parent.height - 4
width: parent.width - 2
height: parent.height
width: parent.width
spacing: 0
Row
{
@ -62,82 +63,172 @@ Rectangle
for (var k = 0; k < logsModel.count; k++)
{
var log = logsModel.get(k);
content += log.type + "\t" + log.level + "\t" + log.date + "\t" + log.content;
content += log.type + "\t" + log.level + "\t" + log.date + "\t" + log.content + "\n";
}
appContext.toClipboard(content);
}
}
}
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));
appContext.toClipboard(log.type + " " + log.level + " " + log.date + " " + log.content);
Rectangle {
anchors.verticalCenter: parent.verticalCenter
width: 1;
height: parent.height - 10
color : "#808080"
}
model: SortFilterProxyModel {
id: proxyModel
source: logsModel
ToolButton {
id: javascriptButton
checkable: true
height: 30
anchors.verticalCenter: parent.verticalCenter
checked: true
onCheckedChanged: {
proxyModel.toogleFilter("javascript")
}
tooltip: qsTr("JavaScript")
style:
ButtonStyle {
label:
Item {
DefaultLabel {
font.family: "sans serif"
font.pointSize: Style.absoluteSize(-3)
color: "#5391d8"
anchors.centerIn: parent
text: qsTr("JavaScript")
}
}
}
}
filterRole: ""
filterString: ""
filterSyntax: SortFilterProxyModel.Wildcard
filterCaseSensitivity: Qt.CaseInsensitive
ToolButton {
id: runButton
checkable: true
height: 30
anchors.verticalCenter: parent.verticalCenter
checked: true
onCheckedChanged: {
proxyModel.toogleFilter("run")
}
TableViewColumn
{
role: "date"
title: qsTr("date")
width: 150
delegate: itemDelegate
tooltip: qsTr("Run")
style:
ButtonStyle {
label:
Item {
DefaultLabel {
font.family: "sans serif"
font.pointSize: Style.absoluteSize(-3)
color: "#5391d8"
anchors.centerIn: parent
text: qsTr("Run")
}
}
}
TableViewColumn
{
role: "type"
title: qsTr("type")
width: 100
delegate: itemDelegate
}
ToolButton {
id: stateButton
checkable: true
height: 30
anchors.verticalCenter: parent.verticalCenter
checked: true
onCheckedChanged: {
proxyModel.toogleFilter("state")
}
tooltip: qsTr("State")
style:
ButtonStyle {
label:
Item {
DefaultLabel {
font.family: "sans serif"
font.pointSize: Style.absoluteSize(-3)
color: "#5391d8"
anchors.centerIn: parent
text: qsTr("State")
}
}
}
TableViewColumn
}
}
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));
appContext.toClipboard(log.type + " " + log.level + " " + log.date + " " + log.content);
}
model: SortFilterProxyModel {
id: proxyModel
source: logsModel
function toogleFilter(_value)
{
role: "content"
title: qsTr("content")
width: 700
delegate: itemDelegate
if (filterString.indexOf('_' + _value) !== -1)
filterString = filterString.replace('_' + _value, _value);
else
filterString = filterString.replace(_value, '_' + _value);
}
filterRole: "type"
filterString: "(?:javascript|run|state)"
filterSyntax: SortFilterProxyModel.RegExp
filterCaseSensitivity: Qt.CaseInsensitive
}
TableViewColumn
{
role: "date"
title: qsTr("date")
width: 150
delegate: itemDelegate
}
TableViewColumn
{
role: "type"
title: qsTr("type")
width: 100
delegate: itemDelegate
}
TableViewColumn
{
role: "content"
title: qsTr("content")
width: 700
delegate: itemDelegate
}
}
Component {
id: itemDelegate
DefaultLabel {
text: styleData.value;
font.family: "sans serif"
font.pointSize: Style.absoluteSize(-1)
color: {
if (styleData.row > -1)
{
var l = logsModel.get(styleData.row).level
if (l === "error")
return "red"
else if (l === "warning")
return "orange"
else if (l === "info")
return "#808080"
}
else
Component {
id: itemDelegate
DefaultLabel {
text: styleData.value;
font.family: "sans serif"
font.pointSize: Style.absoluteSize(-1)
color: {
if (styleData.row > -1)
{
var l = logsModel.get(styleData.row).level
if (l === "error")
return "red"
else if (l === "warning")
return "orange"
else if (l === "info")
return "#808080"
}
else
return "#808080"
}
}
}
}
}

27
mix/qml/StatusPane.qml

@ -87,6 +87,24 @@ Rectangle {
width: 500
height: 30
color: "#fcfbfc"
states: [
State {
name: "logsOpened"
PropertyChanges {
target: statusContainer
border.color: "#808080"
border.width: 1
}
},
State {
name: "logsClosed"
PropertyChanges {
target: statusContainer
border.color: "#808080"
border.width: 0
}
}
]
Text {
anchors.verticalCenter: parent.verticalCenter
@ -152,18 +170,25 @@ Rectangle {
function toggle()
{
if (logsContainer.state === "opened")
{
statusContainer.state = "logsClosed";
logsContainer.state = "closed"
}
else
{
statusContainer.state = "logsOpened";
logsContainer.state = "opened";
}
}
id: logsContainer
width: 1000
height: 0
anchors.topMargin: 2
//anchors.topMargin:
anchors.top: statusContainer.bottom
anchors.horizontalCenter: parent.horizontalCenter
visible: false
radius: 5
Component.onCompleted:
{
var top = logsContainer;

1
mix/res.qrc

@ -110,7 +110,6 @@
<file>qml/img/run.png</file>
<file>qml/img/note.png</file>
<file>qml/LogsPane.qml</file>
<file>qml/LogsWindow.qml</file>
<file>qml/img/copy.png</file>
<file>qml/img/broom.png</file>
</qresource>

Loading…
Cancel
Save