File indexing completed on 2024-05-12 04:44:29
0001 // SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com> 0002 // SPDX-License-Identifier: BSD-2-Clause OR MIT 0003 0004 #ifndef ASYNCIMAGEPROVIDERBASE_H 0005 #define ASYNCIMAGEPROVIDERBASE_H 0006 0007 #include <qglobal.h> 0008 #include <qobject.h> 0009 0010 #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) 0011 #include <qtmetamacros.h> 0012 #else 0013 #include <qobjectdefs.h> 0014 #include <qstring.h> 0015 #endif 0016 0017 namespace PerceptualColor 0018 { 0019 /** @internal 0020 * 0021 * @brief Base class for @ref AsyncImageProvider. 0022 * 0023 * @internal 0024 * 0025 * @note <a href="https://stackoverflow.com/a/63021891">The <tt>Q_OBJECT</tt> 0026 * macro and templates cannot be combined.</a> Therefore, 0027 * @ref AsyncImageProviderBase serves as a base class to provide 0028 * signals for @ref AsyncImageProvider. */ 0029 class AsyncImageProviderBase : public QObject 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 Q_INVOKABLE explicit AsyncImageProviderBase(QObject *parent = nullptr); 0035 virtual ~AsyncImageProviderBase() noexcept override; 0036 0037 Q_SIGNALS: 0038 /** @brief Signals that the background rendering has completed an 0039 * interlacing pass. 0040 * 0041 * New image data is available now at @ref AsyncImageProvider::getCache(). 0042 * 0043 * @note Even after changing image parameters with 0044 * @ref AsyncImageProvider::setImageParameters() a possibly 0045 * running render process might not stop immediately and continue 0046 * to deliver data, therefore also emitting this signal. 0047 * 0048 * @sa @ref AsyncImageProvider::refreshAsync() */ 0049 void interlacingPassCompleted(); 0050 0051 private: 0052 Q_DISABLE_COPY(AsyncImageProviderBase) 0053 0054 /** @internal @brief Only for unit tests. */ 0055 friend class TestAsyncImageProviderBase; 0056 }; 0057 0058 } // namespace PerceptualColor 0059 0060 #endif // ASYNCIMAGEPROVIDERBASE_H