diff options
author | Lorn Potter <lorn.potter@gmail.com> | 2018-01-09 07:31:51 +1000 |
---|---|---|
committer | Lorn Potter <lorn.potter@gmail.com> | 2018-01-17 22:22:43 +0000 |
commit | ee0a98196e148694cc666a2cb4e145bc01c73a7d (patch) | |
tree | dc3f610a1ccda1a7068b907cd9eaf5a600a294cb | |
parent | 3a4956f3bbc99bc69ee3fbce92275d002125d0eb (diff) |
wasm: refactor QHTML5 to QHtml5
Both are currently used. More consistent and with Qt conventions.
Change-Id: I22564305dbd642583874e426967ae05a9160bdec
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r-- | src/plugins/platforms/html5/html5.pro | 2 | ||||
-rw-r--r-- | src/plugins/platforms/html5/main.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5backingstore.cpp | 22 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5backingstore.h | 6 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5compositor.cpp | 12 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5compositor.h | 14 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5eventtranslator.cpp | 22 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5eventtranslator.h | 4 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5integration.cpp | 48 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5integration.h | 24 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5openglcontext.cpp | 28 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5openglcontext.h | 6 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5screen.cpp | 22 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5screen.h | 10 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5window.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/html5/qhtml5window.h | 10 |
16 files changed, 121 insertions, 121 deletions
diff --git a/src/plugins/platforms/html5/html5.pro b/src/plugins/platforms/html5/html5.pro index 8e69d645d3..d8de342683 100644 --- a/src/plugins/platforms/html5/html5.pro +++ b/src/plugins/platforms/html5/html5.pro @@ -50,6 +50,6 @@ shell_file.files = html5_shell.html INSTALLS += shell_file PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QHTML5IntegrationPlugin +PLUGIN_CLASS_NAME = QHtml5IntegrationPlugin !equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - load(qt_plugin) diff --git a/src/plugins/platforms/html5/main.cpp b/src/plugins/platforms/html5/main.cpp index 34a38117d7..768c951e17 100644 --- a/src/plugins/platforms/html5/main.cpp +++ b/src/plugins/platforms/html5/main.cpp @@ -32,7 +32,7 @@ QT_BEGIN_NAMESPACE -class QHTML5IntegrationPlugin : public QPlatformIntegrationPlugin +class QHtml5IntegrationPlugin : public QPlatformIntegrationPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "html5.json") @@ -40,11 +40,11 @@ public: QPlatformIntegration *create(const QString&, const QStringList&) override; }; -QPlatformIntegration* QHTML5IntegrationPlugin::create(const QString& system, const QStringList& paramList) +QPlatformIntegration* QHtml5IntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); if (!system.compare(QLatin1String("html5"), Qt::CaseInsensitive)) - return new QHTML5Integration; + return new QHtml5Integration; return 0; } diff --git a/src/plugins/platforms/html5/qhtml5backingstore.cpp b/src/plugins/platforms/html5/qhtml5backingstore.cpp index 452db99cc4..12fe2fb9b1 100644 --- a/src/plugins/platforms/html5/qhtml5backingstore.cpp +++ b/src/plugins/platforms/html5/qhtml5backingstore.cpp @@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE -QHTML5BackingStore::QHTML5BackingStore(QHtml5Compositor *compositor, QWindow *window) +QHtml5BackingStore::QHtml5BackingStore(QHtml5Compositor *compositor, QWindow *window) : QPlatformBackingStore(window) , mCompositor(compositor) , mTexture(new QOpenGLTexture(QOpenGLTexture::Target2D)) @@ -51,16 +51,16 @@ QHTML5BackingStore::QHTML5BackingStore(QHtml5Compositor *compositor, QWindow *wi html5Window->setBackingStore(this); } -QHTML5BackingStore::~QHTML5BackingStore() +QHtml5BackingStore::~QHtml5BackingStore() { } -QPaintDevice *QHTML5BackingStore::paintDevice() +QPaintDevice *QHtml5BackingStore::paintDevice() { return &mImage; } -void QHTML5BackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) +void QHtml5BackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(window); Q_UNUSED(region); @@ -69,7 +69,7 @@ void QHTML5BackingStore::flush(QWindow *window, const QRegion ®ion, const QPo mCompositor->requestRedraw(); /* - auto* screen = static_cast<QHTML5Screen *>(window->screen()->handle()); + auto* screen = static_cast<QHtml5Screen *>(window->screen()->handle()); mContext->makeCurrent(window); @@ -104,7 +104,7 @@ void QHTML5BackingStore::flush(QWindow *window, const QRegion ®ion, const QPo */ } -void QHTML5BackingStore::updateTexture() +void QHtml5BackingStore::updateTexture() { if (mDirty.isNull()) return; @@ -149,7 +149,7 @@ void QHTML5BackingStore::updateTexture() mDirty = QRegion(); } -void QHTML5BackingStore::beginPaint(const QRegion ®ion) +void QHtml5BackingStore::beginPaint(const QRegion ®ion) { mDirty |= region; //mContext->makeCurrent(window()); @@ -164,7 +164,7 @@ void QHTML5BackingStore::beginPaint(const QRegion ®ion) painter.fillRect(rect, blank); } -void QHTML5BackingStore::resize(const QSize &size, const QRegion &staticContents) +void QHtml5BackingStore::resize(const QSize &size, const QRegion &staticContents) { Q_UNUSED(staticContents) @@ -180,18 +180,18 @@ void QHTML5BackingStore::resize(const QSize &size, const QRegion &staticContents */ } -QImage QHTML5BackingStore::toImage() const +QImage QHtml5BackingStore::toImage() const { // used by QPlatformBackingStore::composeAndFlush return mImage; } -const QImage &QHTML5BackingStore::getImageRef() const +const QImage &QHtml5BackingStore::getImageRef() const { return mImage; } -const QOpenGLTexture* QHTML5BackingStore::getUpdatedTexture() +const QOpenGLTexture* QHtml5BackingStore::getUpdatedTexture() { updateTexture(); return mTexture.data(); diff --git a/src/plugins/platforms/html5/qhtml5backingstore.h b/src/plugins/platforms/html5/qhtml5backingstore.h index 436e70aaec..2a0a06894b 100644 --- a/src/plugins/platforms/html5/qhtml5backingstore.h +++ b/src/plugins/platforms/html5/qhtml5backingstore.h @@ -39,11 +39,11 @@ class QOpenGLTexture; class QRegion; class QHtml5Compositor; -class QHTML5BackingStore : public QPlatformBackingStore +class QHtml5BackingStore : public QPlatformBackingStore { public: - QHTML5BackingStore(QHtml5Compositor *compositor, QWindow *window); - ~QHTML5BackingStore(); + QHtml5BackingStore(QHtml5Compositor *compositor, QWindow *window); + ~QHtml5BackingStore(); QPaintDevice *paintDevice() override; diff --git a/src/plugins/platforms/html5/qhtml5compositor.cpp b/src/plugins/platforms/html5/qhtml5compositor.cpp index 6321505d46..2f8ad5c721 100644 --- a/src/plugins/platforms/html5/qhtml5compositor.cpp +++ b/src/plugins/platforms/html5/qhtml5compositor.cpp @@ -110,7 +110,7 @@ void QHtml5Compositor::removeWindow(QHtml5Window *window) notifyTopWindowChanged(window); } -void QHtml5Compositor::setScreen(QHTML5Screen *screen) +void QHtml5Compositor::setScreen(QHtml5Screen *screen) { mScreen = screen; } @@ -223,7 +223,7 @@ bool QHtml5Compositor::event(QEvent *ev) return QObject::event(ev); } -void QHtml5Compositor::blit(QOpenGLTextureBlitter *blitter, QHTML5Screen *screen, const QOpenGLTexture *texture, QRect targetGeometry) +void QHtml5Compositor::blit(QOpenGLTextureBlitter *blitter, QHtml5Screen *screen, const QOpenGLTexture *texture, QRect targetGeometry) { QMatrix4x4 m; m.translate(-1.0f, -1.0f); @@ -242,9 +242,9 @@ void QHtml5Compositor::blit(QOpenGLTextureBlitter *blitter, QHTML5Screen *screen blitter->blit(texture->textureId(), m, QOpenGLTextureBlitter::OriginTopLeft); } -void QHtml5Compositor::drawWindowContent(QOpenGLTextureBlitter *blitter, QHTML5Screen *screen, QHtml5Window *window) +void QHtml5Compositor::drawWindowContent(QOpenGLTextureBlitter *blitter, QHtml5Screen *screen, QHtml5Window *window) { - QHTML5BackingStore* backingStore = window->backingStore(); + QHtml5BackingStore* backingStore = window->backingStore(); QOpenGLTexture const* texture = backingStore->getUpdatedTexture(); @@ -395,7 +395,7 @@ QHtml5Compositor::QHtml5TitleBarOptions QHtml5Compositor::makeTitleBarOptions(co return titleBarOptions; } -void QHtml5Compositor::drawWindowDecorations(QOpenGLTextureBlitter *blitter, QHTML5Screen *screen, QHtml5Window *window) +void QHtml5Compositor::drawWindowDecorations(QOpenGLTextureBlitter *blitter, QHtml5Screen *screen, QHtml5Window *window) { int width = window->windowFrameGeometry().width(); int height = window->windowFrameGeometry().height(); @@ -757,7 +757,7 @@ void QHtml5Compositor::drawShadePanel(QHtml5TitleBarOptions options, QPainter *p } -void QHtml5Compositor::drawWindow(QOpenGLTextureBlitter *blitter, QHTML5Screen *screen, QHtml5Window *window) +void QHtml5Compositor::drawWindow(QOpenGLTextureBlitter *blitter, QHtml5Screen *screen, QHtml5Window *window) { if (window->window()->type() != Qt::Popup) drawWindowDecorations(blitter, screen, window); diff --git a/src/plugins/platforms/html5/qhtml5compositor.h b/src/plugins/platforms/html5/qhtml5compositor.h index 6e0b2af7b5..d52d21d0d9 100644 --- a/src/plugins/platforms/html5/qhtml5compositor.h +++ b/src/plugins/platforms/html5/qhtml5compositor.h @@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE class QHtml5Window; -class QHTML5Screen; +class QHtml5Screen; class QOpenGLContext; class QOpenGLTextureBlitter; @@ -107,7 +107,7 @@ public: void addWindow(QHtml5Window *window, QHtml5Window *parentWindow = 0); void removeWindow(QHtml5Window *window); - void setScreen(QHTML5Screen *screen); + void setScreen(QHtml5Screen *screen); void setVisible(QHtml5Window *window, bool visible); void raise(QHtml5Window *window); @@ -135,17 +135,17 @@ private: void flush2(const QRegion ®ion); void flushCompletedCallback(int32_t); void notifyTopWindowChanged(QHtml5Window* window); - void drawWindow(QOpenGLTextureBlitter *blitter, QHTML5Screen *screen, QHtml5Window *window); - void drawWindowContent(QOpenGLTextureBlitter *blitter, QHTML5Screen *screen, QHtml5Window *window); - void blit(QOpenGLTextureBlitter *blitter, QHTML5Screen *screen, const QOpenGLTexture *texture, QRect targetGeometry); + void drawWindow(QOpenGLTextureBlitter *blitter, QHtml5Screen *screen, QHtml5Window *window); + void drawWindowContent(QOpenGLTextureBlitter *blitter, QHtml5Screen *screen, QHtml5Window *window); + void blit(QOpenGLTextureBlitter *blitter, QHtml5Screen *screen, const QOpenGLTexture *texture, QRect targetGeometry); - void drawWindowDecorations(QOpenGLTextureBlitter *blitter, QHTML5Screen *screen, QHtml5Window *window); + void drawWindowDecorations(QOpenGLTextureBlitter *blitter, QHtml5Screen *screen, QHtml5Window *window); void drwPanelButton(); private: QImage *m_frameBuffer; QScopedPointer<QOpenGLContext> mContext; QScopedPointer<QOpenGLTextureBlitter> mBlitter; - QHTML5Screen *mScreen; + QHtml5Screen *mScreen; QHash<QHtml5Window *, QHtml5CompositedWindow> m_compositedWindows; QList<QHtml5Window *> m_windowStack; diff --git a/src/plugins/platforms/html5/qhtml5eventtranslator.cpp b/src/plugins/platforms/html5/qhtml5eventtranslator.cpp index 6d4a910e07..3f394ddff9 100644 --- a/src/plugins/platforms/html5/qhtml5eventtranslator.cpp +++ b/src/plugins/platforms/html5/qhtml5eventtranslator.cpp @@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE -QHTML5EventTranslator::QHTML5EventTranslator(QObject *parent) +QHtml5EventTranslator::QHtml5EventTranslator(QObject *parent) : QObject(parent) , draggedWindow(nullptr) , pressedButtons(Qt::NoButton) @@ -57,7 +57,7 @@ QHTML5EventTranslator::QHTML5EventTranslator(QObject *parent) emscripten_set_focus_callback(0,(void *)this, 1, &focus_cb); } -QFlags<Qt::KeyboardModifier> QHTML5EventTranslator::translateKeyModifier(const EmscriptenKeyboardEvent *keyEvent) +QFlags<Qt::KeyboardModifier> QHtml5EventTranslator::translateKeyModifier(const EmscriptenKeyboardEvent *keyEvent) { QFlags<Qt::KeyboardModifier> keyModifier = Qt::NoModifier; if (keyEvent->shiftKey) { @@ -79,7 +79,7 @@ QFlags<Qt::KeyboardModifier> QHTML5EventTranslator::translateKeyModifier(const E return keyModifier; } -QFlags<Qt::KeyboardModifier> QHTML5EventTranslator::translateMouseModifier(const EmscriptenMouseEvent *mouseEvent) +QFlags<Qt::KeyboardModifier> QHtml5EventTranslator::translateMouseModifier(const EmscriptenMouseEvent *mouseEvent) { QFlags<Qt::KeyboardModifier> keyModifier = Qt::NoModifier; if (mouseEvent->ctrlKey) { @@ -97,7 +97,7 @@ QFlags<Qt::KeyboardModifier> QHTML5EventTranslator::translateMouseModifier(const return keyModifier; } -int QHTML5EventTranslator::keyboard_cb(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData) +int QHtml5EventTranslator::keyboard_cb(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData) { Q_UNUSED(userData) @@ -130,7 +130,7 @@ int QHTML5EventTranslator::keyboard_cb(int eventType, const EmscriptenKeyboardEv return 0; } -Qt::Key QHTML5EventTranslator::translateEmscriptKey(const EmscriptenKeyboardEvent *emscriptKey, bool *outAlphanumeric) +Qt::Key QHtml5EventTranslator::translateEmscriptKey(const EmscriptenKeyboardEvent *emscriptKey, bool *outAlphanumeric) { Qt::Key qtKey; if (outAlphanumeric) @@ -218,7 +218,7 @@ Qt::Key QHTML5EventTranslator::translateEmscriptKey(const EmscriptenKeyboardEven return qtKey; } -Qt::MouseButton QHTML5EventTranslator::translateMouseButton(unsigned short button) +Qt::MouseButton QHtml5EventTranslator::translateMouseButton(unsigned short button) { if (button == 0) return Qt::LeftButton; @@ -230,9 +230,9 @@ Qt::MouseButton QHTML5EventTranslator::translateMouseButton(unsigned short butto return Qt::NoButton; } -int QHTML5EventTranslator::mouse_cb(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) +int QHtml5EventTranslator::mouse_cb(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) { - QHTML5EventTranslator *translator = (QHTML5EventTranslator*)userData; + QHtml5EventTranslator *translator = (QHtml5EventTranslator*)userData; translator->processMouse(eventType,mouseEvent); return 0; } @@ -293,7 +293,7 @@ void resizeWindow(QWindow *window, QHtml5Window::ResizeMode mode, window->setGeometry(x1, y1, w, h); } -void QHTML5EventTranslator::processMouse(int eventType, const EmscriptenMouseEvent *mouseEvent) +void QHtml5EventTranslator::processMouse(int eventType, const EmscriptenMouseEvent *mouseEvent) { auto timestamp = mouseEvent->timestamp; QPoint point(mouseEvent->canvasX, mouseEvent->canvasY); @@ -301,7 +301,7 @@ void QHTML5EventTranslator::processMouse(int eventType, const EmscriptenMouseEve Qt::MouseButton button = translateMouseButton(mouseEvent->button); Qt::KeyboardModifiers modifiers = translateMouseModifier(mouseEvent); - QWindow *window2 = QHTML5Integration::get()->compositor()->windowAt(point, 5); + QWindow *window2 = QHtml5Integration::get()->compositor()->windowAt(point, 5); QHtml5Window *htmlWindow = static_cast<QHtml5Window*>(window2->handle()); bool onFrame = false; if (window2 && !window2->geometry().contains(point)) @@ -379,7 +379,7 @@ void QHTML5EventTranslator::processMouse(int eventType, const EmscriptenMouseEve QCoreApplication::processEvents(); // probably not the best way } -int QHTML5EventTranslator::focus_cb(int /*eventType*/, const EmscriptenFocusEvent */*focusEvent*/, void */*userData*/) +int QHtml5EventTranslator::focus_cb(int /*eventType*/, const EmscriptenFocusEvent */*focusEvent*/, void */*userData*/) { // qDebug() << Q_FUNC_INFO << eventType << focusEvent; return 0; diff --git a/src/plugins/platforms/html5/qhtml5eventtranslator.h b/src/plugins/platforms/html5/qhtml5eventtranslator.h index fea7c653f5..688c7f3e1c 100644 --- a/src/plugins/platforms/html5/qhtml5eventtranslator.h +++ b/src/plugins/platforms/html5/qhtml5eventtranslator.h @@ -40,7 +40,7 @@ QT_BEGIN_NAMESPACE class QWindow; -class QHTML5EventTranslator : public QObject +class QHtml5EventTranslator : public QObject { Q_OBJECT @@ -171,7 +171,7 @@ class QHTML5EventTranslator : public QObject public: - explicit QHTML5EventTranslator(QObject *parent = 0); + explicit QHtml5EventTranslator(QObject *parent = 0); static int keyboard_cb(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData); static int mouse_cb(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData); diff --git a/src/plugins/platforms/html5/qhtml5integration.cpp b/src/plugins/platforms/html5/qhtml5integration.cpp index 598b3baf5d..dbbd4df09f 100644 --- a/src/plugins/platforms/html5/qhtml5integration.cpp +++ b/src/plugins/platforms/html5/qhtml5integration.cpp @@ -55,15 +55,15 @@ using namespace emscripten; QT_BEGIN_NAMESPACE void browserBeforeUnload() { - QHTML5Integration::QHTML5BrowserExit(); + QHtml5Integration::QHtml5BrowserExit(); } EMSCRIPTEN_BINDINGS(my_module) { function("browserBeforeUnload", &browserBeforeUnload); } -static QHTML5Integration *globalHtml5Integration; -QHTML5Integration *QHTML5Integration::get() { return globalHtml5Integration; } +static QHtml5Integration *globalHtml5Integration; +QHtml5Integration *QHtml5Integration::get() { return globalHtml5Integration; } void emscriptenOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) { @@ -92,10 +92,10 @@ void emscriptenOutput(QtMsgType type, const QMessageLogContext &context, const Q } } -QHTML5Integration::QHTML5Integration() +QHtml5Integration::QHtml5Integration() : mFontDb(0), mCompositor(new QHtml5Compositor), - mScreen(new QHTML5Screen(mCompositor)), + mScreen(new QHtml5Screen(mCompositor)), m_eventDispatcher(0) { qSetMessagePattern(QString("(%{function}:%{line}) - %{message}")); @@ -107,9 +107,9 @@ QHTML5Integration::QHTML5Integration() screenAdded(mScreen); emscripten_set_resize_callback(0, (void *)this, 1, uiEvent_cb); - m_eventTranslator = new QHTML5EventTranslator(); + m_eventTranslator = new QHtml5EventTranslator(); #ifdef QEGL_EXTRA_DEBUG - qWarning("QHTML5Integration\n"); + qWarning("QHtml5Integration\n"); #endif EM_ASM(// exit app if browser closes window.onbeforeunload = function () { @@ -118,7 +118,7 @@ QHTML5Integration::QHTML5Integration() ); } -QHTML5Integration::~QHTML5Integration() +QHtml5Integration::~QHtml5Integration() { qDebug() << Q_FUNC_INFO; delete mCompositor; @@ -127,13 +127,13 @@ QHTML5Integration::~QHTML5Integration() delete m_eventTranslator; } -void QHTML5Integration::QHTML5BrowserExit() +void QHtml5Integration::QHtml5BrowserExit() { QCoreApplication *app = QCoreApplication::instance(); app->quit(); } -bool QHTML5Integration::hasCapability(QPlatformIntegration::Capability cap) const +bool QHtml5Integration::hasCapability(QPlatformIntegration::Capability cap) const { switch (cap) { case ThreadedPixmaps: return true; @@ -146,10 +146,10 @@ bool QHTML5Integration::hasCapability(QPlatformIntegration::Capability cap) cons } } -QPlatformWindow *QHTML5Integration::createPlatformWindow(QWindow *window) const +QPlatformWindow *QHtml5Integration::createPlatformWindow(QWindow *window) const { #ifdef QEGL_EXTRA_DEBUG - qWarning("QHTML5Integration::createPlatformWindow %p\n",window); + qWarning("QHtml5Integration::createPlatformWindow %p\n",window); #endif QHtml5Window *w = new QHtml5Window(window, mCompositor, m_backingStores.value(window)); @@ -158,13 +158,13 @@ QPlatformWindow *QHTML5Integration::createPlatformWindow(QWindow *window) const return w; } -QPlatformBackingStore *QHTML5Integration::createPlatformBackingStore(QWindow *window) const +QPlatformBackingStore *QHtml5Integration::createPlatformBackingStore(QWindow *window) const { //#ifdef QEGL_EXTRA_DEBUG - qWarning("QHTML5Integration::createWindowSurface %p\n", window); + qWarning("QHtml5Integration::createWindowSurface %p\n", window); //#endif #ifndef QT_NO_OPENGL - QHTML5BackingStore *backingStore = new QHTML5BackingStore(mCompositor, window); + QHtml5BackingStore *backingStore = new QHtml5BackingStore(mCompositor, window); m_backingStores.insert(window, backingStore); return backingStore; #else @@ -173,13 +173,13 @@ QPlatformBackingStore *QHTML5Integration::createPlatformBackingStore(QWindow *wi } #ifndef QT_NO_OPENGL -QPlatformOpenGLContext *QHTML5Integration::createPlatformOpenGLContext(QOpenGLContext *context) const +QPlatformOpenGLContext *QHtml5Integration::createPlatformOpenGLContext(QOpenGLContext *context) const { - return new QHTML5OpenGLContext(context->format()); + return new QHtml5OpenGLContext(context->format()); } #endif -QPlatformFontDatabase *QHTML5Integration::fontDatabase() const +QPlatformFontDatabase *QHtml5Integration::fontDatabase() const { if (mFontDb == 0) mFontDb = new QHtml5FontDatabase(); @@ -187,17 +187,17 @@ QPlatformFontDatabase *QHTML5Integration::fontDatabase() const return mFontDb; } -QAbstractEventDispatcher *QHTML5Integration::createEventDispatcher() const +QAbstractEventDispatcher *QHtml5Integration::createEventDispatcher() const { return new QHtml5EventDispatcher(); } -QVariant QHTML5Integration::styleHint(QPlatformIntegration::StyleHint hint) const +QVariant QHtml5Integration::styleHint(QPlatformIntegration::StyleHint hint) const { return QPlatformIntegration::styleHint(hint); } -int QHTML5Integration::uiEvent_cb(int eventType, const EmscriptenUiEvent *e, void *userData) +int QHtml5Integration::uiEvent_cb(int eventType, const EmscriptenUiEvent *e, void *userData) { Q_UNUSED(e) Q_UNUSED(userData) @@ -221,7 +221,7 @@ static void set_canvas_size(double width, double height) }, width, height); } -void QHTML5Integration::updateQScreenAndCanvasRenderSize() +void QHtml5Integration::updateQScreenAndCanvasRenderSize() { // The HTML canvas has two sizes: the CSS size and the canvas render size. // The CSS size is determined according to standard CSS rules, while the @@ -233,8 +233,8 @@ void QHTML5Integration::updateQScreenAndCanvasRenderSize() set_canvas_size(css_width, css_height); QSizeF cssSize(css_width, css_height); - QHTML5Integration::get()->mScreen->setGeometry(QRect(QPoint(0, 0), cssSize.toSize())); - QHTML5Integration::get()->mCompositor->requestRedraw(); + QHtml5Integration::get()->mScreen->setGeometry(QRect(QPoint(0, 0), cssSize.toSize())); + QHtml5Integration::get()->mCompositor->requestRedraw(); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/html5/qhtml5integration.h b/src/plugins/platforms/html5/qhtml5integration.h index cec5d3e9a8..cf06040fde 100644 --- a/src/plugins/platforms/html5/qhtml5integration.h +++ b/src/plugins/platforms/html5/qhtml5integration.h @@ -42,20 +42,20 @@ QT_BEGIN_NAMESPACE -class QHTML5EventTranslator; +class QHtml5EventTranslator; class QHtml5FontDatabase; class QHtml5Window; class QHtml5EventDispatcher; -class QHTML5Screen; +class QHtml5Screen; class QHtml5Compositor; -class QHTML5BackingStore; +class QHtml5BackingStore; -class QHTML5Integration : public QObject, public QPlatformIntegration +class QHtml5Integration : public QObject, public QPlatformIntegration { Q_OBJECT public: - QHTML5Integration(); - ~QHTML5Integration(); + QHtml5Integration(); + ~QHtml5Integration(); bool hasCapability(QPlatformIntegration::Capability cap) const override; QPlatformWindow *createPlatformWindow(QWindow *window) const override; @@ -67,20 +67,20 @@ public: QAbstractEventDispatcher *createEventDispatcher() const override; QVariant styleHint(QPlatformIntegration::StyleHint hint) const override; - static QHTML5Integration *get(); - QHTML5Screen *screen() { return mScreen; } + static QHtml5Integration *get(); + QHtml5Screen *screen() { return mScreen; } QHtml5Compositor *compositor() { return mCompositor; } - static void QHTML5BrowserExit(); + static void QHtml5BrowserExit(); static void updateQScreenAndCanvasRenderSize(); private: mutable QHtml5FontDatabase *mFontDb; QHtml5Compositor *mCompositor; - mutable QHTML5Screen *mScreen; - mutable QHTML5EventTranslator *m_eventTranslator; + mutable QHtml5Screen *mScreen; + mutable QHtml5EventTranslator *m_eventTranslator; mutable QHtml5EventDispatcher *m_eventDispatcher; static int uiEvent_cb(int eventType, const EmscriptenUiEvent *e, void *userData); - mutable QHash<QWindow *, QHTML5BackingStore *> m_backingStores; + mutable QHash<QWindow *, QHtml5BackingStore *> m_backingStores; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/html5/qhtml5openglcontext.cpp b/src/plugins/platforms/html5/qhtml5openglcontext.cpp index 6193e6c2fa..300c0878fc 100644 --- a/src/plugins/platforms/html5/qhtml5openglcontext.cpp +++ b/src/plugins/platforms/html5/qhtml5openglcontext.cpp @@ -33,19 +33,19 @@ QT_BEGIN_NAMESPACE -QHTML5OpenGLContext::QHTML5OpenGLContext(const QSurfaceFormat &format) +QHtml5OpenGLContext::QHtml5OpenGLContext(const QSurfaceFormat &format) :m_requestedFormat(format) { m_requestedFormat.setRenderableType(QSurfaceFormat::OpenGLES); } -QHTML5OpenGLContext::~QHTML5OpenGLContext() +QHtml5OpenGLContext::~QHtml5OpenGLContext() { if (m_context) emscripten_webgl_destroy_context(m_context); } -void QHTML5OpenGLContext::maybeRecreateEmscriptenContext(QPlatformSurface *surface) +void QHtml5OpenGLContext::maybeRecreateEmscriptenContext(QPlatformSurface *surface) { // Native emscripten contexts are tied to a single surface. Recreate // the context if the surface is changed. @@ -67,9 +67,9 @@ void QHTML5OpenGLContext::maybeRecreateEmscriptenContext(QPlatformSurface *surfa Q_UNUSED(reserved); // The application may get contex-lost if e.g. moved to the background. Set // m_contextLost which will make isValid() return false. Application code will - // then detect this and recrate the the context, resulting in a new QHTML5OpenGLContext + // then detect this and recrate the the context, resulting in a new QHtml5OpenGLContext // instance. - reinterpret_cast<QHTML5OpenGLContext *>(userData)->m_contextLost = true; + reinterpret_cast<QHtml5OpenGLContext *>(userData)->m_contextLost = true; return true; }; bool capture = true; @@ -77,7 +77,7 @@ void QHTML5OpenGLContext::maybeRecreateEmscriptenContext(QPlatformSurface *surfa } } -EMSCRIPTEN_WEBGL_CONTEXT_HANDLE QHTML5OpenGLContext::createEmscriptenContext(const char *canvasId, QSurfaceFormat format) +EMSCRIPTEN_WEBGL_CONTEXT_HANDLE QHtml5OpenGLContext::createEmscriptenContext(const char *canvasId, QSurfaceFormat format) { EmscriptenWebGLContextAttributes attributes; emscripten_webgl_init_context_attributes(&attributes); // Populate with default attributes @@ -97,45 +97,45 @@ EMSCRIPTEN_WEBGL_CONTEXT_HANDLE QHTML5OpenGLContext::createEmscriptenContext(con return context; } -QSurfaceFormat QHTML5OpenGLContext::format() const +QSurfaceFormat QHtml5OpenGLContext::format() const { return m_requestedFormat; } -GLuint QHTML5OpenGLContext::defaultFramebufferObject(QPlatformSurface *surface) const +GLuint QHtml5OpenGLContext::defaultFramebufferObject(QPlatformSurface *surface) const { return QPlatformOpenGLContext::defaultFramebufferObject(surface); } -bool QHTML5OpenGLContext::makeCurrent(QPlatformSurface *surface) +bool QHtml5OpenGLContext::makeCurrent(QPlatformSurface *surface) { maybeRecreateEmscriptenContext(surface); return emscripten_webgl_make_context_current(m_context) == EMSCRIPTEN_RESULT_SUCCESS; } -void QHTML5OpenGLContext::swapBuffers(QPlatformSurface *surface) +void QHtml5OpenGLContext::swapBuffers(QPlatformSurface *surface) { Q_UNUSED(surface); // No swapbuffers on WebGl } -void QHTML5OpenGLContext::doneCurrent() +void QHtml5OpenGLContext::doneCurrent() { // No doneCurrent on WebGl } -bool QHTML5OpenGLContext::isSharing() const +bool QHtml5OpenGLContext::isSharing() const { return false; } -bool QHTML5OpenGLContext::isValid() const +bool QHtml5OpenGLContext::isValid() const { return (m_contextLost == false); } -QFunctionPointer QHTML5OpenGLContext::getProcAddress(const char *procName) +QFunctionPointer QHtml5OpenGLContext::getProcAddress(const char *procName) { return reinterpret_cast<QFunctionPointer>(eglGetProcAddress(procName)); } diff --git a/src/plugins/platforms/html5/qhtml5openglcontext.h b/src/plugins/platforms/html5/qhtml5openglcontext.h index d3793413ed..6503cf3ab9 100644 --- a/src/plugins/platforms/html5/qhtml5openglcontext.h +++ b/src/plugins/platforms/html5/qhtml5openglcontext.h @@ -34,11 +34,11 @@ QT_BEGIN_NAMESPACE -class QHTML5OpenGLContext : public QPlatformOpenGLContext +class QHtml5OpenGLContext : public QPlatformOpenGLContext { public: - QHTML5OpenGLContext(const QSurfaceFormat &format); - ~QHTML5OpenGLContext(); + QHtml5OpenGLContext(const QSurfaceFormat &format); + ~QHtml5OpenGLContext(); QSurfaceFormat format() const override; void swapBuffers(QPlatformSurface *surface) override; diff --git a/src/plugins/platforms/html5/qhtml5screen.cpp b/src/plugins/platforms/html5/qhtml5screen.cpp index 260c363724..dfca7b941b 100644 --- a/src/plugins/platforms/html5/qhtml5screen.cpp +++ b/src/plugins/platforms/html5/qhtml5screen.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE -QHTML5Screen::QHTML5Screen(QHtml5Compositor *compositor) +QHtml5Screen::QHtml5Screen(QHtml5Compositor *compositor) : mCompositor(compositor) , m_depth(32) , m_format(QImage::Format_RGB32) @@ -56,32 +56,32 @@ QHTML5Screen::QHTML5Screen(QHtml5Compositor *compositor) mCompositor->setScreen(this); } -QHTML5Screen::~QHTML5Screen() +QHtml5Screen::~QHtml5Screen() { } -QRect QHTML5Screen::geometry() const +QRect QHtml5Screen::geometry() const { return m_geometry; } -int QHTML5Screen::depth() const +int QHtml5Screen::depth() const { return m_depth; } -QImage::Format QHTML5Screen::format() const +QImage::Format QHtml5Screen::format() const { return m_format; } -QPlatformCursor *QHTML5Screen::cursor() const +QPlatformCursor *QHtml5Screen::cursor() const { return const_cast<QHtml5Cursor *>(&m_cursor); } -void QHTML5Screen::resizeMaximizedWindows() +void QHtml5Screen::resizeMaximizedWindows() { QList<QWindow*> windows = QGuiApplication::allWindows(); // 'screen()' still has the old geometry info while 'this' has the new geometry info @@ -110,22 +110,22 @@ void QHTML5Screen::resizeMaximizedWindows() } } -QWindow *QHTML5Screen::topWindow() const +QWindow *QHtml5Screen::topWindow() const { return mCompositor->keyWindow(); } -QWindow *QHTML5Screen::topLevelAt(const QPoint & p) const +QWindow *QHtml5Screen::topLevelAt(const QPoint & p) const { return mCompositor->windowAt(p); } -void QHTML5Screen::invalidateSize() +void QHtml5Screen::invalidateSize() { m_geometry = QRect(); } -void QHTML5Screen::setGeometry(const QRect &rect) +void QHtml5Screen::setGeometry(const QRect &rect) { m_geometry = rect; QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry(), availableGeometry()); diff --git a/src/plugins/platforms/html5/qhtml5screen.h b/src/plugins/platforms/html5/qhtml5screen.h index 444f7797c3..707bca45cc 100644 --- a/src/plugins/platforms/html5/qhtml5screen.h +++ b/src/plugins/platforms/html5/qhtml5screen.h @@ -41,17 +41,17 @@ QT_BEGIN_NAMESPACE class QPlatformOpenGLContext; class QHtml5Window; -class QHTML5BackingStore; +class QHtml5BackingStore; class QHtml5Compositor; class QOpenGLContext; -class QHTML5Screen : public QObject, public QPlatformScreen +class QHtml5Screen : public QObject, public QPlatformScreen { Q_OBJECT public: - QHTML5Screen(QHtml5Compositor *compositor); - ~QHTML5Screen(); + QHtml5Screen(QHtml5Compositor *compositor); + ~QHtml5Screen(); QRect geometry() const override; int depth() const override; @@ -91,7 +91,7 @@ private: QImage::Format m_format; QHtml5Cursor m_cursor; }; -//Q_DECLARE_OPERATORS_FOR_FLAGS(QHTML5Screen::Flags) +//Q_DECLARE_OPERATORS_FOR_FLAGS(QHtml5Screen::Flags) QT_END_NAMESPACE #endif // QHTML5SCREEN_H diff --git a/src/plugins/platforms/html5/qhtml5window.cpp b/src/plugins/platforms/html5/qhtml5window.cpp index 93cee9ca4b..b05c4df8db 100644 --- a/src/plugins/platforms/html5/qhtml5window.cpp +++ b/src/plugins/platforms/html5/qhtml5window.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE //static QHtml5Window *globalHtml5Window; //QHtml5Window *QHtml5Window::get() { return globalHtml5Window; } -QHtml5Window::QHtml5Window(QWindow *w, QHtml5Compositor* compositor, QHTML5BackingStore *backingStore) +QHtml5Window::QHtml5Window(QWindow *w, QHtml5Compositor* compositor, QHtml5BackingStore *backingStore) : QPlatformWindow(w), mWindow(w), mCompositor(compositor), @@ -101,9 +101,9 @@ void QHtml5Window::create() mNormalGeometry = rect; } -QHTML5Screen *QHtml5Window::platformScreen() const +QHtml5Screen *QHtml5Window::platformScreen() const { - return static_cast<QHTML5Screen *>(window()->screen()->handle()); + return static_cast<QHtml5Screen *>(window()->screen()->handle()); } void QHtml5Window::setGeometry(const QRect &rect) diff --git a/src/plugins/platforms/html5/qhtml5window.h b/src/plugins/platforms/html5/qhtml5window.h index e64f8b8d46..f9c5063038 100644 --- a/src/plugins/platforms/html5/qhtml5window.h +++ b/src/plugins/platforms/html5/qhtml5window.h @@ -56,7 +56,7 @@ public: ResizeLeft }; - QHtml5Window(QWindow *w, QHtml5Compositor* compositor, QHTML5BackingStore *backingStore); + QHtml5Window(QWindow *w, QHtml5Compositor* compositor, QHtml5BackingStore *backingStore); ~QHtml5Window(); void create(); @@ -72,9 +72,9 @@ public: void lower() override; QRect normalGeometry() const override; - QHTML5Screen *platformScreen() const; - void setBackingStore(QHTML5BackingStore *store) { mBackingStore = store; } - QHTML5BackingStore *backingStore() const { return mBackingStore; } + QHtml5Screen *platformScreen() const; + void setBackingStore(QHtml5BackingStore *store) { mBackingStore = store; } + QHtml5BackingStore *backingStore() const { return mBackingStore; } QWindow *window() const { return mWindow; } void injectMousePressed(const QPoint &local, const QPoint &global, @@ -109,7 +109,7 @@ protected: QWindow* mWindow = nullptr; QHtml5Compositor *mCompositor = nullptr; - QHTML5BackingStore *mBackingStore = nullptr; + QHtml5BackingStore *mBackingStore = nullptr; QRect mNormalGeometry {0, 0, 0 ,0}; QRect mOldGeometry; Qt::WindowFlags mWindowFlags = Qt::Window; |