summaryrefslogtreecommitdiffstats
path: root/src/interfaceframework/qifpagingmodel_p.h
blob: b35539ca183c0a412476820912fb23aff9350dca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QIFPAGINGMODEL_P_H
#define QIFPAGINGMODEL_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <QtInterfaceFramework/private/qifabstractfeaturelistmodel_p.h>
#include <private/qtifglobal_p.h>

#include "qifpagingmodel.h"
#include "qifpagingmodelinterface.h"
#include "qifstandarditem.h"

#include <QtCore/QBitArray>
#include <QtCore/QUuid>

QT_BEGIN_NAMESPACE

class Q_QTINTERFACEFRAMEWORK_EXPORT QIfPagingModelPrivate : public QIfAbstractFeatureListModelPrivate
{
public:
    QIfPagingModelPrivate(const QString &interface, QIfPagingModel *model);
    ~QIfPagingModelPrivate() override;

    void initialize() override;
    void onInitializationDone();
    void onCapabilitiesChanged(QUuid identifier, QtInterfaceFrameworkModule::ModelCapabilities capabilities);
    void onDataFetched(QUuid identifier, const QList<QVariant> &items, int start, bool moreAvailable);
    void onCountChanged(QUuid identifier, int new_length);
    void onDataChanged(QUuid identifier, const QList<QVariant> &data, int start, int count);
    void onFetchMoreThresholdReached();
    virtual void resetModel();
    virtual void clearToDefaults();
    const QIfStandardItem *itemAt(int i) const;
    void fetchData(int startIndex);

    QIfPagingModelInterface *backend() const;

    QIfPagingModel * const q_ptr;
    Q_DECLARE_PUBLIC(QIfPagingModel)

    QtInterfaceFrameworkModule::ModelCapabilities m_capabilities;
    int m_chunkSize;

    QList<QVariant> m_itemList;
    QBitArray m_availableChunks;
    bool m_moreAvailable;

    QUuid m_identifier;
    int m_fetchMoreThreshold;
    int m_fetchedDataCount;
    QIfPagingModel::LoadingType m_loadingType;
};

QT_END_NAMESPACE

#endif // QIFPAGINGMODEL_P_H