Changeset 27 for trunk/Forms


Ignore:
Timestamp:
Nov 9, 2011, 4:11:56 PM (13 years ago)
Author:
george
Message:
  • Added: Partial client-server protocol layer implementation.
Location:
trunk/Forms
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/ULoginForm.lfm

    r25 r27  
    4444    Width = 75
    4545    Caption = 'Login'
     46    Default = True
    4647    ModalResult = 1
    4748    OnClick = ButtonLoginClick
     
    5455    Width = 104
    5556    TabOrder = 2
    56   end
    57   object MaskEditPassword: TMaskEdit
    58     Left = 88
    59     Height = 21
    60     Top = 96
    61     Width = 104
    62     CharCase = ecNormal
    63     MaxLength = 1
    64     TabOrder = 3
    65     EditMask = '*'
    66     Text = '*'
    67     SpaceChar = '_'
    6857  end
    6958  object Label3: TLabel
     
    8271    ItemHeight = 13
    8372    Style = csDropDownList
    84     TabOrder = 4
     73    TabOrder = 3
    8574  end
    8675  object ButtonChange: TButton
     
    9180    Caption = 'Change'
    9281    OnClick = ButtonChangeClick
    93     TabOrder = 5
     82    TabOrder = 4
    9483  end
    9584  object Image1: TImage
     
    9988    Width = 152
    10089  end
     90  object EditPassword: TEdit
     91    Left = 89
     92    Height = 21
     93    Top = 96
     94    Width = 104
     95    EchoMode = emPassword
     96    PasswordChar = '*'
     97    TabOrder = 5
     98  end
    10199end
  • trunk/Forms/ULoginForm.lrt

    r25 r27  
    44TLOGINFORM.BUTTONCANCEL.CAPTION=Close
    55TLOGINFORM.BUTTONLOGIN.CAPTION=Login
    6 TLOGINFORM.MASKEDITPASSWORD.TEXT=*
    76TLOGINFORM.LABEL3.CAPTION=Connection:
    87TLOGINFORM.BUTTONCHANGE.CAPTION=Change
  • trunk/Forms/ULoginForm.pas

    r25 r27  
    1919    ComboBoxConnection: TComboBox;
    2020    EditUserName: TEdit;
     21    EditPassword: TEdit;
    2122    Image1: TImage;
    2223    Label1: TLabel;
    2324    Label2: TLabel;
    2425    Label3: TLabel;
    25     MaskEditPassword: TMaskEdit;
    2626    procedure ButtonCancelClick(Sender: TObject);
    2727    procedure ButtonChangeClick(Sender: TObject);
     
    4949  Core.LastUserName := EditUserName.Text;
    5050  Core.LastProfile := ComboBoxConnection.ItemIndex;
    51   Core.LastPassword := MaskEditPassword.Text;
     51  Core.LastPassword := EditPassword.Text;
    5252end;
    5353
     
    6060begin
    6161  MainForm.PersistentForm.Load(Self);
     62  EditUserName.Text := Core.LastUserName;
     63  EditPassword.Text := '';
     64  Core.Profiles.FillStrings(ComboBoxConnection.Items);
    6265  ComboBoxConnection.ItemIndex := Core.LastProfile;
    63   EditUserName.Text := Core.LastUserName;
    64   MaskEditPassword.Text := '';
    65   Core.Profiles.FillStrings(ComboBoxConnection.Items);
     66  if (ComboBoxConnection.Items.Count > 0) and
     67    (ComboBoxConnection.ItemIndex = -1) then ComboBoxConnection.ItemIndex := 0;
    6668end;
    6769
     
    7577  if LoginProfileForm.ShowModal = mrOk then begin
    7678    Core.Profiles.FillStrings(ComboBoxConnection.Items);
     79    Core.LastProfile := ComboBoxConnection.ItemIndex;
     80    ComboBoxConnection.ItemIndex := Core.LastProfile;
     81    if (ComboBoxConnection.Items.Count > 0) and
     82      (ComboBoxConnection.ItemIndex = -1) then ComboBoxConnection.ItemIndex := 0;
    7783  end;
    7884end;
  • trunk/Forms/ULoginProfileForm.lfm

    r25 r27  
    149149    Top = 312
    150150    Width = 75
     151    Anchors = [akTop, akRight]
    151152    Caption = 'Cancel'
    152153    ModalResult = 2
  • trunk/Forms/ULoginProfileForm.pas

    r25 r27  
    1010
    1111type
    12   TConnectProtocol = (cpXMLRPC);
     12  TConnectProtocol = (cpXMLRPC, cpDirect);
    1313
    1414  { TConnectProfile }
     
    155155procedure TLoginProfileForm.ButtonAddClick(Sender: TObject);
    156156begin
    157   TConnectProfile(ProfileList.AddNew(TConnectProfile.Create));
     157  ProfileList.AddNew(TConnectProfile.Create);
    158158  ListBox1.Items.AddObject(TConnectProfile(ProfileList.Last).Name,
    159159    TConnectProfile(ProfileList.Last));
     
    183183  ProfileList.Assign(Core.Profiles);
    184184  ProfileList.FillStrings(ListBox1.Items);
     185  ListBox1.ItemIndex := Core.LastProfile;
     186  if (ListBox1.Items.Count > 0) and
     187    (ListBox1.ItemIndex = -1) then ListBox1.ItemIndex := 0;
    185188end;
    186189
     
    218221      OpenKey(AKey + '\ConnectProfile\' + IntToStr(I), True);
    219222      with TConnectProfile(AddNew(TConnectProfile.Create)) do begin
    220         HostName := ReadStringWithDefault('HostName', 'localhost');
    221         Port := ReadIntegerWithDefault('Port', 8090);
    222         Database := ReadStringWithDefault('Database', 'database');
    223         Protocol := TConnectProtocol(ReadIntegerWithDefault('Protocol', 0));
    224         UserName := ReadStringWithDefault('UserName', 'admin');
     223        Name := ReadStringWithDefault('Name', Name);
     224        HostName := ReadStringWithDefault('HostName', HostName);
     225        Port := ReadIntegerWithDefault('Port', Port);
     226        Database := ReadStringWithDefault('Database', Database);
     227        Protocol := TConnectProtocol(ReadIntegerWithDefault('Protocol', Integer(Protocol)));
     228        UserName := ReadStringWithDefault('UserName', UserName);
    225229      end;
    226230    end;
     
    242246      OpenKey(AKey + '\ConnectProfile\' + IntToStr(I), True);
    243247      with TConnectProfile(Items[I]) do begin
     248        WriteString('Name', Name);
    244249        WriteString('HostName', HostName);
    245250        WriteInteger('Port', Port);
  • trunk/Forms/UMainForm.lfm

    r25 r27  
    11object MainForm: TMainForm
    2   Left = 271
     2  Left = 307
    33  Height = 446
    4   Top = 159
     4  Top = 126
    55  Width = 640
    66  ActiveControl = Panel1
     
    88  ClientHeight = 427
    99  ClientWidth = 640
     10  Icon.Data = {
     11    BE1000000000010001002020000001002000A810000016000000280000002000
     12    0000400000000100200000000000001000006400000064000000000000000000
     13    0000000000000000000000000000000000000000000000000000000000000000
     14    0000000000000000000000000000000000000000000000000000000000000000
     15    0000000000000000000000000000000000000000000000000000000000000000
     16    0000000000000000000000000000000000000000000000000000000000000000
     17    00000000000000000000000000000000000000000000D6D2ABFFB7B06CFFB5AE
     18    66FFB9B370FFCFCA9CFF00000000000000000000000000000000000000000000
     19    0000000000000000000000000000000000000000000000000000E8E1B3FFDDD4
     20    91FFDDD491FFE4DDA7FF00000000000000000000000000000000000000000000
     21    000000000000000000000000000000000000A0963BFF877C09FF837700FF8377
     22    00FF837700FF847801FF978C29FFCDC999FF0000000000000000000000000000
     23    000000000000000000000000000000000000E3DBA4FFD3C86EFFD2C66AFFD2C6
     24    6AFFD2C66AFFD2C66AFFD4C871FFE0D89AFF0000000000000000000000000000
     25    00000000000000000000000000008F8418FF837700FF837700FF867A06FF877C
     26    09FF877B08FF847801FF837700FF877B07FFBAB371FF00000000000000000000
     27    0000000000000000000000000000DFD798FFD2C66AFFD2C66AFFD2C66AFFD5CA
     28    74FFD5CA74FFD2C86DFFD2C66AFFD2C66AFFDAD188FF00000000000000000000
     29    000000000000000000009A9030FF837700FF837700FFAAA251FF000000000000
     30    000000000000B2AA61FF857904FF837700FF857904FFBAB371FF000000000000
     31    00000000000000000000DED594FFD2C66AFFD2C66AFFD6CB79FF000000000000
     32    00000000000000000000DBD189FFD2C66AFFD2C66AFFE3DBA4FF000000000000
     33    000000000000BDB678FF847801FF847801FFAFA75CFF00000000000000000000
     34    00000000000000000000C0BA7DFF887C0AFF837700FF948A23FF000000000000
     35    000000000000DFD697FFD2C66AFFD2C66AFFD8CD7EFF00000000000000000000
     36    0000000000000000000000000000DAD085FFD2C66AFFD4C871FF000000000000
     37    000000000000998E2DFF837700FF8A7E0EFF0000000000000000000000000000
     38    0000000000000000000000000000CBC695FF9A9030FF00000000000000000000
     39    0000E0D89AFFD2C66AFFD2C66AFFD8CE81FF0000000000000000000000000000
     40    000000000000000000000000000000000000D2C66CFFD2C66AFF000000000000
     41    00000000000090851AFF837700FF988E2CFF0000000000000000000000000000
     42    000000000000000000000000000000000000000000000000000000000000E0D7
     43    9AFFD2C66AFFD2C66AFFD7CC7CFF000000000000000000000000000000000000
     44    000000000000000000000000000000000000D3C76DFFD2C66AFFDED594FF0000
     45    00000000000092871FFF837700FF91861CFF0000000000000000000000000000
     46    0000000000000000000000000000000000000000000000000000DED695FFD2C6
     47    6AFFD2C66AFFD6CA77FF00000000000000000000000000000000000000000000
     48    000000000000000000000000000000000000D5CA74FFD2C66AFFDED695FF0000
     49    000000000000A29941FF837700FF867A06FF0000000000000000000000000000
     50    00000000000000000000000000000000000000000000DED594FFD2C66AFFD2C6
     51    6AFFD7CC7CFF0000000000000000000000000000000000000000000000000000
     52    000000000000000000000000000000000000D3C76DFFD2C66AFF000000000000
     53    000000000000C2BD84FF847801FF837700FF968C29FF00000000000000000000
     54    000000000000000000000000000000000000DFD798FFD2C66AFFD2C66AFFD8CE
     55    81FF0000000000000000C9C490FFBEB87BFF0000000000000000000000000000
     56    0000000000000000000000000000D5CA74FFD2C66AFFD7CC7CFF000000000000
     57    000000000000000000009F9539FF837700FF837700FF9D9436FF000000000000
     58    0000000000000000000000000000E0D89AFFD2C66AFFD2C66AFFD8CE7FFF0000
     59    000000000000D1CCA1FF897D0BFF877B08FFBCB575FF00000000000000000000
     60    00000000000000000000D6CB79FFD2C66AFFD2C66CFFE7E1B1FF000000000000
     61    00000000000000000000000000009A9030FF837700FF837700FF9E9538FF0000
     62    00000000000000000000E2DAA0FFD2C66AFFD2C66AFFD6CC7AFF000000000000
     63    000000000000CFCA9CFF877B07FF837700FF867A06FFBBB473FF000000000000
     64    000000000000D9CF82FFD2C66AFFD2C66AFFE0D79AFF00000000000000000000
     65    000000000000000000000000000000000000978C29FF837700FF837700FF9B91
     66    31FF000000000000000000000000D7CC7CFFD6CB79FF00000000000000000000
     67    00000000000000000000CBC695FF877B07FF837700FF857A05FFBAB471FF0000
     68    00000000000000000000D2C66CFFDED594FF0000000000000000000000000000
     69    00000000000000000000000000000000000000000000978C29FF837700FF8377
     70    00FF968C27FF0000000000000000000000000000000000000000000000000000
     71    0000000000000000000000000000CBC695FF897D0DFF837700FF847801FFB7B0
     72    6CFF000000000000000000000000000000000000000000000000000000000000
     73    00000000000000000000000000000000000000000000000000009D9335FF8377
     74    00FF837700FF9B9131FF00000000000000000000000000000000000000000000
     75    000000000000000000000000000000000000CBC695FF8A7E0EFF837700FF8579
     76    04FFB2AA61FF0000000000000000000000000000000000000000000000000000
     77    0000000000000000000000000000000000000000000000000000000000009C93
     78    34FF837700FF837700FF9E9538FF000000000000000000000000000000000000
     79    00000000000000000000000000000000000000000000D1CCA1FF8E8215FF8377
     80    00FF857904FFB2AA61FF00000000000000000000000000000000000000000000
     81    0000000000000000000000000000000000000000000000000000000000000000
     82    0000988E2CFF837700FF837700FF9D9436FF0000000000000000000000000000
     83    0000000000000000000000000000EBE6C0FF000000000000000000000000887D
     84    0CFF837700FF857903FFB0A85DFF000000000000000000000000000000000000
     85    000000000000000000000000000000000000D4C871FFD5CA74FF000000000000
     86    000000000000978C29FF837700FF837700FF978C29FF00000000000000000000
     87    00000000000000000000E6DFADFFD3C76DFFD8CD7EFF00000000000000000000
     88    00008E8215FF837700FF847801FFAEA659FF0000000000000000000000000000
     89    0000000000000000000000000000D5CA74FFD2C66AFFD2C66AFFE7E1B1FF0000
     90    000000000000000000009A9030FF837700FF837700FF988E2CFF000000000000
     91    000000000000E7E1B1FFD3C76DFFD2C66AFFD5CA74FF00000000000000000000
     92    00000000000091861CFF837700FF847801FFB0A85DFF00000000000000000000
     93    00000000000000000000DCD38DFFD2C66AFFD2C66AFFE5DEAAFF000000000000
     94    00000000000000000000000000009D9335FF837801FF9B9131FF000000000000
     95    0000E7E1B1FFD3C86EFFD2C66AFFD5CA74FF0000000000000000000000000000
     96    000000000000000000008F8418FF837700FF857903FFC2BC81FF000000000000
     97    00000000000000000000D2C66AFFD2C66AFFE2DAA0FF00000000000000000000
     98    000000000000000000000000000000000000ACA455FF0000000000000000E7E1
     99    B1FFD3C86EFFD2C66AFFD4C871FF000000000000000000000000000000000000
     100    00000000000000000000D2CEA3FF857A05FF837700FF938921FF000000000000
     101    000000000000DBD38CFFD2C66AFFD4C871FF0000000000000000000000000000
     102    0000000000000000000000000000000000000000000000000000E6E0B0FFD3C8
     103    6EFFD2C66AFFD2C66CFF00000000000000000000000000000000000000000000
     104    0000000000000000000000000000B0A85DFF837700FF837700FFCEC99BFF0000
     105    000000000000D7CC7CFFD2C66AFFD7CC7CFF0000000000000000000000000000
     106    00000000000000000000000000000000000000000000E5DEADFFD2C66CFFD2C6
     107    6AFFD5C973FF0000000000000000000000000000000000000000000000000000
     108    000000000000000000000000000000000000867A06FF837700FFB3AB64FF0000
     109    000000000000D7CC7CFFD2C66AFFDAD085FF0000000000000000000000000000
     110    000000000000000000000000000000000000E6DFB0FFD3C76DFFD2C66AFFD5CA
     111    74FF000000000000000000000000000000000000000000000000000000000000
     112    000000000000000000000000000000000000877B08FF837700FFB6AF68FF0000
     113    000000000000DACF84FFD2C66AFFD5CA74FF0000000000000000000000000000
     114    0000000000000000000000000000E7E1B1FFD3C86EFFD2C66AFFD5CA74FF0000
     115    00000000000000000000AFA85CFF988E2BFF0000000000000000000000000000
     116    0000000000000000000000000000C4BE86FF847801FF847801FF000000000000
     117    000000000000EAE5BCFFD2C66AFFD2C66AFFE9E4B9FF00000000000000000000
     118    00000000000000000000E7E1B1FFD3C86EFFD2C66AFFD3C76DFF000000000000
     119    000000000000B9B471FF837700FF837700FF958A25FF00000000000000000000
     120    00000000000000000000000000008F8418FF837700FF90851AFF000000000000
     121    00000000000000000000DAD085FFD2C66AFFD2C66AFFE1D99CFF000000000000
     122    000000000000E0D89AFFD2C66AFFD2C66AFFD3C870FF00000000000000000000
     123    00000000000000000000978C29FF837700FF837700FF8F8418FFC7C28CFF0000
     124    000000000000C8C38EFF8C8113FF837700FF837700FFBDB678FF000000000000
     125    0000000000000000000000000000D8CD7EFFD2C66AFFD2C66AFFD3C86EFFD4C8
     126    6FFFD3C76DFFD2C66AFFD2C66AFFD5CA74FF0000000000000000000000000000
     127    00000000000000000000000000009F9539FF847801FF837700FF857904FF877C
     128    09FF877C09FF857904FF837700FF837700FFA69D48FF00000000000000000000
     129    000000000000000000000000000000000000DBD38CFFD2C66CFFD2C66AFFD2C6
     130    6AFFD2C66AFFD2C66AFFD7CC7CFFEBE5BDFF0000000000000000000000000000
     131    000000000000000000000000000000000000BAB371FF938921FF837700FF8377
     132    00FF837700FF837700FF8A7E0EFFBDB678FF0000000000000000000000000000
     133    0000000000000000000000000000000000000000000000000000E6DFADFFE3DC
     134    A5FFEBE6BEFF0000000000000000000000000000000000000000000000000000
     135    000000000000000000000000000000000000000000000000000000000000B7B0
     136    6CFFB5AE66FFC2BC81FF00000000000000000000000000000000000000000000
     137    0000000000000000000000000000000000000000000000000000000000000000
     138    0000000000000000000000000000000000000000000000000000000000000000
     139    0000000000000000000000000000000000000000000000000000000000000000
     140    0000000000000000000000000000000000000000000000000000000000000000
     141    0000000000000000000000000000000000000000000000000000000000000000
     142    0000000000000000000000000000000000000000000000000000000000000000
     143    0000000000000000000000000000000000000000000000000000000000000000
     144    0000000000000000000000000000000000000000000000000000000000000000
     145    0000
     146  }
    10147  Menu = MainMenu1
    11148  OnClose = FormClose
     
    189326      Caption = 'About'
    190327      OnExecute = AAboutExecute
     328    end
     329    object ADisconnect: TAction
     330      Caption = 'Disconnect'
     331      OnExecute = ADisconnectExecute
    191332    end
    192333  end
     
    323464        OnClick = MenuItem17Click
    324465      end
     466      object MenuItem22: TMenuItem
     467        Action = ADisconnect
     468      end
    325469      object MenuItem14: TMenuItem
    326470        Action = AExit
  • trunk/Forms/UMainForm.lrt

    r25 r27  
    2121TMAINFORM.AIMPORTSTRUCTURE.CAPTION=Import structure...
    2222TMAINFORM.AABOUT.CAPTION=About
     23TMAINFORM.ADISCONNECT.CAPTION=Disconnect
    2324TMAINFORM.MENUITEM13.CAPTION=Server
    2425TMAINFORM.MENUITEM11.CAPTION=View
  • trunk/Forms/UMainForm.pas

    r25 r27  
    1818    AConnect: TAction;
    1919    AAbout: TAction;
     20    ADisconnect: TAction;
    2021    AImportStructure: TAction;
    2122    AInitSystemValues: TAction;
     
    5556    MenuItem20: TMenuItem;
    5657    MenuItem21: TMenuItem;
     58    MenuItem22: TMenuItem;
    5759    MenuItem3: TMenuItem;
    5860    MenuItem4: TMenuItem;
     
    7173    procedure AAboutExecute(Sender: TObject);
    7274    procedure AConnectExecute(Sender: TObject);
     75    procedure ADisconnectExecute(Sender: TObject);
    7376    procedure AExitExecute(Sender: TObject);
    7477    procedure AImportStructureExecute(Sender: TObject);
     
    111114    TreeState: TTreeState;
    112115    Report: TReport;
     116    procedure UpdateInterface;
    113117    procedure LoadTree;
    114118    procedure LoadItemList;
     
    130134uses
    131135  UItemView, UItemEdit, UItemAdd, ULoginForm, USettingForm, UApplicationInfo,
    132   UCore, UImportStructureForm, UAboutForm, ULoginProfileForm;
     136  UCore, UImportStructureForm, UAboutForm, ULoginProfileForm, UChronisClientDirect;
    133137
    134138{$R *.lfm}
     
    507511end;
    508512
     513procedure TMainForm.UpdateInterface;
     514begin
     515  ADisconnect.Enabled := Core.System.Database.Connected;
     516  AConnect.Enabled := not Core.System.Database.Connected;
     517  AInitSystemValues.Enabled := Core.System.Database.Connected;
     518  AImportStructure.Enabled := Core.System.Database.Connected;
     519end;
     520
    509521procedure TMainForm.FormCreate(Sender: TObject);
    510522begin
     
    639651      Core.System.Database.UserName := Core.LastUserName;
    640652      Core.System.Database.Password := Core.LastPassword;
     653      Core.System.Database.Port := Port;
     654      if Protocol = cpDirect then Core.Client := TChronisClientDirect.Create;
     655    end;
     656    try
    641657      Core.System.Database.Connect;
    642     end;
    643     InitStructure;
    644     Core.System.LoadTypes;
    645     LoadTree;
    646   end;
     658      InitStructure;
     659      Core.System.LoadTypes;
     660      LoadTree;
     661    except
     662      on E:Exception do ShowMessage(E.Message);
     663    end;
     664  end;
     665end;
     666
     667procedure TMainForm.ADisconnectExecute(Sender: TObject);
     668begin
     669  Core.System.Database.Disconnect;
     670  TreeView1.Items.Clear;
     671  ListView1.Items.Clear;
     672  Core.System.Types.Clear;
     673  FreeAndNil(Core.Client);
    647674end;
    648675
  • trunk/Forms/USettingForm.lfm

    r22 r27  
    1010  OnShow = FormShow
    1111  LCLVersion = '0.9.31'
    12   object Label1: TLabel
    13     Left = 8
    14     Height = 14
    15     Top = 8
    16     Width = 78
    17     Caption = 'Server address:'
    18     ParentColor = False
    19   end
    20   object Edit1: TEdit
    21     Left = 116
    22     Height = 21
    23     Top = 8
    24     Width = 252
    25     TabOrder = 0
    26   end
    2712  object ButtonSave: TButton
    2813    Left = 362
     
    3318    Caption = 'Save'
    3419    ModalResult = 1
    35     TabOrder = 1
     20    TabOrder = 0
    3621  end
    3722  object ButtonCancel: TButton
     
    4328    Caption = 'Cancel'
    4429    ModalResult = 2
    45     TabOrder = 2
     30    TabOrder = 1
    4631  end
    4732  object Label2: TLabel
     
    5944    Width = 132
    6045    ItemHeight = 13
    61     TabOrder = 3
     46    TabOrder = 2
    6247  end
    6348end
  • trunk/Forms/USettingForm.lrt

    r18 r27  
    11TSETTINGFORM.CAPTION=Settings
    2 TSETTINGFORM.LABEL1.CAPTION=Server address:
    32TSETTINGFORM.BUTTONSAVE.CAPTION=Save
    43TSETTINGFORM.BUTTONCANCEL.CAPTION=Cancel
  • trunk/Forms/USettingForm.pas

    r12 r27  
    1717    ButtonCancel: TButton;
    1818    ComboBoxLanguage: TComboBox;
    19     Edit1: TEdit;
    20     Label1: TLabel;
    2119    Label2: TLabel;
    2220    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
Note: See TracChangeset for help on using the changeset viewer.