From 2b35678018f03b456ad399b82b9e487ba78e15c4 Mon Sep 17 00:00:00 2001 From: gbamber Date: Thu, 15 Dec 2016 18:43:36 +0000 Subject: [PATCH] 0.2.6.0: Added feature - Help menu/AutoLoad Last File git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5507 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../json_packager/deploywin/json_packager.iss | 2 +- .../deploywin/locale/jsoneditor.en.po | 4 + .../deploywin/locale/jsoneditor.es.po | 5 +- applications/json_packager/jsonpackage.lpi | 3 +- applications/json_packager/jsonpackage.lps | 110 ++++++++++-------- applications/json_packager/jsonpackage.res | Bin 142552 -> 142736 bytes .../json_packager/locale/jsoneditor.en.po | 4 + .../json_packager/locale/jsoneditor.es.mo | Bin 8145 -> 8246 bytes .../json_packager/locale/jsoneditor.es.po | 5 +- .../json_packager/locale/jsoneditor.po | 4 + applications/json_packager/umain.lfm | 9 +- applications/json_packager/umain.lrj | 1 + applications/json_packager/umain.pas | 75 +++++++++--- 13 files changed, 147 insertions(+), 75 deletions(-) diff --git a/applications/json_packager/deploywin/json_packager.iss b/applications/json_packager/deploywin/json_packager.iss index c0aefd54a..0c3851e94 100644 --- a/applications/json_packager/deploywin/json_packager.iss +++ b/applications/json_packager/deploywin/json_packager.iss @@ -1,6 +1,6 @@ [Setup] AppName=External OPM JSON package Editor -AppVersion=0.2.5.0 +AppVersion=0.2.6.0 DefaultDirName={pf}\OPMUtilities DefaultGroupName=OPM UninstallDisplayIcon={app}\jsoneditor.exe diff --git a/applications/json_packager/deploywin/locale/jsoneditor.en.po b/applications/json_packager/deploywin/locale/jsoneditor.en.po index 502d4dc32..8b0514e38 100644 --- a/applications/json_packager/deploywin/locale/jsoneditor.en.po +++ b/applications/json_packager/deploywin/locale/jsoneditor.en.po @@ -144,6 +144,10 @@ msgstr "&Help" msgid "About.." msgstr "About.." +#: tfrmmain.mnu_helpautoloadlastfile.caption +msgid "Auto-load last saved file" +msgstr "" + #: tfrmmain.mnu_helpdisablewarnings.caption msgid "Disable warnings" msgstr "Disable warnings" diff --git a/applications/json_packager/deploywin/locale/jsoneditor.es.po b/applications/json_packager/deploywin/locale/jsoneditor.es.po index 9ff512124..c424a72d1 100644 --- a/applications/json_packager/deploywin/locale/jsoneditor.es.po +++ b/applications/json_packager/deploywin/locale/jsoneditor.es.po @@ -145,6 +145,10 @@ msgstr "&Ayuda" msgid "About.." msgstr "Acerca de.." +#: tfrmmain.mnu_helpautoloadlastfile.caption +msgid "Auto-load last saved file" +msgstr "Carga automática último archivo guardado" + #: tfrmmain.mnu_helpdisablewarnings.caption msgid "Disable warnings" msgstr "Deshabilitar advertencias" @@ -376,4 +380,3 @@ msgstr "¿Quieres copiar %s a la carpeta %s?" #: umain.rsyoumayneedto msgid "(You may need to restart the app to see the change)" msgstr "(Quizás necesites reiniciar la aplicación para ver los cambios)" - diff --git a/applications/json_packager/jsonpackage.lpi b/applications/json_packager/jsonpackage.lpi index 9e84862b8..cefc29554 100644 --- a/applications/json_packager/jsonpackage.lpi +++ b/applications/json_packager/jsonpackage.lpi @@ -28,8 +28,7 @@ - - + diff --git a/applications/json_packager/jsonpackage.lps b/applications/json_packager/jsonpackage.lps index dcbe310e3..8440695d1 100644 --- a/applications/json_packager/jsonpackage.lps +++ b/applications/json_packager/jsonpackage.lps @@ -3,14 +3,14 @@ - - + + - + - + @@ -20,8 +20,8 @@ - - + + @@ -29,11 +29,11 @@ - + - - - + + + @@ -41,7 +41,7 @@ - + @@ -49,7 +49,7 @@ - + @@ -155,9 +155,9 @@ - - - + + + @@ -352,20 +352,32 @@ - + - - + - + + + + + + + + + + + + + + @@ -373,123 +385,123 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/applications/json_packager/jsonpackage.res b/applications/json_packager/jsonpackage.res index 44ddf3942ca7f6ccc0ae8f6906c67ea9ddf1e0e5..d7b4fdeee27f6ceabdcaeaa09d23161c6cb82372 100644 GIT binary patch delta 217 zcmca{lViedjtx)Pm>C$@Ha}-u$joZSpvPb^xtHrO6s}CN{&DUx*!z_ASDXLiDjuN3LuqAU?s&RMG8uj6(uDn pUv;tByibxvhOv5bAh+`77p8BiX!_=>F0RteG6~yd5*YWK0RV={Or-z- delta 69 zcmV-L0J{H>+X&d%2(aV^0|5X9v*!k(0|hkzE≀jS9m7IXli(RVv&%&Z8vy`=(_pvLU;(|%99tJo diff --git a/applications/json_packager/locale/jsoneditor.en.po b/applications/json_packager/locale/jsoneditor.en.po index 502d4dc32..8b0514e38 100644 --- a/applications/json_packager/locale/jsoneditor.en.po +++ b/applications/json_packager/locale/jsoneditor.en.po @@ -144,6 +144,10 @@ msgstr "&Help" msgid "About.." msgstr "About.." +#: tfrmmain.mnu_helpautoloadlastfile.caption +msgid "Auto-load last saved file" +msgstr "" + #: tfrmmain.mnu_helpdisablewarnings.caption msgid "Disable warnings" msgstr "Disable warnings" diff --git a/applications/json_packager/locale/jsoneditor.es.mo b/applications/json_packager/locale/jsoneditor.es.mo index 6e6fa85184edb67cc6df74765487f6ed5169b589..eafbd7ce3b05e192415ab2e836f212152fe0765b 100644 GIT binary patch delta 1908 zcmYk+TWAzl9LMqh#xxh(T#V5qTH~lS_lwbJ)6_&`Of=DGjS^Ea%9xGo+D*5Ks}F@R z6(6J(gerNc7fK@tA}Ep|l7}Li(gzU~p)W>35b?!AF^`S-{mqWxVb6TdIZkH&=YRg= z;|;erde8GxM~$|d{yBXj#cT+-f5L^9n{HN#^DqsYQ2(?UGqE$6@4?TQ@56eG;2OMy ztMC!(`JoK65-i42Gtb%>46rbW<@f|Ea2Dra8E?@GtB_~dYAnM>EW&=|XCqvi@HBSd zUzm+KbJ+wIqn=ZXdd^zR;QiLbAeDu7QHCgkIFy6NrL@{%1~-yvNkG_C5xi|?quK@)K@Ty{LH(^RXdx&dVGnx zp@^t-!&1}^8iIK{YG(&gf&PNjlbu73*M7%ccoX?qXi+jVi;+{dQmnxS{950Cgn`4t z6;vQosI#BJt+;YA1&ZI}5BLzNJ8R~=Mz9NYgbz>wze8oBU`etDnz5I82kL0Xa0~v8 z>H7Y2DCHmZ2dE=Bhnw&>?89k1jg5Rm+QB_k>Yv~;e2tWc&2^GG7-FubBGeb5reji5 zHkCouLAl3;jrvXLQxT~!lmRy4pW${?Ca4{2r8m;m6pWgV%b~BMe@WLDqYQjQSKB~W zfTY{6oi0>spnL89FqzVojM=Q8PBvv^$WIyg#n_E)^slr)+f3J2pr$k3N$;eur4j&!zc`Txk-p*jG~}|Xwf1N zf+B)&5nd6pO(@i+7NIU&XbCP_xF|3Jqv-p)cMSi`na|8Pcjo^;=Zqt@pKF}i*oeo* zXeW}0!7#H+Sh<=VSJc=D%yNI@U=pk_RPDL9N|(I&6~XD|oTHil~7ikir6 zyorOT3FR}(Enu3X?k9(uNhny?hrlxMI2KcF7)3svLnxKIZ2 zkZM>ds&w^860I96@ftQ^05y?6sNUH~IyK>JhXd8vkD76rdtQf1aTBKDF=UR`i!9zA zpfd9m)f4ZL%_0&)ze{q>Ky|+#*{p<}7SxKx=r|nchGAs0QFdCvgnK@R>VYNHM7>O( z{;@oytX7U~*oZXxr*6#2o}e-@gsS~C9>;l9Nve|hXM|m-1-!!RID~8T{pZor`?yeyo!ED4iPk<6Ko#Ujcf-$ z71c~bpIbYj+LjY)QjKhaugEB0@XI)YSwt?Oa;+SVD^5x|_7nQQqM;@?Zy 'unknown' then + If (FileExistsUTF8(sJSONFilePath)) AND (bAutoLoadLast=TRUE) then + LoadJSONFromFile(sJSONFilePath); -procedure TfrmMain.LoadItemClick(Sender: TObject); +end; +procedure TfrmMain.LoadJSONFromFile(sFileName:String); var i: integer; Quad: TVersionQuad; begin - FileOpen1.Dialog.InitialDir := - CFG.ReadString('Options', 'LastLoadedJSONPath', sUpdateDirectory); - FileOpen1.Dialog.Filter := 'JSON|*.json'; - if FileOpen1.Dialog.Execute then - begin - ResetPackageFileControlsToOne; // So iNumLpkFilesVisible=1 - sJSONFilePath := FileOpen1.Dialog.Filename; - CFG.WriteString('Options', 'LastLoadedJSONPath', ExtractFileDir(sJSONFilePath)); - JSONPackage := TUpdatePackage.Create; + ResetPackageFileControlsToOne; // So iNumLpkFilesVisible=1 + JSONPackage := TUpdatePackage.Create; try - if JSONPackage.LoadFromFile(FileOpen1.Dialog.FileName) then + if JSONPackage.LoadFromFile(sFileName) then begin edt_UpdateZipName.Text := JSONPackage.UpdatePackageData.Name; edt_DownloadZipURL.Text := JSONPackage.UpdatePackageData.DownloadZipURL; @@ -934,10 +942,23 @@ begin end else ShowMessageFmt(rsThereWasAPro, - [ExtractFilename(FileOpen1.Dialog.FileName)]); + [ExtractFilename(sFileName)]); finally JSONPackage.Free; end; +end; + +procedure TfrmMain.LoadItemClick(Sender: TObject); +begin + FileOpen1.Dialog.InitialDir := + CFG.ReadString('Options', 'LastLoadedJSONPath', sUpdateDirectory); + FileOpen1.Dialog.Filter := 'JSON|*.json'; + if FileOpen1.Dialog.Execute then + begin + sJSONFilePath := FileOpen1.Dialog.Filename; + CFG.WriteString('Options', 'LastLoadedJSONPath', ExtractFileDir(sJSONFilePath)); + ResetPackageFileControlsToOne; // So iNumLpkFilesVisible=1 + LoadJSONFromFile(sJSONFilePath); end; end; @@ -1009,6 +1030,13 @@ begin MessageDlg(rsAbout + ' ' + Application.Title, s, mtInformation, [mbOK], 0); end; +procedure TfrmMain.mnu_helpAutoloadLastFileClick(Sender: TObject); +begin + bAutoLoadLast:= NOT bAutoLoadLast; + mnu_helpAutoloadLastFile.Checked:=bAutoLoadLast; + CFG.WriteBool('Options', 'AutoLoadLastFile',bAutoLoadLast); +end; + procedure TfrmMain.mnu_helpDisableWarningsClick(Sender: TObject); begin bDisableWarnings := not bDisableWarnings; @@ -1177,8 +1205,11 @@ begin FileSaveAs1.Dialog.InitialDir := sUpdateDirectory; FileSaveAs1.Dialog.FileName := 'update_' + ExtractFilenameOnly(edt_UpdateZipName.Text) + '.json'; + if FileSaveAs1.Dialog.Execute then - sJSONFilePath := FileSaveAs1.Dialog.FileName + begin + sJSONFilePath := FileSaveAs1.Dialog.FileName; + end else Exit; end; @@ -1207,11 +1238,17 @@ begin if MessageDlg(rsOverwrite + ' ' + sJSONFilePath + '?', mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then if JSONPackage.SaveToFile(sJSONFilePath) then - ShowMessage(sJSONFilePath + ' ' + rsSavedOK); + begin + ShowMessage(sJSONFilePath + ' ' + rsSavedOK); + CFG.WriteString('Options','LastSavedJSON',sJSONFilePath); + end; end else if JSONPackage.SaveToFile(sJSONFilePath) then - ShowMessage(sJSONFilePath + rsSavedOK) + begin + ShowMessage(sJSONFilePath + rsSavedOK); + CFG.WriteString('Options','LastSavedJSON',sJSONFilePath); + end else ShowMessage(rsSaveUnsucces); bDirty := False;