File indexing completed on 2024-12-22 04:13:16

0001 /*
0002  *  SPDX-FileCopyrightText: 2022 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 #ifndef KISLODAVAILABILITYMODEL_H
0007 #define KISLODAVAILABILITYMODEL_H
0008 
0009 #include <lager/cursor.hpp>
0010 #include <lager/extra/qt.hpp>
0011 
0012 #include "KisLodAvailabilityData.h"
0013 #include <kis_paintop_lod_limitations.h>
0014 
0015 class KisLodAvailabilityModel : public QObject
0016 {
0017     Q_OBJECT
0018 public:
0019     enum AvailabilityState {
0020         Available = 0,
0021         Limited,
0022         BlockedByThreshold,
0023         BlockedFully
0024     };
0025 
0026     using AvailabilityStatePack =
0027         std::tuple<AvailabilityState, KisPaintopLodLimitations, bool>;
0028 public:
0029     KisLodAvailabilityModel(lager::cursor<KisLodAvailabilityData> data,
0030                             lager::reader<qreal> effectiveBrushSize,
0031                             lager::reader<KisPaintopLodLimitations> lodLimitations);
0032 
0033     lager::cursor<KisLodAvailabilityData> data;
0034     lager::reader<qreal> effectiveBrushSize;
0035     lager::reader<KisPaintopLodLimitations> lodLimitations;
0036 
0037     LAGER_QT_CURSOR(bool, isLodUserAllowed);
0038     LAGER_QT_READER(bool, isLodSizeThresholdSupported);
0039     LAGER_QT_CURSOR(qreal, lodSizeThreshold);
0040 
0041     LAGER_QT_READER(AvailabilityStatePack, availabilityState);
0042     LAGER_QT_READER(bool, effectiveLodAvailable);
0043 
0044 Q_SIGNALS:
0045     void sigConfigurationItemChanged();
0046 };
0047 
0048 #endif // KISLODAVAILABILITYMODEL_H