Skip to content

Commit

Permalink
Initial structure to add favorites
Browse files Browse the repository at this point in the history
  • Loading branch information
Iktwo committed Oct 9, 2016
1 parent c8d42ab commit 0da5871
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Requires Qt >= 5.5
* Support icon themes.
* Investigate if it is possible to integrate widgets.

# Analitics
# Analytics

This project uses Firebase Analytics to collect usage data.

Expand Down
28 changes: 28 additions & 0 deletions src/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ ApplicationWindow {
property bool isWindowActive: Qt.application.state === Qt.ApplicationActive
property int dpi: Screen.pixelDensity * 25.4

property variant favoritesData: ([])

property var resolutions: [
{"height": 480, "width": 320}, // HVGA
{"height": 640, "width": 480}, // VGA
Expand Down Expand Up @@ -60,6 +62,14 @@ ApplicationWindow {
QL.ScreenValues.updateScreenValues()
}

onFavoritesDataChanged: {
listModelFavorites.clear()

for (var i = 0; i < favoritesData.length; ++i) {
listModelFavorites.append(favoritesData)
}
}

Component.onCompleted: {
Config.Theme.tablet = QL.ScreenValues.isTablet
}
Expand Down Expand Up @@ -155,6 +165,24 @@ ApplicationWindow {
source: QL.ScreenValues.navBarVisible ? "qrc:/images/shadow_navigationbar" : ""
}

Connections {
target: QL.PackageManager

onAddedApplicationToGrid: {
var favs = favoritesData
favs.push({'name': name, 'packageName': packageName})
favoritesData = favs
}
}

Settings {
property alias favorites: applicationWindow.favoritesData
}

ListModel {
id: listModelFavorites
}

// D.Debug {
// debugData: {
// 'sdkInt': QL.System.sdkInt,
Expand Down
54 changes: 53 additions & 1 deletion src/qml/themes/classic/ThemeMain.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import QtQuick 2.0
import com.iktwo.qutelauncher 1.0 as QL
import config 1.0 as Config

FocusScope {
id: root
Expand Down Expand Up @@ -33,6 +34,57 @@ FocusScope {
onPressAndHold: QL.Launcher.pickWallpaper()
}

GridView {
id: gridView

anchors.fill: parent

property int highlightedItem

maximumFlickVelocity: height * 5

header: Item {
width: parent.width
height: 20 * QL.ScreenValues.dp
}

add: Transition {
NumberAnimation { properties: "opacity"; from: 0; to: 1; duration: 450 }
NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: 500 }
}

displaced: Transition {
NumberAnimation { property: "opacity"; to: 1.0 }
NumberAnimation { property: "scale"; to: 1.0 }
}

clip: true
interactive: visible

cellHeight: height / Config.Theme.getColumns()
cellWidth: width / Config.Theme.getRows()

model: listModelFavorites

delegate: ApplicationTile {
id: applicationTile

height: GridView.view.cellHeight
width: GridView.view.cellWidth

source: "image://icon/" + model.packageName
text: model.name

onClicked: QL.PackageManager.launchApplication(model.packageName)
onPressAndHold: root.pressAndHold(model, x, y)
}

onHeightChanged: {
if (height !== 0)
cacheBuffer = Math.max(1080, height * 5)
}
}

Item {
anchors {
top: parent.top; topMargin: QL.ScreenValues.statusBarHeight
Expand Down Expand Up @@ -111,11 +163,11 @@ FocusScope {

Connections {
target: QL.Launcher

onNewIntentReceived: explandableItem.close()
onMinimized: explandableItem.close()
}


ApplicationGridMenu {
id: applicationGridMenu

Expand Down
1 change: 1 addition & 0 deletions src/qml/themes/tiles/ColorPicker.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Item {

function close() {
visible = false
/// TODO: verify this
// backKeyHandler.forceActiveFocus()
}

Expand Down
7 changes: 4 additions & 3 deletions src/qml/themes/tiles/ThemeMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Item {

Rectangle {
anchors.fill: parent

color: "black"
opacity: 0.3
visible: applicationGrid.editMode
Expand All @@ -60,15 +61,15 @@ Item {
ApplicationGrid {
id: applicationGrid

visible: true
model: QL.PackageManager

anchors {
top: parent.top; topMargin: parent.height * 0.025
bottom: parent.bottom; bottomMargin: parent.height * 0.025
left: parent.left; leftMargin: (parent.width / 2 ) * 0.025
}

visible: true
model: QL.PackageManager

width: (parent.width / 2 ) * 0.95
}

Expand Down

0 comments on commit 0da5871

Please sign in to comment.