nodeguy/src/cpp/include/nodegui/QtGui/QMovie/nmovie.hpp
Atul R 86c3ef089c
Integration with Qode 2.0 (#400)
* Moves qt integration solely to the nodegui core addon

* Adds lint fixes

* moved to integration core

* cleans up export snippet

* revert package.json

* Add exit if app->exec finishes.

* lint fix

* Makes QApplication custom

* adds qobject to wrap of qapp

* Adds working qt run looper

* Adds font default

* Adds qt installer

* Updates qode integration to v2.0.1

* fix cpp lints

* Fixes lint and deps

* Adds miniqt installation

* adds setup mini qt script

* skips tests due to issues with jest

* fix config and download path for linux and windows

* Adds multiple artifact downloader

* fix qt config and compilation

* Fixes qode path for windows (now it can load dll's easily)

* Add compilation

* fix windows path setup

* use scripts directly

* enabled tests back

* fix ubuntu deps

* update to alpha release

* fix workflow

* adds more artifacts and funding field

* change to alpha v2

* update prebuild yml

* revert build action

* disabling prebuild for now

* switch to stable release 5.14.1

* version bump
2020-03-07 10:28:30 +01:00

68 lines
2.8 KiB
C++

#pragma once
#include <QMovie>
#include "Extras/Export/export.h"
#include "QtCore/QObject/qobject_macro.h"
#include "QtCore/QRect/qrect_wrap.h"
#include "QtCore/QSize/qsize_wrap.h"
#include "core/Events/eventwidget.h"
#include "core/Events/eventwidget_macro.h"
class DLL_EXPORT NMovie : public QMovie, public EventWidget {
Q_OBJECT
EVENTWIDGET_IMPLEMENTATIONS(QMovie)
public:
using QMovie::QMovie;
void connectSignalsToEventEmitter() {
QOBJECT_SIGNALS
// Qt Connects: Implement all signal connects here
QObject::connect(this, &QMovie::error,
[=](QImageReader::ImageReaderError error) {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
this->emitOnNode.Call(
{Napi::String::New(env, "error"),
Napi::Number::New(env, static_cast<int>(error))});
});
QObject::connect(this, &QMovie::finished, [=]() {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
this->emitOnNode.Call({Napi::String::New(env, "finished")});
});
QObject::connect(this, &QMovie::frameChanged, [=](int frameNumber) {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
this->emitOnNode.Call({Napi::String::New(env, "frameChanged"),
Napi::Number::New(env, frameNumber)});
});
QObject::connect(this, &QMovie::started, [=]() {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
this->emitOnNode.Call({Napi::String::New(env, "started")});
});
QObject::connect(this, &QMovie::resized, [=](const QSize &size) {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
auto instance = QSizeWrap::constructor.New({Napi::External<QSize>::New(
env, new QSize(size.width(), size.height()))});
this->emitOnNode.Call({Napi::String::New(env, "resized"), instance});
});
QObject::connect(this, &QMovie::stateChanged,
[=](QMovie::MovieState state) {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
this->emitOnNode.Call(
{Napi::String::New(env, "stateChanged"),
Napi::Number::New(env, static_cast<int>(state))});
});
QObject::connect(this, &QMovie::updated, [=](const QRect &rect) {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
auto instance = QRectWrap::constructor.New(
{Napi::External<QRect>::New(env, new QRect(rect))});
this->emitOnNode.Call({Napi::String::New(env, "updated"), instance});
});
}
};