File indexing completed on 2024-05-19 04:29:14
0001 /* 0002 * SPDX-FileCopyrightText: 2023 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #ifndef KISIMPORTUSERFEEDBACKINTERFACE_H 0007 #define KISIMPORTUSERFEEDBACKINTERFACE_H 0008 0009 #include <QtGlobal> 0010 #include <functional> 0011 0012 class QWidget; 0013 0014 /** 0015 * Sometimes the importing filter may face some werd issue that needs 0016 * user's input/decision. 0017 */ 0018 class KisImportUserFeedbackInterface 0019 { 0020 public: 0021 using AskCallback = std::function<bool(QWidget*)>; 0022 0023 enum Result { 0024 Success = 0, 0025 UserCancelled, 0026 SuppressedByBatchMode 0027 }; 0028 0029 public: 0030 KisImportUserFeedbackInterface() = default; 0031 0032 0033 virtual ~KisImportUserFeedbackInterface(); 0034 0035 /** 0036 * @brief ask the user a question about the loading process 0037 * 0038 * @param callback a functor that actually asks the user 0039 * @return the result of the operation 0040 */ 0041 virtual Result askUser(AskCallback callback) = 0; 0042 0043 private: 0044 #if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)) 0045 Q_DISABLE_COPY_MOVE(KisImportUserFeedbackInterface); 0046 #else 0047 KisImportUserFeedbackInterface(const KisImportUserFeedbackInterface&) = delete; 0048 KisImportUserFeedbackInterface(KisImportUserFeedbackInterface&&) = delete; 0049 #endif 0050 }; 0051 0052 #endif // KISIMPORTUSERFEEDBACKINTERFACE_H