File indexing completed on 2025-02-09 06:04:36

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 SKGMONTHLYPLUGINWIDGET_H
0007 #define SKGMONTHLYPLUGINWIDGET_H
0008 /** @file
0009  * A plugin for monthly report
0010 *
0011 * @author Stephane MANKOWSKI
0012 */
0013 #include "skginterfaceplugin.h"
0014 #include "skgtabpage.h"
0015 #include "ui_skgmonthlypluginwidget_base.h"
0016 
0017 /**
0018  * A plugin for monthly report
0019  */
0020 class SKGMonthlyPluginWidget : public SKGTabPage
0021 {
0022     Q_OBJECT
0023 public:
0024     /**
0025      * Default Constructor
0026      * @param iParent the parent widget
0027      * @param iDocument the document
0028      */
0029     explicit SKGMonthlyPluginWidget(QWidget* iParent, SKGDocument* iDocument);
0030 
0031     /**
0032      * Default Destructor
0033      */
0034     ~SKGMonthlyPluginWidget() override;
0035 
0036     /**
0037      * Get the current state
0038      * MUST BE OVERWRITTEN
0039      * @return a string containing all information needed to set the same state.
0040      * Could be an XML stream
0041      */
0042     QString getState() override;
0043 
0044     /**
0045      * Set the current state
0046      * MUST BE OVERWRITTEN
0047      * @param iState must be interpreted to set the state of the widget
0048      */
0049     void setState(const QString& iState) override;
0050 
0051     /**
0052      * Get attribute name to save the default state
0053      * MUST BE OVERWRITTEN
0054      * @return attribute name to save the default state.
0055      */
0056     QString getDefaultStateAttribute() override;
0057 
0058     /**
0059      * Get the main widget
0060      * @return a widget
0061      */
0062     QWidget* mainWidget() override;
0063 
0064     /**
0065      * Get the current month
0066      * @return the current month
0067      */
0068     virtual QString getPeriod();
0069 
0070 private Q_SLOTS:
0071     void dataModified(const QString& iTableName, int iIdTransaction);
0072     void onPeriodChanged();
0073     void onGetNewHotStuff();
0074     void onPutNewHotStuff();
0075     void onTemplateChanged();
0076     void onAddTemplate();
0077     void onDeleteTemplate();
0078 
0079     QString getReport();
0080 
0081 private:
0082     Q_DISABLE_COPY(SKGMonthlyPluginWidget)
0083     void fillTemplateList();
0084 
0085     Ui::skgmonthlyplugin_base ui{};
0086 
0087     QAction* m_upload;
0088 };
0089 
0090 #endif  // SKGMonthlyPLUGINWIDGET_H