[app] Show book count as menu label when appropriate
This commit is contained in:
parent
902d6c20af
commit
7ceb720633
3 changed files with 14 additions and 18 deletions
|
@ -51,6 +51,8 @@ Item {
|
|||
property alias shelf: shelfModel
|
||||
property alias device: shelfModel.device
|
||||
property alias dummyItemIndex: shelfModel.dummyItemIndex
|
||||
property alias bookCount: shelfModel.bookCount
|
||||
property alias bookCountVisible: storageHeader.needed
|
||||
|
||||
signal openBook(var book)
|
||||
signal dropItem(var mouseX, var mouseY)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2015-2020 Jolla Ltd.
|
||||
Copyright (C) 2015-2020 Slava Monich <slava.monich@jolla.com>
|
||||
Copyright (C) 2015-2021 Jolla Ltd.
|
||||
Copyright (C) 2015-2021 Slava Monich <slava.monich@jolla.com>
|
||||
|
||||
You may use this file under the terms of BSD license as follows:
|
||||
|
||||
|
@ -58,20 +58,8 @@ Column {
|
|||
property int count
|
||||
property bool showCount: true
|
||||
|
||||
property int _shownCount
|
||||
|
||||
signal clicked()
|
||||
|
||||
function updateShownCount() {
|
||||
if (count > 0) {
|
||||
_shownCount = count
|
||||
}
|
||||
}
|
||||
|
||||
onCountChanged: updateShownCount()
|
||||
|
||||
Component.onCompleted: updateShownCount()
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: Math.max(storageLabel.height, bookCount.height)
|
||||
|
@ -134,12 +122,10 @@ Column {
|
|||
}
|
||||
//: Number of books in the storage header
|
||||
//% "%0 book(s)"
|
||||
text: qsTrId("harbour-books-storage-book_count",_shownCount).arg(_shownCount)
|
||||
text: qsTrId("harbour-books-storage-book_count",count).arg(count)
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
color: Theme.highlightColor
|
||||
opacity: (showCount && count > 0) ? 1 : 0
|
||||
visible: opacity > 0
|
||||
Behavior on opacity { FadeAnimation {} }
|
||||
visible: (showCount && needed && count > 0) ? 1 : 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -131,6 +131,14 @@ Item {
|
|||
enabled: currentShelf && (currentShelf.count > 0)
|
||||
onClicked: storageModel.setDeleteAllRequest(storageListWatcher.currentIndex, true)
|
||||
}
|
||||
MenuLabel {
|
||||
//: Number of books in the storage header
|
||||
//% "%0 book(s)"
|
||||
text: qsTrId("harbour-books-storage-book_count",bookCount).arg(bookCount)
|
||||
visible: !bookCountVisible && bookCount > 0
|
||||
readonly property int bookCount: storageList.currentItem ? storageList.currentItem.bookCount : 0
|
||||
readonly property bool bookCountVisible: storageList.currentItem && storageList.currentItem.bookCountVisible
|
||||
}
|
||||
}
|
||||
|
||||
onEditModeChanged: {
|
||||
|
|
Loading…
Reference in a new issue