| 153 | } |
| 154 | |
| 155 | void App::saveAllProcess() { |
| 156 | if ( mTmpDocs.empty() ) |
| 157 | return; |
| 158 | |
| 159 | mSplitter->forEachEditorStoppable( [this]( UICodeEditor* editor ) { |
| 160 | if ( editor->getDocument().isDirty() && |
| 161 | std::find( mTmpDocs.begin(), mTmpDocs.end(), &editor->getDocument() ) != |
| 162 | mTmpDocs.end() ) { |
| 163 | if ( editor->getDocument().hasFilepath() ) { |
| 164 | editor->save(); |
| 165 | updateEditorTabTitle( editor ); |
| 166 | if ( mSplitter->getCurEditor() == editor ) |
| 167 | updateEditorTitle( editor ); |
| 168 | mTmpDocs.erase( &editor->getDocument() ); |
| 169 | } else { |
| 170 | UIFileDialog* dialog = saveFileDialog( editor, false ); |
| 171 | dialog->on( Event::SaveFile, [this, editor]( const Event* ) { |
| 172 | updateEditorTabTitle( editor ); |
| 173 | if ( mSplitter->getCurEditor() == editor ) |
| 174 | updateEditorTitle( editor ); |
| 175 | } ); |
| 176 | dialog->on( Event::OnWindowClose, [this, editor]( const Event* ) { |
| 177 | mTmpDocs.erase( &editor->getDocument() ); |
| 178 | if ( App::instance() && !SceneManager::instance()->isShuttingDown() && |
| 179 | !mTmpDocs.empty() ) |
| 180 | saveAllProcess(); |
| 181 | } ); |
| 182 | return true; |
| 183 | } |
| 184 | } |
| 185 | return false; |
| 186 | } ); |
| 187 | } |
| 188 | |
| 189 | void App::saveAll() { |
| 190 | mTmpDocs.clear(); |
nothing calls this directly
no test coverage detected