Prechádzať zdrojové kódy

Get rid of cargo cultish intermediate settings usage

Change-Id: Ibb060433276ee75605a099a87d204c4a5d4a06ff
Donald Carr 9 rokov pred
rodič
commit
887733bbd6
3 zmenil súbory, kde vykonal 8 pridanie a 8 odobranie
  1. 1 1
      qml/common/View.qml
  2. 6 6
      qml/main.qml
  3. 1 1
      qml/physics/Physics.qml

+ 1 - 1
qml/common/View.qml

@@ -26,7 +26,7 @@ Item {
     }
 
     Repeater {
-        model: globalUtil.columnCount
+        model: globalSettings.columnCount
         delegate: columnComponent
     }
 }

+ 6 - 6
qml/main.qml

@@ -8,6 +8,8 @@ Window {
     width: 1024
     height: 768
 
+    onWidthChanged: globalUtil.reset()
+
     QtObject {
         id: d
         property int primedColumns: 0
@@ -17,10 +19,8 @@ Window {
         id: globalUtil
         property int itemCount
         property int currentColumn: 0
-        property bool primed: d.primedColumns === columnCount
+        property bool primed: d.primedColumns === globalSettings.columnCount
 
-        property bool commonFeedRoundRobin: globalSettings.commonFeedRoundRobin
-        property int columnCount: globalSettings.columnCount
         property int adjustedInterval: 1000*(globalSettings.interval > 60 ? 60*(globalSettings.interval-60) : Math.max(globalSettings.interval, 1))
 
         function registerColumnPrimed() {
@@ -33,12 +33,12 @@ Window {
         }
 
         function columnSelection() {
-            if (commonFeedRoundRobin) {
+            if (globalSettings.commonFeedRoundRobin) {
                 var ret = currentColumn
-                currentColumn = (currentColumn + 1) % columnCount
+                currentColumn = (currentColumn + 1) % globalSettings.columnCount
                 return ret
             } else {
-                return Math.floor(Math.random()*columnCount)
+                return Math.floor(Math.random()*globalSettings.columnCount)
             }
         }
     }

+ 1 - 1
qml/physics/Physics.qml

@@ -55,7 +55,7 @@ View {
             property bool fixedRotation: true
 
             function considerImage() {
-                if (stackHeight < (1.3 + 1/globalUtil.columnCount)*root.height) {
+                if (stackHeight < (1.3 + 1/globalSettings.columnCount)*root.height) {
                     addImage()
                 }
             }