turning a lot of includes into forward declares
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include "widgets/splits/Split.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/Common.hpp"
|
||||
#include "common/NetworkRequest.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "providers/twitch/EmoteValue.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
@@ -11,15 +11,20 @@
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
#include "util/StreamLink.hpp"
|
||||
#include "widgets/Notebook.hpp"
|
||||
#include "widgets/Window.hpp"
|
||||
#include "widgets/dialogs/QualityPopup.hpp"
|
||||
#include "widgets/dialogs/SelectChannelDialog.hpp"
|
||||
#include "widgets/dialogs/TextInputDialog.hpp"
|
||||
#include "widgets/dialogs/UserInfoPopup.hpp"
|
||||
#include "widgets/helper/ChannelView.hpp"
|
||||
#include "widgets/helper/DebugPopup.hpp"
|
||||
#include "widgets/helper/ResizingTextEdit.hpp"
|
||||
#include "widgets/helper/SearchPopup.hpp"
|
||||
#include "widgets/helper/Shortcut.hpp"
|
||||
#include "widgets/splits/SplitContainer.hpp"
|
||||
#include "widgets/splits/SplitHeader.hpp"
|
||||
#include "widgets/splits/SplitInput.hpp"
|
||||
#include "widgets/splits/SplitOverlay.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
@@ -37,7 +42,6 @@
|
||||
#include <random>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
pajlada::Signals::Signal<Qt::KeyboardModifiers> Split::modifierStatusChanged;
|
||||
Qt::KeyboardModifiers Split::modifierStatus = Qt::NoModifier;
|
||||
|
||||
@@ -51,20 +55,20 @@ Split::Split(QWidget *parent)
|
||||
: BaseWidget(parent)
|
||||
, container_(nullptr)
|
||||
, channel_(Channel::getEmpty())
|
||||
, vbox_(this)
|
||||
, header_(this)
|
||||
, view_(this)
|
||||
, input_(this)
|
||||
, vbox_(new QVBoxLayout(this))
|
||||
, header_(new SplitHeader(this))
|
||||
, view_(new ChannelView(this))
|
||||
, input_(new SplitInput(this))
|
||||
, overlay_(new SplitOverlay(this))
|
||||
{
|
||||
this->setMouseTracking(true);
|
||||
|
||||
this->vbox_.setSpacing(0);
|
||||
this->vbox_.setMargin(1);
|
||||
this->vbox_->setSpacing(0);
|
||||
this->vbox_->setMargin(1);
|
||||
|
||||
this->vbox_.addWidget(&this->header_);
|
||||
this->vbox_.addWidget(&this->view_, 1);
|
||||
this->vbox_.addWidget(&this->input_);
|
||||
this->vbox_->addWidget(this->header_);
|
||||
this->vbox_->addWidget(this->view_, 1);
|
||||
this->vbox_->addWidget(this->input_);
|
||||
|
||||
// Initialize chat widget-wide hotkeys
|
||||
// CTRL+W: Close Split
|
||||
@@ -89,41 +93,41 @@ Split::Split(QWidget *parent)
|
||||
// CreateShortcut(this, "ALT+SHIFT+UP", &Split::doIncFlexY);
|
||||
// CreateShortcut(this, "ALT+SHIFT+DOWN", &Split::doDecFlexY);
|
||||
|
||||
this->input_.ui_.textEdit->installEventFilter(parent);
|
||||
this->input_->ui_.textEdit->installEventFilter(parent);
|
||||
|
||||
this->view_.mouseDown.connect([this](QMouseEvent *) {
|
||||
this->view_->mouseDown.connect([this](QMouseEvent *) {
|
||||
//
|
||||
this->giveFocus(Qt::MouseFocusReason);
|
||||
});
|
||||
this->view_.selectionChanged.connect([this]() {
|
||||
if (view_.hasSelection()) {
|
||||
this->input_.clearSelection();
|
||||
this->view_->selectionChanged.connect([this]() {
|
||||
if (view_->hasSelection()) {
|
||||
this->input_->clearSelection();
|
||||
}
|
||||
});
|
||||
|
||||
this->input_.textChanged.connect([=](const QString &newText) {
|
||||
this->input_->textChanged.connect([=](const QString &newText) {
|
||||
if (getSettings()->showEmptyInput) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (newText.length() == 0) {
|
||||
this->input_.hide();
|
||||
} else if (this->input_.isHidden()) {
|
||||
this->input_.show();
|
||||
this->input_->hide();
|
||||
} else if (this->input_->isHidden()) {
|
||||
this->input_->show();
|
||||
}
|
||||
});
|
||||
|
||||
getSettings()->showEmptyInput.connect(
|
||||
[this](const bool &showEmptyInput, auto) {
|
||||
if (!showEmptyInput && this->input_.getInputText().length() == 0) {
|
||||
this->input_.hide();
|
||||
if (!showEmptyInput && this->input_->getInputText().length() == 0) {
|
||||
this->input_->hide();
|
||||
} else {
|
||||
this->input_.show();
|
||||
this->input_->show();
|
||||
}
|
||||
},
|
||||
this->managedConnections_);
|
||||
|
||||
this->header_.updateModerationModeIcon();
|
||||
this->header_->updateModerationModeIcon();
|
||||
this->overlay_->hide();
|
||||
|
||||
this->setSizePolicy(QSizePolicy::MinimumExpanding,
|
||||
@@ -139,9 +143,9 @@ Split::Split(QWidget *parent)
|
||||
}
|
||||
});
|
||||
|
||||
this->input_.ui_.textEdit->focused.connect(
|
||||
this->input_->ui_.textEdit->focused.connect(
|
||||
[this] { this->focused.invoke(); });
|
||||
this->input_.ui_.textEdit->focusLost.connect(
|
||||
this->input_->ui_.textEdit->focusLost.connect(
|
||||
[this] { this->focusLost.invoke(); });
|
||||
}
|
||||
|
||||
@@ -155,7 +159,7 @@ Split::~Split()
|
||||
|
||||
ChannelView &Split::getChannelView()
|
||||
{
|
||||
return this->view_;
|
||||
return *this->view_;
|
||||
}
|
||||
|
||||
SplitContainer *Split::getContainer()
|
||||
@@ -187,7 +191,7 @@ void Split::setChannel(IndirectChannel newChannel)
|
||||
{
|
||||
this->channel_ = newChannel;
|
||||
|
||||
this->view_.setChannel(newChannel.get());
|
||||
this->view_->setChannel(newChannel.get());
|
||||
|
||||
this->usermodeChangedConnection_.disconnect();
|
||||
this->roomModeChangedConnection_.disconnect();
|
||||
@@ -197,12 +201,12 @@ void Split::setChannel(IndirectChannel newChannel)
|
||||
|
||||
if (tc != nullptr) {
|
||||
this->usermodeChangedConnection_ = tc->userStateChanged.connect([this] {
|
||||
this->header_.updateModerationModeIcon();
|
||||
this->header_.updateRoomModes();
|
||||
this->header_->updateModerationModeIcon();
|
||||
this->header_->updateRoomModes();
|
||||
});
|
||||
|
||||
this->roomModeChangedConnection_ = tc->roomModesChanged.connect(
|
||||
[this] { this->header_.updateRoomModes(); });
|
||||
[this] { this->header_->updateRoomModes(); });
|
||||
}
|
||||
|
||||
this->indirectChannelChangedConnection_ =
|
||||
@@ -210,9 +214,9 @@ void Split::setChannel(IndirectChannel newChannel)
|
||||
QTimer::singleShot(0, [this] { this->setChannel(this->channel_); });
|
||||
});
|
||||
|
||||
this->header_.updateModerationModeIcon();
|
||||
this->header_.updateChannelText();
|
||||
this->header_.updateRoomModes();
|
||||
this->header_->updateModerationModeIcon();
|
||||
this->header_->updateChannelText();
|
||||
this->header_->updateRoomModes();
|
||||
|
||||
this->channelChanged.invoke();
|
||||
}
|
||||
@@ -221,8 +225,8 @@ void Split::setModerationMode(bool value)
|
||||
{
|
||||
if (value != this->moderationMode_) {
|
||||
this->moderationMode_ = value;
|
||||
this->header_.updateModerationModeIcon();
|
||||
this->view_.layoutMessages();
|
||||
this->header_->updateModerationModeIcon();
|
||||
this->view_->layoutMessages();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +237,7 @@ bool Split::getModerationMode() const
|
||||
|
||||
void Split::insertTextToInput(const QString &text)
|
||||
{
|
||||
this->input_.insertText(text);
|
||||
this->input_->insertText(text);
|
||||
}
|
||||
|
||||
void Split::showChangeChannelPopup(const char *dialogTitle, bool empty,
|
||||
@@ -267,27 +271,27 @@ void Split::showChangeChannelPopup(const char *dialogTitle, bool empty,
|
||||
|
||||
void Split::layoutMessages()
|
||||
{
|
||||
this->view_.layoutMessages();
|
||||
this->view_->layoutMessages();
|
||||
}
|
||||
|
||||
void Split::updateGifEmotes()
|
||||
{
|
||||
this->view_.queueUpdate();
|
||||
this->view_->queueUpdate();
|
||||
}
|
||||
|
||||
void Split::updateLastReadMessage()
|
||||
{
|
||||
this->view_.updateLastReadMessage();
|
||||
this->view_->updateLastReadMessage();
|
||||
}
|
||||
|
||||
void Split::giveFocus(Qt::FocusReason reason)
|
||||
{
|
||||
this->input_.ui_.textEdit->setFocus(reason);
|
||||
this->input_->ui_.textEdit->setFocus(reason);
|
||||
}
|
||||
|
||||
bool Split::hasFocus() const
|
||||
{
|
||||
return this->input_.ui_.textEdit->hasFocus();
|
||||
return this->input_->ui_.textEdit->hasFocus();
|
||||
}
|
||||
|
||||
void Split::paintEvent(QPaintEvent *)
|
||||
@@ -305,13 +309,13 @@ void Split::mouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
void Split::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
this->view_.unsetCursor();
|
||||
this->view_->unsetCursor();
|
||||
this->handleModifiers(QGuiApplication::queryKeyboardModifiers());
|
||||
}
|
||||
|
||||
void Split::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
this->view_.unsetCursor();
|
||||
this->view_->unsetCursor();
|
||||
this->handleModifiers(QGuiApplication::queryKeyboardModifiers());
|
||||
}
|
||||
|
||||
@@ -389,7 +393,7 @@ void Split::changeChannel()
|
||||
void Split::popup()
|
||||
{
|
||||
auto app = getApp();
|
||||
Window &window = app->windows->createWindow(Window::Type::Popup);
|
||||
Window &window = app->windows->createWindow(WindowType::Popup);
|
||||
|
||||
Split *split = new Split(static_cast<SplitContainer *>(
|
||||
window.getNotebook().getOrAddSelectedPage()));
|
||||
@@ -402,7 +406,7 @@ void Split::popup()
|
||||
|
||||
void Split::clear()
|
||||
{
|
||||
this->view_.clearMessages();
|
||||
this->view_->clearMessages();
|
||||
}
|
||||
|
||||
void Split::openInBrowser()
|
||||
@@ -442,8 +446,8 @@ void Split::showViewerList()
|
||||
QDockWidget::DockWidgetFloatable);
|
||||
viewerDock->resize(
|
||||
0.5 * this->width(),
|
||||
this->height() - this->header_.height() - this->input_.height());
|
||||
viewerDock->move(0, this->header_.height());
|
||||
this->height() - this->header_->height() - this->input_->height());
|
||||
viewerDock->move(0, this->header_->height());
|
||||
|
||||
auto multiWidget = new QWidget(viewerDock);
|
||||
auto dockVbox = new QVBoxLayout(viewerDock);
|
||||
@@ -543,7 +547,7 @@ void Split::showUserInfoPopup(const UserName &user)
|
||||
|
||||
void Split::copyToClipboard()
|
||||
{
|
||||
QApplication::clipboard()->setText(this->view_.getSelectedText());
|
||||
QApplication::clipboard()->setText(this->view_->getSelectedText());
|
||||
}
|
||||
|
||||
void Split::showSearch()
|
||||
|
||||
Reference in New Issue
Block a user