// bytran -|- spectral calculations for portable devices using the HITRAN database
//
// Developed by Dzianis Pliutau (Denis Plutov) and Kostya Roslyakov
// www.bytran.org | bytran@bytran.org
// Copyright (c) 2016 Dzianis Pliutau
// Distributed under the MIT license
//
// The MIT License (MIT)
// Copyright (c) 2016 Dzianis Pliutau
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



// Object linking the spectral line calculation configuration parameters in the main calculation module with the QML interface component
#ifndef LINEOPTIONSQML_H
#define LINEOPTIONSQML_H

#include <QObject>
#include <QLocale>
#include "bytrancore.h"

class LineOptionsQml : public QObject
{
    Q_OBJECT

    Q_PROPERTY(quint8 lineshapeProfile READ lineshapeProfile WRITE setLineshapeProfile NOTIFY lineshapeProfileChanged)
    Q_PROPERTY(QString intensThresh READ intensThresh WRITE setIntensThresh NOTIFY intensThreshChanged)
    Q_PROPERTY(QString wingContribSatHw READ wingContribSatHw WRITE setWingContribSatHw NOTIFY wingContribSatHwChanged)
    Q_PROPERTY(QString wingContribAbs READ wingContribAbs WRITE setWingContribAbs NOTIFY wingContribAbsChanged)
    Q_PROPERTY(quint8 lineBroadening READ lineBroadening WRITE setLineBroadening NOTIFY lineBroadeningChanged)
    Q_PROPERTY(bool useLineShift READ useLineShift WRITE setUseLineShift NOTIFY useLineShiftChanged)

public:

    explicit LineOptionsQml(QObject *parent = 0, BytranCore *inCore = 0);
    LineOptionsQml(const QString &intensThresh, const QString &wingContribSatHw, const QString &wingContribAbs, const int &lineshapeProfile, const int &lineBroadening, const bool &useLineShift, QObject *parent=0);

    // Lineshape profile
    quint8 lineshapeProfile() const;
    void setLineshapeProfile(const quint8 &lineshapeProfile);

    // Intensity treshold
    QString intensThresh() const;
    void setIntensThresh(const QString &intensThresh);

    // Line wing contribution in saturated halfwidths
    QString wingContribSatHw() const;
    void setWingContribSatHw(const QString &wingContribSatHw);

    // Line wing contribution absolute
    QString wingContribAbs() const;
    void setWingContribAbs(const QString &rwingContribAbs);

    // Broadening type
    quint8 lineBroadening() const;
    void setLineBroadening(const quint8 &lineBroadening);

    // Line shift
    bool useLineShift() const;
    void setUseLineShift(const bool &useLineShift);

signals:

    void lineshapeProfileChanged();
    void intensThreshChanged();
    void wingContribSatHwChanged();
    void wingContribAbsChanged();
    void lineBroadeningChanged();
    void useLineShiftChanged();

private slots:

    // Slot is used to update all values in the corresponding QML dialog
    void setUpdatedValues();

private:

    QString m_intensThresh;
    QString m_wingContribSatHw;
    QString m_wingContribAbs;
    quint8 m_lineshapeProfile;
    quint8 m_lineBroadening;
    bool m_useLineShift;

    // Core object with the calculation logic etc.
    BytranCore *core;

    // Locale specific string to number and inverse conversions
    QLocale loc;

};

#endif // LINEOPTIONSQML_H
