From 600b12ab783cf36ec34e04df9b915088c7b6b4a9 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 1 Apr 2015 11:53:57 +0200 Subject: [PATCH] LogsPanel --- mix/qml/LogsPane.qml | 43 +++++++++++++++++++++++++++++++-------- mix/qml/LogsPaneStyle.qml | 2 +- mix/qml/StatusPane.qml | 10 +++------ 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/mix/qml/LogsPane.qml b/mix/qml/LogsPane.qml index 21bd9fd96..f600f9f9d 100644 --- a/mix/qml/LogsPane.qml +++ b/mix/qml/LogsPane.qml @@ -13,6 +13,11 @@ Rectangle logsModel.insert(0, { "type": _type, "date": Qt.formatDateTime(new Date(), "hh:mm:ss"), "content": _content, "level": _level }); } + Keys.onEscapePressed: + { + parent.toggle(); + } + anchors.fill: parent radius: 5 color: "transparent" @@ -33,7 +38,7 @@ Rectangle height: parent.height width: parent.width horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - ColumnLayout + Column { id: logsRect spacing: 0 @@ -93,6 +98,26 @@ Rectangle return index % 2 === 0 ? "transparent" : LogsPaneStyle.generic.layout.logAlternateColor; } + MouseArea + { + anchors.fill: parent + onClicked: + { + if (logContent.elide === Text.ElideNone) + { + logContent.elide = Text.ElideRight; + logContent.wrapMode = Text.NoWrap + parent.height = 30; + } + else + { + logContent.elide = Text.ElideNone; + logContent.wrapMode = Text.WordWrap; + parent.height = logContent.lineCount * 30; + } + } + } + DefaultLabel { text: date; @@ -120,12 +145,16 @@ Rectangle } } - DefaultLabel { + Text { + id: logContent text: content; font.family: LogsPaneStyle.generic.layout.logLabelFont width: LogsPaneStyle.generic.layout.contentWidth font.pointSize: Style.absoluteSize(-1) anchors.verticalCenter: parent.verticalCenter + elide: Text.ElideRight + + maximumLineCount: 10 anchors.left: parent.left anchors.leftMargin: 190 color: { @@ -145,11 +174,8 @@ Rectangle } } } - - } - Component { id: itemDelegate DefaultLabel { @@ -166,7 +192,6 @@ Rectangle } } } - } Rectangle @@ -377,7 +402,7 @@ Rectangle anchors.centerIn: parent fillMode: Image.PreserveAspectFit width: 20 - height: 20 + height: 25 } Action { @@ -420,7 +445,7 @@ Rectangle anchors.centerIn: parent fillMode: Image.PreserveAspectFit width: 20 - height: 20 + height: 25 } Action { @@ -503,7 +528,7 @@ Rectangle anchors.centerIn: parent fillMode: Image.PreserveAspectFit width: 20 - height: 20 + height: 25 } Action { diff --git a/mix/qml/LogsPaneStyle.qml b/mix/qml/LogsPaneStyle.qml index 215f17bd7..8e0dfd5f4 100644 --- a/mix/qml/LogsPaneStyle.qml +++ b/mix/qml/LogsPaneStyle.qml @@ -20,7 +20,7 @@ QtObject { property int headerInputWidth: 200 property int dateWidth: 70 property int typeWidth: 90 - property int contentWidth: 250 + property int contentWidth: 560 property string logAlternateColor: "#f6f5f6" } } diff --git a/mix/qml/StatusPane.qml b/mix/qml/StatusPane.qml index b42b13fef..3d366021f 100644 --- a/mix/qml/StatusPane.qml +++ b/mix/qml/StatusPane.qml @@ -112,7 +112,7 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter radius: 3 - width: 650 + width: 600 height: 30 color: "#fcfbfc" Text { @@ -201,8 +201,8 @@ Rectangle { { logsContainer.state = "opened"; logsContainer.focus = true; - calCoord(); forceActiveFocus(); + calCoord(); } } @@ -213,10 +213,6 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter visible: false radius: 5 - Component.onCompleted: - { - calCoord(); - } function calCoord() { @@ -225,7 +221,7 @@ Rectangle { top = top.parent var coordinates = logsContainer.mapToItem(top, 0, 0); logsContainer.parent = top; - logsContainer.x = coordinates.x + 150; + logsContainer.x = coordinates.x; logsContainer.y = coordinates.y; }