diff --git a/mobile/app/package/contents/ui/Thumbnails.qml b/mobile/app/package/contents/ui/Thumbnails.qml index 5f33334ca..37cea14ab 100644 --- a/mobile/app/package/contents/ui/Thumbnails.qml +++ b/mobile/app/package/contents/ui/Thumbnails.qml @@ -1,53 +1,53 @@ /* * Copyright 2012 Marco Martin * * 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 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 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.1 import QtQuick.Controls 2.0 import org.kde.kirigami 2.0 as Kirigami ThumbnailsBase { id: root model: documentItem.matchingPages ToolBar { id: toolBarContent width: root.width height: searchField.height TextField { id: searchField enabled: documentItem ? documentItem.supportsSearching : false anchors.centerIn: parent onTextChanged: { if (text.length > 2) { documentItem.searchText(text); } else { documentItem.resetSearch(); } } } - Kirigami.Label { + Label { anchors { left: searchField.right verticalCenter: searchField.verticalCenter } visible: documentItem.matchingPages.length == 0 text: i18n("No results found.") } } } diff --git a/mobile/app/package/contents/ui/ThumbnailsBase.qml b/mobile/app/package/contents/ui/ThumbnailsBase.qml index a61816090..4c41b4f76 100644 --- a/mobile/app/package/contents/ui/ThumbnailsBase.qml +++ b/mobile/app/package/contents/ui/ThumbnailsBase.qml @@ -1,116 +1,116 @@ /* * Copyright 2012 Marco Martin * * 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 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 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.1 import QtQuick.Controls 1.3 import QtGraphicalEffects 1.0 import org.kde.okular 2.0 as Okular import org.kde.kirigami 2.0 as Kirigami Kirigami.Page { id: root leftPadding: 0 topPadding: 0 rightPadding: 0 bottomPadding: 0 property alias contentY: resultsGrid.contentY property alias contentHeight: resultsGrid.contentHeight property alias model: resultsGrid.model signal pageClicked(int pageNumber) property Item view: resultsGrid ScrollView { anchors { fill: parent topMargin: Kirigami.Units.gridUnit * 2 } GridView { id: resultsGrid anchors.fill: parent cellWidth: Math.floor(width / Math.floor(width / (Kirigami.Units.gridUnit * 8))) cellHeight: Math.floor(cellWidth * 1.6) delegate: Item { id: delegate width: resultsGrid.cellWidth height: resultsGrid.cellHeight property bool current: documentItem.currentPage == modelData onCurrentChanged: { if (current) { resultsGrid.currentIndex = index } } Rectangle { anchors.centerIn: parent width: thumbnail.width + Kirigami.Units.smallSpacing * 2 //FIXME: why bindings with thumbnail.height doesn't work? height: thumbnail.height + Kirigami.Units.smallSpacing * 2 Okular.ThumbnailItem { id: thumbnail x: Kirigami.Units.smallSpacing y: Kirigami.Units.smallSpacing document: documentItem pageNumber: modelData width: delegate.width - Kirigami.Units.smallSpacing * 2 - Kirigami.Units.gridUnit //value repeated to avoid binding loops height: Math.round(width / (implicitWidth/implicitHeight)) Rectangle { width: childrenRect.width height: childrenRect.height color: Kirigami.Theme.backgroundColor radius: width smooth: true anchors { bottom: parent.bottom right: parent.right } - Kirigami.Label { + Label { text: modelData + 1 } } } MouseArea { anchors.fill: parent onClicked: { resultsGrid.currentIndex = index documentItem.currentPage = modelData contextDrawer.drawerOpen = false root.pageClicked(modelData) } } } layer.enabled: true layer.effect: DropShadow { horizontalOffset: 0 verticalOffset: 0 radius: Math.ceil(Kirigami.Units.gridUnit * 0.8) samples: 32 color: Qt.rgba(0, 0, 0, 0.5) } } highlight: Rectangle { color: Kirigami.Theme.highlightColor opacity: 0.4 } } } } diff --git a/mobile/app/package/contents/ui/TreeDelegate.qml b/mobile/app/package/contents/ui/TreeDelegate.qml index 13854046c..acc2d08de 100644 --- a/mobile/app/package/contents/ui/TreeDelegate.qml +++ b/mobile/app/package/contents/ui/TreeDelegate.qml @@ -1,108 +1,109 @@ /* * Copyright 2012 Marco Martin * * 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 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 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.1 +import QtQuick.Controls 2.0 import org.kde.kquickcontrolsaddons 2.0 import org.kde.kirigami 2.0 as Kirigami Column { id: treeDelegate property variant sourceModel property int rowIndex: index width: parent.width property bool matches: display.toLowerCase().indexOf(searchField.text.toLowerCase()) !== -1 MouseArea { id: delegateArea width: parent.width height: matches ? label.height : 0 opacity: matches ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 250 } } onClicked: { documentItem.currentPage = page-1 - contextDrawer.opened = false + contextDrawer.drawerOpen = false } QIconItem { id: icon icon: decoration width: theme.smallIconSize height: width anchors.verticalCenter: parent.verticalCenter x: units.largeSpacing } - Kirigami.Label { + Label { id: label text: display verticalAlignment: Text.AlignBottom anchors.left: icon.right } //there isn't a sane way to do a dotted line in QML Rectangle { color: theme.textColor opacity: 0.3 height: 1 anchors { bottom: parent.bottom left: label.right right: pageNumber.left } } - Kirigami.Label { + Label { id: pageNumber text: pageLabel ? pageLabel : page anchors.right: parent.right verticalAlignment: Text.AlignBottom anchors.rightMargin: units.largeSpacing } } Column { id: col x: 20 width: parent.width - 20 property variant model: childrenModel Repeater { id: rep model: VisualDataModel { id: childrenModel model: documentItem.tableOfContents } } } onParentChanged: { if (treeDelegate.parent && treeDelegate.parent.model) { sourceModel = treeDelegate.parent.model } childrenModel.rootIndex = sourceModel.modelIndex(index) if (model.hasModelChildren) { childrenModel.delegate = Qt.createComponent("TreeDelegate.qml") } } }