From 984c68ef457af86773e22249694956fcee01a3b5 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 17 Aug 2020 17:19:05 +0200 Subject: [PATCH] implement My Devices --- examples/iot-dashboard/Humidity.cpp | 1 + examples/iot-dashboard/IndoorTemperature.cpp | 1 + examples/iot-dashboard/MainContent.cpp | 4 ++ examples/iot-dashboard/MyDevices.cpp | 52 ++++++++++++++++++ examples/iot-dashboard/MyDevices.h | 12 ++++ examples/iot-dashboard/images.qrc | 4 ++ examples/iot-dashboard/images/ac.png | Bin 0 -> 782 bytes examples/iot-dashboard/images/ac.svg | 9 +++ examples/iot-dashboard/images/lamps.png | Bin 0 -> 747 bytes examples/iot-dashboard/images/lamps.svg | 11 ++++ .../iot-dashboard/images/music-system.png | Bin 0 -> 1468 bytes .../iot-dashboard/images/music-system.svg | 3 + examples/iot-dashboard/images/router.png | Bin 0 -> 925 bytes examples/iot-dashboard/images/router.svg | 19 +++++++ examples/iot-dashboard/iot-dashboard.pro | 2 + 15 files changed, 118 insertions(+) create mode 100644 examples/iot-dashboard/MyDevices.cpp create mode 100644 examples/iot-dashboard/MyDevices.h create mode 100644 examples/iot-dashboard/images/ac.png create mode 100644 examples/iot-dashboard/images/ac.svg create mode 100644 examples/iot-dashboard/images/lamps.png create mode 100644 examples/iot-dashboard/images/lamps.svg create mode 100644 examples/iot-dashboard/images/music-system.png create mode 100644 examples/iot-dashboard/images/music-system.svg create mode 100644 examples/iot-dashboard/images/router.png create mode 100644 examples/iot-dashboard/images/router.svg diff --git a/examples/iot-dashboard/Humidity.cpp b/examples/iot-dashboard/Humidity.cpp index 47537796..2970939f 100644 --- a/examples/iot-dashboard/Humidity.cpp +++ b/examples/iot-dashboard/Humidity.cpp @@ -29,6 +29,7 @@ Humidity::Humidity(QQuickItem *parent) value->setTextColor("#929CB2"); auto* buttons = new QskLinearBox(Qt::Vertical, this); + buttons->setSizePolicy(Qt::Horizontal, QskSizePolicy::Fixed); buttons->setSpacing(0); QImage upImage( ":/images/up.png"); diff --git a/examples/iot-dashboard/IndoorTemperature.cpp b/examples/iot-dashboard/IndoorTemperature.cpp index 4b99b0cb..66dd2a86 100644 --- a/examples/iot-dashboard/IndoorTemperature.cpp +++ b/examples/iot-dashboard/IndoorTemperature.cpp @@ -29,6 +29,7 @@ IndoorTemperature::IndoorTemperature(QQuickItem *parent) value->setTextColor("#929CB2"); auto* buttons = new QskLinearBox(Qt::Vertical, this); + buttons->setSizePolicy(Qt::Horizontal, QskSizePolicy::Fixed); buttons->setSpacing(0); QImage upImage( ":/images/up.png"); diff --git a/examples/iot-dashboard/MainContent.cpp b/examples/iot-dashboard/MainContent.cpp index f1d0fcf5..8401ff6b 100644 --- a/examples/iot-dashboard/MainContent.cpp +++ b/examples/iot-dashboard/MainContent.cpp @@ -3,6 +3,7 @@ #include "Card.h" #include "Humidity.h" #include "IndoorTemperature.h" +#include "MyDevices.h" #include "PieChart.h" #include "TopBar.h" #include "Usage.h" @@ -38,6 +39,9 @@ MainContent::MainContent( QQuickItem *parent ) : QskLinearBox( Qt::Vertical, par auto* humidity = new Humidity(gridBox); gridBox->addItem(humidity, 1, 1); + + auto* myDevices = new MyDevices(gridBox); + gridBox->addItem(myDevices, 0, 2, 2, 1); } void MainContent::addCard( const QString &title, QskControl *content, int column ) diff --git a/examples/iot-dashboard/MyDevices.cpp b/examples/iot-dashboard/MyDevices.cpp new file mode 100644 index 00000000..5cc78960 --- /dev/null +++ b/examples/iot-dashboard/MyDevices.cpp @@ -0,0 +1,52 @@ +#include "MyDevices.h" +#include "DaytimeSkin.h" +#include "RoundedIcon.h" + +#include +#include + +namespace { + class Device : public QskLinearBox + { + public: + Device(const QString& name, const QskGradient& gradient, QQuickItem* parent) + : QskLinearBox(Qt::Vertical, parent) + , m_name(name) + { + auto fileName = name.toLower(); + fileName.replace(' ', '-'); + auto* icon = new RoundedIcon(fileName, gradient, this); + icon->setOpacity(0.15); + auto* textLabel = new QskTextLabel(name, this); + textLabel->setAlignment(Qt::AlignHCenter); + } + + private: + QString m_name; + }; +} + +MyDevices::MyDevices(QQuickItem *parent) : QskLinearBox(Qt::Vertical, parent) +{ + setMargins(17); + + auto* title = new QskTextLabel("My Devices", this); + title->setFontRole(DaytimeSkin::TitleFont); + + auto* content = new QskGridBox(this); + + QskGradient gradient1(QskGradient::Vertical, "#FF3122", "#FF7D34"); + QskGradient gradient2(QskGradient::Vertical, "#6100FF", "#6776FF"); + + auto* lamps = new Device("Lamps", gradient1, content); + content->addItem(lamps, 0, 0); + + auto* musicSystem = new Device("Music System", gradient2, content); + content->addItem(musicSystem, 0, 1); + + auto* ac = new Device("AC", gradient1, content); + content->addItem(ac, 1, 0); + + auto* router = new Device("Router", gradient2, content); + content->addItem(router, 1, 1); +} diff --git a/examples/iot-dashboard/MyDevices.h b/examples/iot-dashboard/MyDevices.h new file mode 100644 index 00000000..75953d2a --- /dev/null +++ b/examples/iot-dashboard/MyDevices.h @@ -0,0 +1,12 @@ +#ifndef MYDEVICES_H +#define MYDEVICES_H + +#include + +class MyDevices : public QskLinearBox +{ +public: + MyDevices( QQuickItem* parent); +}; + +#endif // MYDEVICES_H diff --git a/examples/iot-dashboard/images.qrc b/examples/iot-dashboard/images.qrc index 423b6367..f98310f0 100644 --- a/examples/iot-dashboard/images.qrc +++ b/examples/iot-dashboard/images.qrc @@ -12,5 +12,9 @@ images/humidity.png images/up.png images/down.png + images/lamps.png + images/music-system.png + images/ac.png + images/router.png diff --git a/examples/iot-dashboard/images/ac.png b/examples/iot-dashboard/images/ac.png new file mode 100644 index 0000000000000000000000000000000000000000..51a75aa90ff7a89b8c9329678b3ec764a3856a2d GIT binary patch literal 782 zcmV+p1M&QcP)AI`ZB$TxB2qQn*bhHK}$*YW4`ufPbO?d|a8Cx~J=>J--r!hI+e@Vjf#@%u=z zm=Fqm(6j||Sdhc_^bS=+QH_@_Qra|vL<3aEc9go)_+jjztC!gW# zA*=47ay=^haLyD(Lh}!u6NDOkzmJQH4&U9u zh}SA{iv_VH=(R4821SBI_7>sES=gw{DloKkoKHMuf$|;DjIOtXgB8j5~ z+QEMYuVg>wdJ$ulAc;*?$EAXZ5;om@0B5Q1O=3)S1FM2kiRlKen{cX!Ow83l6-!~1 zs@%1BLW?VQ6RB>mHk2p}&2$<^9}m~V=dYWl5dTGb;ts!m{Z`+2#K#=j5KAT8Q##Cj zL3OBYJa`xp8Q0x2HA&GM7I}ahi7;%}uF4DdFZ?`8)1Lj@@hzlPWkBj-4 zJEysvg#C9{}Jf|elvF{J1k_bnmFq%r${;g4h%S8TwX zr84oC@RYVW9*@dica`yD$bD@yPs{>&Sdhj^A+L3ftvuk?u#Xb_29o3SG5zG=I{*Lx M07*qoM6N<$f;7!#D*ylh literal 0 HcmV?d00001 diff --git a/examples/iot-dashboard/images/ac.svg b/examples/iot-dashboard/images/ac.svg new file mode 100644 index 00000000..20921e23 --- /dev/null +++ b/examples/iot-dashboard/images/ac.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/examples/iot-dashboard/images/lamps.png b/examples/iot-dashboard/images/lamps.png new file mode 100644 index 0000000000000000000000000000000000000000..91536c1b03e70a2848d33f4789bc54ef65971ffc GIT binary patch literal 747 zcmV=Z@00009a7bBm000XU z000XU0RWnu7ytkO0drDELIAGL9O(c600d`2O+f$vv5yPGV{oPhKMaV6Sqf<)Lh><}O|>`+09S+Q(;f~1=Y79ewi zh8vh&6ek|uOq@3VV^5q_`$>r{XXgFpJ->Nxl7oia{Wk~BgGX)W{^P&??{gn1#i1i6 zit(KT4H?i8%k5&&FX3+AgNF1x?RIGeTT6jzxy%}RFG|uw6_F?^dq*E#m1H8S zQly%5r_Mn4YOUE&rcwvJ@Hr)%MGGQZyfN+Zgs1WtvL;ZYD;d)a$kBJCOE=rIw&$z%%bFwWW+j-UX`bjDb1T+~%f$^TAs#m;W_437iH~Z>{qz dlO_?E^dAO^_)J5iTwVYG002ovPDHLkV1j5rNAv&y literal 0 HcmV?d00001 diff --git a/examples/iot-dashboard/images/lamps.svg b/examples/iot-dashboard/images/lamps.svg new file mode 100644 index 00000000..76928255 --- /dev/null +++ b/examples/iot-dashboard/images/lamps.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/iot-dashboard/images/music-system.png b/examples/iot-dashboard/images/music-system.png new file mode 100644 index 0000000000000000000000000000000000000000..2df28477993b68523bba4d304000b8ed28cb3c48 GIT binary patch literal 1468 zcmV;t1w;CYP)@D?pyMG&6m`o`z1}3~!x4#^$Yob}CkYSpjARbyg6w z17{|50A2om=l|s!vXD)AXwQtS%YV^#Zr?dF(SJ->etf@PA=~!Jq6$5gDDDR*2LUZ8 zw*GzQoRK1ro>HKy|NSm43d+*Iid}Q20kP`pV^Nv4)}mEfP^_stR{L}tZR#UVHmAoZ z(9aUJhL_jypg%SKGF%~!YQe|DHO%eOBV`(pN(NN6>u_Onn`f}hZPcN%bAcDR=`$bW zs}zQHa_n`0uSjBOkh1oN-6pK~C^1>K{qtv7!A&3a%{je~d6TTz1K6F+YDI70<~r7F z0W4z38ceN)GQr1#+T;=_QpKrirl~$fQ7;JEBX8JQj6+~U$Z#VpK(j=ticv}C$sCnS z8`_o3O$~+tgpmXaG*fn}Fi4y3?)C+kMMYv^1I69!0Bh~=lI5Z;wELOQu-7MmIl^_1 z5|$9@>Lg)R1+c%&>k5T;5Gx%7{L$!NYGQ2*%D&bXB2^83 zKkUj}o8}WS>1T@LE>!5#-%eG#asdHj_Yg-Ftb-EV7ze)9LUz6x&YKsI5hm}k>8wE+ zE3Ek2?+`Cs6>A44@AoF>ECz^R9TCY6{uhNQ3P?dmXfk?QcdD4ACQV`6yl|tA7BBV7&9cefoB^422u-a=%>CQbGGs! zB`y}a2RQZN@JX>Xn(%@gnuU+HumSp=n{Tz0{OW(l*&7hG%_vg zvWU;AWRH<2u+B55nJp1&54G$PDoIIc0(kY?AAeeoBbKbp2KZN7>e)Kw$u)^}dowJQ zh=%U)Rw5s9tc>De0wbrz7ap6<(IHn5H^ zv>@5w_+TYFd|ygP&xA%=>pq5()0vw~@Y~kd4fC`k63jXl$wii_Vn7OhjzET^8Qjus z?fv#cc;=JN)0?@kjSKA*ybuAnSj zYsq>E1#fcD%F)8p^-Fk$#-BQ)j2O|qbdIQZcTsza)gP8u*!Pv$FU#r=6j$(!icu1x zJ=CcH(7_|LtiN)VZqhI5C4hXjhyAci^NI99X>+HW{&@kB3D~mZ=`Yb(1;bAk|7{(a zSgsoOp7TEe#ce1O341MNv1Nv!r$K$7CzqNfy + + diff --git a/examples/iot-dashboard/images/router.png b/examples/iot-dashboard/images/router.png new file mode 100644 index 0000000000000000000000000000000000000000..86bd1ca859dead7874a70bd0e884153c5de4063a GIT binary patch literal 925 zcmV;O17iG%P)|$@&`4$ZYo?=sw#Cs*mVcpb%&7(Wk({Bw!4H~5mZTbrLrEApxa2 z5Tc7H+UHwae%olJPRRF*d5n!MLq$b1tw4(_A3%wYA&`U+E`)OVpa~Z!+l8>|a&xVb z9-+nZFSD@1YEt7%{ku^1NwPu(kV9GsqmumodCx4Mt(D99u&gO)*QqGa1(R-T(>mI6 zO$0$pZmmm>N$u)XV<>i;*0jjQT2#1ctmcI66XH&uV|hc=#tdDmT_$lDl%%Y8)3cC< z1D9l6SoVbc@~LxybcfR_krQOD7-q9x363P!u(p zAF3u#j5`%$DWGHe8i6_qSJ`TMd~TWwZrcSTt5CUW%la?a-m{lg^Ca*aR<5oi4#Hj| zL+(29%6syBhYi;O^T~nS+W0~F8b$IrK3+r4en^=e&wKHhu6ctLz+F~WiB}SWKAKFD zST!Crjk|G;Qp+S>h!v3Rb9SJ68-dEHp7|Pt7FPbGHCYPiGKP$nw*vxu7J{&PD@f@y z@-Qe3Wki3e=;9{u09{${wId@b+J9Hx=9YI8LnWRL+DHMcUoMY3+k*j%Y2{SC8?E-j z=8j^K70~DJW?E!4bn)bz`(}Rnh>ACGkGqb)XiGP5j`5A-00000NkvXXu0mjfp#`Ql literal 0 HcmV?d00001 diff --git a/examples/iot-dashboard/images/router.svg b/examples/iot-dashboard/images/router.svg new file mode 100644 index 00000000..166cd71a --- /dev/null +++ b/examples/iot-dashboard/images/router.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/examples/iot-dashboard/iot-dashboard.pro b/examples/iot-dashboard/iot-dashboard.pro index dec833b7..9604b028 100644 --- a/examples/iot-dashboard/iot-dashboard.pro +++ b/examples/iot-dashboard/iot-dashboard.pro @@ -8,6 +8,7 @@ SOURCES += \ IndoorTemperature.cpp \ MainContent.cpp \ MenuBar.cpp \ + MyDevices.cpp \ PieChart.cpp \ PieChartPainted.cpp \ PieChartSkinlet.cpp \ @@ -26,6 +27,7 @@ HEADERS += \ MainContent.h \ MainWindow.h \ MenuBar.h \ + MyDevices.h \ PieChart.h \ PieChartPainted.h \ PieChartSkinlet.h \