//  ************************************************************************************************
//
//  BornAgain: simulate and fit reflection and scattering
//
//! @file      GUI/View/Job/JobEditor.h
//! @brief     Defines class JobEditor.
//!
//! @homepage  http://www.bornagainproject.org
//! @license   GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
//  ************************************************************************************************

#ifndef BORNAGAIN_GUI_VIEW_JOB_JOBEDITOR_H
#define BORNAGAIN_GUI_VIEW_JOB_JOBEDITOR_H

#include <QTabWidget>
#include <QTextEdit>
#include <QTreeView>
#include <QWidget>

class JobItem;
class JobparQModel;

//! The JobEditor class holds component editor for JobItem. Part of JobsPanel,
//! resides at lower left corner of JobView.

class JobEditor : public QWidget {
    Q_OBJECT
public:
    explicit JobEditor(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
    ~JobEditor() override;
    void setJobItem(JobItem* jobItem);

private slots:
    void onCommentsEdited();

private:
    void notifyJobPropertyChange();
    void applySettings();
    void saveSettings();

    QTabWidget* m_tab_widget;
    QTreeView* m_properties_view;
    JobparQModel* m_properties_model;
    QTextEdit* m_comments_editor;
    JobItem* m_job_item;
};

#endif // BORNAGAIN_GUI_VIEW_JOB_JOBEDITOR_H
