Skip to content

Commit

Permalink
Tab design for advanced settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Dussed committed Jul 23, 2024
1 parent 28fe8da commit 387f087
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
26 changes: 20 additions & 6 deletions config-dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,29 +453,43 @@ void OBSBasicSettings::AddServer(QFormLayout *outputsLayout, obs_data_t *setting
// Advanced settings
const bool advanced = obs_data_get_bool(settings, "advanced");
auto advancedGroup = new QGroupBox(QString::fromUtf8(obs_module_text("AdvancedGroupHeader")));
advancedGroup->setAlignment(Qt::AlignRight);
advancedGroup->setContentsMargins(0, 4, 0, 0);

advancedGroup->setStyleSheet("QGroupBox::title { subcontrol-origin: margin; subcontrol-position: top right; padding: 12px 18px 0 0; }"
"QGroupBox { padding-top: 4px; padding-bottom: 0 }");
"QGroupBox { padding-top: 4px; padding-bottom: 0;}");
advancedGroup->setVisible(advanced);

auto advancedGroupLayout = new QVBoxLayout;
advancedGroup->setLayout(advancedGroupLayout);

// Tab widget
// 1 = bg for active tab + pane, 2 = inactive tabs, 3 = tab text colour, 4 = border colour for pane
auto tabStyles = QString("QTabWidget::pane { background: %1; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-right-radius: 4px; margin-top: -1px; padding-top: 8px; border: 1px solid %4; } QTabWidget::tab-bar { margin-bottom: 0; padding-bottom: 0; border-color: %4; } QTabBar::tab { color: %3; padding: 10px; margin-bottom: 0; border: 1px solid %4; } QTabBar::tab:selected { background: %1; font-weight: bold; border-bottom: none; } QTabBar::tab:!selected { background: %2; }")
.arg(palette().color(QPalette::ColorRole::Mid).name(QColor::HexRgb), palette().color(QPalette::ColorRole::Light).name(QColor::HexRgb), palette().color(QPalette::ColorRole::Text).name(QColor::HexRgb), palette().color(QPalette::ColorRole::Light).name(QColor::HexRgb));

auto advancedTabWidget = new QTabWidget;
advancedTabWidget->setContentsMargins(0, 0, 0, 0);
advancedTabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
advancedTabWidget->setStyleSheet(tabStyles);
// advancedTabWidget->setStyleSheet("QTabWidget::tab-bar { border: 1px solid gray; }"
// "QTabBar::tab { background: gray; color: white; padding: 10px; }"
// "QTabBar::tab:selected { background: lightgray; }"
// "QTabWidget::pane { border: none; background: pink; }");

// auto pageStyle = QString("QWidget[page=\"true\"] { border: 1px solid %1; padding-top: 0; margin-top: 0; }")
// .arg(QPalette().color(QPalette::ColorRole::Mid).name(QColor::HexRgb));
//
auto videoPage = new QWidget;
videoPage->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
videoPage->setStyleSheet("background: pink");
// videoPage->setStyleSheet(pageStyle);
// videoPage->setProperty("page", true);
auto videoPageLayout = new QFormLayout;
videoPage->setLayout(videoPageLayout);

auto audioPage = new QWidget;
audioPage->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
audioPage->setStyleSheet("background: pink");
// audioPage->setStyleSheet(pageStyle);
// audioPage->setProperty("page", true);
auto audioPageLayout = new QFormLayout;
audioPage->setLayout(audioPageLayout);

Expand Down Expand Up @@ -665,8 +679,8 @@ void OBSBasicSettings::AddServer(QFormLayout *outputsLayout, obs_data_t *setting
});

// Hook up
advancedTabWidget->addTab(videoPage, QString::fromUtf8("video"));
advancedTabWidget->addTab(audioPage, QString::fromUtf8("audio"));
advancedTabWidget->addTab(videoPage, QString::fromUtf8(obs_module_text("VideoEncoderSettings")));
advancedTabWidget->addTab(audioPage, QString::fromUtf8(obs_module_text("AudioEncoderSettings")));
advancedGroupLayout->addWidget(advancedTabWidget, 1);


Expand Down
2 changes: 2 additions & 0 deletions data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ BackButton="< Back"
SaveOutput="Save Output"
CreateOutput="Create Output"
AdvancedGroupHeader="Advanced Encoding Settings"
VideoEncoderSettings="Video Settings"
AudioEncoderSettings="Audio Settings"

# Errors and warnings
MainOutputNotActive="Unable to start output. \nThis output is configured to use your main encoder's output (Built-in stream), which is not currently active.\nPlease start your main encoder first."
Expand Down

0 comments on commit 387f087

Please sign in to comment.