parent
c4075ddaed
commit
4291b0d20e
@ -104,4 +104,5 @@ endif(X11_FOUND)
|
||||
|
||||
install(TARGETS plasma-shell ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
|
||||
add_subdirectory(applets)
|
||||
add_subdirectory(qmlpackages)
|
||||
|
4
src/shell/applets/CMakeLists.txt
Normal file
4
src/shell/applets/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
plasma_install_package(testapplet org.kde.testapplet)
|
||||
plasma_install_package(testcomponentsapplet org.kde.testcomponentsapplet)
|
||||
plasma_install_package(testshaderapplet org.kde.testshaderapplet)
|
29
src/shell/applets/testapplet/contents/config/config.qml
Normal file
29
src/shell/applets/testapplet/contents/config/config.qml
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2013 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.configuration 2.0
|
||||
|
||||
ConfigModel {
|
||||
ConfigCategory {
|
||||
name: "General"
|
||||
icon: "plasma"
|
||||
source: "configGeneral.qml"
|
||||
}
|
||||
}
|
15
src/shell/applets/testapplet/contents/config/main.xml
Normal file
15
src/shell/applets/testapplet/contents/config/main.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||
<kcfgfile name=""/>
|
||||
|
||||
<group name="General">
|
||||
<entry name="Test" type="String">
|
||||
<label>This is a test</label>
|
||||
<default>test</default>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
</kcfg>
|
47
src/shell/applets/testapplet/contents/ui/configGeneral.qml
Normal file
47
src/shell/applets/testapplet/contents/ui/configGeneral.qml
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2013 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
|
||||
Item {
|
||||
id: iconsPage
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: mainColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property alias cfg_Test: testConfigField.text
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
anchors.fill: parent
|
||||
spacing: 4
|
||||
Row {
|
||||
PlasmaComponents.Label {
|
||||
text: "Text Config value"
|
||||
}
|
||||
PlasmaComponents.TextField {
|
||||
id: testConfigField
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
92
src/shell/applets/testapplet/contents/ui/main.qml
Normal file
92
src/shell/applets/testapplet/contents/ui/main.qml
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright 2013 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "transparent"
|
||||
width: 100
|
||||
height: 100
|
||||
radius: 10
|
||||
smooth: true
|
||||
property int minimumWidth: units.gridUnit * 20
|
||||
property int minimumHeight: column.implicitHeight
|
||||
|
||||
property Component compactRepresentation: Component {
|
||||
Rectangle {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: plasmoid.expanded = !plasmoid.expanded
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaExtras.ConditionalLoader {
|
||||
anchors.fill: parent
|
||||
when: plasmoid.expanded
|
||||
source: Component {
|
||||
Item {
|
||||
Column {
|
||||
id: column
|
||||
anchors.centerIn: parent
|
||||
Text {
|
||||
text: i18n("I'm an applet")
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
text: i18n("Background")
|
||||
checked: plasmoid.backgroundHints == 1
|
||||
onClicked: {
|
||||
print("Background hints: " + plasmoid.backgroundHints)
|
||||
if (plasmoid.backgroundHints == 0) {
|
||||
plasmoid.backgroundHints = 1//TODO: make work "StandardBackground"
|
||||
root.color = "transparent"
|
||||
} else {
|
||||
plasmoid.backgroundHints = 0//TODO: make work "NoBackground"
|
||||
root.color = "darkgreen"
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
text: i18n("Busy")
|
||||
checked: plasmoid.busy
|
||||
onClicked: {
|
||||
plasmoid.busy = !plasmoid.busy
|
||||
}
|
||||
}
|
||||
TextInput {
|
||||
width: 100
|
||||
height: 22
|
||||
text: plasmoid.configuration.Test
|
||||
onTextChanged: plasmoid.configuration.Test = text
|
||||
}
|
||||
Component.onCompleted: {
|
||||
print("Conditional component of test applet loaded")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
print("Test Applet loaded")
|
||||
}
|
||||
}
|
30
src/shell/applets/testapplet/metadata.desktop
Normal file
30
src/shell/applets/testapplet/metadata.desktop
Normal file
@ -0,0 +1,30 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Keywords=
|
||||
Name=Applet Test
|
||||
Name[de]=Miniprogrammtest
|
||||
Name[es]=Prueba de miniaplicación
|
||||
Name[fi]=Sovelmatesti
|
||||
Name[fr]=Applet test
|
||||
Name[mr]=एप्लेट चाचणी
|
||||
Name[nl]=Test van applet
|
||||
Name[pl]=Próba apletu
|
||||
Name[pt]=Teste de 'Applets'
|
||||
Name[pt_BR]=Teste de miniaplicativo
|
||||
Name[sk]=Test Appletu
|
||||
Name[sv]=Miniprogramtest
|
||||
Name[uk]=Тест аплету
|
||||
Name[x-test]=xxApplet Testxx
|
||||
Type=Service
|
||||
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-KDE-ParentApp=
|
||||
X-KDE-PluginInfo-Author=Marco Martin
|
||||
X-KDE-PluginInfo-Category=
|
||||
X-KDE-PluginInfo-Email=mart@kde.org
|
||||
X-KDE-PluginInfo-License=GPLv2+
|
||||
X-KDE-PluginInfo-Name=org.kde.testapplet
|
||||
X-KDE-PluginInfo-Version=
|
||||
X-KDE-PluginInfo-Website=
|
||||
X-Plasma-MainScript=ui/main.qml
|
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
// ButtonsPage
|
||||
|
||||
PlasmaComponents.Page {
|
||||
id: plasmoidPage
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: _s
|
||||
}
|
||||
Column {
|
||||
spacing: _s/2
|
||||
anchors.fill: parent
|
||||
PlasmaExtras.Heading {
|
||||
level: 1
|
||||
width: parent.width
|
||||
text: "Buttons"
|
||||
}
|
||||
Row {
|
||||
height: _h
|
||||
spacing: _s
|
||||
PlasmaComponents.Button {
|
||||
text: "Button"
|
||||
iconSource: "call-start"
|
||||
}
|
||||
PlasmaComponents.ToolButton {
|
||||
text: "ToolButton"
|
||||
iconSource: "call-stop"
|
||||
}
|
||||
}
|
||||
Row {
|
||||
height: _h
|
||||
spacing: _s
|
||||
PlasmaComponents.RadioButton {
|
||||
id: radio
|
||||
text: "RadioButton"
|
||||
//iconSource: "call-stop"
|
||||
onCheckedChanged: if (checked) tfield.forceActiveFocus()
|
||||
}
|
||||
PlasmaComponents.TextField {
|
||||
id: tfield
|
||||
enabled: radio.checked
|
||||
text: "input here"
|
||||
clearButtonShown: true
|
||||
}
|
||||
}
|
||||
// PlasmaComponents.TextArea {
|
||||
// width: parent.width
|
||||
// height: _h*2
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Window 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
// DialogContent
|
||||
|
||||
Item {
|
||||
id: dialogsPage
|
||||
width: 300
|
||||
height: 200
|
||||
signal closeMe()
|
||||
Rectangle {
|
||||
color: "green"
|
||||
//anchors.margins: 24
|
||||
opacity: 0
|
||||
anchors.fill: parent
|
||||
}
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
spacing: 12
|
||||
PlasmaExtras.Title {
|
||||
id: tx
|
||||
text: "Test Dialog"
|
||||
}
|
||||
LocaleItem {
|
||||
id: localeItem
|
||||
anchors { left: parent.left; right: parent.right; top: tx.bottom; }
|
||||
}
|
||||
PlasmaComponents.TextArea {
|
||||
anchors { left: parent.left; right: parent.right; top: localeItem.bottom; }
|
||||
width: parent.width
|
||||
height: 80
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
id: thanks
|
||||
anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 24; }
|
||||
iconSource: "dialog-ok"
|
||||
text: "Thanks."
|
||||
//onClicked: dialogsPage.parent.visible = false;
|
||||
onClicked: closeMe()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,246 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Window 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
// DialogsPage
|
||||
|
||||
PlasmaComponents.Page {
|
||||
id: dialogsPage
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: _s
|
||||
}
|
||||
Column {
|
||||
spacing: _s/2
|
||||
anchors.fill: parent
|
||||
PlasmaExtras.Title {
|
||||
width: parent.width
|
||||
text: "Dialogs"
|
||||
}
|
||||
Row {
|
||||
height: _h
|
||||
spacing: _s
|
||||
PlasmaComponents.Button {
|
||||
id: radio
|
||||
checkable: true
|
||||
iconSource: "dialog-ok"
|
||||
text: "Window"
|
||||
}
|
||||
Window {
|
||||
title: radio.text
|
||||
id: qWindow
|
||||
visible: radio.checked
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
color: Qt.rgba(0,0,0,0)
|
||||
DialogContent {
|
||||
id: dContent
|
||||
onCloseMe: {
|
||||
qWindow.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
text: qWindow.visible ? "shown" : "hidden"
|
||||
}
|
||||
}
|
||||
Row {
|
||||
height: _h
|
||||
spacing: _s
|
||||
PlasmaComponents.Button {
|
||||
text: "Core.Dialog"
|
||||
iconSource: "dialog-ok-apply"
|
||||
checkable: true
|
||||
//onCheckedChanged: pcDialog.visible = checked
|
||||
onCheckedChanged: pcDialog.visible = checked
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
text: pcDialog.visible ? "shown" : "hidden"
|
||||
}
|
||||
|
||||
PlasmaCore.Dialog {
|
||||
id: pcDialog
|
||||
//windowFlags: Qt.Popup
|
||||
visualParent: dialogsPage
|
||||
//mainItem: dContent2
|
||||
color: Qt.rgba(0,0,0,0)
|
||||
|
||||
mainItem: DialogContent {
|
||||
id: dContent2
|
||||
onCloseMe: pcDialog.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
Row {
|
||||
height: _h
|
||||
spacing: _s
|
||||
PlasmaComponents.Button {
|
||||
text: "Dialog"
|
||||
iconSource: "dialog-ok-apply"
|
||||
checkable: true
|
||||
onCheckedChanged: {
|
||||
if (checked) {
|
||||
pcompDialog.open();
|
||||
} else {
|
||||
pcompDialog.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
text: pcompDialog.visible ? "shown" : "hidden"
|
||||
}
|
||||
|
||||
PlasmaComponents.Dialog {
|
||||
id: pcompDialog
|
||||
//windowFlags: Qt.Popup
|
||||
visualParent: root
|
||||
content: DialogContent {
|
||||
id: dContent3
|
||||
onCloseMe: pcompDialog.close()
|
||||
}
|
||||
buttons: PlasmaComponents.ButtonRow {
|
||||
PlasmaComponents.Button {
|
||||
text: "Close";
|
||||
onClicked: {
|
||||
print("Closing...");
|
||||
pcompDialog.close()
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
text: "Accept";
|
||||
onClicked: {
|
||||
print("Accepting...");
|
||||
pcompDialog.accept();
|
||||
pcompDialog.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Row {
|
||||
height: _h
|
||||
spacing: _s
|
||||
PlasmaComponents.Button {
|
||||
text: "QueryDialog"
|
||||
iconSource: "dialog-ok-apply"
|
||||
checkable: true
|
||||
onCheckedChanged: {
|
||||
if (checked) {
|
||||
queryDialog.open();
|
||||
} else {
|
||||
queryDialog.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
text: queryDialog.visible ? "shown" : "hidden"
|
||||
}
|
||||
|
||||
PlasmaComponents.QueryDialog {
|
||||
id: queryDialog
|
||||
//windowFlags: Qt.Popup
|
||||
visualParent: root
|
||||
titleText: "Fruit Inquiry"
|
||||
message: "Would you rather have apples or oranges?"
|
||||
acceptButtonText: "Apples"
|
||||
rejectButtonText: "Oranges"
|
||||
onButtonClicked: {
|
||||
print("hey");
|
||||
queryDialog.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaComponents.ButtonRow {
|
||||
id: buttonRow
|
||||
spacing: _s/2
|
||||
PlasmaComponents.Button {
|
||||
width: _h
|
||||
text: "Top"
|
||||
onClicked: {
|
||||
locationDialog.location = PlasmaCore.Types.TopEdge;
|
||||
locationDialog.visible = !locationDialog.visible
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
text: "Bottom"
|
||||
width: _h
|
||||
onClicked: {
|
||||
locationDialog.location = PlasmaCore.Types.BottomEdge;
|
||||
locationDialog.visible = !locationDialog.visible
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
text: "Left"
|
||||
width: _h
|
||||
onClicked: {
|
||||
locationDialog.location = PlasmaCore.Types.LeftEdge;
|
||||
locationDialog.visible = !locationDialog.visible
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
text: "Right"
|
||||
width: _h
|
||||
onClicked: {
|
||||
locationDialog.location = PlasmaCore.Types.RightEdge;
|
||||
locationDialog.visible = !locationDialog.visible
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
text: "Desktop"
|
||||
width: _h
|
||||
onClicked: {
|
||||
locationDialog.location = PlasmaCore.Types.Desktop;
|
||||
locationDialog.visible = !locationDialog.visible
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
text: "Floating"
|
||||
width: _h
|
||||
onClicked: {
|
||||
locationDialog.location = PlasmaCore.Types.Floating;
|
||||
locationDialog.visible = !locationDialog.visible
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
text: "FullScreen"
|
||||
width: _h
|
||||
onClicked: {
|
||||
locationDialog.location = PlasmaCore.Types.FullScreen;
|
||||
locationDialog.visible = !locationDialog.visible
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaCore.Dialog {
|
||||
id: locationDialog
|
||||
visualParent: buttonRow
|
||||
mainItem: DialogContent {
|
||||
id: dContent4
|
||||
onCloseMe: locationDialog.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
import org.kde.draganddrop 2.0 as DragAndDrop
|
||||
|
||||
|
||||
//Item {
|
||||
PlasmaComponents.ListItem {
|
||||
|
||||
width: parent.width
|
||||
//height: _h * 1.5
|
||||
property alias icon: itemIcon.source
|
||||
property alias text: label.text
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
id: itemIcon
|
||||
|
||||
width: _h
|
||||
height: width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: _h/2
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: label
|
||||
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: itemIcon.right
|
||||
leftMargin: _h/2
|
||||
right: parent.right
|
||||
rightMargin: _h/2
|
||||
}
|
||||
|
||||
}
|
||||
}
|
262
src/shell/applets/testcomponentsapplet/contents/ui/DragPage.qml
Normal file
262
src/shell/applets/testcomponentsapplet/contents/ui/DragPage.qml
Normal file
@ -0,0 +1,262 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
import org.kde.draganddrop 2.0 as DragAndDrop
|
||||
|
||||
// MousePage
|
||||
|
||||
PlasmaComponents.Page {
|
||||
id: dragPage
|
||||
|
||||
property int _h: 48
|
||||
property bool isDragging: false
|
||||
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: _s
|
||||
}
|
||||
|
||||
PlasmaExtras.Title {
|
||||
id: dlabel
|
||||
|
||||
anchors { left: parent.left; right: parent.right; top: parent.top; }
|
||||
|
||||
text: "Drag & Drop"
|
||||
}
|
||||
|
||||
Column {
|
||||
id: dragCol
|
||||
|
||||
width: (parent.width-_h)/2
|
||||
height: parent.height
|
||||
anchors {
|
||||
left: parent.left;
|
||||
top: parent.top;
|
||||
topMargin: itemHeight/2
|
||||
|
||||
}
|
||||
|
||||
spacing: _h/4
|
||||
|
||||
|
||||
property int itemHeight: _h*1.5
|
||||
|
||||
DragItem {
|
||||
text: "Image and URL"
|
||||
icon: "image-png"
|
||||
height: parent.itemHeight
|
||||
DragAndDrop.DragArea {
|
||||
objectName: "imageandurl"
|
||||
anchors { fill: parent; }
|
||||
//delegateImage: "akonadi"
|
||||
mimeData.url: "http://plasma.kde.org"
|
||||
onDragStarted: {
|
||||
isDragging = true;
|
||||
print(" drag started for " + objectName);
|
||||
ooo.text = objectName
|
||||
}
|
||||
onDrop: {
|
||||
isDragging = false;
|
||||
print(" item dropped " + objectName);
|
||||
ooo.text = objectName
|
||||
}
|
||||
//Rectangle { anchors.fill: parent; color: "blue"; opacity: 0.4; }
|
||||
}
|
||||
}
|
||||
DragItem {
|
||||
text: "Delegate Image"
|
||||
icon: "image-png"
|
||||
height: parent.itemHeight
|
||||
DragAndDrop.DragArea {
|
||||
objectName: "image"
|
||||
anchors { fill: parent; }
|
||||
//delegateImage: "akonadi"
|
||||
//mimeData.url: "http://plasma.kde.org"
|
||||
onDragStarted: {
|
||||
isDragging = true;
|
||||
print(" drag started for " + objectName);
|
||||
ooo.text = objectName
|
||||
}
|
||||
onDrop: {
|
||||
isDragging = false;
|
||||
print(" item dropped " + objectName);
|
||||
ooo.text = objectName
|
||||
}
|
||||
//Rectangle { anchors.fill: parent; color: "green"; opacity: 0.4; }
|
||||
}
|
||||
}
|
||||
DragItem {
|
||||
text: "HTML"
|
||||
icon: "text-html"
|
||||
height: parent.itemHeight
|
||||
DragAndDrop.DragArea {
|
||||
objectName: "html"
|
||||
anchors { fill: parent; }
|
||||
mimeData.html: "<b>One <i> Two <u> Three </b> Four </i>Five </u> "
|
||||
onDragStarted: {
|
||||
isDragging = true;
|
||||
print(" drag started for " + objectName);
|
||||
ooo.text = objectName
|
||||
}
|
||||
onDrop: {
|
||||
isDragging = false;
|
||||
print(" item dropped " + objectName);
|
||||
ooo.text = objectName
|
||||
}
|
||||
}
|
||||
}
|
||||
DragItem {
|
||||
text: "Color"
|
||||
icon: "preferences-color"
|
||||
height: parent.itemHeight
|
||||
DragAndDrop.DragArea {
|
||||
objectName: "color"
|
||||
anchors { fill: parent; }
|
||||
mimeData.color: "orange"
|
||||
onDragStarted: {
|
||||
isDragging = true;
|
||||
print(" drag started for " + objectName);
|
||||
ooo.text = objectName
|
||||
}
|
||||
onDrop: {
|
||||
isDragging = false;
|
||||
print(" item dropped " + objectName);
|
||||
ooo.text = objectName
|
||||
//mimeData.
|
||||
}
|
||||
}
|
||||
}
|
||||
DragItem {
|
||||
text: "Lots of Stuff"
|
||||
icon: "ksplash"
|
||||
height: parent.itemHeight
|
||||
DragAndDrop.DragArea {
|
||||
id: dragArea2
|
||||
objectName: "stuff"
|
||||
// width: parent.width / 2
|
||||
// height: dropArea.height / 2
|
||||
anchors.fill: parent
|
||||
|
||||
mimeData.text: "Clownfish"
|
||||
mimeData.html: "<h2>Swimming in a Sea of Cheese</h2><pre>Primus->perform();</pre><br/>"
|
||||
mimeData.color: "darkred"
|
||||
mimeData.url: "http://plasma.kde.org"
|
||||
mimeData.urls: ["http://planetkde.org", "http://fsfe.org", "http://techbase.kde.org", "http://qt-project.org"]
|
||||
|
||||
//Rectangle { anchors.fill: parent; color: "yellow"; opacity: 0.6; }
|
||||
|
||||
onDragStarted: {
|
||||
isDragging = true;
|
||||
print(" drag started for " + objectName);
|
||||
ooo.text = objectName
|
||||
}
|
||||
onDrop: {
|
||||
isDragging = false;
|
||||
print(" item dropped " + objectName);
|
||||
ooo.text = objectName
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
id: ooo
|
||||
}
|
||||
}
|
||||
DragAndDrop.DropArea {
|
||||
id: dropArea
|
||||
//width: parent.width- / 2
|
||||
//visible: false
|
||||
anchors {
|
||||
right: parent.right;
|
||||
left: dragCol.right;
|
||||
bottom: parent.bottom;
|
||||
top: parent.top; margins: _h/2
|
||||
|
||||
}
|
||||
|
||||
PlasmaComponents.ListItem {
|
||||
id: dropHightlight
|
||||
anchors.fill: parent
|
||||
opacity: 0
|
||||
|
||||
PropertyAnimation { properties: "opacity"; easing.type: Easing.Linear; duration: 2000; }
|
||||
}
|
||||
|
||||
Rectangle { id: clr; anchors.fill: parent; color: "transparent"; opacity: color != "transparent" ? 1 : 0; }
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: ilabel
|
||||
font.pointSize: _h / 2
|
||||
text: "Drop here."
|
||||
opacity: isDragging ? 0.7 : 0
|
||||
anchors.centerIn: parent
|
||||
horizontalAlignment: Text.AlignCenter
|
||||
PropertyAnimation { properties: "opacity"; easing.type: Easing.Linear; duration: 2000; }
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: slabel
|
||||
font.pointSize: _h / 4
|
||||
//text: "Drop here."
|
||||
//opacity: isDragging ? 1 : 0
|
||||
//onTextChanged: print("droparea changed to " + text)
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
//horizontalAlignment: Text.AlignCenter
|
||||
}
|
||||
|
||||
onDragEnter: {
|
||||
// slabel.text = "drop item here";
|
||||
dropHightlight.opacity = 1;
|
||||
}
|
||||
onDragLeave: {
|
||||
// slabel.text = "drop left";
|
||||
dropHightlight.opacity = 0;
|
||||
}
|
||||
onDrop: {
|
||||
var txt = event.mimeData.html;
|
||||
txt += event.mimeData.text;
|
||||
if (event.mimeData.url != "") {
|
||||
txt += "<br />Url: " + event.mimeData.url;
|
||||
}
|
||||
var i = 0;
|
||||
var u;
|
||||
for (u in event.mimeData.urls) {
|
||||
txt += "<br /> Url " + i + " : " + event.mimeData.urls[i];
|
||||
i++;
|
||||
}
|
||||
// print("COLOR: " + event.mimeData.color);
|
||||
if (event.mimeData.hasColor()) {
|
||||
clr.color = event.mimeData.color;
|
||||
} else {
|
||||
clr.color = "transparent";
|
||||
}
|
||||
slabel.text = txt
|
||||
dropHightlight.opacity = 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
144
src/shell/applets/testcomponentsapplet/contents/ui/IconsPage.qml
Normal file
144
src/shell/applets/testcomponentsapplet/contents/ui/IconsPage.qml
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
// IconTab
|
||||
|
||||
PlasmaComponents.Page {
|
||||
id: iconsPage
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: _s
|
||||
}
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
spacing: _s
|
||||
|
||||
PlasmaExtras.Title {
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
text: "Icons"
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
text: "iconSizes.small : " + theme.iconSizes.small +
|
||||
", iconSizes.desktop: " + theme.iconSizes.desktop +
|
||||
",<br />iconSizes.toolbar: " + theme.iconSizes.toolbar +
|
||||
", iconSizes.dialog : " + theme.iconSizes.dialog
|
||||
|
||||
}
|
||||
Flow {
|
||||
//height: _h
|
||||
width: parent.width
|
||||
spacing: _s
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
source: "configure"
|
||||
width: _h
|
||||
height: width
|
||||
}
|
||||
PlasmaCore.IconItem {
|
||||
source: "dialog-ok"
|
||||
width: _h
|
||||
height: width
|
||||
}
|
||||
PlasmaCore.IconItem {
|
||||
source: "resize-tr2bl"
|
||||
width: _h
|
||||
height: width
|
||||
}
|
||||
PlasmaCore.IconItem {
|
||||
source: "akonadi"
|
||||
width: _h
|
||||
height: width
|
||||
}
|
||||
PlasmaCore.IconItem {
|
||||
source: "clock"
|
||||
width: _h
|
||||
height: width
|
||||
}
|
||||
QtExtras.QIconItem {
|
||||
icon: "preferences-desktop-icons"
|
||||
width: _h
|
||||
height: width
|
||||
}
|
||||
|
||||
}
|
||||
PlasmaExtras.Heading {
|
||||
level: 2
|
||||
text: "ToolTip"
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: _s
|
||||
PlasmaCore.IconItem {
|
||||
id: akonadiIcon
|
||||
objectName: "akonadiIcon"
|
||||
source: "akonadi"
|
||||
width: height
|
||||
height: _h*2
|
||||
//anchors.horizontalCenter: parent.horizontalCenter
|
||||
Rectangle { color: "orange"; opacity: 0.3; anchors.fill: parent; }
|
||||
PlasmaCore.ToolTip {
|
||||
anchors.fill: parent
|
||||
target: akonadiIcon
|
||||
iconSource: "klipper"
|
||||
mainText: "Fish sighted in the wild, in the wild, a fish was seen."
|
||||
subText: "A mean-looking grouper swam by."
|
||||
}
|
||||
}
|
||||
Image {
|
||||
objectName: "bridgeimage"
|
||||
height: _h*2
|
||||
width: height
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: "../images/bridge.jpg"
|
||||
PlasmaCore.ToolTip {
|
||||
anchors.fill: parent
|
||||
image: parent.source
|
||||
mainText: "Bridge"
|
||||
subText: "Waalbrug."
|
||||
}
|
||||
}
|
||||
Image {
|
||||
objectName: "surfboardimage"
|
||||
height: _h*2
|
||||
width: height
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: "../images/surfboard.jpg"
|
||||
PlasmaCore.ToolTip {
|
||||
anchors.fill: parent
|
||||
image: parent.source
|
||||
mainComponent: Component {
|
||||
PlasmaComponents.Label {
|
||||
text: "Nijmegen North Beach"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
//subText: "A surfboard on the beach. <br />The photo shows the Waal river's north beach, \
|
||||
//across the water from Nijmegen, Netherlands. It was taken during the summer festivals a few years back."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.locale 2.0
|
||||
|
||||
|
||||
Item {
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
|
||||
Locale {
|
||||
id: locale
|
||||
}
|
||||
Column {
|
||||
PlasmaComponents.Label {
|
||||
text: "Locale Time Bindings"
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
text: locale.formatLocaleTime( "11:12:13", Locale.TimeWithoutAmPm|Locale.TimeWithoutSeconds )
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
text: locale.formatDateTime("2013-04-12", Locale.ShortDate ,Locale.Seconds )
|
||||
}
|
||||
}
|
||||
}
|
117
src/shell/applets/testcomponentsapplet/contents/ui/MousePage.qml
Normal file
117
src/shell/applets/testcomponentsapplet/contents/ui/MousePage.qml
Normal file
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
// MousePage
|
||||
|
||||
PlasmaComponents.Page {
|
||||
id: mousePage
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: _s
|
||||
}
|
||||
PlasmaExtras.Title {
|
||||
id: mellabel
|
||||
text: "MouseEventListener"
|
||||
anchors { left: parent.left; right: parent.right; top: parent.top }
|
||||
}
|
||||
QtExtras.MouseEventListener {
|
||||
id: mel
|
||||
hoverEnabled: true
|
||||
anchors { left: parent.left; right: parent.right; top: mellabel.bottom; bottom: parent.bottom; }
|
||||
/*
|
||||
void pressed(KDeclarativeMouseEvent *mouse);
|
||||
void positionChanged(KDeclarativeMouseEvent *mouse);
|
||||
void released(KDeclarativeMouseEvent *mouse);
|
||||
void clicked(KDeclarativeMouseEvent *mouse);
|
||||
void pressAndHold(KDeclarativeMouseEvent *mouse);
|
||||
void wheelMoved(KDeclarativeWheelEvent *wheel);
|
||||
void containsMouseChanged(bool containsMouseChanged);
|
||||
void hoverEnabledChanged(bool hoverEnabled);
|
||||
*/
|
||||
onPressed: {
|
||||
print("Pressed");
|
||||
melstatus.text = "pressed";
|
||||
}
|
||||
onPositionChanged: {
|
||||
print("positionChanged: " + mouse.x + "," + mouse.y);
|
||||
}
|
||||
onReleased: {
|
||||
print("Released");
|
||||
melstatus.text = "Released";
|
||||
}
|
||||
onPressAndHold: {
|
||||
print("pressAndHold");
|
||||
melstatus.text = "pressAndHold";
|
||||
}
|
||||
onClicked: {
|
||||
print("Clicked");
|
||||
melstatus.text = "clicked";
|
||||
}
|
||||
onWheelMoved: {
|
||||
print("Wheel: " + wheel.delta);
|
||||
}
|
||||
onContainsMouseChanged: {
|
||||
print("Contains mouse: " + containsMouse);
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
//target: mel
|
||||
anchors.fill: parent
|
||||
onPressed: PlasmaExtras.DisappearAnimation { targetItem: bgImage }
|
||||
onReleased: PlasmaExtras.AppearAnimation { targetItem: bgImage }
|
||||
}
|
||||
Image {
|
||||
id: bgImage
|
||||
source: "image://appbackgrounds/standard"
|
||||
fillMode: Image.Tile
|
||||
anchors.fill: parent
|
||||
asynchronous: true
|
||||
// opacity: mel.containsMouse ? 1 : 0.2
|
||||
// Behavior on opacity { PropertyAnimation {} }
|
||||
}
|
||||
Column {
|
||||
//width: parent.width
|
||||
spacing: _s
|
||||
anchors.fill: parent
|
||||
PlasmaComponents.Button {
|
||||
text: "Button"
|
||||
iconSource: "call-start"
|
||||
}
|
||||
PlasmaComponents.ToolButton {
|
||||
text: "ToolButton"
|
||||
iconSource: "call-stop"
|
||||
}
|
||||
PlasmaComponents.RadioButton {
|
||||
text: "RadioButton"
|
||||
//iconSource: "call-stop"
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
id: melstatus
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
// PlasmoidPage
|
||||
|
||||
PlasmaComponents.Page {
|
||||
id: plasmoidPage
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: _s
|
||||
}
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: _s
|
||||
PlasmaExtras.Heading {
|
||||
level: 2
|
||||
text: "I'm an applet"
|
||||
}
|
||||
|
||||
PlasmaComponents.ButtonColumn {
|
||||
PlasmaComponents.RadioButton {
|
||||
text: "No background"
|
||||
onClicked: {
|
||||
if (checked) plasmoid.backgroundHints = 0;
|
||||
}
|
||||
}
|
||||
PlasmaComponents.RadioButton {
|
||||
text: "Default background"
|
||||
checked: true
|
||||
onClicked: {
|
||||
if (checked) plasmoid.backgroundHints = 1;
|
||||
}
|
||||
}
|
||||
PlasmaComponents.RadioButton {
|
||||
text: "Translucent background"
|
||||
onClicked: {
|
||||
if (checked) plasmoid.backgroundHints = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Button {
|
||||
height: theme.iconSizes.desktop
|
||||
text: "Busy"
|
||||
checked: plasmoid.busy
|
||||
onClicked: {
|
||||
plasmoid.busy = !plasmoid.busy
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Button {
|
||||
id: ctxButton
|
||||
height: theme.iconSizes.desktop
|
||||
text: "Context Menu"
|
||||
Loader {
|
||||
id: menuLoader
|
||||
}
|
||||
onClicked: {
|
||||
if (menuLoader.source == "") {
|
||||
menuLoader.source = "TestMenu.qml"
|
||||
} else {
|
||||
//menuLoader.source = ""
|
||||
}
|
||||
menuLoader.item.open(0, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
// PlasmoidPage
|
||||
|
||||
PlasmaComponents.Menu {
|
||||
id: testMenu
|
||||
|
||||
PlasmaComponents.MenuItem {
|
||||
text: "Red Snapper"
|
||||
icon: "dragonplayer"
|
||||
onClicked: print(" Clicked on : " + text)
|
||||
}
|
||||
|
||||
PlasmaComponents.MenuItem {
|
||||
text: "Eel"
|
||||
icon: "kthesaurus"
|
||||
onClicked: print(" Clicked on : " + text)
|
||||
}
|
||||
|
||||
PlasmaComponents.MenuItem {
|
||||
text: "White Tip Reef Shark"
|
||||
icon: "kmag"
|
||||
onClicked: print(" Clicked on : " + text)
|
||||
}
|
||||
|
||||
Component.onCompleted:{
|
||||
print("TestMenu.qml served .. opening");
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 100
|
||||
height: 100
|
||||
clip: true
|
||||
property int minimumWidth: units.gridUnit * 20
|
||||
property int minimumHeight: units.gridUnit * 30
|
||||
|
||||
property int _s: theme.iconSizes.small
|
||||
property int _h: theme.iconSizes.desktop
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: dataSource
|
||||
|
||||
}
|
||||
|
||||
PlasmaComponents.TabBar {
|
||||
id: tabBar
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
}
|
||||
height: _h
|
||||
|
||||
PlasmaComponents.TabButton { tab: dragPage; iconSource: "preferences-desktop-mouse"}
|
||||
PlasmaComponents.TabButton { tab: iconsPage; iconSource: "preferences-desktop-icons"}
|
||||
PlasmaComponents.TabButton { tab: dialogsPage; iconSource: "preferences-system-windows"}
|
||||
PlasmaComponents.TabButton { tab: buttonsPage; iconSource: "preferences-desktop-theme"}
|
||||
PlasmaComponents.TabButton { tab: plasmoidPage; iconSource: "plasma"}
|
||||
PlasmaComponents.TabButton { tab: mousePage; iconSource: "preferences-desktop-mouse"}
|
||||
}
|
||||
|
||||
PlasmaComponents.TabGroup {
|
||||
id: tabGroup
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: tabBar.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
//currentTab: tabBar.currentTab
|
||||
|
||||
DragPage {
|
||||
id: dragPage
|
||||
}
|
||||
IconsPage {
|
||||
id: iconsPage
|
||||
}
|
||||
DialogsPage {
|
||||
id: dialogsPage
|
||||
}
|
||||
|
||||
ButtonsPage {
|
||||
id: buttonsPage
|
||||
}
|
||||
|
||||
|
||||
PlasmoidPage {
|
||||
id: plasmoidPage
|
||||
}
|
||||
|
||||
MousePage {
|
||||
id: mousePage
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
print("Components Test Applet loaded");
|
||||
//dataSource.engine = "org.kde.foobar"
|
||||
// tabGroup.currentTab = mousePage;
|
||||
}
|
||||
}
|
31
src/shell/applets/testcomponentsapplet/metadata.desktop
Normal file
31
src/shell/applets/testcomponentsapplet/metadata.desktop
Normal file
@ -0,0 +1,31 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Keywords=
|
||||
Name=Components Test
|
||||
Name[de]=Komponententest
|
||||
Name[es]=Prueba de componentes
|
||||
Name[fi]=Komponenttitesti
|
||||
Name[fr]=Test des composants
|
||||
Name[mr]=घटक चाचणी
|
||||
Name[nl]=Test van componenten
|
||||
Name[pl]=Próba składników
|
||||
Name[pt]=Teste de Componentes
|
||||
Name[pt_BR]=Teste de componentes
|
||||
Name[sk]=Test komponentov
|
||||
Name[sv]=Komponenttest
|
||||
Name[uk]=Тестування компонентів
|
||||
Name[x-test]=xxComponents Testxx
|
||||
Type=Service
|
||||
Icon=plasma
|
||||
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-KDE-ParentApp=
|
||||
X-KDE-PluginInfo-Author=Sebastian Kügler
|
||||
X-KDE-PluginInfo-Category=Development Tools
|
||||
X-KDE-PluginInfo-Email=sebas@kde.org
|
||||
X-KDE-PluginInfo-License=GPLv2+
|
||||
X-KDE-PluginInfo-Name=org.kde.testcomponentsapplet
|
||||
X-KDE-PluginInfo-Version=
|
||||
X-KDE-PluginInfo-Website=
|
||||
X-Plasma-MainScript=ui/testcomponents.qml
|
17
src/shell/applets/testshaderapplet/contents/config/main.xml
Normal file
17
src/shell/applets/testshaderapplet/contents/config/main.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||
<kcfgfile name=""/>
|
||||
|
||||
<group name="General">
|
||||
<entry name="Speed" type="int">
|
||||
<label>Speed of the leaves</label>
|
||||
<default>60</default>
|
||||
<min>20</min>
|
||||
<max>150</max>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
</kcfg>
|
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
ShaderExample {
|
||||
|
||||
pageName: "Colors"
|
||||
pageDescription: ""
|
||||
|
||||
ShaderEffect {
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 48
|
||||
opacity: 0.2
|
||||
|
||||
fragmentShader: {
|
||||
"uniform mat4 gl_ModelViewMatrix;" +
|
||||
"uniform mat4 gl_ProjectionMatrix;" +
|
||||
//"attribute vec4 gl_Vertex;" +
|
||||
"void main(void) {" +
|
||||
" gl_FragColor = vec4(1.0, 0.0, 0.0, 0.3); " +
|
||||
" gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex; " +
|
||||
"}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
121
src/shell/applets/testshaderapplet/contents/ui/ColorShower.qml
Normal file
121
src/shell/applets/testshaderapplet/contents/ui/ColorShower.qml
Normal file
@ -0,0 +1,121 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
|
||||
** of its contributors may be used to endorse or promote products derived
|
||||
** from this software without specific prior written permission.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
|
||||
ShaderExample {
|
||||
|
||||
pageName: "Particles"
|
||||
pageDescription: "Fun rainbow colors using a fragment shader"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
anchors.margins: -_s
|
||||
ParticleSystem {
|
||||
id: psItem
|
||||
//anchors.fill: parent
|
||||
x: parent.width / 2
|
||||
y: parent.height / 2
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
// clip: true
|
||||
anchors.topMargin: 48
|
||||
//anchors.leftMargin: 42
|
||||
|
||||
Emitter {
|
||||
emitRate: 400
|
||||
lifeSpan: 8000
|
||||
size: 24
|
||||
sizeVariation: 16
|
||||
velocity: PointDirection {x: psItem.width/20; y: psItem.height/20;}
|
||||
acceleration: PointDirection {x: -psItem.width/40; y: -psItem.height/40; xVariation: -psItem.width/20; yVariation: -psItem.width/20}
|
||||
}
|
||||
|
||||
CustomParticle {
|
||||
vertexShader:"
|
||||
uniform lowp float qt_Opacity;
|
||||
varying lowp float fFade;
|
||||
varying highp vec2 fPos;
|
||||
|
||||
void main() {
|
||||
qt_TexCoord0 = qt_ParticleTex;
|
||||
highp float size = qt_ParticleData.z;
|
||||
highp float endSize = qt_ParticleData.w;
|
||||
|
||||
highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y;
|
||||
|
||||
highp float currentSize = mix(size, endSize, t * t);
|
||||
|
||||
if (t < 0. || t > 1.)
|
||||
currentSize = 0.;
|
||||
|
||||
highp vec2 pos = qt_ParticlePos
|
||||
- currentSize / 2. + currentSize * qt_ParticleTex // adjust size
|
||||
+ qt_ParticleVec.xy * t * qt_ParticleData.y // apply velocity vector..
|
||||
+ 0.5 * qt_ParticleVec.zw * pow(t * qt_ParticleData.y, 2.);
|
||||
|
||||
gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1);
|
||||
|
||||
highp float fadeIn = min(t * 20., 1.);
|
||||
highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
|
||||
|
||||
fFade = fadeIn * fadeOut * qt_Opacity;
|
||||
fPos = vec2(pos.x/320., pos.y/480.);
|
||||
}
|
||||
"
|
||||
//! [0]
|
||||
fragmentShader: "
|
||||
varying highp vec2 fPos;
|
||||
varying lowp float fFade;
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
void main() {//*2 because this generates dark colors mostly
|
||||
highp vec2 circlePos = qt_TexCoord0*2.0 - vec2(1.0,1.0);
|
||||
highp float dist = length(circlePos);
|
||||
highp float circleFactor = max(min(1.0 - dist, 1.0), 0.0);
|
||||
gl_FragColor = vec4(fPos.x*2.0 - fPos.y, fPos.y*2.0 - fPos.x, fPos.x*fPos.y*2.0, 0.0) * circleFactor * fFade;
|
||||
}"
|
||||
//! [0]
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
157
src/shell/applets/testshaderapplet/contents/ui/EditorPage.qml
Normal file
157
src/shell/applets/testshaderapplet/contents/ui/EditorPage.qml
Normal file
@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
// ButtonsPage
|
||||
|
||||
PlasmaComponents.Page {
|
||||
id: editorPage
|
||||
|
||||
property string shader
|
||||
property alias shaderText: editor.text
|
||||
property string pageName: "Editor"
|
||||
property string icon: "accessories-text-editor"
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: _s
|
||||
}
|
||||
|
||||
Image {
|
||||
id: imageItem
|
||||
anchors.fill: parent
|
||||
//source: "../images/elarun-small.png"
|
||||
}
|
||||
|
||||
ShaderEffectSource {
|
||||
id: effectSource
|
||||
sourceItem: imageItem
|
||||
//hideSource: hideSourceCheckbox.checked
|
||||
hideSource: true
|
||||
}
|
||||
|
||||
ShaderEffect {
|
||||
id: mainShader
|
||||
anchors.fill: editorPage
|
||||
property variant source: effectSource
|
||||
property real f: 0
|
||||
property real f2: 0
|
||||
property int intensity: 1
|
||||
smooth: true
|
||||
}
|
||||
PlasmaComponents.ToolButton {
|
||||
iconSource: "dialog-close"
|
||||
width: _h
|
||||
height: width
|
||||
visible: !(mainShader.fragmentShader == "" && mainShader.vertexShader == "")
|
||||
anchors { top: parent.top; right: parent.right; }
|
||||
onClicked: {
|
||||
mainShader.fragmentShader = "";
|
||||
mainShader.vertexShader = "";
|
||||
editorPage.shader = ""
|
||||
vertexPage.shader = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PlasmaExtras.Heading {
|
||||
id: heading
|
||||
level: 1
|
||||
anchors {
|
||||
top: parent.top;
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
text: pageName
|
||||
}
|
||||
PlasmaComponents.ButtonColumn {
|
||||
anchors {
|
||||
right: parent.right
|
||||
top: heading.top
|
||||
}
|
||||
PlasmaComponents.RadioButton {
|
||||
id: fragmentRadio
|
||||
text: "Fragment / Pixel Shader"
|
||||
}
|
||||
PlasmaComponents.RadioButton {
|
||||
text: "Vertex Shader"
|
||||
}
|
||||
}
|
||||
|
||||
// PlasmaComponents.TextArea {
|
||||
// id: editor
|
||||
// anchors {
|
||||
// top: heading.bottom;
|
||||
// topMargin: _s
|
||||
// left: parent.left
|
||||
// right: parent.right
|
||||
// bottom: applyButton.top
|
||||
// bottomMargin: _s
|
||||
//
|
||||
// }
|
||||
// // text: { "void main(void) {\
|
||||
// // gl_FragColor = vec4(1.0, 0.0, 0.0, 0.3);\
|
||||
// // }"
|
||||
// // }
|
||||
// text:"
|
||||
// void main(void) {
|
||||
// gl_FragColor = vec4(0.2, 0.8, 0.6, 0.3);
|
||||
// }
|
||||
// "
|
||||
//
|
||||
// // width: parent.width
|
||||
// // parent.height-height: _h*2
|
||||
// }
|
||||
|
||||
PlasmaComponents.Button {
|
||||
id: applyButton
|
||||
text: "Upload Shader"
|
||||
onClicked: {
|
||||
shader = editor.text
|
||||
if (fragmentRadio.checked) {
|
||||
print("Uploading new fragment shader: \n" + shader);
|
||||
mainShader.fragmentShader = shader
|
||||
} else {
|
||||
print("Uploading new vertex shader: \n" + shader);
|
||||
mainShader.vertexShader = shader;
|
||||
}
|
||||
}
|
||||
|
||||
anchors {
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
// PlasmaComponents.CheckBox {
|
||||
// id: hideSourceCheckbox
|
||||
// text: "Hide Source Item"
|
||||
// anchors { bottom: parent.bottom; left: parent.left; margins: _s; }
|
||||
// onCheckedChanged: effectSource.hideSource = checked
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
// VertexPage
|
||||
|
||||
PlasmaComponents.Page {
|
||||
id: examplesPage
|
||||
|
||||
//property string shader
|
||||
property string pageName: "Shader Examples"
|
||||
property string pageDescription: "Shader Examples"
|
||||
property string icon: "weather-clear"
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: _s
|
||||
}
|
||||
|
||||
PlasmaExtras.Heading {
|
||||
id: heading
|
||||
level: 1
|
||||
anchors {
|
||||
top: parent.top;
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
text: pageName
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
anchors {
|
||||
top: heading.bottom;
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
}
|
||||
text: pageDescription
|
||||
}
|
||||
}
|
241
src/shell/applets/testshaderapplet/contents/ui/Shadows.qml
Normal file
241
src/shell/applets/testshaderapplet/contents/ui/Shadows.qml
Normal file
@ -0,0 +1,241 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
|
||||
** of its contributors may be used to endorse or promote products derived
|
||||
** from this software without specific prior written permission.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
//import QtQuick.Particles 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
|
||||
ShaderExample {
|
||||
|
||||
pageName: "Shadows"
|
||||
pageDescription: ""
|
||||
Grid {
|
||||
id: cfgrid
|
||||
columns: 2
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
width: parent.width * 0.6
|
||||
height: 96
|
||||
spacing: 6
|
||||
columnSpacing: 12
|
||||
PlasmaComponents.Label {
|
||||
text: "Distance:";
|
||||
width: parent.width * 0.5;
|
||||
horizontalAlignment: Text.AlignRight
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
PlasmaComponents.Slider {
|
||||
width: parent.width * 0.4
|
||||
id: distanceSlider
|
||||
stepSize: 1
|
||||
minimumValue: 0
|
||||
maximumValue: 25
|
||||
value: 8
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
text: "Opacity:";
|
||||
horizontalAlignment: Text.AlignRight
|
||||
elide: Text.ElideRight
|
||||
width: parent.width * 0.5;
|
||||
}
|
||||
PlasmaComponents.Slider {
|
||||
width: parent.width * 0.4
|
||||
id: opacitySlider
|
||||
// stepSize: 250
|
||||
minimumValue: 0
|
||||
maximumValue: 1.0
|
||||
stepSize: 0.05
|
||||
value: 0.4
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
anchors.margins: -_s
|
||||
|
||||
Item {
|
||||
id: theItem
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: _s * 2
|
||||
|
||||
Column {
|
||||
id: "txtCol"
|
||||
anchors.fill: parent
|
||||
anchors.margins: _s
|
||||
anchors.topMargin: _s * 2
|
||||
spacing: _s
|
||||
|
||||
PlasmaExtras.Heading {
|
||||
text: "Effects on Components"
|
||||
|
||||
}
|
||||
PlasmaExtras.Paragraph {
|
||||
text:"In Plasma 2, the user interface is based on an OpenGL scenegraph, composition of the UI happens on the graphics card. In the past weeks, we've been working on getting a Plasma 2 shell up and running, and on porting the QML imports of the Plasma Components."
|
||||
}
|
||||
|
||||
PlasmaExtras.Heading {
|
||||
font.pointSize: 48
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.topMargin: _s * 3
|
||||
text: "This is shadowy text."
|
||||
}
|
||||
Row {
|
||||
height: 48
|
||||
width: parent.width
|
||||
spacing: _s
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
source: "configure"
|
||||
width: parent.height
|
||||
height: width
|
||||
}
|
||||
PlasmaCore.IconItem {
|
||||
source: "dialog-ok"
|
||||
width: parent.height
|
||||
height: width
|
||||
}
|
||||
|
||||
PlasmaCore.SvgItem {
|
||||
id: buttonItem
|
||||
svg: PlasmaCore.Svg {
|
||||
id: configIconsSvg
|
||||
imagePath: "widgets/configuration-icons"
|
||||
}
|
||||
elementId: "maximize"
|
||||
width: parent.height
|
||||
height: width
|
||||
}
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
source: "akonadi"
|
||||
width: parent.height
|
||||
height: width
|
||||
}
|
||||
PlasmaCore.IconItem {
|
||||
source: "clock"
|
||||
width: parent.height
|
||||
height: width
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ShaderEffectSource {
|
||||
id: theSource
|
||||
sourceItem: theItem
|
||||
hideSource: true
|
||||
}
|
||||
|
||||
ShaderEffect {
|
||||
anchors.fill: theItem
|
||||
property variant source: theSource
|
||||
property variant shadow: ShaderEffectSource {
|
||||
sourceItem: ShaderEffect {
|
||||
width: theItem.width
|
||||
height: theItem.height
|
||||
property variant delta: Qt.size(0.0, 1.0 / height)
|
||||
property variant source: ShaderEffectSource {
|
||||
sourceItem: ShaderEffect {
|
||||
width: theItem.width
|
||||
height: theItem.height
|
||||
property variant delta: Qt.size(1.0 / width, 0.0)
|
||||
property variant source: theSource
|
||||
fragmentShader: "
|
||||
uniform lowp float qt_Opacity;
|
||||
uniform sampler2D source;
|
||||
uniform highp vec2 delta;
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
void main() {
|
||||
gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
|
||||
+ 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
|
||||
+ 0.2466 * texture2D(source, qt_TexCoord0)
|
||||
+ 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
|
||||
+ 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
|
||||
}"
|
||||
}
|
||||
}
|
||||
fragmentShader: "
|
||||
uniform lowp float qt_Opacity;
|
||||
uniform sampler2D source;
|
||||
uniform highp vec2 delta;
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
void main() {
|
||||
gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
|
||||
+ 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
|
||||
+ 0.2466 * texture2D(source, qt_TexCoord0)
|
||||
+ 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
|
||||
+ 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
|
||||
}"
|
||||
}
|
||||
}
|
||||
property real angle: 0
|
||||
property variant offset: Qt.point(distanceSlider.value * Math.cos(angle), distanceSlider.value * Math.sin(angle))
|
||||
NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 }
|
||||
property variant delta: Qt.size(offset.x / width, offset.y / height)
|
||||
property real darkness: opacitySlider.value // Changeme
|
||||
fragmentShader: "
|
||||
uniform lowp float qt_Opacity;
|
||||
uniform highp vec2 offset;
|
||||
uniform sampler2D source;
|
||||
uniform sampler2D shadow;
|
||||
uniform highp float darkness;
|
||||
uniform highp vec2 delta;
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
void main() {
|
||||
lowp vec4 fg = texture2D(source, qt_TexCoord0);
|
||||
lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta);
|
||||
gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity;
|
||||
}"
|
||||
// Slider {
|
||||
// id: shadowSlider
|
||||
// anchors.left: parent.left
|
||||
// anchors.right: parent.right
|
||||
// anchors.bottom: parent.bottom
|
||||
// height: 40
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
ShaderExample {
|
||||
|
||||
pageName: "Simple"
|
||||
pageDescription: "Paints a red, translucent rectangle"
|
||||
|
||||
ShaderEffect {
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 48
|
||||
opacity: 0.2
|
||||
|
||||
fragmentShader: { " \
|
||||
void main(void) { \
|
||||
gl_FragColor = vec4(1.0, 0.0, 0.0, 0.3); \
|
||||
} \
|
||||
"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
110
src/shell/applets/testshaderapplet/contents/ui/WaterEffect.qml
Normal file
110
src/shell/applets/testshaderapplet/contents/ui/WaterEffect.qml
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
// VertexPage
|
||||
|
||||
Item {
|
||||
id: waterRoot
|
||||
property alias sourceItem: effectsource.sourceItem
|
||||
property bool waving: true
|
||||
//anchors.top: parent.bottom
|
||||
anchors.top: iconCol.bottom
|
||||
width: sourceItem.width
|
||||
height: sourceItem.height
|
||||
|
||||
ShaderEffect {
|
||||
anchors.fill: parent
|
||||
property variant source: effectsource
|
||||
property real f: 0
|
||||
property real f2: 0
|
||||
property real intensity: 1
|
||||
smooth: true
|
||||
|
||||
ShaderEffectSource {
|
||||
id: effectsource
|
||||
//hideSource: false
|
||||
//smooth: true
|
||||
sourceItem: mainItem
|
||||
}
|
||||
|
||||
fragmentShader:
|
||||
"
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
uniform sampler2D source;
|
||||
uniform lowp float qt_Opacity;
|
||||
uniform highp float f;
|
||||
uniform highp float f2;
|
||||
uniform highp float intensity;
|
||||
|
||||
void main() {
|
||||
const highp float twopi = 3.141592653589 * 2.0;
|
||||
|
||||
highp float distanceFactorToPhase = pow(qt_TexCoord0.y + 0.5, 8.0) * 5.0;
|
||||
highp float ofx = sin(f * twopi + distanceFactorToPhase) / 100.0;
|
||||
highp float ofy = sin(f2 * twopi + distanceFactorToPhase * qt_TexCoord0.x) / 60.0;
|
||||
|
||||
highp float intensityDampingFactor = (qt_TexCoord0.x + 2.0) * (qt_TexCoord0.y + 0.2);
|
||||
highp float distanceFactor = (1.0 - qt_TexCoord0.y) * 4.0 * intensity * intensityDampingFactor;
|
||||
|
||||
ofx *= distanceFactor;
|
||||
ofy *= distanceFactor;
|
||||
|
||||
highp float x = qt_TexCoord0.x + ofx;
|
||||
highp float y = 1.0 - qt_TexCoord0.y + ofy;
|
||||
|
||||
highp float fake = (sin((ofy + ofx) * twopi) + 0.5) * 0.05 * (1.2 - qt_TexCoord0.y) * intensity * intensityDampingFactor;
|
||||
|
||||
highp vec4 pix =
|
||||
texture2D(source, vec2(x, y)) * 0.6 +
|
||||
texture2D(source, vec2(x-fake, y)) * 2.05 +
|
||||
texture2D(source, vec2(x, y-fake)) * 2.05 +
|
||||
texture2D(source, vec2(x+fake, y)) * 2.05 +
|
||||
texture2D(source, vec2(x, y+fake)) * 2.05;
|
||||
|
||||
highp float darken = 0.6 - (ofx - ofy) / 2.0;
|
||||
pix.b *= 1.2 * darken;
|
||||
pix.r *= 0.9 * darken;
|
||||
pix.g *= darken;
|
||||
|
||||
gl_FragColor = qt_Opacity * vec4(pix.r, pix.g, pix.b, 1.0);
|
||||
}
|
||||
"
|
||||
|
||||
NumberAnimation on f {
|
||||
running: waterRoot.waving
|
||||
loops: Animation.Infinite
|
||||
from: 0
|
||||
to: 1
|
||||
duration: 2410
|
||||
}
|
||||
NumberAnimation on f2 {
|
||||
running: waterRoot.waving
|
||||
loops: Animation.Infinite
|
||||
from: 0
|
||||
to: 1
|
||||
duration: 1754
|
||||
}
|
||||
}
|
||||
}
|
143
src/shell/applets/testshaderapplet/contents/ui/WobbleExample.qml
Normal file
143
src/shell/applets/testshaderapplet/contents/ui/WobbleExample.qml
Normal file
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
ShaderExample {
|
||||
|
||||
pageName: "Wobble"
|
||||
pageDescription: "Makes an image wobble"
|
||||
|
||||
Grid {
|
||||
id: cfgrid
|
||||
columns: 2
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
width: parent.width * 0.6
|
||||
height: 96
|
||||
spacing: 6
|
||||
columnSpacing: _m
|
||||
PlasmaComponents.Label {
|
||||
text: "Amplitude:";
|
||||
width: parent.width * 0.5;
|
||||
horizontalAlignment: Text.AlignRight
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
PlasmaComponents.Slider {
|
||||
width: parent.width * 0.4
|
||||
id: amplitudeSlider
|
||||
stepSize: 0.05
|
||||
minimumValue: 0
|
||||
maximumValue: 1.0
|
||||
value: 0.4
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
text: "Speed:";
|
||||
horizontalAlignment: Text.AlignRight
|
||||
width: parent.width * 0.5;
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
PlasmaComponents.Slider {
|
||||
width: parent.width * 0.4
|
||||
id: speedSlider
|
||||
stepSize: 250
|
||||
minimumValue: 0
|
||||
maximumValue: 6000
|
||||
value: 3000
|
||||
onValueChanged: {
|
||||
if (timeAnimation != null) {
|
||||
timeAnimation.duration = maximumValue - value +1;
|
||||
timeAnimation.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
anchors { right: parent.right; bottom: parent.bottom; }
|
||||
// height: theme.iconSizes.toolbar
|
||||
text: "Busy"
|
||||
checked: plasmoid.busy
|
||||
onClicked: {
|
||||
plasmoid.busy = !plasmoid.busy
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Item {
|
||||
id: imageItem
|
||||
opacity: 0.8
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 48
|
||||
Image {
|
||||
source: "../images/elarun-small.png"
|
||||
anchors.fill: parent
|
||||
anchors.margins: parent.height / 10
|
||||
}
|
||||
}
|
||||
|
||||
// PlasmaCore.IconItem {
|
||||
// id: iconItem
|
||||
// source: "plasmagik"
|
||||
// width: 400
|
||||
// height: 400
|
||||
// // width: parent.height
|
||||
// // height: width
|
||||
// anchors.centerIn: parent
|
||||
// }
|
||||
|
||||
ShaderEffect {
|
||||
id: wobbleShader
|
||||
|
||||
anchors.fill: imageItem
|
||||
//property real time
|
||||
property variant mouse
|
||||
property variant resolution
|
||||
|
||||
property int fadeDuration: 250
|
||||
property real amplitude: 0.04 * amplitudeSlider.value
|
||||
property real frequency: 20
|
||||
property real time: 10
|
||||
property int speed: (speedSlider.maximumValue - speedSlider.value + 1)
|
||||
|
||||
property variant source: ShaderEffectSource {
|
||||
sourceItem: imageItem
|
||||
hideSource: true
|
||||
}
|
||||
|
||||
NumberAnimation on time { id: timeAnimation; loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 3000 }
|
||||
Behavior on amplitude { NumberAnimation { duration: wobbleShader.fadeDuration } }
|
||||
|
||||
fragmentShader: { //mainItem.opacity = 0;
|
||||
"uniform lowp float qt_Opacity;" +
|
||||
"uniform highp float amplitude;" +
|
||||
"uniform highp float frequency;" +
|
||||
"uniform highp float time;" +
|
||||
"uniform sampler2D source;" +
|
||||
"varying highp vec2 qt_TexCoord0;" +
|
||||
"void main() {" +
|
||||
" highp vec2 p = sin(time + frequency * qt_TexCoord0);" +
|
||||
" gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" +
|
||||
"}"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
30
src/shell/applets/testshaderapplet/contents/ui/config.qml
Normal file
30
src/shell/applets/testshaderapplet/contents/ui/config.qml
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
// import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
// import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
|
||||
Column {
|
||||
id: root
|
||||
//property alias cfg_Speed
|
||||
Rectangle { color: "green"; width: 200; height: 300; }
|
||||
// PlasmaExtras.Heading {
|
||||
// text: "Applet Config:"
|
||||
// }
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.qtextracomponents 2.0 as QtExtras
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 400
|
||||
height: 400
|
||||
|
||||
property int minimumWidth: units.gridUnit * 20
|
||||
property int minimumHeight: units.gridUnit * 30
|
||||
property int _s: theme.iconSizes.small
|
||||
property int _h: theme.iconSizes.desktop
|
||||
property int _m: 12
|
||||
|
||||
Item {
|
||||
id: mainItem
|
||||
anchors.fill: parent
|
||||
|
||||
PlasmaComponents.TabBar {
|
||||
id: tabBar
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
}
|
||||
height: theme.iconSizes.toolbar * 1.5
|
||||
|
||||
PlasmaComponents.TabButton { tab: colorShower; text: tab.pageName; }
|
||||
PlasmaComponents.TabButton { tab: wobbleExample; text: tab.pageName; }
|
||||
PlasmaComponents.TabButton { tab: shadowExample; text: tab.pageName; }
|
||||
PlasmaComponents.TabButton { tab: simpleExample; text: tab.pageName; }
|
||||
//PlasmaComponents.TabButton { tab: vertexPage; iconSource: vertexPage.icon; }
|
||||
}
|
||||
|
||||
PlasmaComponents.TabGroup {
|
||||
id: tabGroup
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: tabBar.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
ColorShower {
|
||||
id: colorShower
|
||||
}
|
||||
WobbleExample {
|
||||
id: wobbleExample
|
||||
}
|
||||
// ColorExample {
|
||||
// id: colorExample
|
||||
// }
|
||||
Shadows {
|
||||
id: shadowExample
|
||||
}
|
||||
SimpleExample {
|
||||
id: simpleExample
|
||||
}
|
||||
// EditorPage {
|
||||
// id: vertexPage
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
print("Shader Test Applet loaded");
|
||||
}
|
||||
}
|
39
src/shell/applets/testshaderapplet/metadata.desktop
Normal file
39
src/shell/applets/testshaderapplet/metadata.desktop
Normal file
@ -0,0 +1,39 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Keywords=
|
||||
Name=Shader Test
|
||||
Name[fr]=Test du nuanceur
|
||||
Name[mr]=शेडर चाचणी
|
||||
Name[nl]=Test van schaduw
|
||||
Name[pl]=Próba jednostki cieniującej
|
||||
Name[pt]=Teste de Sombras
|
||||
Name[pt_BR]=Teste de sombra
|
||||
Name[sk]=Test Shadera
|
||||
Name[sv]=Skuggningstest
|
||||
Name[uk]=Тестування підпрограм побудови тіней
|
||||
Name[x-test]=xxShader Testxx
|
||||
Comment=Futzing with Visual Effects
|
||||
Comment[fr]=Jouer avec les effets visuels
|
||||
Comment[mr]=दृश्यास्पद परिणाम बरोबर फट्झिंग
|
||||
Comment[nl]=Tijd verspillen met visuele effecten
|
||||
Comment[pl]=Futzing z efektami wizualnymi
|
||||
Comment[pt]=Brincar com Efeitos Visuais
|
||||
Comment[pt_BR]=Brinque com efeitos visuais
|
||||
Comment[sk]=Futzing s vizuálnymi efektami
|
||||
Comment[sv]=Greja med visuella effekter
|
||||
Comment[uk]=Маніпулювання візуальними ефектами
|
||||
Comment[x-test]=xxFutzing with Visual Effectsxx
|
||||
Type=Service
|
||||
Icon=plasma
|
||||
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-KDE-ParentApp=
|
||||
X-KDE-PluginInfo-Author=Sebastian Kügler
|
||||
X-KDE-PluginInfo-Category=Graphics
|
||||
X-KDE-PluginInfo-Email=sebas@kde.org
|
||||
X-KDE-PluginInfo-License=GPLv2+
|
||||
X-KDE-PluginInfo-Name=org.kde.testshaderapplet
|
||||
X-KDE-PluginInfo-Version=
|
||||
X-KDE-PluginInfo-Website=
|
||||
X-Plasma-MainScript=ui/testshaderapplet.qml
|
@ -2,7 +2,7 @@
|
||||
var panel = new Panel
|
||||
panel.screen = 0
|
||||
panel.location = 'top'
|
||||
panel.addWidget("org.kde.kickoff")
|
||||
panel.addWidget("org.kde.testapplet")
|
||||
panel.addWidget("org.kde.windowlist")
|
||||
|
||||
for (var i = 0; i < screenCount; ++i) {
|
||||
@ -11,5 +11,6 @@ for (var i = 0; i < screenCount; ++i) {
|
||||
desktop.screen = i
|
||||
desktop.wallpaperPlugin = 'org.kde.image'
|
||||
|
||||
var clock = desktop.addWidget("org.kde.analogclock")
|
||||
desktop.addWidget("org.kde.testapplet")
|
||||
var testComponents = desktop.addWidget("org.kde.testcomponentsapplet")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user