提交 7f910909 编写于 作者: C cg2121 提交者: Clayton Groeneveld

UI: Add ability to resize output based on source size

上级 14ae6351
...@@ -865,3 +865,8 @@ About.GetInvolved="Get Involved" ...@@ -865,3 +865,8 @@ About.GetInvolved="Get Involved"
About.Authors="Authors" About.Authors="Authors"
About.License="License" About.License="License"
About.Contribute="Want to contribute?" About.Contribute="Want to contribute?"
# Dynamic output size
ResizeOutputSizeOfSource="Resize output (source size)"
ResizeOutputSizeOfSource.Text="The base and canvas resolution will be resized to the size of the current source."
ResizeOutputSizeOfSource.Continue="Do you want to continue?"
...@@ -4227,6 +4227,21 @@ void OBSBasic::CreateSourcePopupMenu(int idx, bool preview) ...@@ -4227,6 +4227,21 @@ void OBSBasic::CreateSourcePopupMenu(int idx, bool preview)
popup.addSeparator(); popup.addSeparator();
} }
QAction *resizeOutput = popup.addAction(
QTStr("ResizeOutputSizeOfSource"), this,
SLOT(ResizeOutputSizeOfSource()));
int width = obs_source_get_width(source);
int height = obs_source_get_height(source);
resizeOutput->setEnabled(!(ui->streamButton->isChecked() ||
ui->recordButton->isChecked() ||
(replayBufferButton &&
replayBufferButton->isChecked())));
if (width == 0 || height == 0)
resizeOutput->setEnabled(false);
popup.addMenu(AddScaleFilteringMenu(sceneItem)); popup.addMenu(AddScaleFilteringMenu(sceneItem));
popup.addSeparator(); popup.addSeparator();
...@@ -6733,6 +6748,39 @@ void OBSBasic::on_actionShowAbout_triggered() ...@@ -6733,6 +6748,39 @@ void OBSBasic::on_actionShowAbout_triggered()
about->setAttribute(Qt::WA_DeleteOnClose, true); about->setAttribute(Qt::WA_DeleteOnClose, true);
} }
void OBSBasic::ResizeOutputSizeOfSource()
{
if (ui->streamButton->isChecked() || ui->recordButton->isChecked() ||
(replayBufferButton && replayBufferButton->isChecked()))
return;
QMessageBox resize_output(this);
resize_output.setText(QTStr("ResizeOutputSizeOfSource.Text") +
"\n\n" + QTStr("ResizeOutputSizeOfSource.Continue"));
QAbstractButton *Yes = resize_output.addButton(QTStr("Yes"),
QMessageBox::YesRole);
resize_output.addButton(QTStr("No"), QMessageBox::NoRole);
resize_output.setIcon(QMessageBox::Warning);
resize_output.setWindowTitle(QTStr("ResizeOutputSizeOfSource"));
resize_output.exec();
if (resize_output.clickedButton() != Yes)
return;
OBSSource source = obs_sceneitem_get_source(GetCurrentSceneItem());
int width = obs_source_get_width(source);
int height = obs_source_get_height(source);
config_set_uint(basicConfig, "Video", "BaseCX", width);
config_set_uint(basicConfig, "Video", "BaseCY", height);
config_set_uint(basicConfig, "Video", "OutputCX", width);
config_set_uint(basicConfig, "Video", "OutputCY", height);
ResetVideo();
on_actionFitToScreen_triggered();
}
ColorSelect::ColorSelect(QWidget *parent) ColorSelect::ColorSelect(QWidget *parent)
: QWidget(parent), : QWidget(parent),
ui(new Ui::ColorSelect) ui(new Ui::ColorSelect)
......
...@@ -742,6 +742,8 @@ private slots: ...@@ -742,6 +742,8 @@ private slots:
void StackedMixerAreaContextMenuRequested(); void StackedMixerAreaContextMenuRequested();
void ResizeOutputSizeOfSource();
public slots: public slots:
void on_actionResetTransform_triggered(); void on_actionResetTransform_triggered();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册