From a104e92ad5e4a7d6a723a97b0a016d7bcea24c37 Mon Sep 17 00:00:00 2001 From: confuseh Date: Sun, 28 Jan 2018 14:10:12 +0000 Subject: [PATCH] Add additional options for streamlink, remove static from qualitypopup Fixes #261 --- src/singletons/settingsmanager.hpp | 1 + src/widgets/qualitypopup.cpp | 6 ++++-- src/widgets/qualitypopup.hpp | 1 + src/widgets/settingspages/behaviourpage.cpp | 1 + src/widgets/split.cpp | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/singletons/settingsmanager.hpp b/src/singletons/settingsmanager.hpp index 986115a29..9781c2321 100644 --- a/src/singletons/settingsmanager.hpp +++ b/src/singletons/settingsmanager.hpp @@ -52,6 +52,7 @@ public: FloatSetting mouseScrollMultiplier = {"/behaviour/mouseScrollMultiplier", 1.0}; QStringSetting streamlinkPath = {"/behaviour/streamlink/path", ""}; QStringSetting preferredQuality = {"/behaviour/streamlink/quality", "Choose"}; + QStringSetting streamlinkOpts = {"/behaviour/streamlink/options", ""}; BoolSetting pauseChatHover = {"/behaviour/pauseChatHover", false}; /// Commands diff --git a/src/widgets/qualitypopup.cpp b/src/widgets/qualitypopup.cpp index 4a41d4557..16c6c75ff 100644 --- a/src/widgets/qualitypopup.cpp +++ b/src/widgets/qualitypopup.cpp @@ -12,6 +12,7 @@ QualityPopup::QualityPopup(const QString &channel, const QString &path, QStringL { this->ui.okButton.setText("OK"); this->ui.cancelButton.setText("Cancel"); + this->setAttribute(Qt::WA_DeleteOnClose, true); QObject::connect(&this->ui.okButton, &QPushButton::clicked, this, &QualityPopup::okButtonClicked); @@ -33,7 +34,7 @@ QualityPopup::QualityPopup(const QString &channel, const QString &path, QStringL void QualityPopup::showDialog(const QString &channel, const QString &path, QStringList options) { - static QualityPopup *instance = new QualityPopup(channel, path, options); + QualityPopup *instance = new QualityPopup(channel, path, options); instance->show(); instance->activateWindow(); @@ -43,8 +44,9 @@ void QualityPopup::showDialog(const QString &channel, const QString &path, QStri void QualityPopup::okButtonClicked() { + singletons::SettingManager &settings = singletons::SettingManager::getInstance(); QProcess::startDetached(this->path, - {"twitch.tv/" + this->channel, this->ui.selector.currentText()}); + {"twitch.tv/" + this->channel, this->ui.selector.currentText(), settings.streamlinkOpts}); this->close(); } diff --git a/src/widgets/qualitypopup.hpp b/src/widgets/qualitypopup.hpp index 603537f34..9353208c2 100644 --- a/src/widgets/qualitypopup.hpp +++ b/src/widgets/qualitypopup.hpp @@ -9,6 +9,7 @@ #include #include "basewindow.hpp" +#include "singletons/settingsmanager.hpp" namespace chatterino { diff --git a/src/widgets/settingspages/behaviourpage.cpp b/src/widgets/settingspages/behaviourpage.cpp index e45c5b0eb..82419e106 100644 --- a/src/widgets/settingspages/behaviourpage.cpp +++ b/src/widgets/settingspages/behaviourpage.cpp @@ -45,6 +45,7 @@ BehaviourPage::BehaviourPage() groupLayout->addRow("Streamlink path:", this->createLineEdit(settings.streamlinkPath)); groupLayout->addRow("Prefered quality:", this->createComboBox({STREAMLINK_QUALITY}, settings.preferredQuality)); + groupLayout->addRow("Additional options:", this->createLineEdit(settings.streamlinkOpts)); } layout->addStretch(1); diff --git a/src/widgets/split.cpp b/src/widgets/split.cpp index 2746dbec7..22dcdd67d 100644 --- a/src/widgets/split.cpp +++ b/src/widgets/split.cpp @@ -422,6 +422,7 @@ void Split::doOpenStreamlink() args << quality; if (exclude != "") args << "--stream-sorting-excludes" << exclude; + args << settings.streamlinkOpts; QProcess::startDetached(path, args); } else { QProcess *p = new QProcess();