You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Code/Tools/AssetProcessor/native/AssetManager/assetScannerWorker.h

65 lines
2.6 KiB
C++

/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#ifndef ASSETSCANNERWORKER_H
#define ASSETSCANNERWORKER_H
#if !defined(Q_MOC_RUN)
#include "native/assetprocessor.h"
#include "assetScanFolderInfo.h"
#include <QString>
#include <QSet>
#include <QObject>
#endif
namespace AssetProcessor
{
class PlatformConfiguration;
/** This Class is actually responsible for scanning the game folder
* and finding file of interest files.
* Its created on the main thread and then moved to the worker thread
* so it should contain no QObject-based classes at construction time (it can make them later)
*/
class AssetScannerWorker
: public QObject
{
Q_OBJECT
public:
explicit AssetScannerWorker(PlatformConfiguration* config, QObject* parent = 0);
Q_SIGNALS:
void ScanningStateChanged(AssetProcessor::AssetScanningStatus status);
void FilesFound(QSet<AssetFileInfo> files); // QSet<QString> is a refcounted copy-on-write object, do not pass by ref.
void FoldersFound(QSet<AssetFileInfo> folders); // QSet<QString> is a refcounted copy-on-write object, do not pass by ref.
void ExcludedFound(QSet<AssetFileInfo> excluded); // QSet<QString> is a refcounted copy-on-write object, do not pass by ref.
public Q_SLOTS:
void StartScan();
void StopScan();
protected:
// scanFolderInfo - the folder we're currently scanning (this will sometimes be a fake scanfolder created when recursing through directories)
// rootScanFolder - the actual scan folder we started with, which will either be the same as scanFolderInfo or a parent folder
void ScanForSourceFiles(const ScanFolderInfo& scanFolderInfo, const ScanFolderInfo& rootScanFolder);
void EmitFiles();
private:
volatile bool m_doScan = true;
QSet<AssetFileInfo> m_fileList; // note: neither QSet nor QString are qobject-derived
QSet<AssetFileInfo> m_folderList;
QSet<AssetFileInfo> m_excludedList;
PlatformConfiguration* m_platformConfiguration;
};
} // end namespace AssetProcessor
#endif // ASSETSCANNERWORKER_H