2
* Copyright: 2016 Canonical, Ltd
4
* This file is part of acolyterm
6
* ubuntu-terminal-app is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* ubuntu-terminal-app is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
import QtGraphicalEffects 1.0
23
import Ubuntu.Components 1.3
26
import QMLTermWidget 1.0
28
// Mouse/Touchpad and keyboard support
29
import QtSystemInfo 5.5
32
// objectName for functional testing purposes (autopilot-qt5)
34
objectName: "terminal"
35
applicationName: "com.ubuntu.terminal"
36
automaticOrientation: true
38
AuthenticationService {
53
Component.onCompleted: addTab();
62
Component.onCompleted: push(terminalPage)
64
property bool prevKeyboardVisible: false
66
onCurrentPageChanged: {
67
if(currentPage == terminalPage) {
68
// Restore previous keyboard state.
69
if (prevKeyboardVisible) {
70
Qt.inputMethod.show();
72
Qt.inputMethod.hide();
75
// Force the focus on the widget when the terminal shown.
76
if (terminalPage.terminal) {
77
terminalPage.terminal.forceActiveFocus();
80
// Force the focus out of the terminal widget.
81
currentPage.forceActiveFocus();
82
prevKeyboardVisible = Qt.inputMethod.visible;
83
Qt.inputMethod.hide();
90
// TODO: decide between the expandable button or the two buttons.
93
// anchors {right: parent.right; top: parent.top; margins: units.gu(1);}
95
// childComponent: Component {
97
// color: "#99000000" // Transparent black
98
// radius: width * 0.5
99
// border.color: UbuntuColors.orange;
100
// border.width: units.dp(3)
105
// width: units.gu(3)
107
// anchors.centerIn: parent
114
// iconName: "settings"
115
// onTriggered: pageStack.push(settingsPage)
118
// iconName: "browser-tabs"
119
// onTriggered: pageStack.push(tabsPage)
144
// TODO This is a workaround at the moment.
145
// The application should get them from the c++.
146
model: ["GreenOnBlack","WhiteOnBlack","BlackOnWhite","BlackOnRandomLight","Linux","cool-retro-term","DarkPastels","BlackOnLightYellow", "Ubuntu"]
148
// TRANSLATORS: This is the name of a terminal color scheme which is displayed in the settings
149
namesModel: [i18n.tr("Green on black"),i18n.tr("White on black"),i18n.tr("Black on white"),i18n.tr("Black on random light"),i18n.tr("Linux"),i18n.tr("Cool retro term"),i18n.tr("Dark pastels / Ubuntu (old)"),i18n.tr("Black on light yellow"),i18n.tr("Ubuntu")]
153
Component.onCompleted: {
154
tabsModel.selectTab(0);
156
// The margins for the terminal canvas are 2px
157
// Hardcoded value from TerminalDisplay.h
158
width = 80 * terminalPage.terminal.fontMetrics.width + 2
159
height = 24 * terminalPage.terminal.fontMetrics.height + 2
164
filter: InputInfo.Keyboard
169
filter: InputInfo.Mouse
174
filter: InputInfo.TouchPad
177
// WORKAROUND: Not yet implemented in the SDK
180
property: "mouseAttached"
181
value: miceModel.count > 0 || touchpadsModel.count > 0
184
// WORKAROUND: Not yet implemented in the SDK
187
property: "keyboardAttached"
188
value: keyboardsModel.count > 0