| 129 | } |
| 130 | |
| 131 | void MainWindow::setArea(Area *area) |
| 132 | { |
| 133 | Q_D(MainWindow); |
| 134 | |
| 135 | if (d->area) { |
| 136 | // Disconnect the previous area. We really do not want to mess with |
| 137 | // the main window if an area not visible now is modified. Further, |
| 138 | // if setArea() is called with the same area as is current |
| 139 | // now, we do not want to connect to the same signals twice. |
| 140 | disconnect(d->area, nullptr, d, nullptr); |
| 141 | } |
| 142 | |
| 143 | bool differentArea = (area != d->area); |
| 144 | if (d->autoAreaSettingsSave && differentArea) |
| 145 | saveSettings(); |
| 146 | |
| 147 | HoldUpdates hu(this); |
| 148 | if (d->area) |
| 149 | clearArea(); |
| 150 | d->area = area; |
| 151 | d->reconstruct(); |
| 152 | |
| 153 | if(d->area->activeView()) |
| 154 | activateView(d->area->activeView()); |
| 155 | else |
| 156 | d->activateFirstVisibleView(); |
| 157 | |
| 158 | initializeStatusBar(); |
| 159 | emit areaChanged(area); |
| 160 | |
| 161 | hu.stop(); |
| 162 | |
| 163 | loadSettings(); |
| 164 | connect(area, &Area::viewAdded, d, &MainWindowPrivate::viewAdded); |
| 165 | connect(area, &Area::viewRemoved, d, &MainWindowPrivate::viewRemovedInternal); |
| 166 | connect(area, &Area::requestToolViewRaise, d, &MainWindowPrivate::raiseToolView); |
| 167 | connect(area, &Area::aboutToRemoveView, d, &MainWindowPrivate::aboutToRemoveView); |
| 168 | connect(area, &Area::toolViewAdded, d, &MainWindowPrivate::toolViewAdded); |
| 169 | connect(area, &Area::aboutToRemoveToolView, d, &MainWindowPrivate::aboutToRemoveToolView); |
| 170 | } |
| 171 | |
| 172 | void MainWindow::focusEditor() |
| 173 | { |
no test coverage detected