#ifndef LISTSUBPROC_H
#define LISTSUBPROC_H

#include <QWidget>
#include <QResizeEvent>
#include <QTreeWidget>
#include "connectortoserver.h"

enum ColumnsTreeSubProc{
    clmnSP_title = 0,
    clmnSP_code,
    clmnSP_canplay,
    clmnSP_count
};

namespace Ui {
class ListSubProc;
}

class ListSubProc : public QWidget
{
    Q_OBJECT

public:
    explicit ListSubProc(QWidget *parent = nullptr);
    ~ListSubProc();

    void closeEvent(QCloseEvent *event) override;
    void resizeEvent(QResizeEvent *event) override;
    void changeEvent(QEvent * event) override;

    void setTask(TaskAmmFim* task);
    bool getListCheckedSubProc(QList<SubProc>* listSubProc);

private:
    void preparationTreeWidget();
    void reSetHeadTreeWidget();
    void setWidthColumnsTree();
    int calculateWidth_0Column();

private slots:
    void on_btnAssign_clicked();

signals:
    void signal_Accepted();

private:
    Ui::ListSubProc *ui;

    TaskAmmFim task;

    QTreeWidget* treeWidget;
    QList<int> listWidthColumn;
};

#endif // LISTSUBPROC_H
