mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-10-27 11:00:32 -04:00 
			
		
		
		
	Only delete last .wav file on exit if it is not to be saved
Also enhanced delete .wav files menu entry to delete .c2 files as well. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5672 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
		
							parent
							
								
									c739bb88e8
								
							
						
					
					
						commit
						97509cbea0
					
				| @ -823,6 +823,7 @@ void MainWindow::dataSink(qint64 frames) | |||||||
|       imin=imin - (imin%(m_TRperiod/60)); |       imin=imin - (imin%(m_TRperiod/60)); | ||||||
|       QString t2; |       QString t2; | ||||||
|       t2.sprintf("%2.2d%2.2d",ihr,imin); |       t2.sprintf("%2.2d%2.2d",ihr,imin); | ||||||
|  |       m_fileToSave.clear (); | ||||||
|       m_fname=m_config.save_directory ().absoluteFilePath (t.date().toString("yyMMdd") + |       m_fname=m_config.save_directory ().absoluteFilePath (t.date().toString("yyMMdd") + | ||||||
|                                                            "_" + t2 + ".wav"); |                                                            "_" + t2 + ".wav"); | ||||||
|       *future2 = QtConcurrent::run(savewav, m_fname, m_TRperiod); |       *future2 = QtConcurrent::run(savewav, m_fname, m_TRperiod); | ||||||
| @ -1236,7 +1237,7 @@ void MainWindow::closeEvent(QCloseEvent * e) | |||||||
|   m_shortcuts.reset (); |   m_shortcuts.reset (); | ||||||
|   m_mouseCmnds.reset (); |   m_mouseCmnds.reset (); | ||||||
| 
 | 
 | ||||||
|   if(m_fname != "") killFile(); |   killFile (); | ||||||
|   m_killAll=true; |   m_killAll=true; | ||||||
|   mem_jt9->detach(); |   mem_jt9->detach(); | ||||||
|   QFile quitFile {m_config.temp_dir ().absoluteFilePath (".quit")}; |   QFile quitFile {m_config.temp_dir ().absoluteFilePath (".quit")}; | ||||||
| @ -1393,20 +1394,13 @@ void MainWindow::diskWriteFinished()                       //diskWriteFinished | |||||||
| //Delete ../save/*.wav
 | //Delete ../save/*.wav
 | ||||||
| void MainWindow::on_actionDelete_all_wav_files_in_SaveDir_triggered() | void MainWindow::on_actionDelete_all_wav_files_in_SaveDir_triggered() | ||||||
| { | { | ||||||
|   int i; |   if (QMessageBox::Yes == QMessageBox::warning(this, "Confirm Delete", | ||||||
|   QString fname; |                                               "Are you sure you want to delete all *.wav and *.c2 files in\n" + | ||||||
|   int ret = QMessageBox::warning(this, "Confirm Delete", |  | ||||||
|                                  "Are you sure you want to delete all *.wav files in\n" + |  | ||||||
|                                               QDir::toNativeSeparators(m_config.save_directory ().absolutePath ()) + " ?", |                                               QDir::toNativeSeparators(m_config.save_directory ().absolutePath ()) + " ?", | ||||||
|                                  QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); |                                                QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)) { | ||||||
|   if(ret==QMessageBox::Yes) { |     Q_FOREACH (auto const& file | ||||||
|     QDir dir(m_config.save_directory ()); |                , m_config.save_directory ().entryList ({"*.wav", "*.c2"}, QDir::Files | QDir::Writable)) { | ||||||
|     QStringList files=dir.entryList(QDir::Files); |       m_config.save_directory ().remove (file); | ||||||
|     QList<QString>::iterator f; |  | ||||||
|     for(f=files.begin(); f!=files.end(); ++f) { |  | ||||||
|       fname=*f; |  | ||||||
|       i=(fname.indexOf(".wav")); |  | ||||||
|       if(i>10) dir.remove(fname); |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1583,8 +1577,7 @@ void MainWindow::readFromStdout()                             //readFromStdout | |||||||
|     if(m_mode=="JT4") t=t.mid(0,39) + t.mid(42,t.length()-42); |     if(m_mode=="JT4") t=t.mid(0,39) + t.mid(42,t.length()-42); | ||||||
|     if(t.indexOf("<DecodeFinished>") >= 0) { |     if(t.indexOf("<DecodeFinished>") >= 0) { | ||||||
|       m_bdecoded = (t.mid(23,1).toInt()==1); |       m_bdecoded = (t.mid(23,1).toInt()==1); | ||||||
|       bool keepFile=m_saveAll or (m_saveDecoded and m_bdecoded); |       if(!m_diskData) killFileTimer->start (45*1000); //Kill in 45 s
 | ||||||
|       if(!keepFile and !m_diskData) killFileTimer->start(45*1000); //Kill in 45 s
 |  | ||||||
|       jt9com_.nagain=0; |       jt9com_.nagain=0; | ||||||
|       jt9com_.ndiskdat=0; |       jt9com_.ndiskdat=0; | ||||||
|       m_nclearave=0; |       m_nclearave=0; | ||||||
| @ -1699,12 +1692,11 @@ void MainWindow::readFromStdout()                             //readFromStdout | |||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MainWindow::killFile() | void MainWindow::killFile () | ||||||
| { | { | ||||||
|   if(m_fname==m_fileToSave) { |   if (!m_fname.isEmpty () | ||||||
|   } else { |       && !(m_saveAll || (m_saveDecoded && m_bdecoded) || m_fname == m_fileToSave)) { | ||||||
|     QFile savedFile(m_fname); |     QFile {m_fname}.remove(); | ||||||
|     savedFile.remove(); |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -2407,7 +2407,7 @@ QPushButton[state="ok"] { | |||||||
|   </action> |   </action> | ||||||
|   <action name="actionDelete_all_wav_files_in_SaveDir"> |   <action name="actionDelete_all_wav_files_in_SaveDir"> | ||||||
|    <property name="text"> |    <property name="text"> | ||||||
|     <string>Delete all *.wav files in SaveDir</string> |     <string>Delete all *.wav && *.c2 files in SaveDir</string> | ||||||
|    </property> |    </property> | ||||||
|   </action> |   </action> | ||||||
|   <action name="actionQuickDecode"> |   <action name="actionQuickDecode"> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user