2018-06-26 17:42:35 +02:00
|
|
|
#include "ExternalToolsPage.hpp"
|
2018-04-25 20:35:32 +02:00
|
|
|
|
2018-06-26 14:09:39 +02:00
|
|
|
#include "Application.hpp"
|
|
|
|
#include "util/LayoutCreator.hpp"
|
2018-04-25 20:35:32 +02:00
|
|
|
|
|
|
|
#include <QGroupBox>
|
|
|
|
|
2018-08-06 21:17:03 +02:00
|
|
|
#define STREAMLINK_QUALITY \
|
|
|
|
"Choose", "Source", "High", "Medium", "Low", "Audio only"
|
2018-04-25 20:35:32 +02:00
|
|
|
|
|
|
|
namespace chatterino {
|
2018-05-06 16:33:00 +02:00
|
|
|
namespace {
|
2018-08-15 22:46:20 +02:00
|
|
|
QString createLink(const QString &url, const QString &name)
|
|
|
|
{
|
|
|
|
return QString("<a href=\"" + url +
|
|
|
|
"\"><span style=\"color: white;\">" + name +
|
|
|
|
"</span></a>");
|
|
|
|
}
|
2018-05-06 16:33:00 +02:00
|
|
|
} // namespace
|
|
|
|
|
2018-04-25 20:35:32 +02:00
|
|
|
ExternalToolsPage::ExternalToolsPage()
|
|
|
|
: SettingsPage("External tools", "")
|
|
|
|
{
|
2018-04-27 22:11:19 +02:00
|
|
|
auto app = getApp();
|
|
|
|
|
2018-06-26 17:06:17 +02:00
|
|
|
LayoutCreator<ExternalToolsPage> layoutCreator(this);
|
2018-04-26 23:07:02 +02:00
|
|
|
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
2018-04-25 20:35:32 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
auto group = layout.emplace<QGroupBox>("Streamlink");
|
|
|
|
auto groupLayout = group.setLayoutType<QFormLayout>();
|
2018-05-06 16:33:00 +02:00
|
|
|
|
2018-08-06 21:17:03 +02:00
|
|
|
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!");
|
2018-05-06 16:33:00 +02:00
|
|
|
description->setWordWrap(true);
|
|
|
|
description->setStyleSheet("color: #bbb");
|
|
|
|
|
|
|
|
auto links = new QLabel(
|
2018-08-15 22:46:20 +02:00
|
|
|
createLink("https://streamlink.github.io/", "Website") + " " +
|
|
|
|
createLink(
|
2018-08-06 21:17:03 +02:00
|
|
|
"https://github.com/streamlink/streamlink/releases/latest",
|
|
|
|
"Download"));
|
2018-05-06 16:33:00 +02:00
|
|
|
links->setTextFormat(Qt::RichText);
|
2018-08-06 21:17:03 +02:00
|
|
|
links->setTextInteractionFlags(Qt::TextBrowserInteraction |
|
|
|
|
Qt::LinksAccessibleByKeyboard |
|
2018-05-06 16:33:00 +02:00
|
|
|
Qt::LinksAccessibleByKeyboard);
|
|
|
|
links->setOpenExternalLinks(true);
|
|
|
|
|
|
|
|
groupLayout->setWidget(0, QFormLayout::SpanningRole, description);
|
|
|
|
groupLayout->setWidget(1, QFormLayout::SpanningRole, links);
|
|
|
|
|
2018-08-06 21:17:03 +02:00
|
|
|
auto customPathCb =
|
|
|
|
this->createCheckBox("Use custom path (Enable if using "
|
|
|
|
"non-standard streamlink installation path)",
|
2018-08-12 12:56:28 +02:00
|
|
|
getSettings()->streamlinkUseCustomPath);
|
2018-05-06 16:33:00 +02:00
|
|
|
groupLayout->setWidget(2, QFormLayout::SpanningRole, customPathCb);
|
|
|
|
|
2018-08-12 12:56:28 +02:00
|
|
|
auto customPath = this->createLineEdit(getSettings()->streamlinkPath);
|
2018-08-06 21:17:03 +02:00
|
|
|
customPath->setPlaceholderText(
|
|
|
|
"Path to folder where Streamlink executable can be found");
|
2018-05-06 16:33:00 +02:00
|
|
|
groupLayout->addRow("Custom streamlink path:", customPath);
|
2018-04-27 22:11:19 +02:00
|
|
|
groupLayout->addRow(
|
2018-05-06 16:33:00 +02:00
|
|
|
"Preferred quality:",
|
2018-08-06 21:17:03 +02:00
|
|
|
this->createComboBox({STREAMLINK_QUALITY},
|
2018-08-12 12:56:28 +02:00
|
|
|
getSettings()->preferredQuality));
|
2018-08-06 21:17:03 +02:00
|
|
|
groupLayout->addRow(
|
|
|
|
"Additional options:",
|
2018-08-12 12:56:28 +02:00
|
|
|
this->createLineEdit(getSettings()->streamlinkOpts));
|
2018-05-06 16:33:00 +02:00
|
|
|
|
2018-08-12 12:56:28 +02:00
|
|
|
getSettings()->streamlinkUseCustomPath.connect(
|
2018-05-06 16:33:00 +02:00
|
|
|
[=](const auto &value, auto) {
|
|
|
|
customPath->setEnabled(value); //
|
|
|
|
},
|
2018-07-06 19:23:47 +02:00
|
|
|
this->managedConnections_);
|
2018-04-25 20:35:32 +02:00
|
|
|
}
|
2018-04-26 23:07:02 +02:00
|
|
|
|
|
|
|
layout->addStretch(1);
|
2018-04-25 20:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace chatterino
|