3 * Copyright 2020 Robin Krens <robin@robinkrens.nl>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Library General Public License as
7 * published by the Free Software Foundation; either version 2 or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 import QtQuick.Controls 1.2
23 import QtQuick.Window 2.2
25 import org.kde.plasma.plasmoid 2.0
27 import "../code/utils.js" as Utils
33 property int dir: getRandomIntInclusive(0,1); /* could go either left or right */
34 property int radius: Utils.getSnowSize(plasmoid.configuration.userSize); /* size of snowflake */
35 property int swirl: getRandomIntInclusive(35,200); /* random falling 'swirl' */
36 property int disposition: 0;
37 property alias snowFlakeRotation: snowFlake.rotation;
38 //property int rotationSpeed: (Math.random() * 100) % 3 + 1; /* falling rotation */
39 property int rotationSpeed: getRandomIntInclusive(1,4);
40 property int rotationDirection: getRandomIntInclusive(0,1);
41 //property int fallingSpeed: (Math.random() * 100) % 3 + 2;
42 property int fallingSpeed: Utils.getFallingSpeed(plasmoid.configuration.userSpeed);
44 //width: 80; height: 80;
48 flags: Qt.WindowStaysOnTopHint
49 | Qt.FramelessWindowHint
50 | Qt.WA_TransparentForMouseEvents
51 | Qt.WA_TranslucentBackground
52 | Qt.X11BypassWindowManagerHint;
54 /* Basic functions (fro, developer.mozilla.org) */
55 function getRandomIntInclusive(min, max) {
57 max = Math.floor(max);
58 return Math.floor(Math.random() * (max - min + 1) + min);
66 radius: plasmoid.configuration.userStyle == "Plain" ? 50 : 0;
67 color: plasmoid.configuration.userStyle == "Plain" ? "white" : "transparent";
75 switch(plasmoid.configuration.userStyle) {
77 imgSrc = "../images/classic.png";
82 imgSrc = "../images/romantic.png";
90 //source: "../images/romantic.png";