Files
o3de/Code/Tools/ProjectManager/Source/PathValidator.h
T
Steve Pham 38261d0800 Shorten copyright headers by splitting into 2 lines (#2213)
* Updated all copyright headers to split the longer original copyright line into 2 shorter lines

Signed-off-by: Steve Pham <spham@amazon.com>
2021-07-16 15:25:48 -07:00

42 lines
1.2 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <QValidator>
#endif
QT_FORWARD_DECLARE_CLASS(QWidget)
namespace O3DE::ProjectManager
{
class PathValidator
: public QValidator
{
public:
enum class PathMode {
ExistingFile, //!< A single, existings file. Useful for "Open file"
ExistingFolder, //!< A single, existing directory. Useful for "Open Folder"
AnyFile //!< A single, valid file, doesn't have to exist but the directory must. Useful for "Save File"
};
explicit PathValidator(PathMode pathMode, QWidget* parent = nullptr);
~PathValidator() = default;
void setAllowEmpty(bool allowEmpty);
void setPathMode(PathMode pathMode);
QValidator::State validate(QString &text, int &) const override;
private:
PathMode m_pathMode = PathMode::AnyFile;
bool m_allowEmpty = false;
};
} // namespace O3DE::ProjectManager