Warning, file /office/calligra/libs/widgets/KoResourceServerProvider.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 0003 Copyright (c) 1999 Matthias Elter <elter@kde.org> 0004 Copyright (c) 2003 Patrick Julien <freak@codepimps.org> 0005 Copyright (c) 2005 Sven Langkamp <sven.langkamp@gmail.com> 0006 0007 This library is free software; you can redistribute it and/or 0008 modify it under the terms of the GNU Lesser General Public 0009 License as published by the Free Software Foundation; either 0010 version 2.1 of the License, or (at your option) any later version. 0011 0012 This library 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, write to the Free Software 0019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 0020 */ 0021 0022 #ifndef KORESOURCESERVERPROVIDER_H 0023 #define KORESOURCESERVERPROVIDER_H 0024 0025 #include <kowidgets_export.h> 0026 0027 #include <QThread> 0028 0029 #include <WidgetsDebug.h> 0030 0031 #include "KoResourceServer.h" 0032 #include "KoPattern.h" 0033 #include "KoAbstractGradient.h" 0034 #include "KoColorSet.h" 0035 0036 /** 0037 * KoResourceLoaderThread allows threaded loading of the resources of a resource server 0038 */ 0039 class KOWIDGETS_EXPORT KoResourceLoaderThread : public QThread { 0040 0041 Q_OBJECT 0042 public: 0043 0044 /** 0045 * Constructs a KoResourceLoaderThread for a server 0046 * @param server the server the resources will be loaded for 0047 */ 0048 explicit KoResourceLoaderThread(KoResourceServerBase *server); 0049 ~KoResourceLoaderThread() override = default; 0050 public Q_SLOTS: 0051 /** 0052 * Checks whether the thread has finished loading and waits 0053 * until it is finished if necessary 0054 */ 0055 void barrier(); 0056 0057 protected: 0058 /** 0059 * Overridden from QThread 0060 */ 0061 void run() override; 0062 0063 private: 0064 0065 KoResourceServerBase * m_server; 0066 QStringList m_fileNames; 0067 }; 0068 0069 0070 /** 0071 * Provides default resource servers for gradients, patterns and palettes 0072 */ 0073 class KOWIDGETS_EXPORT KoResourceServerProvider : public QObject 0074 { 0075 Q_OBJECT 0076 0077 public: 0078 KoResourceServerProvider(); 0079 ~KoResourceServerProvider() override; 0080 0081 static KoResourceServerProvider* instance(); 0082 0083 KoResourceServer<KoPattern>* patternServer(bool block = true); 0084 KoResourceServer<KoAbstractGradient>* gradientServer(bool block = true); 0085 KoResourceServer<KoColorSet>* paletteServer(bool block = true); 0086 0087 private: 0088 KoResourceServerProvider(const KoResourceServerProvider&); 0089 KoResourceServerProvider operator=(const KoResourceServerProvider&); 0090 0091 private: 0092 struct Private; 0093 Private* const d; 0094 }; 0095 0096 #endif // KORESOURCESERVERPROVIDER_H