mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-21 08:45:06 -05:00
Simple GUI added.
This commit is contained in:
parent
8dc542e9e8
commit
3ee128f8ed
@ -1,152 +1,55 @@
|
||||
object Form1: TForm1
|
||||
Left = 544
|
||||
Height = 615
|
||||
Top = 169
|
||||
Width = 554
|
||||
Left = 314
|
||||
Height = 428
|
||||
Top = 197
|
||||
Width = 702
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 615
|
||||
ClientWidth = 554
|
||||
ClientHeight = 428
|
||||
ClientWidth = 702
|
||||
OnCreate = FormCreate
|
||||
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
|
||||
Left = 16
|
||||
Height = 33
|
||||
Top = 576
|
||||
Width = 520
|
||||
Top = 365
|
||||
Width = 680
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = 'Button1'
|
||||
OnClick = Button1Click
|
||||
TabOrder = 3
|
||||
TabOrder = 0
|
||||
end
|
||||
object Edit1: TEdit
|
||||
Left = 72
|
||||
Height = 21
|
||||
Top = 542
|
||||
Width = 176
|
||||
Anchors = [akLeft, akBottom]
|
||||
TabOrder = 4
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 24
|
||||
Height = 14
|
||||
Top = 540
|
||||
Width = 29
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = 'Filter:'
|
||||
ParentColor = False
|
||||
end
|
||||
object SearchIn: TComboBox
|
||||
Left = 344
|
||||
Height = 21
|
||||
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'
|
||||
object GroupBox1: TGroupBox
|
||||
Left = 280
|
||||
Height = 333
|
||||
Top = 0
|
||||
Width = 418
|
||||
Align = alCustom
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
Caption = 'GroupBox1'
|
||||
ClientHeight = 315
|
||||
ClientWidth = 414
|
||||
TabOrder = 1
|
||||
object Memo1: TMemo
|
||||
Left = 14
|
||||
Height = 280
|
||||
Top = 8
|
||||
Width = 376
|
||||
BorderStyle = bsNone
|
||||
Color = clBtnFace
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
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
|
||||
|
@ -41,31 +41,6 @@ uses
|
||||
|
||||
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 = class(TObject)
|
||||
@ -103,9 +78,11 @@ type
|
||||
FUpdating : boolean;
|
||||
function GetLScriptCount: integer;
|
||||
function GetMainDir: string;
|
||||
function GetScript(index : integer): TSimbaScript;
|
||||
function GetScriptCount: integer;
|
||||
public
|
||||
property MainDir : string read GetMainDir write FMaindir;
|
||||
property SimbaScript[index : integer] : TSimbaScript read GetScript;
|
||||
procedure Update; //Gets the online scripts
|
||||
procedure LUpdate; //Loads the local scripts, uses MainDir
|
||||
function NewVersion(Script : integer) : boolean; //Checks for updates for Script
|
||||
@ -119,6 +96,26 @@ type
|
||||
destructor Destroy; override;
|
||||
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
|
||||
@ -160,13 +157,25 @@ begin
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
s: TMMLSettings;
|
||||
begin
|
||||
{ s := TMMLSettings.Create(TreeView1.Items);
|
||||
s.LoadFromXML('/scratch/gittest/list.xml');
|
||||
fill(s);
|
||||
s.Free();}
|
||||
Mng := TScriptManager.Create;
|
||||
ListView1.Columns.Add.Width:= ClientWidth;
|
||||
end;
|
||||
|
||||
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;
|
||||
|
||||
procedure TForm1.ClickItem(Sender: TObject; Button: TMouseButton;
|
||||
@ -181,7 +190,7 @@ begin
|
||||
exit;
|
||||
|
||||
{ Any selection causes the description to change }
|
||||
form1.Memo1.Lines.Clear();
|
||||
{ form1.Memo1.Lines.Clear();
|
||||
form1.Memo1.Lines.Append(TSimbaScript(item.data).Description);
|
||||
|
||||
if Button = mbLeft then
|
||||
@ -193,16 +202,21 @@ begin
|
||||
Form1.ScriptPopup.Items[0].Caption:= 'Install ' + TSimbaScript(item.data).Name;
|
||||
Form1.ScriptPopup.PopUp();
|
||||
end;
|
||||
//form1.Memo1.Text := TSimbaScript(item.data).Description;
|
||||
//form1.Memo1.Text := TSimbaScript(item.data).Description; }
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
var
|
||||
Mngr : TScriptManager;
|
||||
i : integer;
|
||||
Item : TListItem;
|
||||
begin
|
||||
Mngr := TScriptManager.Create;
|
||||
Mngr.Update;
|
||||
Mngr.free;
|
||||
Mng.Update;
|
||||
for i := 0 to Mng.ScriptCount - 1 do
|
||||
begin
|
||||
Item := ListView1.Items.Add;
|
||||
Item.Data:= Mng.SimbaScript[i];
|
||||
Item.Caption:= Mng.SimbaScript[i].Name;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TSimbaScript }
|
||||
@ -292,6 +306,11 @@ begin
|
||||
result := IncludeTrailingPathDelimiter(FMainDir);
|
||||
end;
|
||||
|
||||
function TScriptManager.GetScript(index : integer): TSimbaScript;
|
||||
begin
|
||||
result := TSimbaScript(FScripts[index]);
|
||||
end;
|
||||
|
||||
function TScriptManager.GetScriptCount: integer;
|
||||
begin
|
||||
result := FScripts.Count;
|
||||
@ -305,7 +324,7 @@ var
|
||||
Node,Script : TDOMNode;
|
||||
Subs : TStringList;
|
||||
Down : TDownloadThread;
|
||||
SimbaScript : TSimbaScript;
|
||||
SScript : TSimbaScript;
|
||||
begin
|
||||
if FUpdating then
|
||||
exit;
|
||||
@ -329,10 +348,10 @@ begin
|
||||
script := Node.FirstChild;
|
||||
while Script <> nil do
|
||||
begin
|
||||
SimbaScript := TSimbaScript.Create;
|
||||
SimbaScript.LoadFromNode(Script);
|
||||
FScripts.Add(SimbaScript);
|
||||
SimbaScript.Dbg;
|
||||
SScript := TSimbaScript.Create;
|
||||
SScript.LoadFromNode(Script);
|
||||
FScripts.Add(SScript);
|
||||
SScript.Dbg;
|
||||
Script := Script.NextSibling;
|
||||
end;
|
||||
end;
|
||||
@ -346,7 +365,7 @@ var
|
||||
Node,Script : TDOMNode;
|
||||
Subs : TStringList;
|
||||
Down : TDownloadThread;
|
||||
SimbaScript : TLSimbaScript;
|
||||
SScript : TLSimbaScript;
|
||||
begin
|
||||
if DirectoryExists(MainDir) = false then
|
||||
exit;
|
||||
@ -359,10 +378,10 @@ begin
|
||||
script := Node.FirstChild;
|
||||
while Script <> nil do
|
||||
begin
|
||||
SimbaScript := TLSimbaScript.Create;
|
||||
SimbaScript.LoadFromName(Node.TextContent,maindir);
|
||||
FLScripts.Add(SimbaScript);
|
||||
SimbaScript.Dbg;
|
||||
SScript := TLSimbaScript.Create;
|
||||
SScript.LoadFromName(Node.TextContent,maindir);
|
||||
FLScripts.Add(SScript);
|
||||
SScript.Dbg;
|
||||
Script := Script.NextSibling;
|
||||
end;
|
||||
end;
|
||||
@ -380,7 +399,7 @@ begin
|
||||
for i := 0 to ScriptCount-1 do
|
||||
if TSimbaScript(FScripts[i]).Name = Scrpt.Name then
|
||||
begin
|
||||
Scrpt.OnlineScript = TSimbaScript(FScripts[i]);
|
||||
Scrpt.OnlineScript := TSimbaScript(FScripts[i]);
|
||||
Break;
|
||||
end;
|
||||
result := Scrpt.OnlineScript.Version <> Scrpt.Version;
|
||||
@ -407,13 +426,13 @@ end;
|
||||
|
||||
procedure TScriptManager.UpdateScript(Script: integer);
|
||||
var
|
||||
LScript : TLSimbaScript;
|
||||
LScrpt : TLSimbaScript;
|
||||
Scrpt : TSimbaScript;
|
||||
begin
|
||||
LScript := TLSimbaScript(FLScripts[Script]);
|
||||
LScrpt := TLSimbaScript(FLScripts[Script]);
|
||||
if not NewVersion(Script) then
|
||||
Exit;
|
||||
Scrpt := LScript.OnlineScript;
|
||||
Scrpt := LScrpt.OnlineScript;
|
||||
with LScrpt do
|
||||
begin
|
||||
Version:= Scrpt.Version;
|
||||
|
Loading…
Reference in New Issue
Block a user