mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-10 19:35:10 -05:00
Added some settings.
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@381 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
4a0e4dde3b
commit
96b83db57d
@ -8,6 +8,9 @@ uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
ComCtrls, settings;
|
||||
|
||||
const
|
||||
SimbaSettingsFile = 'settings.xml';
|
||||
|
||||
type
|
||||
|
||||
{ TSettingsForm }
|
||||
|
@ -39,7 +39,7 @@ uses
|
||||
SynExportHTML,
|
||||
SynEditKeyCmds, SynEditHighlighter, SynEditMarkupSpecialLine,SynEditMarkupHighAll,
|
||||
SynEditMiscClasses, LMessages, Buttons, PairSplitter,about, framefunctionlist,
|
||||
ocr, updateform;
|
||||
ocr, updateform, simbasettings;
|
||||
|
||||
type
|
||||
|
||||
@ -469,6 +469,9 @@ end;
|
||||
procedure TForm1.RunScript;
|
||||
var
|
||||
DbgImgInfo : TDbgImgInfo;
|
||||
fontPath: String;
|
||||
saveAfterSetting: Boolean = false;
|
||||
|
||||
begin
|
||||
with CurrScript do
|
||||
begin
|
||||
@ -513,7 +516,25 @@ begin
|
||||
if not assigned(Self.OCR_Fonts) then
|
||||
begin
|
||||
Self.OCR_Fonts :=TMOCR.Create(ScriptThread.Client);
|
||||
OCR_Fonts.InitTOCR(IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)) + 'Fonts' + DS);
|
||||
|
||||
if not SettingsForm.Settings.KeyExists('Settings/Fonts/Path') then
|
||||
saveAfterSetting := True;
|
||||
|
||||
fontPath := SettingsForm.Settings.GetSetDefaultKeyValue('Settings/Fonts/Path',
|
||||
IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)) + 'Fonts' + DS);
|
||||
|
||||
if saveAfterSetting then
|
||||
SettingsForm.Settings.SaveToXML('settings.xml');
|
||||
|
||||
if DirectoryExists(fontPath) then
|
||||
begin
|
||||
OCR_Fonts.InitTOCR(fontPath);
|
||||
end
|
||||
else
|
||||
begin
|
||||
writeln('Warning: The Font directory in the Settings is not valid. Changing to default.');
|
||||
OCR_Fonts.InitTOCR(IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)) + 'Fonts' + DS);
|
||||
end;
|
||||
end;
|
||||
ScriptThread.Client.MOCR.SetFonts(OCR_Fonts.GetFonts);
|
||||
|
||||
|
@ -57,7 +57,7 @@ var
|
||||
implementation
|
||||
|
||||
uses
|
||||
internets, TestUnit;
|
||||
internets, TestUnit, simbasettings;
|
||||
|
||||
function TSimbaUpdateForm.CanUpdate: Boolean;
|
||||
begin
|
||||
@ -68,11 +68,26 @@ begin
|
||||
end;
|
||||
|
||||
function TSimbaUpdateForm.GetLatestSimbaVersion: Integer;
|
||||
var
|
||||
saveAfterSetting: Boolean = false;
|
||||
begin
|
||||
if SimbaVersionThread = nil then//Create thread (only if no-other one is already running)
|
||||
begin
|
||||
SimbaVersionThread := TSimbaVersionThread.Create(true);
|
||||
SimbaVersionThread.InputURL:= 'http://old.villavu.com/merlijn/Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF} + '.version';
|
||||
|
||||
if not SettingsForm.Settings.KeyExists('Settings/Updater/RemoteVersionLink') then
|
||||
saveAfterSetting := true;
|
||||
|
||||
SimbaVersionThread.InputURL := SettingsForm.Settings.GetSetDefaultKeyValue(
|
||||
'Settings/Updater/RemoteVersionLink',
|
||||
'http://old.villavu.com/merlijn/Simba'{$IFDEF WINDOWS} +
|
||||
'.exe'{$ENDIF} + '.version');
|
||||
|
||||
if saveAfterSetting then
|
||||
SettingsForm.Settings.SaveToXML(SimbaSettingsFile);
|
||||
|
||||
|
||||
// SimbaVersionThread.InputURL:= 'http://old.villavu.com/merlijn/Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF} + '.version';
|
||||
SimbaVersionThread.Resume;
|
||||
while SimbaVersionThread.Done = false do//Wait till thread is done
|
||||
begin
|
||||
@ -136,6 +151,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TSimbaUpdateForm.PerformUpdate;
|
||||
var
|
||||
saveAfterSetting: Boolean = false;
|
||||
begin
|
||||
Updater := TMMLFileDownloader.Create;
|
||||
|
||||
@ -143,7 +160,17 @@ begin
|
||||
FCancelled := False;
|
||||
|
||||
// Make this a setting later
|
||||
Updater.FileURL := 'http://old.villavu.com/merlijn/Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF};
|
||||
|
||||
if not SettingsForm.Settings.KeyExists('Settings/Updater/RemoteLink') then
|
||||
saveAfterSetting := true;
|
||||
|
||||
Updater.FileURL := SettingsForm.Settings.GetSetDefaultKeyValue(
|
||||
'Settings/Updater/RemoteLink',
|
||||
'http://old.villavu.com/merlijn/Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF}
|
||||
);
|
||||
|
||||
if saveAfterSetting then
|
||||
SettingsForm.Settings.SaveToXML(SimbaSettingsFile);
|
||||
|
||||
//ApplicationName{$IFDEF WINDOWS} +'.exe'{$ENDIF};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user