mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Prompt for save in ocr window if any changes are made (even just one char)
This commit is contained in:
parent
11b86412c3
commit
d29ccb5d38
@ -328,7 +328,6 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
private int _tesseractAsyncIndex;
|
||||
private int _tesseractEngineMode;
|
||||
|
||||
private readonly DateTime _windowStartTime = DateTime.Now;
|
||||
private int _linesOcred;
|
||||
private bool _okClicked;
|
||||
private readonly Dictionary<string, int> _unknownWordsDictionary;
|
||||
@ -8059,26 +8058,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
|
||||
private bool HasChangesBeenMade()
|
||||
{
|
||||
var secondsSinceOcrWindowOpened = DateTime.Now.Subtract(_windowStartTime).TotalSeconds;
|
||||
if (_subtitle != null && _subtitle.Paragraphs.Count > 10 && secondsSinceOcrWindowOpened > 10)
|
||||
{
|
||||
int numberOfLinesWithText = 0;
|
||||
foreach (var p in _subtitle.Paragraphs)
|
||||
{
|
||||
if (p != null && !string.IsNullOrWhiteSpace(p.Text))
|
||||
{
|
||||
numberOfLinesWithText++;
|
||||
}
|
||||
}
|
||||
|
||||
// ocr'ed more than 10 lines - or perhaps manually translated more than 10 lines in at least 30 seconds
|
||||
if (_linesOcred > 10 || numberOfLinesWithText > 10 && secondsSinceOcrWindowOpened > 30)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return _subtitle != null && _subtitle.Paragraphs.Any(p => !string.IsNullOrWhiteSpace(p.Text));
|
||||
}
|
||||
|
||||
private void VobSubOcr_FormClosing(object sender, FormClosingEventArgs e)
|
||||
|
Loading…
Reference in New Issue
Block a user