SettingsView.qml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. import QtQuick 2.0
  2. Item {
  3. id: root
  4. property bool isShown: false
  5. anchors.fill: parent
  6. function show() {
  7. isShown = true;
  8. hideAnimation.stop();
  9. showAnimation.restart();
  10. }
  11. function hide() {
  12. isShown = false;
  13. showAnimation.stop();
  14. hideAnimation.restart();
  15. }
  16. SequentialAnimation {
  17. id: showAnimation
  18. PropertyAction { target: backgroundItem; property: "visible"; value: true }
  19. ParallelAnimation {
  20. NumberAnimation { target: backgroundItem; property: "opacity"; to: 1; duration: 250; easing.type: Easing.InOutQuad }
  21. NumberAnimation { target: backgroundItem; property: "scale"; to: 1; duration: 500; easing.type: Easing.OutBack }
  22. }
  23. }
  24. SequentialAnimation {
  25. id: hideAnimation
  26. ParallelAnimation {
  27. NumberAnimation { target: backgroundItem; property: "opacity"; to: 0; duration: 500; easing.type: Easing.InOutQuad }
  28. NumberAnimation { target: backgroundItem; property: "scale"; to: 0.6; duration: 500; easing.type: Easing.InOutQuad }
  29. }
  30. PropertyAction { target: backgroundItem; property: "visible"; value: false }
  31. }
  32. MouseArea {
  33. anchors.fill: parent
  34. enabled: root.isShown
  35. onClicked: {
  36. root.hide();
  37. }
  38. }
  39. Image {
  40. id: settingsIcon
  41. anchors.left: parent.left
  42. anchors.leftMargin: 4
  43. anchors.bottom: parent.bottom
  44. anchors.bottomMargin: 4
  45. source: "images/settings.png"
  46. opacity: backgroundItem.opacity + 0.4
  47. MouseArea {
  48. anchors.fill: parent
  49. anchors.margins: -20
  50. onClicked: {
  51. if (root.isShown) {
  52. root.hide();
  53. } else {
  54. root.show();
  55. }
  56. }
  57. }
  58. }
  59. BorderImage {
  60. id: backgroundItem
  61. anchors.left: settingsIcon.horizontalCenter
  62. anchors.bottom: settingsIcon.verticalCenter
  63. width: Math.min(480, parent.width - 60)
  64. height: settingsContentColumn.height + 36
  65. source: "images/panel_bg.png"
  66. border.left : 22
  67. border.right : 10
  68. border.top : 5
  69. border.bottom : 26
  70. transformOrigin: Item.BottomLeft
  71. visible: false
  72. opacity: 0
  73. scale: 0.6
  74. Column {
  75. id: settingsContentColumn
  76. width: parent.width
  77. y: 8
  78. Switch {
  79. text: "Show movies cover lighting?"
  80. checked: settings.showLighting
  81. onCheckedChanged: {
  82. settings.showLighting = checked;
  83. }
  84. }
  85. Rectangle {
  86. anchors.horizontalCenter: parent.horizontalCenter
  87. width: parent.width - 32
  88. height: 1
  89. color: "#404040"
  90. }
  91. Switch {
  92. text: "Show shooting star particles?"
  93. checked: settings.showShootingStarParticles
  94. onCheckedChanged: {
  95. settings.showShootingStarParticles = checked;
  96. }
  97. }
  98. Rectangle {
  99. anchors.horizontalCenter: parent.horizontalCenter
  100. width: parent.width - 32
  101. height: 1
  102. color: "#404040"
  103. }
  104. Switch {
  105. text: "Show fog particles?"
  106. checked: settings.showFogParticles
  107. onCheckedChanged: {
  108. settings.showFogParticles = checked;
  109. }
  110. }
  111. Rectangle {
  112. anchors.horizontalCenter: parent.horizontalCenter
  113. width: parent.width - 32
  114. height: 1
  115. color: "#404040"
  116. }
  117. Switch {
  118. text: "Do you l-o-v-e colors?"
  119. checked: settings.showColors
  120. textOn: "Yes"
  121. textOff: "No!"
  122. onCheckedChanged: {
  123. settings.showColors = checked;
  124. }
  125. }
  126. }
  127. }
  128. }