File indexing completed on 2024-05-12 15:59:57

0001 /* This file is part of the KDE project
0002 
0003    SPDX-FileCopyrightText: 2014 Sven Langkamp <sven.langkamp@gmail.com>
0004    SPDX-FileCopyrightText: 2019 Boudewijn Rempt <boud@valdyas.org>
0005 
0006    SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KISRESOURCEITEMCHOOSERSYNC_H
0010 #define KISRESOURCEITEMCHOOSERSYNC_H
0011 
0012 #include <QObject>
0013 #include <QScopedPointer>
0014 
0015 #include "kritaresourcewidgets_export.h"
0016 
0017 /**
0018  * KisResourceItemChooserSync is a singleton that syncs the size of entries in the
0019  * resource item choosers between different choosers
0020  * To use the syncing it has to be turned on in the KisResourceItemChooser
0021  */
0022 class KRITARESOURCEWIDGETS_EXPORT KisResourceItemChooserSync : public QObject
0023 {
0024     Q_OBJECT
0025 public:
0026     KisResourceItemChooserSync();
0027     ~KisResourceItemChooserSync() override;
0028     static KisResourceItemChooserSync* instance();
0029 
0030     /// Gets the base length
0031     /// @returns the base length of items
0032     int baseLength();
0033 
0034     /// Set the base length 
0035     /// @param length base length for the items, will be clamped if outside range
0036     void setBaseLength(int length);
0037     
0038 Q_SIGNALS:
0039     /// Signal is emitted when the base length is changed and will trigger and update in
0040     /// the resource item choosers
0041     void baseLengthChanged(int length);
0042     
0043 private:
0044 
0045     KisResourceItemChooserSync(const KisResourceItemChooserSync&);
0046     KisResourceItemChooserSync operator=(const KisResourceItemChooserSync&);
0047 
0048 private:
0049     struct Private;
0050     const QScopedPointer<Private> d;
0051 };
0052 
0053 #endif // KORESOURCEITEMCHOOSERSYNC_H