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
+24 -12
View File
@@ -28,6 +28,7 @@
#include "util/Clamp.hpp"
#include "util/CombinePath.hpp"
#include "widgets/AccountSwitchPopup.hpp"
#include "widgets/FramelessEmbedWindow.hpp"
#include "widgets/Notebook.hpp"
#include "widgets/Window.hpp"
#include "widgets/dialogs/SettingsDialog.hpp"
@@ -130,6 +131,8 @@ WindowManager::WindowManager()
});
}
WindowManager::~WindowManager() = default;
MessageElementFlags WindowManager::getWordFlags()
{
return this->wordFlags_;
@@ -269,22 +272,14 @@ Window &WindowManager::createWindow(WindowType type, bool show)
return *window;
}
int WindowManager::windowCount()
void WindowManager::select(Split *split)
{
return this->windows_.size();
this->selectSplit.invoke(split);
}
Window *WindowManager::windowAt(int index)
void WindowManager::select(SplitContainer *container)
{
assertInGuiThread();
if (index < 0 || (size_t)index >= this->windows_.size())
{
return nullptr;
}
qCDebug(chatterinoWindowmanager) << "getting window at bad index" << index;
return this->windows_.at(index);
this->selectSplitContainer.invoke(container);
}
QPoint WindowManager::emotePopupPos()
@@ -324,11 +319,23 @@ void WindowManager::initialize(Settings &settings, Paths &paths)
this->applyWindowLayout(windowLayout);
}
if (getArgs().isFramelessEmbed)
{
this->framelessEmbedWindow_.reset(new FramelessEmbedWindow);
this->framelessEmbedWindow_->show();
}
// No main window has been created from loading, create an empty one
if (this->mainWindow_ == nullptr)
{
this->mainWindow_ = &this->createWindow(WindowType::Main);
this->mainWindow_->getNotebook().addPage(true);
// TODO: don't create main window if it's a frameless embed
if (getArgs().isFramelessEmbed)
{
this->mainWindow_->hide();
}
}
settings.timestampFormat.connect([this](auto, auto) {
@@ -634,6 +641,11 @@ WindowLayout WindowManager::loadWindowLayoutFromFile() const
void WindowManager::applyWindowLayout(const WindowLayout &layout)
{
if (getArgs().dontLoadMainWindow)
{
return;
}
// Set emote popup position
this->emotePopupPos_ = layout.emotePopupPos_;