main.qml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. function checkModel() {
  53. visible = (imageModel.rowCount() === 0)
  54. }
  55. z: 1
  56. visible: imageModel.rowCount() === 0
  57. color: "red"
  58. width: childrenRect.width
  59. height: childrenRect.height
  60. anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter }
  61. Text {
  62. font.pointSize: 40
  63. text: "No images found/provided"
  64. }
  65. Component.onCompleted: modelRelay.countChanged.connect(checkModel);
  66. }
  67. Rectangle {
  68. z: 1
  69. opacity: 0.5
  70. visible: generalSettings.viewItemCount
  71. color: "black"
  72. anchors { right: parent.right; top: parent.top }
  73. width: itemCountLabel.width
  74. height: itemCountLabel.height
  75. Text {
  76. id: itemCountLabel
  77. font.pixelSize: 100
  78. text: globalVars.itemCount
  79. color: "white"
  80. }
  81. }
  82. Component.onCompleted: showFullScreen()
  83. }