diff options
Diffstat (limited to 'src/list')
-rw-r--r-- | src/list/TerminalItem.qml | 25 | ||||
-rw-r--r-- | src/list/TerminalList.qml | 14 |
2 files changed, 16 insertions, 23 deletions
diff --git a/src/list/TerminalItem.qml b/src/list/TerminalItem.qml index 4c71be4..06b60b9 100644 --- a/src/list/TerminalItem.qml +++ b/src/list/TerminalItem.qml @@ -6,19 +6,11 @@ import Qt.labs.settings 1.0 Item { id: item - property int index : 0 property EmbeddedTerminal terminal : null + property int index : 0 signal executed (int index) - property Settings settings : Settings { - category: "item" - - property int fontSize : 18 - property string fontFamily : "Monospace" - property string fontColor : "white" - } - anchors { left: parent.left right: parent.right @@ -106,6 +98,7 @@ Item { var terminalComponent = Qt.createComponent("qrc:/EmbeddedTerminal.qml"); var instantiateTerminal = function() { item.terminal = terminalComponent.createObject(elementList, { + "settings" : settings, "program" : program, "workingDirectory" : "$HOME", "focus" : true @@ -136,12 +129,12 @@ Item { id: command font { - family: settings.fontFamily - pointSize: settings.fontSize + family: settings.item.fontFamily + pointSize: settings.item.fontSize } - color: settings.fontColor - selectionColor: settings.fontColor + color: settings.item.fontColor + selectionColor: settings.item.fontColor selectedTextColor: "#161616" selectByMouse: true @@ -162,10 +155,10 @@ Item { Text { font { - family: settings.fontFamily - pointSize: settings.fontSize / 1.5 + family: settings.item.fontFamily + pointSize: settings.item.fontSize / 1.5 } - color: settings.fontColor + color: settings.item.fontColor text: item.index } diff --git a/src/list/TerminalList.qml b/src/list/TerminalList.qml index 6c6465b..9c1636f 100644 --- a/src/list/TerminalList.qml +++ b/src/list/TerminalList.qml @@ -4,12 +4,13 @@ import QtQuick.Layouts 1.1 Item { id: item - property StateHandler state : null - property int activeItem : 0 - property int itemIndex : 0 + property int activeItem : 0 + property int itemIndex : 0 property alias children : column.children + property Component terminalItem : Component { TerminalItem { } } + function onItemExecuted(index) { if ( index === (children.length - 1) ) { createItem(); @@ -17,11 +18,10 @@ Item { } function createItem() { - var terminalItem = Qt.createComponent("qrc:/TerminalItem.qml"); var instantiateTerminal = function() { var instance = terminalItem.createObject(column, { - "index": itemIndex, - "width": flickable.width + "index" : itemIndex, + "width" : flickable.width }); instance.onExecuted.connect(onItemExecuted); @@ -67,7 +67,7 @@ Item { if ( activeItem < (children.length - 1) ) { selectItem(activeItem + 1); } else { - state.enterInsertMode(); + mode.enterInsertMode(); } } |