#ifndef BWIDGET_H
#define BWIDGET_H

#include <QWidget>
#include <QtCharts/QChartGlobal>

class QVBoxLayout;
class QGridLayout;
class QHBoxLayout;
class QLabel;
class QComboBox;
class QCheckBox;
class QSpacerItem;

QT_CHARTS_BEGIN_NAMESPACE
class QChartView;
class QChart;
QT_CHARTS_END_NAMESPACE

typedef QPair<QPointF, QString> Data;
typedef QList<Data> DataList;
typedef QList<DataList> DataTable;

QT_CHARTS_USE_NAMESPACE

class BWidget : public QWidget
{
    Q_OBJECT
public:
    explicit BWidget(QWidget* parent = nullptr);
    ~BWidget();

private Q_SLOTS:
    void updateUI();

private:
    void initUI();

    DataTable generateRandomData(int listCount, int valueMax, int valueCount) const;
    void populateThemeBox();
    void populateLegendBox();
    void connectSignals();

    void createPieChart();
    void createSplineChart();


private:
    int m_listCount;
    int m_valueMax;
    int m_valueCount;
    QList<QChartView *> m_charts;
    DataTable m_dataTable;

    QVBoxLayout* mMainVLayout;
    QHBoxLayout* mChartHLayout;
    QChart* mPieChart;
    QChart* mSplineChart;

    QHBoxLayout *horizontalLayout;
    QLabel *themeLabel;
    QComboBox *themeComboBox;
    QLabel *animatedLabel;
    QComboBox *animatedComboBox;
    QLabel *legendLabel;
    QComboBox *legendComboBox;
    QCheckBox *antialiasCheckBox;
    QSpacerItem *horizontalSpacer;

};


#endif // BWIDGET_H
