summary refs log tree commit diff
path: root/src/MainWindow.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-04 00:05:05 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-04 00:05:05 +0300
commit6c5309d9eb006bd7d9505f217798964803531b58 (patch)
tree53c8620b32bf005191414b7398a33082e5965f6d /src/MainWindow.cc
parentAdd build target for doxygen (diff)
downloadnheko-6c5309d9eb006bd7d9505f217798964803531b58.tar.xz
Fix regressions regarding UI resizing
The room list would be hidden only through window resizing.
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;