Git commit 8f1310dd1e9a780da967191335f8de84d46cc477 by Weng Xuetian. Committed on 15/11/2016 at 19:24. Pushed by xuetianweng into branch 'master'. Bring potd wallpaper back to life. Summary: Port the potd wallpaper plugin to KF5/QML. Test Plan: Test manually with plasmashell Reviewers: #plasma, mart Reviewed By: mart Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D3184 A +23 -0 wallpapers/potd/contents/config/main.xml A +167 -0 wallpapers/potd/contents/ui/config.qml [License: LGPL (v= 2+)] A +49 -0 wallpapers/potd/contents/ui/main.qml [License: LGPL (v2+= )] A +105 -0 wallpapers/potd/metadata.desktop http://commits.kde.org/kdeplasma-addons/8f1310dd1e9a780da967191335f8de84d46= cc477 diff --git a/wallpapers/potd/contents/config/main.xml b/wallpapers/potd/con= tents/config/main.xml new file mode 100644 index 0000000..152e0be --- /dev/null +++ b/wallpapers/potd/contents/config/main.xml @@ -0,0 +1,23 @@ + + + + + + + + apod + + + + + + #000000 + + + + diff --git a/wallpapers/potd/contents/ui/config.qml b/wallpapers/potd/conte= nts/ui/config.qml new file mode 100644 index 0000000..012d7c7 --- /dev/null +++ b/wallpapers/potd/contents/ui/config.qml @@ -0,0 +1,167 @@ +/* + * Copyright 2016 Weng Xuetian + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.5 +import QtQuick.Controls 1.0 as QtControls +import QtQuick.Dialogs 1.1 as QtDialogs +import org.kde.plasma.core 2.0 as PlasmaCore + +Column { + id: root + property string cfg_Provider + property int cfg_FillMode + property alias cfg_Color: colorDialog.color + ListModel { + id: providerModel + } + + function populateProviders() { + providerModel.clear(); + var providers =3D engine.data["Providers"]; + if (providers) { + var provider; + for (provider in providers) { + providerModel.append({'id': provider, 'name': providers[pr= ovider]}) + } + } + } + + PlasmaCore.DataSource { + id: engine + engine: "potd" + connectedSources: ["Providers"] + onDataChanged: populateProviders() + } + + Component.onCompleted: { + populateProviders() + for (var i =3D 0; i < providerModel.count; i++) { + if (providerModel.get(i)["id"] =3D=3D wallpaper.configuration.= Provider) { + providerComboBox.currentIndex =3D i; + break; + } + } + } + + Row { + spacing: units.largeSpacing / 2 + QtControls.Label { + width: formAlignment - units.largeSpacing + horizontalAlignment: Text.AlignRight + text: i18nd("plasma_applet_org.kde.potd", "Providers:") + anchors.verticalCenter: providerComboBox.verticalCenter + } + QtControls.ComboBox { + id: providerComboBox + property int textLength: 24 + width: theme.mSize(theme.defaultFont).width * textLength + model: providerModel + textRole: "name" + onCurrentIndexChanged: { + cfg_Provider =3D providerModel.get(currentIndex)["id"] + } + } + } + + Row { + //x: formAlignment - positionLabel.paintedWidth + spacing: units.largeSpacing / 2 + QtControls.Label { + id: positionLabel + width: formAlignment - units.largeSpacing + anchors { + verticalCenter: resizeComboBox.verticalCenter + } + text: i18nd("plasma_applet_org.kde.potd", "Positioning:") + horizontalAlignment: Text.AlignRight + } + QtControls.ComboBox { + id: resizeComboBox + property int textLength: 24 + width: theme.mSize(theme.defaultFont).width * textLength + model: [ + { + 'label': i18nd("plasma_applet_org.kde.potd", "= Scaled and Cropped"), + 'fillMode': Image.PreserveAspectCrop + }, + { + 'label': i18nd("plasma_applet_org.kde.potd","S= caled"), + 'fillMode': Image.Stretch + }, + { + 'label': i18nd("plasma_applet_org.kde.potd","S= caled, Keep Proportions"), + 'fillMode': Image.PreserveAspectFit + }, + { + 'label': i18nd("plasma_applet_org.kde.potd", "= Centered"), + 'fillMode': Image.Pad + }, + { + 'label': i18nd("plasma_applet_org.kde.potd","T= iled"), + 'fillMode': Image.Tile + } + ] + + textRole: "label" + onCurrentIndexChanged: cfg_FillMode =3D model[currentIndex]["f= illMode"] + Component.onCompleted: setMethod(); + + function setMethod() { + for (var i =3D 0; i < model.length; i++) { + if (model[i]["fillMode"] =3D=3D wallpaper.configuratio= n.FillMode) { + resizeComboBox.currentIndex =3D i; + var tl =3D model[i]["label"].length; + } + } + } + } + } + + QtDialogs.ColorDialog { + id: colorDialog + modality: Qt.WindowModal + showAlphaChannel: false + title: i18nd("plasma_applet_org.kde.potd", "Select Background Colo= r") + } + + Row { + id: colorRow + spacing: units.largeSpacing / 2 + QtControls.Label { + width: formAlignment - units.largeSpacing + anchors.verticalCenter: colorButton.verticalCenter + horizontalAlignment: Text.AlignRight + text: i18nd("plasma_applet_org.kde.potd", "Background Color:") + } + QtControls.Button { + id: colorButton + width: units.gridUnit * 3 + text: " " // needed to it gets a proper height... + onClicked: colorDialog.open() + + Rectangle { + id: colorRect + anchors.centerIn: parent + width: parent.width - 2 * units.smallSpacing + height: theme.mSize(theme.defaultFont).height + color: colorDialog.color + } + } + } +} diff --git a/wallpapers/potd/contents/ui/main.qml b/wallpapers/potd/content= s/ui/main.qml new file mode 100644 index 0000000..c986b52 --- /dev/null +++ b/wallpapers/potd/contents/ui/main.qml @@ -0,0 +1,49 @@ +/* + * Copyright 2016 Weng Xuetian + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.5 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.kquickcontrolsaddons 2.0 + +Rectangle { + id: root + + readonly property string provider: wallpaper.configuration.Provider + + PlasmaCore.DataSource { + id: engine + engine: "potd" + connectedSources: [provider] + } + + Rectangle { + id: backgroundColor + anchors.fill: parent + color: wallpaper.configuration.Color + Behavior on color { + ColorAnimation { duration: units.longDuration } + } + } + + QImageItem { + anchors.fill: parent + image: engine.data[provider]["Image"] + fillMode: wallpaper.configuration.FillMode + } +} diff --git a/wallpapers/potd/metadata.desktop b/wallpapers/potd/metadata.de= sktop new file mode 100644 index 0000000..94c3217 --- /dev/null +++ b/wallpapers/potd/metadata.desktop @@ -0,0 +1,105 @@ +[Desktop Entry] +Encoding=3DUTF-8 +Name=3DPicture of the Day +Name[ar]=3D=D8=B5=D9=88=D8=B1=D8=A9 =D8=A7=D9=84=D9=8A=D9=88=D9=85 +Name[ast]=3DImaxe del d=C3=ADa +Name[bs]=3DSlika dana +Name[ca]=3DImatge del dia +Name[ca@valencia]=3DImatge del dia +Name[cs]=3DObr=C3=A1zek dne +Name[da]=3DDagens billede +Name[de]=3DBild des Tages +Name[el]=3D=CE=A6=CF=89=CF=84=CE=BF=CE=B3=CF=81=CE=B1=CF=86=CE=AF=CE=B1 = =CF=84=CE=B7=CF=82 =CE=B7=CE=BC=CE=AD=CF=81=CE=B1=CF=82 +Name[en_GB]=3DPicture of the Day +Name[es]=3DImagen del d=C3=ADa +Name[et]=3DP=C3=A4evapilt +Name[fi]=3DP=C3=A4iv=C3=A4n kuva +Name[fr]=3DImage du jour +Name[ga]=3DGrianghraf an Lae +Name[gl]=3DImaxe do d=C3=ADa +Name[hr]=3DSlika dana +Name[hu]=3DA nap k=C3=A9pe +Name[is]=3DMyndir dagsins +Name[it]=3DImmagine del giorno +Name[ja]=3D=E4=BB=8A=E6=97=A5=E3=81=AE=E5=86=99=E7=9C=9F +Name[kk]=3D=D0=A2=D3=99=D1=83=D0=BB=D1=96=D0=BA =D1=81=D1=83=D1=80=D0=B5= =D1=82=D1=96 +Name[km]=3D=E1=9E=9A=E1=9E=BC=E1=9E=94=E1=9E=97=E1=9E=B6=E1=9E=96=E2=80=8B= =E1=9E=94=E1=9F=92=E1=9E=9A=E1=9E=85=E1=9E=B6=E1=9F=86=E2=80=8B=E1=9E=90=E1= =9F=92=E1=9E=84=E1=9F=83 +Name[ko]=3D=EC=98=A4=EB=8A=98=EC=9D=98 =EA=B7=B8=EB=A6=BC +Name[lt]=3DDienos paveiksliukas +Name[lv]=3DDienas att=C4=93ls +Name[mr]=3D=E0=A4=A6=E0=A4=BF=E0=A4=B5=E0=A4=B8=E0=A4=BE=E0=A4=9A=E0=A5=87= =E0=A4=9A=E0=A4=BF=E0=A4=A4=E0=A5=8D=E0=A4=B0 +Name[nb]=3DDagens bilde +Name[nds]=3DBild f=C3=B6r Vundaag +Name[nl]=3DAfbeelding van de dag +Name[nn]=3DDagens bilete +Name[pa]=3D=E0=A8=85=E0=A9=B1=E0=A8=9C =E0=A8=A6=E0=A9=80 =E0=A8=A4=E0=A8= =B8=E0=A8=B5=E0=A9=80=E0=A8=B0 +Name[pl]=3DObraz dnia +Name[pt]=3DImagem do Dia +Name[pt_BR]=3DImagem do dia +Name[ro]=3DImaginea zilei +Name[ru]=3D=D0=98=D0=B7=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0= =B5 =D0=B4=D0=BD=D1=8F +Name[sk]=3DObr=C3=A1zok d=C5=88a +Name[sl]=3DSlika dneva +Name[sr]=3D=D1=81=D0=BB=D0=B8=D0=BA=D0=B0 =D0=B4=D0=B0=D0=BD=D0=B0 +Name[sr@ijekavian]=3D=D1=81=D0=BB=D0=B8=D0=BA=D0=B0 =D0=B4=D0=B0=D0=BD=D0= =B0 +Name[sr@ijekavianlatin]=3Dslika dana +Name[sr@latin]=3Dslika dana +Name[sv]=3DDagens bild +Name[tr]=3DG=C3=BCn=C3=BCn Resmi +Name[uk]=3D=D0=9A=D0=B0=D1=80=D1=82=D0=B8=D0=BD=D0=BA=D0=B0 =D0=B4=D0=BD= =D1=8F +Name[wa]=3DIm=C3=A5dje do djo=C3=BB +Name[x-test]=3DxxPicture of the Dayxx +Name[zh_CN]=3D=E6=AF=8F=E6=97=A5=E4=B8=80=E5=9B=BE +Name[zh_TW]=3D=E6=9C=AC=E6=97=A5=E5=9C=96=E7=89=87 +Comment=3DA new picture from the Internet each day +Comment[ar]=3D=D8=B5=D9=88=D8=B1=D8=A9 =D9=85=D9=86 =D8=A7=D9=84=D8=B3=D8= =A7=D8=A8=D9=83=D8=A9 =D9=83=D9=84 =D9=8A=D9=88=D9=85 +Comment[bs]=3DNova slika sa Interneta svaki dan +Comment[ca]=3DUna imatge nova des d'Internet cada dia +Comment[ca@valencia]=3DUna imatge nova des d'Internet cada dia +Comment[cs]=3DNov=C3=BD obr=C3=A1zek z internetu denn=C4=9B +Comment[da]=3DEt nyt billede fra internettet hver dag +Comment[de]=3DT=C3=A4glich ein Bild aus dem Internet anzeigen +Comment[el]=3D=CE=9A=CE=AC=CE=B8=CE=B5 =CE=BC=CE=AD=CF=81=CE=B1 =CE=BC=CE= =B9=CE=B1 =CE=BD=CE=AD=CE=B1 =CE=B5=CE=B9=CE=BA=CF=8C=CE=BD=CE=B1 =CE=B1=CF= =80=CF=8C =CF=84=CE=BF =CE=B4=CE=B9=CE=B1=CE=B4=CE=AF=CE=BA=CF=84=CF=85=CE= =BF +Comment[en_GB]=3DA new picture from the Internet each day +Comment[es]=3DUna nueva imagen desde Internet cada d=C3=ADa +Comment[et]=3DIga p=C3=A4ev uus pilt internetist +Comment[fi]=3DJoka p=C3=A4iv=C3=A4 uusi kuva Internetist=C3=A4 +Comment[fr]=3DUne nouvelle image chaque jour provenant d'Internet +Comment[gl]=3DMostra imaxes de internet cada d=C3=ADa. +Comment[hu]=3DMinden nap =C3=BAj k=C3=A9p az internetr=C5=91l +Comment[it]=3DUna nuova immagine ogni giorno da Internet. +Comment[kk]=3D=D0=9A=D2=AF=D0=BD=D0=B4=D0=B5 =D0=98=D0=BD=D1=82=D0=B5=D1= =80=D0=BD=D0=B5=D1=82=D1=82=D0=B5=D0=BD =D0=B6=D0=B0=D2=A3=D0=B0 =D1=81=D1= =83=D1=80=D0=B5=D1=82 +Comment[ko]=3D=EC=9D=B8=ED=84=B0=EB=84=B7=EC=97=90=EC=84=9C =EB=A7=A4=EC= =9D=BC =EC=83=88 =EA=B7=B8=EB=A6=BC =EA=B0=80=EC=A0=B8=EC=98=A4=EA=B8=B0 +Comment[nb]=3DEt nytt bilde fra Internett hver dag +Comment[nds]=3DElk Dag en nieg Bild ut dat Internet halen +Comment[nl]=3DElke dag een nieuw plaatje uit het internet +Comment[nn]=3DEit nytt bilete fr=C3=A5 Internett kvar dag +Comment[pl]=3DKa=C5=BCdego dnia nowe zdj=C4=99cie z internetu +Comment[pt]=3DUma nova imagem di=C3=A1ria da Internet +Comment[pt_BR]=3DUma nova imagem di=C3=A1ria da Internet +Comment[ro]=3DO nou=C4=83 imagine din Internet =C3=AEn fiecare zi +Comment[ru]=3D=D0=9D=D0=BE=D0=B2=D0=BE=D0=B5 =D0=B8=D0=B7=D0=BE=D0=B1=D1= =80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5 =D0=B8=D0=B7 =D0=98=D0=BD=D1=82=D0= =B5=D1=80=D0=BD=D0=B5=D1=82=D0=B0 =D0=BA=D0=B0=D0=B6=D0=B4=D1=8B=D0=B9 =D0= =B4=D0=B5=D0=BD=D1=8C +Comment[sk]=3DNov=C3=BD obr=C3=A1zok z Internetu ka=C5=BEd=C3=BD de=C5=88 +Comment[sl]=3DNova slika z interneta vsak dan +Comment[sr]=3D=D0=A1=D0=B2=D0=B0=D0=BA=D0=B8 =D0=B4=D0=B0=D0=BD =D0=BD=D0= =BE=D0=B2=D0=B0 =D1=81=D0=BB=D0=B8=D0=BA=D0=B0 =D1=81=D0=B0 =D0=98=D0=BD=D1= =82=D0=B5=D1=80=D0=BD=D0=B5=D1=82=D0=B0 +Comment[sr@ijekavian]=3D=D0=A1=D0=B2=D0=B0=D0=BA=D0=B8 =D0=B4=D0=B0=D0=BD = =D0=BD=D0=BE=D0=B2=D0=B0 =D1=81=D0=BB=D0=B8=D0=BA=D0=B0 =D1=81=D0=B0 =D0=98= =D0=BD=D1=82=D0=B5=D1=80=D0=BD=D0=B5=D1=82=D0=B0 +Comment[sr@ijekavianlatin]=3DSvaki dan nova slika sa Interneta +Comment[sr@latin]=3DSvaki dan nova slika sa Interneta +Comment[sv]=3DEn ny bild fr=C3=A5n Internet varje dag +Comment[tr]=3DHer g=C3=BCn =C4=B0nternet'ten yeni bir resim g=C3=B6ster +Comment[uk]=3D=D0=9D=D0=BE=D0=B2=D0=B5 =D0=B7=D0=BE=D0=B1=D1=80=D0=B0=D0= =B6=D0=B5=D0=BD=D0=BD=D1=8F =D0=B7 =D1=96=D0=BD=D1=82=D0=B5=D1=80=D0=BD=D0= =B5=D1=82=D1=83 =D1=89=D0=BE=D0=B4=D0=BD=D1=8F +Comment[x-test]=3DxxA new picture from the Internet each dayxx +Comment[zh_CN]=3D=E6=AF=8F=E5=A4=A9=E4=BB=8E=E4=BA=92=E8=81=94=E7=BD=91=E8= =8E=B7=E5=8F=96=E6=96=B0=E5=9B=BE=E7=89=87 +Comment[zh_TW]=3D=E7=B6=B2=E9=9A=9B=E7=B6=B2=E8=B7=AF=E4=B8=8A=E7=9A=84=E6= =AF=8F=E6=97=A5=E6=96=B0=E5=9C=96=E7=89=87 + +Type=3DService +ServiceTypes=3DPlasma/Wallpaper +Icon=3Doffice-calendar +X-Plasma-MainScript=3Dui/main.qml +X-KDE-PluginInfo-Author=3DWeng Xuetian +X-KDE-PluginInfo-Email=3Dwengxt@gmail.com +X-KDE-PluginInfo-Name=3Dorg.kde.potd +X-KDE-PluginInfo-Version=3D1.0 +X-KDE-PluginInfo-Website=3Dhttp://kde.org/ +X-KDE-PluginInfo-License=3DLGPL +X-KDE-PluginInfo-EnabledByDefault=3Dtrue