| 3248 | } |
| 3249 | |
| 3250 | bool MainWindow::LoadLayout(int layout) |
| 3251 | { |
| 3252 | qInfo() << "LoadLayout " << layout; |
| 3253 | QString path = GetLayoutPath(layout); |
| 3254 | |
| 3255 | QFile f(path); |
| 3256 | if(f.open(QIODevice::ReadOnly | QIODevice::Text)) |
| 3257 | { |
| 3258 | QVariantMap state; |
| 3259 | |
| 3260 | bool success = LoadFromJSON(state, f, JSON_ID, JSON_VER); |
| 3261 | |
| 3262 | if(!success) |
| 3263 | return false; |
| 3264 | |
| 3265 | if(restoreState(state)) |
| 3266 | { |
| 3267 | // Close any windows which have now become orphaned |
| 3268 | foreach(QWidget *toolWindow, ui->toolWindowManager->toolWindows()) |
| 3269 | { |
| 3270 | if(ui->toolWindowManager->areaOf(toolWindow) == NULL) |
| 3271 | { |
| 3272 | qInfo() << "Manually closing orphaned window " << toolWindow->objectName(); |
| 3273 | ui->toolWindowManager->forceCloseToolWindow(toolWindow); |
| 3274 | } |
| 3275 | } |
| 3276 | return true; |
| 3277 | } |
| 3278 | return false; |
| 3279 | } |
| 3280 | |
| 3281 | qInfo() << "Couldn't load layout from " << path << " " << f.errorString(); |
| 3282 | |
| 3283 | return false; |
| 3284 | } |
| 3285 | |
| 3286 | void MainWindow::showLaunchError(ResultDetails result) |
| 3287 | { |
nothing calls this directly
no test coverage detected