Added TAS window caption logic for Qt GUI.

This commit is contained in:
mjbudd77 2021-12-04 07:52:12 -05:00
parent eb335f227d
commit d124808c1b
4 changed files with 34 additions and 10 deletions

View File

@ -1412,14 +1412,13 @@ bool TasEditorWindow::loadProject(const char* fullname)
applyMovieInputConfig();
// add new file to Recent menu
addRecentProject( fullname );
//taseditorWindow.updateRecentProjectsArray(fullname);
//taseditorWindow.updateCaption();
updateCaption();
update();
success = true;
} else
{
// failed to load
//taseditorWindow.updateCaption();
updateCaption();
update();
}
fceuWrapperUnLock();
@ -1435,7 +1434,8 @@ bool TasEditorWindow::saveProject(bool save_compact)
if (project.getProjectFile().empty())
{
ret = saveProjectAs(save_compact);
} else
}
else
{
if (save_compact)
{
@ -1445,7 +1445,7 @@ bool TasEditorWindow::saveProject(bool save_compact)
{
project.save(0, taseditorConfig.projectSavingOptions_SaveInBinary, taseditorConfig.projectSavingOptions_SaveMarkers, taseditorConfig.projectSavingOptions_SaveBookmarks, taseditorConfig.projectSavingOptions_GreenzoneSavingMode, taseditorConfig.projectSavingOptions_SaveHistory, taseditorConfig.projectSavingOptions_SavePianoRoll, taseditorConfig.projectSavingOptions_SaveSelection);
}
//taseditorWindow.updateCaption();
updateCaption();
}
fceuWrapperUnLock();
@ -1548,9 +1548,8 @@ bool TasEditorWindow::saveProjectAs(bool save_compact)
project.save( filename.toStdString().c_str(), taseditorConfig.projectSavingOptions_SaveInBinary, taseditorConfig.projectSavingOptions_SaveMarkers, taseditorConfig.projectSavingOptions_SaveBookmarks, taseditorConfig.projectSavingOptions_GreenzoneSavingMode, taseditorConfig.projectSavingOptions_SaveHistory, taseditorConfig.projectSavingOptions_SavePianoRoll, taseditorConfig.projectSavingOptions_SaveSelection);
}
addRecentProject( filename.toStdString().c_str() );
//taseditorWindow.updateRecentProjectsArray(nameo);
// saved successfully - remove * mark from caption
//taseditorWindow.updateCaption();
updateCaption();
return true;
}
@ -1823,7 +1822,7 @@ void TasEditorWindow::createNewProject(void)
recorder.reset();
//popupDisplay.reset();
//taseditorWindow.redraw();
//taseditorWindow.updateCaption();
updateCaption();
update();
}
fceuWrapperUnLock();
@ -2064,6 +2063,30 @@ void TasEditorWindow::exportMovieFile(void)
}
//----------------------------------------------------------------------------
void TasEditorWindow::updateCaption(void)
{
char newCaption[300];
strcpy(newCaption, "TAS Editor");
if (!movie_readonly)
{
strcat(newCaption, recorder.getRecordingCaption());
}
// add project name
std::string projectname = project.getProjectName();
if (!projectname.empty())
{
strcat(newCaption, " - ");
strcat(newCaption, projectname.c_str());
}
// and * if project has unsaved changes
if (project.getProjectChanged())
{
strcat(newCaption, "*");
}
setWindowTitle( tr(newCaption) );
//SetWindowText(hwndTASEditor, newCaption);
}
//----------------------------------------------------------------------------
void TasEditorWindow::clearProjectList(void)
{
std::list <std::string*>::iterator it;

View File

@ -310,6 +310,7 @@ class TasEditorWindow : public QDialog
HISTORY history;
BRANCHES branches;
void updateCaption(void);
bool loadProject(const char* fullname);
void loadClipboard(const char *txt);
void toggleInput(int start, int end, int joy, int button, int consecutivenessTag);

View File

@ -116,7 +116,7 @@ void RECORDER::update()
// update window caption if needed
if (oldStateOfMovieReadonly != movie_readonly || oldMultitrackRecordingJoypadNumber != multitrackRecordingJoypadNumber)
{
//taseditorWindow.updateCaption();
tasWin->updateCaption();
}
// update Bookmarks/Branches groupbox caption if needed
if (taseditorConfig->oldControlSchemeForBranching && oldStateOfMovieReadonly != movie_readonly)

View File

@ -382,7 +382,7 @@ void TASEDITOR_PROJECT::setProjectChanged()
if (!changed)
{
changed = true;
//taseditorWindow.updateCaption();
tasWin->updateCaption();
sheduleNextAutosave();
}
}