#ifndef DASHBOARD_H
#define DASHBOARD_H

#include "qboxlayout.h"
#include <QObject>
#include "global.h"
#include "dataPanel/dpGlobals.h"

class DashboardFrame;
class CustomTab;
class QMenu;
class DataPanel;

class Dashboard : public QObject
{
    Q_OBJECT

public:
    explicit Dashboard(const QString& strName, QObject *parent = nullptr);
    ~Dashboard();

    const QString& name();
    void setName(const QString&);
    void setFrame(DashboardFrame*);
    DashboardFrame* frame();
    void setDisplayAreaLayout(QHBoxLayout*);
    CustomTab* tab();
    QWidget* displayArea();
    void setActive(bool);
    void addPanel(DataPanelType);
    void removePanel(const QString&);
    void resizePanel(double, double);
    void deleteSubWidgets();
    void setDateTime(const QDateTime&);
    void setTimeRange(TimeUnit);

public slots:
    void contextMenu_tab(const QPoint&);
    void onAction_rename();
    void onAction_remove();

    void onSignal_removePanel(const QString&);
    void onSignal_openConfigurationDlg(DataPanel*);

signals:
    void sgl_rename();
    void sgl_remove();

private:    
    QString           m_strName;
    DashboardFrame*   m_pFrame;
    CustomTab*        m_pTab;
    QMenu*            m_pTabMenu;
    QWidget*          m_pDisplayArea;
    QHBoxLayout*      m_pDisplayAreaLayout;
    QList<DataPanel*> m_dataPanels;
    int               m_nPanenlNameNumber;
};


#endif
