aboutsummaryrefslogtreecommitdiff
path: root/qml
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-07-05 18:41:30 +0200
committerAdrian Kummerlaender2015-07-05 18:41:30 +0200
commitef1a71f77d318ef75e04467bab17a650c0b4d868 (patch)
tree97287cc6a0b086e31c5b2d3d306c059413b0ece6 /qml
parent78966dc00419a4f5fe5fec4725062a4a0f380228 (diff)
downloadMetaTerm-ef1a71f77d318ef75e04467bab17a650c0b4d868.tar
MetaTerm-ef1a71f77d318ef75e04467bab17a650c0b4d868.tar.gz
MetaTerm-ef1a71f77d318ef75e04467bab17a650c0b4d868.tar.bz2
MetaTerm-ef1a71f77d318ef75e04467bab17a650c0b4d868.tar.lz
MetaTerm-ef1a71f77d318ef75e04467bab17a650c0b4d868.tar.xz
MetaTerm-ef1a71f77d318ef75e04467bab17a650c0b4d868.tar.zst
MetaTerm-ef1a71f77d318ef75e04467bab17a650c0b4d868.zip
Replaced ScrollBar with terminal instance index
Diffstat (limited to 'qml')
-rw-r--r--qml/EmbeddedTerminal.qml1
-rw-r--r--qml/ScrollBar.qml78
-rw-r--r--qml/TerminalItem.qml23
-rw-r--r--qml/main.qml8
-rw-r--r--qml/ui.qrc11
5 files changed, 27 insertions, 94 deletions
diff --git a/qml/EmbeddedTerminal.qml b/qml/EmbeddedTerminal.qml
index f4f104e..6d94230 100644
--- a/qml/EmbeddedTerminal.qml
+++ b/qml/EmbeddedTerminal.qml
@@ -4,6 +4,7 @@ import QtQuick.Controls 1.2
Item {
id: embeddedTerminal
+
property string program
property string workingDirectory
property int columns
diff --git a/qml/ScrollBar.qml b/qml/ScrollBar.qml
deleted file mode 100644
index 18f149c..0000000
--- a/qml/ScrollBar.qml
+++ /dev/null
@@ -1,78 +0,0 @@
-import QtQuick 2.0;
-
-Item {
- id: scrollbar
- width: (handleSize + 2)
- visible: (flickable.visibleArea.heightRatio < 1.0)
-
- anchors {
- top: flickable.top
- right: flickable.right
- bottom: flickable.bottom
- }
-
- property Flickable flickable
- property int handleSize
-
- Item {
- id: bar
-
- anchors.fill: parent
-
- Rectangle {
- anchors.fill: parent
- color: "black"
- opacity: 0.5
- }
-
- MouseArea {
- id: control
- anchors.fill: parent
-
- drag {
- target: handle
- minimumY: 0
- maximumY: (bar.height - handle.height)
- axis: Drag.YAxis
- }
-
- onClicked: {
- flickable.contentY = (mouse.y / bar.height * (flickable.contentHeight - flickable.height));
- }
- }
-
- Item {
- id: handle;
- height: Math.max(20, (flickable.visibleArea.heightRatio * bar.height))
-
- anchors {
- left: parent.left
- right: parent.right
- }
-
- Rectangle {
- id: backHandle
- anchors {
- fill: parent
- margins: 1
- }
-
- color: (control.pressed ? "gray" : "white")
- }
- }
- }
-
- Binding {
- target: handle
- property: "y"
- value: (flickable.contentY * control.drag.maximumY / (flickable.contentHeight - flickable.height))
- when: (!control.drag.active)
- }
-
- Binding {
- target: flickable
- property: "contentY"
- value: (handle.y * (flickable.contentHeight - flickable.height) / control.drag.maximumY)
- when: (control.drag.active || control.pressed)
- }
-}
diff --git a/qml/TerminalItem.qml b/qml/TerminalItem.qml
index 6c19c45..51ef98c 100644
--- a/qml/TerminalItem.qml
+++ b/qml/TerminalItem.qml
@@ -4,6 +4,9 @@ import QtQuick.Layouts 1.1
Item {
id: terminalItem
+
+ property int index : 0
+
signal executed
height: elementList.height
@@ -47,7 +50,7 @@ Item {
id: elementList
function createTerminal(program) {
- var terminal = Qt.createComponent("qrc:/EmbeddedTerminal.qml");
+ var terminal = Qt.createComponent("qrc:/EmbeddedTerminal.qml");
var instantiateTerminal = function() {
terminal.createObject(elementList, {
"columns": 90,
@@ -62,7 +65,7 @@ Item {
instantiateTerminal();
} else {
terminal.statusChanged.connect(instantiateTerminal);
- }
+ }
}
RowLayout {
@@ -93,10 +96,13 @@ Item {
TextInput {
id: command
- font.pointSize: 18
+ font {
+ family: "Monospace"
+ pointSize: 18
+ }
color: "white"
- selectedTextColor: "#161616"
selectionColor: "white"
+ selectedTextColor: "#161616"
selectByMouse: true
focus: true
@@ -112,6 +118,15 @@ Item {
}
}
}
+
+ Text {
+ text: terminalItem.index
+ font {
+ family: "Monospace"
+ pointSize: 12
+ }
+ color: "white"
+ }
}
}
}
diff --git a/qml/main.qml b/qml/main.qml
index 1e0db9d..48be124 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -29,9 +29,10 @@ ApplicationWindow {
onHeightChanged: scrollTo(activeItem)
function createItem() {
- var terminalItem = Qt.createComponent("qrc:/TerminalItem.qml");
+ var terminalItem = Qt.createComponent("qrc:/TerminalItem.qml");
var instantiateTerminal = function() {
var instance = terminalItem.createObject(terminalList, {
+ "index": terminalList.children.length,
"width": terminalListFlickable.width
});
instance.onExecuted.connect(createItem);
@@ -160,9 +161,4 @@ ApplicationWindow {
enabled: false
onTriggered: terminalList.selectItem(0)
}
-
- ScrollBar {
- flickable: terminalListFlickable
- handleSize: 10
- }
}
diff --git a/qml/ui.qrc b/qml/ui.qrc
index 8339fa2..add7048 100644
--- a/qml/ui.qrc
+++ b/qml/ui.qrc
@@ -1,8 +1,7 @@
<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- <file>TerminalItem.qml</file>
- <file>EmbeddedTerminal.qml</file>
- <file>ScrollBar.qml</file>
- </qresource>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>TerminalItem.qml</file>
+ <file>EmbeddedTerminal.qml</file>
+ </qresource>
</RCC>