obs-aitum-multistream/output-dialog.cpp

209 lines
5.0 KiB
C++
Raw Normal View History

#include "output-dialog.hpp"
#include <QDialog>
2024-07-16 18:41:19 +02:00
#include <QVBoxLayout>
#include <QLabel>
#include <QStackedWidget>
2024-07-16 23:00:33 +02:00
#include <QPushButton>
#include <QAbstractButton>
#include <QToolButton>
2024-07-16 20:52:59 +02:00
#include "obs-module.h"
2024-07-16 23:00:33 +02:00
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;
}
2024-07-16 18:41:19 +02:00
OutputDialog::OutputDialog(QDialog *parent) : QDialog(parent) {
2024-07-16 20:52:59 +02:00
setModal(true);
2024-07-16 18:41:19 +02:00
stackedWidget = new QStackedWidget;
2024-07-16 18:41:19 +02:00
// Service selection page
stackedWidget->addWidget(WizardServicePage());
2024-07-16 18:41:19 +02:00
// Pages for each service
stackedWidget->addWidget(WizardInfoKick());
stackedWidget->addWidget(WizardInfoYouTube());
stackedWidget->addWidget(WizardInfoTwitter());
stackedWidget->addWidget(WizardInfoUnknown());
stackedWidget->addWidget(WizardInfoTwitch());
stackedWidget->addWidget(WizardInfoTrovo());
stackedWidget->addWidget(WizardInfoTikTok());
stackedWidget->addWidget(WizardInfoFacebook());
stackedWidget->setCurrentIndex(0);
2024-07-16 20:52:59 +02:00
setWindowTitle(obs_module_text("NewOutputWindowTitle"));
2024-07-16 18:41:19 +02:00
auto stackedLayout = new QVBoxLayout;
stackedLayout->addWidget(stackedWidget);
stackedLayout->setAlignment(stackedWidget, Qt::AlignTop);
stackedLayout->setContentsMargins(4, 4, 4, 4);
setMinimumSize(650, 400);
2024-07-16 23:00:33 +02:00
setMaximumSize(650, 400);
2024-07-16 18:41:19 +02:00
setLayout(stackedLayout);
show();
}
2024-07-16 18:41:19 +02:00
QWidget *OutputDialog::WizardServicePage() {
auto page = new QWidget(this);
auto pageLayout = new QVBoxLayout;
2024-07-16 20:52:59 +02:00
auto description = new QLabel(QString::fromUtf8(obs_module_text("NewOutputSelectService")));
2024-07-16 23:00:33 +02:00
description->setStyleSheet("margin-bottom: 20px;");
2024-07-16 20:52:59 +02:00
pageLayout->addWidget(description);
// layout for service selection
auto selectionLayout = new QVBoxLayout;
2024-07-16 23:00:33 +02:00
auto spacerTest = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
pageLayout->addSpacerItem(spacerTest);
2024-07-16 20:52:59 +02:00
// row 1
auto rowOne = new QHBoxLayout;
2024-07-16 23:00:33 +02:00
rowOne->addWidget(selectionButton("Twitch", platformIconTwitch));
rowOne->addWidget(selectionButton("YouTube", platformIconYouTube));
rowOne->addWidget(selectionButton("TikTok", platformIconTikTok));
rowOne->addWidget(selectionButton("Facebook", platformIconFacebook));
selectionLayout->addLayout(rowOne);
2024-07-16 20:52:59 +02:00
// row 2
2024-07-16 23:00:33 +02:00
auto rowTwo = new QHBoxLayout;
2024-07-16 20:52:59 +02:00
2024-07-16 23:00:33 +02:00
rowTwo->addWidget(selectionButton("Trovo", platformIconTrovo));
rowTwo->addWidget(selectionButton("X (Twitter)", platformIconTwitter));
rowTwo->addWidget(selectionButton("Kick", platformIconKick));
rowTwo->addWidget(selectionButton(obs_module_text("OtherService"), platformIconUnknown));
2024-07-16 20:52:59 +02:00
2024-07-16 23:00:33 +02:00
selectionLayout->addLayout(rowTwo);
//
pageLayout->addSpacerItem(spacerTest);
pageLayout->addLayout(selectionLayout);
2024-07-16 20:52:59 +02:00
2024-07-16 23:00:33 +02:00
// pageLayout->setAlignment(Qt::AlignCenter);
2024-07-16 18:41:19 +02:00
page->setLayout(pageLayout);
return page;
}
QWidget *OutputDialog::WizardInfoKick() {
auto page = new QWidget(this);
auto pageLayout = new QVBoxLayout;
auto title = new QLabel(QString("Kick Service page"));
pageLayout->addWidget(title);
page->setLayout(pageLayout);
return page;
}
QWidget *OutputDialog::WizardInfoYouTube() {
auto page = new QWidget(this);
auto pageLayout = new QVBoxLayout;
auto title = new QLabel(QString("YouTube Service page"));
pageLayout->addWidget(title);
page->setLayout(pageLayout);
return page;
}
QWidget *OutputDialog::WizardInfoTwitter() {
auto page = new QWidget(this);
auto pageLayout = new QVBoxLayout;
auto title = new QLabel(QString("Twitter Service page"));
pageLayout->addWidget(title);
2024-07-16 18:41:19 +02:00
page->setLayout(pageLayout);
return page;
}
2024-07-16 18:41:19 +02:00
QWidget *OutputDialog::WizardInfoUnknown() {
auto page = new QWidget(this);
auto pageLayout = new QVBoxLayout;
auto title = new QLabel(QString("Unknown Service page"));
pageLayout->addWidget(title);
2024-07-16 18:41:19 +02:00
page->setLayout(pageLayout);
return page;
}
2024-07-16 18:41:19 +02:00
QWidget *OutputDialog::WizardInfoTwitch() {
auto page = new QWidget(this);
auto pageLayout = new QVBoxLayout;
2024-07-16 18:41:19 +02:00
auto title = new QLabel(QString("Twitch Service page"));
pageLayout->addWidget(title);
page->setLayout(pageLayout);
return page;
}
2024-07-16 18:41:19 +02:00
QWidget *OutputDialog::WizardInfoTrovo() {
auto page = new QWidget(this);
auto pageLayout = new QVBoxLayout;
auto title = new QLabel(QString("Trovo Service page"));
pageLayout->addWidget(title);
page->setLayout(pageLayout);
return page;
}
QWidget *OutputDialog::WizardInfoTikTok() {
auto page = new QWidget(this);
auto pageLayout = new QVBoxLayout;
auto title = new QLabel(QString("Tiktok Service page"));
pageLayout->addWidget(title);
page->setLayout(pageLayout);
return page;
}
QWidget *OutputDialog::WizardInfoFacebook() {
auto page = new QWidget(this);
auto pageLayout = new QVBoxLayout;
auto title = new QLabel(QString("Facebook Service page"));
pageLayout->addWidget(title);
page->setLayout(pageLayout);
return page;
}