summary refs log tree commit diff
path: root/src/MainWindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/MainWindow.cc')
-rw-r--r--src/MainWindow.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/MainWindow.cc b/src/MainWindow.cc

index 7733a002..37739dc3 100644 --- a/src/MainWindow.cc +++ b/src/MainWindow.cc
@@ -164,6 +164,34 @@ MainWindow::MainWindow(QWidget *parent) } void +MainWindow::showEvent(QShowEvent *event) +{ + adjustSideBars(); + QMainWindow::showEvent(event); +} + +void +MainWindow::resizeEvent(QResizeEvent *event) +{ + adjustSideBars(); + QMainWindow::resizeEvent(event); +} + +void +MainWindow::adjustSideBars() +{ + const int timelineWidth = chat_page_->timelineWidth(); + const int minAvailableWidth = + conf::sideBarCollapsePoint + ui::sidebar::CommunitiesSidebarSize; + + if (timelineWidth < minAvailableWidth && !chat_page_->isSideBarExpanded()) { + chat_page_->hideSideBars(); + } else { + chat_page_->showSideBars(); + } +} + +void MainWindow::restoreWindowSize() { QSettings settings;