mediaplayer.cpp Example File
mediaplayer-widgets-static/mediaplayer.cpp// // Statemachine code from reading SCXML file 'mediaplayer.scxml' // Created by: The Qt SCXML Compiler version 1 (Qt 5.12.6) // WARNING! All changes made in this file will be lost! // #include "mediaplayer.h" #include <qscxmlinvokableservice.h> #include <qscxmltabledata.h> #include <QScxmlEcmaScriptDataModel> #if !defined(Q_QSCXMLC_OUTPUT_REVISION) #error "The header file 'mediaplayer.scxml' doesn't include <qscxmltabledata.h>." #elif Q_QSCXMLC_OUTPUT_REVISION != 1 #error "This file was generated using the qscxmlc from 5.12.6. It" #error "cannot be used with the include files from this version of Qt." #error "(The qscxmlc has changed too much.)" #endif struct MediaPlayerStateMachine::Data: private QScxmlTableData { Data(MediaPlayerStateMachine &stateMachine) : stateMachine(stateMachine) {} void init() { stateMachine.setTableData(this); stateMachine.setDataModel(&dataModel); } QString name() const override final { return string(0); } QScxmlExecutableContent::ContainerId initialSetup() const override final { return 50; } QScxmlExecutableContent::InstructionId *instructions() const override final { return theInstructions; } QScxmlExecutableContent::StringId *dataNames(int *count) const override final { *count = 1; return dataIds; } QScxmlExecutableContent::EvaluatorInfo evaluatorInfo(QScxmlExecutableContent::EvaluatorId evaluatorId) const override final { Q_ASSERT(evaluatorId >= 0); Q_ASSERT(evaluatorId < 5); return evaluators[evaluatorId]; } QScxmlExecutableContent::AssignmentInfo assignmentInfo(QScxmlExecutableContent::EvaluatorId assignmentId) const override final { Q_ASSERT(assignmentId >= 0); Q_ASSERT(assignmentId < 1); return assignments[assignmentId]; } QScxmlExecutableContent::ForeachInfo foreachInfo(QScxmlExecutableContent::EvaluatorId foreachId) const override final { Q_ASSERT(foreachId >= 0); Q_ASSERT(foreachId < 0); return foreaches[foreachId]; } QString string(QScxmlExecutableContent::StringId id) const override final { Q_ASSERT(id >= QScxmlExecutableContent::NoString); Q_ASSERT(id < 19); if (id == QScxmlExecutableContent::NoString) return QString(); return QString({static_cast<QStringData*>(strings.data + id)}); } const qint32 *stateMachineTable() const override final { return theStateMachineTable; } QScxmlInvokableServiceFactory *serviceFactory(int id) const override final; MediaPlayerStateMachine &stateMachine; QScxmlEcmaScriptDataModel dataModel; static QScxmlExecutableContent::ParameterInfo param(QScxmlExecutableContent::StringId name, QScxmlExecutableContent::EvaluatorId expr, QScxmlExecutableContent::StringId location) { QScxmlExecutableContent::ParameterInfo p; p.name = name; p.expr = expr; p.location = location; return p; } static QScxmlExecutableContent::InvokeInfo invoke( QScxmlExecutableContent::StringId id, QScxmlExecutableContent::StringId prefix, QScxmlExecutableContent::EvaluatorId expr, QScxmlExecutableContent::StringId location, QScxmlExecutableContent::StringId context, QScxmlExecutableContent::ContainerId finalize, bool autoforward) { QScxmlExecutableContent::InvokeInfo i; i.id = id; i.prefix = prefix; i.expr = expr; i.location = location; i.context = context; i.finalize = finalize; i.autoforward = autoforward; return i; } static qint32 theInstructions[]; static QScxmlExecutableContent::StringId dataIds[]; static QScxmlExecutableContent::EvaluatorInfo evaluators[]; static QScxmlExecutableContent::AssignmentInfo assignments[]; static QScxmlExecutableContent::ForeachInfo foreaches[]; static const qint32 theStateMachineTable[]; static struct Strings { QArrayData data[19]; qunicodechar stringdata[901]; } strings; }; MediaPlayerStateMachine::MediaPlayerStateMachine(QObject *parent) : QScxmlStateMachine(&staticMetaObject, parent) , data(new Data(*this)) { qRegisterMetaType<MediaPlayerStateMachine *>(); data->init(); } MediaPlayerStateMachine::~MediaPlayerStateMachine() { delete data; } QScxmlInvokableServiceFactory *MediaPlayerStateMachine::Data::serviceFactory(int id) const { Q_UNUSED(id); Q_UNREACHABLE(); } qint32 MediaPlayerStateMachine::Data::theInstructions[] = { 2, 1, 23, 1, 21, 7, 0, 3, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 6, 1, -1, 2, 1, 21, 1, 19, 3, 9, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 6, 1, -1, 1, 2, 6, 4 }; QScxmlExecutableContent::StringId MediaPlayerStateMachine::Data::dataIds[] = { 6 }; QScxmlExecutableContent::EvaluatorInfo MediaPlayerStateMachine::Data::evaluators[] = { { 2, 3 }, { 6, 11 }, { 13, 14 }, { 15, 16 }, { 17, 18 } }; QScxmlExecutableContent::AssignmentInfo MediaPlayerStateMachine::Data::assignments[] = { { 6, 7, 8 } }; QScxmlExecutableContent::ForeachInfo MediaPlayerStateMachine::Data::foreaches[] = { { -1, -1, -1, -1 } }; #define STR_LIT(idx, ofs, len) \ Q_STATIC_STRING_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ qptrdiff(offsetof(Strings, stringdata) + ofs * sizeof(qunicodechar) - idx * sizeof(QArrayData)) \ ) MediaPlayerStateMachine::Data::Strings MediaPlayerStateMachine::Data::strings = {{ STR_LIT(0, 0, 23), STR_LIT(1, 24, 7), STR_LIT(2, 32, 14), STR_LIT(3, 47, 66), STR_LIT(4, 114, 3), STR_LIT(5, 118, 7), STR_LIT(6, 126, 5), STR_LIT(7, 132, 17), STR_LIT(8, 150, 65), STR_LIT(9, 216, 33), STR_LIT(10, 250, 15), STR_LIT(11, 266, 52), STR_LIT(12, 319, 15), STR_LIT(13, 335, 46), STR_LIT(14, 382, 98), STR_LIT(15, 481, 45), STR_LIT(16, 527, 97), STR_LIT(17, 625, 112), STR_LIT(18, 738, 161) },{ 0x4d,0x65,0x64,0x69,0x61,0x50,0x6c,0x61,0x79,0x65,0x72,0x53,0x74,0x61,0x74,0x65,0x4d,0x61,0x63,0x68,0x69,0x6e,0x65,0, // 0: MediaPlayerStateMachine 0x73,0x74,0x6f,0x70,0x70,0x65,0x64,0, // 1: stopped 0x69,0x73,0x56,0x61,0x6c,0x69,0x64,0x4d,0x65,0x64,0x69,0x61,0x28,0x29,0, // 2: isValidMedia() 0x74,0x72,0x61,0x6e,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x69,0x6e,0x73,0x74,0x72,0x75,0x63,0x74,0x69,0x6f,0x6e,0x20,0x69,0x6e,0x20,0x73,0x74,0x61,0x74,0x65,0x20,0x73,0x74,0x6f,0x70,0x70,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x63,0x6f,0x6e,0x64,0x3d,0x22,0x69,0x73,0x56,0x61,0x6c,0x69,0x64,0x4d,0x65,0x64,0x69,0x61,0x28,0x29,0x22,0, // 3: transition instruction in state stopped with cond=\"isValidMedia()\" 0x74,0x61,0x70,0, // 4: tap 0x70,0x6c,0x61,0x79,0x69,0x6e,0x67,0, // 5: playing 0x6d,0x65,0x64,0x69,0x61,0, // 6: media 0x5f,0x65,0x76,0x65,0x6e,0x74,0x2e,0x64,0x61,0x74,0x61,0x2e,0x6d,0x65,0x64,0x69,0x61,0, // 7: _event.data.media 0x61,0x73,0x73,0x69,0x67,0x6e,0x20,0x69,0x6e,0x73,0x74,0x72,0x75,0x63,0x74,0x69,0x6f,0x6e,0x20,0x69,0x6e,0x20,0x73,0x74,0x61,0x74,0x65,0x20,0x70,0x6c,0x61,0x79,0x69,0x6e,0x67,0x20,0x77,0x69,0x74,0x68,0x20,0x65,0x78,0x70,0x72,0x3d,0x22,0x5f,0x65,0x76,0x65,0x6e,0x74,0x2e,0x64,0x61,0x74,0x61,0x2e,0x6d,0x65,0x64,0x69,0x61,0x22,0, // 8: assign instruction in state playing with expr=\"_event.data.media\" 0x73,0x65,0x6e,0x64,0x20,0x69,0x6e,0x73,0x74,0x72,0x75,0x63,0x74,0x69,0x6f,0x6e,0x20,0x69,0x6e,0x20,0x73,0x74,0x61,0x74,0x65,0x20,0x70,0x6c,0x61,0x79,0x69,0x6e,0x67,0, // 9: send instruction in state playing 0x70,0x6c,0x61,0x79,0x62,0x61,0x63,0x6b,0x53,0x74,0x61,0x72,0x74,0x65,0x64,0, // 10: playbackStarted 0x70,0x61,0x72,0x61,0x6d,0x20,0x69,0x6e,0x73,0x74,0x72,0x75,0x63,0x74,0x69,0x6f,0x6e,0x20,0x69,0x6e,0x20,0x73,0x74,0x61,0x74,0x65,0x20,0x70,0x6c,0x61,0x79,0x69,0x6e,0x67,0x20,0x77,0x69,0x74,0x68,0x20,0x65,0x78,0x70,0x72,0x3d,0x22,0x6d,0x65,0x64,0x69,0x61,0x22,0, // 11: param instruction in state playing with expr=\"media\" 0x70,0x6c,0x61,0x79,0x62,0x61,0x63,0x6b,0x53,0x74,0x6f,0x70,0x70,0x65,0x64,0, // 12: playbackStopped 0x21,0x69,0x73,0x56,0x61,0x6c,0x69,0x64,0x4d,0x65,0x64,0x69,0x61,0x28,0x29,0x20,0x7c,0x7c,0x20,0x6d,0x65,0x64,0x69,0x61,0x20,0x3d,0x3d,0x3d,0x20,0x5f,0x65,0x76,0x65,0x6e,0x74,0x2e,0x64,0x61,0x74,0x61,0x2e,0x6d,0x65,0x64,0x69,0x61,0, // 13: !isValidMedia() || media === _event.data.media 0x74,0x72,0x61,0x6e,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x69,0x6e,0x73,0x74,0x72,0x75,0x63,0x74,0x69,0x6f,0x6e,0x20,0x69,0x6e,0x20,0x73,0x74,0x61,0x74,0x65,0x20,0x70,0x6c,0x61,0x79,0x69,0x6e,0x67,0x20,0x77,0x69,0x74,0x68,0x20,0x63,0x6f,0x6e,0x64,0x3d,0x22,0x21,0x69,0x73,0x56,0x61,0x6c,0x69,0x64,0x4d,0x65,0x64,0x69,0x61,0x28,0x29,0x20,0x7c,0x7c,0x20,0x6d,0x65,0x64,0x69,0x61,0x20,0x3d,0x3d,0x3d,0x20,0x5f,0x65,0x76,0x65,0x6e,0x74,0x2e,0x64,0x61,0x74,0x61,0x2e,0x6d,0x65,0x64,0x69,0x61,0x22,0, // 14: transition instruction in state playing with cond=\"!isValidMedia() || media === _event.data.media\" 0x69,0x73,0x56,0x61,0x6c,0x69,0x64,0x4d,0x65,0x64,0x69,0x61,0x28,0x29,0x20,0x26,0x26,0x20,0x6d,0x65,0x64,0x69,0x61,0x20,0x21,0x3d,0x3d,0x20,0x5f,0x65,0x76,0x65,0x6e,0x74,0x2e,0x64,0x61,0x74,0x61,0x2e,0x6d,0x65,0x64,0x69,0x61,0, // 15: isValidMedia() && media !== _event.data.media 0x74,0x72,0x61,0x6e,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x69,0x6e,0x73,0x74,0x72,0x75,0x63,0x74,0x69,0x6f,0x6e,0x20,0x69,0x6e,0x20,0x73,0x74,0x61,0x74,0x65,0x20,0x70,0x6c,0x61,0x79,0x69,0x6e,0x67,0x20,0x77,0x69,0x74,0x68,0x20,0x63,0x6f,0x6e,0x64,0x3d,0x22,0x69,0x73,0x56,0x61,0x6c,0x69,0x64,0x4d,0x65,0x64,0x69,0x61,0x28,0x29,0x20,0x26,0x26,0x20,0x6d,0x65,0x64,0x69,0x61,0x20,0x21,0x3d,0x3d,0x20,0x5f,0x65,0x76,0x65,0x6e,0x74,0x2e,0x64,0x61,0x74,0x61,0x2e,0x6d,0x65,0x64,0x69,0x61,0x22,0, // 16: transition instruction in state playing with cond=\"isValidMedia() && media !== _event.data.media\" 0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x20,0x69,0x73,0x56,0x61,0x6c,0x69,0x64,0x4d,0x65,0x64,0x69,0x61,0x28,0x29,0x20,0x7b,0xa,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x61,0x72,0x20,0x6d,0x20,0x3d,0x20,0x5f,0x65,0x76,0x65,0x6e,0x74,0x2e,0x64,0x61,0x74,0x61,0x2e,0x6d,0x65,0x64,0x69,0x61,0xa,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x6d,0x20,0x2b,0x20,0x22,0x22,0x29,0x2e,0x6c,0x65,0x6e,0x67,0x74,0x68,0x20,0x3e,0x20,0x30,0xa,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0, // 17: function isValidMedia() {\n var m = _event.data.media\n return (m + \"\").length > 0\n } 0x73,0x63,0x72,0x69,0x70,0x74,0x20,0x69,0x6e,0x73,0x74,0x72,0x75,0x63,0x74,0x69,0x6f,0x6e,0x20,0x69,0x6e,0x20,0x73,0x74,0x61,0x74,0x65,0x20,0x28,0x6e,0x6f,0x6e,0x65,0x29,0x20,0x77,0x69,0x74,0x68,0x20,0x73,0x6f,0x75,0x72,0x63,0x65,0x3d,0x22,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x20,0x69,0x73,0x56,0x61,0x6c,0x69,0x64,0x4d,0x65,0x64,0x69,0x61,0x28,0x29,0x20,0x7b,0xa,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x61,0x72,0x20,0x6d,0x20,0x3d,0x20,0x5f,0x65,0x76,0x65,0x6e,0x74,0x2e,0x64,0x61,0x74,0x61,0x2e,0x6d,0x65,0x64,0x69,0x61,0xa,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x6d,0x20,0x2b,0x20,0x22,0x22,0x29,0x2e,0x6c,0x65,0x6e,0x67,0x74,0x68,0x20,0x3e,0x20,0x30,0xa,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x22,0 // 18: script instruction in state (none) with source=\"function isValidMedia() {\n var m = _event.data.media\n return (m + \"\").length > 0\n }\" }}; const qint32 MediaPlayerStateMachine::Data::theStateMachineTable[] = { 0x1, // version 0, // name 1, // data-model 17, // child states array offset 3, // transition to initial states -1, // initial setup 0, // binding -1, // maxServiceId 14, 2, // state offset and count 36, 4, // transition offset and count 60, 22, // array offset and size // States: 1, -1, 0, -1, -1, -1, -1, -1, -1, 4, -1, 5, -1, 0, -1, -1, 0, 26, -1, -1, 14, -1, // Transitions: 2, 0, 1, 0, 0, -1, 8, 2, 1, 1, 6, -1, 12, 3, 1, 1, 10, -1, -1, -1, 2, -1, 20, -1, // Arrays: 1, 1, 1, 4, 1, 0, 1, 0, 1, 4, 1, 1, 1, 4, 2, 1, 2, 2, 0, 1, 1, 0, 0xc0ff33 // terminator }; struct qt_meta_stringdata_MediaPlayerStateMachine_t { QByteArrayData data[8]; unsigned char stringdata0[85]; }; #define QT_MOC_LITERAL(idx, ofs, len) \ Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ qptrdiff(offsetof(qt_meta_stringdata_MediaPlayerStateMachine_t, stringdata0) + ofs \ - idx * sizeof(QByteArrayData)) \ ) static const qt_meta_stringdata_MediaPlayerStateMachine_t qt_meta_stringdata_MediaPlayerStateMachine = { { QT_MOC_LITERAL(0, 0, 23), // "MediaPlayerStateMachine" QT_MOC_LITERAL(1, 24, 14), // "stoppedChanged" QT_MOC_LITERAL(2, 39, 0), // "" QT_MOC_LITERAL(3, 40, 6), // "active" QT_MOC_LITERAL(4, 47, 14), // "playingChanged" QT_MOC_LITERAL(5, 62, 6), // "parent" QT_MOC_LITERAL(6, 69, 7), // "stopped" QT_MOC_LITERAL(7, 77, 7) // "playing" },{ 0x4d,0x65,0x64,0x69,0x61,0x50,0x6c,0x61,0x79,0x65,0x72,0x53,0x74,0x61,0x74,0x65,0x4d,0x61,0x63,0x68,0x69,0x6e,0x65,0, // 0: MediaPlayerStateMachine 0x73,0x74,0x6f,0x70,0x70,0x65,0x64,0x43,0x68,0x61,0x6e,0x67,0x65,0x64,0, // 1: stoppedChanged 0, // 2: 0x61,0x63,0x74,0x69,0x76,0x65,0, // 3: active 0x70,0x6c,0x61,0x79,0x69,0x6e,0x67,0x43,0x68,0x61,0x6e,0x67,0x65,0x64,0, // 4: playingChanged 0x70,0x61,0x72,0x65,0x6e,0x74,0, // 5: parent 0x73,0x74,0x6f,0x70,0x70,0x65,0x64,0, // 6: stopped 0x70,0x6c,0x61,0x79,0x69,0x6e,0x67,0 // 7: playing }}; #undef QT_MOC_LITERAL static const uint qt_meta_data_MediaPlayerStateMachine[] = { // content: 8, // revision 0, // classname 0, 0, // classinfo 2, 14, // methods 2, 33, // properties 0, 0, // enums/sets 1, 41, // constructors 0, // flags 2, // signalCount // signals: name, argc, parameters, tag, flags 1, 1, 24, 2, 0x06 /* Public */, 4, 1, 27, 2, 0x06 /* Public */, // signals: parameters QMetaType::Void, QMetaType::Bool, 3, QMetaType::Void, QMetaType::Bool, 3, // constructors: parameters 0x80000000 | 2, QMetaType::QObjectStar, 5, // properties: name, type, flags 6, QMetaType::Bool, 0x006a6001, 7, QMetaType::Bool, 0x006a6001, // properties: notify_signal_id 0, 1, // constructors: name, argc, parameters, tag, flags 0, 1, 30, 2, 0x0e /* Public */, 0 // eod }; void MediaPlayerStateMachine::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { if (_c == QMetaObject::CreateInstance) { switch (_id) { case 0: { MediaPlayerStateMachine *_r = new MediaPlayerStateMachine((*reinterpret_cast< QObject **>(_a[1]))); if (_a[0]) *reinterpret_cast<QObject**>(_a[0]) = _r; } break; default: break; } } else if (_c == QMetaObject::InvokeMetaMethod) { MediaPlayerStateMachine *_t = static_cast<MediaPlayerStateMachine *>(_o); Q_UNUSED(_t) switch (_id) { case 0: QMetaObject::activate(_o, &staticMetaObject, 0, _a); break; case 1: QMetaObject::activate(_o, &staticMetaObject, 1, _a); break; default: ; } } else if (_c == QMetaObject::IndexOfMethod) { int *result = reinterpret_cast<int *>(_a[0]); void **func = reinterpret_cast<void **>(_a[1]); Q_UNUSED(result); Q_UNUSED(func); } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { MediaPlayerStateMachine *_t = static_cast<MediaPlayerStateMachine *>(_o); Q_UNUSED(_t) void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = _t->isActive(0); break; case 1: *reinterpret_cast< bool*>(_v) = _t->isActive(1); break; default: break; } } else if (_c == QMetaObject::WriteProperty) { } else if (_c == QMetaObject::ResetProperty) { } #endif // QT_NO_PROPERTIES } const QMetaObject MediaPlayerStateMachine::staticMetaObject = { { &QScxmlStateMachine::staticMetaObject, qt_meta_stringdata_MediaPlayerStateMachine.data, qt_meta_data_MediaPlayerStateMachine, qt_static_metacall, nullptr, nullptr} }; const QMetaObject *MediaPlayerStateMachine::metaObject() const { return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; } void *MediaPlayerStateMachine::qt_metacast(const char *_clname) { if (!_clname) return nullptr; if (!strcmp(_clname, reinterpret_cast<const char *>( qt_meta_stringdata_MediaPlayerStateMachine.stringdata0))) return static_cast<void*>(const_cast< MediaPlayerStateMachine*>(this)); return QScxmlStateMachine::qt_metacast(_clname); } int MediaPlayerStateMachine::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QScxmlStateMachine::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 2) qt_static_metacall(this, _c, _id, _a); _id -= 2; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { if (_id < 2) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 2; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty || _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) { qt_static_metacall(this, _c, _id, _a); _id -= 2; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 2; } #endif // QT_NO_PROPERTIES return _id; }