2019-09-08 22:27:57 +02:00
|
|
|
#include "ExternalToolsPage.hpp"
|
|
|
|
|
|
|
|
#include "Application.hpp"
|
|
|
|
#include "util/Helpers.hpp"
|
|
|
|
#include "util/LayoutCreator.hpp"
|
2020-07-05 14:32:10 +02:00
|
|
|
#include "util/RemoveScrollAreaBackground.hpp"
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2020-07-05 14:32:10 +02:00
|
|
|
#include <QFormLayout>
|
2019-09-08 22:27:57 +02:00
|
|
|
#include <QGroupBox>
|
2020-07-05 14:32:10 +02:00
|
|
|
#include <QLabel>
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
#define STREAMLINK_QUALITY \
|
|
|
|
"Choose", "Source", "High", "Medium", "Low", "Audio only"
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
ExternalToolsPage::ExternalToolsPage()
|
|
|
|
{
|
|
|
|
LayoutCreator<ExternalToolsPage> layoutCreator(this);
|
2020-07-05 14:32:10 +02:00
|
|
|
|
|
|
|
auto scroll = layoutCreator.emplace<QScrollArea>();
|
|
|
|
auto widget = scroll.emplaceScrollAreaWidget();
|
|
|
|
removeScrollAreaBackground(scroll.getElement(), widget.getElement());
|
|
|
|
|
|
|
|
auto layout = widget.setLayoutType<QVBoxLayout>();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
auto group = layout.emplace<QGroupBox>("Streamlink");
|
|
|
|
auto groupLayout = group.setLayoutType<QFormLayout>();
|
|
|
|
|
|
|
|
auto description = new QLabel(
|
|
|
|
"Streamlink is a command-line utility that pipes video streams "
|
|
|
|
"from various "
|
|
|
|
"services into a video player, such as VLC. Make sure to edit the "
|
|
|
|
"configuration file before you use it!");
|
|
|
|
description->setWordWrap(true);
|
|
|
|
description->setStyleSheet("color: #bbb");
|
|
|
|
|
|
|
|
auto links = new QLabel(
|
2019-09-18 16:31:51 +02:00
|
|
|
formatRichNamedLink("https://streamlink.github.io/", "Website") +
|
|
|
|
" " +
|
|
|
|
formatRichNamedLink(
|
2019-09-08 22:27:57 +02:00
|
|
|
"https://github.com/streamlink/streamlink/releases/latest",
|
2022-12-06 23:27:27 +01:00
|
|
|
"Download") +
|
|
|
|
" " +
|
|
|
|
formatRichNamedLink("https://streamlink.github.io/cli.html#twitch",
|
|
|
|
"Documentation"));
|
2019-09-08 22:27:57 +02:00
|
|
|
links->setTextFormat(Qt::RichText);
|
|
|
|
links->setTextInteractionFlags(Qt::TextBrowserInteraction |
|
|
|
|
Qt::LinksAccessibleByKeyboard |
|
2020-07-05 14:32:10 +02:00
|
|
|
Qt::LinksAccessibleByMouse);
|
2019-09-08 22:27:57 +02:00
|
|
|
links->setOpenExternalLinks(true);
|
|
|
|
|
|
|
|
groupLayout->setWidget(0, QFormLayout::SpanningRole, description);
|
|
|
|
groupLayout->setWidget(1, QFormLayout::SpanningRole, links);
|
|
|
|
|
|
|
|
auto customPathCb =
|
|
|
|
this->createCheckBox("Use custom path (Enable if using "
|
|
|
|
"non-standard streamlink installation path)",
|
|
|
|
getSettings()->streamlinkUseCustomPath);
|
|
|
|
groupLayout->setWidget(2, QFormLayout::SpanningRole, customPathCb);
|
|
|
|
|
|
|
|
auto customPath = this->createLineEdit(getSettings()->streamlinkPath);
|
|
|
|
customPath->setPlaceholderText(
|
|
|
|
"Path to folder where Streamlink executable can be found");
|
|
|
|
groupLayout->addRow("Custom streamlink path:", customPath);
|
|
|
|
groupLayout->addRow(
|
|
|
|
"Preferred quality:",
|
|
|
|
this->createComboBox({STREAMLINK_QUALITY},
|
|
|
|
getSettings()->preferredQuality));
|
|
|
|
groupLayout->addRow(
|
|
|
|
"Additional options:",
|
|
|
|
this->createLineEdit(getSettings()->streamlinkOpts));
|
|
|
|
|
|
|
|
getSettings()->streamlinkUseCustomPath.connect(
|
|
|
|
[=](const auto &value, auto) {
|
2020-11-08 12:02:19 +01:00
|
|
|
customPath->setEnabled(value);
|
2019-09-08 22:27:57 +02:00
|
|
|
},
|
|
|
|
this->managedConnections_);
|
|
|
|
}
|
2020-08-22 16:49:23 +02:00
|
|
|
layout->addSpacing(16);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2020-04-11 11:43:35 +02:00
|
|
|
{
|
2020-08-22 15:01:16 +02:00
|
|
|
auto group = layout.emplace<QGroupBox>("Custom stream player");
|
2020-04-11 11:43:35 +02:00
|
|
|
auto groupLayout = group.setLayoutType<QFormLayout>();
|
|
|
|
|
|
|
|
const auto description = new QLabel(
|
2020-08-22 15:01:16 +02:00
|
|
|
"You can open Twitch streams directly in any video player that "
|
2020-04-11 11:43:35 +02:00
|
|
|
"has built-in Twitch support and has own URI Scheme.\nE.g.: "
|
2020-08-22 15:01:16 +02:00
|
|
|
"IINA for macOS and Potplayer (with extension) for "
|
|
|
|
"Windows.\n\nWith this value set, you will get the option to "
|
|
|
|
"\"Open in custom player\" when "
|
|
|
|
"right-clicking a channel header.");
|
2020-04-11 11:43:35 +02:00
|
|
|
description->setWordWrap(true);
|
|
|
|
description->setStyleSheet("color: #bbb");
|
|
|
|
|
|
|
|
groupLayout->setWidget(0, QFormLayout::SpanningRole, description);
|
|
|
|
|
2020-08-22 15:01:16 +02:00
|
|
|
auto lineEdit = this->createLineEdit(getSettings()->customURIScheme);
|
|
|
|
lineEdit->setPlaceholderText("custom-player-scheme://");
|
|
|
|
groupLayout->addRow("Custom stream player URI Scheme:", lineEdit);
|
2020-04-11 11:43:35 +02:00
|
|
|
}
|
2020-08-22 16:49:23 +02:00
|
|
|
layout->addSpacing(16);
|
2020-04-11 11:43:35 +02:00
|
|
|
|
2020-07-05 14:32:10 +02:00
|
|
|
{
|
|
|
|
auto group = layout.emplace<QGroupBox>("Image Uploader");
|
|
|
|
auto groupLayout = group.setLayoutType<QFormLayout>();
|
|
|
|
|
|
|
|
const auto description = new QLabel(
|
|
|
|
"You can set custom host for uploading images, like "
|
|
|
|
"imgur.com or s-ul.eu.<br>Check " +
|
2020-08-22 14:46:17 +02:00
|
|
|
formatRichNamedLink("https://chatterino.com/help/image-uploader",
|
2020-07-05 14:32:10 +02:00
|
|
|
"this guide") +
|
|
|
|
" for help.");
|
|
|
|
description->setWordWrap(true);
|
|
|
|
description->setStyleSheet("color: #bbb");
|
|
|
|
description->setTextFormat(Qt::RichText);
|
|
|
|
description->setTextInteractionFlags(Qt::TextBrowserInteraction |
|
|
|
|
Qt::LinksAccessibleByKeyboard |
|
|
|
|
Qt::LinksAccessibleByMouse);
|
|
|
|
description->setOpenExternalLinks(true);
|
|
|
|
|
|
|
|
groupLayout->setWidget(0, QFormLayout::SpanningRole, description);
|
|
|
|
|
2020-08-22 18:33:37 +02:00
|
|
|
groupLayout->addRow(this->createCheckBox(
|
|
|
|
"Enable image uploader", getSettings()->imageUploaderEnabled));
|
2021-06-26 14:08:44 +02:00
|
|
|
groupLayout->addRow(
|
|
|
|
this->createCheckBox("Ask for confirmation when uploading an image",
|
|
|
|
getSettings()->askOnImageUpload));
|
2020-08-22 18:33:37 +02:00
|
|
|
|
2020-07-05 14:32:10 +02:00
|
|
|
groupLayout->addRow(
|
|
|
|
"Request URL: ",
|
|
|
|
this->createLineEdit(getSettings()->imageUploaderUrl));
|
|
|
|
groupLayout->addRow(
|
|
|
|
"Form field: ",
|
|
|
|
this->createLineEdit(getSettings()->imageUploaderFormField));
|
|
|
|
groupLayout->addRow(
|
|
|
|
"Extra Headers: ",
|
|
|
|
this->createLineEdit(getSettings()->imageUploaderHeaders));
|
|
|
|
groupLayout->addRow(
|
|
|
|
"Image link: ",
|
|
|
|
this->createLineEdit(getSettings()->imageUploaderLink));
|
|
|
|
groupLayout->addRow(
|
|
|
|
"Deletion link: ",
|
|
|
|
this->createLineEdit(getSettings()->imageUploaderDeletionLink));
|
|
|
|
}
|
|
|
|
|
2019-09-08 22:27:57 +02:00
|
|
|
layout->addStretch(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace chatterino
|