| 1 |
/* |
| 2 |
* Copyright (C) 2016 Canonical Ltd |
| 3 |
* |
| 4 |
* This program is free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License version 3 as |
| 6 |
* published by the Free Software Foundation. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
* |
| 16 |
* Authored by: Florian Boucault <[email protected]> |
| 17 |
*/ |
| 18 |
|
| 19 |
import QtQuick 2.4 |
| 20 |
import QtQuick.Layouts 1.3 |
| 21 |
import Lomiri.Components 1.3 |
| 22 |
import Terminal 0.1 |
| 23 |
import QMLTermWidget 1.0 |
| 24 |
import GSettings 1.0 |
| 25 |
|
| 26 |
SettingsSection { |
| 27 |
id: section |
| 28 |
|
| 29 |
windowColor: theme.palette.selected.overlay |
| 30 |
flickableItem: scrollView.flickableItem |
| 31 |
|
| 32 |
GSettings { |
| 33 |
id: lomiriSettings |
| 34 |
schema.id: "com.lomiri.Shell" |
| 35 |
} |
| 36 |
|
| 37 |
ScrollView { |
| 38 |
id: scrollView |
| 39 |
anchors.fill: parent |
| 40 |
|
| 41 |
Item { |
| 42 |
// not a child of ScrollView, but it's reparented to |
| 43 |
// ScrollView.viewport. For that reason we can not use 'anchors' |
| 44 |
// but we have to set the width instead. |
| 45 |
width: section.width |
| 46 |
height: childrenRect.height + 2 * section.margins |
| 47 |
|
| 48 |
Column { |
| 49 |
anchors { |
| 50 |
right: parent.right |
| 51 |
left: parent.left |
| 52 |
top: parent.top |
| 53 |
margins: section.margins |
| 54 |
} |
| 55 |
|
| 56 |
spacing: units.gu(1) |
| 57 |
|
| 58 |
SettingsCard { |
| 59 |
id: securityCard |
| 60 |
|
| 61 |
title: i18n.tr("Security") |
| 62 |
|
| 63 |
Column { |
| 64 |
spacing: units.gu(2) |
| 65 |
|
| 66 |
CheckBox { |
| 67 |
id: authenticationCheckbox |
| 68 |
text: i18n.tr("Require authentication at startup") |
| 69 |
onCheckedChanged: settings.authenticationRequired = checked |
| 70 |
Binding { |
| 71 |
target: authenticationCheckbox |
| 72 |
property: "checked" |
| 73 |
value: settings.authenticationRequired |
| 74 |
} |
| 75 |
} |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
SettingsCard { |
| 80 |
id: textCard |
| 81 |
|
| 82 |
title: i18n.tr("Text") |
| 83 |
|
| 84 |
Row { |
| 85 |
spacing: units.gu(2) |
| 86 |
|
| 87 |
Item { |
| 88 |
width: childrenRect.width |
| 89 |
height: childrenRect.height |
| 90 |
|
| 91 |
Label { |
| 92 |
id: fontStyleLabel |
| 93 |
text: i18n.tr("Font:") |
| 94 |
} |
| 95 |
|
| 96 |
ComboBox { |
| 97 |
id: fontStyleCombo |
| 98 |
anchors { |
| 99 |
top: fontStyleLabel.bottom |
| 100 |
topMargin: units.gu(1) |
| 101 |
} |
| 102 |
|
| 103 |
function fontFamilyFromModel(model) { |
| 104 |
return model; |
| 105 |
} |
| 106 |
model: Fonts.monospaceFamilies |
| 107 |
bindingTarget: settings |
| 108 |
bindingProperty: "fontStyle" |
| 109 |
} |
| 110 |
} |
| 111 |
|
| 112 |
Item { |
| 113 |
width: childrenRect.width |
| 114 |
height: childrenRect.height |
| 115 |
|
| 116 |
Label { |
| 117 |
id: fontSizeLabel |
| 118 |
text: i18n.tr("Font Size:") |
| 119 |
} |
| 120 |
|
| 121 |
ComboBox { |
| 122 |
id: fontSizeCombo |
| 123 |
anchors { |
| 124 |
top: fontSizeLabel.bottom |
| 125 |
topMargin: units.gu(1) |
| 126 |
} |
| 127 |
width: units.gu(9) |
| 128 |
function arrayOfNumbers(min, max) { |
| 129 |
var list = []; |
| 130 |
for (var i = min; i <= max; i++) { |
| 131 |
list.push(i); |
| 132 |
} |
| 133 |
return list; |
| 134 |
} |
| 135 |
model: arrayOfNumbers(settings.minFontSize, settings.maxFontSize) |
| 136 |
bindingTarget: settings |
| 137 |
bindingProperty: "fontSize" |
| 138 |
} |
| 139 |
} |
| 140 |
} |
| 141 |
} |
| 142 |
|
| 143 |
SettingsCard { |
| 144 |
id: cursorCard |
| 145 |
|
| 146 |
title: i18n.tr("Cursor") |
| 147 |
|
| 148 |
Column { |
| 149 |
spacing: units.gu(2) |
| 150 |
|
| 151 |
CheckBox { |
| 152 |
id: blinkCursorCheckbox |
| 153 |
text: i18n.tr("Blinking cursor") |
| 154 |
onCheckedChanged: settings.blinkingCursor = checked |
| 155 |
Binding { |
| 156 |
target: blinkCursorCheckbox |
| 157 |
property: "checked" |
| 158 |
value: settings.blinkingCursor |
| 159 |
} |
| 160 |
} |
| 161 |
} |
| 162 |
} |
| 163 |
|
| 164 |
SettingsCard { |
| 165 |
id: colorsCard |
| 166 |
|
| 167 |
title: i18n.tr("Colors") |
| 168 |
|
| 169 |
// TODO This is a workaround at the moment. |
| 170 |
// The application should get them from the c++. |
| 171 |
property var model: [ |
| 172 |
{"name": i18n.tr("Ubuntu"), "value": "Ubuntu"}, |
| 173 |
{"name": i18n.tr("Green on black"), "value": "GreenOnBlack"}, |
| 174 |
{"name": i18n.tr("White on black"), "value": "WhiteOnBlack"}, |
| 175 |
{"name": i18n.tr("Black on white"), "value": "BlackOnWhite"}, |
| 176 |
{"name": i18n.tr("Black on random light"), "value": "BlackOnRandomLight"}, |
| 177 |
{"name": i18n.tr("Linux"), "value": "Linux"}, |
| 178 |
{"name": i18n.tr("Cool retro term"), "value": "cool-retro-term"}, |
| 179 |
{"name": i18n.tr("Dark pastels"), "value": "DarkPastels"}, |
| 180 |
{"name": i18n.tr("Black on light yellow"), "value": "BlackOnLightYellow"}, |
| 181 |
{"name": i18n.tr("Customized"), "value": terminalAppRoot.customizedSchemeName}, |
| 182 |
] |
| 183 |
|
| 184 |
property var currentScheme: ColorSchemeManager.findColorScheme(settings.colorScheme) |
| 185 |
|
| 186 |
Column { |
| 187 |
spacing: units.gu(2) |
| 188 |
|
| 189 |
Row { |
| 190 |
ColorRow { |
| 191 |
width: units.gu(16) |
| 192 |
title: i18n.tr("Background:") |
| 193 |
colorScheme: colorsCard.currentScheme |
| 194 |
start: 1 |
| 195 |
count: 1 |
| 196 |
} |
| 197 |
|
| 198 |
ColorRow { |
| 199 |
width: units.gu(16) |
| 200 |
title: i18n.tr("Text:") |
| 201 |
colorScheme: colorsCard.currentScheme |
| 202 |
start: 0 |
| 203 |
count: 1 |
| 204 |
} |
| 205 |
} |
| 206 |
|
| 207 |
BackgroundOpacityEditor { |
| 208 |
colorScheme: colorsCard.currentScheme |
| 209 |
} |
| 210 |
|
| 211 |
ColorRow { |
| 212 |
title: i18n.tr("Normal palette:") |
| 213 |
colorScheme: colorsCard.currentScheme |
| 214 |
start: 2 |
| 215 |
count: 8 |
| 216 |
} |
| 217 |
|
| 218 |
ColorRow { |
| 219 |
title: i18n.tr("Bright palette:") |
| 220 |
colorScheme: colorsCard.currentScheme |
| 221 |
start: 12 |
| 222 |
count: 8 |
| 223 |
} |
| 224 |
|
| 225 |
Column { |
| 226 |
spacing: units.gu(1) |
| 227 |
Label { |
| 228 |
text: i18n.tr("Preset:") |
| 229 |
} |
| 230 |
|
| 231 |
ComboBox { |
| 232 |
model: colorsCard.model |
| 233 |
bindingTarget: settings |
| 234 |
bindingProperty: "colorScheme" |
| 235 |
textRole: "name" |
| 236 |
valueRole: "value" |
| 237 |
} |
| 238 |
} |
| 239 |
} |
| 240 |
} |
| 241 |
|
| 242 |
SettingsCard { |
| 243 |
id: gesturesCard |
| 244 |
|
| 245 |
readonly property real comboBoxWidth: Math.min(width * 0.8, units.gu(35)) |
| 246 |
|
| 247 |
title: i18n.tr("Gestures") |
| 248 |
|
| 249 |
Column { |
| 250 |
spacing: units.gu(3) |
| 251 |
anchors { |
| 252 |
left: parent.left |
| 253 |
right: parent.right |
| 254 |
} |
| 255 |
|
| 256 |
Column { |
| 257 |
spacing: units.gu(2) |
| 258 |
|
| 259 |
CheckBox { |
| 260 |
id: enableTouchGesturesCheckbox |
| 261 |
text: i18n.tr("Enable touch gestures") |
| 262 |
onCheckedChanged: settings.enableTouchGestures = checked |
| 263 |
Binding { |
| 264 |
target: enableTouchGesturesCheckbox |
| 265 |
property: "checked" |
| 266 |
value: settings.enableTouchGestures |
| 267 |
} |
| 268 |
} |
| 269 |
|
| 270 |
CheckBox { |
| 271 |
id: forceDisableTouchGesturesHapticsCheckbox |
| 272 |
visible: settings.enableTouchGestures |
| 273 |
text: i18n.tr("Force disable haptics") |
| 274 |
onCheckedChanged: settings.forceDisableTouchGesturesHaptics = checked |
| 275 |
Binding { |
| 276 |
target: forceDisableTouchGesturesHapticsCheckbox |
| 277 |
property: "checked" |
| 278 |
value: settings.forceDisableTouchGesturesHaptics |
| 279 |
} |
| 280 |
} |
| 281 |
} |
| 282 |
|
| 283 |
Column { |
| 284 |
visible: settings.enableTouchGestures |
| 285 |
spacing: units.gu(1) |
| 286 |
Label { |
| 287 |
text: i18n.tr("One-finger tap:") |
| 288 |
} |
| 289 |
|
| 290 |
ComboBox { |
| 291 |
width: gesturesCard.comboBoxWidth |
| 292 |
model: [ |
| 293 |
{ "name": i18n.tr("Disabled"), "value": 0 }, |
| 294 |
{ "name": i18n.tr("Tab (Auto-completion)"), "value": 1 }, |
| 295 |
] |
| 296 |
bindingTarget: settings |
| 297 |
bindingProperty: "oneFingerTapFunction" |
| 298 |
textRole: "name" |
| 299 |
valueRole: "value" |
| 300 |
} |
| 301 |
} |
| 302 |
|
| 303 |
Column { |
| 304 |
visible: settings.enableTouchGestures |
| 305 |
spacing: units.gu(1) |
| 306 |
Label { |
| 307 |
text: i18n.tr("One-finger horizontal swipe:") |
| 308 |
} |
| 309 |
|
| 310 |
ComboBox { |
| 311 |
width: gesturesCard.comboBoxWidth |
| 312 |
model: [ |
| 313 |
{ "name": i18n.tr("Disabled"), "value": 0 }, |
| 314 |
{ "name": i18n.tr("Left/Right Keys (Move cursor)"), "value": 1 }, |
| 315 |
] |
| 316 |
bindingTarget: settings |
| 317 |
bindingProperty: "oneFingerHorizontalSwipe" |
| 318 |
textRole: "name" |
| 319 |
valueRole: "value" |
| 320 |
} |
| 321 |
|
| 322 |
ComboBox { |
| 323 |
visible: settings.oneFingerHorizontalSwipe !== 0 |
| 324 |
width: gesturesCard.comboBoxWidth |
| 325 |
model: [ |
| 326 |
{ "name": i18n.tr("Default sensitivity"), "value": 0 }, |
| 327 |
{ "name": i18n.tr("Low sensitivity"), "value": 1 }, |
| 328 |
{ "name": i18n.tr("Medium sensitivity"), "value": 2 }, |
| 329 |
{ "name": i18n.tr("High sensitivity"), "value": 3 }, |
| 330 |
] |
| 331 |
bindingTarget: settings |
| 332 |
bindingProperty: "oneFingerHorizontalSwipeSensitivity" |
| 333 |
textRole: "name" |
| 334 |
valueRole: "value" |
| 335 |
} |
| 336 |
} |
| 337 |
|
| 338 |
Column { |
| 339 |
visible: settings.enableTouchGestures |
| 340 |
spacing: units.gu(1) |
| 341 |
Label { |
| 342 |
text: i18n.tr("One-finger vertical swipe:") |
| 343 |
} |
| 344 |
|
| 345 |
ComboBox { |
| 346 |
width: gesturesCard.comboBoxWidth |
| 347 |
model: [ |
| 348 |
{ "name": i18n.tr("Disabled"), "value": 0 }, |
| 349 |
{ "name": i18n.tr("Up/Down Keys (History)"), "value": 1 }, |
| 350 |
{ "name": i18n.tr("Mouse Wheel (Scroll)"), "value": 2 }, |
| 351 |
] |
| 352 |
bindingTarget: settings |
| 353 |
bindingProperty: "oneFingerVerticalSwipe" |
| 354 |
textRole: "name" |
| 355 |
valueRole: "value" |
| 356 |
} |
| 357 |
|
| 358 |
ComboBox { |
| 359 |
visible: settings.oneFingerVerticalSwipe !== 0 |
| 360 |
width: gesturesCard.comboBoxWidth |
| 361 |
model: [ |
| 362 |
{ "name": i18n.tr("Default sensitivity"), "value": 0 }, |
| 363 |
{ "name": i18n.tr("Low sensitivity"), "value": 1 }, |
| 364 |
{ "name": i18n.tr("Medium sensitivity"), "value": 2 }, |
| 365 |
{ "name": i18n.tr("High sensitivity"), "value": 3 }, |
| 366 |
] |
| 367 |
bindingTarget: settings |
| 368 |
bindingProperty: "oneFingerVerticalSwipeSensitivity" |
| 369 |
textRole: "name" |
| 370 |
valueRole: "value" |
| 371 |
} |
| 372 |
} |
| 373 |
|
| 374 |
Column { |
| 375 |
visible: settings.enableTouchGestures |
| 376 |
spacing: units.gu(1) |
| 377 |
Label { |
| 378 |
text: i18n.tr("Two-finger vertical swipe:") |
| 379 |
} |
| 380 |
|
| 381 |
ComboBox { |
| 382 |
width: gesturesCard.comboBoxWidth |
| 383 |
model: [ |
| 384 |
{ "name": i18n.tr("Disabled"), "value": 0 }, |
| 385 |
{ "name": i18n.tr("Mouse Wheel (Scroll)"), "value": 1 }, |
| 386 |
{ "name": i18n.tr("Up/Down Keys (History)"), "value": 2 }, |
| 387 |
] |
| 388 |
bindingTarget: settings |
| 389 |
bindingProperty: "twoFingerVerticalSwipe" |
| 390 |
textRole: "name" |
| 391 |
valueRole: "value" |
| 392 |
} |
| 393 |
|
| 394 |
ComboBox { |
| 395 |
visible: settings.twoFingerVerticalSwipe !== 0 |
| 396 |
width: gesturesCard.comboBoxWidth |
| 397 |
model: [ |
| 398 |
{ "name": i18n.tr("Default sensitivity"), "value": 0 }, |
| 399 |
{ "name": i18n.tr("Low sensitivity"), "value": 1 }, |
| 400 |
{ "name": i18n.tr("Medium sensitivity"), "value": 2 }, |
| 401 |
{ "name": i18n.tr("High sensitivity"), "value": 3 }, |
| 402 |
] |
| 403 |
bindingTarget: settings |
| 404 |
bindingProperty: "twoFingerVerticalSwipeSensitivity" |
| 405 |
textRole: "name" |
| 406 |
valueRole: "value" |
| 407 |
} |
| 408 |
} |
| 409 |
|
| 410 |
Label { |
| 411 |
visible: settings.enableTouchGestures |
| 412 |
anchors { |
| 413 |
left: parent.left |
| 414 |
right: parent.right |
| 415 |
} |
| 416 |
font.italic: true |
| 417 |
text: i18n.tr("** Default sensitivity is based on current font size while other options behave consistently") |
| 418 |
wrapMode: Text.WordWrap |
| 419 |
} |
| 420 |
} |
| 421 |
} |
| 422 |
|
| 423 |
SettingsCard { |
| 424 |
id: layoutsCard |
| 425 |
visible: !QuickUtils.keyboardAttached || lomiriSettings.alwaysShowOsk |
| 426 |
title: i18n.tr("Layouts") |
| 427 |
|
| 428 |
Column { |
| 429 |
width: Math.min(parent.width, units.gu(32)) |
| 430 |
|
| 431 |
Repeater { |
| 432 |
model: settings.profilesList |
| 433 |
delegate: RowLayout { |
| 434 |
anchors { |
| 435 |
left: parent.left |
| 436 |
right: parent.right |
| 437 |
} |
| 438 |
height: units.gu(5) |
| 439 |
|
| 440 |
Label { |
| 441 |
text: name |
| 442 |
Layout.fillWidth: true |
| 443 |
} |
| 444 |
|
| 445 |
Switch { |
| 446 |
checked: profileVisible |
| 447 |
property bool completed: false |
| 448 |
onCheckedChanged: { |
| 449 |
settings.profilesList.setProperty(index, "profileVisible", checked); |
| 450 |
if (completed) settings.profilesChanged(); |
| 451 |
} |
| 452 |
Component.onCompleted: completed = true |
| 453 |
} |
| 454 |
} |
| 455 |
} |
| 456 |
} |
| 457 |
} |
| 458 |
} |
| 459 |
} |
| 460 |
} |
| 461 |
} |