Changeset 10 for trunk/Forms


Ignore:
Timestamp:
Jun 9, 2011, 9:33:21 AM (13 years ago)
Author:
george
Message:
  • Added: Application meta information.
  • Added: Empty settings form.
  • Modified: Server connect configuration is now stored in system registry.
Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        33chronis
        44heaptrclog.trc
         5chronis.exe
  • trunk/Forms/ULoginForm.lfm

    r7 r10  
    99  ClientHeight = 177
    1010  ClientWidth = 405
    11   LCLVersion = '0.9.29'
     11  LCLVersion = '0.9.31'
    1212  object Label1: TLabel
    1313    Left = 16
    1414    Height = 14
    1515    Top = 48
    16     Width = 61
     16    Width = 53
    1717    Caption = 'Username:'
    1818    ParentColor = False
     
    2222    Height = 14
    2323    Top = 80
    24     Width = 57
     24    Width = 51
    2525    Caption = 'Password:'
    2626    ParentColor = False
     
    4444  object Edit1: TEdit
    4545    Left = 88
    46     Height = 23
     46    Height = 21
    4747    Top = 40
    4848    Width = 104
     
    5151  object MaskEdit1: TMaskEdit
    5252    Left = 88
    53     Height = 23
     53    Height = 21
    5454    Top = 71
    5555    Width = 104
  • trunk/Forms/ULoginForm.lrt

    r7 r10  
    1 TLOGINFORM.LOGINFORM.CAPTION=Login
     1TLOGINFORM.CAPTION=Login
    22TLOGINFORM.LABEL1.CAPTION=Username:
    33TLOGINFORM.LABEL2.CAPTION=Password:
    44TLOGINFORM.BUTTONCANCEL.CAPTION=Close
    55TLOGINFORM.BUTTONLOGIN.CAPTION=Login
     6TLOGINFORM.MASKEDIT1.TEXT=*
  • trunk/Forms/UMainForm.lfm

    r9 r10  
    11object MainForm: TMainForm
    2   Left = 255
    3   Height = 445
    4   Top = 75
    5   Width = 649
     2  Left = 268
     3  Height = 451
     4  Top = 156
     5  Width = 646
    66  ActiveControl = Panel1
    77  Caption = 'ChronIS'
    8   ClientHeight = 418
    9   ClientWidth = 649
     8  ClientHeight = 432
     9  ClientWidth = 646
    1010  Menu = MainMenu1
    1111  OnClose = FormClose
     
    1313  OnDestroy = FormDestroy
    1414  OnShow = FormShow
    15   LCLVersion = '0.9.29'
     15  LCLVersion = '0.9.31'
    1616  object Panel1: TPanel
    1717    Left = 0
    18     Height = 418
     18    Height = 432
    1919    Top = 0
    2020    Width = 184
    2121    Align = alLeft
    2222    BevelOuter = bvNone
    23     ClientHeight = 418
     23    ClientHeight = 432
    2424    ClientWidth = 184
    2525    TabOrder = 0
    2626    object Label1: TLabel
    2727      Left = 7
    28       Height = 18
     28      Height = 14
    2929      Top = 4
    30       Width = 51
     30      Width = 39
    3131      Caption = 'Groups:'
    3232      ParentColor = False
     
    3434    object TreeView1: TTreeView
    3535      Left = 4
    36       Height = 394
     36      Height = 408
    3737      Top = 19
    3838      Width = 180
    3939      Anchors = [akTop, akLeft, akRight, akBottom]
    40       DefaultItemHeight = 19
     40      DefaultItemHeight = 16
    4141      Images = ImageListActions
    4242      ReadOnly = True
     
    4848  object Panel2: TPanel
    4949    Left = 189
    50     Height = 418
     50    Height = 432
    5151    Top = 0
    52     Width = 460
     52    Width = 457
    5353    Align = alClient
    5454    BevelOuter = bvNone
    55     ClientHeight = 418
    56     ClientWidth = 460
     55    ClientHeight = 432
     56    ClientWidth = 457
    5757    TabOrder = 1
    5858    object Label2: TLabel
    5959      Left = 2
    60       Height = 18
     60      Height = 14
    6161      Top = 4
    62       Width = 54
     62      Width = 43
    6363      Caption = 'Reports:'
    6464      ParentColor = False
     
    6666    object ListView1: TListView
    6767      Left = 2
    68       Height = 362
     68      Height = 376
    6969      Top = 19
    70       Width = 456
     70      Width = 453
    7171      Anchors = [akTop, akLeft, akRight, akBottom]
    7272      Columns = <>
     
    8686      Left = 3
    8787      Height = 25
    88       Top = 389
     88      Top = 403
    8989      Width = 75
    9090      Action = AItemAdd
     
    9595      Left = 83
    9696      Height = 25
    97       Top = 389
     97      Top = 403
    9898      Width = 75
    9999      Action = AItemDelete
     
    104104  object Splitter1: TSplitter
    105105    Left = 184
    106     Height = 418
     106    Height = 432
    107107    Top = 0
    108108    Width = 5
     
    166166      OnExecute = AToggleFullscreenExecute
    167167      ShortCut = 122
     168    end
     169    object AConnect: TAction
     170      Caption = 'Connect'
     171      Hint = 'Connect'
     172      OnExecute = AConnectExecute
     173    end
     174    object ASettings: TAction
     175      Caption = 'Settings'
     176      Hint = 'Settings'
     177      OnExecute = ASettingsExecute
    168178    end
    169179  end
     
    296306    object MenuItem13: TMenuItem
    297307      Caption = 'Server'
     308      object MenuItem17: TMenuItem
     309        Action = AConnect
     310      end
    298311      object MenuItem14: TMenuItem
    299312        Action = AExit
     
    305318        Action = AToggleFullscreen
    306319      end
     320      object MenuItem16: TMenuItem
     321        Action = ASettings
     322      end
    307323    end
    308324    object MenuItem12: TMenuItem
  • trunk/Forms/UMainForm.lrt

    r7 r10  
    1 TMAINFORM.MAINFORM.CAPTION=ChronIS
     1TMAINFORM.CAPTION=ChronIS
    22TMAINFORM.LABEL1.CAPTION=Groups:
    33TMAINFORM.LABEL2.CAPTION=Reports:
     
    1414TMAINFORM.AEXIT.CAPTION=Exit
    1515TMAINFORM.ATOGGLEFULLSCREEN.CAPTION=Fullscreen mode
     16TMAINFORM.ACONNECT.CAPTION=Connect
     17TMAINFORM.ACONNECT.HINT=Connect
     18TMAINFORM.ASETTINGS.CAPTION=Settings
     19TMAINFORM.ASETTINGS.HINT=Settings
    1620TMAINFORM.MENUITEM13.CAPTION=Server
    1721TMAINFORM.MENUITEM11.CAPTION=View
  • trunk/Forms/UMainForm.pas

    r9 r10  
    1717
    1818  TMainForm = class(TForm)
     19    AConnect: TAction;
     20    ASettings: TAction;
    1921    AToggleFullscreen: TAction;
    2022    AExit: TAction;
     
    4446    MenuItem14: TMenuItem;
    4547    MenuItem15: TMenuItem;
     48    MenuItem16: TMenuItem;
     49    MenuItem17: TMenuItem;
    4650    MenuItem2: TMenuItem;
    4751    MenuItem3: TMenuItem;
     
    5963    Splitter1: TSplitter;
    6064    TreeView1: TTreeView;
     65    procedure AConnectExecute(Sender: TObject);
    6166    procedure AExitExecute(Sender: TObject);
    6267    procedure AItemAddExecute(Sender: TObject);
     
    6671    procedure AObjectGroupAddGroupExecute(Sender: TObject);
    6772    procedure AObjectGroupEditExecute(Sender: TObject);
     73    procedure ASettingsExecute(Sender: TObject);
    6874    procedure AToggleFullscreenExecute(Sender: TObject);
    6975    procedure ButtonAddClick(Sender: TObject);
     
    8591    RegistryKey: string;
    8692    RegistryRootKey: HKEY;
    87     procedure LoadConfiguration;
    8893    procedure LoadFromRegistry;
    8994    procedure SaveToRegistry;
     95    procedure InitStructure;
    9096  public
    9197    SelectedObjectId: Integer;
     
    112118
    113119uses
    114   UItemView, UItemEdit, UItemAdd;
     120  UItemView, UItemEdit, UItemAdd, ULoginForm, USettingForm, UApplicationInfo;
    115121
    116122{$R *.lfm}
    117123
    118124{ TMainForm }
    119 
    120 procedure TMainForm.LoadConfiguration;
    121 var
    122   Config: TXMLDocument;
    123   I1: Integer;
    124   I2: Integer;
    125   I3: Integer;
    126 begin
    127   if FileExists(ConfigFileName) then try
    128     ReadXMLFile(Config, ConfigFileName);
    129     for I1 := 0 to Config.ChildNodes.Count - 1 do
    130     with Config.ChildNodes[I1] do begin
    131       if NodeName = 'configuration' then
    132       for I2 := 0 to ChildNodes.Count - 1 do
    133       with ChildNodes[I2] do begin
    134         if NodeName = 'database' then
    135         for I3 := 0 to ChildNodes.Count - 1 do
    136         with ChildNodes[I3] do begin
    137           if NodeName = 'hostname' then
    138             System.Database.HostName := TextContent;
    139           if NodeName = 'schema' then
    140             System.Database.Database := TextContent;
    141           if NodeName = 'username' then
    142             System.Database.UserName := TextContent;
    143           if NodeName = 'password' then
    144             System.Database.Password := TextContent;
    145         end;
    146       end;
    147     end;
    148   finally
    149     Config.Free;
    150   end;
    151 end;
    152125
    153126procedure TMainForm.LoadFromRegistry;
     
    158131    OpenKey(RegistryKey, True);
    159132    Panel1.Width := ReadIntegerWithDefault('GroupTreeWidth', 200);
     133    System.Database.Database := ReadStringWithDefault('DatabaseSchema', 'chronis');
     134    System.Database.Hostname := ReadStringWithDefault('DatabaseHostName', 'localhost');
     135    System.Database.UserName := ReadStringWithDefault('DatabaseUserName', 'chronis');
     136    System.Database.Password := ReadStringWithDefault('DatabasePassword', '');
    160137  finally
    161138    Free;
     
    170147    OpenKey(RegistryKey, True);
    171148    WriteInteger('GroupTreeWidth', Panel1.Width);
     149    WriteString('DatabaseSchema', System.Database.Database);
     150    WriteString('DatabaseHostName', System.Database.Hostname);
     151    WriteString('DatabaseUserName', System.Database.UserName);
     152    WriteString('DatabasePassword', System.Database.Password);
    172153  finally
    173154    Free;
     
    175156end;
    176157
     158procedure TMainForm.InitStructure;
     159begin
     160
     161end;
     162
    177163procedure TMainForm.FormCreate(Sender: TObject);
    178164begin
    179165  System := TChronisBase.Create;
    180166  System.Database := TSqlDatabase.Create;
    181   LoadConfiguration;
    182   System.Database.Connect;
    183167  TreeState := TTreeState.Create;
    184168  Report := TReport.Create;
     
    187171  SelectedObject.Base := System;
    188172  RegistryRootKey := HKEY_CURRENT_USER;
    189   RegistryKey := '\Software\Chronosoft\Chronis';
     173  RegistryKey := '\Software\' + ApplicationInfo.CompanyName + '\' +
     174    ApplicationInfo.Name;
    190175  PersistentForm := TPersistentForm.Create;
    191176  PersistentForm.RegistryKey := RegistryKey;
     
    237222    ItemEditForm.Show;
    238223  end;
     224end;
     225
     226procedure TMainForm.ASettingsExecute(Sender: TObject);
     227begin
     228  SettingForm.ShowModal;
    239229end;
    240230
     
    281271end;
    282272
     273procedure TMainForm.AConnectExecute(Sender: TObject);
     274begin
     275  LoginForm.ShowModal;
     276end;
     277
    283278procedure TMainForm.FormShow(Sender: TObject);
    284279begin
    285280  PersistentForm.Load(Self);
     281  LoadFromRegistry;
     282  System.Database.Connect;
     283  InitStructure;
    286284  LoadTree;
    287   LoadFromRegistry;
    288285end;
    289286
Note: See TracChangeset for help on using the changeset viewer.