File: versionlistmodel.h

package info (click to toggle)
kup-backup 0.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,576 kB
  • sloc: cpp: 8,422; xml: 311; makefile: 6; sh: 3
file content (45 lines) | stat: -rw-r--r-- 1,122 bytes parent folder | download
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
// SPDX-FileCopyrightText: 2020 Simon Persson <simon.persson@mykolab.com>
//
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL

#ifndef VERSIONLISTMODEL_H
#define VERSIONLISTMODEL_H

#include "mergedvfs.h"
#include <QAbstractListModel>

struct BupSourceInfo {
    QUrl mBupKioPath;
    QString mRepoPath;
    QString mBranchName;
    QString mPathInRepo;
    qint64 mCommitTime;
    quint64 mSize;
    bool mIsDirectory;
};

Q_DECLARE_METATYPE(BupSourceInfo)

class VersionListModel : public QAbstractListModel
{
    Q_OBJECT
public:
    explicit VersionListModel(QObject *parent = nullptr);
    void setNode(const MergedNode *pNode);
    int rowCount(const QModelIndex &pParent) const override;
    QVariant data(const QModelIndex &pIndex, int pRole) const override;

protected:
    const VersionList *mVersionList;
    const MergedNode *mNode{};
};

enum VersionDataRole {
    VersionBupUrlRole = Qt::UserRole + 1, // QUrl
    VersionMimeTypeRole, // QString
    VersionSizeRole, // quint64
    VersionSourceInfoRole, // PathInfo
    VersionIsDirectoryRole // bool
};

#endif // VERSIONLISTMODEL_H