aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/unarchiver.h
blob: 5aff2407707ead7042dd8386741c7214788c650e (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
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "utils_global.h"

#include "async.h"
#include "filepath.h"

#include <QObject>

namespace Utils {

class QTCREATOR_UTILS_EXPORT Unarchiver : public QObject
{
    Q_OBJECT

public:
    Unarchiver();

    void setArchive(const FilePath &archive);
    void setDestination(const FilePath &destination);

    Result<> result() const;

    void start();

    bool isDone() const;
    bool isCanceled() const;

signals:
    void started();
    void done(Tasking::DoneResult result);
    void progress(const FilePath &path);

private:
    Async<Result<>> m_async;

    FilePath m_archive;
    FilePath m_destination;
};

using UnarchiverTask = Tasking::SimpleCustomTask<Unarchiver>;

} // namespace Utils