From 71533800ce00dc11d23a7d8193b138fa2d779487 Mon Sep 17 00:00:00 2001 From: David Marsh Date: Tue, 16 Jul 2024 22:00:33 +0100 Subject: [PATCH] Add visual output service picker --- output-dialog.cpp | 42 +++++++++++++++++++++++++++++++++++++++--- output-dialog.hpp | 11 +++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/output-dialog.cpp b/output-dialog.cpp index 003996b..8690b91 100644 --- a/output-dialog.cpp +++ b/output-dialog.cpp @@ -4,9 +4,24 @@ #include #include #include +#include +#include +#include #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) { setModal(true); stackedWidget = new QStackedWidget; @@ -34,6 +49,7 @@ OutputDialog::OutputDialog(QDialog *parent) : QDialog(parent) { stackedLayout->setContentsMargins(4, 4, 4, 4); setMinimumSize(650, 400); + setMaximumSize(650, 400); setLayout(stackedLayout); show(); @@ -45,22 +61,42 @@ QWidget *OutputDialog::WizardServicePage() { auto pageLayout = new QVBoxLayout; auto description = new QLabel(QString::fromUtf8(obs_module_text("NewOutputSelectService"))); + description->setStyleSheet("margin-bottom: 20px;"); pageLayout->addWidget(description); // layout for service selection - auto gap = 8; - auto selectionLayout = new QVBoxLayout; - selectionLayout->setSpacing(gap); + + auto spacerTest = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); + + pageLayout->addSpacerItem(spacerTest); // row 1 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 + 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); diff --git a/output-dialog.hpp b/output-dialog.hpp index 553073b..5884429 100644 --- a/output-dialog.hpp +++ b/output-dialog.hpp @@ -18,6 +18,17 @@ private: QWidget *WizardInfoTikTok(); 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; public: OutputDialog(QDialog *parent);