summaryrefslogtreecommitdiffstats
path: root/src/mobile/qml/TabsPanel.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/mobile/qml/TabsPanel.qml')
-rw-r--r--src/mobile/qml/TabsPanel.qml114
1 files changed, 114 insertions, 0 deletions
diff --git a/src/mobile/qml/TabsPanel.qml b/src/mobile/qml/TabsPanel.qml
new file mode 100644
index 0000000..4881479
--- /dev/null
+++ b/src/mobile/qml/TabsPanel.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+ * Copyright (C) 2012 Instituto Nokia de Tecnologia (INdT) *
+ * *
+ * This file may be used under the terms of the GNU Lesser *
+ * General Public License version 2.1 as published by the Free Software *
+ * Foundation and appearing in the file LICENSE.LGPL included in the *
+ * packaging of this file. Please review the following information to *
+ * ensure the GNU Lesser General Public License version 2.1 requirements *
+ * will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. *
+ * *
+ * 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 Lesser General Public License for more details. *
+ ****************************************************************************/
+
+import QtQuick 2.0
+import "UiConstants.js" as UiConstants
+
+Item {
+ id: root
+ height: pagedGrid.height + 25 + indicatorRow.height
+
+ IndicatorRow {
+ id: indicatorRow
+ anchors {
+ bottom: root.bottom
+ left: root.left
+ right: root.right
+ }
+ itemCount: pagedGrid.pageCount
+ maxItems: UiConstants.TabsMaxPages
+ currentItem: pagedGrid.currentPage
+ }
+
+ Component {
+ id: pagedItemDelegate
+ Image {
+ property string url: model.url
+ property bool fadeUrl: false
+ source: model.screenshot
+ height: UiConstants.PagedGridSizeTable[1]
+ fillMode: Image.Pad
+ verticalAlignment: Image.AlignBottom
+ clip: true
+
+ Text {
+ text: index + (pagedGrid.currentPage * 4) + 1
+ color: "#C1C2C3"
+ font.pixelSize: 30
+ font.family: "Nokia Pure Headline Light"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors {
+ top: parent.top
+ bottom: parent.bottom
+ left: parent.left
+ right: parent.right
+ topMargin: 108
+ bottomMargin: 103
+ leftMargin: 69
+ rightMargin: 62
+ }
+ }
+
+ Text {
+ id: displayedUrl
+ text: url.replace(/(https?|file):\/\/\/?(www\.)?/, "").replace(/\/.*/, "");
+ color: "#515050"
+ horizontalAlignment: fadeUrl ? Text.AlignLeft : Text.AlignHCenter
+ font.pixelSize: 20
+ font.family: "Nokia Pure Text Light"
+ anchors {
+ bottom: parent.bottom
+ left: parent.left
+ right: parent.right
+ bottomMargin: 10
+ leftMargin: 14
+ rightMargin: 14
+ }
+ onWidthChanged: fadeUrl = paintedWidth > width
+ }
+ Image {
+ id: urlFade
+ source: "qrc:///mobile/grid/overlayer_tabs_url"
+ visible: fadeUrl
+ anchors {
+ bottom: parent.bottom
+ right: parent.right
+ }
+ }
+ }
+ }
+
+ PagedGrid {
+ id: pagedGrid
+ model: TabsModel
+ delegate: pagedItemDelegate
+ emptyItemDelegate: Image { source: "qrc:///mobile/grid/thumb_empty_slot" }
+ maxPages: indicatorRow.maxItems
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: parent.top
+ }
+ onItemClicked: {
+ if (y < UiConstants.PagedGridCloseButtonHeight
+ && (UiConstants.PagedGridSizeTable[0] - x) <= UiConstants.PagedGridCloseButtonWidth) {
+ TabsModel.remove(index);
+ } else
+ TabsModel.currentWebViewIndex = index;
+ }
+ }
+}