#ifndef MYQTENGINE_H
#define MYQTENGINE_H

#include <QObject>
#include <QString>
#include <QStringList>
#include <QVariant>
#include <QGlobal.h>
#include <QTime>
#include <QImageReader>

class MyQtEngine : public QObject
{
    Q_OBJECT

    // Properies can be accessed from QML code
    Q_PROPERTY(QString selectedPicPath READ selectedPicPath WRITE setSelectedPicPath NOTIFY selectedPicPathChanged)

public:
    MyQtEngine(QObject *parent = 0);
    ~MyQtEngine();

    // For selectedPicPath property
    QString selectedPicPath();
    void setSelectedPicPath(QString);

    QStringList picturePaths();
    void removeImage(QString);

    // These Q_INVOKABLE methods can be called from QML
public:
    Q_INVOKABLE QVariant pictureAt(QVariant index);
    Q_INVOKABLE void searchPictures();
    Q_INVOKABLE QVariant imageName(QVariant);
    Q_INVOKABLE QVariant randInt(QVariant low, QVariant high);
    Q_INVOKABLE QVariant scaledPicture(QVariant picturePath, QVariant preferredWidth, QVariant preferredHeight);

private:
    void searchPicturesFromDevice(QString);

signals:
    // For selectedPicPath property
    void selectedPicPathChanged();

private:
    QString m_selectedPicPath;
    QStringList m_picturePaths;
    QImageReader m_imageReader;

};

#endif // MYQTENGINE_H
