File indexing completed on 2025-02-02 04:56:55
0001 /*************************************************************************** 0002 * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr 0003 * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 ***************************************************************************/ 0006 #ifndef SKGSTATISTICPLUGIN_H 0007 #define SKGSTATISTICPLUGIN_H 0008 /** @file 0009 * A plugin to generate statistic. 0010 * 0011 * @author Stephane MANKOWSKI 0012 */ 0013 #include "skginterfaceplugin.h" 0014 0015 0016 /** 0017 * A plugin to generate statistic 0018 */ 0019 class SKGStatisticPlugin : public SKGInterfacePlugin 0020 { 0021 Q_OBJECT 0022 Q_INTERFACES(SKGInterfacePlugin) 0023 0024 public: 0025 /** 0026 * Default Constructor 0027 */ 0028 explicit SKGStatisticPlugin(QWidget* iWidget, QObject* iParent, const QVariantList& iArg); 0029 0030 /** 0031 * Default Destructor 0032 */ 0033 ~SKGStatisticPlugin() override; 0034 0035 /** 0036 * Called to initialise the plugin 0037 * @param iDocument the main document 0038 * @return true if the plugin is compatible with the document 0039 */ 0040 bool setupActions(SKGDocument* iDocument) override; 0041 0042 /** 0043 * Must be modified to refresh widgets after a modification. 0044 */ 0045 void refresh() override; 0046 0047 /** 0048 * The title of the plugin. 0049 * @return The title of the plugin 0050 */ 0051 QString title() const override; 0052 0053 /** 0054 * The icon of the plugin. 0055 * @return The icon of the plugin 0056 */ 0057 QString icon() const override; 0058 0059 /** 0060 * The toolTip of the plugin. 0061 * @return The toolTip of the plugin 0062 */ 0063 QString toolTip() const override; 0064 0065 /** 0066 * Must be implemented to set the position of the plugin. 0067 * @return integer value between 0 and 999 (default = 999) 0068 */ 0069 int getOrder() const override; 0070 0071 /** 0072 * Must be implemented to know if a plugin must be display in pages chooser. 0073 * @return true of false (default = false) 0074 */ 0075 bool isInPagesChooser() const override; 0076 0077 private Q_SLOTS: 0078 0079 void triggerAction(); 0080 void pageChanged(); 0081 void pageOpened(); 0082 0083 private: 0084 Q_DISABLE_COPY(SKGStatisticPlugin) 0085 0086 void readStats(); 0087 void writeStats(); 0088 0089 SKGDocument* m_currentDocument; 0090 0091 QVariantMap m_stats; 0092 QString m_file; 0093 QDateTime m_timeInit; 0094 QString m_docUniqueIdentifier; 0095 }; 0096 0097 #endif // SKGSTATISTICPLUGIN_H