1 /***************************************************************************
2  * SPDX-FileCopyrightText: 2021 S. MANKOWSKI stephane@mankowski.fr
3  * SPDX-FileCopyrightText: 2021 G. DE BURE support@mankowski.fr
4  * SPDX-License-Identifier: GPL-3.0-or-later
5  ***************************************************************************/
6 #ifndef SKGSCHEDULEDPLUGINWIDGET_H
7 #define SKGSCHEDULEDPLUGINWIDGET_H
8 /** @file
9  * A skrooge plugin to manage scheduled operations
10 *
11 * @author Stephane MANKOWSKI
12 */
13 #include "skgtabpage.h"
14 #include "ui_skgscheduledpluginwidget_base.h"
15 
16 class SKGDocumentBank;
17 
18 /**
19  * A skrooge plugin to manage scheduled operations
20  */
21 class SKGScheduledPluginWidget : public SKGTabPage
22 {
23     Q_OBJECT
24 
25 public:
26     /**
27      * Default Constructor
28      * @param iParent the parent widget
29      * @param iDocument the document
30      */
31     explicit SKGScheduledPluginWidget(QWidget* iParent, SKGDocumentBank* iDocument);
32 
33     /**
34      * Default Destructor
35      */
36     ~SKGScheduledPluginWidget() override;
37 
38     /**
39      * Get the current state
40      * MUST BE OVERWRITTEN
41      * @return a string containing all information needed to set the same state.
42      * Could be an XML stream
43      */
44     QString getState() override;
45 
46     /**
47      * Set the current state
48      * MUST BE OVERWRITTEN
49      * @param iState must be interpreted to set the state of the widget
50      */
51     void setState(const QString& iState) override;
52 
53     /**
54      * Get attribute name to save the default state
55      * MUST BE OVERWRITTEN
56      * @return attribute name to save the default state.
57      */
58     QString getDefaultStateAttribute() override;
59 
60     /**
61      * Get the main widget
62      * @return a widget
63      */
64     QWidget* mainWidget() override;
65 
66 protected:
67     /**
68      * Event filtering
69      * @param iObject object
70      * @param iEvent event
71      * @return In your reimplementation of this function, if you want to filter the event out, i.e. stop it being handled further, return true; otherwise return false.
72      */
73     bool eventFilter(QObject* iObject, QEvent* iEvent) override;
74 
75 private Q_SLOTS:
76     void onSelectionChanged();
77     void onUpdate();
78     void onProcessImmediately();
79     void onProcess(bool iImmediately = false);
80     void onNbOccurrenceChanged();
81     void onJumpToTheOperation();
82 
83 private:
Q_DISABLE_COPY(SKGScheduledPluginWidget)84     Q_DISABLE_COPY(SKGScheduledPluginWidget)
85 
86     Ui::skgscheduledplugin_base ui{};
87 };
88 
89 #endif  // SKGSCHEDULEDPLUGINWIDGET_H
90