Skip to content

Commit 6f0eaf0

Browse files
committed
Updated info about SWAG database + some UI tweaks
1 parent 11e28e3 commit 6f0eaf0

File tree

4 files changed

+62
-43
lines changed

4 files changed

+62
-43
lines changed

Src/FmSWAGImportDlg.dfm

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,12 @@ inherited SWAGImportDlg: TSWAGImportDlg
1919
inherited pcWizard: TPageControl
2020
Width = 671
2121
Height = 456
22-
ActivePage = tsCategories
22+
ActivePage = tsFinish
2323
ExplicitWidth = 671
2424
ExplicitHeight = 456
2525
object tsIntro: TTabSheet
2626
Caption = 'tsIntro'
2727
TabVisible = False
28-
ExplicitLeft = 0
29-
ExplicitTop = 0
30-
ExplicitWidth = 0
31-
ExplicitHeight = 0
3228
inline frmIntro: THTMLTpltDlgFrame
3329
Left = 0
3430
Top = 0
@@ -59,37 +55,41 @@ inherited SWAGImportDlg: TSWAGImportDlg
5955
Caption = 'tsFolder'
6056
ImageIndex = 4
6157
TabVisible = False
62-
ExplicitLeft = 0
63-
ExplicitTop = 0
64-
ExplicitWidth = 0
65-
ExplicitHeight = 0
6658
object lblFolder: TLabel
6759
Left = 0
6860
Top = 8
69-
Width = 393
61+
Width = 383
7062
Height = 13
7163
Caption =
72-
'Enter the SWAG database download &folder: (click the button to b' +
73-
'rowse for folder)'
64+
'Enter the SWAG database download &folder - you need the '#39'swag'#39' s' +
65+
'ub-directory:'
7466
FocusControl = edPath
7567
end
76-
object lblFolderPageInfo: TLabel
68+
object lblFolderPageInfo2: TLabel
7769
Left = 0
7870
Top = 72
7971
Width = 267
8072
Height = 13
8173
Caption = 'Click the Next button to choose which packets to import'
8274
end
83-
object edPath: TEdit
75+
object lblFolderPageInfo1: TLabel
8476
Left = 0
85-
Top = 28
77+
Top = 26
78+
Width = 208
79+
Height = 13
80+
Caption = 'Click the ... button to browse for the folder'
81+
FocusControl = edPath
82+
end
83+
object edPath: TEdit
84+
Left = 3
85+
Top = 45
8686
Width = 484
8787
Height = 21
8888
TabOrder = 0
8989
end
9090
object btnBrowse: TButton
91-
Left = 490
92-
Top = 28
91+
Left = 493
92+
Top = 45
9393
Width = 27
9494
Height = 21
9595
Action = actBrowse
@@ -184,10 +184,6 @@ inherited SWAGImportDlg: TSWAGImportDlg
184184
Caption = 'tsUpdate'
185185
ImageIndex = 2
186186
TabVisible = False
187-
ExplicitLeft = 0
188-
ExplicitTop = 0
189-
ExplicitWidth = 0
190-
ExplicitHeight = 0
191187
object lblUpdateDesc: TLabel
192188
Left = 0
193189
Top = 3
@@ -231,10 +227,6 @@ inherited SWAGImportDlg: TSWAGImportDlg
231227
Caption = 'tsFinish'
232228
ImageIndex = 3
233229
TabVisible = False
234-
ExplicitLeft = 0
235-
ExplicitTop = 0
236-
ExplicitWidth = 0
237-
ExplicitHeight = 0
238230
inline frmOutro: THTMLTpltDlgFrame
239231
Left = 0
240232
Top = 0

Src/FmSWAGImportDlg.pas

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ TSWAGImportDlg = class(TWizardDlg, INoPublicConstruct)
6565
tsFolder: TTabSheet;
6666
lblFolder: TLabel;
6767
edPath: TEdit;
68-
lblFolderPageInfo: TLabel;
68+
lblFolderPageInfo2: TLabel;
6969
btnBrowse: TButton;
7070
actBrowse: TAction;
7171
frmIntro: THTMLTpltDlgFrame;
7272
lblVersionNumber: TLabel;
73+
lblFolderPageInfo1: TLabel;
7374
/// <summary>Handles clicks on the check boxes next to packets in the
7475
/// packet selection list box by selecting and deselecting packets for
7576
/// inclusion in the import.</summary>
@@ -315,8 +316,12 @@ procedure TSWAGImportDlg.ArrangeForm;
315316
TCtrlArranger.AlignVCentres(
316317
TCtrlArranger.BottomOf(lblFolder, 6), [edPath, btnBrowse]
317318
);
319+
TCtrlArranger.AlignLefts(
320+
[lblFolder, edPath, lblFolderPageInfo1, lblFolderPageInfo2], 0
321+
);
318322
TCtrlArranger.MoveToRightOf(edPath, btnBrowse, 8);
319-
lblFolderPageInfo.Top := TCtrlArranger.BottomOf([edPath, btnBrowse], 12);
323+
lblFolderPageInfo1.Top := TCtrlArranger.BottomOf([edPath, btnBrowse], 12);
324+
lblFolderPageInfo2.Top := TCtrlArranger.BottomOf(lblFolderPageInfo1, 8);
320325

321326
// tsCategories
322327
lblCategoriesDesc.Width := tsCategories.ClientWidth;
@@ -423,7 +428,8 @@ procedure TSWAGImportDlg.BuildCSS(Sender: TObject;
423428
with CSSBuilder.AddSelector('.framed') do
424429
begin
425430
AddProperty(TCSS.BorderProp(cssAll, 1, cbsSolid, clBorder));
426-
AddProperty(TCSS.PaddingProp(4));
431+
AddProperty(TCSS.PaddingProp(0, 4, 4, 4));
432+
AddProperty(TCSS.MarginProp(cssTop, 4));
427433
end;
428434
end;
429435

@@ -461,6 +467,8 @@ procedure TSWAGImportDlg.clbSelectPacketsKeyDown(Sender: TObject;
461467
end;
462468

463469
procedure TSWAGImportDlg.ConfigForm;
470+
resourcestring
471+
sVersions = 'v%0:s to v%1:s';
464472
begin
465473
inherited;
466474
pcWizard.ActivePage := tsFinish;
@@ -485,6 +493,16 @@ procedure TSWAGImportDlg.ConfigForm;
485493
'SWAGReleaseURL',
486494
TURL.SWAGReleases
487495
);
496+
Tplt.ResolvePlaceholderText(
497+
'SupportedSWAGVersions',
498+
Format(
499+
sVersions,
500+
[
501+
string(TSWAGVersion.LowestSupportedVersion),
502+
string(TSWAGVersion.LowestUnSupportedVersion)
503+
]
504+
)
505+
);
488506
end
489507
);
490508
end;
@@ -615,7 +633,6 @@ procedure TSWAGImportDlg.InitSelectionPage;
615633
var
616634
Cats: TList<TSWAGCategory>;
617635
Idx: Integer;
618-
VerNumStr: string;
619636
resourcestring
620637
sLblVersionNumberCaption = 'SWAG version %s';
621638
begin

Src/Res/HTML/dlg-swag-import-intro-tplt.html

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,45 @@
2424
<body>
2525

2626
<p>
27-
This wizard enables you to import snippets from the <a
27+
This wizard enables you to import &quot;packets&quot; (SWAG's equivalent of CodeSnip's snippets) from the <a
2828
class="help-link"
2929
href="help:AboutSWAG"
3030
>SWAG database</a> into your local user database.
3131
</p>
3232

33-
<p class="framed">
34-
You must have a copy of a specially prepared version of SWAG on your local system before continuing. If you haven't already got it then you need to download it from the <em>delphidabbler/swag</em> repository on GitHub. Go to <a
35-
class="external-link"
36-
href="<%SWAGReleaseURL%>"
37-
><%SWAGReleaseURL%></a> and find the latest release of the XML version of SWAG. The file name will be in the form <code>swag-xml-vX.X.X</code> where <code>X.X.X</code> is the version number. Download the file and unzip it into a folder on your computer. Make a note of the folder's location - it will be needed in the next step.
33+
<div class="framed">
34+
<p>
35+
You must have a copy of a specially prepared version of SWAG on your local system before continuing. If you haven't already got it then you need to download it from the <em>delphidabbler/swag</em> repository on GitHub.
36+
</p>
37+
<p>
38+
Go to <a class="external-link" href="<%SWAGReleaseURL%>" ><%SWAGReleaseURL%></a> and find the latest supported release&dagger;. The file name will be in the form <code>dd-swag-vX.Y.Z</code> where <code>X.Y.Z</code> is the version number. Download the file and unzip it into a folder on your computer. Make a note of the folder's location - it will be needed in the next step.
39+
</p>
40+
<p class="indent">
41+
&dagger; Currently CodeSnip supports SWAG versions <%SupportedSWAGVersions%>.
42+
</p>
43+
</div>
44+
45+
<p>
46+
<strong class="warning">Warning:</strong> Although importing snippets should be safe, you may wish to take a backup of your user database before going any further. You can do this from the <em>Database | Backup User Database</em> menu option.
47+
</p>
3848

3949
<p>
40-
On the next page of the wizard you will be asked for the location of the folder containing the SWAG database. <em>CodeSnip</em> will then open the database and display all SWAG's categories on the following page. From there you can browse and display the snippets in each category before selecting those you want to import. You get a chance to review these before importing.
50+
On the next page of the wizard you will be asked for the location of the folder containing the SWAG database. <strong>Note</strong> that you will need to specify the <strong><code>swag</code></strong> sub-directory of the download. <em>CodeSnip</em> will then open the database and display all SWAG's categories on the following page. From there you can browse and display the packets in each category before selecting those you want to import. You get a chance to review these before importing.
4151
</p>
4252

4353
<p>
44-
All snippets are imported as <a
54+
All packets are imported as <a
4555
class="help-link"
4656
href="help:SnippetFreeform"
47-
>freeform</a>.
57+
>freeform</a> snippets.
4858
</p>
4959

5060
<p>
51-
<em>CodeSnip</em> does not keep a track of snippets imported from SWAG &ndash; it treats them just like any other user defined snippet. This means it is possible to import the same snippet more than once. It's up to you to keep track of this.
61+
<em>CodeSnip</em> does not keep a track of packets imported from SWAG &ndash; it treats them just like any other user defined snippet. This means it is possible to import the same packet more than once. It's up to you to keep track of this.
5262
</p>
5363

5464
<p>
55-
<strong>Note:</strong> It can take quite some time to import snippets from SWAG. You are advised not to import more than about 20 snippets in one go. If you want to import a lot of snippets you should run this wizard more than once.
65+
<strong>Note:</strong> It can take quite some time to import packets from SWAG. You are advised not to import more than about 20 packets in one go. If you want to import a lot of packets you should run this wizard more than once.
5666
</p>
5767

5868
</body>

Src/Res/HTML/dlg-swag-import-outro-tplt.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
<body>
2424

2525
<p>
26-
All the selected snippets have now been imported into the
27-
<em><%SWAGCategory%></em> category.
26+
All the selected SWAG packets have now been converted to CodeSnip snippets
27+
and imported into the <em><%SWAGCategory%></em> category.
2828
</p>
2929

3030
<p>
31-
The imported snippets can be edited as required.
31+
The snippets can be edited as required.
3232
</p>
3333

3434
<p>

0 commit comments

Comments
 (0)