Add opening tab in popup (#3082)
Co-authored-by: zneix <zneix@zneix.eu> Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "util/Helpers.hpp"
|
||||
#include "util/LayoutCreator.hpp"
|
||||
#include "widgets/Notebook.hpp"
|
||||
#include "widgets/Window.hpp"
|
||||
#include "widgets/helper/ChannelView.hpp"
|
||||
#include "widgets/helper/NotebookTab.hpp"
|
||||
#include "widgets/splits/ClosedSplits.hpp"
|
||||
@@ -761,6 +762,33 @@ void SplitContainer::applyFromDescriptor(const NodeDescriptor &rootNode)
|
||||
this->layout();
|
||||
}
|
||||
|
||||
void SplitContainer::popup()
|
||||
{
|
||||
Window &window = getApp()->windows->createWindow(WindowType::Popup);
|
||||
auto popupContainer = window.getNotebook().getOrAddSelectedPage();
|
||||
|
||||
QJsonObject encodedTab;
|
||||
WindowManager::encodeTab(this, true, encodedTab);
|
||||
TabDescriptor tab = TabDescriptor::loadFromJSON(encodedTab);
|
||||
|
||||
// custom title
|
||||
if (!tab.customTitle_.isEmpty())
|
||||
{
|
||||
popupContainer->getTab()->setCustomTitle(tab.customTitle_);
|
||||
}
|
||||
|
||||
// highlighting on new messages
|
||||
popupContainer->getTab()->setHighlightsEnabled(tab.highlightsEnabled_);
|
||||
|
||||
// splits
|
||||
if (tab.rootNode_)
|
||||
{
|
||||
popupContainer->applyFromDescriptor(*tab.rootNode_);
|
||||
}
|
||||
|
||||
window.show();
|
||||
}
|
||||
|
||||
void SplitContainer::applyFromDescriptorRecursively(
|
||||
const NodeDescriptor &rootNode, Node *node)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user