Commit 44c87926 authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

Glacier homescreen 0.0.1

parents
TEMPLATE = subdirs
SUBDIRS += \
src
#
# Do NOT Edit the Auto-generated Part!
# Generated by: spectacle version 0.27
#
Name: lipstick-glacier-home-qt5
# >> macros
# << macros
Summary: A nice homescreen for Glacier experience
Version: 0.0.0
Release: 1
Group: System/GUI/Other
License: BSD
URL: https://github.com/locusf/glacier-home
Source0: %{name}-%{version}.tar.bz2
Source1: lipstick.desktop
Source2: lipstick.service
Source100: lipstick-glacier-home-qt5.yaml
Requires: lipstick-qt5 >= 0.17.0
Requires: nemo-qml-plugin-configuration-qt5
Requires: nemo-qml-plugin-time-qt5
Requires: qt-components-qt5 >= 2.0.2
Requires: qt5-qtdeclarative-import-window2
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: pkgconfig(lipstick-qt5) >= 0.12.0
Conflicts: lipstick-example-home
%description
A homescreen for Nemo Mobile
%prep
%setup -q -n %{name}-%{version}
# >> setup
# << setup
%build
# >> build pre
# << build pre
%qmake5
make %{?_smp_mflags}
# >> build post
# << build post
%install
rm -rf %{buildroot}
# >> install pre
# << install pre
%qmake5_install
mkdir -p %{buildroot}%{_libdir}/systemd/user/
cp -a %{SOURCE2} %{buildroot}%{_libdir}/systemd/user/
# >> install post
# << install post
%files
%defattr(-,root,root,-)
%{_bindir}/lipstick
%{_libdir}/systemd/user/lipstick.service
%config /etc/xdg/autostart/*.desktop
%{_datadir}/lipstick/lipstick.conf
%{_libdir}/systemd/user/user-session.target.wants/lipstick.service
# >> files
# << files
Name: lipstick-glacier-home-qt5
Summary: A nice homescreen for Glacier experience
Version: 0.0.0
Release: 1
Group: System/GUI/Other
License: BSD
URL: https://github.com/locusf/glacier-home
Sources:
- "%{name}-%{version}.tar.bz2"
- lipstick.desktop
Description: A homescreen for Nemo Mobile
Builder: qmake5
Requires:
- lipstick-qt5 >= 0.17.0
- nemo-qml-plugin-configuration-qt5
- nemo-qml-plugin-time-qt5
- qt-components-qt5 >= 2.0.2
- qt5-qtdeclarative-import-window2 # TODO: components dep?
PkgConfigBR:
- Qt5Core
- Qt5Quick
- lipstick-qt5 >= 0.12.0
ExtraSources:
- lipstick.service;%{_libdir}/systemd/user/
Conflicts:
- lipstick-example-home
Files:
- "%{_bindir}/lipstick"
- "%{_libdir}/systemd/user/lipstick.service"
- "%config /etc/xdg/autostart/*.desktop"
- "%{_datadir}/lipstick/lipstick.conf"
- "%{_libdir}/systemd/user/user-session.target.wants/lipstick.service"
[Desktop Entry]
Exec=/usr/bin/lipstick
X-Moblin-Priority=High
OnlyShowIn=X-MEEGO-HS;
X-Meego-Watchdog=Restart
[Unit]
Description=The lipstick UI
Requires=dbus.socket pre-user-session.target
After=pre-user-session.target
[Service]
Type=notify
EnvironmentFile=-/var/lib/environment/compositor/*.conf
ExecStart=/usr/bin/lipstick $LIPSTICK_OPTIONS --systemd
Restart=always
[Install]
WantedBy=user-session.target
// This file is part of colorful-home, a nice user experience for touchscreens.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// Copyright (c) 2012, Timur Kristóf <venemo@fedoraproject.org>
#include <homeapplication.h>
#include <QFont>
#include <homewindow.h>
int main(int argc, char **argv)
{
HomeApplication app(argc, argv, QString());
QGuiApplication::setFont(QFont("Open Sans"));
setenv("EGL_PLATFORM", "wayland", 1);
setenv("QT_QPA_PLATFORM", "wayland", 1);
setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1);
app.setCompositorPath("qrc:/qml/compositor.qml");
app.setQmlPath("qrc:/qml/MainScreen.qml");
app.mainWindowInstance()->showFullScreen();
return app.exec();
}
/****************************************************************************************
**
** Copyright (C) 2014 Aleksi Suomalainen <suomalainen.aleksi@gmail.com>
** All rights reserved.
**
** You may use this file under the terms of 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 the author 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 HOLDERS 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.
**
****************************************************************************************/
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Window 2.1
ApplicationWindow {
id: appWindow
contentOrientation: Screen.orientation
// Implements back key navigation
Keys.onReleased: {
if (event.key === Qt.Key_Back) {
if (pageStack.depth > 1) {
pageStack.pop();
event.accepted = true;
} else { Qt.quit(); }
}
}
ListModel {
id: pageModel
ListElement {
title: "Live-Coding Arena"
page: "content/LiveCoding.qml"
}
}
initialPage: Page {
id: pageItem
tools: ToolBarLayoutExample { title: "Glacier UI" }
ListView {
model: pageModel
anchors.fill: parent
clip: true
delegate: AndroidDelegate {
text: title
onClicked: pageItem.Stack.view.push(Qt.resolvedUrl(page))
}
}
}
}
// Copyright (C) 2013 Jolla Ltd.
// Copyright (C) 2013 John Brooks <john.brooks@dereferenced.net>
//
// This file is part of colorful-home, a nice user experience for touchscreens.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import QtQuick 2.0
import org.nemomobile.lipstick 0.1
import "compositor"
Compositor {
id: root
property Item homeWindow
// Set to the item of the current topmost window
property Item topmostWindow
// True if the home window is the topmost window
homeActive: topmostWindow == root.homeWindow
property bool appActive: !homeActive
// The application window that was most recently topmost
property Item topmostApplicationWindow
function windowToFront(winId) {
var o = root.windowForId(winId)
var window = null
if (o) window = o.userData
if (window == null) window = homeWindow
setCurrentWindow(window)
}
function setCurrentWindow(w, skipAnimation) {
if (w == null)
w = homeWindow
topmostWindow = w;
if (topmostWindow == homeWindow || topmostWindow == null) {
clearKeyboardFocus()
} else {
if (topmostApplicationWindow) topmostApplicationWindow.visible = false
topmostApplicationWindow = topmostWindow
topmostApplicationWindow.visible = true
if (!skipAnimation) topmostApplicationWindow.animateIn()
w.window.takeFocus()
}
}
Connections {
target: root
onActiveFocusItemChanged: {
// Search for the layer of the focus item
var focusedLayer = root.activeFocusItem
while (focusedLayer && focusedLayer.parent !== layersParent)
focusedLayer = focusedLayer.parent
// reparent the overlay to the found layer
overlayLayer.parent = focusedLayer ? focusedLayer : overlayLayer.parent
}
}
Rectangle {
id: layersParent
anchors.fill: parent
color: "black"
Item {
id: homeLayer
z: root.homeActive ? 4 : 1
anchors.fill: parent
}
Item {
id: appLayer
z: 2
width: parent.width
height: parent.height
visible: root.appActive
}
Item {
id: overlayLayer
z: 5
visible: root.appActive
}
Item {
id: notificationLayer
z: 6
}
}
ScreenGestureArea {
id: gestureArea
z: 2
anchors.fill: parent
enabled: root.appActive
property real swipeThreshold: 0.15
onGestureStarted: {
swipeAnimation.stop()
cancelAnimation.stop()
state = "swipe"
}
onGestureFinished: {
if (gestureArea.progress >= swipeThreshold) {
swipeAnimation.valueTo = inverted ? -max : max
swipeAnimation.start()
} else {
cancelAnimation.start()
}
}
states: [
State {
name: "swipe"
PropertyChanges {
target: gestureArea
delayReset: true
}
PropertyChanges {
target: appLayer
x: gestureArea.horizontal ? gestureArea.value : 0
y: gestureArea.horizontal ? 0 : gestureArea.value
}
PropertyChanges {
target: homeLayer
opacity: 0.6 + 0.4 * gestureArea.progress
scale: 0.8 + 0.2 * gestureArea.progress
}
}
]
SequentialAnimation {
id: cancelAnimation
NumberAnimation {
target: gestureArea
property: "value"
to: 0
duration: 200
easing.type: Easing.OutQuint
}
PropertyAction {
target: gestureArea
property: "state"
value: ""
}
}
SequentialAnimation {
id: swipeAnimation
property alias valueTo: valueAnimation.to
NumberAnimation {
id: valueAnimation
target: gestureArea
property: "value"
duration: 200
easing.type: Easing.OutQuint
}
ScriptAction {
script: setCurrentWindow(root.homeWindow)
}
PropertyAction {
target: gestureArea
property: "state"
value: ""
}
}
}
Component {
id: windowWrapper
WindowWrapperBase { }
}
Component {
id: alphaWrapper
WindowWrapperAlpha { }
}
onWindowAdded: {
if (debug) console.log("Compositor: Window added \"" + window.title + "\"")
var isHomeWindow = window.isInProcess && root.homeWindow == null && window.title == "Home"
var isNotificationWindow = window.category == "notification"
var isOverlayWindow = window.category == "overlay"
var parent = null
if (isHomeWindow) {
parent = homeLayer
} else if (isNotificationWindow) {
parent = notificationLayer
} else if (isOverlayWindow){
parent = overlayLayer
} else {
parent = appLayer
}
var w;
if (isOverlayWindow) w = alphaWrapper.createObject(parent, { window: window })
else w = windowWrapper.createObject(parent, { window: window })
window.userData = w
if (isHomeWindow) {
root.homeWindow = w
setCurrentWindow(homeWindow)
} else if (isNotificationWindow || isOverlayWindow) {
} else {
setCurrentWindow(w)
}
}
onWindowRemoved: {
if (debug) console.log("Compositor: Window removed \"" + window.title + "\"")
var w = window.userData;
if (root.topmostWindow == w)
setCurrentWindow(root.homeWindow);
if (window.userData)
window.userData.destroy()
}
}
// Copyright (C) 2013 John Brooks <john.brooks@dereferenced.net>
//
// This file is part of colorful-home, a nice user experience for touchscreens.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import QtQuick 2.0
MouseArea {
id: root
property int boundary: 20
property bool delayReset
signal gestureStarted(string gesture)
signal gestureFinished(string gesture)
// Current gesture
property bool active: gesture != ""
property string gesture
property int value
property int max
property real progress: Math.abs(value) / max
property bool horizontal: gesture === "left" || gesture === "right"
property bool inverted: gesture === "left" || gesture === "up"
// Internal
property int _mouseStart
onPressed: {
if (mouse.x < boundary) {
gesture = "right"
max = width - mouse.x
} else if (width - mouse.x < boundary) {
gesture = "left"
max = mouse.x
} else if (mouse.y < boundary) {
gesture = "down"
max = height - mouse.y
} else if (height - mouse.y < boundary) {
gesture = "up"
max = mouse.y
} else {
mouse.accepted = false
return
}
value = 0
if (horizontal)
_mouseStart = mouse.x
else
_mouseStart = mouse.y
gestureStarted(gesture)
}
onPositionChanged: {
var p = horizontal ? mouse.x : mouse.y
value = Math.max(Math.min(p - _mouseStart, max), -max)
}
function reset() {
gesture = ""
value = max = 0
_mouseStart = 0
}
onDelayResetChanged: {
if (!delayReset)
reset()
}
onReleased: {
gestureFinished(gesture)
if (!delayReset)
reset()
}
}
// Copyright (C) 2013 Jolla Ltd.
//
// This file is part of colorful-home, a nice user experience for touchscreens.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import QtQuick 2.0
WindowWrapperBase {
id: wrapper
ShaderEffect {
anchors.fill: parent
z: 2
// source Item must be a texture provider
property Item source: wrapper.window
fragmentShader: "
uniform sampler2D source;
uniform mediump float qt_Opacity;
varying highp vec2 qt_TexCoord0;
void main() {
gl_FragColor = qt_Opacity * texture2D(source, qt_TexCoord0);
}"
}
onWindowChanged: {
if (window != null) {
// do not paint the QWaylandSurfaceItem, just use it as
// a texture provider
window.setPaintEnabled(false)
}
}
}
// Copyright (C) 2013 Jolla Ltd.
//
// This file is part of colorful-home, a nice user experience for touchscreens.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import QtQuick 2.0
Item {
id: wrapper
property Item window
width: window.width
height: window.height
NumberAnimation on opacity { id: fadeInAnimation; running: false; from: 0; to: 1 }
function animateIn() { fadeInAnimation.start(); }
Component.onCompleted: window.parent = wrapper
}
<RCC>
<qresource prefix="/">
<file>qml/MainScreen.qml</file>
<file>qml/compositor/ScreenGestureArea.qml</file>
<file>qml/compositor/WindowWrapperAlpha.qml</file>
<file>qml/compositor/WindowWrapperBase.qml</file>
</qresource>
</RCC>
# Main project file for Glacier home
TEMPLATE = app
TARGET = lipstick
VERSION = 0.1
INSTALLS = target
target.path = /usr/bin
CONFIG += qt link_pkgconfig
QT += quick
HEADERS +=
SOURCES += \
main.cpp \
main.cpp
RESOURCES += \
resources-qml.qrc \
resources-images.qrc \
resources-qml.qrc
PKGCONFIG += lipstick-qt5
OTHER_FILES += qml/*.qml \
qml/MainScreen.qml \
qml/compositor.qml
config.files = lipstick.conf
config.path = /usr/share/lipstick
INSTALLS += config
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment