Changeset View
Changeset View
Standalone View
Standalone View
src/MainWindow.cpp
Show First 20 Lines • Show All 758 Lines • ▼ Show 20 Line(s) | 758 | { | |||
---|---|---|---|---|---|
759 | setMenuBarInitialVisibility(KonsoleSettings::showMenuBarByDefault()); | 759 | setMenuBarInitialVisibility(KonsoleSettings::showMenuBarByDefault()); | ||
760 | 760 | | |||
761 | if (KonsoleSettings::allowMenuAccelerators()) { | 761 | if (KonsoleSettings::allowMenuAccelerators()) { | ||
762 | restoreMenuAccelerators(); | 762 | restoreMenuAccelerators(); | ||
763 | } else { | 763 | } else { | ||
764 | removeMenuAccelerators(); | 764 | removeMenuAccelerators(); | ||
765 | } | 765 | } | ||
766 | 766 | | |||
767 | _viewManager->setNavigationVisibility(KonsoleSettings::tabBarVisibility()); | | |||
768 | _viewManager->setNavigationPosition(KonsoleSettings::tabBarPosition()); | | |||
769 | _viewManager->setNavigationBehavior(KonsoleSettings::newTabBehavior()); | | |||
770 | _viewManager->setNavigationTabWidthExpanding(KonsoleSettings::expandTabWidth()); | | |||
771 | _viewManager->setShowQuickButtons(KonsoleSettings::showQuickButtons()); | | |||
772 | | ||||
773 | if (KonsoleSettings::tabBarUseUserStyleSheet()) { | | |||
774 | setNavigationStyleSheetFromFile(KonsoleSettings::tabBarUserStyleSheetFile()); | | |||
775 | } else { | | |||
776 | // Apply default values | | |||
777 | _viewManager->setNavigationStyleSheet(KonsoleSettings::tabBarStyleSheet()); | | |||
778 | } | | |||
779 | | ||||
780 | setAutoSaveSettings(QStringLiteral("MainWindow"), KonsoleSettings::saveGeometryOnExit()); | 767 | setAutoSaveSettings(QStringLiteral("MainWindow"), KonsoleSettings::saveGeometryOnExit()); | ||
781 | | ||||
782 | updateWindowCaption(); | 768 | updateWindowCaption(); | ||
783 | } | 769 | } | ||
784 | 770 | | |||
785 | | ||||
786 | void MainWindow::setNavigationStyleSheetFromFile(const QUrl &styleSheetFile) | | |||
787 | { | | |||
788 | // Let's only deal w/ local files for now | | |||
789 | if (!styleSheetFile.isLocalFile()) { | | |||
790 | _viewManager->setNavigationStyleSheet(KonsoleSettings::tabBarStyleSheet()); | | |||
791 | } | | |||
792 | | ||||
793 | QFile file(styleSheetFile.toLocalFile()); | | |||
794 | if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { | | |||
795 | _viewManager->setNavigationStyleSheet(KonsoleSettings::tabBarStyleSheet()); | | |||
796 | } | | |||
797 | | ||||
798 | QString styleSheetText; | | |||
799 | QTextStream in(&file); | | |||
800 | while (!in.atEnd()) { | | |||
801 | styleSheetText.append(in.readLine()); | | |||
802 | } | | |||
803 | | ||||
804 | // Replace current style sheet w/ loaded file | | |||
805 | _viewManager->setNavigationStyleSheet(styleSheetText); | | |||
806 | } | | |||
807 | | ||||
808 | void MainWindow::activateMenuBar() | 771 | void MainWindow::activateMenuBar() | ||
809 | { | 772 | { | ||
810 | const QList<QAction *> menuActions = menuBar()->actions(); | 773 | const QList<QAction *> menuActions = menuBar()->actions(); | ||
811 | 774 | | |||
812 | if (menuActions.isEmpty()) { | 775 | if (menuActions.isEmpty()) { | ||
813 | return; | 776 | return; | ||
814 | } | 777 | } | ||
815 | 778 | | |||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |