OBSBasicTransform::OBSBasicTransform(OBSBasic *parent) : QDialog (parent), ui (new Ui::OBSBasicTransform), main (parent) { ui->setupUi(this); HookWidget(ui->positionX, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->positionY, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->rotation, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->sizeX, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->sizeY, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->align, COMBO_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->boundsType, COMBO_CHANGED, SLOT(OnBoundsType(int))); HookWidget(ui->boundsAlign, COMBO_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->boundsWidth, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->boundsHeight, DSCROLL_CHANGED, SLOT(OnControlChanged())); OBSScene curScene = main->GetCurrentScene(); SetScene(curScene); SetItem(FindASelectedItem(curScene)); channelChangedSignal.Connect(obs_get_signal_handler(), "channel_change", OBSChannelChanged, this); }
void OBSBasicTransform::OnBoundsType(int index) { if (index == -1) return; obs_bounds_type type = (obs_bounds_type)index; bool enable = (type != OBS_BOUNDS_NONE); ui->boundsAlign->setEnabled(enable); ui->boundsWidth->setEnabled(enable); ui->boundsHeight->setEnabled(enable); if (!ignoreItemChange) { obs_bounds_type lastType = obs_sceneitem_get_bounds_type(item); if (lastType == OBS_BOUNDS_NONE) { OBSSource source = obs_sceneitem_get_source(item); int width = (int)obs_source_get_width(source); int height = (int)obs_source_get_height(source); ui->boundsWidth->setValue(width); ui->boundsHeight->setValue(height); } } OnControlChanged(); }
OBSBasicTransform::OBSBasicTransform(OBSBasic *parent) : QDialog (parent), ui (new Ui::OBSBasicTransform), main (parent) { ui->setupUi(this); HookWidget(ui->positionX, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->positionY, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->rotation, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->sizeX, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->sizeY, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->align, COMBO_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->boundsType, COMBO_CHANGED, SLOT(OnBoundsType(int))); HookWidget(ui->boundsAlign, COMBO_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->boundsWidth, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->boundsHeight, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->cropLeft, ISCROLL_CHANGED, SLOT(OnCropChanged())); HookWidget(ui->cropRight, ISCROLL_CHANGED, SLOT(OnCropChanged())); HookWidget(ui->cropTop, ISCROLL_CHANGED, SLOT(OnCropChanged())); HookWidget(ui->cropBottom, ISCROLL_CHANGED, SLOT(OnCropChanged())); connect(ui->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()), this, SLOT(on_resetButton_clicked())); connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close())); installEventFilter(CreateShortcutFilter()); OBSScene curScene = main->GetCurrentScene(); SetScene(curScene); SetItem(FindASelectedItem(curScene)); channelChangedSignal.Connect(obs_get_signal_handler(), "channel_change", OBSChannelChanged, this); }