Add visual output service picker

This commit is contained in:
David Marsh 2024-07-16 22:00:33 +01:00
parent 05e119702c
commit 71533800ce
2 changed files with 50 additions and 3 deletions

View File

@ -4,9 +4,24 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QLabel> #include <QLabel>
#include <QStackedWidget> #include <QStackedWidget>
#include <QPushButton>
#include <QAbstractButton>
#include <QToolButton>
#include "obs-module.h" #include "obs-module.h"
QToolButton *selectionButton(std::string title, QIcon icon) {
auto button = new QToolButton;
button->setText(QString::fromUtf8(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;
}
OutputDialog::OutputDialog(QDialog *parent) : QDialog(parent) { OutputDialog::OutputDialog(QDialog *parent) : QDialog(parent) {
setModal(true); setModal(true);
stackedWidget = new QStackedWidget; stackedWidget = new QStackedWidget;
@ -34,6 +49,7 @@ OutputDialog::OutputDialog(QDialog *parent) : QDialog(parent) {
stackedLayout->setContentsMargins(4, 4, 4, 4); stackedLayout->setContentsMargins(4, 4, 4, 4);
setMinimumSize(650, 400); setMinimumSize(650, 400);
setMaximumSize(650, 400);
setLayout(stackedLayout); setLayout(stackedLayout);
show(); show();
@ -45,22 +61,42 @@ QWidget *OutputDialog::WizardServicePage() {
auto pageLayout = new QVBoxLayout; auto pageLayout = new QVBoxLayout;
auto description = new QLabel(QString::fromUtf8(obs_module_text("NewOutputSelectService"))); auto description = new QLabel(QString::fromUtf8(obs_module_text("NewOutputSelectService")));
description->setStyleSheet("margin-bottom: 20px;");
pageLayout->addWidget(description); pageLayout->addWidget(description);
// layout for service selection // layout for service selection
auto gap = 8;
auto selectionLayout = new QVBoxLayout; auto selectionLayout = new QVBoxLayout;
selectionLayout->setSpacing(gap);
auto spacerTest = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
pageLayout->addSpacerItem(spacerTest);
// row 1 // row 1
auto rowOne = new QHBoxLayout; auto rowOne = new QHBoxLayout;
rowOne->addWidget(selectionButton("Twitch", platformIconTwitch));
rowOne->addWidget(selectionButton("YouTube", platformIconYouTube));
rowOne->addWidget(selectionButton("TikTok", platformIconTikTok));
rowOne->addWidget(selectionButton("Facebook", platformIconFacebook));
selectionLayout->addLayout(rowOne);
// row 2 // row 2
auto rowTwo = new QHBoxLayout;
rowTwo->addWidget(selectionButton("Trovo", platformIconTrovo));
rowTwo->addWidget(selectionButton("X (Twitter)", platformIconTwitter));
rowTwo->addWidget(selectionButton("Kick", platformIconKick));
rowTwo->addWidget(selectionButton(obs_module_text("OtherService"), platformIconUnknown));
selectionLayout->addLayout(rowTwo);
//
pageLayout->addSpacerItem(spacerTest);
pageLayout->addLayout(selectionLayout);
// pageLayout->setAlignment(Qt::AlignCenter);
page->setLayout(pageLayout); page->setLayout(pageLayout);

View File

@ -18,6 +18,17 @@ private:
QWidget *WizardInfoTikTok(); QWidget *WizardInfoTikTok();
QWidget *WizardInfoFacebook(); QWidget *WizardInfoFacebook();
// Platform icons
QIcon platformIconTwitch = QIcon(":/aitum/media/twitch.png");
QIcon platformIconYouTube = QIcon(":/aitum/media/youtube.png");
QIcon platformIconKick = QIcon(":/aitum/media/kick.png");
QIcon platformIconTikTok = QIcon(":/aitum/media/tiktok.png");
QIcon platformIconTwitter = QIcon(":/aitum/media/twitter.png");
QIcon platformIconTrovo = QIcon(":/aitum/media/trovo.png");
QIcon platformIconFacebook = QIcon(":/aitum/media/facebook.png");
QIcon platformIconUnknown = QIcon(":/aitum/media/unknown.png");
QStackedWidget *stackedWidget; QStackedWidget *stackedWidget;
public: public:
OutputDialog(QDialog *parent); OutputDialog(QDialog *parent);