src/main.cpp

changeset 240
414d392b9ae6
parent 237
10a6298f636f
child 241
c4e2afabcb90
equal deleted inserted replaced
239:74ce5ac84f25 240:414d392b9ae6
362 ui.setupUi(&mainWindow); 362 ui.setupUi(&mainWindow);
363 const uiutilities::KeySequenceMap defaultKeyboardShortcuts = 363 const uiutilities::KeySequenceMap defaultKeyboardShortcuts =
364 uiutilities::makeKeySequenceMap(uiutilities::collectActions(&mainWindow)); 364 uiutilities::makeKeySequenceMap(uiutilities::collectActions(&mainWindow));
365 const auto saveSettings = [&]{ 365 const auto saveSettings = [&]{
366 setSetting<Setting::MainWindowGeometry>(mainWindow.saveGeometry()); 366 setSetting<Setting::MainWindowGeometry>(mainWindow.saveGeometry());
367 setSetting<Setting::MainWindowState>(mainWindow.saveState());
367 setSetting<Setting::RecentFiles>(recentlyOpenedFiles); 368 setSetting<Setting::RecentFiles>(recentlyOpenedFiles);
368 setSetting<Setting::RenderStyle>(renderPreferences.style); 369 setSetting<Setting::RenderStyle>(renderPreferences.style);
369 setSetting<Setting::DrawAxes>(renderPreferences.drawAxes); 370 setSetting<Setting::DrawAxes>(renderPreferences.drawAxes);
370 setSetting<Setting::Wireframe>(renderPreferences.wireframe); 371 setSetting<Setting::Wireframe>(renderPreferences.wireframe);
371 libraries.storeToSettings(); 372 libraries.storeToSettings();
642 if (ui.messageLog->property("shouldAutoScroll").toBool()) { 643 if (ui.messageLog->property("shouldAutoScroll").toBool()) {
643 ui.messageLog->scrollToBottom(); 644 ui.messageLog->scrollToBottom();
644 } 645 }
645 }); 646 });
646 mainWindow.setWindowTitle(title()); 647 mainWindow.setWindowTitle(title());
648 mainWindow.tabifyDockWidget(ui.messageLogDock, ui.toolOptionsDock);
647 mainWindow.restoreGeometry(setting<Setting::MainWindowGeometry>()); 649 mainWindow.restoreGeometry(setting<Setting::MainWindowGeometry>());
650 mainWindow.restoreState(setting<Setting::MainWindowState>());
651 // If a dock is made floating and the app is closed, the dock becomes invisible
652 // after the restoreState call. So we make them visible again shere.
653 for (QDockWidget* dock : mainWindow.findChildren<QDockWidget*>()) {
654 dock->setVisible(true);
655 }
648 restoreSettings(); 656 restoreSettings();
649 updateRenderPreferences(&ui, &renderPreferences, &documents); 657 updateRenderPreferences(&ui, &renderPreferences, &documents);
650 mainWindow.show(); 658 mainWindow.show();
651 const int result = app.exec(); 659 const int result = app.exec();
652 saveSettings(); 660 saveSettings();

mercurial