From 6374b4b18974b34fd836f2445efc0bed7b52488a Mon Sep 17 00:00:00 2001 From: Robin Krens Date: Wed, 25 Nov 2020 15:11:27 +0100 Subject: [PATCH] style, speed, size and count parameters --- .gitignore | 1 + contents/code/utils.js | 69 ++++++++++++++++++ contents/config/config.qml | 4 +- contents/config/main.xml | 20 ++++- contents/images/classic.png | Bin 0 -> 4684 bytes contents/images/romantic.png | Bin 0 -> 9162 bytes contents/images/snow1.png | Bin 1431 -> 0 bytes contents/ui/ConfigGeneral.qml | 12 +-- contents/ui/main.qml | 165 ++++++++++++++++++++++++++++++------------ contents/ui/snowWindow.qml | 52 ++++++++++--- metadata.desktop | 2 - 11 files changed, 248 insertions(+), 77 deletions(-) create mode 100644 contents/code/utils.js create mode 100644 contents/images/classic.png create mode 100644 contents/images/romantic.png delete mode 100644 contents/images/snow1.png diff --git a/.gitignore b/.gitignore index 86950b3..c9f21b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.qmlc +*.jsc diff --git a/contents/code/utils.js b/contents/code/utils.js new file mode 100644 index 0000000..e77ec49 --- /dev/null +++ b/contents/code/utils.js @@ -0,0 +1,69 @@ + +function getSnowCount(countStr) { + + var cnt = 25; + switch(countStr) { + case "Few": + cnt = 12; + break; + case "Medium": + cnt = 25; + break; + case "Many": + cnt = 50; + break; + } + + return cnt; +} + +function getSnowSize(sizeStr) { + + var size; + switch(sizeStr) { + case "Tiny": + size = 25; + break; + case "Small": + size = 50; + break; + case "Big": + size = 100; + break; + } + + return size; +} + +function getSnowStyle(style) { + + var style; + switch(styleStr) { + case "Classic": + break; + case "Plain": + break; + case "Romantic": + break; + } + + return style; +} + +function getFallingSpeed(speedStr) { + + var speedFunc; + switch(speedStr) { + case "Slow": + speedFunc = (Math.random() * 100) % 2 + 1; + break; + case "Normal": + speedFunc = (Math.random() * 100) % 3 + 2; + break; + case "Fast": + speedFunc = (Math.random() * 100) % 6 + 4; + break; + } + + return speedFunc; +} diff --git a/contents/config/config.qml b/contents/config/config.qml index dca86fd..1a27aeb 100644 --- a/contents/config/config.qml +++ b/contents/config/config.qml @@ -4,8 +4,8 @@ import org.kde.plasma.configuration 2.0 ConfigModel { ConfigCategory { - name: i18n("Appearance") - icon: "view-list-icons" + name: i18n("General") + icon: "settings-configure" source: "ConfigGeneral.qml" } } diff --git a/contents/config/main.xml b/contents/config/main.xml index 9c334d6..6fcb922 100644 --- a/contents/config/main.xml +++ b/contents/config/main.xml @@ -5,10 +5,22 @@ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > - - - - red + + + + Medium + + + + Normal + + + + Big + + + + Classic diff --git a/contents/images/classic.png b/contents/images/classic.png new file mode 100644 index 0000000000000000000000000000000000000000..922f5af542dff4b5e18151db3542bddded5b6b61 GIT binary patch literal 4684 zcmV-S60_}zP)-M92n*UjA#G=03B&m zSad^gZEa<4bN~PV002XBWnpw>WFU8GbZ8()Nlj2>E@cM*01>cBL_t(|+U;F`XjE4k zJ>8TnDUl~rl$0zfDOp^yOi@y@q(mYSB@(e16vg6Vu_zW7rLs~{DwT>-Q7kP=ON&xb zDh9=1NH7=-27{r}U}|XCP;uB`=+NL}!wwr5x_`X$`M$ZiZ!$?{GUGTGhD?&ln>Y7- zKhAgVcW++${rBGi06+co6AB}J!*$&mz5Wk5cK_7?t^@cdfZ`VkxR-P6e!c=w4`3a? zKk=dfk!v0iQqRj@B#+27Al?HI<@4SG5ZN33050=+V*!Zlj!u4UE&!3;(E}h3paMW8 zf3^icNdbuY9TNch_`Hcs>LP$!0GtAS&HQixoFfRsq_M};sG0<@nd~atD!>B(k7*!9`2fT&05<^q2H<-DJLm~w zad+qeaaP}L{9Q5sHX8!rdU`1UtWs2aR^z1{k-_f*s7v8>I{|#HK)A>x-wj|b^T>RK zqdO`rjR5$oW_8c248DSo!<b?a{zot135}y<~(wNH7#PiuV*-zu0R@Q;TKH;!Xv(BlmLD~Ko=Sldl8UJQc7%pz~{>i z8D$rMGkpFkJ*1c+tAt^%n3MfCdP5z-D(B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4?1>Gmqncg9V+EU zE216tlR|hiTVj&?KtD@~8V$jAA;0pkk%{iLxT+4EoyZ;5ZxYE#^Jjp@In+fz7C_a2 zUR`f9|6~l*`E=9Zu?y^wzX1Pp8dnvi+T-cfin?^ZyZ`VDfwf-&4aa;Wu<{>EUUL*Q z^xnaDP!I4w20FV)hg*=R?H52}Dy9XC<3|fkJ`b7#ka9&+T3GI-kv%nH8l_W2R<_ZV zBQUF1x#qIqQv#A#fMU=uBexc1h!?;o0!dRXAia#_OQ7TYOt6C^IbKbEl_iR3KFUV| zf-myI>O%ezjdi?ucktsDQD&*wMzeAN00SaPL_t*ia*-?Bp+81Yq{U^9U!%loUjU7b zm=MSxufrkLUdy+Vv_qn3(OCK z1*yYl@Wb2y9K3dw!&-&7$&0yM=}mA*fZ{3=b|Fi%zKKuq!i!(y`>xtQ}1{APg9 zIm*wEYWU?g`Cf|~kU@U&k_olgIw$Ump)A+jeeEY@1XUD#zd50(?jpGhW@ ziDWVxnR5TVNc5zMRk<3=6s^{_ndjbv5;=_4gyjFse?FB=CjXz{?!T`xs-cgnoJRIc z%@}g14)+o{`|agI^8YDu>$C^*zRVc8Sb*J`LY-wn@^m_#Vom-_k$%QSh{IVkph~-; zn7dXu2J^Dt*0LbE^OtlwjdVJt?j z#qftK$R9Z;l7qi08%rKz&EXFQJ7HPWvBV@_yI2Ob*r^(o(=o|olsXnc{iL$G`l*=Y zG0KVPqA6e_G09_;3sRtYE@zPKWEz28Ouc9kM^|EqP=#>Y_F_vOqv)_yPG9E#0K!Hg U=`92w(f|Me07*qoM6N<$g5j8DaR2}S literal 0 HcmV?d00001 diff --git a/contents/images/snow1.png b/contents/images/snow1.png deleted file mode 100644 index 9ab4522d0e51143fd885fe58f29b7d518342ba62..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1431 zcmV;I1!($-P))RI3?kS$iM&q03B&m zSad^gZEa<4bN~PV002XBWnpw>WFU8GbZ8()Nlj2>E@cM*00jF2GhW)~Pm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2cbf..84b66b6 100644 --- a/contents/ui/ConfigGeneral.qml +++ b/contents/ui/ConfigGeneral.qml @@ -29,7 +29,6 @@ Item { height: childrenRect.height implicitWidth: pageColumn.implicitWidth implicitHeight: pageColumn.implicitHeight - property string cfg_item_color; SystemPalette { id: sypal @@ -41,19 +40,10 @@ Item { anchors.left: parent.left PlasmaExtras.Heading { - text: i18nc("Heading for colors", "Item shade color") + text: i18nc("TOD", "No config options (yet)") color: syspal.text level: 3 } - /* User can't specify an exact color, since i'm using - * gradients and alpha for colors */ - QtControls.ComboBox { - id: dot - model: ["red", "green", "blue"]; - currentIndex: dot.model.indexOf(cfg_item_color) - onActivated: cfg_item_color = model[index] - } - } } diff --git a/contents/ui/main.qml b/contents/ui/main.qml index 8881ec7..b6bb57e 100644 --- a/contents/ui/main.qml +++ b/contents/ui/main.qml @@ -17,60 +17,146 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.6 +import QtQuick 2.3 +import QtQuick.Controls 1.2 import QtQuick.Layouts 1.0 -import QtQuick.Window 2.2 -//import org.kde.plasma.plasmoid 2.0 as Plasmoid -//import org.kde.plasma.core 2.0 as PlasmaCore -//import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.plasmoid 2.0 as Plasmoid +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents -import QtQuick 2.3 -import QtQuick.Controls 1.2 +import "../code/utils.js" as Utils Item { id: root; property var snow: []; - readonly property int snowCount: 25; + property int snowCount: Utils.getSnowCount(plasmoid.configuration.userCount); readonly property int screenWidth: Qt.application.screens[0].width; readonly property int screenHeight: Qt.application.screens[0].height; - - Button { - id: letitsnow; + width: 250; + height: 180; - anchors.centerIn: parent; - text: "Let it snow!"; + function initializeSnow() { - onClicked: { - - for (var i = 0; i < snowCount; i++) { - - var component = Qt.createComponent("snowWindow.qml"); + if (snowFalling.running) + return; + + for (var i = 0; i < snowCount; i++) { - snow[i] = component.createObject(root); + var component = Qt.createComponent("snowWindow.qml"); + + snow[i] = component.createObject(root); - snow[i].x = Math.random() * screenWidth; - snow[i].y = Math.random() * screenHeight; + snow[i].x = Math.random() * screenWidth; + snow[i].y = Math.random() * screenHeight; + snow[i].width = (Math.random() * 100) % snow[i].radius; + snow[i].height = snow[i].width; + } + } - snow[i].width = (Math.random() * 100) % snow[i].radius; - snow[i].height = snow[i].width; + function startSnow() { - snow[i].showMaximized(); - } + for (var i = 0; i < snowCount; i++) { + snow[i].showMaximized(); + } + snowFalling.running = true; + } + + /* End snow flake and start a 'random' new one */ + function endSnowFlake(i) { + + snow[i].close(); + snow[i].destroy(); + + var component = Qt.createComponent("snowWindow.qml"); + snow[i] = component.createObject(root); + + snow[i].x = Math.random() * screenWidth; + snow[i].y = -10; + snow[i].width = (Math.random() * 100) % snow[i].radius; + snow[i].height = snow[i].width; + + snow[i].showMaximized(); + + } + + function destroySnow() { + + if (!snowFalling.running) + return; + + snowFalling.running = false; + + for (var i = 0; i < snowCount; i++) { + snow[i].close(); + snow[i].destroy(); + } + } + + function updateSnow() { + + if (userSpeed.currentText == '') { // hack + console.log('not initialized yet'); + return; + } + + /* set config for new snow flakes */ + plasmoid.configuration.userStyle = userStyle.textAt(userStyle.currentIndex); + plasmoid.configuration.userSize = userSize.textAt(userSize.currentIndex); + plasmoid.configuration.userSpeed = userSpeed.textAt(userSpeed.currentIndex); + + if (!snowFalling.running || plasmoid.configuration.userSpeed == userSpeed.currentText) // don't update random speed if same + return; + + /* update current snow flakes*/ + for (var i = 0; i < snowCount; i++) { + snow[i].fallingSpeed = Utils.getFallingSpeed(userSpeed.currentText); + } + } + + /* Update snow count works a bit differently; + * can either kill all (implemented now) and start over; + * or slowly add/delete new snow flakes */ + function updateCount() { + + var alreadyRunning = snowFalling.running; + + destroySnow(); + plasmoid.configuration.userCount = userCount.textAt(userCount.currentIndex); + initializeSnow(); + + if (alreadyRunning) + startSnow(); + + } + + GridLayout { + id: gridLayout + rows: 5 + flow: GridLayout.TopToBottom + anchors.fill: parent + + Label { text: "Speed"; color: theme.textColor; } + Label { text: "Size"; color: theme.textColor; } + Label { text: "Style"; color: theme.textColor; } + Label { text: "Count"; color: theme.textColor; } + Button { id: letitsnow; text: "Let it snow!"; onClicked: { initializeSnow(); startSnow(); } } + + ComboBox { id: userSpeed; width: 100; model: ["Slow", "Normal", "Fast"]; currentIndex: 1; onCurrentIndexChanged: updateSnow(); } + ComboBox { id: userSize; width: 100; model: ["Tiny", "Small", "Big"]; currentIndex: 2; onCurrentIndexChanged: updateSnow(); } + ComboBox { id: userStyle; width: 100; model: ["Classic", "Plain", "Romantic"]; currentIndex: 0; onCurrentIndexChanged: updateSnow(); } + ComboBox { id: userCount; width: 100; model: ["Few", "Medium", "Many"]; currentIndex: 1; onCurrentIndexChanged: updateCount(); } - snowFalling.running = true; - } + Button { width: 100; text: "Stop"; onClicked: destroySnow(); } + } Timer { id: snowFalling - function test() { - } - interval: 50; running: false; repeat: true onTriggered: { @@ -92,25 +178,10 @@ Item { snow[i].x = 1440; } - //snow[i].y += 2; snow[i].y += snow[i].fallingSpeed; if (snow[i].y > screenHeight) { - //snow[i].y = 0; - - snow[i].close(); - snow[i].destroy(); - - var component = Qt.createComponent("snowWindow.qml"); - snow[i] = component.createObject(root); - - snow[i].x = Math.random() * screenWidth; - snow[i].y = 0; - snow[i].width = (Math.random() * 100) % snow[i].radius; - snow[i].height = snow[i].width; - - snow[i].showMaximized(); - + endSnowFlake(i); } if(snow[i].rotationDirection == 0) { @@ -121,6 +192,6 @@ Item { } } - } + } } diff --git a/contents/ui/snowWindow.qml b/contents/ui/snowWindow.qml index 7273f6e..8973ddd 100644 --- a/contents/ui/snowWindow.qml +++ b/contents/ui/snowWindow.qml @@ -18,22 +18,28 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.6 -import QtQuick.Controls 1.4 +import QtQuick 2.3 +import QtQuick.Controls 1.2 import QtQuick.Window 2.2 +import org.kde.plasma.plasmoid 2.0 + +import "../code/utils.js" as Utils + ApplicationWindow { id: root; - property int dir: (Math.random() * 100) % 2; /* could go either left or right */ - property int radius: 100; /* size of snowflake */ - property int swirl: (Math.random() * 1000) % 55 + 2; /* random falling 'swirl' */ + property int dir: getRandomIntInclusive(0,1); /* could go either left or right */ + property int radius: Utils.getSnowSize(plasmoid.configuration.userSize); /* size of snowflake */ + property int swirl: getRandomIntInclusive(35,200); /* random falling 'swirl' */ property int disposition: 0; property alias snowFlakeRotation: snowFlake.rotation; - property int rotationSpeed: (Math.random() * 100) % 3 + 1; /* falling rotation */ - property int rotationDirection: (Math.random() * 100) % 2; - property int fallingSpeed: (Math.random() * 100) % 3 + 2; + //property int rotationSpeed: (Math.random() * 100) % 3 + 1; /* falling rotation */ + property int rotationSpeed: getRandomIntInclusive(1,4); + property int rotationDirection: getRandomIntInclusive(0,1); + //property int fallingSpeed: (Math.random() * 100) % 3 + 2; + property int fallingSpeed: Utils.getFallingSpeed(plasmoid.configuration.userSpeed); //width: 80; height: 80; opacity: 0.5; @@ -45,19 +51,43 @@ ApplicationWindow { | Qt.WA_TranslucentBackground | Qt.X11BypassWindowManagerHint; + /* Basic functions (fro, developer.mozilla.org) */ + function getRandomIntInclusive(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min + 1) + min); + } + Rectangle { id: snowFlake; anchors.fill: parent; - //radius: 3; - color: "transparent"; + radius: plasmoid.configuration.userStyle == "Plain" ? 50 : 0; + color: plasmoid.configuration.userStyle == "Plain" ? "white" : "transparent"; Image { id: snowFlakeImage; + function setImage() { + + var imgSrc = ""; + switch(plasmoid.configuration.userStyle) { + case "Classic": + imgSrc = "../images/classic.png"; + break; + case "Plain": + break; + case "Romantic": + imgSrc = "../images/romantic.png"; + break; + } + return imgSrc; + } + anchors.fill: parent; - source: "../images/snow1.png"; + source: setImage(); + //source: "../images/romantic.png"; } } diff --git a/metadata.desktop b/metadata.desktop index 9f02ec9..d86d39f 100644 --- a/metadata.desktop +++ b/metadata.desktop @@ -20,5 +20,3 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-FormFactors=desktop -[Settings] -FallbackTheme=breeze-dark -- 2.7.4