Skip to content

Commit

Permalink
initial add of example desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
rburchell committed Aug 21, 2012
0 parents commit 4adf05a
Show file tree
Hide file tree
Showing 9 changed files with 439 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README
@@ -0,0 +1,8 @@
what is this?
=============

this is a simple example QML application using 'lipstick' to create
a mobile-oriented homescreen.

to build, make sure you've built and installed 'lipstick' correctly,
then just qmake/make/make install, and run 'lipstick'.
Binary file added images/jolla-full-wallpaper.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions lipstick-example-home.pro
@@ -0,0 +1,31 @@
TEMPLATE = app
TARGET = lipstick
VERSION = 0.1

target.path += /usr/bin
INSTALLS = target

QT += network \
svg \
dbus \
xml \
declarative \
opengl

HEADERS +=

SOURCES += \
main.cpp

RESOURCES += \
res.qrc

OTHER_FILES += \
images/clarity_03_by_pr09studio.jpg \
qml/main.qml \
qml/Launcher.qml \
qml/Switcher.qml \
qml/SwitcherItem.qml

CONFIG += link_pkgconfig
PKGCONFIG += lipstick
11 changes: 11 additions & 0 deletions main.cpp
@@ -0,0 +1,11 @@
// Copyright (c) 2012, Jolla Mobile
// <insert closed source header here>

#include <QDebug>
#include <homeapplication.h>

int main(int argc, char *argv[])
{
HomeApplication app(argc, argv, "qrc:/qml/main.qml");
return app.exec();
}
85 changes: 85 additions & 0 deletions qml/Launcher.qml
@@ -0,0 +1,85 @@

/*
* Launcher.qml
*
* Copyright (c) 2011 - Tom Swindell <t.swindell@rubyx.co.uk>
* Copyright (c) 2012 - Timur Kristóf <venemo@fedoraproject.org>
*
* 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 1.1
import org.nemomobile.lipstick 0.1

Item {
id: launcherRoot
clip: true

property alias cellWidth: gridview.cellWidth

GridView {
id: gridview
width: Math.floor(parent.width / cellWidth) * cellWidth
cellWidth: 80 + 60
cellHeight: cellWidth
anchors {
top: parent.top;
bottom: parent.bottom;
horizontalCenter: parent.horizontalCenter;
topMargin: 20
bottomMargin: 20
}

model: LauncherModel { }

delegate: Item {
width: gridview.cellWidth
height: gridview.cellHeight

Image {
id:icon
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
margins: 8
}
width: 80
height: width
source: model.object.iconFilePath
}
Text {
width: parent.width - 10
anchors {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
margins: 30
}
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
font.pixelSize: 18
color: 'white'
text: object.title
}
MouseArea {
anchors.fill: parent
onClicked: object.launchApplication();
}
}
}
}
72 changes: 72 additions & 0 deletions qml/Switcher.qml
@@ -0,0 +1,72 @@

/*
* Switcher.qml
*
* Copyright (c) 2011 - Tom Swindell <t.swindell@rubyx.co.uk>
* Copyright (c) 2012 - Timur Kristóf <venemo@fedoraproject.org>
*
* 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 1.1
import org.nemomobile.lipstick 0.1

Item {
property int columnNumber: 3

id: switcherRoot
clip: true

GridView {
id: gridview
width: cellWidth * columnNumber
cellWidth: (parent.width - 60) / columnNumber
cellHeight: cellWidth * (desktop.height / desktop.width) + 20
anchors {
top: parent.top
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
topMargin: 35
bottomMargin: 35
}

model: SwitcherModel {
id:switcherModel
}

delegate: Item {
width: gridview.cellWidth
height: gridview.cellHeight

SwitcherItem {
width: parent.width - 10
height: parent.height - 10
anchors.centerIn: parent
}
}
}
Text {
// Empty switcher indicator
anchors.centerIn: parent
visible: switcherModel.itemCount === 0
text: "No apps open"
color: "white"
font.pixelSize: 30
}
}
87 changes: 87 additions & 0 deletions qml/SwitcherItem.qml
@@ -0,0 +1,87 @@

/*
* SwitcherItem.qml
*
* Copyright (c) 2011 - Tom Swindell <t.swindell@rubyx.co.uk>
* Copyright (c) 2012 - Timur Kristóf <venemo@fedoraproject.org>
*
* 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 1.1
import org.nemomobile.lipstick 0.1

Item {
id: switcherItemRoot

SwitcherPixmapItem {
id: windowPixmap
width: desktop.isPortrait ? parent.height : parent.width
height: desktop.isPortrait ? parent.width : parent.height
windowId: model.object.window
transform: Rotation {
angle: desktop.isPortrait ? 90 : 0
origin.x: windowPixmap.height / 2
origin.y: windowPixmap.height / 2
}
}

MouseArea {
anchors.fill: parent
onClicked: windowManager.windowToFront(model.object.window)
}

Item {
id: closeButton
width: 30
height: width
anchors {
top: parent.top
right: parent.right
}

Rectangle {
anchors.centerIn: parent
color: 'red'
width: 40
height: 8
transform: Rotation {
angle: 45
origin.x: 20
origin.y: 4
}
}
Rectangle {
anchors.centerIn: parent
color: 'red'
width: 40
height: 8
transform: Rotation {
angle: -45
origin.x: 20
origin.y: 4
}
}

MouseArea {
anchors.fill: parent
onClicked: windowManager.closeWindow(model.object.window)
}
}
}

0 comments on commit 4adf05a

Please sign in to comment.