qmlFrontend/hwengine.h
author unc0rr
Mon, 22 Sep 2014 02:10:39 +0400
branchqmlfrontend
changeset 10420 02c573d19224
parent 10418 091d2c0216c3
child 10424 4be6cd55f1cf
permissions -rw-r--r--
flib: - Ability to pass raw data via IPC qmlfrontend: - Pass message received by callback through event loop to handle it in main thread - Get preview image from engine on button click and render it in Image object

#ifndef HWENGINE_H
#define HWENGINE_H

#include <QObject>
#include <QByteArray>
#include <QVector>
#include <QPixmap>

#include "flib.h"

class QQmlEngine;

class HWEngine : public QObject
{
    Q_OBJECT
public:
    explicit HWEngine(QQmlEngine * engine, QObject *parent = 0);
    ~HWEngine();

    static void exposeToQML();
    Q_INVOKABLE void run();
    
signals:
    void previewImageChanged();
    
public slots:

private:
    QList<QByteArray> m_argsList;
    QVector<const char *> m_args;
    QQmlEngine * m_engine;

    static void engineMessageCallback(void *context, const char * msg, quint32 len);
    void sendIPC(const QByteArray &b);

private slots:
    void engineMessageHandler(const QByteArray &msg);
};

#endif // HWENGINE_H