Adjust icon size

pull/4/head
revenmartin 5 years ago
parent 3169cbd391
commit 78a34cbf35

@ -1,3 +1,22 @@
/*
* Copyright (C) 2021 CutefishOS.
*
* Author: revenmartin <revenmartin@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.1 import QtQuick.Controls 2.1
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
@ -48,11 +67,10 @@ Item {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
top: parent.top top: parent.top
bottom: label.top bottom: label.top
// margins: FishUI.Units.largeSpacing * 2 leftMargin: Math.min(FishUI.Units.largeSpacing * 2, root.maxSpacing)
leftMargin: Math.min(FishUI.Units.largeSpacing * 2, root.horizontalSpacing) rightMargin: Math.min(FishUI.Units.largeSpacing * 2, root.maxSpacing)
rightMargin: Math.min(FishUI.Units.largeSpacing * 2, root.horizontalSpacing) topMargin: Math.min(FishUI.Units.largeSpacing * 2, root.maxSpacing)
topMargin: Math.min(FishUI.Units.largeSpacing * 2, root.verticalSpacing) bottomMargin: Math.min(FishUI.Units.largeSpacing * 2, root.maxSpacing)
bottomMargin: Math.min(FishUI.Units.largeSpacing * 2, root.verticalSpacing)
} }
property real size: height property real size: height

@ -1,26 +1,45 @@
/*
* Copyright (C) 2021 CutefishOS.
*
* Author: revenmartin <revenmartin@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Window 2.12 import QtQuick.Window 2.12
import FishUI 1.0 as FishUI import FishUI 1.0 as FishUI
import Cutefish.Launcher 1.0 import Cutefish.Launcher 1.0
PageView { PageView {
id: gridView id: control
property int iconSize: gridView.width > gridView.height ? gridView.width * 0.09 + root.horizontalSpacing * 2 property int iconSize: control.width > control.height ? control.width * 0.09 + root.horizontalSpacing * 2 + root.maxSpacing
: gridView.height * 0.09 + root.verticalSpacing * 2 : control.height * 0.09 + root.verticalSpacing * 2 + root.maxSpacing
property int cellWidth: { property int cellWidth: {
var extraWidth = calcExtraSpacing(iconSize, gridView.width) var extraWidth = calcExtraSpacing(iconSize, control.width)
return iconSize + extraWidth return iconSize + extraWidth
} }
property int cellHeight: { property int cellHeight: {
var extraHeight = calcExtraSpacing(iconSize, gridView.height) var extraHeight = calcExtraSpacing(iconSize, control.height)
return iconSize + extraHeight return iconSize + extraHeight
} }
columns: gridView.width / cellWidth columns: control.width / cellWidth
rows: gridView.height / cellHeight rows: control.height / cellHeight
model: launcherModel model: launcherModel
@ -31,10 +50,10 @@ PageView {
LauncherGridDelegate { LauncherGridDelegate {
id: delegate id: delegate
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: root.horizontalSpacing * 1.5 anchors.leftMargin: root.maxSpacing
anchors.rightMargin: root.horizontalSpacing * 1.5 anchors.rightMargin: root.maxSpacing
anchors.topMargin: root.verticalSpacing * 1.5 anchors.topMargin: root.maxSpacing
anchors.bottomMargin: root.verticalSpacing * 1.5 anchors.bottomMargin: root.maxSpacing
} }
} }

@ -1,3 +1,22 @@
/*
* Copyright (C) 2021 CutefishOS.
*
* Author: revenmartin <revenmartin@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0 import QtQuick 2.0
import Cutefish.Launcher 1.0 import Cutefish.Launcher 1.0

@ -1,3 +1,22 @@
/*
* Copyright (C) 2021 CutefishOS.
*
* Author: revenmartin <revenmartin@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Window 2.3 import QtQuick.Window 2.3
import QtQuick.Controls 2.5 import QtQuick.Controls 2.5
@ -15,6 +34,7 @@ Item {
property real horizontalSpacing: launcher.screenRect.width * 0.01 * Screen.devicePixelRatio property real horizontalSpacing: launcher.screenRect.width * 0.01 * Screen.devicePixelRatio
property real verticalSpacing: launcher.screenRect.height * 0.01 * Screen.devicePixelRatio property real verticalSpacing: launcher.screenRect.height * 0.01 * Screen.devicePixelRatio
property real maxSpacing: horizontalSpacing > verticalSpacing ? horizontalSpacing : verticalSpacing
Wallpaper { Wallpaper {
id: backend id: backend
@ -63,11 +83,11 @@ Item {
id: mainLayout id: mainLayout
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: launcher.screenAvailableRect ? launcher.screenAvailableRect.x : 0 anchors.leftMargin: launcher.screenAvailableRect ? launcher.screenAvailableRect.x : 0
anchors.topMargin: launcher.screenAvailableRect ? launcher.screenAvailableRect.y + root.verticalSpacing * 2 * Screen.devicePixelRatio : 0 anchors.topMargin: launcher.screenAvailableRect ? launcher.screenAvailableRect.y + root.verticalSpacing * 2 : 0
anchors.rightMargin: launcher.screenRect.width - (launcher.screenAvailableRect.x + launcher.screenAvailableRect.width) anchors.rightMargin: launcher.screenRect.width - (launcher.screenAvailableRect.x + launcher.screenAvailableRect.width)
anchors.bottomMargin: launcher.screenRect.height - (launcher.screenAvailableRect.y + launcher.screenAvailableRect.height - root.verticalSpacing) anchors.bottomMargin: launcher.screenRect.height - (launcher.screenAvailableRect.y + launcher.screenAvailableRect.height - root.verticalSpacing)
spacing: root.verticalSpacing * Screen.devicePixelRatio spacing: root.verticalSpacing
Item { Item {
id: searchItem id: searchItem

@ -1,3 +1,22 @@
/*
* Copyright (C) 2021 CutefishOS.
*
* Author: revenmartin <revenmartin@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "wallpaper.h" #include "wallpaper.h"
Wallpaper::Wallpaper(QObject *parent) Wallpaper::Wallpaper(QObject *parent)

@ -1,3 +1,22 @@
/*
* Copyright (C) 2021 CutefishOS.
*
* Author: revenmartin <revenmartin@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WALLPAPER_H #ifndef WALLPAPER_H
#define WALLPAPER_H #define WALLPAPER_H

Loading…
Cancel
Save