mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
3c8992cac1
All occurrences of log() have been replaced with qDebug() bonus meme: remove a bunch of std::string usages in the pubsub client Fixes #1467
64 lines
1.7 KiB
C++
64 lines
1.7 KiB
C++
#include "QualityPopup.hpp"
|
|
#include "util/StreamLink.hpp"
|
|
|
|
namespace chatterino {
|
|
|
|
QualityPopup::QualityPopup(const QString &_channelName, QStringList options)
|
|
: channelName_(_channelName)
|
|
{
|
|
this->ui_.okButton.setText("OK");
|
|
this->ui_.cancelButton.setText("Cancel");
|
|
|
|
QObject::connect(&this->ui_.okButton, &QPushButton::clicked, this,
|
|
&QualityPopup::okButtonClicked);
|
|
QObject::connect(&this->ui_.cancelButton, &QPushButton::clicked, this,
|
|
&QualityPopup::cancelButtonClicked);
|
|
|
|
this->ui_.buttonBox.addButton(&this->ui_.okButton,
|
|
QDialogButtonBox::ButtonRole::AcceptRole);
|
|
this->ui_.buttonBox.addButton(&this->ui_.cancelButton,
|
|
QDialogButtonBox::ButtonRole::RejectRole);
|
|
|
|
this->ui_.selector.addItems(options);
|
|
|
|
this->ui_.vbox.addWidget(&this->ui_.selector);
|
|
this->ui_.vbox.addWidget(&this->ui_.buttonBox);
|
|
|
|
this->setLayout(&this->ui_.vbox);
|
|
}
|
|
|
|
void QualityPopup::showDialog(const QString &channelName, QStringList options)
|
|
{
|
|
QualityPopup *instance = new QualityPopup(channelName, options);
|
|
|
|
instance->setAttribute(Qt::WA_DeleteOnClose, true);
|
|
|
|
instance->show();
|
|
instance->activateWindow();
|
|
instance->raise();
|
|
instance->setFocus();
|
|
}
|
|
|
|
void QualityPopup::okButtonClicked()
|
|
{
|
|
QString channelURL = "twitch.tv/" + this->channelName_;
|
|
|
|
try
|
|
{
|
|
openStreamlink(channelURL, this->ui_.selector.currentText());
|
|
}
|
|
catch (const Exception &ex)
|
|
{
|
|
qDebug() << "Exception caught trying to open streamlink:" << ex.what();
|
|
}
|
|
|
|
this->close();
|
|
}
|
|
|
|
void QualityPopup::cancelButtonClicked()
|
|
{
|
|
this->close();
|
|
}
|
|
|
|
} // namespace chatterino
|