Example #1
0
void Box2DGearJoint::setRatio(float _ratio)
{
    if (qFuzzyCompare(_ratio,ratio()))
        return;
    mGearJointDef.ratio = _ratio;
    if (mGearJoint)
        mGearJoint->SetRatio(_ratio);
    emit ratioChanged();
}
Example #2
0
    void adjustRatio()
    {
        QSize size = value();
        bool kept_ratio = ratio_ > 0;

        if ( size.width() == 0 || size.height() == 0 )
            ratio_ = 0;
        else
            ratio_ = qreal(size.width()) / size.height();

        emit ratioChanged(ratio_);

        bool keeps_ratio = ratio_ > 0;
        if ( keeps_ratio != kept_ratio )
            setKeepRatioImpl(keeps_ratio);
    }
Example #3
0
void VideoSurface::onNewFrameAvailable(std::shared_ptr<VideoFrame> newFrame)
{
    QSize newSize;

    lock();
    lastFrame = newFrame;
    newSize = lastFrame->getSourceDimensions().size();
    unlock();

    float newRatio = getSizeRatio(newSize);

    if (newRatio != ratio && isVisible())
    {
        ratio = newRatio;
        recalulateBounds();
        emit ratioChanged();
        emit boundaryChanged();
    }

    update();
}
Example #4
0
void VideoSurface::unsubscribe()
{
    if (!source || hasSubscribed == 0)
        return;

    if (--hasSubscribed != 0)
        return;

    lock();
    lastFrame.reset();
    unlock();

    ratio = 1.0f;
    recalulateBounds();
    emit ratioChanged();
    emit boundaryChanged();

    source->unsubscribe();
    disconnect(source, &VideoSource::frameAvailable, this, &VideoSurface::onNewFrameAvailable);
    disconnect(source, &VideoSource::sourceStopped, this, &VideoSurface::onSourceStopped);
}
Example #5
0
void QCompressor::setRatio(double ratio)
{
    QMutexLocker mutexLocker(&_mutex);
    _ratio = ratio;
    emit ratioChanged(_ratio);
}
Example #6
0
void WWindowPrivate::init()
{
    Q_Q(WWindow);

    icon = sk->icon();

    visible = true;

    hoverItem = NULL;

    q->setAcceptHoverEvents(true);

#ifdef QT_LATEST
    q->setFlag(QQuickItem::ItemAcceptsDrops);
#endif

    //---------------------------------------------------------------------------------------------
    // View

#if defined(SK_WIN_NATIVE)
    view = new WView(q, NULL);
#elif defined(Q_OS_WIN)
    view = new WView(q, NULL, Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);
#else
    view = new WView(q, NULL, Qt::FramelessWindowHint);
#endif

#ifdef QT_4
    view->setWindowTitle(sk->name());
#else
    view->setTitle(sk->name());
#endif

    if (icon.isEmpty() == false)
    {
#ifdef QT_4
        view->setWindowIcon(QIcon(icon));
#else
        view->setIcon(QIcon(icon));
#endif
    }

    view->setVisible(true);

    //---------------------------------------------------------------------------------------------
    // Signals

    QObject::connect(view, SIGNAL(messageReceived(const QString &)),
                     q,    SIGNAL(messageReceived(const QString &)));

    QObject::connect(view, SIGNAL(stateChanged(Qt::WindowState)),
                     q,    SIGNAL(stateChanged(Qt::WindowState)));

    QObject::connect(view, SIGNAL(fadeIn ()), q, SIGNAL(fadeIn ()));
    QObject::connect(view, SIGNAL(fadeOut()), q, SIGNAL(fadeOut()));

    QObject::connect(view, SIGNAL(dragEnded()), q, SIGNAL(dragEnded()));

    QObject::connect(view, SIGNAL(beforeClose()), q, SIGNAL(beforeClose()));

    //---------------------------------------------------------------------------------------------

    QObject::connect(view, SIGNAL(itemWidthChanged ()), q, SIGNAL(itemWidthChanged ()));
    QObject::connect(view, SIGNAL(itemHeightChanged()), q, SIGNAL(itemHeightChanged()));

    QObject::connect(view, SIGNAL(xChanged()), q, SIGNAL(viewXChanged()));
    QObject::connect(view, SIGNAL(yChanged()), q, SIGNAL(viewYChanged()));

    QObject::connect(view, SIGNAL(widthChanged ()), q, SIGNAL(viewWidthChanged ()));
    QObject::connect(view, SIGNAL(heightChanged()), q, SIGNAL(viewHeightChanged()));

    QObject::connect(view, SIGNAL(centerXChanged()), q, SIGNAL(centerXChanged()));
    QObject::connect(view, SIGNAL(centerYChanged()), q, SIGNAL(centerYChanged()));

    QObject::connect(view, SIGNAL(originXChanged()), q, SIGNAL(originXChanged()));
    QObject::connect(view, SIGNAL(originYChanged()), q, SIGNAL(originYChanged()));

    QObject::connect(view, SIGNAL(ratioChanged()), q, SIGNAL(ratioChanged()));

    QObject::connect(view, SIGNAL(zoomChanged()), q, SIGNAL(zoomChanged()));

    QObject::connect(view, SIGNAL(minimumWidthChanged ()), q, SIGNAL(minimumWidthChanged ()));
    QObject::connect(view, SIGNAL(minimumHeightChanged()), q, SIGNAL(minimumHeightChanged()));

    QObject::connect(view, SIGNAL(maximumWidthChanged ()), q, SIGNAL(maximumWidthChanged ()));
    QObject::connect(view, SIGNAL(maximumHeightChanged()), q, SIGNAL(maximumHeightChanged()));

    QObject::connect(view, SIGNAL(geometryNormalChanged()), q, SIGNAL(geometryNormalChanged()));

    QObject::connect(view, SIGNAL(minimizedChanged ()), q, SIGNAL(minimizedChanged ()));
    QObject::connect(view, SIGNAL(maximizedChanged ()), q, SIGNAL(maximizedChanged ()));
    QObject::connect(view, SIGNAL(fullScreenChanged()), q, SIGNAL(fullScreenChanged()));
    QObject::connect(view, SIGNAL(lockedChanged    ()), q, SIGNAL(lockedChanged    ()));
    QObject::connect(view, SIGNAL(scalingChanged   ()), q, SIGNAL(scalingChanged   ()));

    QObject::connect(view, SIGNAL(activeChanged  ()), q, SIGNAL(activeChanged  ()));
    QObject::connect(view, SIGNAL(enteredChanged ()), q, SIGNAL(enteredChanged ()));
    QObject::connect(view, SIGNAL(draggingChanged()), q, SIGNAL(draggingChanged()));
    QObject::connect(view, SIGNAL(draggedChanged ()), q, SIGNAL(draggedChanged ()));
    QObject::connect(view, SIGNAL(resizingChanged()), q, SIGNAL(resizingChanged()));
    QObject::connect(view, SIGNAL(touchingChanged()), q, SIGNAL(touchingChanged()));

    QObject::connect(view, SIGNAL(mousePosChanged   ()), q, SIGNAL(mousePosChanged   ()));
    QObject::connect(view, SIGNAL(mouseCursorChanged()), q, SIGNAL(mouseCursorChanged()));

#ifdef QT_4
    QObject::connect(view, SIGNAL(openglChanged()), q, SIGNAL(openglChanged()));
#endif

    QObject::connect(view, SIGNAL(antialiasChanged()), q, SIGNAL(antialiasChanged()));
    QObject::connect(view, SIGNAL(vsyncChanged    ()), q, SIGNAL(vsyncChanged    ()));

    QObject::connect(view, SIGNAL(hoverEnabledChanged()), q, SIGNAL(hoverEnabledChanged()));

    QObject::connect(view, SIGNAL(fadeEnabledChanged ()), q, SIGNAL(fadeEnabledChanged ()));
    QObject::connect(view, SIGNAL(fadeDurationChanged()), q, SIGNAL(fadeDurationChanged()));

    //---------------------------------------------------------------------------------------------

    QObject::connect(view, SIGNAL(idleCheckChanged()), q, SIGNAL(idleCheckChanged()));
    QObject::connect(view, SIGNAL(idleChanged     ()), q, SIGNAL(idleChanged     ()));
    QObject::connect(view, SIGNAL(idleDelayChanged()), q, SIGNAL(idleDelayChanged()));

    //---------------------------------------------------------------------------------------------

    QObject::connect(view, SIGNAL(mousePressed(WDeclarativeMouseEvent *)),
                     q,    SIGNAL(mousePressed(WDeclarativeMouseEvent *)));

    QObject::connect(view, SIGNAL(mouseReleased(WDeclarativeMouseEvent *)),
                     q,    SIGNAL(mouseReleased(WDeclarativeMouseEvent *)));

    QObject::connect(view, SIGNAL(mouseDoubleClicked(WDeclarativeMouseEvent *)),
                     q,    SIGNAL(mouseDoubleClicked(WDeclarativeMouseEvent *)));

    QObject::connect(view, SIGNAL(keyPressed(WDeclarativeKeyEvent *)),
                     q,    SIGNAL(keyPressed(WDeclarativeKeyEvent *)));

    QObject::connect(view, SIGNAL(keyReleased(WDeclarativeKeyEvent *)),
                     q,    SIGNAL(keyReleased(WDeclarativeKeyEvent *)));

    //---------------------------------------------------------------------------------------------

    QObject::connect(view, SIGNAL(keyShiftPressedChanged()),
                     q,    SIGNAL(keyShiftPressedChanged()));

    QObject::connect(view, SIGNAL(keyControlPressedChanged()),
                     q,    SIGNAL(keyControlPressedChanged()));

    QObject::connect(view, SIGNAL(keyAltPressedChanged()),
                     q,    SIGNAL(keyAltPressedChanged()));

    //---------------------------------------------------------------------------------------------

    QObject::connect(view, SIGNAL(availableGeometryChanged()),
                     q,    SIGNAL(availableGeometryChanged()));
}
Example #7
0
void ExportDialog::makeSizeGroupBox(){
  sizeOutGb=new QGroupBox("Output Size");
  QDoubleValidator *vd=new QDoubleValidator(this);
  QIntValidator *vi=new QIntValidator(this);
  vd->setBottom(1e-2);
  vi->setBottom(100);
  widthLe=new QLineEdit;
  widthLe->setValidator(vi);
  widthLe->setFixedWidth(50);
  widthLe->setAlignment(Qt::AlignRight);
  QObject::connect(widthLe,SIGNAL(editingFinished()),this,SLOT(widthChanged()));
  heightLe=new QLineEdit;
  heightLe->setValidator(vi);
  heightLe->setFixedWidth(50);
  heightLe->setAlignment(Qt::AlignRight);
  QObject::connect(heightLe,SIGNAL(editingFinished()),this,SLOT(heightChanged()));
  ratioLe=new QLineEdit;
  ratioLe->setValidator(vd);
  ratioLe->setFixedWidth(70);
  ratioLe->setAlignment(Qt::AlignRight);
  QObject::connect(ratioLe,SIGNAL(editingFinished()),this,SLOT(ratioChanged()));
  QPixmap lockedPixmap, unlockedPixmap;
  lockedPixmap.loadFromData(LOCKED_PNG, sizeof(LOCKED_PNG));
  unlockedPixmap.loadFromData(UNLOCKED_PNG, sizeof(UNLOCKED_PNG));
  lockedIcon=QIcon(lockedPixmap);
  unlockedIcon=QIcon(unlockedPixmap);
  lockBt=new QPushButton;
  lockBt->setCheckable(true);
  lockBt->setChecked(false);
  lockBt->setMaximumSize(20,20);
  lockBt->setMinimumSize(20,20);
  lockBt->setIcon(unlockedIcon);
  QObject::connect(lockBt,SIGNAL(toggled(bool)),this,SLOT(updateIcon(bool)));
  QPushButton *but320x240=new QPushButton(QString("320 x 240"));
  QPushButton *but640x480=new QPushButton(QString("640 x 480"));
  QPushButton *but800x600=new QPushButton(QString("800 x 600"));
  QObject::connect(but320x240,SIGNAL(pressed()),this,SLOT(set320x240()));
  QObject::connect(but640x480,SIGNAL(pressed()),this,SLOT(set640x480()));
  QObject::connect(but800x600,SIGNAL(pressed()),this,SLOT(set800x600()));
  QLabel *widthLb=new QLabel(tr("Width"));
  QLabel *heightLb=new QLabel(tr("Height"));
  QLabel *ratioLb=new QLabel(tr("Image Aspect"));
  QGridLayout *gLayout=new QGridLayout;
  gLayout->addWidget(widthLb,0,0);
  gLayout->addWidget(widthLe,0,1);
  gLayout->addWidget(but320x240,0,3);
  gLayout->addWidget(but640x480,0,4);
  gLayout->addWidget(heightLb,1,0);
  gLayout->addWidget(heightLe,1,1);
  gLayout->addWidget(but800x600,1,3);
  gLayout->setColumnStretch(2,2);
  gLayout->setColumnStretch(5,1);
  QHBoxLayout *hLayout=new QHBoxLayout;
  hLayout->addWidget(ratioLb);
  hLayout->addWidget(ratioLe);
  hLayout->addWidget(lockBt);
  hLayout->addStretch(1);
  QVBoxLayout *vLayout=new QVBoxLayout;
  vLayout->addLayout(gLayout);
  vLayout->addLayout(hLayout);
  sizeOutGb->setLayout(vLayout);
}