1
0

8 Коммитууд 96fedd1594 ... d64aa69c78

Эзэн SHA1 Мессеж Огноо
  Donald Carr d64aa69c78 Wait on images to be loaded prior to animating them 5 жил өмнө
  Donald Carr 77060be465 Accelerate through the transition 5 жил өмнө
  Donald Carr e741f1206f Disable all backgrounds by default 5 жил өмнө
  Donald Carr e88d6982ed Frameless art is the best 5 жил өмнө
  Donald Carr d397b10b83 Play around with ShaderEffects 5 жил өмнө
  Donald Carr 04a2655106 Polish trivial 5 жил өмнө
  Donald Carr 0ed72c37a8 Reintroduce artFrameWidth 5 жил өмнө
  Donald Carr 3fa970047c Force use of core profile 5 жил өмнө

+ 10 - 2
qml/common/ArtImage.qml

@@ -5,9 +5,13 @@ import ".."
 
 Rectangle {
     id: root
+
+    signal loaded
+
     property var effect
     property int modelIndex
 
+    property alias artwork: image
     property alias asynchronous: image.asynchronous
     property alias source: image.source
 
@@ -21,8 +25,11 @@ Rectangle {
         cache: false
         opacity: globalSettings.fadeInImages ? 0 : 1.0
 
-        height: root.height
-        width: root.width
+        x: globalSettings.artFrameWidth
+        y: globalSettings.artFrameWidth
+
+        height: root.height - 2*globalSettings.artFrameWidth
+        width: root.width - 2*globalSettings.artFrameWidth
 
         asynchronous: true
         fillMode: Image.PreserveAspectFit
@@ -47,6 +54,7 @@ Rectangle {
         onStatusChanged: {
             if (status === Image.Ready) {
                 opacity = globalSettings.artOpacity
+                root.loaded()
             }
         }
     }

+ 2 - 2
qml/main.qml

@@ -85,11 +85,11 @@ Item {
         property int columnCount: 8
         property int interval: 5
         property int itemLimit: -1
-        property int artFrameWidth: 2
+        property int artFrameWidth: 0
 
         property string effect: ""
         property string artView: "Trivial"
-        property string backdrop: "Swirls"
+        property string backdrop
 
         property bool randomBackdropColor: false
         property bool smoothArt: false

+ 45 - 14
qml/views/trivial/Trivial.qml

@@ -7,8 +7,6 @@ import PictureModel 1.0
 Item {
     id: root
 
-    property var imageArray: []
-
     function animationStep() {
         var fullyLoaded = true
         for (var i = globalSettings.columnCount - 1; i >= 0; i--) {
@@ -23,16 +21,17 @@ Item {
             if ((!d.initialized && !fullCanvas) || (i == 0) && !overloadedCanvas && (globalSettings.itemLimit < 0 || (globalUtil.itemCount < globalSettings.itemLimit))) {
                 globalUtil.itemCount++
                 tailItem = d.pictureDelegate.createObject(root)
+                tailItem.loaded.connect(function() { d.loadedImageCount += 1 } )
                 tailItem.columnIndex = i
                 col.push(tailItem)
             }
 
             if (!d.initialized) {
-                fullyLoaded = fullyLoaded  && !fullCanvas
+                fullyLoaded = fullyLoaded  && fullCanvas
                 continue
             }
 
-            if (overloadedCanvas || d.animating[i]) {
+            if (d.imagesLoaded && (overloadedCanvas || d.animating[i])) {
                 feedTimer.restart()
                 d.animating[i] = true
                 for (var j = 0; j < col.length; j++) {
@@ -43,35 +42,34 @@ Item {
                         if (globalSettings.columnCount - i > 1) {
                             item.columnIndex = i + 1
                             d.imageArray[i + 1].push(item)
+                            d.grainsOfSand = 0
+                            d.velocity = 0
                         } else {
                             item.destroy();
                             globalUtil.itemCount--
                         }
                     } else {
-                        item.y += 1
+                        item.y += d.velocity
                     }
                 }
+                d.grainsOfSand += 0.05
+                d.velocity = Math.pow(d.grainsOfSand, 2)
                 return;
             }
         }
+
         if (!d.initialized && fullyLoaded) {
-            settleTimer.start()
+            d.initialized = true
+            background.color = "black"
         }
     }
 
     Rectangle {
+        id: background
         color: "white"
         anchors.fill: parent
     }
 
-    Timer {
-        id: settleTimer
-        interval: 5000
-        onTriggered: {
-            d.initialized = true
-        }
-    }
-
     Timer {
         id: feedTimer
         interval: globalSettings.interval*100
@@ -84,6 +82,13 @@ Item {
 
     QtObject {
         id: d
+
+        property real velocity: 0
+        property real grainsOfSand: 0
+
+        property int loadedImageCount: 0
+        property bool imagesLoaded: loadedImageCount > 0 && (loadedImageCount >= globalUtil.itemCount)
+
         property bool incoming: false
         property bool initialized: globalSettings.itemLimit > -1 ? true : false
         property real t: 0
@@ -109,6 +114,32 @@ Item {
                 onHeightChanged: {
                     considerY()
                 }
+
+                /*
+                ShaderEffect {
+                    z: 1
+                    width: src.width; height: src.height
+                    property variant src: artwork
+                    vertexShader: "
+                                  uniform highp mat4 qt_Matrix;
+                                  attribute highp vec4 qt_Vertex;
+                                  attribute highp vec2 qt_MultiTexCoord0;
+                                  varying highp vec2 coord;
+                                  void main() {
+                                      coord = qt_MultiTexCoord0;
+                                      gl_Position = qt_Matrix * qt_Vertex;
+                                  }"
+                    fragmentShader: "
+                                  varying highp vec2 coord;
+                                  uniform sampler2D src;
+                                  uniform lowp float qt_Opacity;
+                                  void main() {
+                                      lowp vec4 tex = texture2D(src, coord);
+                                      gl_FragColor = vec4(vec3(dot(tex.rgb,
+                                                          vec3(0.344, 0.5, 0.156))),
+                                                               tex.a) * qt_Opacity;
+                                  }"
+                }*/
             }
         }
 

+ 2 - 0
src/main.cpp

@@ -237,6 +237,7 @@ int main(int argc, char *argv[])
 #endif
     } else {
         QSurfaceFormat format = QSurfaceFormat::defaultFormat();
+        format.setProfile(QSurfaceFormat::CoreProfile);
 
         bool force24bpp = settings.value("force24bpp", false).toBool();
         bool force16bpp = settings.value("force16bpp", false).toBool();
@@ -270,6 +271,7 @@ int main(int argc, char *argv[])
         settings.setValue("forceDoubleBuffer", forceDoubleBuffer);
         settings.setValue("forceTripleBuffer", forceTripleBuffer);
 
+        qDebug() << "Setting format" << format;
         QSurfaceFormat::setDefaultFormat(format);
     }