mirror-chatterino2/src/widgets/StreamView.cpp

36 lines
909 B
C++
Raw Normal View History

2018-06-26 14:09:39 +02:00
#include "StreamView.hpp"
2018-01-19 14:48:17 +01:00
2018-06-26 15:33:51 +02:00
#include "common/Channel.hpp"
2018-06-26 14:09:39 +02:00
#include "util/Helpers.hpp"
#include "util/LayoutCreator.hpp"
#include "widgets/helper/ChannelView.hpp"
#include "widgets/splits/Split.hpp"
2018-01-19 14:48:17 +01:00
#ifdef USEWEBENGINE
2018-08-15 22:46:20 +02:00
# include <QtWebEngineWidgets>
2018-01-19 14:48:17 +01:00
#endif
namespace chatterino {
2018-04-07 12:53:10 +02:00
StreamView::StreamView(ChannelPtr channel, const QUrl &url)
2018-01-19 14:48:17 +01:00
{
2018-06-26 17:06:17 +02:00
LayoutCreator<StreamView> layoutCreator(this);
2018-01-19 14:48:17 +01:00
#ifdef USEWEBENGINE
2018-08-06 21:17:03 +02:00
auto web =
layoutCreator.emplace<QWebEngineView>(this).assign(&this->stream);
2018-01-19 14:48:17 +01:00
web->setUrl(url);
2018-08-06 21:17:03 +02:00
web->settings()->setAttribute(QWebEngineSettings::FullScreenSupportEnabled,
true);
2018-01-19 14:48:17 +01:00
#endif
auto chat = layoutCreator.emplace<ChannelView>();
chat->setFixedWidth(300);
chat->setChannel(channel);
this->layout()->setSpacing(0);
this->layout()->setMargin(0);
}
2018-01-19 14:48:17 +01:00
} // namespace chatterino