// 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.



// Data object to specify the HITRAN database download options
#ifndef HITRANDOWNLOADOPTIONSQML_H
#define HITRANDOWNLOADOPTIONSQML_H

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

class HitranDownloadOptionsQml : public QObject
{
    Q_OBJECT

    Q_PROPERTY(quint8 hitranFileUsage READ hitranFileUsage WRITE setHitranFileUsage NOTIFY hitranFileUsageChanged)
    Q_PROPERTY(bool cumulativeHitranExists READ cumulativeHitranExists NOTIFY cumulativeHitranExistsChanged)

public:

    Q_INVOKABLE void downloadCompleteHitran();

    explicit HitranDownloadOptionsQml(QObject *parent = 0, BytranCore *inCore = 0);

    // Methods to get and set the HITRAN file usage (download vs. local etc.)
    quint8 hitranFileUsage() const;
    void setHitranFileUsage(const quint8 hitranFileUsage);

    // Method returns a value indicating if the cumulative HITRAN database file exists
    bool cumulativeHitranExists() const;

signals:

    void hitranFileUsageChanged();
    void cumulativeHitranExistsChanged();

public slots:

private:

    // Core object related to the main calculation parameters
    BytranCore *core;

    // Variable indicating if the HITRAN database should be accessed of the disk or downloaded (thd download option is the default)
    quint8 m_hitranFileUsage;  // 0 - download and save HITRAN file in segments as the need arises and store them locally for later reuse offline (previously unaccessed segments would have to be downloaded);
                               // 1 - use cumulative HITRAN file (download complete HITRAN file once only and later use it offline);
                               // 2 - dowload HITRAN segments from hitran.org every time, no storing of data on the mobile device (not recommended)

    bool m_cumulativeHitranExistsChanged;  // true - cumulative HITRAN file exists; false - cumulative HITRAN file does not exist

};

#endif // HITRANDOWNLOADOPTIONSQML_H
