mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-21 16:55:01 -05:00
Simple GUI added.
This commit is contained in:
parent
8dc542e9e8
commit
3ee128f8ed
@ -1,152 +1,55 @@
|
|||||||
object Form1: TForm1
|
object Form1: TForm1
|
||||||
Left = 544
|
Left = 314
|
||||||
Height = 615
|
Height = 428
|
||||||
Top = 169
|
Top = 197
|
||||||
Width = 554
|
Width = 702
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
Caption = 'Form1'
|
Caption = 'Form1'
|
||||||
ClientHeight = 615
|
ClientHeight = 428
|
||||||
ClientWidth = 554
|
ClientWidth = 702
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '0.9.29'
|
||||||
object ListView1: TListView
|
|
||||||
Left = 16
|
|
||||||
Height = 512
|
|
||||||
Top = 8
|
|
||||||
Width = 232
|
|
||||||
Anchors = [akTop, akLeft, akBottom]
|
|
||||||
Columns = <
|
|
||||||
item
|
|
||||||
Caption = 'Scripts'
|
|
||||||
Width = 414
|
|
||||||
end>
|
|
||||||
IconOptions.Arrangement = iaLeft
|
|
||||||
LargeImages = ImageList1
|
|
||||||
ScrollBars = ssAutoBoth
|
|
||||||
SmallImages = ImageList1
|
|
||||||
StateImages = ImageList1
|
|
||||||
TabOrder = 0
|
|
||||||
ViewStyle = vsReport
|
|
||||||
OnMouseUp = ClickItem
|
|
||||||
end
|
|
||||||
object TreeView1: TTreeView
|
|
||||||
Left = 0
|
|
||||||
Height = 24
|
|
||||||
Top = 440
|
|
||||||
Width = 32
|
|
||||||
DefaultItemHeight = 15
|
|
||||||
TabOrder = 1
|
|
||||||
Visible = False
|
|
||||||
end
|
|
||||||
object Memo1: TMemo
|
|
||||||
Left = 272
|
|
||||||
Height = 504
|
|
||||||
Top = 16
|
|
||||||
Width = 262
|
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
|
||||||
Lines.Strings = (
|
|
||||||
'Memo1'
|
|
||||||
)
|
|
||||||
TabOrder = 2
|
|
||||||
end
|
|
||||||
object Button1: TButton
|
object Button1: TButton
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 33
|
Height = 33
|
||||||
Top = 576
|
Top = 365
|
||||||
Width = 520
|
Width = 680
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Caption = 'Button1'
|
Caption = 'Button1'
|
||||||
OnClick = Button1Click
|
OnClick = Button1Click
|
||||||
TabOrder = 3
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object Edit1: TEdit
|
object GroupBox1: TGroupBox
|
||||||
Left = 72
|
Left = 280
|
||||||
Height = 21
|
Height = 333
|
||||||
Top = 542
|
Top = 0
|
||||||
Width = 176
|
Width = 418
|
||||||
Anchors = [akLeft, akBottom]
|
Align = alCustom
|
||||||
TabOrder = 4
|
Anchors = [akTop, akLeft, akBottom]
|
||||||
end
|
Caption = 'GroupBox1'
|
||||||
object Label1: TLabel
|
ClientHeight = 315
|
||||||
Left = 24
|
ClientWidth = 414
|
||||||
Height = 14
|
TabOrder = 1
|
||||||
Top = 540
|
object Memo1: TMemo
|
||||||
Width = 29
|
Left = 14
|
||||||
Anchors = [akLeft, akBottom]
|
Height = 280
|
||||||
Caption = 'Filter:'
|
Top = 8
|
||||||
ParentColor = False
|
Width = 376
|
||||||
end
|
BorderStyle = bsNone
|
||||||
object SearchIn: TComboBox
|
Color = clBtnFace
|
||||||
Left = 344
|
ReadOnly = True
|
||||||
Height = 21
|
TabOrder = 0
|
||||||
Top = 534
|
|
||||||
Width = 192
|
|
||||||
ItemHeight = 13
|
|
||||||
ItemIndex = 0
|
|
||||||
Items.Strings = (
|
|
||||||
'Tags, Name, Author'
|
|
||||||
'Name'
|
|
||||||
'Tags'
|
|
||||||
'Author'
|
|
||||||
)
|
|
||||||
TabOrder = 5
|
|
||||||
Text = 'Tags, Name, Author'
|
|
||||||
end
|
|
||||||
object Label2: TLabel
|
|
||||||
Left = 272
|
|
||||||
Height = 14
|
|
||||||
Top = 536
|
|
||||||
Width = 44
|
|
||||||
Caption = 'Filter by:'
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object ImageList1: TImageList
|
|
||||||
left = 80
|
|
||||||
top = 272
|
|
||||||
Bitmap = {
|
|
||||||
4C69010000001000000010000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004EA35778499B5103FFFFFF00FFFF
|
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0047994FD24191499CFFFFFF00FFFF
|
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0063C06E1D5FBB6A705BB4
|
|
||||||
65B756AD5FEA50A65AFF4B9E53FF45964DFF60A868FF5BA262FF347E3A90FFFF
|
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0062BE6D395EB968B079C383FF89CA
|
|
||||||
92FF94D09CFF95D19EFF90CF99FF8CCB94FF87C98FFF80C487FF4E9554FF276D
|
|
||||||
2C84FFFFFF00FFFFFF00FFFFFF0060BC6C1D5CB667B085C98EFF9BD4A4FF8FCE
|
|
||||||
98FF92CF9AFF8DCC95FF88CA90FF83C68BFF7EC485FF79C17FFF478D4CFF2265
|
|
||||||
258AFFFFFF00FFFFFF00FFFFFF005BB4657075BF7EFF98D2A1FF94CF9CFF86C7
|
|
||||||
8DFF5EA765FF398640FF347E3AFF2E7633FF49904FFF458B4AFF20632493FFFF
|
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF0054AB5EB780C389FF8DCC95FF83C48AFF3D8B
|
|
||||||
44E137833E8DFFFFFF00FFFFFF00FFFFFF00236627D21F61239FFFFFFF00FFFF
|
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF004DA155E847994FF8419149F63B8842ED3580
|
|
||||||
3C83FFFFFF00FFFFFF00FFFFFF00FFFFFF001E5F217B1B5B1E0354AB5E614EA3
|
|
||||||
5761499B516143934B613D8B446145964D613F8E466139864061347E3A612E76
|
|
||||||
336167C6730364C2707BFFFFFF00FFFFFF00FFFFFF00FFFFFF004DA155834799
|
|
||||||
4FED419149F63B8842F835803CE8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
|
||||||
FF0063C06E9F5FBB6AD2FFFFFF00FFFFFF00FFFFFF004B9E538D45964DE186C6
|
|
||||||
8EFF88C98FFF6FB376FF2E7633B7FFFFFF00FFFFFF00FFFFFF00FFFFFF0062BE
|
|
||||||
6D937BC785FF77C281FF54AB5EFF4EA357FF499B51FF63AC6BFF83C38BFF87C9
|
|
||||||
8FFF82C689FF509756FF276D2C70FFFFFF00FFFFFF00FFFFFF0060BC6C8A79C4
|
|
||||||
83FF9ED7A7FF9BD4A4FF97D29FFF92CF9AFF8DCC95FF88CA90FF7AC282FF7EC4
|
|
||||||
85FF5DA463FF266B2AB02265251DFFFFFF00FFFFFF00FFFFFF005BB4658473BD
|
|
||||||
7CFF96D19FFF94CF9CFF8FCD96FF8ACA91FF85C78BFF7ABE81FF65AD6CFF4B92
|
|
||||||
51FF246829B020632439FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004EA3
|
|
||||||
579066B06EFF61AA68FF3D8B44FF37833EFF327B37FF2C7432EA276D2CB72366
|
|
||||||
27701F61231DFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
|
||||||
FF004191499C3B8842D2FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
|
||||||
FF0039864003347E3A78FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF00
|
|
||||||
}
|
|
||||||
end
|
|
||||||
object ScriptPopup: TPopupMenu
|
|
||||||
left = 115
|
|
||||||
top = 147
|
|
||||||
object MenuItem1: TMenuItem
|
|
||||||
Caption = 'Install'
|
|
||||||
end
|
|
||||||
object MenuItem2: TMenuItem
|
|
||||||
Caption = 'Rate'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object ListView1: TListView
|
||||||
|
Left = 0
|
||||||
|
Height = 333
|
||||||
|
Top = 0
|
||||||
|
Width = 274
|
||||||
|
Align = alCustom
|
||||||
|
Anchors = [akTop, akLeft, akBottom]
|
||||||
|
Columns = <>
|
||||||
|
TabOrder = 2
|
||||||
|
OnChange = ListView1Change
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -41,31 +41,6 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TForm1 }
|
|
||||||
|
|
||||||
TForm1 = class(TForm)
|
|
||||||
Button1: TButton;
|
|
||||||
SearchIn: TComboBox;
|
|
||||||
Edit1: TEdit;
|
|
||||||
ImageList1: TImageList;
|
|
||||||
Label1: TLabel;
|
|
||||||
Label2: TLabel;
|
|
||||||
ListView1: TListView;
|
|
||||||
Memo1: TMemo;
|
|
||||||
MenuItem1: TMenuItem;
|
|
||||||
MenuItem2: TMenuItem;
|
|
||||||
ScriptPopup: TPopupMenu;
|
|
||||||
TreeView1: TTreeView;
|
|
||||||
procedure Button1Click(Sender: TObject);
|
|
||||||
procedure ClickItem(Sender: TObject; Button: TMouseButton;
|
|
||||||
Shift: TShiftState; X, Y: Integer);
|
|
||||||
procedure FormCreate(Sender: TObject);
|
|
||||||
private
|
|
||||||
{ private declarations }
|
|
||||||
public
|
|
||||||
{ public declarations }
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TSimbaScript }
|
{ TSimbaScript }
|
||||||
|
|
||||||
TSimbaScript = class(TObject)
|
TSimbaScript = class(TObject)
|
||||||
@ -103,9 +78,11 @@ type
|
|||||||
FUpdating : boolean;
|
FUpdating : boolean;
|
||||||
function GetLScriptCount: integer;
|
function GetLScriptCount: integer;
|
||||||
function GetMainDir: string;
|
function GetMainDir: string;
|
||||||
|
function GetScript(index : integer): TSimbaScript;
|
||||||
function GetScriptCount: integer;
|
function GetScriptCount: integer;
|
||||||
public
|
public
|
||||||
property MainDir : string read GetMainDir write FMaindir;
|
property MainDir : string read GetMainDir write FMaindir;
|
||||||
|
property SimbaScript[index : integer] : TSimbaScript read GetScript;
|
||||||
procedure Update; //Gets the online scripts
|
procedure Update; //Gets the online scripts
|
||||||
procedure LUpdate; //Loads the local scripts, uses MainDir
|
procedure LUpdate; //Loads the local scripts, uses MainDir
|
||||||
function NewVersion(Script : integer) : boolean; //Checks for updates for Script
|
function NewVersion(Script : integer) : boolean; //Checks for updates for Script
|
||||||
@ -119,6 +96,26 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
TForm1 = class(TForm)
|
||||||
|
Button1: TButton;
|
||||||
|
GroupBox1: TGroupBox;
|
||||||
|
ListView1: TListView;
|
||||||
|
Memo1: TMemo;
|
||||||
|
procedure Button1Click(Sender: TObject);
|
||||||
|
procedure ClickItem(Sender: TObject; Button: TMouseButton;
|
||||||
|
Shift: TShiftState; X, Y: Integer);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure ListView1Change(Sender: TObject; Item: TListItem;
|
||||||
|
Change: TItemChange);
|
||||||
|
private
|
||||||
|
Mng : TScriptManager;
|
||||||
|
public
|
||||||
|
{ public declarations }
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -160,13 +157,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.FormCreate(Sender: TObject);
|
procedure TForm1.FormCreate(Sender: TObject);
|
||||||
var
|
|
||||||
s: TMMLSettings;
|
|
||||||
begin
|
begin
|
||||||
{ s := TMMLSettings.Create(TreeView1.Items);
|
Mng := TScriptManager.Create;
|
||||||
s.LoadFromXML('/scratch/gittest/list.xml');
|
ListView1.Columns.Add.Width:= ClientWidth;
|
||||||
fill(s);
|
end;
|
||||||
s.Free();}
|
|
||||||
|
procedure TForm1.ListView1Change(Sender: TObject; Item: TListItem;
|
||||||
|
Change: TItemChange);
|
||||||
|
var
|
||||||
|
Script : TSimbaScript;
|
||||||
|
begin
|
||||||
|
if Item.Data <> nil then
|
||||||
|
begin
|
||||||
|
Memo1.Clear;
|
||||||
|
Script := TSimbaScript(Item.data);
|
||||||
|
Memo1.Lines.Add('Name: ' + Script.Name);
|
||||||
|
Memo1.lines.add('Author: ' + Script.Author);
|
||||||
|
Memo1.Lines.add('Version: ' + Script.Version);
|
||||||
|
Memo1.Lines.Add('Description: ' + Script.Description);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.ClickItem(Sender: TObject; Button: TMouseButton;
|
procedure TForm1.ClickItem(Sender: TObject; Button: TMouseButton;
|
||||||
@ -181,7 +190,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
{ Any selection causes the description to change }
|
{ Any selection causes the description to change }
|
||||||
form1.Memo1.Lines.Clear();
|
{ form1.Memo1.Lines.Clear();
|
||||||
form1.Memo1.Lines.Append(TSimbaScript(item.data).Description);
|
form1.Memo1.Lines.Append(TSimbaScript(item.data).Description);
|
||||||
|
|
||||||
if Button = mbLeft then
|
if Button = mbLeft then
|
||||||
@ -193,16 +202,21 @@ begin
|
|||||||
Form1.ScriptPopup.Items[0].Caption:= 'Install ' + TSimbaScript(item.data).Name;
|
Form1.ScriptPopup.Items[0].Caption:= 'Install ' + TSimbaScript(item.data).Name;
|
||||||
Form1.ScriptPopup.PopUp();
|
Form1.ScriptPopup.PopUp();
|
||||||
end;
|
end;
|
||||||
//form1.Memo1.Text := TSimbaScript(item.data).Description;
|
//form1.Memo1.Text := TSimbaScript(item.data).Description; }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.Button1Click(Sender: TObject);
|
procedure TForm1.Button1Click(Sender: TObject);
|
||||||
var
|
var
|
||||||
Mngr : TScriptManager;
|
i : integer;
|
||||||
|
Item : TListItem;
|
||||||
begin
|
begin
|
||||||
Mngr := TScriptManager.Create;
|
Mng.Update;
|
||||||
Mngr.Update;
|
for i := 0 to Mng.ScriptCount - 1 do
|
||||||
Mngr.free;
|
begin
|
||||||
|
Item := ListView1.Items.Add;
|
||||||
|
Item.Data:= Mng.SimbaScript[i];
|
||||||
|
Item.Caption:= Mng.SimbaScript[i].Name;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TSimbaScript }
|
{ TSimbaScript }
|
||||||
@ -292,6 +306,11 @@ begin
|
|||||||
result := IncludeTrailingPathDelimiter(FMainDir);
|
result := IncludeTrailingPathDelimiter(FMainDir);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TScriptManager.GetScript(index : integer): TSimbaScript;
|
||||||
|
begin
|
||||||
|
result := TSimbaScript(FScripts[index]);
|
||||||
|
end;
|
||||||
|
|
||||||
function TScriptManager.GetScriptCount: integer;
|
function TScriptManager.GetScriptCount: integer;
|
||||||
begin
|
begin
|
||||||
result := FScripts.Count;
|
result := FScripts.Count;
|
||||||
@ -305,7 +324,7 @@ var
|
|||||||
Node,Script : TDOMNode;
|
Node,Script : TDOMNode;
|
||||||
Subs : TStringList;
|
Subs : TStringList;
|
||||||
Down : TDownloadThread;
|
Down : TDownloadThread;
|
||||||
SimbaScript : TSimbaScript;
|
SScript : TSimbaScript;
|
||||||
begin
|
begin
|
||||||
if FUpdating then
|
if FUpdating then
|
||||||
exit;
|
exit;
|
||||||
@ -329,10 +348,10 @@ begin
|
|||||||
script := Node.FirstChild;
|
script := Node.FirstChild;
|
||||||
while Script <> nil do
|
while Script <> nil do
|
||||||
begin
|
begin
|
||||||
SimbaScript := TSimbaScript.Create;
|
SScript := TSimbaScript.Create;
|
||||||
SimbaScript.LoadFromNode(Script);
|
SScript.LoadFromNode(Script);
|
||||||
FScripts.Add(SimbaScript);
|
FScripts.Add(SScript);
|
||||||
SimbaScript.Dbg;
|
SScript.Dbg;
|
||||||
Script := Script.NextSibling;
|
Script := Script.NextSibling;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -346,7 +365,7 @@ var
|
|||||||
Node,Script : TDOMNode;
|
Node,Script : TDOMNode;
|
||||||
Subs : TStringList;
|
Subs : TStringList;
|
||||||
Down : TDownloadThread;
|
Down : TDownloadThread;
|
||||||
SimbaScript : TLSimbaScript;
|
SScript : TLSimbaScript;
|
||||||
begin
|
begin
|
||||||
if DirectoryExists(MainDir) = false then
|
if DirectoryExists(MainDir) = false then
|
||||||
exit;
|
exit;
|
||||||
@ -359,10 +378,10 @@ begin
|
|||||||
script := Node.FirstChild;
|
script := Node.FirstChild;
|
||||||
while Script <> nil do
|
while Script <> nil do
|
||||||
begin
|
begin
|
||||||
SimbaScript := TLSimbaScript.Create;
|
SScript := TLSimbaScript.Create;
|
||||||
SimbaScript.LoadFromName(Node.TextContent,maindir);
|
SScript.LoadFromName(Node.TextContent,maindir);
|
||||||
FLScripts.Add(SimbaScript);
|
FLScripts.Add(SScript);
|
||||||
SimbaScript.Dbg;
|
SScript.Dbg;
|
||||||
Script := Script.NextSibling;
|
Script := Script.NextSibling;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -380,7 +399,7 @@ begin
|
|||||||
for i := 0 to ScriptCount-1 do
|
for i := 0 to ScriptCount-1 do
|
||||||
if TSimbaScript(FScripts[i]).Name = Scrpt.Name then
|
if TSimbaScript(FScripts[i]).Name = Scrpt.Name then
|
||||||
begin
|
begin
|
||||||
Scrpt.OnlineScript = TSimbaScript(FScripts[i]);
|
Scrpt.OnlineScript := TSimbaScript(FScripts[i]);
|
||||||
Break;
|
Break;
|
||||||
end;
|
end;
|
||||||
result := Scrpt.OnlineScript.Version <> Scrpt.Version;
|
result := Scrpt.OnlineScript.Version <> Scrpt.Version;
|
||||||
@ -407,13 +426,13 @@ end;
|
|||||||
|
|
||||||
procedure TScriptManager.UpdateScript(Script: integer);
|
procedure TScriptManager.UpdateScript(Script: integer);
|
||||||
var
|
var
|
||||||
LScript : TLSimbaScript;
|
LScrpt : TLSimbaScript;
|
||||||
Scrpt : TSimbaScript;
|
Scrpt : TSimbaScript;
|
||||||
begin
|
begin
|
||||||
LScript := TLSimbaScript(FLScripts[Script]);
|
LScrpt := TLSimbaScript(FLScripts[Script]);
|
||||||
if not NewVersion(Script) then
|
if not NewVersion(Script) then
|
||||||
Exit;
|
Exit;
|
||||||
Scrpt := LScript.OnlineScript;
|
Scrpt := LScrpt.OnlineScript;
|
||||||
with LScrpt do
|
with LScrpt do
|
||||||
begin
|
begin
|
||||||
Version:= Scrpt.Version;
|
Version:= Scrpt.Version;
|
||||||
|
Loading…
Reference in New Issue
Block a user