diff --git a/declarativeimports/plasmaextracomponents/CMakeLists.txt b/declarativeimports/plasmaextracomponents/CMakeLists.txt index 1650172a7..cfb622a46 100644 --- a/declarativeimports/plasmaextracomponents/CMakeLists.txt +++ b/declarativeimports/plasmaextracomponents/CMakeLists.txt @@ -40,5 +40,7 @@ install(FILES qml/Heading.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/ install(FILES qml/Paragraph.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/extras) install(FILES qml/Title.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/extras) +install(DIRECTORY qml/animations/ DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/extras) + #install platform overrides -- enable as we use this feature for plasmaextras #install(DIRECTORY platformcomponents/touch/ DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/extras) diff --git a/declarativeimports/plasmaextracomponents/appbackgroundprovider.cpp b/declarativeimports/plasmaextracomponents/appbackgroundprovider.cpp index edf8e1d28..45c844888 100644 --- a/declarativeimports/plasmaextracomponents/appbackgroundprovider.cpp +++ b/declarativeimports/plasmaextracomponents/appbackgroundprovider.cpp @@ -34,6 +34,8 @@ AppBackgroundProvider::AppBackgroundProvider() QImage AppBackgroundProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) { + Q_UNUSED(size) + Q_UNUSED(requestedSize) QString search = QLatin1Literal("desktoptheme/") % Plasma::Theme::defaultTheme()->themeName() % QLatin1Literal("/appbackgrounds/") % id % ".png"; search = KStandardDirs::locate("data", search); return QImage(search); diff --git a/declarativeimports/plasmaextracomponents/qml/animations/ActivateAnimation.qml b/declarativeimports/plasmaextracomponents/qml/animations/ActivateAnimation.qml new file mode 100644 index 000000000..fb2433ce7 --- /dev/null +++ b/declarativeimports/plasmaextracomponents/qml/animations/ActivateAnimation.qml @@ -0,0 +1,38 @@ +// -*- coding: iso-8859-1 -*- +/* + * Copyright 2011 Sebastian Kügler + * + * 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 1.0 +import "Animations.js" as Animations + +SequentialAnimation { + id: activateAnimation + objectName: "activateAnimation" + + property Item targetItem + property int duration: Animations.normalDuration/5 + + // Fast scaling while we're animation == more FPS + ScriptAction { script: targetItem.smooth = false } + + PressedAnimation { targetItem: activateAnimation.targetItem } + ReleasedAnimation { targetItem: activateAnimation.targetItem } + + ScriptAction { script: targetItem.smooth = true } +} diff --git a/declarativeimports/plasmaextracomponents/qml/animations/Animations.js b/declarativeimports/plasmaextracomponents/qml/animations/Animations.js new file mode 100644 index 000000000..96db3c14a --- /dev/null +++ b/declarativeimports/plasmaextracomponents/qml/animations/Animations.js @@ -0,0 +1,8 @@ + +.pragma library + +// a normal animation +var normalDuration = 250; + +// for direct feedback, such as tapping +var feedbackDuration = 50; \ No newline at end of file diff --git a/declarativeimports/plasmaextracomponents/qml/animations/AppearAnimation.qml b/declarativeimports/plasmaextracomponents/qml/animations/AppearAnimation.qml new file mode 100644 index 000000000..6caffb3ef --- /dev/null +++ b/declarativeimports/plasmaextracomponents/qml/animations/AppearAnimation.qml @@ -0,0 +1,52 @@ +// -*- coding: iso-8859-1 -*- +/* + * Copyright 2011 Sebastian Kügler + * + * 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 1.0 +import "Animations.js" as Animations + +SequentialAnimation { + id: appearAnimation + objectName: "appearAnimation" + + property Item targetItem + property int duration: Animations.normalDuration + + // Fast scaling while we're animation == more FPS + ScriptAction { script: { targetItem.smooth = false; targetItem.visible = true; } } + + ParallelAnimation { + PropertyAnimation { + target: targetItem + properties: "opacity" + from: 0; to: 1.0 + duration: appearAnimation.duration; + easing.type: Easing.InExpo; + } + PropertyAnimation { + target: targetItem + properties: "scale" + from: 0.8; to: 1.0 + duration: appearAnimation.duration; + easing.type: Easing.InExpo; + } + } + + ScriptAction { script: targetItem.smooth = true } +} diff --git a/declarativeimports/plasmaextracomponents/qml/animations/DisappearAnimation.qml b/declarativeimports/plasmaextracomponents/qml/animations/DisappearAnimation.qml new file mode 100644 index 000000000..1448161e5 --- /dev/null +++ b/declarativeimports/plasmaextracomponents/qml/animations/DisappearAnimation.qml @@ -0,0 +1,53 @@ +// -*- coding: iso-8859-1 -*- +/* + * Copyright 2011 Sebastian Kügler + * + * 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 1.0 +import "Animations.js" as Animations + +SequentialAnimation { + id: disappearAnimation + objectName: "disappearAnimation" + + property Item targetItem + property int duration: Animations.normalDuration + + ScriptAction { script: targetItem.smooth = false; } + + ParallelAnimation { + PropertyAnimation { + properties: "opacity" + duration: disappearAnimation.duration + target: disappearAnimation.targetItem + easing.type: Easing.OutExpo; + } + PropertyAnimation { + properties: "scale" + target: disappearAnimation.targetItem + duration: disappearAnimation.duration * 0.6 + easing.type: Easing.OutExpo; + } + } + ScriptAction { + script: { + targetItem.smooth = true; + targetItem.visible = false; + } + } +} diff --git a/declarativeimports/plasmaextracomponents/qml/animations/PressedAnimation.qml b/declarativeimports/plasmaextracomponents/qml/animations/PressedAnimation.qml new file mode 100644 index 000000000..0fdcbf05f --- /dev/null +++ b/declarativeimports/plasmaextracomponents/qml/animations/PressedAnimation.qml @@ -0,0 +1,51 @@ +// -*- coding: iso-8859-1 -*- +/* + * Copyright 2011 Sebastian Kügler + * + * 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 1.0 +import "Animations.js" as Animations + +SequentialAnimation { + id: pressedAnimation + objectName: "pressedAnimation" + + property Item targetItem + property int duration: Animations.feedbackDuration + + // Fast scaling while we're animation == more FPS + ScriptAction { script: targetItem.smooth = false } + + ParallelAnimation { + PropertyAnimation { + target: targetItem + properties: "opacity" + from: 1.0; to: 0.8 + duration: pressedAnimation.duration; + easing.type: Easing.OutExpo; + } + PropertyAnimation { + target: targetItem + properties: "scale" + from: 1.0; to: 0.95 + duration: pressedAnimation.duration; + easing.type: Easing.OutExpo; + } + } + ScriptAction { script: targetItem.smooth = true } +} diff --git a/declarativeimports/plasmaextracomponents/qml/animations/ReleasedAnimation.qml b/declarativeimports/plasmaextracomponents/qml/animations/ReleasedAnimation.qml new file mode 100644 index 000000000..a74b4699b --- /dev/null +++ b/declarativeimports/plasmaextracomponents/qml/animations/ReleasedAnimation.qml @@ -0,0 +1,52 @@ +// -*- coding: iso-8859-1 -*- +/* + * Copyright 2011 Sebastian Kügler + * + * 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 1.0 +import "Animations.js" as Animations + +SequentialAnimation { + id: releasedAnimation + objectName: "releasedAnimation" + + property Item targetItem + property int duration: Animations.feedbackDuration + + // Fast scaling while we're animation == more FPS + ScriptAction { script: targetItem.smooth = false } + + ParallelAnimation { + PropertyAnimation { + target: targetItem + properties: "opacity" + from: 0.8; to: 1.0 + duration: releasedAnimation.duration; + easing.type: Easing.InExpo; + } + PropertyAnimation { + target: targetItem + properties: "scale" + from: 0.95; to: 1.0 + duration: releasedAnimation.duration; + easing.type: Easing.InExpo; + } + } + + ScriptAction { script: targetItem.smooth = true } +} diff --git a/declarativeimports/plasmaextracomponents/qml/qmldir b/declarativeimports/plasmaextracomponents/qml/qmldir index 1eeb9dc04..040fc13c3 100644 --- a/declarativeimports/plasmaextracomponents/qml/qmldir +++ b/declarativeimports/plasmaextracomponents/qml/qmldir @@ -4,3 +4,9 @@ App 0.1 App.qml Heading 0.1 Heading.qml Paragraph 0.1 Paragraph.qml Title 0.1 Title.qml + +ActivateAnimation 0.1 ActivateAnimation.qml +AppearAnimation 0.1 AppearAnimation.qml +DisappearAnimation 0.1 DisappearAnimation.qml +PressedAnimation 0.1 PressedAnimation.qml +ReleasedAnimation 0.1 ReleasedAnimation.qml