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
@@ -7,31 +7,23 @@
namespace chatterino {
SwitchSplitItem::SwitchSplitItem(Split *split)
: AbstractSwitcherItem(QIcon(":switcher/switch.svg"))
, split_(split)
, container_(split->getContainer())
{
}
SwitchSplitItem::SwitchSplitItem(SplitContainer *container)
SwitchSplitItem::SwitchSplitItem(SplitContainer *container, Split *split)
: AbstractSwitcherItem(QIcon(":switcher/switch.svg"))
, container_(container)
, split_(split)
{
assert(this->container_ != nullptr);
}
void SwitchSplitItem::action()
{
auto &nb = getApp()->windows->getMainWindow().getNotebook();
nb.select(this->container_);
/*
* If the item is referring to a specific channel, select the
* corresponding split.
*/
if (this->split_)
{
this->container_->setSelected(this->split_);
getApp()->windows->select(this->split_);
}
else if (this->container_)
{
getApp()->windows->select(this->container_);
}
}