Added TAS config parameter load/save logic for Qt GUI.

This commit is contained in:
mjbudd77 2021-12-23 13:29:48 -05:00
parent 4c7b8bf64c
commit 86e7f7a889
4 changed files with 170 additions and 1 deletions

View File

@ -182,6 +182,8 @@ TasEditorWindow::TasEditorWindow(QWidget *parent)
::branches = &this->branches;
::splicer = &this->splicer;
this->taseditorConfig.load();
clipboard = QGuiApplication::clipboard();
setWindowTitle("TAS Editor");
@ -236,6 +238,7 @@ TasEditorWindow::~TasEditorWindow(void)
//if (!askToSaveProject()) return false;
// destroy window
taseditorConfig.save();
//taseditorWindow.exit();
//disableGeneralKeyboardInput();
// release memory

View File

@ -16,6 +16,7 @@ Config - Current settings
* stores resources: default values of all settings, min/max values of settings
------------------------------------------------------------------------------------ */
#include "Qt/fceuWrapper.h"
#include "Qt/TasEditor/recorder.h"
#include "Qt/TasEditor/inputlog.h"
#include "Qt/TasEditor/taseditor_config.h"
@ -98,6 +99,116 @@ TASEDITOR_CONFIG::TASEDITOR_CONFIG(void)
}
void TASEDITOR_CONFIG::load(void)
{
std::string s;
g_config->getOption("SDL.TasAutoSaveEnabled" , &autosaveEnabled );
g_config->getOption("SDL.TasAutoSavePeriod" , &autosavePeriod );
g_config->getOption("SDL.TasAutoSaveSilent" , &autosaveSilent );
g_config->getOption("SDL.TasTooltipsEnabled" , &tooltipsEnabled );
g_config->getOption("SDL.TasCurrentPattern" , &currentPattern );
g_config->getOption("SDL.TasFollowPlaybackCursor" , &followPlaybackCursor );
g_config->getOption("SDL.TasTurboSeek" , &turboSeek );
g_config->getOption("SDL.TasAutoRestoreLastPlaybackPosition" , &autoRestoreLastPlaybackPosition );
g_config->getOption("SDL.TasSuperImpose" , &superimpose );
g_config->getOption("SDL.TasRecordingUsePattern" , &recordingUsePattern );
g_config->getOption("SDL.TasEnableLuaAutoFunction" , &enableLuaAutoFunction );
g_config->getOption("SDL.TasDisplayBranchesTree" , &displayBranchesTree );
g_config->getOption("SDL.TasDisplayBranchScreenshots" , &displayBranchScreenshots );
g_config->getOption("SDL.TasDisplayBranchDescriptions" , &displayBranchDescriptions );
g_config->getOption("SDL.TasEnableHotChanges" , &enableHotChanges );
g_config->getOption("SDL.TasFollowUndoContext" , &followUndoContext );
g_config->getOption("SDL.TasFollowMarkerNoteContext" , &followMarkerNoteContext );
g_config->getOption("SDL.TasGreenzoneCapacity" , &greenzoneCapacity );
g_config->getOption("SDL.TasMaxUndoLevels" , &maxUndoLevels );
g_config->getOption("SDL.TasEnableGreenzoning" , &enableGreenzoning );
g_config->getOption("SDL.TasAutofirePatternSkipsLag" , &autofirePatternSkipsLag );
g_config->getOption("SDL.TasAutoAdjustInputAccordingToLag" , &autoAdjustInputAccordingToLag );
g_config->getOption("SDL.TasDrawInputByDragging" , &drawInputByDragging );
g_config->getOption("SDL.TasCombineConsecutiveRecordingsAndDraws" , &combineConsecutiveRecordingsAndDraws );
g_config->getOption("SDL.TasUse1PKeysForAllSingleRecordings" , &use1PKeysForAllSingleRecordings );
g_config->getOption("SDL.TasUseInputKeysForColumnSet" , &useInputKeysForColumnSet );
g_config->getOption("SDL.TasBindMarkersToInput" , &bindMarkersToInput );
g_config->getOption("SDL.TasEmptyNewMarkerNotes" , &emptyNewMarkerNotes );
g_config->getOption("SDL.TasOldControlSchemeForBranching" , &oldControlSchemeForBranching );
g_config->getOption("SDL.TasBranchesRestoreEntireMovie" , &branchesRestoreEntireMovie );
g_config->getOption("SDL.TasHUDInBranchScreenshots" , &HUDInBranchScreenshots );
g_config->getOption("SDL.TasAutopauseAtTheEndOfMovie" , &autopauseAtTheEndOfMovie );
g_config->getOption("SDL.TasLastExportedInputType" , &lastExportedInputType );
g_config->getOption("SDL.TasLastExportedSubtitlesStatus" , &lastExportedSubtitlesStatus );
g_config->getOption("SDL.TasProjectSavingOptions_SaveInBinary" , &projectSavingOptions_SaveInBinary );
g_config->getOption("SDL.TasProjectSavingOptions_SaveMarkers" , &projectSavingOptions_SaveMarkers );
g_config->getOption("SDL.TasProjectSavingOptions_SaveBookmarks" , &projectSavingOptions_SaveBookmarks );
g_config->getOption("SDL.TasProjectSavingOptions_SaveHistory" , &projectSavingOptions_SaveHistory );
g_config->getOption("SDL.TasProjectSavingOptions_SavePianoRoll" , &projectSavingOptions_SavePianoRoll );
g_config->getOption("SDL.TasProjectSavingOptions_SaveSelection" , &projectSavingOptions_SaveSelection );
g_config->getOption("SDL.TasProjectSavingOptions_GreenzoneSavingMode", &projectSavingOptions_GreenzoneSavingMode );
g_config->getOption("SDL.TasSaveCompact_SaveInBinary" , &saveCompact_SaveInBinary );
g_config->getOption("SDL.TasSaveCompact_SaveMarkers" , &saveCompact_SaveMarkers );
g_config->getOption("SDL.TasSaveCompact_SaveBookmarks" , &saveCompact_SaveBookmarks );
g_config->getOption("SDL.TasSaveCompact_SaveHistory" , &saveCompact_SaveHistory );
g_config->getOption("SDL.TasSaveCompact_SavePianoRoll" , &saveCompact_SavePianoRoll );
g_config->getOption("SDL.TasSaveCompact_SaveSelection" , &saveCompact_SaveSelection );
g_config->getOption("SDL.TasSaveCompact_GreenzoneSavingMode" , &saveCompact_GreenzoneSavingMode );
g_config->getOption("SDL.TasLastAuthorName" , &s);
strncpy( lastAuthorName, s.c_str(), AUTHOR_NAME_MAX_LEN );
lastAuthorName[AUTHOR_NAME_MAX_LEN-1] = 0;
}
void TASEDITOR_CONFIG::save(void)
{
g_config->setOption("SDL.TasAutoSaveEnabled" , autosaveEnabled );
g_config->setOption("SDL.TasAutoSavePeriod" , autosavePeriod );
g_config->setOption("SDL.TasAutoSaveSilent" , autosaveSilent );
g_config->setOption("SDL.TasTooltipsEnabled" , tooltipsEnabled );
g_config->setOption("SDL.TasCurrentPattern" , currentPattern );
g_config->setOption("SDL.TasFollowPlaybackCursor" , followPlaybackCursor );
g_config->setOption("SDL.TasTurboSeek" , turboSeek );
g_config->setOption("SDL.TasAutoRestoreLastPlaybackPosition" , autoRestoreLastPlaybackPosition );
g_config->setOption("SDL.TasSuperImpose" , superimpose );
g_config->setOption("SDL.TasRecordingUsePattern" , recordingUsePattern );
g_config->setOption("SDL.TasEnableLuaAutoFunction" , enableLuaAutoFunction );
g_config->setOption("SDL.TasDisplayBranchesTree" , displayBranchesTree );
g_config->setOption("SDL.TasDisplayBranchScreenshots" , displayBranchScreenshots );
g_config->setOption("SDL.TasDisplayBranchDescriptions" , displayBranchDescriptions );
g_config->setOption("SDL.TasEnableHotChanges" , enableHotChanges );
g_config->setOption("SDL.TasFollowUndoContext" , followUndoContext );
g_config->setOption("SDL.TasFollowMarkerNoteContext" , followMarkerNoteContext );
g_config->setOption("SDL.TasGreenzoneCapacity" , greenzoneCapacity );
g_config->setOption("SDL.TasMaxUndoLevels" , maxUndoLevels );
g_config->setOption("SDL.TasEnableGreenzoning" , enableGreenzoning );
g_config->setOption("SDL.TasAutofirePatternSkipsLag" , autofirePatternSkipsLag );
g_config->setOption("SDL.TasAutoAdjustInputAccordingToLag" , autoAdjustInputAccordingToLag );
g_config->setOption("SDL.TasDrawInputByDragging" , drawInputByDragging );
g_config->setOption("SDL.TasCombineConsecutiveRecordingsAndDraws" , combineConsecutiveRecordingsAndDraws );
g_config->setOption("SDL.TasUse1PKeysForAllSingleRecordings" , use1PKeysForAllSingleRecordings );
g_config->setOption("SDL.TasUseInputKeysForColumnSet" , useInputKeysForColumnSet );
g_config->setOption("SDL.TasBindMarkersToInput" , bindMarkersToInput );
g_config->setOption("SDL.TasEmptyNewMarkerNotes" , emptyNewMarkerNotes );
g_config->setOption("SDL.TasOldControlSchemeForBranching" , oldControlSchemeForBranching );
g_config->setOption("SDL.TasBranchesRestoreEntireMovie" , branchesRestoreEntireMovie );
g_config->setOption("SDL.TasHUDInBranchScreenshots" , HUDInBranchScreenshots );
g_config->setOption("SDL.TasAutopauseAtTheEndOfMovie" , autopauseAtTheEndOfMovie );
g_config->setOption("SDL.TasLastExportedInputType" , lastExportedInputType );
g_config->setOption("SDL.TasLastExportedSubtitlesStatus" , lastExportedSubtitlesStatus );
g_config->setOption("SDL.TasProjectSavingOptions_SaveInBinary" , projectSavingOptions_SaveInBinary );
g_config->setOption("SDL.TasProjectSavingOptions_SaveMarkers" , projectSavingOptions_SaveMarkers );
g_config->setOption("SDL.TasProjectSavingOptions_SaveBookmarks" , projectSavingOptions_SaveBookmarks );
g_config->setOption("SDL.TasProjectSavingOptions_SaveHistory" , projectSavingOptions_SaveHistory );
g_config->setOption("SDL.TasProjectSavingOptions_SavePianoRoll" , projectSavingOptions_SavePianoRoll );
g_config->setOption("SDL.TasProjectSavingOptions_SaveSelection" , projectSavingOptions_SaveSelection );
g_config->setOption("SDL.TasProjectSavingOptions_GreenzoneSavingMode", projectSavingOptions_GreenzoneSavingMode );
g_config->setOption("SDL.TasSaveCompact_SaveInBinary" , saveCompact_SaveInBinary );
g_config->setOption("SDL.TasSaveCompact_SaveMarkers" , saveCompact_SaveMarkers );
g_config->setOption("SDL.TasSaveCompact_SaveBookmarks" , saveCompact_SaveBookmarks );
g_config->setOption("SDL.TasSaveCompact_SaveHistory" , saveCompact_SaveHistory );
g_config->setOption("SDL.TasSaveCompact_SavePianoRoll" , saveCompact_SavePianoRoll );
g_config->setOption("SDL.TasSaveCompact_SaveSelection" , saveCompact_SaveSelection );
g_config->setOption("SDL.TasSaveCompact_GreenzoneSavingMode" , saveCompact_GreenzoneSavingMode );
g_config->setOption("SDL.TasLastAuthorName" , lastAuthorName);
g_config->save();
}

View File

@ -31,6 +31,9 @@ class TASEDITOR_CONFIG
public:
TASEDITOR_CONFIG(void);
void load(void);
void save(void);
// vars saved in fceux.cfg file
int windowX;
int windowY;

View File

@ -34,6 +34,7 @@
#include "Qt/sdl-video.h"
#include "Qt/AviRecord.h"
#include "Qt/unix-netplay.h"
#include "Qt/TasEditor/taseditor_config.h"
#ifdef WIN32
#include <windows.h>
@ -468,6 +469,7 @@ GetBaseDirectory(std::string &dir)
Config *
InitConfig()
{
TASEDITOR_CONFIG tasCfg;
std::string dir, prefix, savPath, movPath;
Config *config;
@ -759,6 +761,56 @@ InitConfig()
config->addOption("SDL.TasBookmarksFont", "");
config->addOption("SDL.TasBranchesFont" , "");
config->addOption("SDL.TasAutoSaveEnabled" , tasCfg.autosaveEnabled );
config->addOption("SDL.TasAutoSavePeriod" , tasCfg.autosavePeriod );
config->addOption("SDL.TasAutoSaveSilent" , tasCfg.autosaveSilent );
config->addOption("SDL.TasTooltipsEnabled" , tasCfg.tooltipsEnabled );
config->addOption("SDL.TasCurrentPattern" , tasCfg.currentPattern );
config->addOption("SDL.TasFollowPlaybackCursor" , tasCfg.followPlaybackCursor );
config->addOption("SDL.TasTurboSeek" , tasCfg.turboSeek );
config->addOption("SDL.TasAutoRestoreLastPlaybackPosition" , tasCfg.autoRestoreLastPlaybackPosition );
config->addOption("SDL.TasSuperImpose" , tasCfg.superimpose );
config->addOption("SDL.TasRecordingUsePattern" , tasCfg.recordingUsePattern );
config->addOption("SDL.TasEnableLuaAutoFunction" , tasCfg.enableLuaAutoFunction );
config->addOption("SDL.TasDisplayBranchesTree" , tasCfg.displayBranchesTree );
config->addOption("SDL.TasDisplayBranchScreenshots" , tasCfg.displayBranchScreenshots );
config->addOption("SDL.TasDisplayBranchDescriptions" , tasCfg.displayBranchDescriptions );
config->addOption("SDL.TasEnableHotChanges" , tasCfg.enableHotChanges );
config->addOption("SDL.TasFollowUndoContext" , tasCfg.followUndoContext );
config->addOption("SDL.TasFollowMarkerNoteContext" , tasCfg.followMarkerNoteContext );
config->addOption("SDL.TasGreenzoneCapacity" , tasCfg.greenzoneCapacity );
config->addOption("SDL.TasMaxUndoLevels" , tasCfg.maxUndoLevels );
config->addOption("SDL.TasEnableGreenzoning" , tasCfg.enableGreenzoning );
config->addOption("SDL.TasAutofirePatternSkipsLag" , tasCfg.autofirePatternSkipsLag );
config->addOption("SDL.TasAutoAdjustInputAccordingToLag" , tasCfg.autoAdjustInputAccordingToLag );
config->addOption("SDL.TasDrawInputByDragging" , tasCfg.drawInputByDragging );
config->addOption("SDL.TasCombineConsecutiveRecordingsAndDraws" , tasCfg.combineConsecutiveRecordingsAndDraws );
config->addOption("SDL.TasUse1PKeysForAllSingleRecordings" , tasCfg.use1PKeysForAllSingleRecordings );
config->addOption("SDL.TasUseInputKeysForColumnSet" , tasCfg.useInputKeysForColumnSet );
config->addOption("SDL.TasBindMarkersToInput" , tasCfg.bindMarkersToInput );
config->addOption("SDL.TasEmptyNewMarkerNotes" , tasCfg.emptyNewMarkerNotes );
config->addOption("SDL.TasOldControlSchemeForBranching" , tasCfg.oldControlSchemeForBranching );
config->addOption("SDL.TasBranchesRestoreEntireMovie" , tasCfg.branchesRestoreEntireMovie );
config->addOption("SDL.TasHUDInBranchScreenshots" , tasCfg.HUDInBranchScreenshots );
config->addOption("SDL.TasAutopauseAtTheEndOfMovie" , tasCfg.autopauseAtTheEndOfMovie );
config->addOption("SDL.TasLastExportedInputType" , tasCfg.lastExportedInputType );
config->addOption("SDL.TasLastExportedSubtitlesStatus" , tasCfg.lastExportedSubtitlesStatus );
config->addOption("SDL.TasProjectSavingOptions_SaveInBinary" , tasCfg.projectSavingOptions_SaveInBinary );
config->addOption("SDL.TasProjectSavingOptions_SaveMarkers" , tasCfg.projectSavingOptions_SaveMarkers );
config->addOption("SDL.TasProjectSavingOptions_SaveBookmarks" , tasCfg.projectSavingOptions_SaveBookmarks );
config->addOption("SDL.TasProjectSavingOptions_SaveHistory" , tasCfg.projectSavingOptions_SaveHistory );
config->addOption("SDL.TasProjectSavingOptions_SavePianoRoll" , tasCfg.projectSavingOptions_SavePianoRoll );
config->addOption("SDL.TasProjectSavingOptions_SaveSelection" , tasCfg.projectSavingOptions_SaveSelection );
config->addOption("SDL.TasProjectSavingOptions_GreenzoneSavingMode", tasCfg.projectSavingOptions_GreenzoneSavingMode );
config->addOption("SDL.TasSaveCompact_SaveInBinary" , tasCfg.saveCompact_SaveInBinary );
config->addOption("SDL.TasSaveCompact_SaveMarkers" , tasCfg.saveCompact_SaveMarkers );
config->addOption("SDL.TasSaveCompact_SaveBookmarks" , tasCfg.saveCompact_SaveBookmarks );
config->addOption("SDL.TasSaveCompact_SaveHistory" , tasCfg.saveCompact_SaveHistory );
config->addOption("SDL.TasSaveCompact_SavePianoRoll" , tasCfg.saveCompact_SavePianoRoll );
config->addOption("SDL.TasSaveCompact_SaveSelection" , tasCfg.saveCompact_SaveSelection );
config->addOption("SDL.TasSaveCompact_GreenzoneSavingMode" , tasCfg.saveCompact_GreenzoneSavingMode );
config->addOption("SDL.TasLastAuthorName" , "");
config->addOption("_useNativeFileDialog", "SDL.UseNativeFileDialog", false);
config->addOption("_useNativeMenuBar" , "SDL.UseNativeMenuBar", false);
config->addOption("SDL.PauseOnMainMenuAccess", false);