Visual improvements to drawer

Now the drawer open automatically when the window is big enough. The
drawer handle are also only visible when a document is open. The
thumbnails page was also improved and some spacing issues were solved.
This commit is contained in:
Carl Schwan 2020-12-10 23:45:21 +00:00 committed by Albert Astals Cid
parent 604a4e1db2
commit 6af6742067
4 changed files with 30 additions and 15 deletions

View file

@ -24,7 +24,12 @@ import org.kde.okular 2.0 as Okular
Kirigami.OverlayDrawer {
edge: Qt.RightEdge
bottomPadding: 0
topPadding: 0
leftPadding: 0
rightPadding: 0
edge: Qt.application.layoutDirection == Qt.RightToLeft ? Qt.LeftEdge : Qt.RightEdge
contentItem: Item {
id: browserFrame
implicitWidth: Kirigami.Units.gridUnit * 45

View file

@ -24,13 +24,13 @@ import org.kde.kirigami 2.8 as Kirigami
ThumbnailsBase {
id: root
model: documentItem.matchingPages
padding: 0
header: QQC2.ToolBar {
id: toolBarContent
width: root.width
Kirigami.SearchField {
padding: 0
contentItem: Kirigami.SearchField {
id: searchField
width: parent.width
placeholderText: i18n("Search...")
enabled: documentItem ? documentItem.supportsSearching : false
onTextChanged: {

View file

@ -29,23 +29,22 @@ Kirigami.ScrollablePage {
property Item view: resultsGrid
signal pageClicked(int pageNumber)
QQC2.Label {
anchors.centerIn: parent
visible: model.length == 0
text: i18n("No results found.")
}
Kirigami.CardsListView {
contentItem: Kirigami.CardsListView {
id: resultsGrid
clip: true
leftMargin: Kirigami.Units.largeSpacing * 10
rightMargin: Kirigami.Units.largeSpacing * 10
QQC2.Label {
anchors.centerIn: parent
visible: model.length == 0
text: i18n("No results found.")
}
delegate: Kirigami.AbstractCard {
implicitWidth: root.width
highlighted: delegateRecycler && delegateRecycler.GridView.isCurrentItem
showClickFeedback: true
readonly property real ratio: contentItem.implicitHeight/contentItem.implicitWidth
height: width * ratio
implicitHeight: width * ratio
contentItem: Okular.ThumbnailItem {
document: documentItem
pageNumber: modelData

View file

@ -24,10 +24,15 @@ import org.kde.kirigami 2.10 as Kirigami
import org.kde.okular.app 2.0
Kirigami.ApplicationWindow {
id: fileBrowserRoot
id: root
readonly property int columnWidth: Kirigami.Units.gridUnit * 13
wideScreen: width > columnWidth * 5
visible: true
header: null
globalDrawer: Kirigami.GlobalDrawer {
title: i18n("Okular")
titleIcon: "okular"
@ -57,7 +62,13 @@ Kirigami.ApplicationWindow {
}
]
}
contextDrawer: OkularDrawer {}
contextDrawer: OkularDrawer {
contentItem.implicitWidth: columnWidth
modal: !root.wideScreen
onModalChanged: drawerOpen = !modal
enabled: documentItem.opened && pageStack.layers.depth < 2
handleVisible: enabled && pageStack.layers.depth < 2
}
title: documentItem.windowTitleForDocument ? documentItem.windowTitleForDocument : i18n("Okular")
Okular.DocumentItem {