main.qml 2.1 KB

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