<commit_before>/****************************************************************************
 *   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 Snowshoe 1.0

Item {
    id: pagedGrid

    // Read/write properties.
    property QtObject model: null
    property Component delegate: null
    property Component emptyItemDelegate: null
    property int extraMargin: 40
    property int itemWidth: 192
    property int itemHeight: 263

    property int rowsPerPage: 2
    property int columnsPerPage: 2
    property int spacing: 16
    property int currentPage: 0
    property int maxPages: 1

    // Read only properties.
    property int page: 0
    property int pageWidth: columnsPerPage * itemWidth + (columnsPerPage - 1) * spacing
    property int pageHeight: rowsPerPage * itemHeight + (rowsPerPage - 1) * spacing
    property int itemsPerPage: rowsPerPage * columnsPerPage
    property alias pageCount: grid.pageCount

    width: grid.pageWidth + 2 * extraMargin
    height: grid.pageHeight
    clip: true

    // x and y will be given in coordinates relative to the clicked item.
    signal itemClicked(int index, int x, int y);

    function itemAt(index) {
        return grid.itemAt(index)
    }

    PageFillGrid {
        id: grid
        model: pagedGrid.model
        delegate: pagedGrid.delegate
        spacing: pagedGrid.spacing
        itemWidth: pagedGrid.itemWidth<commit_msg>Fixed tabs pager to automatically scroll out of an empty page.<commit_after>/****************************************************************************
 *   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 Snowshoe 1.0

Item {
    id: pagedGrid

    // Read/write properties.
    property QtObject model: null
    property Component delegate: null
    property Component emptyItemDelegate: null
    property int extraMargin: 40
    property int itemWidth: 192
    property int itemHeight: 263

    property int rowsPerPage: 2
    property int columnsPerPage: 2
    property int spacing: 16
    property int currentPage: 0
    property int maxPages: 1

    // Read only properties.
    property int page: 0
    property int pageWidth: columnsPerPage * itemWidth + (columnsPerPage - 1) * spacing
    property int pageHeight: rowsPerPage * itemHeight + (rowsPerPage - 1) * spacing
    property int itemsPerPage: rowsPerPage * columnsPerPage
    property alias pageCount: grid.pageCount

    width: grid.pageWidth + 2 * extraMargin
    height: grid.pageHeight
    clip: true

    // x and y will be given in coordinates relative to the clicked item.
    signal itemClicked(int index, int x, int y);

    function itemAt(index) {
        return grid.itemAt(index)
    }

    onPageCountChanged: {
        if (pageCount === currentPage && currentPage > 0)
            --currentPage;
    }

    PageFillGrid {
        id: grid
        model: pagedGrid.model
        delegate: pagedGrid.delegate
        spacing: pagedGrid.spacing
        itemWidth: pagedGrid.itemWidth
{'fraction_non_alphanumeric': 0.11373011196228638, 'fraction_numerical': 0.012767629149479473, 'mean_word_length': 2.249521378430121, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7122667', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1185, 'n_words': 486}