aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qnx/qnxdeployqtlibrariesdialog.h
blob: 2cb9e3c94d81533ed1cb29aa4bd347a38eb3a2af (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
71
72
73
74
75
76
77
78
79
80
81
// Copyright (C) 2016 BlackBerry Limited. All rights reserved.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QDialog>

#include <projectexplorer/devicesupport/idevicefwd.h>
#include <utils/qtcprocess.h>

QT_BEGIN_NAMESPACE
class QComboBox;
class QLabel;
class QLineEdit;
class QPlainTextEdit;
class QProgressBar;
QT_END_NAMESPACE

namespace ProjectExplorer { class DeployableFile; }
namespace RemoteLinux { class GenericDirectUploadService; }

namespace Qnx::Internal {

class QnxDeployQtLibrariesDialog : public QDialog
{
public:
    enum State {
        Inactive,
        CheckingRemoteDirectory,
        RemovingRemoteDirectory,
        Uploading
    };

    explicit QnxDeployQtLibrariesDialog(const ProjectExplorer::IDeviceConstPtr &device,
                                        QWidget *parent = nullptr);
    ~QnxDeployQtLibrariesDialog() override;

    int execAndDeploy(int qtVersionId, const QString &remoteDirectory);

protected:
    void closeEvent(QCloseEvent *event) override;

private:
    void deployLibraries();
    void updateProgress(const QString &progressMessage);
    void handleUploadFinished();

    void startCheckDirProcess();
    void startRemoveDirProcess();

    void handleCheckDirDone();
    void handleRemoveDirDone();
    bool handleError(const Utils::QtcProcess &process);

    QList<ProjectExplorer::DeployableFile> gatherFiles();
    QList<ProjectExplorer::DeployableFile> gatherFiles(const QString &dirPath,
            const QString &baseDir = QString(),
            const QStringList &nameFilters = QStringList());

    QString fullRemoteDirectory() const;
    void startUpload();

    QComboBox *m_qtLibraryCombo;
    QPushButton *m_deployButton;
    QLabel *m_basePathLabel;
    QLineEdit *m_remoteDirectory;
    QProgressBar *m_deployProgress;
    QPlainTextEdit *m_deployLogWindow;
    QPushButton *m_closeButton;

    Utils::QtcProcess m_checkDirProcess;
    Utils::QtcProcess m_removeDirProcess;
    RemoteLinux::GenericDirectUploadService *m_uploadService;

    ProjectExplorer::IDeviceConstPtr m_device;

    int m_progressCount = 0;
    State m_state = Inactive;
};

} // Qnx::Internal