File indexing completed on 2024-06-23 05:03:09

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 SKGPROPERTIESPLUGIN_H
0007 #define SKGPROPERTIESPLUGIN_H
0008 /** @file
0009  * A plugin to manage properties on objects.
0010 *
0011 * @author Stephane MANKOWSKI
0012  */
0013 #include <qprocess.h>
0014 
0015 #include "skginterfaceplugin.h"
0016 
0017 class SKGPropertiesPluginDockWidget;
0018 class QMenu;
0019 class QDockWidget;
0020 
0021 /**
0022  * A plugin to manage properties on objects
0023  */
0024 class SKGPropertiesPlugin : public SKGInterfacePlugin
0025 {
0026     Q_OBJECT
0027     Q_INTERFACES(SKGInterfacePlugin)
0028 
0029 public:
0030     /**
0031      * Default Constructor
0032      */
0033     explicit SKGPropertiesPlugin(QWidget* iWidget, QObject* iParent, const QVariantList& iArg);
0034 
0035     /**
0036      * Default Destructor
0037      */
0038     ~SKGPropertiesPlugin() override;
0039 
0040     /**
0041      * Called to initialise the plugin
0042      * @param iDocument the main document
0043      * @return true if the plugin is compatible with the document
0044      */
0045     bool setupActions(SKGDocument* iDocument) override;
0046 
0047     /**
0048      * Must be modified to refresh widgets after a modification.
0049      */
0050     void refresh() override;
0051 
0052     /**
0053      * The dock widget of the plugin.
0054      * @return The dock widget of the plugin
0055      */
0056     QDockWidget* getDockWidget() override;
0057 
0058     /**
0059      * The icon of the plugin.
0060      * @return The icon of the plugin
0061      */
0062     QString icon() const override;
0063 
0064     /**
0065      * The title of the plugin.
0066      * @return The title of the plugin
0067      */
0068     QString title() const override;
0069 
0070     /**
0071      * The tips list of the plugin.
0072      * @return The tips list of the plugin
0073      */
0074     QStringList tips() const override;
0075 
0076     /**
0077      * Must be implemented to set the position of the plugin.
0078      * @return integer value between 0 and 999 (default = 999)
0079      */
0080     int getOrder() const override;
0081 
0082 private Q_SLOTS:
0083     void onAddProperty();
0084     void onDownloadAndAddBills();
0085     void onShowAddPropertyMenu();
0086     void onBillsRetreived();
0087 
0088 private:
0089     Q_DISABLE_COPY(SKGPropertiesPlugin)
0090 
0091     QProcess m_billsProcess;
0092     QStringList m_bills;
0093 
0094     SKGDocument* m_currentDocument;
0095     QDockWidget* m_dockWidget;
0096     SKGPropertiesPluginDockWidget* m_dockContent;
0097     QMenu* m_addPropertyMenu;
0098 };
0099 
0100 #endif  // SKGPROPERTIESPLUGIN_H