summaryrefslogtreecommitdiff
path: root/src/package-lib/packagecreator.h
blob: 4484af4198599375b2ca3b19570fd8aaca9d23f6 (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
// 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 GPL-3.0-only

#pragma once

#include <QObject>

#include <QtAppManCommon/error.h>

QT_FORWARD_DECLARE_CLASS(QIODevice)
QT_FORWARD_DECLARE_CLASS(QDir)

QT_BEGIN_NAMESPACE_AM

class PackageCreatorPrivate;
class InstallationReport;


class PackageCreator : public QObject
{
    Q_OBJECT

public:
    PackageCreator(const QDir &sourceDir, QIODevice *output, const InstallationReport &report,
                   QObject *parent = nullptr);
    ~PackageCreator();

    QDir sourceDirectory() const;
    void setSourceDirectory(const QDir &sourceDir);

    bool create();

    QByteArray createdDigest() const;
    QVariantMap metaData() const;

    bool hasFailed() const;
    bool wasCanceled() const;

    Error errorCode() const;
    QString errorString() const;

public slots:
    void cancel();

signals:
    void progress(qreal progress);

private:
    PackageCreatorPrivate *d;

    friend class PackageCreatorPrivate;
};

QT_END_NAMESPACE_AM