Make AssFile handle autosaving on every commit itself rather than going through FrameMain

Originally committed to SVN as r5247.
This commit is contained in:
Thomas Goyne 2011-01-20 05:57:23 +00:00
parent cecaff404b
commit a8ebc1e456
3 changed files with 6 additions and 11 deletions

View File

@ -800,6 +800,11 @@ int AssFile::Commit(wxString desc, CommitType type, int amendId) {
UndoStack.pop_front();
}
if (OPT_GET("App/Auto/Save on Every Change")->GetBool()) {
if (!filename.empty() && CanSave())
Save(filename);
}
AnnounceCommit(type);
return commitId;
}

View File

@ -126,7 +126,7 @@ FrameMain::FrameMain (wxArrayString args)
StartupLog("Initializing context models");
AssFile::top = context->ass = new AssFile;
context->ass->AddCommitListener(&FrameMain::OnSubtitlesCommit, this);
context->ass->AddCommitListener(&FrameMain::UpdateTitle, this);
context->ass->AddFileOpenListener(&FrameMain::OnSubtitlesOpen, this);
context->ass->AddFileSaveListener(&FrameMain::UpdateTitle, this);
@ -1135,15 +1135,6 @@ void FrameMain::OnAudioClose()
SetDisplayMode(-1, 0);
}
void FrameMain::OnSubtitlesCommit() {
if (OPT_GET("App/Auto/Save on Every Change")->GetBool()) {
if (context->ass->IsModified() && context->ass->CanSave())
(*cmd::get("subtitle/save"))(context.get());
}
UpdateTitle();
}
void FrameMain::OnSubtitlesOpen() {
UpdateTitle();

View File

@ -158,7 +158,6 @@ private:
void OnVideoOpen();
void OnSubtitlesCommit();
void OnSubtitlesOpen();
void OnSubtitlesSave();