~verzegnassi-stefano/+junk/ubuntu-terminal-app-uitk13

« back to all changes in this revision

Viewing changes to src/app/qml/ubuntu-terminal-app.qml

  • Committer: Filippo Scognamiglio
  • Date: 2014-10-25 04:42:31 UTC
  • Revision ID: flscogna@gmail.com-20141025044231-javjhusbqa171127
Initial reboot commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.3
 
2
import QtGraphicalEffects 1.0
 
3
import Ubuntu.Components 1.1
 
4
import QMLTermWidget 1.0
 
5
 
 
6
MainView {
 
7
    // objectName for functional testing purposes (autopilot-qt5)
 
8
    id: mview
 
9
    objectName: "terminal"
 
10
    applicationName: "com.ubuntu.terminal"
 
11
    automaticOrientation: true
 
12
 
 
13
    backgroundColor: terminal.backgroundColor
 
14
 
 
15
    width: units.gu(50)
 
16
    height: units.gu(75)
 
17
 
 
18
    AuthenticationService {
 
19
        onDenied: Qt.quit()
 
20
    }
 
21
 
 
22
    Page {
 
23
        id: terminalPage
 
24
        anchors.fill: parent
 
25
 
 
26
        QMLTermWidget {
 
27
            id: terminal
 
28
            width: parent.width
 
29
            height: parent.height - Qt.inputMethod.keyboardRectangle.height
 
30
 
 
31
            //shellProgram: "top"
 
32
            onSessionFinished: Qt.quit()
 
33
            initialWorkingDirectory: "$HOME"
 
34
            colorScheme: "WhiteOnBlack"
 
35
 
 
36
            TerminalInputArea{
 
37
                anchors.fill: parent
 
38
                onMouseMoveDetected: terminal.simulateMouseMove(x, y, button, buttons, modifiers);
 
39
                onDoubleClickDetected: terminal.simulateMouseDoubleClick(x, y, button, buttons, modifiers);
 
40
                onMousePressDetected: terminal.simulateMousePress(x, y, button, buttons, modifiers);
 
41
                onMouseReleaseDetected: terminal.simulateMouseRelease(x, y, button, buttons, modifiers);
 
42
                onMouseWheelDetected: terminal.simulateWheel(x, y, buttons, modifiers, angleDelta);
 
43
                onSwipeUpDetected: terminal.simulateKeyPress(Qt.Key_Up, Qt.NoModifier, true, 0, "");
 
44
                onSwipeDownDetected: terminal.simulateKeyPress(Qt.Key_Down, Qt.NoModifier, true, 0, "");
 
45
                onTouchPress: terminal.simulateKeyPress(Qt.Key_Tab, Qt.NoModifier, true, 0, "");
 
46
            }
 
47
 
 
48
            font.pointSize: 14
 
49
            font.family: "Ubuntu Mono"
 
50
 
 
51
            Component.onCompleted: {
 
52
                terminal.startShellProgram();
 
53
                forceActiveFocus();
 
54
            }
 
55
        }
 
56
 
 
57
        // Floating Keyboard button
 
58
        Rectangle {
 
59
            anchors.bottom: parent.bottom
 
60
            anchors.right: parent.right
 
61
            anchors.margins: units.gu(2)
 
62
            color: "black"
 
63
            opacity: 0.3
 
64
            width: units.gu(7)
 
65
            height: width
 
66
            radius: width * 0.5
 
67
            border.color: "white"
 
68
            border.width: units.gu(1)
 
69
            z: 2
 
70
 
 
71
            Text {
 
72
                anchors.centerIn: parent
 
73
                color: "white"
 
74
                text: "VKB"
 
75
            }
 
76
 
 
77
            MouseArea{
 
78
                anchors.fill: parent
 
79
                onPressed: {
 
80
                    Qt.inputMethod.show();
 
81
                    terminal.forceActiveFocus();
 
82
                }
 
83
            }
 
84
        }
 
85
    }
 
86
}