File indexing completed on 2024-05-26 05:10: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 SKGBANKPLUGINWIDGET_H 0007 #define SKGBANKPLUGINWIDGET_H 0008 /** @file 0009 * This file is Skrooge plugin for bank management. 0010 * 0011 * @author Stephane MANKOWSKI / Guillaume DE BURE 0012 */ 0013 #include <qstringlist.h> 0014 #include <qtimer.h> 0015 0016 #include "skgaccountobject.h" 0017 #include "skgtabpage.h" 0018 #include "ui_skgbankpluginwidget_base.h" 0019 0020 class SKGBoardWidget; 0021 class SKGDocumentBank; 0022 0023 /** 0024 * This file is Skrooge plugin for bank management 0025 */ 0026 class SKGBankPluginWidget : public SKGTabPage 0027 { 0028 Q_OBJECT 0029 0030 public: 0031 /** 0032 * Default Constructor 0033 * @param iParent the parent widget 0034 * @param iDocument the document 0035 */ 0036 explicit SKGBankPluginWidget(QWidget* iParent, SKGDocumentBank* iDocument); 0037 0038 /** 0039 * Default Destructor 0040 */ 0041 ~SKGBankPluginWidget() override; 0042 0043 /** 0044 * Get the current state 0045 * MUST BE OVERWRITTEN 0046 * @return a string containing all information needed to set the same state. 0047 * Could be an XML stream 0048 */ 0049 QString getState() override; 0050 0051 /** 0052 * Set the current state 0053 * MUST BE OVERWRITTEN 0054 * @param iState must be interpreted to set the state of the widget 0055 */ 0056 void setState(const QString& iState) override; 0057 0058 /** 0059 * Get attribute name to save the default state 0060 * MUST BE OVERWRITTEN 0061 * @return attribute name to save the default state. 0062 */ 0063 QString getDefaultStateAttribute() override; 0064 0065 /** 0066 * Get the main widget 0067 * @return a widget 0068 */ 0069 QWidget* mainWidget() override; 0070 0071 /** 0072 * Get the printable widgets. 0073 * The default implementation returns the main widget. 0074 * @return the printable widgets. 0075 */ 0076 QList<QWidget*> printableWidgets() override; 0077 0078 /** 0079 * To know if this page contains an editor. MUST BE OVERWRITTEN 0080 * @return the editor state 0081 */ 0082 bool isEditor() override; 0083 0084 /** 0085 * To activate the editor by setting focus on right widget. MUST BE OVERWRITTEN 0086 */ 0087 void activateEditor() override; 0088 0089 protected: 0090 /** 0091 * Event filtering 0092 * @param iObject object 0093 * @param iEvent event 0094 * @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. 0095 */ 0096 bool eventFilter(QObject* iObject, QEvent* iEvent) override; 0097 0098 private Q_SLOTS: 0099 void dataModified(const QString& iTableName, int iIdTransaction, bool iLightTransaction = false); 0100 void onIconChanged(); 0101 void onAccountCreatorModified(); 0102 void onAddAccountClicked(); 0103 void onModifyAccountClicked(); 0104 void onSelectionChanged(); 0105 void onRefreshGraphDelayed(); 0106 void onRefreshGraph(); 0107 void cleanEditor(); 0108 void refreshInfoZone(); 0109 SKGError setInitialBalanceFromEditor(SKGAccountObject& iAccount); 0110 0111 private: 0112 Q_DISABLE_COPY(SKGBankPluginWidget) 0113 0114 Ui::skgbankplugin_base ui{}; 0115 QTimer m_timer; 0116 QTimer m_timer2; 0117 SKGBoardWidget* m_graph; 0118 QString m_graphState; 0119 }; 0120 0121 #endif // SKGDEBUGPLUGIN_H