Showing the changes to interface/src/ui/InteractiveWindow.cpp (1 of 2 files). Show all
Unified · Split
| @@ -55,78 +55,6 @@ QmlWindowProxy::QmlWindowProxy(QObject* qmlObject, QObject* parent) : QmlWrapper · 54 unmodified lines | ||
| 55 | 55 | _qmlWindow = qmlObject; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | −void QmlWindowProxy::setPosition(const glm::vec2& position) { | |
| 59 | − if (_qmlWindow) { | |
| 60 | − _qmlWindow->setProperty(INTERACTIVE_WINDOW_POSITION_PROPERTY, QPointF(position.x, position.y)); | |
| 61 | − QMetaObject::invokeMethod(_qmlWindow, "updateInteractiveWindowPositionForMode"); | |
| 62 | − } | |
| 63 | −} | |
| 64 | − | |
| 65 | −glm::vec2 QmlWindowProxy::getPosition() const { | |
| 66 | − if (!_qmlWindow) { | |
| 67 | − return {}; | |
| 68 | − } | |
| 69 | − | |
| 70 | − return toGlm(_qmlWindow->property(INTERACTIVE_WINDOW_POSITION_PROPERTY).toPointF()); | |
| 71 | −} | |
| 72 | − | |
| 73 | −void QmlWindowProxy::setSize(const glm::vec2& size) { | |
| 74 | − if (_qmlWindow) { | |
| 75 | − _qmlWindow->setProperty(INTERACTIVE_WINDOW_SIZE_PROPERTY, QSize(size.x, size.y)); | |
| 76 | − QMetaObject::invokeMethod(_qmlWindow, "updateInteractiveWindowSizeForMode"); | |
| 77 | − } | |
| 78 | −} | |
| 79 | − | |
| 80 | −glm::vec2 QmlWindowProxy::getSize() const { | |
| 81 | − if (!_qmlWindow) { | |
| 82 | − return {}; | |
| 83 | − } | |
| 84 | − | |
| 85 | − return toGlm(_qmlWindow->property(INTERACTIVE_WINDOW_SIZE_PROPERTY).toSize()); | |
| 86 | −} | |
| 87 | − | |
| 88 | −void QmlWindowProxy::setTitle(const QString& title) { | |
| 89 | − if (_qmlWindow) { | |
| 90 | − _qmlWindow->setProperty(TITLE_PROPERTY, title); | |
| 91 | − } | |
| 92 | −} | |
| 93 | − | |
| 94 | −QString QmlWindowProxy::getTitle() const { | |
| 95 | − if (!_qmlWindow) { | |
| 96 | − return QString(); | |
| 97 | − } | |
| 98 | − | |
| 99 | − return _qmlWindow->property(TITLE_PROPERTY).toString(); | |
| 100 | −} | |
| 101 | − | |
| 102 | −void QmlWindowProxy::setVisible(bool visible) { | |
| 103 | − if (_qmlWindow) { | |
| 104 | − _qmlWindow->setProperty(INTERACTIVE_WINDOW_VISIBLE_PROPERTY, visible); | |
| 105 | − } | |
| 106 | −} | |
| 107 | − | |
| 108 | −bool QmlWindowProxy::isVisible() const { | |
| 109 | − if (!_qmlWindow) { | |
| 110 | − return false; | |
| 111 | − } | |
| 112 | − | |
| 113 | − return _qmlWindow->property(INTERACTIVE_WINDOW_VISIBLE_PROPERTY).toBool(); | |
| 114 | −} | |
| 115 | − | |
| 116 | −void QmlWindowProxy::setPresentationMode(int presentationMode) { | |
| 117 | − if (_qmlWindow) { | |
| 118 | − _qmlWindow->setProperty(PRESENTATION_MODE_PROPERTY, presentationMode); | |
| 119 | − } | |
| 120 | −} | |
| 121 | − | |
| 122 | −int QmlWindowProxy::getPresentationMode() const { | |
| 123 | − if (!_qmlWindow) { | |
| 124 | − return Virtual; | |
| 125 | − } | |
| 126 | − | |
| 127 | − return _qmlWindow->property(PRESENTATION_MODE_PROPERTY).toInt(); | |
| 128 | −} | |
| 129 | − | |
| 130 | 58 | void QmlWindowProxy::parentNativeWindowToMainWindow() { |
| 131 | 59 | #ifdef Q_OS_WIN |
| 132 | 60 | if (!_qmlWindow) { |
| @@ -395,7 +323,8 @@ void InteractiveWindow::qmlToScript(const QVariant& message) { · 262 unmodified lines | ||
| 395 | 323 | |
| 396 | 324 | void InteractiveWindow::setVisible(bool visible) { |
| 397 | 325 | if (_qmlWindowProxy) { |
| 398 | − QMetaObject::invokeMethod(_qmlWindowProxy.get(), "setVisible", Q_ARG(bool, visible)); | |
| 326 | + QMetaObject::invokeMethod(_qmlWindowProxy.get(), "writeProperty", Q_ARG(QString, INTERACTIVE_WINDOW_VISIBLE_PROPERTY), | |
| 327 | + Q_ARG(QVariant, visible)); | |
| 399 | 328 | } |
| 400 | 329 | } |
| 401 | 330 | |
| @@ -403,8 +332,10 @@ bool InteractiveWindow::isVisible() const { · 1 unmodified line | ||
| 403 | 332 | if (!_qmlWindowProxy) { |
| 404 | 333 | return false; |
| 405 | 334 | } |
| 406 | − | |
| 407 | − return _qmlWindowProxy->isVisible(); | |
| 335 | + QVariant result; | |
| 336 | + BLOCKING_INVOKE_METHOD(_qmlWindowProxy.get(), "readProperty", Q_RETURN_ARG(QVariant, result), | |
| 337 | + Q_ARG(QString, INTERACTIVE_WINDOW_VISIBLE_PROPERTY)); | |
| 338 | + return result.toBool(); | |
| 408 | 339 | } |
| 409 | 340 | |
| 410 | 341 | glm::vec2 InteractiveWindow::getPosition() const { |
| @@ -412,12 +343,18 @@ glm::vec2 InteractiveWindow::getPosition() const { · 1 unmodified line | ||
| 412 | 343 | return {}; |
| 413 | 344 | } |
| 414 | 345 | |
| 415 | − return _qmlWindowProxy->getPosition(); | |
| 346 | + QVariant result; | |
| 347 | + BLOCKING_INVOKE_METHOD(_qmlWindowProxy.get(), "readProperty", Q_RETURN_ARG(QVariant, result), | |
| 348 | + Q_ARG(QString, INTERACTIVE_WINDOW_POSITION_PROPERTY)); | |
| 349 | + | |
| 350 | + return toGlm(result.toPointF()); | |
| 416 | 351 | } |
| 417 | 352 | |
| 418 | 353 | void InteractiveWindow::setPosition(const glm::vec2& position) { |
| 419 | 354 | if (_qmlWindowProxy) { |
| 420 | − QMetaObject::invokeMethod(_qmlWindowProxy.get(), "setPosition", Q_ARG(const glm::vec2&, position)); | |
| 355 | + QMetaObject::invokeMethod(_qmlWindowProxy.get(), "writeProperty", Q_ARG(QString, INTERACTIVE_WINDOW_POSITION_PROPERTY), | |
| 356 | + Q_ARG(QVariant, QPointF(position.x, position.y))); | |
| 357 | + QMetaObject::invokeMethod(_qmlWindowProxy->getQmlWindow(), "updateInteractiveWindowPositionForMode"); | |
| 421 | 358 | } |
| 422 | 359 | } |
| 423 | 360 | |
| @@ -425,12 +362,18 @@ glm::vec2 InteractiveWindow::getSize() const { · 1 unmodified line | ||
| 425 | 362 | if (!_qmlWindowProxy) { |
| 426 | 363 | return {}; |
| 427 | 364 | } |
| 428 | − return _qmlWindowProxy->getSize(); | |
| 365 | + | |
| 366 | + QVariant result; | |
| 367 | + BLOCKING_INVOKE_METHOD(_qmlWindowProxy.get(), "readProperty", Q_RETURN_ARG(QVariant, result), | |
| 368 | + Q_ARG(QString, INTERACTIVE_WINDOW_SIZE_PROPERTY)); | |
| 369 | + return toGlm(result.toSize()); | |
| 429 | 370 | } |
| 430 | 371 | |
| 431 | 372 | void InteractiveWindow::setSize(const glm::vec2& size) { |
| 432 | 373 | if (_qmlWindowProxy) { |
| 433 | − QMetaObject::invokeMethod(_qmlWindowProxy.get(), "setSize", Q_ARG(const glm::vec2&, size)); | |
| 374 | + QMetaObject::invokeMethod(_qmlWindowProxy.get(), "writeProperty", Q_ARG(QString, INTERACTIVE_WINDOW_SIZE_PROPERTY), | |
| 375 | + Q_ARG(QVariant, QSize(size.x, size.y))); | |
| 376 | + QMetaObject::invokeMethod(_qmlWindowProxy->getQmlWindow(), "updateInteractiveWindowSizeForMode"); | |
| 434 | 377 | } |
| 435 | 378 | } |
| 436 | 379 | |
| @@ -438,12 +381,17 @@ QString InteractiveWindow::getTitle() const { · 1 unmodified line | ||
| 438 | 381 | if (!_qmlWindowProxy) { |
| 439 | 382 | return QString(); |
| 440 | 383 | } |
| 441 | − return _qmlWindowProxy->getTitle(); | |
| 384 | + | |
| 385 | + QVariant result; | |
| 386 | + BLOCKING_INVOKE_METHOD(_qmlWindowProxy.get(), "readProperty", Q_RETURN_ARG(QVariant, result), | |
| 387 | + Q_ARG(QString, TITLE_PROPERTY)); | |
| 388 | + return result.toString(); | |
| 442 | 389 | } |
| 443 | 390 | |
| 444 | 391 | void InteractiveWindow::setTitle(const QString& title) { |
| 445 | 392 | if (_qmlWindowProxy) { |
| 446 | − QMetaObject::invokeMethod(_qmlWindowProxy.get(), "setTitle", Q_ARG(const QString&, title)); | |
| 393 | + QMetaObject::invokeMethod(_qmlWindowProxy.get(), "writeProperty", Q_ARG(QString, TITLE_PROPERTY), | |
| 394 | + Q_ARG(QVariant, title)); | |
| 447 | 395 | } |
| 448 | 396 | } |
| 449 | 397 | |
| @@ -451,7 +399,10 @@ int InteractiveWindow::getPresentationMode() const { · 1 unmodified line | ||
| 451 | 399 | if (!_qmlWindowProxy) { |
| 452 | 400 | return Virtual; |
| 453 | 401 | } |
| 454 | − return _qmlWindowProxy->getPresentationMode(); | |
| 402 | + QVariant result; | |
| 403 | + BLOCKING_INVOKE_METHOD(_qmlWindowProxy.get(), "readProperty", Q_RETURN_ARG(QVariant, result), | |
| 404 | + Q_ARG(QString, PRESENTATION_MODE_PROPERTY)); | |
| 405 | + return result.toInt(); | |
| 455 | 406 | } |
| 456 | 407 | |
| 457 | 408 | void InteractiveWindow::parentNativeWindowToMainWindow() { |
| @@ -462,6 +413,7 @@ void InteractiveWindow::parentNativeWindowToMainWindow() { · 4 unmodified lines | ||
| 462 | 413 | |
| 463 | 414 | void InteractiveWindow::setPresentationMode(int presentationMode) { |
| 464 | 415 | if (_qmlWindowProxy) { |
| 465 | − QMetaObject::invokeMethod(_qmlWindowProxy.get(), "setPresentationMode", Q_ARG(int, presentationMode)); | |
| 416 | + QMetaObject::invokeMethod(_qmlWindowProxy.get(), "writeProperty", Q_ARG(QString, PRESENTATION_MODE_PROPERTY), | |
| 417 | + Q_ARG(QVariant, presentationMode)); | |
| 466 | 418 | } |
| 467 | 419 | } |