| 1 |
import QtQuick 2.12 |
| 2 |
import Lomiri.Components 1.3 |
| 3 |
import Qt.labs.settings 1.0 |
| 4 |
import Lomiri.Components.ListItems 1.3 as ListItems |
| 5 |
|
| 6 |
Page { |
| 7 |
id:_advancedOptionsPage |
| 8 |
|
| 9 |
|
| 10 |
signal back(); |
| 11 |
|
| 12 |
property Settings settings: viewFinderView.finderOverlay.settings |
| 13 |
|
| 14 |
header: PageHeader { |
| 15 |
id:_advancedOptionsPageHeader |
| 16 |
StyleHints { |
| 17 |
backgroundColor:"transparent" |
| 18 |
foregroundColor: theme.palette.normal.backgroundText |
| 19 |
} |
| 20 |
title: i18n.tr("Settings") |
| 21 |
leadingActionBar.actions: [ |
| 22 |
Action { |
| 23 |
iconName: "close" |
| 24 |
text: i18n.tr("Close") |
| 25 |
onTriggered: _advancedOptionsPage.back(); |
| 26 |
} |
| 27 |
] |
| 28 |
|
| 29 |
trailingActionBar.actions: [ |
| 30 |
Action { |
| 31 |
iconName: "info" |
| 32 |
text: i18n.tr("About") |
| 33 |
onTriggered: { |
| 34 |
galleryPageStack.push(infoPageComponent) |
| 35 |
} |
| 36 |
} |
| 37 |
] |
| 38 |
} |
| 39 |
|
| 40 |
Flickable { |
| 41 |
id:advancedOptions |
| 42 |
|
| 43 |
property Settings settings: viewFinderOverlay.settings |
| 44 |
|
| 45 |
anchors { |
| 46 |
top: _advancedOptionsPageHeader.bottom |
| 47 |
left:parent.left |
| 48 |
right:parent.right |
| 49 |
bottom:parent.bottom |
| 50 |
margins: units.gu(2) |
| 51 |
} |
| 52 |
|
| 53 |
interactive: true |
| 54 |
flickableDirection: Flickable.VerticalFlick |
| 55 |
|
| 56 |
Column { |
| 57 |
|
| 58 |
anchors.fill: parent |
| 59 |
|
| 60 |
ListItem { |
| 61 |
ListItemLayout { |
| 62 |
id: datestampSwitchLayout |
| 63 |
title.text: i18n.tr("Add date stamp on captured images") |
| 64 |
title.color: theme.palette.normal.backgroundText |
| 65 |
title.horizontalAlignment:Text.AlignLeft |
| 66 |
Switch { |
| 67 |
SlotsLayout.position: SlotsLayout.Last |
| 68 |
checked: settings.dateStampImages |
| 69 |
onClicked: settings.dateStampImages = checked |
| 70 |
} |
| 71 |
} |
| 72 |
} |
| 73 |
ListItems.Expandable { |
| 74 |
id:dateStampExpand |
| 75 |
expanded: settings.dateStampImages |
| 76 |
collapsedHeight: 0 |
| 77 |
expandedHeight: units.gu(27) |
| 78 |
collapseOnClick: false |
| 79 |
highlightWhenPressed: false |
| 80 |
|
| 81 |
ListItem { |
| 82 |
id: datestampFormatItem |
| 83 |
divider.visible: false |
| 84 |
ListItemLayout { |
| 85 |
// TRANSLATORS: this refers to the opacity of date stamp added to captured images |
| 86 |
title.text: i18n.tr("Format") |
| 87 |
title.horizontalAlignment:Text.AlignLeft |
| 88 |
title.color: theme.palette.normal.backgroundText |
| 89 |
TextField { |
| 90 |
id:dateFormatText |
| 91 |
SlotsLayout.position: SlotsLayout.Last |
| 92 |
focus: true |
| 93 |
width:datestampFormatItem.width - units.gu(18) |
| 94 |
text: settings.dateStampFormat |
| 95 |
placeholderText: Qt.locale().dateFormat(Locale.ShortFormat) |
| 96 |
onActiveFocusChanged: if(!text) {text = Qt.locale().dateFormat(Locale.ShortFormat);} |
| 97 |
onTextChanged: { |
| 98 |
settings.dateStampFormat = text; |
| 99 |
} |
| 100 |
} |
| 101 |
} |
| 102 |
} |
| 103 |
ListItems.Expandable { |
| 104 |
id:dateStampFormatExpand |
| 105 |
z:1 |
| 106 |
anchors { |
| 107 |
top:datestampFormatItem.bottom |
| 108 |
right: datestampFormatItem.right |
| 109 |
left:datestampFormatItem.left |
| 110 |
bottom: dateStampExpand.bottom |
| 111 |
} |
| 112 |
collapseOnClick: false |
| 113 |
highlightWhenPressed: false |
| 114 |
collapsedHeight: 0 |
| 115 |
expandedHeight: units.gu(20) |
| 116 |
expanded: dateFormatText.activeFocus || dateStampFormatExpandFocus.activeFocus |
| 117 |
FocusScope { |
| 118 |
id:dateStampFormatExpandFocus |
| 119 |
anchors { |
| 120 |
right: parent.right |
| 121 |
left:parent.left |
| 122 |
} |
| 123 |
height:dateStampFormatExpand.expandedHeight |
| 124 |
LomiriShapeOverlay { |
| 125 |
width:dateStampFormatExpandList.width |
| 126 |
height:dateStampFormatExpandList.height |
| 127 |
backgroundColor: "white" |
| 128 |
overlayRect: Qt.rect(0,0,1,1) |
| 129 |
} |
| 130 |
|
| 131 |
ListView { |
| 132 |
id:dateStampFormatExpandList |
| 133 |
anchors.fill: parent |
| 134 |
orientation: ListView.Vertical |
| 135 |
interactive: true |
| 136 |
|
| 137 |
header:Label { |
| 138 |
anchors.horizontalCenter: parent.horizontalCenter |
| 139 |
text:i18n.tr("Date formatting keywords") |
| 140 |
horizontalAlignment: Text.horizontalCenter |
| 141 |
} |
| 142 |
|
| 143 |
model:[ |
| 144 |
{ "seq" : "d", "desc" : i18n.tr("the day as number without a leading zero (1 to 31)") }, |
| 145 |
{ "seq" : "dd", "desc" : i18n.tr("the day as number with a leading zero (01 to 31)") }, |
| 146 |
{ "seq" : "ddd", "desc" : i18n.tr("the abbreviated localized day name (e.g. 'Mon' to 'Sun').") }, |
| 147 |
{ "seq" : "dddd", "desc" : i18n.tr("the long localized day name (e.g. 'Monday' to 'Sunday').") }, |
| 148 |
{ "seq" : "M", "desc" : i18n.tr("the month as number without a leading zero (1 to 12)") }, |
| 149 |
{ "seq" : "MM", "desc" : i18n.tr("the month as number with a leading zero (01 to 12)") }, |
| 150 |
{ "seq" : "MMM", "desc" : i18n.tr("the abbreviated localized month name (e.g. 'Jan' to 'Dec').") }, |
| 151 |
{ "seq" : "MMMM", "desc" : i18n.tr("the long localized month name (e.g. 'January' to 'December').") }, |
| 152 |
{ "seq" : "yy", "desc" : i18n.tr("the year as two digit number (00 to 99)") }, |
| 153 |
{ "seq" : "yyyy", "desc" : i18n.tr("the year as four digit number. If the year is negative, a minus sign is prepended in addition.") }, |
| 154 |
{ "seq" : "h", "desc" : i18n.tr("the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)") }, |
| 155 |
{ "seq" : "hh", "desc" : i18n.tr("the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)") }, |
| 156 |
{ "seq" : "H", "desc" : i18n.tr("the hour without a leading zero (0 to 23, even with AM/PM display)") }, |
| 157 |
{ "seq" : "HH", "desc" : i18n.tr("the hour with a leading zero (00 to 23, even with AM/PM display)") }, |
| 158 |
{ "seq" : "m", "desc" : i18n.tr("the minute without a leading zero (0 to 59)") }, |
| 159 |
{ "seq" : "mm", "desc" : i18n.tr("the minute with a leading zero (00 to 59)") }, |
| 160 |
{ "seq" : "s", "desc" : i18n.tr("the second without a leading zero (0 to 59)") }, |
| 161 |
{ "seq" : "ss", "desc" : i18n.tr("the second with a leading zero (00 to 59)") }, |
| 162 |
{ "seq" : "z", "desc" : i18n.tr("the milliseconds without leading zeroes (0 to 999)") }, |
| 163 |
{ "seq" : "zzz", "desc" : i18n.tr("the milliseconds with leading zeroes (000 to 999)") }, |
| 164 |
{ "seq" : "AP", "desc" : i18n.tr("use AM/PM display. AP will be replaced by either 'AM' or 'PM'.") }, |
| 165 |
{ "seq" : "ap", "desc" : i18n.tr("use am/pm display. ap will be replaced by either 'am' or 'pm'.") }, |
| 166 |
{ "seq" : "t", "desc" : i18n.tr("the timezone (for example 'CEST')") } |
| 167 |
] |
| 168 |
delegate: ListItem { |
| 169 |
height:units.gu(8) |
| 170 |
divider.visible: false |
| 171 |
highlightColor: color |
| 172 |
trailingActions: ListItemActions { |
| 173 |
actions: [ |
| 174 |
Action { |
| 175 |
text: i18n.tr("Add to Format") |
| 176 |
iconName:"add" |
| 177 |
onTriggered:{ |
| 178 |
var addSpace = dateFormatText.text.match(/\w$/); |
| 179 |
dateFormatText.text += (addSpace ? " " : "") + modelData.seq; |
| 180 |
dateFormatText.focus = true; |
| 181 |
} |
| 182 |
} |
| 183 |
] |
| 184 |
|
| 185 |
} |
| 186 |
ListItemLayout { |
| 187 |
title.text: modelData.seq |
| 188 |
summary.text: modelData.desc |
| 189 |
} |
| 190 |
} |
| 191 |
} |
| 192 |
} |
| 193 |
} |
| 194 |
|
| 195 |
ListItem { |
| 196 |
id: dateStampColorItem |
| 197 |
anchors.top : dateStampFormatExpand.bottom |
| 198 |
anchors.margins:units.gu(1) |
| 199 |
height:units.gu(5) |
| 200 |
divider.visible: false |
| 201 |
ListItemLayout { |
| 202 |
id: dateStampColorItemLayout |
| 203 |
|
| 204 |
title.color: theme.palette.normal.backgroundText |
| 205 |
// TRANSLATORS: this refers to the color of date stamp added to captured images |
| 206 |
title.text:i18n.tr("Color") |
| 207 |
title.horizontalAlignment:Text.AlignLeft |
| 208 |
|
| 209 |
ListView { |
| 210 |
id:dateStampColor |
| 211 |
|
| 212 |
width:dateFormatText.width |
| 213 |
height:dateStampColorItem.height |
| 214 |
SlotsLayout.position: SlotsLayout.Last |
| 215 |
|
| 216 |
spacing: units.gu(1) |
| 217 |
orientation: ListView.Horizontal |
| 218 |
interactive: true |
| 219 |
snapMode: ListView.SnapToItem |
| 220 |
highlightFollowsCurrentItem: true |
| 221 |
highlightMoveDuration: LomiriAnimation.SnapDuration |
| 222 |
clip:true |
| 223 |
|
| 224 |
function getItemIdx(item) { |
| 225 |
for(var i in model ) { |
| 226 |
if(item == model[i]) { |
| 227 |
return i; |
| 228 |
} |
| 229 |
} |
| 230 |
return -1; |
| 231 |
} |
| 232 |
|
| 233 |
Component.onCompleted: { |
| 234 |
var newColors = []; |
| 235 |
var existingColors = {}; |
| 236 |
for(var i in LomiriColors) { |
| 237 |
if( typeof(LomiriColors[i]) == "object" && !(LomiriColors[i].stops) && !existingColors[LomiriColors[i].toString()] ) { |
| 238 |
newColors.push(LomiriColors[i]); |
| 239 |
existingColors[LomiriColors[i].toString()] = true; |
| 240 |
} |
| 241 |
} |
| 242 |
model = newColors; |
| 243 |
currentIndex = dateStampColor.getItemIdx( settings.dateStampColor); |
| 244 |
positionViewAtIndex(currentIndex, ListView.Center); |
| 245 |
} |
| 246 |
|
| 247 |
onWidthChanged: if(currentIndex > 0 ) { positionViewAtIndex(currentIndex, ListView.Center); } |
| 248 |
|
| 249 |
delegate: Button { |
| 250 |
height:dateStampColorItem.height - units.gu(1) |
| 251 |
width:height |
| 252 |
color: modelData |
| 253 |
iconName: settings.dateStampColor == modelData ? "tick" : "" |
| 254 |
onClicked: { |
| 255 |
dateStampColor.currentIndex = index; |
| 256 |
settings.dateStampColor = modelData; |
| 257 |
} |
| 258 |
Component.onCompleted: if( settings.dateStampColor == modelData) {dateStampColor.positionViewAtIndex(index, ListView.Center); } |
| 259 |
} |
| 260 |
} |
| 261 |
} |
| 262 |
} |
| 263 |
|
| 264 |
ListItem { |
| 265 |
id: dateStampAlignmentItem |
| 266 |
anchors.top : dateStampColorItem.bottom |
| 267 |
anchors.margins:units.gu(1) |
| 268 |
|
| 269 |
height:units.gu(6) |
| 270 |
divider.visible: false |
| 271 |
ListItemLayout { |
| 272 |
id: dateStampAlignmentItemLayout |
| 273 |
title.color: theme.palette.normal.backgroundText |
| 274 |
// TRANSLATORS: this refers to the alignment of date stamp within captured images (bottom left, top right,etc..) |
| 275 |
title.text:i18n.tr("Alignment") |
| 276 |
title.horizontalAlignment:Text.AlignLeft |
| 277 |
ListView { |
| 278 |
id:dateStampAlignment |
| 279 |
anchors.topMargin:units.gu(1) |
| 280 |
SlotsLayout.position: SlotsLayout.Last |
| 281 |
width:dateFormatText.width |
| 282 |
height:dateStampAlignmentItem.height |
| 283 |
spacing:units.gu(0.5) |
| 284 |
layoutDirection: Qt.RightToLeft |
| 285 |
clip:true |
| 286 |
orientation: Qt.Horizontal |
| 287 |
|
| 288 |
model:[ |
| 289 |
{"value" :Qt.AlignBottom | Qt.AlignRight,"icon":"../../assets/align_bottom_right.png"}, |
| 290 |
{"value" :Qt.AlignBottom | Qt.AlignLeft,"icon":"../../assets/align_bottom_left.png"}, |
| 291 |
{"value" :Qt.AlignTop | Qt.AlignRight,"icon":"../../assets/align_top_right.png"}, |
| 292 |
{"value" :Qt.AlignTop | Qt.AlignLeft,"icon":"../../assets/align_top_left.png"}, |
| 293 |
] |
| 294 |
delegate: CircleButton { |
| 295 |
height:dateStampAlignmentItem.height - units.gu(1) |
| 296 |
width:height |
| 297 |
automaticOrientation:false |
| 298 |
iconSource: Qt.resolvedUrl( modelData.icon ) |
| 299 |
on:(modelData.value == settings.dateStampAlign) |
| 300 |
onClicked: { |
| 301 |
settings.dateStampAlign = modelData.value; |
| 302 |
} |
| 303 |
} |
| 304 |
} |
| 305 |
} |
| 306 |
} |
| 307 |
|
| 308 |
ListItem { |
| 309 |
anchors.top : dateStampAlignmentItem.bottom |
| 310 |
anchors.margins:units.gu(1) |
| 311 |
id: dateStampOpacityItem |
| 312 |
height:units.gu(3) |
| 313 |
divider.visible: false |
| 314 |
|
| 315 |
ListItemLayout { |
| 316 |
id: dateStampOpacityItemLayout |
| 317 |
height: dateStampOpacityItem.height |
| 318 |
title.color: theme.palette.normal.backgroundText |
| 319 |
// TRANSLATORS: this refers to the opacity of date stamp added to captured images |
| 320 |
title.text:i18n.tr("Opacity") |
| 321 |
title.horizontalAlignment:Text.AlignLeft |
| 322 |
|
| 323 |
Slider { |
| 324 |
id: dateStampOpacity |
| 325 |
width:dateFormatText.width |
| 326 |
height:dateStampOpacityItem.height |
| 327 |
value:settings.dateStampOpacity |
| 328 |
SlotsLayout.position: SlotsLayout.Last |
| 329 |
maximumValue: 1.0 |
| 330 |
minimumValue: 0.25 |
| 331 |
stepSize: 0.1 |
| 332 |
live:true |
| 333 |
onValueChanged: { |
| 334 |
settings.dateStampOpacity = dateStampColor.opacity = value; |
| 335 |
} |
| 336 |
} |
| 337 |
} |
| 338 |
} |
| 339 |
} |
| 340 |
ListItem { |
| 341 |
ListItemLayout { |
| 342 |
id: blurEffectSwitch |
| 343 |
title.text: i18n.tr("Blurred Overlay") |
| 344 |
title.horizontalAlignment:Text.AlignLeft |
| 345 |
title.color: theme.palette.normal.backgroundText |
| 346 |
Switch { |
| 347 |
SlotsLayout.position: SlotsLayout.Last |
| 348 |
checked: appSettings.blurEffects |
| 349 |
onClicked: appSettings.blurEffects = checked |
| 350 |
} |
| 351 |
} |
| 352 |
} |
| 353 |
ListItems.Expandable { |
| 354 |
id:dblurEffectExpand |
| 355 |
expanded: appSettings.blurEffects |
| 356 |
collapsedHeight: 0 |
| 357 |
expandedHeight: units.gu(6) |
| 358 |
collapseOnClick: false |
| 359 |
highlightWhenPressed: false |
| 360 |
|
| 361 |
ListItem { |
| 362 |
ListItemLayout { |
| 363 |
id: blurEffectsPreviewOnlySwitch |
| 364 |
title.text: i18n.tr("Only Blur Preview overlay") |
| 365 |
title.horizontalAlignment:Text.AlignLeft |
| 366 |
title.color: theme.palette.normal.backgroudText |
| 367 |
Switch { |
| 368 |
SlotsLayout.position: SlotsLayout.Last |
| 369 |
checked: appSettings.blurEffectsPreviewOnly |
| 370 |
onClicked: appSettings.blurEffectsPreviewOnly = checked |
| 371 |
} |
| 372 |
} |
| 373 |
} |
| 374 |
} |
| 375 |
} |
| 376 |
} |
| 377 |
|
| 378 |
} |