Advertisement
Guest User

Camera_code_patch

a guest
Nov 15th, 2018
1,815
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.05 KB | None | 0 0
  1. --- /usr/share/jolla-settings/pages/jolla-camera/SettingsPage.qml 2018-10-22 03:00:00.000000000 +0300
  2. +++ /usr/share/jolla-settings/pages/jolla-camera/SettingsPage.qml 2018-11-14 22:11:21.800789262 +0200
  3. @@ -6,6 +6,7 @@
  4. import org.nemomobile.systemsettings 1.0
  5. import com.jolla.settings.system 1.0
  6. import Sailfish.Policy 1.0
  7. +import com.jolla.gallery.ambience 1.0
  8.  
  9. Page {
  10. onStatusChanged: {
  11. @@ -19,6 +20,18 @@
  12.  
  13. path: "/apps/jolla-camera"
  14.  
  15. + ConfigurationGroup {
  16. + id: customCameraOverlay
  17. +
  18. + path: "camera/overlay"
  19. +
  20. + property int customOverlay: 6
  21. + property int baselcolor: 0
  22. + property int defaultbasel: 0
  23. + property bool customicon: false
  24. + property bool timerscreen: false
  25. + }
  26. +
  27. ConfigurationGroup {
  28. id: primaryImageSettings
  29.  
  30. @@ -217,6 +230,249 @@
  31. }
  32. }
  33. }
  34. +
  35. + SectionHeader {
  36. + //% "Camera setting overlay"
  37. + text: qsTr("Camera setting overlay")
  38. + }
  39. +
  40. + Slider {
  41. + id: slider
  42. + width: parent.width
  43. + maximumValue: 6
  44. + minimumValue: 0
  45. + stepSize: 1
  46. + value: customCameraOverlay.customOverlay
  47. + onValueChanged: customCameraOverlay.customOverlay = value
  48. +
  49. + onPressAndHold: cancel()
  50. +
  51. + Label {
  52. + id: valueLabel
  53. + //% "%1%"
  54. + text: {"0." + slider.value}
  55. +
  56. + x: slider.leftMargin - width/2
  57. + anchors.bottom: parent.verticalCenter // assuming slider centers its content vertically
  58. + anchors.bottomMargin: Theme.paddingSmall + Theme.paddingMedium
  59. + scale: slider.down ? Theme.fontSizeLarge / Theme.fontSizeMedium : 1.0
  60. + color: slider.highlighted ? Theme.highlightColor : Theme.primaryColor
  61. + Behavior on scale { NumberAnimation { duration: 80 } }
  62. + }
  63. + }
  64. +
  65. + Item {
  66. + width: parent.width
  67. + height: -Theme.paddingSmall*5
  68. + }
  69. +
  70. + Label {
  71. + width: parent.width
  72. + wrapMode: Text.WordWrap
  73. + horizontalAlignment: Text.AlignHCenter
  74. + color: slider.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
  75. + font.pixelSize: Theme.fontSizeSmall
  76. + text: "Choose preferred overlay"
  77. + }
  78. +
  79. + Item {
  80. + width: parent.width
  81. + height: Theme.paddingLarge
  82. + }
  83. +
  84. + TextSwitch {
  85. + width: parent.width
  86. + text: "Timer on viewfinder"
  87. + checked: customCameraOverlay.timerscreen
  88. + onClicked: customCameraOverlay.timerscreen = checked
  89. + }
  90. +
  91. + Item {
  92. + width: parent.width
  93. + height: Theme.paddingSmall
  94. + }
  95. +
  96. + SectionHeader {
  97. + //% "Camera bezel color"
  98. + text: qsTr("Camera bezel color")
  99. + }
  100. +
  101. + ComboBox {
  102. + width: parent.width
  103. +
  104. + label: qsTr("Camera bezel color")
  105. + currentIndex: updateIndex(customCameraOverlay.defaultbasel)
  106. +
  107. + menu: ContextMenu {
  108. +
  109. + MenuItem {
  110. + text: qsTr("Default")
  111. + onClicked: {
  112. + customCameraOverlay.defaultbasel = 0
  113. + }
  114. + }
  115. +
  116. + MenuItem {
  117. + text: qsTr("Lighter")
  118. + onClicked: {
  119. + customCameraOverlay.defaultbasel = 1
  120. + }
  121. + }
  122. +
  123. + MenuItem {
  124. + text: qsTr("Darker")
  125. + onClicked: {
  126. + customCameraOverlay.defaultbasel = 2
  127. + }
  128. + }
  129. + }
  130. +
  131. + function updateIndex(defaultbasel) {
  132. + if (defaultbasel == 0) {
  133. + return 0
  134. + } else if (defaultbasel == 1) {
  135. + return 1
  136. + } else if (defaultbasel == 2) {
  137. + return 2
  138. + }
  139. + }
  140. + }
  141. +
  142. + Slider {
  143. + id: slider2
  144. + visible: customCameraOverlay.defaultbasel
  145. + Rectangle {
  146. + id: background
  147. + x: slider2.leftMargin
  148. + z: -1
  149. + width: slider2._grooveWidth
  150. + height: Theme.paddingMedium
  151. + anchors.top: parent.verticalCenter
  152. + anchors.topMargin: -Theme.paddingLarge*2
  153. +
  154. + ShaderEffect {
  155. + id: rainbow
  156. + property variant src: background
  157. + property real saturation: 1.0
  158. + property real lightness: 0.5
  159. + property real alpha: 1.0
  160. +
  161. + width: parent.width
  162. + height: parent.height
  163. +
  164. + // Fragment shader to create hue color wheel background
  165. + fragmentShader: "
  166. + varying highp vec2 coord;
  167. + varying highp vec2 qt_TexCoord0;
  168. + uniform sampler2D src;
  169. + uniform lowp float qt_Opacity;
  170. + uniform lowp float saturation;
  171. + uniform lowp float lightness;
  172. + uniform lowp float alpha;
  173. +
  174. + void main() {
  175. + float r, g, b;
  176. +
  177. + float h = qt_TexCoord0.x * 360.0;
  178. + float s = saturation;
  179. + float l = lightness;
  180. +
  181. + float c = (1.0 - abs(2.0 * l - 1.0)) * s;
  182. + float hh = h / 60.0;
  183. + float x = c * (1.0 - abs(mod(hh, 2.0) - 1.0));
  184. +
  185. + int i = int( hh );
  186. +
  187. + if (i == 0) {
  188. + r = c; g = x; b = 0.0;
  189. + } else if (i == 1) {
  190. + r = x; g = c; b = 0.0;
  191. + } else if (i == 2) {
  192. + r = 0.0; g = c; b = x;
  193. + } else if (i == 3) {
  194. + r = 0.0; g = x; b = c;
  195. + } else if (i == 4) {
  196. + r = x; g = 0.0; b = c;
  197. + } else if (i == 5) {
  198. + r = c; g = 0.0; b = x;
  199. + } else {
  200. + r = 0.0; g = 0.0; b = 0.0;
  201. + }
  202. +
  203. + float m = l - 0.5 * c;
  204. +
  205. + lowp vec4 tex = texture2D(src, qt_TexCoord0);
  206. + gl_FragColor = vec4(r+m,g+m,b+m,alpha) * qt_Opacity;
  207. + }"
  208. + }
  209. + }
  210. +
  211. + width: parent.width
  212. + minimumValue: 0
  213. + maximumValue: 100
  214. + stepSize: 1
  215. + value: customCameraOverlay.baselcolor
  216. + valueText: "◭"
  217. + onValueChanged: customCameraOverlay.baselcolor = value
  218. + onPressAndHold: cancel()
  219. +
  220. + Label {
  221. + width: parent.width
  222. + wrapMode: Text.Wrap
  223. + font.pixelSize: Theme.fontSizeSmall
  224. + horizontalAlignment: Text.AlignHCenter
  225. + anchors.top: parent.verticalCenter
  226. + anchors.topMargin: Theme.paddingMedium*2.8
  227. + color: customCameraOverlay.defaultbasel == 1 ? Color.toHighlight(Color.fromHsva(customCameraOverlay.baselcolor/100, 1.0, 0.5, 1.0)) : Qt.darker(Color.toHighlight(Color.fromHsva(customCameraOverlay.baselcolor/100, 1.0, 0.5, 1.0)))
  228. + text: qsTr("Choose bezel color")
  229. + }
  230. + }
  231. +
  232. + Item {
  233. + width: parent.width
  234. + visible: customCameraOverlay.defaultbasel
  235. + height: Theme.paddingLarge
  236. + }
  237. +
  238. + Rectangle {
  239. + visible: customCameraOverlay.defaultbasel
  240. + anchors.horizontalCenter: parent.horizontalCenter
  241. + //width: Theme.pixelRatio > 1.0 ? 540 : 480
  242. + //height: Theme.pixelRatio > 1.0 ? 205 : 145
  243. + width: Theme.pixelRatio < 1.25 ? screen.width/1.1 : (Theme.pixelRatio < 1.5 ? screen.width/1.16 : screen.width/1.7)
  244. + height: Theme.pixelRatio < 1.25 ? icon.height : (Theme.pixelRatio < 1.5 ? icon.height*1.3 : icon.height*1.6)
  245. + color: customCameraOverlay.defaultbasel == 1 ? Color.toHighlight(Color.fromHsva(customCameraOverlay.baselcolor/100, 1.0, 0.5, 1.0)) : Qt.darker(Color.toHighlight(Color.fromHsva(customCameraOverlay.baselcolor/100, 1.0, 0.5, 1.0)))
  246. +
  247. + Image {
  248. + id: icon
  249. + //width: Theme.pixelRatio > 1.0 ? 497 : 437
  250. + //height: Theme.pixelRatio > 1.0 ? 205 : 145
  251. + scale: Theme.pixelRatio < 1.25 ? 1.0 : (Theme.pixelRatio < 1.5 ? 1.3 : 1.6)
  252. + anchors.horizontalCenter: parent.horizontalCenter
  253. + anchors.bottom: parent.verticalCenter
  254. + anchors.bottomMargin: Theme.pixelRatio < 1.25 ? -Theme.paddingLarge*3 : (Theme.pixelRatio < 1.5 ? -Theme.paddingLarge*2.2 : -Theme.paddingLarge*1.8)
  255. + source: customCameraOverlay.customicon ? "image://theme/icon-preview-camerabezel2" : "image://theme/icon-preview-camerabezel"
  256. + }
  257. + }
  258. +
  259. + Item {
  260. + width: parent.width
  261. + visible: customCameraOverlay.defaultbasel
  262. + height: Theme.paddingLarge
  263. + }
  264. +
  265. + TextSwitch {
  266. + visible: customCameraOverlay.defaultbasel
  267. + width: parent.width
  268. + text: "Use darker icons"
  269. + checked: customCameraOverlay.customicon
  270. + onClicked: customCameraOverlay.customicon = checked
  271. + }
  272. +
  273. + Item {
  274. + width: parent.width
  275. + height: Theme.paddingLarge*1.5
  276. + }
  277. }
  278. }
  279.  
  280. --- /usr/lib/qt5/qml/com/jolla/camera/settings.qml 2018-10-22 03:00:00.000000000 +0300
  281. +++ /usr/lib/qt5/qml/com/jolla/camera/settings.qml 2018-11-14 22:18:23.000000000 +0200
  282. @@ -68,6 +68,15 @@
  283. CameraImageProcessing.WhiteBalanceTungsten
  284. ]
  285.  
  286. + ConfigurationGroup {
  287. + id: customCameraOverlay
  288. +
  289. + path: "/apps/jolla-camera/camera/overlay"
  290. +
  291. + property int defaultbasel: 0
  292. + property bool customicon: false
  293. + }
  294. +
  295. ConfigurationGroup {
  296. id: modeSettings
  297. path: globalSettings.cameraDevice + "/" + globalSettings.captureMode
  298. @@ -101,8 +110,8 @@
  299.  
  300. function captureModeIcon(mode) {
  301. switch (mode) {
  302. - case "image": return "image://theme/icon-camera-camera-mode"
  303. - case "video": return "image://theme/icon-camera-video"
  304. + case "image": return (customCameraOverlay.defaultbasel && customCameraOverlay.customicon && modeSettings.captureMode == Camera.CaptureStillImage ? "image://theme/icon-camera-camera-mode3" : "image://theme/icon-camera-camera-mode")
  305. + case "video": return (customCameraOverlay.defaultbasel && customCameraOverlay.customicon && modeSettings.captureMode == Camera.CaptureStillImage ? "image://theme/icon-camera-video3" : "image://theme/icon-camera-video")
  306. default: return ""
  307. }
  308. }
  309. --- /usr/lib/qt5/qml/com/jolla/camera/capture/CaptureOverlay.qml 2018-11-05 23:07:03.000000000 +0200
  310. +++ /usr/lib/qt5/qml/com/jolla/camera/capture/CaptureOverlay.qml 2018-11-14 22:25:42.000000000 +0200
  311. @@ -16,6 +16,15 @@
  312. SettingsOverlay {
  313. id: settingsOverlay
  314.  
  315. + ConfigurationGroup {
  316. + id: customCameraOverlay
  317. +
  318. + path: "/apps/jolla-camera/camera/overlay"
  319. +
  320. + property int defaultbasel: 0
  321. + property bool customicon: false
  322. + }
  323. +
  324. property var captureView
  325. property var camera
  326. property Item focusArea
  327. @@ -202,7 +211,7 @@
  328. ? "image://theme/icon-camera-video-shutter-off"
  329. : (camera.captureMode == Camera.CaptureVideo
  330. ? "image://theme/icon-camera-video-shutter-on"
  331. - : "image://theme/icon-camera-shutter")
  332. + : (customCameraOverlay.defaultbasel && customCameraOverlay.customicon ? "image://theme/icon-camera-shutter3" : "image://theme/icon-camera-shutter"))
  333. }
  334.  
  335. Label {
  336. --- /usr/lib/qt5/qml/com/jolla/camera/settings/SettingsOverlay.qml 2018-11-05 23:07:03.000000000 +0200
  337. +++ /usr/lib/qt5/qml/com/jolla/camera/settings/SettingsOverlay.qml 2018-11-14 22:38:12.000000000 +0200
  338. @@ -2,10 +2,22 @@
  339. import QtMultimedia 5.0
  340. import Sailfish.Silica 1.0
  341. import com.jolla.camera 1.0
  342. +import org.nemomobile.configuration 1.0
  343.  
  344. PinchArea {
  345. id: overlay
  346.  
  347. + ConfigurationGroup {
  348. + id: customCameraOverlay
  349. +
  350. + path: "/apps/jolla-camera/camera/overlay"
  351. +
  352. + property int customOverlay: 6
  353. + property int defaultbasel: 0
  354. + property bool customicon: false
  355. + property bool timerscreen: false
  356. + }
  357. +
  358. property bool isPortrait
  359. property real topButtonRowHeight
  360. property bool open
  361. @@ -160,7 +172,7 @@
  362. model: [ "primary", "secondary" ]
  363. settings: Settings
  364. property: "cameraDevice"
  365. - icon: "image://theme/icon-camera-switch"
  366. + icon: (customCameraOverlay.defaultbasel && customCameraOverlay.customicon && camera.captureMode == Camera.CaptureStillImage ? "image://theme/icon-camera-switch3" : "image://theme/icon-camera-switch")
  367. opacity: _commonControlOpacity
  368. visible: opacity > 0.0
  369. }
  370. @@ -184,7 +196,7 @@
  371. height: Theme.itemSizeExtraSmall
  372. anchors.horizontalCenter: parent.horizontalCenter
  373. radius: width / 2
  374. - color: Theme.rgba(_highlightColor, 0.4)
  375. + color: customCameraOverlay.defaultbasel && customCameraOverlay.customicon && !captureModeMenu.currentIndex ? "grey" : Theme.rgba(_highlightColor, 0.4)
  376. opacity: y < -captureModeMenu.itemStep ? 1.0 - (captureModeMenu.itemStep + y) / (-captureModeMenu.itemStep/2)
  377. : (y > 0 ? 1.0 - y/(captureModeMenu.itemStep/2) : 1.0)
  378. y: {
  379. @@ -377,7 +389,7 @@
  380.  
  381. visible: overlay.expanded
  382. color: "black"
  383. - opacity: 0.6 * (1 - container.opacity)
  384. + opacity: "0." + customCameraOverlay.customOverlay * (1 - container.opacity)
  385. }
  386.  
  387. Row {
  388. @@ -511,6 +523,31 @@
  389. }
  390. }
  391.  
  392. + Column {
  393. + x: exposureSlider.alignment == Qt.AlignRight ? (isPortrait ? 0 : Theme.paddingLarge)
  394. + : parent.width - width - (isPortrait ? 0 : Theme.paddingLarge*9.9)
  395. + anchors {
  396. + verticalCenter: parent.verticalCenter
  397. + verticalCenterOffset: isPortrait ? Theme.paddingMedium : 0
  398. + }
  399. + spacing: Theme.paddingLarge
  400. +
  401. + SettingsMenu {
  402. + id: timerMenu2
  403. + visible: customCameraOverlay.timerscreen && !overlay.expanded
  404. + width: overlay._menuWidth
  405. + title: Settings.timerText
  406. + header: upperHeader
  407. + model: [ 0, 3, 10, 15 ]
  408. + delegate: SettingsMenuItem {
  409. + settings: Settings.mode
  410. + property: "timer"
  411. + value: modelData
  412. + icon: Settings.timerIcon(modelData)
  413. + }
  414. + }
  415. + }
  416. +
  417. Column {
  418. x: exposureSlider.alignment == Qt.AlignLeft ? (isPortrait ? 0 : Theme.paddingLarge)
  419. : parent.width - width - (isPortrait ? 0 : Theme.paddingLarge)
  420. --- /usr/share/jolla-camera/camera.qml 2018-10-22 03:00:00.000000000 +0300
  421. +++ /usr/share/jolla-camera/camera.qml 2018-11-14 22:43:59.000000000 +0200
  422. @@ -3,10 +3,21 @@
  423. import Sailfish.Media 1.0
  424. import com.jolla.camera 1.0
  425. import "pages"
  426. +import org.nemomobile.configuration 1.0
  427. +import com.jolla.gallery.ambience 1.0
  428.  
  429. ApplicationWindow {
  430. id: window
  431.  
  432. + ConfigurationGroup {
  433. + id: customCameraOverlay
  434. + path: "/apps/jolla-camera/camera/overlay"
  435. + property int baselcolor: 0
  436. + property int defaultbasel: 0
  437. + property string colorcode: customCameraOverlay.Color.toHighlight(Color.fromHsva(customCameraOverlay.baselcolor/100, 1.0, 0.5, 1.0))
  438. + property string colorcodedark: Qt.darker(customCameraOverlay.Color.toHighlight(Color.fromHsva(customCameraOverlay.baselcolor/100, 1.0, 0.5, 1.0)))
  439. + }
  440. +
  441. property var captureModel: null
  442. property bool galleryActive
  443. property bool galleryVisible
  444. @@ -29,7 +40,7 @@
  445. parent: window
  446. anchors.fill: parent
  447. z: -1
  448. - color: "black"
  449. + color: galleryActive ? "black" : (customCameraOverlay.defaultbasel == 1 ? customCameraOverlay.colorcode : (customCameraOverlay.defaultbasel == 2 ? customCameraOverlay.colorcodedark : "black"))
  450. visible: pageStack.depth < 2 && !pageStack.busy
  451. }
  452.  
  453. --- /usr/share/jolla-camera/lockscreen.qml 2018-10-22 03:00:00.000000000 +0300
  454. +++ /usr/share/jolla-camera/lockscreen.qml 2018-11-14 22:48:54.000000000 +0200
  455. @@ -4,10 +4,21 @@
  456. import Sailfish.Media 1.0
  457. import com.jolla.camera 1.0
  458. import QtMultimedia 5.0
  459. +import org.nemomobile.configuration 1.0
  460. +import com.jolla.gallery.ambience 1.0
  461.  
  462. ApplicationWindow {
  463. id: window
  464.  
  465. + ConfigurationGroup {
  466. + id: customCameraOverlay
  467. + path: "/apps/jolla-camera/camera/overlay"
  468. + property int baselcolor: 0
  469. + property int defaultbasel: 0
  470. + property string colorcode: customCameraOverlay.Color.toHighlight(Color.fromHsva(customCameraOverlay.baselcolor/100, 1.0, 0.5, 1.0))
  471. + property string colorcodedark: Qt.darker(customCameraOverlay.Color.toHighlight(Color.fromHsva(customCameraOverlay.baselcolor/100, 1.0, 0.5, 1.0)))
  472. + }
  473. +
  474. allowedOrientations: defaultAllowedOrientations
  475. _defaultPageOrientations: Orientation.All
  476. _defaultLabelFormat: Text.PlainText
  477. @@ -40,7 +51,7 @@
  478. width: window.width
  479. height: window.height
  480.  
  481. - color: "black"
  482. + color: customCameraOverlay.defaultbasel == 1 ? customCameraOverlay.colorcode : (customCameraOverlay.defaultbasel == 2 ? customCameraOverlay.colorcodedark : "black")
  483. }
  484.  
  485. GStreamerVideoOutput {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement