qmlfrontend/hwengine.h
author unc0rr
Tue, 26 Dec 2017 01:36:58 +0100
branchqmlfrontend
changeset 12861 488782d9aba9
parent 12858 0c6fb706f747
child 12863 fe16fa088b69
permissions -rw-r--r--
Recreate uFLRunQueue in Qt, render previews

#ifndef HWENGINE_H
#define HWENGINE_H

#include <QList>
#include <QObject>

#include "flib.h"

class QQmlEngine;
class PreviewImageProvider;
class RunQueue;

class HWEngine : public QObject {
    Q_OBJECT

public:
    explicit HWEngine(QQmlEngine* engine, QObject* parent = nullptr);
    ~HWEngine();

    static void exposeToQML();

    Q_INVOKABLE void getPreview();
    Q_INVOKABLE void runQuickGame();

signals:
    void previewIsRendering();
    void previewImageChanged();
    void previewHogCountChanged(int count);
    void gameFinished();

public slots:

private:
    QQmlEngine* m_engine;
    PreviewImageProvider* m_previewProvider;
    RunQueue* m_runQueue;

    static void guiMessagesCallback(void* context, MessageType mt, const char* msg, uint32_t len);

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

#endif // HWENGINE_H