feat: show favorites bar when setting is enabled
This commit is contained in:
parent
16f5c2fb1a
commit
1ead1c3db5
|
@ -15,12 +15,14 @@ Rectangle {
|
|||
|
||||
id: root
|
||||
width: parent.width
|
||||
height: 45
|
||||
height: barRow.height + favoritesBarLoader.height
|
||||
color: Style.current.background
|
||||
border.width: 0
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
id: barRow
|
||||
width: parent.width
|
||||
height: 45
|
||||
spacing: root.innerMargin
|
||||
|
||||
Menu {
|
||||
|
@ -219,6 +221,21 @@ Rectangle {
|
|||
padding: 6
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: favoritesBarLoader
|
||||
active: appSettings.showFavoritesBar
|
||||
height: active ? item.height : 0
|
||||
anchors.top: barRow.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Style.current.smallPadding
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Style.current.smallPadding
|
||||
|
||||
sourceComponent: Component {
|
||||
FavoritesBar {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -650,46 +650,12 @@ Rectangle {
|
|||
anchors.topMargin: 60
|
||||
}
|
||||
|
||||
Item {
|
||||
FavoritesList {
|
||||
id: bookmarkListContainer
|
||||
anchors.horizontalCenter: emptyPageImage.horizontalCenter
|
||||
anchors.top: emptyPageImage.bottom
|
||||
anchors.topMargin: 30
|
||||
width: parent.width - Style.current.bigPadding * 2
|
||||
|
||||
ListView {
|
||||
id: bookmarkList
|
||||
model: browserModel.bookmarks
|
||||
spacing: Style.current.padding
|
||||
orientation : ListView.Horizontal
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.horizontalCenterOffset: -(addBookmarkBtn.width + spacing) /2
|
||||
width: Math.min(childrenRect.width, parent.width - addBookmarkBtn.width - spacing)
|
||||
delegate: BookmarkButton {
|
||||
id: bookmarkBtn
|
||||
text: name
|
||||
onClicked: {
|
||||
currentWebView.url = determineRealURL(url)
|
||||
}
|
||||
source: imageUrl
|
||||
onRightClicked: {
|
||||
favoriteMenu.url = url
|
||||
favoriteMenu.x = bookmarkList.x + bookmarkBtn.x + mouse.x
|
||||
favoriteMenu.y = Qt.binding(function () {return bookmarkListContainer.y + mouse.y + favoriteMenu.height})
|
||||
favoriteMenu.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BookmarkButton {
|
||||
id: addBookmarkBtn
|
||||
text: qsTr("Add favorite")
|
||||
onClicked: {
|
||||
addFavoriteModal.open()
|
||||
}
|
||||
anchors.left: bookmarkList.right
|
||||
anchors.leftMargin: bookmarkList.spacing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
import QtQuick 2.13
|
||||
import QtQuick.Layouts 1.13
|
||||
import "../../../shared"
|
||||
import "../../../shared/status"
|
||||
import "../../../imports"
|
||||
|
||||
RowLayout {
|
||||
id: favoritesBar
|
||||
spacing: 0
|
||||
height: 38
|
||||
|
||||
ListView {
|
||||
id: bookmarkList
|
||||
model: browserModel.bookmarks
|
||||
spacing: Style.current.halfPadding
|
||||
orientation : ListView.Horizontal
|
||||
height: parent.height
|
||||
clip: true
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||
width: parent.width
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
delegate: StatusButton {
|
||||
id: favoriteBtn
|
||||
height: 32
|
||||
icon.source: imageUrl
|
||||
disableColorOverlay: true
|
||||
icon.width: 24
|
||||
icon.height: 24
|
||||
text: name
|
||||
implicitHeight: 32
|
||||
type: "secondary"
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
z: 51
|
||||
onClicked: function (mouse) {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
favoriteMenu.url = url
|
||||
favoriteMenu.x = favoriteBtn.x + mouse.x
|
||||
favoriteMenu.y = Qt.binding(function () {return mouse.y + favoriteMenu.height})
|
||||
favoriteMenu.open()
|
||||
return
|
||||
}
|
||||
|
||||
currentWebView.url = determineRealURL(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
import QtQuick 2.13
|
||||
import "../../../shared"
|
||||
import "../../../shared/status"
|
||||
import "../../../imports"
|
||||
import "./components"
|
||||
|
||||
Item {
|
||||
id: bookmarkListContainer
|
||||
|
||||
ListView {
|
||||
id: bookmarkList
|
||||
model: browserModel.bookmarks
|
||||
spacing: Style.current.padding
|
||||
orientation : ListView.Horizontal
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.horizontalCenterOffset: -(addBookmarkBtn.width + spacing) /2
|
||||
width: Math.min(childrenRect.width, parent.width - addBookmarkBtn.width - spacing)
|
||||
delegate: BookmarkButton {
|
||||
id: bookmarkBtn
|
||||
text: name
|
||||
onClicked: {
|
||||
currentWebView.url = determineRealURL(url)
|
||||
}
|
||||
source: imageUrl
|
||||
onRightClicked: {
|
||||
favoriteMenu.url = url
|
||||
favoriteMenu.x = bookmarkList.x + bookmarkBtn.x + mouse.x
|
||||
favoriteMenu.y = Qt.binding(function () {return bookmarkListContainer.y + mouse.y + favoriteMenu.height})
|
||||
favoriteMenu.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BookmarkButton {
|
||||
id: addBookmarkBtn
|
||||
text: qsTr("Add favorite")
|
||||
onClicked: {
|
||||
addFavoriteModal.open()
|
||||
}
|
||||
anchors.left: bookmarkList.right
|
||||
anchors.leftMargin: bookmarkList.spacing
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ Item {
|
|||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onClicked: {
|
||||
if (mouse.button == Qt.RightButton) {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
root.rightClicked(mouse)
|
||||
} else {
|
||||
root.clicked(mouse)
|
||||
|
|
|
@ -132,6 +132,8 @@ DISTFILES += \
|
|||
app/AppLayouts/Browser/DownloadElement.qml \
|
||||
app/AppLayouts/Browser/FaviconImage.qml \
|
||||
app/AppLayouts/Browser/FavoriteMenu.qml \
|
||||
app/AppLayouts/Browser/FavoritesBar.qml \
|
||||
app/AppLayouts/Browser/FavoritesList.qml \
|
||||
app/AppLayouts/Browser/components/BookmarkButton.qml \
|
||||
app/AppLayouts/Chat/ChatColumn/ChatComponents/ChatCommandButton.qml \
|
||||
app/AppLayouts/Chat/ChatColumn/ChatComponents/ChatCommandModal.qml \
|
||||
|
|
|
@ -12,6 +12,7 @@ Button {
|
|||
property color color: Style.current.buttonForegroundColor
|
||||
property color bgColor: Style.current.buttonBackgroundColor
|
||||
property color bgHoverColor: Qt.darker(control.bgColor, 1.1)
|
||||
property bool disableColorOverlay: false
|
||||
property int iconRotation: 0
|
||||
|
||||
id: control
|
||||
|
@ -43,9 +44,10 @@ Button {
|
|||
rotation: control.iconRotation
|
||||
|
||||
ColorOverlay {
|
||||
enabled: !control.disableColorOverlay
|
||||
anchors.fill: iconImg
|
||||
source: iconImg
|
||||
color: buttonLabel.color
|
||||
color: control.disableColorOverlay ? "transparent" : buttonLabel.color
|
||||
antialiasing: true
|
||||
smooth: true
|
||||
rotation: control.iconRotation
|
||||
|
|
Loading…
Reference in New Issue