config.dat can optionally be stored on the same folder as aegisub.exe.

Originally committed to SVN as r1280.
This commit is contained in:
Rodrigo Braz Monteiro 2007-06-21 06:14:49 +00:00
parent 1db207ea29
commit 24d941b2bc
4 changed files with 22 additions and 15 deletions

View File

@ -119,6 +119,8 @@ Please visit http://aegisub.net to download latest version
o Fixed behavior of the Escape key in it. (AMZ)
o Redesigned the interface and replaced the log window with a much better Scintilla control. (AMZ)
o You can now collect multiple times without reopening the dialog. (AMZ)
- All user-specific files (configuration, style storages, etc) are now stored on Application Data\Aegisub in Windows. (AMZ)
- config.dat can optionally be stored on the same folder as aegisub.exe. (AMZ)
- Added a much-needed options dialog with all the relevant config.dat options in it. (AMZ)
- Various fixes to better handle paths/file names with non-ANSI characters on Windows (jfs/AMZ)
- Misc. fixes for building on Linux (Azzy, equinox, jfs)

View File

@ -45,6 +45,7 @@
#include "options.h"
#include <wx/spinctrl.h>
#include <wx/stdpaths.h>
#include <wx/filefn.h>
#include "frame_main.h"
#include "standard_paths.h"
#include "validators.h"
@ -97,15 +98,12 @@ DialogOptions::DialogOptions(wxWindow *parent)
wxSizer *genMainSizer = new wxBoxSizer(wxVERTICAL);
wxSizer *genSizer1 = new wxStaticBoxSizer(wxHORIZONTAL,generalPage,_("Startup"));
wxSizer *genSizer4 = new wxFlexGridSizer(2,2,5,5);
wxCheckBox *box = new wxCheckBox(generalPage,-1,_("Show Splash Screen"));
Bind(box,_T("Show splash"));
genSizer4->Add(box,1,wxALL,0);
box = new wxCheckBox(generalPage,-1,_("Show Tip of the Day"));
Bind(box,_T("Tips enabled"));
genSizer4->Add(box,1,wxALL,0);
box = new wxCheckBox(generalPage,-1,_("Auto Check for Updates"));
Bind(box,_T("Auto check for updates"));
genSizer4->Add(box,1,wxALL,0);
AddCheckBox(generalPage,genSizer4,_("Show Splash Screen"),_T("Show splash"));
AddCheckBox(generalPage,genSizer4,_("Show Tip of the Day"),_T("Tips enabled"));
AddCheckBox(generalPage,genSizer4,_("Auto Check for Updates"),_T("Auto check for updates"));
AddCheckBox(generalPage,genSizer4,_("Save config.dat locally"),_T("Local config"));
genSizer1->Add(genSizer4,1,wxEXPAND|wxALL,5);
wxSizer *genSizer2 = new wxStaticBoxSizer(wxVERTICAL,generalPage,_("Limits for levels and recent files"));
wxFlexGridSizer *genSizer3 = new wxFlexGridSizer(8,2,5,5);
@ -869,6 +867,11 @@ void DialogOptions::WriteToOptions(bool justApply) {
}
// Save options
if (Options.AsBool(_T("Local config"))) Options.SetFile(StandardPaths::DecodePath(_T("?data/config.dat")));
else {
Options.SetFile(StandardPaths::DecodePath(_T("?user/config.dat")));
wxRemoveFile(StandardPaths::DecodePath(_T("?data/config.dat")));
}
Options.Save();
// Need restart?

View File

@ -87,8 +87,13 @@ bool AegisubApp::OnInit() {
#endif
// Set config file
Options.SetFile(StandardPaths::DecodePath(_T("?data/config.dat")));
Options.Load();
if (!Options.AsBool(_T("Local config"))) {
Options.SetFile(StandardPaths::DecodePath(_T("?user/config.dat")));
Options.Load();
}
Options.Save();
AssTime::UseMSPrecision = Options.AsBool(_T("Use nonstandard Milisecond Times"));
// Set hotkeys file

View File

@ -80,6 +80,7 @@ void OptionsManager::LoadDefaults(bool onlyDefaults) {
SetModificationType(MOD_AUTOMATIC);
SetBool(_T("Tips enabled"),true);
SetBool(_T("Show splash"),true);
SetBool(_T("Local config"),false);
SetInt(_T("Undo levels"),8);
SetInt(_T("Recent timecodes max"),16);
SetInt(_T("Recent keyframes max"),16);
@ -394,11 +395,10 @@ void OptionsManager::Load() {
// Load defaults
LoadDefaults();
// Check if file exists (create if it doesn't)
// Check if file exists
wxFileName path(filename);
if (!path.FileExists()) {
modified = true;
Save();
return;
}
@ -426,9 +426,6 @@ void OptionsManager::Load() {
}
else SetText(key,value);
}
// Close
Save();
}