Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Uninstall/remove areas to homescreen.
  • Loading branch information
locusf committed Apr 12, 2014
1 parent 5e8edd7 commit 196f074
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 34 deletions.
41 changes: 35 additions & 6 deletions src/qml/AppLauncher.qml
Expand Up @@ -24,6 +24,8 @@

import QtQuick 2.0
import org.nemomobile.lipstick 0.1
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0

// App Launcher page
// the place for browsing installed applications and launching them
Expand All @@ -35,23 +37,50 @@ GridView {
width: Math.floor(parent.width / cellWidth) * cellWidth
cacheBuffer: gridview.contentHeight
property Item reorderItem
property bool onUninstall

// just for margin purposes
header: Item {
height: 30
height: 110
Rectangle {
id: remove
property alias text: lbl.text
visible: onUninstall
height: 110
color: "red"
width: gridview.width / 2
Label {
id: lbl
text: "Remove"
font.pointSize: 8
}
}
Rectangle {
id: uninstall
property alias text: lbl2.text
anchors.left: remove.right
visible: onUninstall
color: "green"
width: gridview.width / 2
height: 110
Label {
id: lbl2
text: "Uninstall"
font.pointSize: 8
}
}
}

footer: Item {
height: 20
model: LauncherModel {
id: launcherModel
iconDirectories: ['/usr/share/themes/glacier/meegotouch/icons/']
}

model: LauncherModel { id: launcherModel }

delegate: LauncherItemDelegate {
id: launcherItem
width: gridview.cellWidth
height: gridview.cellHeight
source: model.object.iconId == "" ? ":/images/icons/apps.png" : (model.object.iconId.indexOf("/") == 0 ? "file://" : "image://theme/") + model.object.iconId
source: (model.object.iconId.indexOf("/") == 0 ? "file://" : "image://theme/") + model.object.iconId
iconCaption: model.object.title
}
}
71 changes: 71 additions & 0 deletions src/qml/FeedsPage.qml
@@ -0,0 +1,71 @@

// 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) 2011, Tom Swindell <t.swindell@rubyx.co.uk>
// Copyright (c) 2012, Timur Kristóf <venemo@fedoraproject.org>

import QtQuick 2.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
// Feeds page:
// the place for an event feed.

Item {
// Day of week
Label {
id: displayDayOfWeek
text: Qt.formatDateTime(wallClock.time, "dddd")
color: "white"
anchors {
top: parent.top
left: parent.left
topMargin: 30
leftMargin: 20
}
}

// Current date
Label {
id: displayCurrentDate
text: Qt.formatDate(wallClock.time, Qt.SystemLocaleShortDate)
color: "#888888"
anchors {
top: displayDayOfWeek.bottom
left: parent.left
topMargin: 5
leftMargin: 20
}
}

// Separator thingy
Rectangle {
height: 2
color: "#888888"
anchors {
top: displayCurrentDate.bottom
left: parent.left
right: parent.right
topMargin: 5
leftMargin: 20
rightMargin: 20
}
}
}
16 changes: 5 additions & 11 deletions src/qml/LauncherItemDelegate.qml
Expand Up @@ -74,6 +74,7 @@ Item {
drag.target = launcherItem
z = 1000
reordering = true
gridview.onUninstall = true

// don't allow dragging an icon out of pages with a horizontal flick
pager.interactive = false
Expand All @@ -85,9 +86,11 @@ Item {
reorderTimer.stop()
drag.target = null
reorderItem = null
pager.interactive = true
gridview.onUninstall = false

reparent(gridview.contentItem)
slideMoveAnim.start()
pager.interactive = true
}
}

Expand All @@ -106,14 +109,6 @@ Item {
reorderTimer.restart()
newIndex = idx
}
/*
var globalY = desktop.mapFromItem(launcherItem, 0, 0).y
if (globalY < 70) {
pageChangeTimer.start()
} else {
pageChangeTimer.stop()
}
*/
}
}

Expand Down Expand Up @@ -150,8 +145,7 @@ Item {
asynchronous: true
onStatusChanged: {
if (status === Image.Error) {
console.log("Error loading an app icon, falling back to default.");
iconImage.source = ":/images/icons/apps.png";
iconImage.source = (model.object.iconId.indexOf("/") == 0 ? "file://" : "image://theme/") + model.object.iconId
}
}

Expand Down
23 changes: 7 additions & 16 deletions src/qml/MainScreen.qml
Expand Up @@ -126,30 +126,21 @@ Page {
height: pager.height
visibleInHome: x > -width && x < desktop.width
}
FeedsPage {
id: feeds
width: pager.width
height: pager.height
}
}

// Initial view should be the AppLauncher
currentIndex: 1
currentIndex: 0
}

Lockscreen {
id: lockScreen

width: parent.width
height: parent.height

z: 200

onOpeningStateChanged: {
// When fully closed, reset the current page
if (openingState !== 0)
return

// Focus the switcher if any applications are running, otherwise the launcher
if (switcher.runningAppsCount > 0) {
pager.currentIndex = 2
} else {
pager.currentIndex = 1
}
}
}
}
1 change: 1 addition & 0 deletions src/resources-qml.qrc
Expand Up @@ -34,5 +34,6 @@
<file>qml/theme/icon-m-framework-close-thumbnail.png</file>
<file>qml/NotificationPreview.qml</file>
<file>qml/images/notification-circle.png</file>
<file>qml/FeedsPage.qml</file>
</qresource>
</RCC>
3 changes: 2 additions & 1 deletion src/src.pro
Expand Up @@ -41,6 +41,7 @@ OTHER_FILES += qml/*.qml \
qml/compositor/WindowWrapperBase.qml \
qml/compositor/WindowWrapperAlpha.qml \
qml/compositor/ScreenGestureArea.qml \
qml/NotificationPreview.qml
qml/NotificationPreview.qml \
qml/FeedsPage.qml


0 comments on commit 196f074

Please sign in to comment.