Skip to content

Commit

Permalink
Show feedback upon opening a channel in streamlink in more places (#3510
Browse files Browse the repository at this point in the history
)

Co-authored-by: Leon Richardt <leon.richardt@gmail.com>
  • Loading branch information
zneix and leon-richardt authored Jan 15, 2022
1 parent 52da0fd commit 9069dee
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
- Minor: Add workaround for multipart emoji as described in [the RFC](https://mm2pl.github.io/emoji_rfc.pdf). (#3469)
- Minor: Add feedback when using the whisper command `/w` incorrectly. (#3439)
- Minor: Add feedback when writing a non-command message in the `/whispers` split. (#3439)
- Minor: Opening streamlink through hotkeys and/or split header menu matches `/streamlink` command and shows feedback in chat as well. (#3510)
- Bugfix: Fix Split Input hotkeys not being available when input is hidden (#3362)
- Bugfix: Fixed colored usernames sometimes not working. (#3170)
- Bugfix: Restored ability to send duplicate `/me` messages. (#3166)
Expand Down
2 changes: 0 additions & 2 deletions src/controllers/commands/CommandController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,6 @@ void CommandController::initialize(Settings &, Paths &paths)
}

stripChannelName(target);
channel->addMessage(makeSystemMessage(
QString("Opening %1 in streamlink...").arg(target)));
openStreamlinkForChannel(target);

return "";
Expand Down
18 changes: 18 additions & 0 deletions src/util/StreamLink.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#include "util/StreamLink.hpp"

#include "Application.hpp"
#include "providers/irc/IrcMessageBuilder.hpp"
#include "singletons/Settings.hpp"
#include "singletons/WindowManager.hpp"
#include "util/Helpers.hpp"
#include "util/SplitCommand.hpp"
#include "widgets/Window.hpp"
#include "widgets/dialogs/QualityPopup.hpp"
#include "widgets/splits/Split.hpp"

#include <QErrorMessage>
#include <QFileInfo>
Expand Down Expand Up @@ -205,6 +209,20 @@ void openStreamlink(const QString &channelURL, const QString &quality,

void openStreamlinkForChannel(const QString &channel)
{
static const QString INFO_TEMPLATE("Opening %1 in Streamlink ...");

auto *currentPage = dynamic_cast<SplitContainer *>(
getApp()->windows->getMainWindow().getNotebook().getSelectedPage());
if (currentPage != nullptr)
{
if (auto currentSplit = currentPage->getSelectedSplit();
currentSplit != nullptr)
{
currentSplit->getChannel()->addMessage(
makeSystemMessage(INFO_TEMPLATE.arg(channel)));
}
}

QString channelURL = "twitch.tv/" + channel;

QString preferredQuality = getSettings()->preferredQuality.getValue();
Expand Down

0 comments on commit 9069dee

Please sign in to comment.