File indexing completed on 2024-04-21 03:41:48

0001 /*
0002     SPDX-FileCopyrightText: 2008 Danilo Balzaque <danilo.balzaque@ltia.fc.unesp.br>
0003     SPDX-FileCopyrightText: 2008 Tadeu Araujo <tadeu.araujo@ltia.fc.unesp.br>
0004     SPDX-FileCopyrightText: 2008 Tiago Porangaba <tiago.porangaba@ltia.fc.unesp.br>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef FRACTIONRINGWIDGET_H
0010 #define FRACTIONRINGWIDGET_H
0011 
0012 #include <KXmlGuiWindow>
0013 
0014 #include "AppMenuWidget.h"
0015 #include "Ratio.h"
0016 #include "FractionPainter.h"
0017 
0018 class QAction;
0019 class QGridLayout;
0020 class AppMenuWidget;
0021 class QColor;
0022 class QLabel;
0023 class FractionPainter;
0024 class QSpinBox;
0025 class QPushButton;
0026 class QLabel;
0027 class QTextEdit;
0028 class QAction;
0029 class QWidgetAction;
0030 
0031 
0032 /*! Constructs a QWidget bla bla bla
0033  *  \author Danilo Balzaque
0034  * */
0035 class FractionRingWidget : public KXmlGuiWindow
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040     /** constructor */
0041     FractionRingWidget();
0042 
0043     /** destructor */
0044     ~FractionRingWidget() override;
0045 
0046 protected:
0047     /** Function is called every time the screen need to be painted.
0048      **/
0049     void paintEvent(QPaintEvent * event) override;
0050 
0051     void resetFraction(bool update);
0052     bool checkTask();
0053     int MCM(int a, int b);
0054     int GCF(int a, int b);
0055 
0056 private:
0057     QWidget * baseWidget;
0058     QWidget * interfaceWidget;
0059 
0060     QGridLayout * layout1;
0061     QGridLayout * gridLayout;
0062     QSpinBox * leftSpinBox;
0063     QSpinBox * rightSpinBox;
0064     QPushButton * resetButton;
0065     QTextEdit * textMsg;
0066     QLabel * leftInfoLabel;
0067     QLabel * rightInfoLabel;
0068 
0069     FractionPainter * fractionWidget;
0070 
0071     AppMenuWidget * kbruchApp;
0072 
0073     QColor bgOutsideRing;
0074     QColor bgOutsideMold;
0075     QColor bgInsideRing;
0076     QColor bgInsideMold;
0077     QColor bgColor;
0078     QColor colorListLeft[5];
0079     QColor colorListRight[5];
0080 
0081     QWidgetAction * m_NewTaskAction;
0082     QWidgetAction * m_BackAction;
0083     QAction * m_HintAction;
0084 
0085     Ratio rLeft;
0086     Ratio rRight;
0087 
0088     int numLeft;
0089     int denLeft;
0090     int multLeft;
0091 
0092     int numRight;
0093     int denRight;
0094     int multRight;
0095 
0096     void setupActions();
0097 
0098 private Q_SLOTS:
0099     void slotLeftSpinBoxValueChanged(int value);
0100     void slotRightSpinBoxValueChanged(int value);
0101     void NewTask();
0102     void Hint();
0103     void GoBack();
0104     /**
0105     * calls the settings dialog
0106     */
0107     void slotPrefs();
0108     /**
0109     * makes sure, all parts of the UI update to new settings
0110     */
0111     void slotApplySettings();
0112 };
0113 
0114 #endif