diff --git a/CHANGELOG.md b/CHANGELOG.md index cbf2d32af..53492ad57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Major: Added custom FrankerFaceZ VIP Badges. (#2628) - Minor: Added `in:` search filter to find messages sent in specific channels. (#2299, #2634) - Minor: Allow for built-in Chatterino commands to be used in custom commands. (#2632) +- Bugfix: Size of splits not saved properly (#2362, #2548) - Bugfix: Fix crash that could occur when the user changed the "Custom stream player URI Scheme" setting if the user had closed down and splits in the application runtime. (#2592) ## 2.3.0 diff --git a/src/singletons/WindowManager.cpp b/src/singletons/WindowManager.cpp index c4f7cf191..f4cd93a5a 100644 --- a/src/singletons/WindowManager.cpp +++ b/src/singletons/WindowManager.cpp @@ -502,9 +502,6 @@ void WindowManager::encodeNodeRecursively(SplitNode *node, QJsonObject &obj) QJsonArray filters; encodeFilters(node->getSplit(), filters); obj.insert("filters", filters); - - obj.insert("flexh", node->getHorizontalFlex()); - obj.insert("flexv", node->getVerticalFlex()); } break; case SplitNode::HorizontalContainer: @@ -524,6 +521,9 @@ void WindowManager::encodeNodeRecursively(SplitNode *node, QJsonObject &obj) } break; } + + obj.insert("flexh", node->getHorizontalFlex()); + obj.insert("flexv", node->getVerticalFlex()); } void WindowManager::encodeChannel(IndirectChannel channel, QJsonObject &obj) diff --git a/src/widgets/splits/SplitContainer.cpp b/src/widgets/splits/SplitContainer.cpp index 7a48b6700..530133cd7 100644 --- a/src/widgets/splits/SplitContainer.cpp +++ b/src/widgets/splits/SplitContainer.cpp @@ -412,6 +412,11 @@ Split *SplitContainer::getTopRightSplit(Node &node) void SplitContainer::layout() { + if (this->disableLayouting_) + { + return; + } + // update top right split auto topRight = this->getTopRightSplit(this->baseNode_); if (this->topRight_) @@ -702,7 +707,10 @@ void SplitContainer::applyFromDescriptor(const NodeDescriptor &rootNode) { assert(this->baseNode_.type_ == Node::EmptyRoot); + this->disableLayouting_ = true; this->applyFromDescriptorRecursively(rootNode, &this->baseNode_); + this->disableLayouting_ = false; + this->layout(); } void SplitContainer::applyFromDescriptorRecursively( @@ -769,6 +777,13 @@ void SplitContainer::applyFromDescriptorRecursively( { Node *_node = new Node(); _node->parent_ = node; + + if (auto *n = std::get_if(&item)) + { + _node->flexH_ = n->flexH_; + _node->flexV_ = n->flexV_; + } + node->children_.emplace_back(_node); this->applyFromDescriptorRecursively(item, _node); } diff --git a/src/widgets/splits/SplitContainer.hpp b/src/widgets/splits/SplitContainer.hpp index 40f12df91..d6bb62f04 100644 --- a/src/widgets/splits/SplitContainer.hpp +++ b/src/widgets/splits/SplitContainer.hpp @@ -250,6 +250,7 @@ private: Node baseNode_; Split *selected_{}; Split *topRight_{}; + bool disableLayouting_{}; NotebookTab *tab_; std::vector splits_;