File indexing completed on 2024-04-28 05:47:24

0001 /*****************************************************************************
0002  *   Copyright 2013 - 2015 Yichao Yu <yyc1992@gmail.com>                     *
0003  *                                                                           *
0004  *   This program is free software; you can redistribute it and/or modify    *
0005  *   it under the terms of the GNU Lesser General Public License as          *
0006  *   published by the Free Software Foundation; either version 2.1 of the    *
0007  *   License, or (at your option) version 3, or any later version accepted   *
0008  *   by the membership of KDE e.V. (or its successor approved by the         *
0009  *   membership of KDE e.V.), which shall act as a proxy defined in          *
0010  *   Section 6 of version 3 of the license.                                  *
0011  *                                                                           *
0012  *   This program is distributed in the hope that it will be useful,         *
0013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
0014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       *
0015  *   Lesser General Public License for more details.                         *
0016  *                                                                           *
0017  *   You should have received a copy of the GNU Lesser General Public        *
0018  *   License along with this library. If not,                                *
0019  *   see <http://www.gnu.org/licenses/>.                                     *
0020  *****************************************************************************/
0021 
0022 #ifndef __QTCURVE_PLUTIN_H__
0023 #define __QTCURVE_PLUTIN_H__
0024 
0025 #include <QStylePlugin>
0026 #include <QList>
0027 #include <mutex>
0028 
0029 namespace QtCurve {
0030 class Style;
0031 
0032 class StylePlugin: public QStylePlugin {
0033     Q_OBJECT
0034     Q_PLUGIN_METADATA(IID QStyleFactoryInterface_iid FILE "qtcurvestyle.json")
0035 public:
0036     QStyle *create(const QString &key) override;
0037     ~StylePlugin();
0038 private:
0039     void init();
0040     bool m_eventNotifyCallbackInstalled = false;
0041     std::once_flag m_ref_flag;
0042 private slots:
0043     void unregisterCallback();
0044 protected:
0045     QList<Style*> m_styleInstances;
0046     friend class Style;
0047 };
0048 }
0049 
0050 #endif