fix: properly handle CLI arguments (#2368)
Fix CLI arguments not being respected. This happened due to the addition of category-based logging (--help, --version) and changes to the window loading ( --channels), respectively. When handling --channels, I took the liberty to refactor the previous version of window description (which relied on generating JSON) to directly building the WindowLayout.
This commit is contained in:
@@ -37,8 +37,6 @@
|
||||
namespace chatterino {
|
||||
namespace {
|
||||
|
||||
const QString WINDOW_LAYOUT_FILENAME(QStringLiteral("window-layout.json"));
|
||||
|
||||
boost::optional<bool> &shouldMoveOutOfBoundsWindow()
|
||||
{
|
||||
static boost::optional<bool> x;
|
||||
@@ -47,6 +45,9 @@ namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
const QString WindowManager::WINDOW_LAYOUT_FILENAME(
|
||||
QStringLiteral("window-layout.json"));
|
||||
|
||||
using SplitNode = SplitContainer::Node;
|
||||
using SplitDirection = SplitContainer::Direction;
|
||||
|
||||
@@ -83,8 +84,8 @@ void WindowManager::showAccountSelectPopup(QPoint point)
|
||||
}
|
||||
|
||||
WindowManager::WindowManager()
|
||||
: windowLayoutFilePath(
|
||||
combinePath(getPaths()->settingsDirectory, WINDOW_LAYOUT_FILENAME))
|
||||
: windowLayoutFilePath(combinePath(getPaths()->settingsDirectory,
|
||||
WindowManager::WINDOW_LAYOUT_FILENAME))
|
||||
{
|
||||
qCDebug(chatterinoWindowmanager) << "init WindowManager";
|
||||
|
||||
@@ -297,7 +298,16 @@ void WindowManager::initialize(Settings &settings, Paths &paths)
|
||||
assert(!this->initialized_);
|
||||
|
||||
{
|
||||
auto windowLayout = this->loadWindowLayoutFromFile();
|
||||
WindowLayout windowLayout;
|
||||
|
||||
if (getArgs().customChannelLayout)
|
||||
{
|
||||
windowLayout = getArgs().customChannelLayout.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
windowLayout = this->loadWindowLayoutFromFile();
|
||||
}
|
||||
|
||||
this->emotePopupPos_ = windowLayout.emotePopupPos_;
|
||||
|
||||
@@ -305,10 +315,10 @@ void WindowManager::initialize(Settings &settings, Paths &paths)
|
||||
}
|
||||
|
||||
// No main window has been created from loading, create an empty one
|
||||
if (mainWindow_ == nullptr)
|
||||
if (this->mainWindow_ == nullptr)
|
||||
{
|
||||
mainWindow_ = &this->createWindow(WindowType::Main);
|
||||
mainWindow_->getNotebook().addPage(true);
|
||||
this->mainWindow_ = &this->createWindow(WindowType::Main);
|
||||
this->mainWindow_->getNotebook().addPage(true);
|
||||
}
|
||||
|
||||
settings.timestampFormat.connect([this](auto, auto) {
|
||||
|
||||
Reference in New Issue
Block a user