| 470 | } |
| 471 | |
| 472 | MainWindow *NotepadNextApplication::createNewWindow() |
| 473 | { |
| 474 | Q_ASSERT(window == Q_NULLPTR); |
| 475 | |
| 476 | window = new MainWindow(this); |
| 477 | |
| 478 | // Keep Lua's editor reference up to date |
| 479 | connect(window, &MainWindow::editorActivated, this, [](ScintillaNext *editor) { |
| 480 | LuaExtension::Instance().setEditor(editor); |
| 481 | }); |
| 482 | |
| 483 | // TODO: this shouldn't be dependent on a MainWindow closing, but this works for now |
| 484 | // since the assumption is MainWindow::aboutToClose() infers the application is shutting |
| 485 | // down but the editors are still active. |
| 486 | connect(window, &MainWindow::aboutToClose, this, &NotepadNextApplication::saveSession); |
| 487 | |
| 488 | // Timer to autosave the session |
| 489 | connect(&autoSaveTimer, &QTimer::timeout, this, &NotepadNextApplication::saveSession); |
| 490 | autoSaveTimer.start(60 * 1000); |
| 491 | |
| 492 | return window; |
| 493 | } |
| 494 | |
| 495 | QStringList NotepadNextApplication::debugInfo() const |
| 496 | { |