Wed, 04 Apr 2018 11:22:47 +0300
refactor
src/mainwindow.cpp | file | annotate | diff | comparison | revisions |
--- a/src/mainwindow.cpp Wed Apr 04 11:19:49 2018 +0300 +++ b/src/mainwindow.cpp Wed Apr 04 11:22:47 2018 +0300 @@ -896,21 +896,23 @@ } } -// --------------------------------------------------------------------------------------------------------------------- -// +/* + * Returns the currently open document. + */ LDDocument* MainWindow::currentDocument() { return m_currentDocument; } -// --------------------------------------------------------------------------------------------------------------------- -// -// TODO: document may be null, this shouldn't be the case -// -void MainWindow::changeDocument (LDDocument* document) +/* + * Changes the current document to the specified document. + */ +void MainWindow::changeDocument(LDDocument* document) { + Q_ASSERT(document != nullptr); + // Implicit files were loaded for caching purposes and may never be switched to. - if (document and document->isFrozen()) + if (document->isFrozen()) return; m_currentDocument = document;