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

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 SKGADVICEBOARDWIDGET_H
0007 #define SKGADVICEBOARDWIDGET_H
0008 /** @file
0009 * This file is plugin for advice.
0010 *
0011 * @author Stephane MANKOWSKI / Guillaume DE BURE
0012 */
0013 #include "skgboardwidget.h"
0014 
0015 class QFormLayout;
0016 class QAction;
0017 class QPushButton;
0018 
0019 /**
0020  * This file is plugin for advice
0021  */
0022 class SKGAdviceBoardWidget : public SKGBoardWidget
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     /**
0028      * Default Constructor
0029      * @param iParent the parent widget
0030      * @param iDocument the document*
0031      */
0032     explicit SKGAdviceBoardWidget(QWidget* iParent, SKGDocument* iDocument);
0033 
0034     /**
0035      * Default Destructor
0036      */
0037     ~SKGAdviceBoardWidget() override;
0038 
0039     /**
0040      * Get the current state
0041      * MUST BE OVERWRITTEN
0042      * @return a string containing all information needed to set the same state.
0043      * Could be an XML stream
0044      */
0045     QString getState() override;
0046 
0047     /**
0048      * Set the current state
0049      * MUST BE OVERWRITTEN
0050      * @param iState must be interpreted to set the state of the widget
0051      */
0052     void setState(const QString& iState) override;
0053 
0054 Q_SIGNALS:
0055     void refreshNeeded();
0056 
0057 private Q_SLOTS:
0058     void pageChanged();
0059     void dataModifiedNotForce();
0060     void dataModifiedForce();
0061     void dataModified(bool iForce = false);
0062     void adviceClicked();
0063     void activateAllAdvice();
0064     void moreAdvice();
0065     void lessAdvice();
0066     void applyRecommended();
0067 
0068 private:
0069     Q_DISABLE_COPY(SKGAdviceBoardWidget)
0070 
0071     int m_maxAdvice;
0072     bool m_refreshNeeded;
0073 
0074     QAction* m_menuAuto;
0075     QPushButton* m_refresh;
0076     QFormLayout* m_layout;
0077     QList<QAction*> m_recommendedActions;
0078     bool m_inapplyall;
0079 };
0080 
0081 #endif  // SKGADVICEBOARDWIDGET_H