diff --git a/src/qml/AppLauncher.qml b/src/qml/AppLauncher.qml index 340732ae..cc91cf2b 100644 --- a/src/qml/AppLauncher.qml +++ b/src/qml/AppLauncher.qml @@ -1,4 +1,3 @@ - // 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 @@ -22,308 +21,184 @@ // Copyright (c) 2011, Tom Swindell // Copyright (c) 2012, Timur Kristóf // Copyright (c) 2017, Eetu Kahelin +// Copyright (c) 2018, Chupligin Sergey import QtQuick 2.6 + import org.nemomobile.lipstick 0.1 +import org.nemomobile.configuration 1.0 + import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0 + +import "applauncher" + // App Launcher page // the place for browsing installed applications and launching them - -GridView { - id: gridview - width: cellWidth * columns - cacheBuffer: gridview.contentHeight - property Item reorderItem - property bool onUninstall - property alias deleter: deleter +Flickable{ + id: appLauncher + width: parent.width + height: desktop.height property var switcher: null property string searchString - property int minCellSize: Theme.iconSizeLauncher + Theme.iconSizeLauncher/2 - property int rows: Math.floor(parent.height / minCellSize) - property int columns: Math.floor(parent.width / minCellSize) - - cellWidth: parent.width / columns - cellHeight: Math.round(parent.height / rows) - - property int folderIndex: -1 - property bool isRootFolder:true - property bool newFolderActive - property bool newFolder: newFolderActive && isRootFolder && folderIndex >= 0 - clip: true - onContentYChanged: { - if( contentY < -Theme.itemHeightHuge*2 ) { - headerItem.visible = true; - timer.running = true; - } + ConfigurationValue { + id: alwaysShowSearch + key: "/home/glacier/appLauncher/alwaysShowSearch" + defaultValue: true } - onSearchStringChanged: timer.restart() - - Timer{ - id: timer; running: false; interval: 7000; repeat: true - onTriggered: { - if(searchString.length < 1 ) headerItem.visible = false + /*top search line*/ + SearchListView { + id: searchListView + width: appLauncher.width + visible: alwaysShowSearch.value == true + + Timer{ + id: searchListViewTimer; + running: false; + interval: 7000; + repeat: true + onTriggered: { + if(searchString.length < 1 && !alwaysShowSearch.value == true) + { + searchListView.visible = false + } + } } } + Connections { - target: headerItem - onHeightChanged:{ - if(headerItem.oldHeight < headerItem.height) - if(!flicking) gridview.contentY = headerItem.y - headerItem.oldHeight = headerItem.height + target: lockScreen + onVisibleChanged: { + if(lockscreenVisible()) { + searchListView.cleanup() + } } - onVisibleChanged:timer.restart() } + Connections { target: Lipstick.compositor onDisplayOff: { - headerItem.searchField.text = "" - headerItem.visible = false + searchListView.cleanup() } onWindowAdded: { - if(window.category=="" && window.title !== "Home"){ - headerItem.searchField.text = "" - headerItem.visible = false + if(window.category === "" && window.title !== "Home"){ + searchListView.cleanup() } } onWindowRaised: { - if(window.category=="" && window.title !== "Home"){ - headerItem.searchField.text = "" - headerItem.visible = false + if(window.category === "" && window.title !== "Home"){ + searchListView.cleanup() } } } - Connections { - target: pager - onFlickEnded: { - headerItem.searchField.text = "" - headerItem.visible = false + onSearchStringChanged: searchListViewTimer.restart() + + /*app grid*/ + GridView { + id: gridview + width: parent.width + height: parent.height-searchListView.height-Theme.itemSpacingHuge + + visible: searchString.length === 0 + + cacheBuffer: gridview.contentHeight + property Item reorderItem + property bool onUninstall + + property int minCellSize: Theme.iconSizeLauncher + Theme.iconSizeLauncher/2 + property int rows: Math.floor(parent.height / minCellSize) + property int columns: Math.floor(parent.width / minCellSize) + + cellWidth: parent.width / columns + cellHeight: Math.round(parent.height / rows) + + anchors{ + top: searchListView.bottom + topMargin: Theme.itemSpacingHuge } - } - Connections { - target: lockScreen - onVisibleChanged: { - if(lockscreenVisible()) { - headerItem.searchField.text = "" - headerItem.visible = false + + onContentYChanged: { + if( contentY < -Theme.itemHeightHuge*2 && alwaysShowSearch.value == false ) { + searchListView.visible = true + searchListViewTimer.running = true } } - } - header: SearchListView { - width: gridview.width - } - - footer: Item { - height: Theme.itemHeightLarge*1.5 - } + property int folderIndex: -1 + property bool isRootFolder:true + property bool newFolderActive + property bool newFolder: newFolderActive && isRootFolder && folderIndex >= 0 + clip: true - Item {//Doesn't yet uninstall applications - id: deleter - anchors.top: parent.top - property alias remove: remove - property alias uninstall: uninstall - function uninstalling(action, caption) { - state = action - if (action==="remove") { - remove.text = qsTr("Removing") + " " + caption - } else if (action == "uninstall") { - uninstall.text = qsTr("Uninstalling") + " " + caption + /*onContentYChanged: { + if( contentY < -Theme.itemHeightHuge ) { + headerItem.visible = true; + timer.running = true; } + }*/ + + footer: Item { + height: Theme.itemHeightLarge*1.5 } - states: [ - State { - name: "remove" - PropertyChanges { - target: remove - color1: "#D9ff0000" - color2: "#D9ff0000" - color3: "#D9ff0000" - } - PropertyChanges { - target: uninstall - color1: "#D9ff0000" - color2: "#80ff0000" - color3: "#4Dff0000" - } - PropertyChanges { - target: uninstall - text: qsTr("Uninstall") - } - }, - State { - name: "uninstall" - PropertyChanges { - target: uninstall - color1: "#D9ff0000" - color2: "#D9ff0000" - color3: "#D9ff0000" - } - PropertyChanges { - target: remove - color1: "#D9ff0000" - color2: "#80ff0000" - color3: "#4Dff0000" - } - PropertyChanges { - target: remove - text: qsTr("Remove") - } - }, - State { - name:"basic" - PropertyChanges { - target: remove - color1: "#D9ff0000" - color2: "#80ff0000" - color3: "#4Dff0000" - } - PropertyChanges { - target: remove - text: qsTr("Remove") - } - PropertyChanges { - target: uninstall - color1: "#D9ff0000" - color2: "#80ff0000" - color3: "#4Dff0000" - } - PropertyChanges { - target: uninstall - text: qsTr("Uninstall") - } - } - ] + onFolderIndexChanged: if (folderIndex == -1) newFolderActive = false - Rectangle {//WHY? - id: remove - property color color1: "#D9ff0000" - property color color2: "#80ff0000" - property color color3: "#4Dff0000" - property alias text: removeLabel.text - anchors.left: parent.left - visible: gridview.onUninstall - height: Theme.itemHeightExtraLarge - width: gridview.width / 2 - gradient: Gradient { - GradientStop { position: 0.0; color: remove.color1 } - GradientStop { position: 0.5; color: remove.color2 } - GradientStop { position: 1.0; color: remove.color3 } - } - Row { - width: parent.width - height: parent.height - Image { - id:removeIcon - fillMode: Image.PreserveAspectFit - height: parent.height -Theme.itemSpacingExtraSmall - width: height - anchors.verticalCenter: parent.verticalCenter - source: "image://theme/remove" - visible: deleter.state != "remove" - } + model: LauncherFolderModel{ + id: launcherModel + } - Label { - id: removeLabel - text: qsTr("Remove") - height: parent.height - width: parent.width - (removeIcon.visible ? removeIcon.width : 0) - anchors.verticalCenter: parent.verticalCenter - font.pixelSize: Theme.fontSizeSmall - elide:Text.ElideRight - horizontalAlignment:Text.AlignHCenter - verticalAlignment:Text.AlignVCenter - } - } + //Using loader that in the future we can also have widgets as delegate + delegate: Loader { + id:loader + width: gridview.cellWidth + height: gridview.cellHeight + onXChanged: item.x = x + onYChanged: item.y = y + property QtObject modelData : model + property int cellIndex: index + sourceComponent: object.type == LauncherModel.Folder ? folder : app } - Rectangle { - id: uninstall - property color color1: "#D9ff0000" - property color color2: "#80ff0000" - property color color3: "#4Dff0000" - property alias text: uninstallLabel.text - anchors.left: remove.right - visible: gridview.onUninstall - width: gridview.width / 2 - height: Theme.itemHeightExtraLarge - gradient: Gradient { - GradientStop { position: 0.0; color: uninstall.color1 } - GradientStop { position: 0.5; color: uninstall.color2 } - GradientStop { position: 1.0; color: uninstall.color3 } + + Component { + id:app + LauncherItemDelegate { + id: launcherItem + parent: gridview + parentItem: gridview + iconCaption.color:Theme.textColor + iconCaption.text: modelData.object.title + isFolder: modelData.object.type == LauncherModel.Folder + source: modelData.object.iconId == "" ? "/usr/share/lipstick-glacier-home-qt5/qml/theme/default-icon.png" : (modelData.object.iconId.indexOf("/") == 0 ? "file://" : "image://theme/") + modelData.object.iconId + notNemoIcon: isFolder || modelData.object.iconId == "" ? false : modelData.object.iconId.indexOf("harbour") > -1 || modelData.object.iconId.indexOf("apkd_launcher") > -1 ? true : false + folderModel:launcherModel } - Row { - width: parent.width - height: parent.height - Image { - id:trashIcon - fillMode: Image.PreserveAspectFit - height: parent.height -Theme.itemSpacingExtraSmall - width: height - anchors.verticalCenter: parent.verticalCenter - source: "image://theme/trash" - visible: deleter.state != "uninstall" - } - Label { - id: uninstallLabel - height: parent.height - width: parent.width - (trashIcon.visible ? trashIcon.width : 0) - anchors.verticalCenter: parent.verticalCenter - text: qsTr("Uninstall") - font.pixelSize: Theme.fontSizeSmall - elide:Text.ElideRight - horizontalAlignment:Text.AlignHCenter - verticalAlignment:Text.AlignVCenter - } + } + Component { + id:folder + LauncherItemFolder { + id: launcherfolder + parent: gridview + iconCaption.color:Theme.textColor + iconCaption.text: modelData.object.title + isFolder: modelData.object.type == LauncherModel.Folder + folderAppsCount: isFolder && modelData.object ? modelData.object.itemCount : 0 + notNemoIcon: isFolder || modelData.object.iconId == "" ? false : modelData.object.iconId.indexOf("harbour") > -1 || modelData.object.iconId.indexOf("apkd_launcher") > -1 ? true : false + folderModel:launcherModel } } } - onFolderIndexChanged: if (folderIndex == -1) newFolderActive = false - - model: LauncherFolderModel { id: launcherModel } - //Using loader that in the future we can also have widgets as delegate - delegate: Loader { - id:loader - width: cellWidth - height: cellHeight - onXChanged: item.x = x - onYChanged: item.y = y - property QtObject modelData : model - property int cellIndex: index - sourceComponent: object.type == LauncherModel.Folder ? folder : app - } - - Component { - id:app - LauncherItemDelegate { - id: launcherItem - parent: gridview - parentItem: gridview - iconCaption.color:Theme.textColor - iconCaption.text: modelData.object.title - isFolder: modelData.object.type == LauncherModel.Folder - source: modelData.object.iconId == "" ? "/usr/share/lipstick-glacier-home-qt5/qml/theme/default-icon.png" : (modelData.object.iconId.indexOf("/") == 0 ? "file://" : "image://theme/") + modelData.object.iconId - notNemoIcon: isFolder || modelData.object.iconId == "" ? false : modelData.object.iconId.indexOf("harbour") > -1 || modelData.object.iconId.indexOf("apkd_launcher") > -1 ? true : false - folderModel:launcherModel - } - } - Component { - id:folder - LauncherItemFolder { - id: launcherfolder - parent: gridview - iconCaption.color:Theme.textColor - iconCaption.text: modelData.object.title - isFolder: modelData.object.type == LauncherModel.Folder - folderAppsCount: isFolder && modelData.object ? modelData.object.itemCount : 0 - notNemoIcon: isFolder || modelData.object.iconId == "" ? false : modelData.object.iconId.indexOf("harbour") > -1 || modelData.object.iconId.indexOf("apkd_launcher") > -1 ? true : false - folderModel:launcherModel + Deleter{ + id: deleter + anchors{ + bottom: parent.bottom } + + state: "uninstall" } } diff --git a/src/qml/CloseButton.qml b/src/qml/CloseButton.qml index 0b056abf..95f7e834 100644 --- a/src/qml/CloseButton.qml +++ b/src/qml/CloseButton.qml @@ -21,7 +21,7 @@ // // Copyright (c) 2012, Timur Kristóf -import QtQuick 2.0 +import QtQuick 2.6 Image { id: closeButton diff --git a/src/qml/DeviceLockUI.qml b/src/qml/DeviceLockUI.qml index 4a547121..d883aa42 100644 --- a/src/qml/DeviceLockUI.qml +++ b/src/qml/DeviceLockUI.qml @@ -1,4 +1,4 @@ -import QtQuick 2.1 +import QtQuick 2.6 import QtQuick.Controls 1.0 import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0 diff --git a/src/qml/FeedsPage.qml b/src/qml/FeedsPage.qml index c9e6dc60..88d79bd8 100644 --- a/src/qml/FeedsPage.qml +++ b/src/qml/FeedsPage.qml @@ -22,7 +22,7 @@ // Copyright (c) 2011, Tom Swindell // Copyright (c) 2012, Timur Kristóf -import QtQuick 2.1 +import QtQuick 2.6 import org.nemomobile.lipstick 0.1 import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0 diff --git a/src/qml/GlacierRotation.qml b/src/qml/GlacierRotation.qml index c4ef25e9..e820f3ae 100644 --- a/src/qml/GlacierRotation.qml +++ b/src/qml/GlacierRotation.qml @@ -29,7 +29,7 @@ ** ****************************************************************************************/ -import QtQuick 2.1 +import QtQuick 2.6 import QtQuick.Window 2.1 import org.nemomobile.lipstick 0.1 diff --git a/src/qml/LockscreenClock.qml b/src/qml/LockscreenClock.qml index 9334faba..f761ef5f 100644 --- a/src/qml/LockscreenClock.qml +++ b/src/qml/LockscreenClock.qml @@ -1,5 +1,5 @@ -import QtQuick 2.1 +import QtQuick 2.6 import org.nemomobile.devicelock 1.0 import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0 diff --git a/src/qml/MainScreen.qml b/src/qml/MainScreen.qml index cc4a8bb3..0d75bbc0 100644 --- a/src/qml/MainScreen.qml +++ b/src/qml/MainScreen.qml @@ -29,7 +29,7 @@ ** ****************************************************************************************/ -import QtQuick 2.1 +import QtQuick 2.6 import QtQuick.Controls 1.0 import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0 @@ -43,6 +43,7 @@ import org.nemomobile.devicelock 1.0 import "scripts/desktop.js" as Desktop Page { + id: desktop // This is used in the favorites page and in the lock screen WallClock { id: wallClock @@ -63,7 +64,7 @@ Page { key: "/home/glacier/homeScreen/wallpaperImage" defaultValue: "/usr/share/lipstick-glacier-home-qt5/qml/images/wallpaper-portrait-bubbles.png" } - id: desktop + property alias lockscreen: lockScreen property alias switcher: switcher property int statusBarHeight: statusbar.height diff --git a/src/qml/Pager.qml b/src/qml/Pager.qml index 95947e34..fb74ba07 100644 --- a/src/qml/Pager.qml +++ b/src/qml/Pager.qml @@ -21,7 +21,7 @@ // // Copyright (c) 2012, Timur Kristóf -import QtQuick 2.0 +import QtQuick 2.6 PathView { id: pager diff --git a/src/qml/ShutdownScreen.qml b/src/qml/ShutdownScreen.qml index e76acb0d..3c294397 100644 --- a/src/qml/ShutdownScreen.qml +++ b/src/qml/ShutdownScreen.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.6 import QtQuick.Window 2.0 import org.nemomobile.lipstick 0.1 import ".." diff --git a/src/qml/Statusbar.qml b/src/qml/Statusbar.qml index d2d966d2..4d7ed7fe 100644 --- a/src/qml/Statusbar.qml +++ b/src/qml/Statusbar.qml @@ -29,7 +29,7 @@ ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** ****************************************************************************************/ -import QtQuick 2.1 +import QtQuick 2.6 import QtQuick.Layouts 1.0 import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0 diff --git a/src/qml/SwitcherItem.qml b/src/qml/SwitcherItem.qml index cc45fe42..ff332479 100644 --- a/src/qml/SwitcherItem.qml +++ b/src/qml/SwitcherItem.qml @@ -22,7 +22,7 @@ // Copyright (c) 2011, Tom Swindell // Copyright (c) 2012, Timur Kristóf -import QtQuick 2.0 +import QtQuick 2.6 import org.nemomobile.lipstick 0.1 import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0 diff --git a/src/qml/ToolBarLayoutExample.qml b/src/qml/ToolBarLayoutExample.qml index b2d010cf..e2bbae33 100644 --- a/src/qml/ToolBarLayoutExample.qml +++ b/src/qml/ToolBarLayoutExample.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.6 import QtQuick.Controls.Nemo 1.0 Item { diff --git a/src/qml/VolumeControl.qml b/src/qml/VolumeControl.qml index 07249ffa..f1b43747 100644 --- a/src/qml/VolumeControl.qml +++ b/src/qml/VolumeControl.qml @@ -29,7 +29,7 @@ ** ****************************************************************************************/ -import QtQuick 2.1 +import QtQuick 2.6 import QtQuick.Controls 1.0 import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0 diff --git a/src/qml/applauncher/Deleter.qml b/src/qml/applauncher/Deleter.qml new file mode 100644 index 00000000..be804f1e --- /dev/null +++ b/src/qml/applauncher/Deleter.qml @@ -0,0 +1,187 @@ +// This file is part of glacier-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) 2018, Chupligin Sergey + +import QtQuick 2.6 + +import QtQuick.Controls.Nemo 1.0 +import QtQuick.Controls.Styles.Nemo 1.0 + +Item {//Doesn't yet uninstall applications + id: deleter + property alias remove: remove + property alias uninstall: uninstall + function uninstalling(action, caption) { + state = action + if (action==="remove") { + remove.text = qsTr("Removing") + " " + caption + } else if (action == "uninstall") { + uninstall.text = qsTr("Uninstalling") + " " + caption + } + } + + states: [ + State { + name: "remove" + PropertyChanges { + target: remove + color1: "#D9ff0000" + color2: "#D9ff0000" + color3: "#D9ff0000" + } + PropertyChanges { + target: uninstall + color1: "#D9ff0000" + color2: "#80ff0000" + color3: "#4Dff0000" + } + PropertyChanges { + target: uninstall + text: qsTr("Uninstall") + } + }, + State { + name: "uninstall" + PropertyChanges { + target: uninstall + color1: "#D9ff0000" + color2: "#D9ff0000" + color3: "#D9ff0000" + } + PropertyChanges { + target: remove + color1: "#D9ff0000" + color2: "#80ff0000" + color3: "#4Dff0000" + } + PropertyChanges { + target: remove + text: qsTr("Remove") + } + }, + State { + name:"basic" + PropertyChanges { + target: remove + color1: "#D9ff0000" + color2: "#80ff0000" + color3: "#4Dff0000" + } + PropertyChanges { + target: remove + text: qsTr("Remove") + } + PropertyChanges { + target: uninstall + color1: "#D9ff0000" + color2: "#80ff0000" + color3: "#4Dff0000" + } + PropertyChanges { + target: uninstall + text: qsTr("Uninstall") + } + } + ] + + Rectangle {//WHY? + id: remove + property color color1: "#D9ff0000" + property color color2: "#80ff0000" + property color color3: "#4Dff0000" + property alias text: removeLabel.text + anchors.left: parent.left + visible: gridview.onUninstall + height: Theme.itemHeightExtraLarge + width: gridview.width / 2 + gradient: Gradient { + GradientStop { position: 0.0; color: remove.color1 } + GradientStop { position: 0.5; color: remove.color2 } + GradientStop { position: 1.0; color: remove.color3 } + } + Row { + width: parent.width + height: parent.height + Image { + id:removeIcon + fillMode: Image.PreserveAspectFit + height: parent.height -Theme.itemSpacingExtraSmall + width: height + anchors.verticalCenter: parent.verticalCenter + source: "image://theme/remove" + visible: deleter.state != "remove" + } + + Label { + id: removeLabel + text: qsTr("Remove") + height: parent.height + width: parent.width - (removeIcon.visible ? removeIcon.width : 0) + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: Theme.fontSizeSmall + elide:Text.ElideRight + horizontalAlignment:Text.AlignHCenter + verticalAlignment:Text.AlignVCenter + } + } + } + Rectangle { + id: uninstall + property color color1: "#D9ff0000" + property color color2: "#80ff0000" + property color color3: "#4Dff0000" + property alias text: uninstallLabel.text + anchors.left: remove.right + visible: gridview.onUninstall + width: gridview.width / 2 + height: Theme.itemHeightExtraLarge + gradient: Gradient { + GradientStop { position: 0.0; color: uninstall.color1 } + GradientStop { position: 0.5; color: uninstall.color2 } + GradientStop { position: 1.0; color: uninstall.color3 } + } + Row { + width: parent.width + height: parent.height + Image { + id:trashIcon + fillMode: Image.PreserveAspectFit + height: parent.height -Theme.itemSpacingExtraSmall + width: height + anchors.verticalCenter: parent.verticalCenter + source: "image://theme/trash" + visible: deleter.state != "uninstall" + } + Label { + id: uninstallLabel + height: parent.height + width: parent.width - (trashIcon.visible ? trashIcon.width : 0) + anchors.verticalCenter: parent.verticalCenter + text: qsTr("Uninstall") + font.pixelSize: Theme.fontSizeSmall + elide:Text.ElideRight + horizontalAlignment:Text.AlignHCenter + verticalAlignment:Text.AlignVCenter + } + } + } +} + diff --git a/src/qml/SearchListView.qml b/src/qml/applauncher/SearchListView.qml similarity index 77% rename from src/qml/SearchListView.qml rename to src/qml/applauncher/SearchListView.qml index 13c67ac1..c7a84976 100644 --- a/src/qml/SearchListView.qml +++ b/src/qml/applauncher/SearchListView.qml @@ -1,6 +1,7 @@ /**************************************************************************************** ** ** Copyright (c) 2017, Eetu Kahelin +** Copyright (c) 2018, Chupligin Sergey ** All rights reserved. ** ** You may use this file under the terms of BSD license as follows: @@ -29,41 +30,68 @@ ** ****************************************************************************************/ import QtQuick 2.6 -import org.nemomobile.lipstick 0.1 import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0 + +import org.nemomobile.lipstick 0.1 import org.nemomobile.contacts 1.0 Item { id:rootItem - height: (searchField.text.length > 0 ? listView.height+searchField.height : searchField.height) + (visible ? Theme.itemSpacingHuge + margin.height : 0) - visible: false + height: calculateHeight() anchors.bottomMargin:Theme.itemSpacingHuge property alias searchField: searchField property int oldHeight - Behavior on height { - enabled:!visible - NumberAnimation{ duration: 300 } + InverseMouseArea { + anchors.fill: parent + onPressed: cleanup() } - onVisibleChanged: { - if( visible){ - searchField.focus = true - searchField.forceActiveFocus() - } else searchField.focus = false - oldHeight=height + function cleanup(){ + searchField.focus = false + appLauncher.searchString = "" + searchField.text = "" + + if(!alwaysShowSearch.value == true) + { + searchListView.visible = false; + } } - Item { - id:margin - height: Theme.itemSpacingSmall + function calculateHeight() + { + if(rootItem.visible){ + if(searchField.text.length > 0){ + return parent.height + } + return searchRow.height+Theme.itemSpacingHuge + } + else + { + return 0; + } } + + onVisibleChanged: { + if(alwaysShowSearch.value == false) + { + if(visible){ + rootItem.height = calculateHeight() + searchField.focus = true + searchField.forceActiveFocus() + } else { + searchField.focus = false + } + oldHeight=height + } + } + Row { id:searchRow anchors { - top:margin.bottom + top: parent.top left: parent.left right: parent.right topMargin: Theme.itemSpacingHuge @@ -78,6 +106,15 @@ Item { height: searchField.height fillMode: Image.PreserveAspectFit source: "image://theme/search" + + MouseArea{ + id: hideShowMouseArea + anchors.fill: parent + onPressAndHold: { + hideShowRow.visible = true + rootItem.height = rootItem.height+hideShowRow.height + } + } } TextField { @@ -85,25 +122,64 @@ Item { width:parent.width - searchIcon.width - Theme.itemSpacingMedium placeholderText: qsTr("Search") Binding { - target: gridview + target: appLauncher property: "searchString" value: searchField.text.toLowerCase().trim() } onTextChanged: { - if(tex.lenght>0) { + if(searchField.lenght>0) { searchField.forceActiveFocus() } } } + } + + Row{ + id: hideShowRow + visible: false + width: parent.width-Theme.itemSpacingMedium*2 + height: visible ? hideShowButton.height+Theme.itemSpacingMedium : 0 + anchors{ + top: searchRow.bottom + topMargin: visible ? Theme.itemSpacingMedium : 0 + } + + Button{ + id: hideShowButton + text: alwaysShowSearch.value == true ? qsTr("Hide search panel") : qsTr("Pinup search panel") + width: parent.width + onClicked: { + rootItem.height = rootItem.height-hideShowRow.height + hideShowRow.visible = false + if(alwaysShowSearch.value == true) + { + alwaysShowSearch.value = false + } + else + { + alwaysShowSearch.value = true + } + } + } + InverseMouseArea { + anchors.fill: parent + onPressed: { + rootItem.height = rootItem.height-hideShowRow.height + hideShowRow.visible = false + } + } } + ListView { id:listView clip: true width: parent.width height:contentHeight - anchors.top: searchRow.bottom - anchors.topMargin: Theme.itemSpacingSmall + anchors{ + top: searchRow.bottom + topMargin: listModel.count > 0 ? Theme.itemSpacingSmall : 0 + } visible: searchString.length>0 section.property: 'category' section.delegate: Component{ @@ -155,7 +231,7 @@ Item { } Connections { - target: gridview + target: appLauncher onSearchStringChanged: listView.update() } @@ -190,15 +266,34 @@ Item { for (i = 0; i < searchLauncherModel.itemCount; ++i) { if (searchLauncherModel.get(i).type === LauncherModel.Folder) { for(var j = 0; j< searchLauncherModel.get(i).itemCount; ++j ) { - titles.push({'iconTitle':searchLauncherModel.get(i).get(j).title, 'iconSource':searchLauncherModel.get(i).get(j).iconId, 'id':i, 'folderId':j, 'category':qsTr("Application")}) + titles.push({ + 'iconTitle':searchLauncherModel.get(i).get(j).title, + 'iconSource':searchLauncherModel.get(i).get(j).iconId, + 'id':i, + 'folderId':j, + 'category':qsTr("Application"), + 'extraCaption': qsTr("installed on you device") + }) } } else { - titles.push({'iconTitle':searchLauncherModel.get(i).title, 'iconSource':searchLauncherModel.get(i).iconId, 'id':i, 'folderId':-1, 'category':qsTr("Application")}) + titles.push({ + 'iconTitle':searchLauncherModel.get(i).title, + 'iconSource':searchLauncherModel.get(i).iconId, + 'id':i, + 'folderId':-1, + 'category':qsTr("Application"), + 'extraCaption': qsTr("installed on you device") + }) } } for (i = 0; i < peopleModel.count; ++i) { if(peopleModel.get(i).firstName && peopleModel.get(i).lastName) { - contacts.push({'title':(peopleModel.get(i).firstName + " " + peopleModel.get(i).lastName), 'iconSource':peopleModel.get(i).avatarUrl.toString(), 'extraCaption':peopleModel.get(i).phoneNumbers, 'category':qsTr("Contact")}) + contacts.push({ + 'title':(peopleModel.get(i).firstName + " " + peopleModel.get(i).lastName), + 'iconSource':peopleModel.get(i).avatarUrl.toString(), + 'extraCaption':peopleModel.get(i).phoneNumbers, + 'category':qsTr("Contact") + }) } } var filteredTitles = titles.filter(function (icon) { @@ -236,7 +331,7 @@ Item { found = existingTitleObject.hasOwnProperty(iconTitle) if (!found) { // for simplicity, just adding to end instead of corresponding position in original list - listModel.append({'title':iconTitle, 'iconSource':iconId, 'id':id, 'folderId':folderId, 'category':category}) + listModel.append({'title':iconTitle, 'iconSource':iconId, 'id':id, 'folderId':folderId, 'category':category, 'extraCaption': ""}) } } for (i = 0; i < contacts.length; ++i) { diff --git a/src/qml/compositor.qml b/src/qml/compositor.qml index 1636f010..1f62aa1a 100644 --- a/src/qml/compositor.qml +++ b/src/qml/compositor.qml @@ -21,9 +21,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import QtQuick 2.0 +import QtQuick 2.6 import org.nemomobile.lipstick 0.1 - import org.nemomobile.devicelock 1.0 import "compositor" diff --git a/src/qml/compositor/ScreenGestureArea.qml b/src/qml/compositor/ScreenGestureArea.qml index 83f0e88a..087adc73 100644 --- a/src/qml/compositor/ScreenGestureArea.qml +++ b/src/qml/compositor/ScreenGestureArea.qml @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import QtQuick 2.0 +import QtQuick 2.6 import QtQuick.Window 2.0 import org.nemomobile.lipstick 0.1 diff --git a/src/qml/compositor/WindowWrapperAlpha.qml b/src/qml/compositor/WindowWrapperAlpha.qml index eae41363..248112d8 100644 --- a/src/qml/compositor/WindowWrapperAlpha.qml +++ b/src/qml/compositor/WindowWrapperAlpha.qml @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import QtQuick 2.0 +import QtQuick 2.6 WindowWrapperBase { id: wrapper diff --git a/src/qml/compositor/WindowWrapperBase.qml b/src/qml/compositor/WindowWrapperBase.qml index 848dcfca..bbc166a3 100644 --- a/src/qml/compositor/WindowWrapperBase.qml +++ b/src/qml/compositor/WindowWrapperBase.qml @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import QtQuick 2.0 +import QtQuick 2.6 Item { id: wrapper diff --git a/src/qml/compositor/WindowWrapperMystic.qml b/src/qml/compositor/WindowWrapperMystic.qml index 09921e12..4777be2c 100644 --- a/src/qml/compositor/WindowWrapperMystic.qml +++ b/src/qml/compositor/WindowWrapperMystic.qml @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import QtQuick 2.1 +import QtQuick 2.6 import QtQuick.Window 2.1 import org.nemomobile.lipstick 0.1 diff --git a/src/src.pro b/src/src.pro index a7ec5655..6f660a1d 100644 --- a/src/src.pro +++ b/src/src.pro @@ -46,8 +46,7 @@ qml.files = qml/MainScreen.qml \ qml/GlacierRotation.qml \ qml/DeviceLockUI.qml \ qml/LauncherItemWrapper.qml \ - qml/LauncherItemFolder.qml \ - qml/SearchListView.qml + qml/LauncherItemFolder.qml qmlcompositor.path = /usr/share/lipstick-glacier-home-qt5/qml/compositor qmlcompositor.files = qml/compositor/WindowWrapperMystic.qml \ @@ -83,6 +82,10 @@ statusbar.files = qml/statusbar/BatteryPanel.qml\ qml/statusbar/NumButton.qml \ qml/statusbar/MediaController.qml +applauncher.path = /usr/share/lipstick-glacier-home-qt5/qml/applauncher +applauncher.files = qml/applauncher/SearchListView.qml \ + qml/applauncher/Deleter.qml + settingswallpaperplugin.files = settings-plugins/wallpaper/wallpaper.qml \ settings-plugins/wallpaper/selectImage.qml \ settings-plugins/wallpaper/wallpaper.svg @@ -112,7 +115,8 @@ INSTALLS += styles \ statusbar\ settingswallpaperplugin\ settingsnotificationsplugin\ - settingspluginconfig + settingspluginconfig \ + applauncher CONFIG += qt link_pkgconfig QT += quick compositor @@ -130,43 +134,17 @@ PKGCONFIG += lipstick-qt5 \ nemodevicelock OTHER_FILES += qml/*.qml \ - qml/MainScreen.qml \ - qml/compositor.qml \ - qml/LauncherItemDelegate.qml \ - qml/Lockscreen.qml \ - qml/LockscreenClock.qml \ - qml/AppSwitcher.qml \ - qml/AppLauncher.qml \ - qml/ToolBarLayoutExample.qml \ - qml/SwitcherItem.qml \ - qml/CloseButton.qml \ - qml/compositor/WindowWrapperMystic.qml \ - qml/compositor/WindowWrapperBase.qml \ - qml/compositor/WindowWrapperAlpha.qml \ - qml/compositor/ScreenGestureArea.qml \ - qml/NotificationPreview.qml \ + qml/compositor/*.qml \ qml/scripts/desktop.js \ - qml/FeedsPage.qml \ - qml/Statusbar.qml \ - qml/StatusbarItem.qml \ - qml/WifiPanel.qml \ - nemovars.conf \ - qml/SimPanel.qml \ - qml/NumButton.qml \ - qml/USBModeSelector.qml \ - qml/VolumeControl.qml \ - qml/BatteryPanel.qml \ - qml/CommonPanel.qml \ - qml/ShutdownScreen.qml \ - qml/GlacierRotation.qml + nemovars.conf \ + qml/connectivity/*.qml TRANSLATIONS += i18n/glacer-home.ts DISTFILES += \ i18n/glacer-home.ts \ - qml/connectivity/ConnectionSelector.qml \ - qml/statusbar/BatteryIndicator.qml \ - settings-plugins/wallpaper/selectImage.qml \ - settings-plugins/notifications/notifications.json \ - settings-plugins/notifications/notifications.svg \ - settings-plugins/notifications/notifications.qml + qml/*/*.qml \ + settings-plugins/*/*.qml \ + settings-plugins/*/*.json \ + settings-plugins/*/*.svg +