-
Notifications
You must be signed in to change notification settings - Fork 89
[sailfish-browser] Use a press and hold scheme in tab list to switch … #959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,8 @@ SilicaGridView { | |
| : parent.width < 2 * parent.height | ||
| ? parent.width <= height ? 1 : 2 : 3 | ||
| readonly property real thumbnailWidth: (parent.width - Theme.horizontalPageMargin * 2 - (Theme.paddingLarge * (columns - 1))) / columns | ||
| readonly property real _tabScale: housekeeping ? 0.9 : 1.0 | ||
| property bool housekeeping | ||
|
|
||
| signal hide | ||
| signal enterNewTabUrl | ||
|
|
@@ -66,21 +68,69 @@ SilicaGridView { | |
| cellWidth: thumbnailWidth + Theme.paddingLarge | ||
| cellHeight: thumbnailHeight + Theme.paddingLarge | ||
|
|
||
| delegate: TabItem { | ||
| id: tabItem | ||
| delegate: Item { | ||
| id: item | ||
|
|
||
| enabled: !closingAllTabs | ||
| opacity: enabled ? 1.0 : 0.0 | ||
| opacity: !closingAllTabs ? 1.0 : 0.0 | ||
| Behavior on opacity { FadeAnimator {}} | ||
|
|
||
| width: thumbnailWidth | ||
| height: thumbnailHeight | ||
|
|
||
| scale: tabGridView._tabScale | ||
| Behavior on scale { SmoothedAnimation {duration: 200; velocity: -1} } | ||
|
|
||
| GridView.onAdd: AddAnimation { | ||
| target: tabItem | ||
| target: item | ||
| } | ||
| GridView.onRemove: RemoveAnimation { | ||
| target: tabItem | ||
| target: item | ||
| } | ||
|
|
||
| TabItem { | ||
| id: tabItem | ||
| anchors.fill: parent | ||
| enabled: !closingAllTabs | ||
| showClose: !tabGridView.housekeeping | ||
|
|
||
| onClicked: { | ||
| if (tabGridView.housekeeping) { | ||
| tabGridView.housekeeping = false | ||
| } else { | ||
| activateTab(index) | ||
| } | ||
| } | ||
| onPressAndHold: tabGridView.housekeeping = true | ||
| onCloseClicked: closeTab(index) | ||
| } | ||
| Rectangle { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This Rectangle & Image & MouseArea should really be an Rectangle & IconButton. IconButton will handle highlighting of the icon. The background Rectangle can be pretty much like already declared (small remark below).
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good advice, thanks. I'm using an IconButton as done before in TabItem.qml. |
||
| color: Theme.colorScheme === Theme.LightOnDark | ||
| ? closeButton.down ? Theme.highlightColor : Theme.primaryColor | ||
| : closeButton.down ? Theme.highlightDimmerColor : Theme.highlightBackgroundColor | ||
| width: Theme.iconSizeMedium | ||
| height: width | ||
| radius: width / 2. | ||
| anchors.horizontalCenter: parent.horizontalCenter | ||
| anchors.verticalCenter: parent.bottom | ||
| opacity: tabGridView.housekeeping ? 1.0 : 0.0 | ||
| visible: opacity > 0. | ||
| Behavior on opacity { FadeAnimation { } } | ||
|
|
||
| IconButton { | ||
| id: closeButton | ||
| anchors.centerIn: parent | ||
| icon.color: Theme.colorScheme === Theme.LightOnDark | ||
| ? Theme.highlightBackgroundColor : Theme.lightPrimaryColor | ||
| icon.highlightColor: Theme.colorScheme === Theme.LightOnDark | ||
| ? Theme.highlightDimmerColor : Theme.darkSecondaryColor | ||
| icon.highlighted: down | ||
| icon.source: "image://theme/icon-close-app" | ||
| enabled: !closingAllTabs && tabGridView.housekeeping | ||
| onClicked: { | ||
| tabItem.markClosed() | ||
| closeTab(index) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -90,7 +140,7 @@ SilicaGridView { | |
| z: -1 | ||
| width: tabGridView.width | ||
| height: tabGridView.height | ||
| onClicked: hide() | ||
| onClicked: tabGridView.housekeeping = false | ||
| } | ||
| ] | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.