Commit 50d5cd22 authored by eekkelund's avatar eekkelund

[AppLauncher] Fix icon scaling with Theme.iconSizeLauncher. Fix moving app icons inside of folder

parent b2030497
...@@ -34,17 +34,20 @@ import QtQuick.Controls.Styles.Nemo 1.0 ...@@ -34,17 +34,20 @@ import QtQuick.Controls.Styles.Nemo 1.0
GridView { GridView {
id: gridview id: gridview
cellWidth: cellSize width: cellWidth * columns
cellHeight: cellSize
width: parent.width
cacheBuffer: gridview.contentHeight cacheBuffer: gridview.contentHeight
property Item reorderItem property Item reorderItem
property bool onUninstall property bool onUninstall
property alias deleter: deleter property alias deleter: deleter
property var switcher: null property var switcher: null
property string searchString property string searchString
property int minCellSize: Theme.iconSizeLauncher + Theme.itemSpacingHuge
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 cellSize: Math.min(parent.width,parent.height)/4
property int folderIndex: -1 property int folderIndex: -1
property bool isRootFolder:true property bool isRootFolder:true
property bool newFolderActive property bool newFolderActive
...@@ -260,12 +263,11 @@ GridView { ...@@ -260,12 +263,11 @@ GridView {
//Using loader that in the future we can also have widgets as delegate //Using loader that in the future we can also have widgets as delegate
delegate: Loader { delegate: Loader {
id:loader id:loader
width: cellSize width: cellWidth
height: cellSize height: cellHeight
onXChanged: item.x = x onXChanged: item.x = x
onYChanged: item.y = y onYChanged: item.y = y
property QtObject modelData : model property QtObject modelData : model
property int cellSize: gridview.cellHeight
property int cellIndex: index property int cellIndex: index
sourceComponent: object.type == LauncherModel.Folder ? folder : app sourceComponent: object.type == LauncherModel.Folder ? folder : app
} }
......
...@@ -67,19 +67,18 @@ Item { ...@@ -67,19 +67,18 @@ Item {
Item { Item {
id: iconWrapper id: iconWrapper
width: parent.width -parent.width/10 height: parent.height - iconText.height
height: width - iconText.height width: parent.width
anchors.centerIn: parent anchors.horizontalCenter: parent.horizontalCenter
y: Math.round((parent.height - (height + iconText.height)) / 2)
Image { Image {
id: iconImage id: iconImage
anchors { anchors.centerIn: parent
// centerIn: launcherItem.n.otNemoIcon ? parent : undefined sourceSize.width: Theme.iconSizeLauncher
horizontalCenter: /* launcherItemnotNemoIcon ? undefined : */parent.horizontalCenter sourceSize.height: Theme.iconSizeLauncher
top: parent.top height: Theme.iconSizeLauncher
//topMargin: Theme.itemSpacingExtraSmall width: height
}
width:/*launcherItem.notNemoIcon ? parent.width-parent.width/3 : */parent.width - parent.width/4
height: width
asynchronous: true asynchronous: true
onStatusChanged: { onStatusChanged: {
if (iconImage.status == Image.Error) { if (iconImage.status == Image.Error) {
...@@ -89,11 +88,7 @@ Item { ...@@ -89,11 +88,7 @@ Item {
} }
Spinner { Spinner {
id: spinnerr id: spinnerr
anchors { anchors.centerIn: iconImage
centerIn: iconImage
top: iconImage.top
topMargin: Theme.itemSpacingExtraSmall
}
width: iconWrapper.width width: iconWrapper.width
height: width height: width
enabled: (modelData.object.type === LauncherModel.Application) ? modelData.object.isLaunching ? switcher.switchModel.getWindowIdForTitle(modelData.object.title) == 0 : false : false enabled: (modelData.object.type === LauncherModel.Application) ? modelData.object.isLaunching ? switcher.switchModel.getWindowIdForTitle(modelData.object.title) == 0 : false : false
...@@ -116,13 +111,13 @@ Item { ...@@ -116,13 +111,13 @@ Item {
width: iconWrapper.width width: iconWrapper.width
elide: Text.ElideRight elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeTiny
color: Theme.textColor color: Theme.textColor
//https://bugreports.qt.io/browse/QTBUG-56052
y: -contentHeight + font.pixelSize + iconWrapper.y + iconWrapper.height
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
bottom: parent.bottom
topMargin: Theme.itemSpacingExtraSmall
} }
} }
} }
......
...@@ -73,10 +73,11 @@ Item { ...@@ -73,10 +73,11 @@ Item {
} }
Item { Item {
id:folderIconStack id:folderIconStack
width: size width: parent.width
height: size height: parent.height - iconText.height
property int size: parent.width -parent.width/10 anchors.horizontalCenter: parent.horizontalCenter
property int iconSize: (/*launcherItem.notNemoIcon ? size-size/3 : */ (size - size/4)) * 0.9 y: Math.round((parent.height - (height + iconText.height)) / 2)
property int iconSize: Theme.iconSizeLauncher * 0.9
property real transparency: 0.6 property real transparency: 0.6
property int iconCount: 4 property int iconCount: 4
property var icons: addIcons() property var icons: addIcons()
...@@ -146,13 +147,13 @@ Item { ...@@ -146,13 +147,13 @@ Item {
width: launcherItem.width width: launcherItem.width
elide: Text.ElideRight elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeTiny
color: Theme.textColor color: Theme.textColor
//https://bugreports.qt.io/browse/QTBUG-56052
y: -contentHeight + font.pixelSize + folderIconStack.y + folderIconStack.height
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
bottom: parent.bottom
topMargin: Theme.itemSpacingExtraSmall
} }
} }
...@@ -173,15 +174,16 @@ Item { ...@@ -173,15 +174,16 @@ Item {
id: folderLoader id: folderLoader
property Item reorderItem property Item reorderItem
property bool isRootFolder:false property bool isRootFolder:false
property int folderIndex: -1
cacheBuffer: folderLoader.contentHeight cacheBuffer: folderLoader.contentHeight
parent: gridview.contentItem parent: gridview.contentItem
y: wrapper.y + wrapper.width y: wrapper.y + wrapper.width
x: 0 x: 0
z: wrapper.z + 100 z: wrapper.z + 100
width: gridview.width width: gridview.width
height: count == 0 ? 0 : (Math.floor((count*wrapper.height-1)/width) + 1) * wrapper.height height: count == 0 ? 0 : (Math.floor((count*wrapper.width-1)/width) + 1) * wrapper.height
cellWidth: wrapper.width cellWidth: wrapper.width
cellHeight: wrapper.width cellHeight: wrapper.height
onReorderItemChanged: if(reorderItem == null) folderIconStack.icons=folderIconStack.addIcons() onReorderItemChanged: if(reorderItem == null) folderIconStack.icons=folderIconStack.addIcons()
Rectangle { Rectangle {
......
...@@ -89,9 +89,11 @@ MouseArea { ...@@ -89,9 +89,11 @@ MouseArea {
drag.target = null drag.target = null
parentItem.reorderItem = null parentItem.reorderItem = null
pager.interactive = true pager.interactive = true
if(parentItem.onUninstall){
parentItem.onUninstall = false parentItem.onUninstall = false
deleteState="basic" deleteState="basic"
deleter.uninstalling(deleteState) deleter.uninstalling(deleteState)
}
parentItem.folderIndex = -1 parentItem.folderIndex = -1
reparent(parentItem.contentItem) reparent(parentItem.contentItem)
z = parent.z z = parent.z
......
...@@ -247,7 +247,7 @@ Item { ...@@ -247,7 +247,7 @@ Item {
} }
Image { Image {
id: iconImage id: iconImage
width: parent.height-Theme.itemSpacingMedium width: Math.min(Theme.iconSizeLauncher, parent.height-Theme.itemSpacingMedium)
height: width height: width
source:iconSource source:iconSource
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
......
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