Changeset View
Changeset View
Standalone View
Standalone View
kate/katemdi.cpp
Show First 20 Lines • Show All 663 Lines • ▼ Show 20 Line(s) | 606 | { | |||
---|---|---|---|---|---|
664 | updateLastSize(); | 664 | updateLastSize(); | ||
665 | 665 | | |||
666 | // restore the own splitter sizes | 666 | // restore the own splitter sizes | ||
667 | QList<int> s = config.readEntry(QStringLiteral("Kate-MDI-Sidebar-%1-Splitter").arg(position()), QList<int>()); | 667 | QList<int> s = config.readEntry(QStringLiteral("Kate-MDI-Sidebar-%1-Splitter").arg(position()), QList<int>()); | ||
668 | m_ownSplit->setSizes(s); | 668 | m_ownSplit->setSizes(s); | ||
669 | 669 | | |||
670 | // show only correct toolviews, remember persistent values ;) | 670 | // show only correct toolviews, remember persistent values ;) | ||
671 | bool anyVis = false; | 671 | bool anyVis = false; | ||
672 | for (int i = 0; i < m_toolviews.size(); ++i) { | 672 | for (auto tv : qAsConst(m_toolviews)) { | ||
673 | ToolView *tv = m_toolviews[i]; | | |||
674 | | ||||
675 | tv->persistent = config.readEntry(QStringLiteral("Kate-MDI-ToolView-%1-Persistent").arg(tv->id), false); | 673 | tv->persistent = config.readEntry(QStringLiteral("Kate-MDI-ToolView-%1-Persistent").arg(tv->id), false); | ||
676 | tv->setToolVisible(config.readEntry(QStringLiteral("Kate-MDI-ToolView-%1-Visible").arg(tv->id), false)); | 674 | tv->setToolVisible(config.readEntry(QStringLiteral("Kate-MDI-ToolView-%1-Visible").arg(tv->id), false)); | ||
677 | 675 | | |||
678 | if (!anyVis) { | 676 | if (!anyVis) { | ||
679 | anyVis = tv->toolVisible(); | 677 | anyVis = tv->toolVisible(); | ||
680 | } | 678 | } | ||
681 | 679 | | |||
682 | setTab(m_widgetToId[tv], tv->toolVisible()); | 680 | setTab(m_widgetToId[tv], tv->toolVisible()); | ||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 722 | { | |||
765 | m_sidebars[KMultiTabBar::Bottom] = new Sidebar(KMultiTabBar::Bottom, this, vb); | 763 | m_sidebars[KMultiTabBar::Bottom] = new Sidebar(KMultiTabBar::Bottom, this, vb); | ||
766 | vlayout->addWidget(m_sidebars[KMultiTabBar::Bottom]); | 764 | vlayout->addWidget(m_sidebars[KMultiTabBar::Bottom]); | ||
767 | m_sidebars[KMultiTabBar::Bottom]->setSplitter(m_vSplitter); | 765 | m_sidebars[KMultiTabBar::Bottom]->setSplitter(m_vSplitter); | ||
768 | 766 | | |||
769 | m_sidebars[KMultiTabBar::Right] = new Sidebar(KMultiTabBar::Right, this, hb); | 767 | m_sidebars[KMultiTabBar::Right] = new Sidebar(KMultiTabBar::Right, this, hb); | ||
770 | hlayout->addWidget(m_sidebars[KMultiTabBar::Right]); | 768 | hlayout->addWidget(m_sidebars[KMultiTabBar::Right]); | ||
771 | m_sidebars[KMultiTabBar::Right]->setSplitter(m_hSplitter); | 769 | m_sidebars[KMultiTabBar::Right]->setSplitter(m_hSplitter); | ||
772 | 770 | | |||
773 | for (int i = 0; i < 4; i++) { | 771 | for (const auto sidebar : qAsConst(m_sidebars)) { | ||
774 | connect(m_sidebars[i], &Sidebar::sigShowPluginConfigPage, this, &MainWindow::sigShowPluginConfigPage); | 772 | connect(sidebar, &Sidebar::sigShowPluginConfigPage, this, &MainWindow::sigShowPluginConfigPage); | ||
775 | } | 773 | } | ||
776 | 774 | | |||
777 | } | 775 | } | ||
778 | 776 | | |||
779 | MainWindow::~MainWindow() | 777 | MainWindow::~MainWindow() | ||
780 | { | 778 | { | ||
781 | // cu toolviews | 779 | // cu toolviews | ||
782 | qDeleteAll(m_toolviews); | 780 | qDeleteAll(m_toolviews); | ||
783 | 781 | | |||
784 | // seems like we really should delete this by hand ;) | 782 | // seems like we really should delete this by hand ;) | ||
785 | delete m_centralWidget; | 783 | delete m_centralWidget; | ||
786 | 784 | | |||
787 | // cleanup the sidebars | 785 | // cleanup the sidebars | ||
788 | for (unsigned int i = 0; i < 4; ++i) { | 786 | for (auto sidebar : qAsConst(m_sidebars)) { | ||
789 | delete m_sidebars[i]; | 787 | delete sidebar; | ||
790 | } | 788 | } | ||
791 | } | 789 | } | ||
792 | 790 | | |||
793 | QWidget *MainWindow::centralWidget() const | 791 | QWidget *MainWindow::centralWidget() const | ||
794 | { | 792 | { | ||
795 | return m_centralWidget; | 793 | return m_centralWidget; | ||
796 | } | 794 | } | ||
797 | 795 | | |||
▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Line(s) | 972 | { | |||
977 | } | 975 | } | ||
978 | 976 | | |||
979 | if (m_restoreConfig->hasGroup(m_restoreGroup)) { | 977 | if (m_restoreConfig->hasGroup(m_restoreGroup)) { | ||
980 | // apply all settings, like toolbar pos and more ;) | 978 | // apply all settings, like toolbar pos and more ;) | ||
981 | KConfigGroup cg(m_restoreConfig, m_restoreGroup); | 979 | KConfigGroup cg(m_restoreConfig, m_restoreGroup); | ||
982 | applyMainWindowSettings(cg); | 980 | applyMainWindowSettings(cg); | ||
983 | 981 | | |||
984 | // reshuffle toolviews only if needed | 982 | // reshuffle toolviews only if needed | ||
985 | for (int i = 0; i < m_toolviews.size(); ++i) { | 983 | for (const auto tv : qAsConst(m_toolviews)) { | ||
gawin: Also, camel case? | |||||
If you like, have no issues with both variants. But better qAsConst(m_toolViews) cullmann: If you like, have no issues with both variants. But better qAsConst(m_toolViews) | |||||
986 | KMultiTabBar::KMultiTabBarPosition newPos = (KMultiTabBar::KMultiTabBarPosition) cg.readEntry(QStringLiteral("Kate-MDI-ToolView-%1-Position").arg(m_toolviews[i]->id), int(m_toolviews[i]->sidebar()->position())); | 984 | KMultiTabBar::KMultiTabBarPosition newPos = (KMultiTabBar::KMultiTabBarPosition) cg.readEntry(QStringLiteral("Kate-MDI-ToolView-%1-Position").arg(tv->id), int(tv->sidebar()->position())); | ||
987 | 985 | | |||
988 | if (m_toolviews[i]->sidebar()->position() != newPos) { | 986 | if (tv->sidebar()->position() != newPos) { | ||
989 | moveToolView(m_toolviews[i], newPos); | 987 | moveToolView(tv, newPos); | ||
990 | } | 988 | } | ||
991 | } | 989 | } | ||
992 | 990 | | |||
993 | // restore the sidebars | 991 | // restore the sidebars | ||
994 | for (unsigned int i = 0; i < 4; ++i) { | 992 | for (auto sidebar : qAsConst(m_sidebars)) { | ||
995 | m_sidebars[i]->restoreSession(cg); | 993 | sidebar->restoreSession(cg); | ||
996 | } | 994 | } | ||
997 | 995 | | |||
998 | // restore splitter sizes | 996 | // restore splitter sizes | ||
999 | QList<int> hs = (QList<int>() << 200 << 100 << 200); | 997 | QList<int> hs = (QList<int>() << 200 << 100 << 200); | ||
1000 | QList<int> vs = (QList<int>() << 150 << 100 << 200); | 998 | QList<int> vs = (QList<int>() << 150 << 100 << 200); | ||
1001 | 999 | | |||
1002 | // get main splitter sizes ;) | 1000 | // get main splitter sizes ;) | ||
1003 | hs = cg.readEntry("Kate-MDI-H-Splitter", hs); | 1001 | hs = cg.readEntry("Kate-MDI-H-Splitter", hs); | ||
Show All 37 Lines | 1019 | { | |||
1041 | config.writeEntry("Kate-MDI-H-Splitter", hs); | 1039 | config.writeEntry("Kate-MDI-H-Splitter", hs); | ||
1042 | config.writeEntry("Kate-MDI-V-Splitter", vs); | 1040 | config.writeEntry("Kate-MDI-V-Splitter", vs); | ||
1043 | 1041 | | |||
1044 | // save sidebar style | 1042 | // save sidebar style | ||
1045 | config.writeEntry("Kate-MDI-Sidebar-Style", (int)toolViewStyle()); | 1043 | config.writeEntry("Kate-MDI-Sidebar-Style", (int)toolViewStyle()); | ||
1046 | config.writeEntry("Kate-MDI-Sidebar-Visible", m_sidebarsVisible); | 1044 | config.writeEntry("Kate-MDI-Sidebar-Visible", m_sidebarsVisible); | ||
1047 | 1045 | | |||
1048 | // save the sidebars | 1046 | // save the sidebars | ||
1049 | for (unsigned int i = 0; i < 4; ++i) { | 1047 | for (auto sidebar : qAsConst(m_sidebars)) { | ||
1050 | m_sidebars[i]->saveSession(config); | 1048 | sidebar->saveSession(config); | ||
1051 | } | 1049 | } | ||
1052 | } | 1050 | } | ||
1053 | 1051 | | |||
1054 | //END MAIN WINDOW | 1052 | //END MAIN WINDOW | ||
1055 | 1053 | | |||
1056 | } // namespace KateMDI | 1054 | } // namespace KateMDI | ||
1057 | 1055 | |
Also, camel case?