assetScanner.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #ifndef ASSETSCANNER_H
  9. #define ASSETSCANNER_H
  10. #if !defined(Q_MOC_RUN)
  11. #include "native/assetprocessor.h"
  12. #include "assetScannerWorker.h"
  13. #include "assetScanFolderInfo.h"
  14. #include <QString>
  15. #include <QThread>
  16. #include <QList>
  17. #endif
  18. namespace AssetProcessor
  19. {
  20. class PlatformConfiguration;
  21. /** This Class is responsible for scanning for assets at startup
  22. */
  23. class AssetScanner
  24. : public QObject
  25. {
  26. Q_OBJECT
  27. public:
  28. explicit AssetScanner(PlatformConfiguration* config, QObject* parent = nullptr);
  29. virtual ~AssetScanner();
  30. void StartScan();//Should be called to start a scan
  31. void StopScan();//Should be called to stop a scan
  32. Q_INVOKABLE AssetScanningStatus status() const;
  33. Q_SIGNALS:
  34. void AssetScanningStatusChanged(AssetScanningStatus status);
  35. void FilesFound(QSet<AssetFileInfo> files);
  36. void FoldersFound(QSet<AssetFileInfo> folders);
  37. void ExcludedFound(QSet<AssetFileInfo> excluded);
  38. private:
  39. QThread m_assetWorkerScannerThread;
  40. AssetScannerWorker m_assetScannerWorker;
  41. bool m_workerCreated = false;
  42. AZStd::atomic<AssetScanningStatus> m_status;
  43. };
  44. }// end namespace AssetProcessor
  45. #endif // ASSETSCANNER_H