general page for settings

This commit is contained in:
David Marsh 2024-07-29 11:43:29 +01:00
parent 55f19cdc00
commit c2850d11b8
4 changed files with 87 additions and 2 deletions

View File

@ -88,6 +88,38 @@ OBSBasicSettings::OBSBasicSettings(QMainWindow *parent) : QDialog(parent)
settingsPages->setLineWidth(0);
QWidget *generalPage = new QWidget;
auto generalPageLayout = new QVBoxLayout;
generalPage->setLayout(generalPageLayout);
auto infoBox = ConfigUtils::generateSettingsGroupBox(QString::fromUtf8(obs_module_text("WelcomeTitle")));
infoBox->setStyleSheet("padding-top: 12px");
auto infoLayout = new QVBoxLayout;
infoBox->setLayout(infoLayout);
auto infoLabel = new QLabel(QString::fromUtf8(obs_module_text("WelcomeText")));
infoLabel->setWordWrap(true);
infoLayout->addWidget(infoLabel, 1);
auto buttonGroupBox = new QWidget();
auto buttonLayout = new QHBoxLayout;
buttonLayout->setSpacing(8);
buttonLayout->setAlignment(Qt::AlignCenter);
auto mainButton = ConfigUtils::generateMenuButton(QString::fromUtf8(obs_module_text("SettingsMainOutputsButton")), QIcon(QString::fromUtf8(":/settings/images/settings/stream.svg")));
auto verticalButton = ConfigUtils::generateMenuButton(QString::fromUtf8(obs_module_text("SettingsVerticalOutputsButton")), QIcon(QString::fromUtf8(":/settings/images/settings/stream.svg")));
auto helpButton = ConfigUtils::generateMenuButton(QString::fromUtf8(obs_module_text("SettingsHelpButton")), main_window->property("defaultIcon").value<QIcon>());
buttonLayout->addWidget(mainButton, 0);
buttonLayout->addWidget(verticalButton, 0);
buttonLayout->addWidget(helpButton, 0);
buttonGroupBox->setLayout(buttonLayout);
generalPageLayout->addWidget(infoBox, 0);
generalPageLayout->addWidget(buttonGroupBox, 1);
QScrollArea *scrollArea = new QScrollArea;
scrollArea->setWidget(generalPage);
scrollArea->setWidgetResizable(true);
@ -201,7 +233,7 @@ OBSBasicSettings::OBSBasicSettings(QMainWindow *parent) : QDialog(parent)
serverLayout->setLabelAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
auto mainTitle = new QLabel(QString::fromUtf8(obs_module_text("SettingsMainCanvasTitle")));
mainTitle->setStyleSheet(QString::fromUtf8("font-weight: bold;"));
mainTitle->setStyleSheet("font-weight: bold;");
serverLayout->addRow(mainTitle);
auto mainDescription = new QLabel(QString::fromUtf8(obs_module_text("SettingsMainCanvasDescription")));
@ -296,13 +328,26 @@ OBSBasicSettings::OBSBasicSettings(QMainWindow *parent) : QDialog(parent)
contentLayout->addWidget(settingsPages, 1);
listWidget->connect(listWidget, &QListWidget::currentRowChanged, settingsPages, &QStackedWidget::setCurrentIndex);
listWidget->setCurrentRow(1);
listWidget->setCurrentRow(0);
QVBoxLayout *vlayout = new QVBoxLayout;
vlayout->setContentsMargins(11, 11, 11, 11);
vlayout->addLayout(contentLayout);
vlayout->addLayout(bottomLayout);
setLayout(vlayout);
// Button connects for general page, clean this up in the future when we abstract pages
connect(mainButton, &QPushButton::clicked, [this] {
listWidget->setCurrentRow(1);
});
connect(verticalButton, &QPushButton::clicked, [this] {
listWidget->setCurrentRow(2);
});
connect(helpButton, &QPushButton::clicked, [this] {
listWidget->setCurrentRow(listWidget->count() - 1);
});
}
OBSBasicSettings::~OBSBasicSettings()

View File

@ -8,6 +8,7 @@
#include <QAbstractButton>
#include <QWidget>
#include <QIcon>
#include <QToolButton>
#include "obs.h"
#include "obs-module.h"
@ -25,6 +26,30 @@ QPushButton *ConfigUtils::generateButton(QString buttonText) {
return button;
}
// Generate settings groupbox
QGroupBox *ConfigUtils::generateSettingsGroupBox(QString headingText) {
auto group = headingText == nullptr ? new QGroupBox : new QGroupBox(headingText);
// group->setProperty("altColor", QVariant(true));
return group;
}
// Generate menu button
QToolButton *ConfigUtils::generateMenuButton(QString title, QIcon icon) {
auto button = new QToolButton;
button->setText(title);
button->setIcon(icon);
button->setIconSize(QSize(32, 32));
button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
button->setStyleSheet(
"min-width: 110px; max-width: 110px; min-height: 90px; max-height: 90px; padding-top: 16px; font-weight: bold;");
return button;
}
// For setting the active property stuff on buttons
void ConfigUtils::updateButtonStyles(QPushButton *defaultButton, QPushButton *customButton, int activeIndex) {
defaultButton->setProperty("unselected", activeIndex != 0 ? true : false);

View File

@ -8,11 +8,19 @@
#include <QGroupBox>
#include <QIcon>
#include <QString>
#include <QToolButton>
#include "obs.h"
class ConfigUtils {
public:
// UI generation
static QPushButton *generateButton(QString buttonText);
static QGroupBox *generateSettingsGroupBox(QString headingText);
static QToolButton *generateMenuButton(QString title, QIcon icon);
static void updateButtonStyles(QPushButton *defaultButton, QPushButton *customButton, int activeIndex);

View File

@ -38,6 +38,13 @@ NewVersion="New version (%1) available <a href='https://aitum.tv/download/multi/
NoVerticalWarning="<strong>Aitum Vertical is not installed, or is out of date.<br /><a href='https://aitum.tv/download/vertical/'>Click here</a> to download the latest version.</strong>"
# Config dialog
WelcomeTitle="Welcome to Aitum Multistream!"
WelcomeText="Multistreaming from OBS just got a whole lot easier.\n\nTo start configuring your outputs for both the main canvas and the vertical canvas (if you use Vertical), click one of the buttons below.\n\nIf you need help, please visit the help page for more information."
SettingsMainOutputsButton="Main Outputs"
SettingsVerticalOutputsButton="Vertical Outputs"
SettingsHelpButton="Help"
SettingsMainCanvasTitle="Main Canvas"
SettingsMainCanvasDescription="You can manage your Main Canvas (the default canvas) settings here. \nPlease note that to change your Built-in Output settings, you need to do this from within the normal OBS settings."