Changeset View
Changeset View
Standalone View
Standalone View
src/MainWindow.cpp
Show First 20 Lines • Show All 752 Lines • ▼ Show 20 Line(s) | 722 | { | |||
---|---|---|---|---|---|
753 | } | 753 | } | ||
754 | 754 | | |||
755 | settingsDialog->show(); | 755 | settingsDialog->show(); | ||
756 | } | 756 | } | ||
757 | 757 | | |||
758 | void MainWindow::applyKonsoleSettings() | 758 | void MainWindow::applyKonsoleSettings() | ||
759 | { | 759 | { | ||
760 | setMenuBarInitialVisibility(KonsoleSettings::showMenuBarByDefault()); | 760 | setMenuBarInitialVisibility(KonsoleSettings::showMenuBarByDefault()); | ||
761 | 761 | setRemoveWindowTitleBarAndFrame(KonsoleSettings::removeWindowTitleBarAndFrame()); | |||
762 | if (KonsoleSettings::allowMenuAccelerators()) { | 762 | if (KonsoleSettings::allowMenuAccelerators()) { | ||
763 | restoreMenuAccelerators(); | 763 | restoreMenuAccelerators(); | ||
764 | } else { | 764 | } else { | ||
765 | removeMenuAccelerators(); | 765 | removeMenuAccelerators(); | ||
766 | } | 766 | } | ||
767 | 767 | | |||
768 | _viewManager->setNavigationBehavior(KonsoleSettings::newTabBehavior()); | 768 | _viewManager->setNavigationBehavior(KonsoleSettings::newTabBehavior()); | ||
769 | setAutoSaveSettings(QStringLiteral("MainWindow"), KonsoleSettings::saveGeometryOnExit()); | 769 | setAutoSaveSettings(QStringLiteral("MainWindow"), KonsoleSettings::saveGeometryOnExit()); | ||
Show All 37 Lines | 800 | { | |||
807 | } | 807 | } | ||
808 | } | 808 | } | ||
809 | 809 | | |||
810 | void MainWindow::setMenuBarInitialVisibility(bool visible) | 810 | void MainWindow::setMenuBarInitialVisibility(bool visible) | ||
811 | { | 811 | { | ||
812 | _menuBarInitialVisibility = visible; | 812 | _menuBarInitialVisibility = visible; | ||
813 | } | 813 | } | ||
814 | 814 | | |||
815 | void MainWindow::setRemoveWindowTitleBarAndFrame(bool frameless) | ||||
816 | { | ||||
817 | // This is used to check if the window is in "opening" state | ||||
818 | // And avoid the visibility change when we change the window flag | ||||
819 | bool oldVisibility = isVisible(); | ||||
820 | | ||||
821 | if(frameless) { | ||||
822 | setWindowFlags(Qt::FramelessWindowHint); | ||||
823 | } else { | ||||
824 | setWindowFlags(Qt::Widget); | ||||
825 | } | ||||
826 | | ||||
827 | if (oldVisibility & !isVisible()) { | ||||
hindenburg: while this works for bool, I'd rather use && here - I'll commit some changes after this. | |||||
828 | setVisible(true); | ||||
829 | } | ||||
830 | } | ||||
831 | | ||||
815 | void MainWindow::showEvent(QShowEvent *event) | 832 | void MainWindow::showEvent(QShowEvent *event) | ||
816 | { | 833 | { | ||
817 | // Make sure the 'initial' visibility is applied only once. | 834 | // Make sure the 'initial' visibility is applied only once. | ||
818 | if (!_menuBarInitialVisibilityApplied) { | 835 | if (!_menuBarInitialVisibilityApplied) { | ||
819 | // the initial visibility of menubar should be applied at this last | 836 | // the initial visibility of menubar should be applied at this last | ||
820 | // moment. Otherwise, the initial visibility will be determined by | 837 | // moment. Otherwise, the initial visibility will be determined by | ||
821 | // what KMainWindow has automatically stored in konsolerc, but not by | 838 | // what KMainWindow has automatically stored in konsolerc, but not by | ||
822 | // what users has explicitly configured . | 839 | // what users has explicitly configured . | ||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |
while this works for bool, I'd rather use && here - I'll commit some changes after this.