DownloadWorker.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #if !defined(Q_MOC_RUN)
  10. #include <AzCore/Outcome/Outcome.h>
  11. #endif
  12. #include <DownloadController.h>
  13. QT_FORWARD_DECLARE_CLASS(QProcess)
  14. namespace O3DE::ProjectManager
  15. {
  16. class DownloadWorker : public QObject
  17. {
  18. // Download was cancelled
  19. inline static const QString DownloadCancelled = QObject::tr("Download Cancelled.");
  20. Q_OBJECT
  21. public:
  22. explicit DownloadWorker();
  23. ~DownloadWorker() = default;
  24. public slots:
  25. void StartDownload();
  26. void SetObjectToDownload(
  27. const QString& objectName, const QString& destinationPath, DownloadController::DownloadObjectType objectType, bool downloadNow = true);
  28. signals:
  29. void UpdateProgress(int bytesDownloaded, int totalBytes);
  30. void Done(QString result = "", QString detailedResult = "");
  31. private:
  32. QString m_objectName;
  33. QString m_destinationPath;
  34. DownloadController::DownloadObjectType m_downloadType;
  35. };
  36. } // namespace O3DE::ProjectManager