Added x-attach-split-to-window command line arg (#2411)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
fourtf
2021-04-17 16:15:23 +02:00
committed by GitHub
parent 58017a7546
commit 2db140d5af
21 changed files with 350 additions and 160 deletions
+6 -46
View File
@@ -31,7 +31,6 @@
#include "widgets/helper/NotebookTab.hpp"
#include "widgets/helper/ResizingTextEdit.hpp"
#include "widgets/helper/SearchPopup.hpp"
#include "widgets/splits/ClosedSplits.hpp"
#include "widgets/splits/SplitContainer.hpp"
#include "widgets/splits/SplitHeader.hpp"
#include "widgets/splits/SplitInput.hpp"
@@ -78,15 +77,8 @@ namespace {
pajlada::Signals::Signal<Qt::KeyboardModifiers> Split::modifierStatusChanged;
Qt::KeyboardModifiers Split::modifierStatus = Qt::NoModifier;
Split::Split(SplitContainer *parent)
: Split(static_cast<QWidget *>(parent))
{
this->container_ = parent;
}
Split::Split(QWidget *parent)
: BaseWidget(parent)
, container_(nullptr)
, channel_(Channel::getEmpty())
, vbox_(new QVBoxLayout(this))
, header_(new SplitHeader(this))
@@ -173,7 +165,7 @@ Split::Split(QWidget *parent)
});
this->view_->joinToChannel.connect([this](QString twitchChannel) {
this->container_->appendNewSplit(false)->setChannel(
this->openSplitRequested.invoke(
getApp()->twitch.server->getOrAddChannel(twitchChannel));
});
@@ -294,21 +286,6 @@ ChannelView &Split::getChannelView()
return *this->view_;
}
SplitContainer *Split::getContainer()
{
return this->container_;
}
bool Split::isInContainer() const
{
return this->container_ != nullptr;
}
void Split::setContainer(SplitContainer *container)
{
this->container_ = container;
}
void Split::updateInputPlaceholder()
{
if (!this->getChannel()->isTwitchChannel())
@@ -388,7 +365,7 @@ void Split::setChannel(IndirectChannel newChannel)
}
this->channel_.get()->displayNameChanged.connect([this] {
this->container_->refreshTab();
this->actionRequested.invoke(Action::RefreshTab);
});
this->channelChanged.invoke();
@@ -435,10 +412,7 @@ void Split::showChangeChannelPopup(const char *dialogTitle, bool empty,
if (dialog->hasSeletedChannel())
{
this->setChannel(dialog->getSelectedChannel());
if (this->isInContainer())
{
this->container_->refreshTab();
}
this->actionRequested.invoke(Action::RefreshTab);
}
callback(dialog->hasSeletedChannel());
@@ -514,10 +488,7 @@ void Split::enterEvent(QEvent *event)
this->overlay_->show();
}
if (this->container_ != nullptr)
{
this->container_->resetMouseStatus();
}
this->actionRequested.invoke(Action::ResetMouseStatus);
}
void Split::leaveEvent(QEvent *event)
@@ -554,23 +525,12 @@ void Split::setIsTopRightSplit(bool value)
/// Slots
void Split::addSibling()
{
if (this->container_)
{
this->container_->appendNewSplit(true);
}
this->actionRequested.invoke(Action::AppendNewSplit);
}
void Split::deleteFromContainer()
{
if (this->container_)
{
this->container_->deleteSplit(this);
auto *tab = this->getContainer()->getTab();
tab->connect(tab, &QWidget::destroyed, [tab]() mutable {
ClosedSplits::invalidateTab(tab);
});
ClosedSplits::push({this->getChannel()->getName(), tab});
}
this->actionRequested.invoke(Action::Delete);
}
void Split::changeChannel()