2018-04-25 20:35:32 +02:00
|
|
|
#include "externaltoolspage.hpp"
|
|
|
|
|
2018-04-27 22:11:19 +02:00
|
|
|
#include "application.hpp"
|
2018-04-25 20:35:32 +02:00
|
|
|
#include "util/layoutcreator.hpp"
|
|
|
|
|
|
|
|
#include <QGroupBox>
|
|
|
|
|
|
|
|
#define STREAMLINK_QUALITY "Choose", "Source", "High", "Medium", "Low", "Audio only"
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
|
|
|
namespace settingspages {
|
|
|
|
|
2018-05-06 16:33:00 +02:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
QString CreateLink(const QString &url, const QString &name)
|
|
|
|
{
|
|
|
|
return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" + name + "</span></a>");
|
|
|
|
}
|
|
|
|
|
|
|
|
} // 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-04-25 20:35:32 +02:00
|
|
|
util::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
|
|
|
|
|
|
|
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(
|
|
|
|
CreateLink("https://streamlink.github.io/", "Website") + " " +
|
|
|
|
CreateLink("https://github.com/streamlink/streamlink/releases/latest", "Download"));
|
|
|
|
links->setTextFormat(Qt::RichText);
|
|
|
|
links->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::LinksAccessibleByKeyboard |
|
|
|
|
Qt::LinksAccessibleByKeyboard);
|
|
|
|
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)",
|
|
|
|
app->settings->streamlinkUseCustomPath);
|
|
|
|
groupLayout->setWidget(2, QFormLayout::SpanningRole, customPathCb);
|
|
|
|
|
|
|
|
auto customPath = this->createLineEdit(app->settings->streamlinkPath);
|
|
|
|
customPath->setPlaceholderText("Path to folder where Streamlink executable can be found");
|
|
|
|
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-04-27 22:11:19 +02:00
|
|
|
this->createComboBox({STREAMLINK_QUALITY}, app->settings->preferredQuality));
|
|
|
|
groupLayout->addRow("Additional options:",
|
|
|
|
this->createLineEdit(app->settings->streamlinkOpts));
|
2018-05-06 16:33:00 +02:00
|
|
|
|
|
|
|
app->settings->streamlinkUseCustomPath.connect(
|
|
|
|
[=](const auto &value, auto) {
|
|
|
|
customPath->setEnabled(value); //
|
|
|
|
},
|
|
|
|
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 settingspages
|
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|