Commit 6596dda6 authored by camilo higuita's avatar camilo higuita

more quick fixes

parent 3b0d95ba
......@@ -112,7 +112,7 @@ Maui.ApplicationWindow
{
id: _favsButton
icon.name: "draw-star"
icon.color: currentView === views.favs ? highlightColor : textColor
// icon.color: currentView === views.favs ? highlightColor : textColor
text: qsTr("Favorites")
checked: currentView === views.favs
onTriggered: currentView = views.favs
......@@ -124,8 +124,8 @@ Maui.ApplicationWindow
{
id: _logButton
icon.name: "view-media-recent"
icon.color: currentView === views.log ? highlightColor : textColor
text: qsTr("Favorites")
// icon.color: currentView === views.log ? highlightColor : textColor
text: qsTr("Recent")
checked: currentView === views.log
onTriggered: currentView = views.log
checkable: false
......@@ -136,7 +136,7 @@ Maui.ApplicationWindow
{
icon.name: "view-contacts"
icon.color: currentView === views.contacts ? highlightColor : textColor
// icon.color: currentView === views.contacts ? highlightColor : textColor
text: qsTr("Contacts")
// height: parent.height
checked: currentView === views.contacts
......@@ -266,6 +266,8 @@ Maui.ApplicationWindow
Component.onCompleted:
{
if(_favsView.view.count < 1)
currentView = views.contacts
if(isAndroid)
Maui.Android.statusbarColor(backgroundColor, !darkTheme)
}
......
/*
* Copyright 2018 Camilo Higuita <milo.h@aol.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) 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 Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Controls.impl 2.3
import QtQuick 2.9
import QtQuick.Controls 2.3
import org.kde.mauikit 1.0 as Maui
import org.kde.kirigami 2.2 as Kirigami
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.3
import UnionModels 1.0
ScrollView
GridLayout
{
id: control
property int cellWidth: unit * 200
property int cellHeight: unit * 200
spacing: space.medium
property int itemSize: 0
property alias model : gridView.model
property alias delegate : gridView.delegate
property alias contentY: gridView.contentY
property alias currentIndex : gridView.currentIndex
property alias count : gridView.count
property alias cacheBuffer : gridView.cacheBuffer
property alias topMargin: gridView.topMargin
property alias bottomMargin: gridView.bottomMargin
property alias rightMargin: gridView.rightMargin
property alias leftMarging: gridView.leftMargin
property alias header : gridView.header
property bool centerContent: false
property bool adaptContent: false
signal areaClicked(var mouse)
signal areaRightClicked()
PinchArea
id: _grid
height: parent.height
width: parent.width
anchors.centerIn: parent
columns: 3
rows: 3
rowSpacing: space.big
columnSpacing: space.big
// spacing: space.medium
readonly property int buttonFontSize: fontSizes.huge * 1.5
property var model : ["1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "0", "#"]
Repeater
{
anchors.fill: parent
onPinchStarted:
{
console.log("pinch started")
}
onPinchUpdated:
{
}
onPinchFinished:
{
console.log("pinch finished")
resizeContent(pinch.scale)
}
GridView
{
id: gridView
anchors
{
leftMargin: control.ScrollBar.visible ? 0 : control.ScrollBar.width
}
model: _grid.model
flow: GridView.FlowLeftToRight
clip: true
focus: true
anchors.horizontalCenter: centerContent ? parent.horizontalCenter :
undefined
width: centerContent ? Math.min(model.count,
Math.floor(parent.width/cellWidth))*cellWidth :
parent.width
height: parent.height
cellWidth: control.cellWidth
cellHeight: control.cellHeight
// maximumFlickVelocity: albumSize*8
boundsBehavior: !isMobile? Flickable.StopAtBounds : Flickable.OvershootBounds
flickableDirection: Flickable.AutoFlickDirection
snapMode: GridView.SnapToRow
highlightMoveDuration: 0
interactive: true
onWidthChanged: adaptContent? control.adaptGrid() : undefined
}
MouseArea
Item
{
anchors.fill: parent
z: -1
acceptedButtons: Qt.RightButton | Qt.LeftButton
onClicked: control.areaClicked(mouse)
onPressAndHold: control.areaRightClicked()
Layout.fillHeight: true
Layout.fillWidth: true
onWheel:
Button
{
if (wheel.modifiers & Qt.ControlModifier)
height: buttonSize
width: height
anchors.centerIn: parent
// bg.radius: Math.max(width, height)
text: modelData
font.bold: true
font.weight: Font.Bold
font.pointSize: buttonFontSize
onClicked:
{
if (wheel.angleDelta.y != 0)
{
var factor = 1 + wheel.angleDelta.y / 600;
if(factor > 1)
{
control.itemSize = control.itemSize + 10
control.cellHeight = control.cellHeight + 10
control.cellWidth = control.cellWidth + 10
}
else if((control.itemSize - 10) > iconSizes.small)
{
control.itemSize = control.itemSize - 10
control.cellHeight = control.cellHeight - 10
control.cellWidth = control.cellWidth - 10
}
if(adaptContent)
control.adaptGrid()
}
dialString += text;
}
}
}
}
function resizeContent(factor)
{
if(factor > 1)
{
control.itemSize = control.itemSize + 10
control.cellHeight = control.cellHeight + 10
control.cellWidth = control.cellWidth + 10
}
else if((control.itemSize - 10) > iconSizes.small)
{
control.itemSize = control.itemSize - 10
control.cellHeight = control.cellHeight - 10
control.cellWidth = control.cellWidth - 10
}
if(adaptContent)
control.adaptGrid()
}
function adaptGrid()
{
var amount = parseInt(gridView.width / (itemSize + spacing), 10)
var leftSpace = parseInt(gridView.width - ( amount * (itemSize + spacing) ), 10)
var size = parseInt((itemSize + spacing) + (parseInt(leftSpace/amount, 10)), 10)
size = size > itemSize + spacing ? size : itemSize + spacing
cellWidth = size
}
}
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