main.qml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import QtQuick 2.5
  2. import QtQuick.Window 2.2
  3. import Qt.labs.settings 1.0
  4. Window {
  5. id: appWindow
  6. width: 1024
  7. height: 768
  8. QtObject {
  9. id: d
  10. function reset() {
  11. globalVars.itemCount = 0
  12. }
  13. }
  14. QtObject {
  15. id: globalVars
  16. property int adjustedInterval: 1000*(generalSettings.interval > 60 ? 60*(generalSettings.interval-60) : generalSettings.interval)*(Math.random()+1)
  17. property int itemCount
  18. }
  19. Settings {
  20. id: generalSettings
  21. property int columnCount: 5
  22. property int interval: 5
  23. property bool viewItemCount: false
  24. property string effect: ""
  25. property string view: "Basic"
  26. property bool smoothArt: false
  27. property bool randomlyMirrorArt: true
  28. onViewChanged: {
  29. loader.source = generalSettings.view.toLowerCase() + "/" + generalSettings.view + ".qml"
  30. d.reset()
  31. }
  32. onColumnCountChanged: d.reset()
  33. }
  34. Rectangle {
  35. focus: true
  36. color: "black"
  37. anchors.fill: parent
  38. Keys.forwardTo: [loader.item, toplevelhandler]
  39. Loader {
  40. id: loader
  41. anchors.fill: parent
  42. source: "basic/Basic.qml"
  43. }
  44. }
  45. Rectangle {
  46. id: toplevelhandler
  47. focus: true
  48. Keys.onLeftPressed: generalSettings.columnCount = Math.max(generalSettings.columnCount-1,1)
  49. Keys.onRightPressed: generalSettings.columnCount++
  50. }
  51. Rectangle {
  52. z: 1
  53. visible: imageModel.rowCount > 0
  54. color: "red"
  55. width: childrenRect.width
  56. height: childrenRect.height
  57. anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter }
  58. Text {
  59. font.pointSize: 40
  60. text: "No images found/provided"
  61. }
  62. }
  63. Rectangle {
  64. z: 1
  65. opacity: 0.5
  66. visible: generalSettings.viewItemCount
  67. color: "black"
  68. anchors { right: parent.right; top: parent.top }
  69. width: itemCountLabel.width
  70. height: itemCountLabel.height
  71. Text {
  72. id: itemCountLabel
  73. font.pixelSize: 100
  74. text: globalVars.itemCount
  75. color: "white"
  76. }
  77. }
  78. Component.onCompleted: showFullScreen()
  79. }