mirror of
https://github.com/Aitum/obs-aitum-multistream.git
synced 2024-11-25 11:42:58 +01:00
Fix margins
This commit is contained in:
parent
ebfb50d70a
commit
59aa58f4ac
@ -106,75 +106,75 @@ void RemoveWidget(QWidget *widget)
|
||||
}
|
||||
|
||||
// Output button styling
|
||||
void outputButtonStyle(QPushButton *button) {
|
||||
button->setMinimumHeight(24);
|
||||
void outputButtonStyle(QPushButton *button)
|
||||
{
|
||||
button->setMinimumHeight(24);
|
||||
|
||||
std::string baseStyles = "min-width: 30px; padding: 2px 10px; ";
|
||||
std::string baseStyles = "min-width: 30px; padding: 2px 10px; ";
|
||||
|
||||
button->setStyleSheet(QString::fromUtf8(baseStyles + (button->isChecked() ? "background: rgb(0,210,153);" : "")));
|
||||
button->setStyleSheet(QString::fromUtf8(baseStyles + (button->isChecked() ? "background: rgb(0,210,153);" : "")));
|
||||
}
|
||||
|
||||
// Common styling things here
|
||||
auto canvasGroupStyle = QString("padding: 12px 0px 0px 0px;"); // Main Canvas, Vertical Canvas
|
||||
auto outputTitleStyle = QString("QLabel{}"); // "Built -in stream"
|
||||
auto outputGroupStyle = QString("background-color: %1; padding: 0px;").arg(QPalette().color(QPalette::ColorRole::Mid).name(QColor::HexRgb)); // wrapper around above
|
||||
auto canvasGroupStyle = QString("padding: 16px 0px 0px 0px;"); // Main Canvas, Vertical Canvas
|
||||
auto outputTitleStyle = QString("QLabel{}"); // "Built -in stream"
|
||||
auto outputGroupStyle = QString("background-color: %1; padding: 0px;")
|
||||
.arg(QPalette().color(QPalette::ColorRole::Mid).name(QColor::HexRgb)); // wrapper around above
|
||||
|
||||
// For showing warning for no vertical integration
|
||||
void showVerticalWarning(QVBoxLayout *verticalLayout) {
|
||||
auto verticalWarning = new QWidget;
|
||||
auto verticalWarningLayout = new QVBoxLayout;
|
||||
void showVerticalWarning(QVBoxLayout *verticalLayout)
|
||||
{
|
||||
auto verticalWarning = new QWidget;
|
||||
auto verticalWarningLayout = new QVBoxLayout;
|
||||
|
||||
auto label = new QLabel(QString::fromUtf8(obs_module_text("NoVerticalWarning")));
|
||||
label->setWordWrap(true);
|
||||
verticalWarningLayout->addWidget(label);
|
||||
verticalWarning->setLayout(verticalWarningLayout);
|
||||
auto label = new QLabel(QString::fromUtf8(obs_module_text("NoVerticalWarning")));
|
||||
label->setWordWrap(true);
|
||||
verticalWarningLayout->addWidget(label);
|
||||
verticalWarning->setLayout(verticalWarningLayout);
|
||||
|
||||
verticalLayout->addWidget(verticalWarning);
|
||||
verticalLayout->addWidget(verticalWarning);
|
||||
}
|
||||
|
||||
|
||||
MultistreamDock::MultistreamDock(QWidget *parent) : QFrame(parent)
|
||||
{
|
||||
// setStyleSheet(QString("padding: 0px;"));
|
||||
|
||||
// Main layout
|
||||
auto mainLayout = new QVBoxLayout;
|
||||
// Main layout
|
||||
auto mainLayout = new QVBoxLayout;
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
setLayout(mainLayout);
|
||||
|
||||
auto t = new QWidget;
|
||||
auto tl = new QVBoxLayout;
|
||||
tl->setSpacing(8); // between canvas groups
|
||||
t->setStyleSheet(QString("padding: 0px; margin:0px;"));
|
||||
tl->setSpacing(8); // between canvas groups
|
||||
t->setStyleSheet(QString("padding: 0px; margin:0px;"));
|
||||
t->setLayout(tl);
|
||||
|
||||
// Group for built in canvas
|
||||
// Group for built in canvas
|
||||
auto mainCanvasGroup = new QGroupBox(QString::fromUtf8(obs_module_text("MainCanvas")));
|
||||
mainCanvasGroup->setStyleSheet(canvasGroupStyle);
|
||||
mainCanvasGroup->setStyleSheet(canvasGroupStyle);
|
||||
|
||||
mainCanvasLayout = new QVBoxLayout;
|
||||
mainCanvasLayout->setSpacing(4); // between outputs on main canvas
|
||||
mainCanvasLayout->setSpacing(4); // between outputs on main canvas
|
||||
|
||||
auto mainStreamGroup = new QGroupBox;
|
||||
mainStreamGroup->setStyleSheet(outputGroupStyle);
|
||||
mainStreamGroup->setStyleSheet(outputGroupStyle);
|
||||
|
||||
auto mainStreamLayout = new QVBoxLayout;
|
||||
|
||||
auto l2 = new QHBoxLayout;
|
||||
|
||||
// Label for built in stream
|
||||
auto bisHeaderLabel = new QLabel(QString::fromUtf8(obs_module_text("BuiltinStream")));
|
||||
bisHeaderLabel->setStyleSheet(outputTitleStyle);
|
||||
// Label for built in stream
|
||||
auto bisHeaderLabel = new QLabel(QString::fromUtf8(obs_module_text("BuiltinStream")));
|
||||
bisHeaderLabel->setStyleSheet(outputTitleStyle);
|
||||
|
||||
l2->addWidget(bisHeaderLabel, 1);
|
||||
|
||||
|
||||
mainStreamButton = new QPushButton;
|
||||
mainStreamButton->setObjectName(QStringLiteral("canvasStream"));
|
||||
mainStreamButton->setIcon(streamInactiveIcon);
|
||||
mainStreamButton->setCheckable(true);
|
||||
mainStreamButton->setChecked(false);
|
||||
|
||||
outputButtonStyle(mainStreamButton);
|
||||
outputButtonStyle(mainStreamButton);
|
||||
|
||||
connect(mainStreamButton, &QPushButton::clicked, [this] {
|
||||
if (obs_frontend_streaming_active()) {
|
||||
@ -185,7 +185,7 @@ MultistreamDock::MultistreamDock(QWidget *parent) : QFrame(parent)
|
||||
mainStreamButton->setChecked(true);
|
||||
}
|
||||
|
||||
outputButtonStyle(mainStreamButton);
|
||||
outputButtonStyle(mainStreamButton);
|
||||
mainStreamButton->setIcon(mainStreamButton->isChecked() ? streamActiveIcon : streamInactiveIcon);
|
||||
});
|
||||
//streamButton->setSizePolicy(sp2);
|
||||
@ -201,9 +201,9 @@ MultistreamDock::MultistreamDock(QWidget *parent) : QFrame(parent)
|
||||
|
||||
tl->addWidget(mainCanvasGroup);
|
||||
|
||||
// VERTICAL
|
||||
// VERTICAL
|
||||
auto verticalCanvasGroup = new QGroupBox(QString::fromUtf8(obs_module_text("VerticalCanvas")));
|
||||
verticalCanvasGroup->setStyleSheet(canvasGroupStyle);
|
||||
verticalCanvasGroup->setStyleSheet(canvasGroupStyle);
|
||||
|
||||
verticalCanvasLayout = new QVBoxLayout;
|
||||
verticalCanvasGroup->setLayout(verticalCanvasLayout);
|
||||
@ -289,14 +289,14 @@ void MultistreamDock::frontend_event(enum obs_frontend_event event, void *privat
|
||||
md->SaveSettings();
|
||||
} else if (event == OBS_FRONTEND_EVENT_STREAMING_STARTING || event == OBS_FRONTEND_EVENT_STREAMING_STARTED) {
|
||||
md->mainStreamButton->setChecked(true);
|
||||
outputButtonStyle(md->mainStreamButton);
|
||||
outputButtonStyle(md->mainStreamButton);
|
||||
|
||||
md->mainStreamButton->setIcon(md->streamActiveIcon);
|
||||
} else if (event == OBS_FRONTEND_EVENT_STREAMING_STOPPING || event == OBS_FRONTEND_EVENT_STREAMING_STOPPED) {
|
||||
md->mainStreamButton->setChecked(false);
|
||||
outputButtonStyle(md->mainStreamButton);
|
||||
outputButtonStyle(md->mainStreamButton);
|
||||
|
||||
md->mainStreamButton->setIcon(md->streamInactiveIcon);
|
||||
md->mainStreamButton->setIcon(md->streamInactiveIcon);
|
||||
}
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ void MultistreamDock::LoadOutput(obs_data_t *data, bool vertical)
|
||||
}
|
||||
}
|
||||
auto streamGroup = new QGroupBox;
|
||||
streamGroup->setStyleSheet(outputGroupStyle);
|
||||
streamGroup->setStyleSheet(outputGroupStyle);
|
||||
streamGroup->setObjectName(name);
|
||||
auto streamLayout = new QVBoxLayout;
|
||||
|
||||
@ -414,7 +414,7 @@ void MultistreamDock::LoadOutput(obs_data_t *data, bool vertical)
|
||||
streamButton->setIcon(streamInactiveIcon);
|
||||
streamButton->setCheckable(true);
|
||||
streamButton->setChecked(false);
|
||||
outputButtonStyle(streamButton);
|
||||
outputButtonStyle(streamButton);
|
||||
|
||||
if (vertical) {
|
||||
connect(streamButton, &QPushButton::clicked, [this, streamButton, data] {
|
||||
@ -431,7 +431,7 @@ void MultistreamDock::LoadOutput(obs_data_t *data, bool vertical)
|
||||
calldata_free(&cd);
|
||||
|
||||
streamButton->setIcon(streamButton->isChecked() ? streamActiveIcon : streamInactiveIcon);
|
||||
outputButtonStyle(streamButton);
|
||||
outputButtonStyle(streamButton);
|
||||
});
|
||||
} else {
|
||||
connect(streamButton, &QPushButton::clicked, [this, streamButton, data] {
|
||||
@ -449,7 +449,7 @@ void MultistreamDock::LoadOutput(obs_data_t *data, bool vertical)
|
||||
}
|
||||
|
||||
streamButton->setIcon(streamButton->isChecked() ? streamActiveIcon : streamInactiveIcon);
|
||||
outputButtonStyle(streamButton);
|
||||
outputButtonStyle(streamButton);
|
||||
});
|
||||
}
|
||||
//streamButton->setSizePolicy(sp2);
|
||||
@ -741,7 +741,7 @@ void MultistreamDock::LoadVerticalOutputs()
|
||||
struct calldata cd;
|
||||
calldata_init(&cd);
|
||||
if (!proc_handler_call(ph, "aitum_vertical_get_stream_settings", &cd)) {
|
||||
showVerticalWarning(verticalCanvasLayout); // show warning
|
||||
showVerticalWarning(verticalCanvasLayout); // show warning
|
||||
calldata_free(&cd);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user