aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-10-10 10:24:50 -0400
committerKen Moore <ken@ixsystems.com>2017-10-10 10:24:50 -0400
commit7f013d766723468f4c4785411dcf5d42694cec3b (patch)
tree763a25026b6a0ea09fec3823cdaeeb9483f2b57f
parentRemove the src-glwidgets tree. No longer needed since it has been replaced by... (diff)
downloadlumina-7f013d766723468f4c4785411dcf5d42694cec3b.tar.gz
lumina-7f013d766723468f4c4785411dcf5d42694cec3b.tar.bz2
lumina-7f013d766723468f4c4785411dcf5d42694cec3b.zip
Fix up the QML test routine a bit, and add a couple works-in-progress for a new firefly screensaver.
-rw-r--r--src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.qml18
-rw-r--r--src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Firefly.qml52
-rw-r--r--src-qt5/src-qml/test/main.cpp5
3 files changed, 73 insertions, 2 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.qml b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.qml
new file mode 100644
index 00000000..36ed4df5
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import QtGraphicalEffects 1.0
+import "." as QML
+
+Rectangle {
+ id : canvas
+ anchors.fill: parent
+ color: "black"
+
+ Repeater {
+ model: Math.round(Math.random()*100)+30
+ QML.Firefly {
+ parent: canvas
+ x: Math.round(Math.random()*canvas.width)
+ y: Math.round(Math.random()*canvas.height)
+ }
+ } //end of Repeater
+} //end of canvas rectangle
diff --git a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Firefly.qml b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Firefly.qml
new file mode 100644
index 00000000..704811a7
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Firefly.qml
@@ -0,0 +1,52 @@
+import QtQuick 2.0
+import QtQuick.Window 2.2
+import QtGraphicalEffects 1.0
+
+Item {
+
+ RectangularGlow {
+ anchors.fill: fly
+ glowRadius: 0.1
+ spread: 0.1
+ color: Qt.rgba(Math.random()*255,Math.random()*255,0,0.3)
+ cornerRadius: fly.radius + glowRadius
+ }
+
+ Rectangle {
+ id: fly
+ width: Math.round(Math.random()*3)+2
+ height: width
+ color: Qt.rgba(Math.random()*255,Math.random()*255,0,0.8)
+ radius: Math.floor(width/2)
+ property int jitterX: Math.round(Math.random()*100)+10
+ property int jitterY: Math.round(Math.random()*100)+10
+
+ }
+
+ Behavior on x {
+ SmoothedAnimation {
+ velocity: 10+Math.random()*canvas.width/100
+ }
+ }
+ Behavior on y {
+ SmoothedAnimation {
+ velocity: 10+Math.random()*canvas.height/100
+ }
+ }
+
+ Timer {
+ interval: Math.round(Math.random()*1000)
+ repeat: true
+ running: true
+ onTriggered: {
+ if ( (x+fly.jitterX)>canvas.width || (x+fly.jitterX)<0 ){ fly.jitterX = 0-fly.jitterX }
+ x = x+fly.jitterX
+ if( (y+fly.jitterY)>canvas.height || (y+fly.jitterY)<0 ){ fly.jitterY = 0-fly.jitterY }
+ y = y+fly.jitterY
+ fly.jitterX = (Math.round(Math.random())*2 - 1) *fly.jitterX
+ fly.jitterY = (Math.round(Math.random())*2 - 1) *fly.jitterY
+ fly.color = Qt.rgba(Math.random()*255,Math.random()*255,Math.random()*150,0.8)
+
+ }
+ } //end of timer
+} //end of item
diff --git a/src-qt5/src-qml/test/main.cpp b/src-qt5/src-qml/test/main.cpp
index eabe7dc5..e65c599f 100644
--- a/src-qt5/src-qml/test/main.cpp
+++ b/src-qt5/src-qml/test/main.cpp
@@ -1,6 +1,6 @@
#include <QDebug>
#include <QApplication>
-#include <QQuickWidget>
+#include <QQuickView>
int main(int argc, char** argv){
QString QMLFile;
@@ -14,7 +14,8 @@ int main(int argc, char** argv){
}
QApplication A(argc,argv);
qDebug() << "Creating base widget";
- QQuickWidget base;
+ QQuickView base;
+ base.setResizeMode(QQuickView::SizeRootObjectToView);
qDebug() << "Resize base widget";
base.resize(1024,768);
qDebug() << "Load QML File:" << QMLFile;
bgstack15