Explorar o código

Create backdrop on demand

Donald Carr %!s(int64=8) %!d(string=hai) anos
pai
achega
cd06a19660
Modificáronse 2 ficheiros con 10 adicións e 9 borrados
  1. 9 9
      qml/main.qml
  2. 1 0
      src/main.cpp

+ 9 - 9
qml/main.qml

@@ -3,8 +3,6 @@ import QtQuick.Window 2.2
 import Qt.labs.settings 1.0
 import PictureModel 1.0
 
-import "."
-
 Window {
     id: appWindow
 
@@ -117,6 +115,7 @@ Window {
         property bool showScreenResolution: false
         property string effect: ""
         property string view: "Reel"
+        property string backdrop: ""
         property bool smoothArt: false
         property bool randomlyMirrorArt: true
         property bool fullscreen: true
@@ -146,17 +145,13 @@ Window {
         }
     }
 
-    Rectangle {
+    Item {
+        id: root
         focus: true
-        color: "black"
+
         anchors.fill: parent
         Keys.forwardTo: [artViewLoader.item, toplevelhandler]
 
-        BackgroundSwirls {
-            visible: globalSettings.animatedBackground
-            anchors.fill: parent
-        }
-
         Loader {
             id: artViewLoader
             anchors.fill: parent
@@ -212,6 +207,11 @@ Window {
 
             }
         }
+        Component.onCompleted: {
+            if (globalSettings.backdrop != "") {
+                Qt.createQmlObject(globalSettings.backdrop + ' { anchors.fill: parent}', root)
+            }
+        }
     }
 
     Item {

+ 1 - 0
src/main.cpp

@@ -87,6 +87,7 @@ int main(int argc, char *argv[])
     QQmlApplicationEngine engine;
     qmlRegisterType<PictureModel>("PictureModel", 1, 0, "PictureModel");
 
+    engine.addImportPath("qrc:/");
     engine.rootContext()->setContextProperty("screenSize", app.screens().at(0)->availableSize());
     engine.rootContext()->setContextProperty("fileReader", new FileReader(&app));
     engine.rootContext()->setContextProperty("nativeHelper", new HelperFunctions(&app));