File indexing completed on 2024-04-28 15:51:36
0001 /* 0002 SPDX-FileCopyrightText: 2007 Pino Toscano <pino@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef _OKULAR_CONFIGINTERFACE_H_ 0008 #define _OKULAR_CONFIGINTERFACE_H_ 0009 0010 #include "../core/okularcore_export.h" 0011 0012 #include <QObject> 0013 0014 class KConfigDialog; 0015 0016 namespace Okular 0017 { 0018 /** 0019 * @short Abstract interface for configuration control 0020 * 0021 * This interface defines a way to configure the Generator itself. 0022 * 0023 * How to use it in a custom Generator: 0024 * @code 0025 class MyGenerator : public Okular::Generator, public Okular::ConfigInterface 0026 { 0027 Q_OBJECT 0028 Q_INTERFACES( Okular::ConfigInterface ) 0029 0030 ... 0031 }; 0032 * @endcode 0033 * and - of course - implementing its methods. 0034 */ 0035 class OKULARCORE_EXPORT ConfigInterface 0036 { 0037 public: 0038 ConfigInterface() 0039 { 0040 } 0041 0042 /** 0043 * Destroys the config interface. 0044 */ 0045 virtual ~ConfigInterface() 0046 { 0047 } 0048 0049 ConfigInterface(const ConfigInterface &) = delete; 0050 ConfigInterface &operator=(const ConfigInterface &) = delete; 0051 0052 /** 0053 * This method is called to tell the generator to re-parse its configuration. 0054 * 0055 * Returns true if something has changed. 0056 * 0057 * @note this method can be called also when the generator is not the 0058 * active generator, or when there was not changed in the config added 0059 * by the generator itself. So the suggestion is to @b check whether 0060 * something changed, and only in that case return @p true 0061 */ 0062 virtual bool reparseConfig() = 0; 0063 0064 /** 0065 * This method allows the generator to add custom configuration pages to the 0066 * config @p dialog of okular. 0067 */ 0068 virtual void addPages(KConfigDialog *dialog) = 0; 0069 }; 0070 0071 } 0072 0073 Q_DECLARE_INTERFACE(Okular::ConfigInterface, "org.kde.okular.ConfigInterface/0.1") 0074 0075 #endif