Changeset 438
Author: nrymanov@gmail.com
(2010/02/05 08:53) About 2 years ago
see #29 - Редизайн и унификация пользовательского интерфейса
Author: nrymanov@gmail.com
(2010/02/05 08:53) About 2 years ago
see #29 - Редизайн и унификация пользовательского интерфейса
Height = 268Height = 200ExplicitHeight = 268ExplicitHeight = 200Height = 282Height = 290Constraints.MinHeight = 270Constraints.MinHeight = 290ExplicitHeight = 282ExplicitHeight = 290Width = 425Width = 432Margins.Right = 7Margins.Right = 14Top = 213Top = 219Width = 120Width = 432Width = 278Width = 425Height = 110Height = 116Caption = '111'110)116)Left = 147Left = 136Width = 214Width = 225Left = 147Left = 136Width = 214Width = 225Left = 147Left = 136Width = 214Width = 225Left = 147Left = 136Top = 90Top = 93Width = 221Width = 225object lblS1: TLabel [0]Height = 160Constraints.MinHeight = 160Constraints.MinWidth = 320ExplicitHeight = 160object lblStatus: TLabel [0]Left = 3Left = 14Top = 66Top = 63Width = 314Width = 292Margins.Top = 10Margins.Left = 14Margins.Bottom = 10Margins.Top = 7Margins.Right = 14Margins.Bottom = 0Alignment = taCenterCaption = #1055#1086#1076#1082#1083#1102#1095#1077#1085#1080#1077' ...'Caption = 'lblS1'ExplicitWidth = 86ExplicitWidth = 22object Bar: TRzProgressBar [1]Left = 11Left = 14Top = 99Top = 83Width = 298Width = 292Margins.Left = 11Height = 17Margins.Top = 10Margins.Left = 14Margins.Right = 11Margins.Top = 7Margins.Right = 14Margins.Bottom = 0BorderOuter = fsFlatRoundedTabOrder = 1BorderWidth = 0InteriorOffset = 0PartsComplete = 0Percent = 0ThemeAware = FalseTotalParts = 0ExplicitLeft = 14ExplicitTop = 92ExplicitWidth = 292Left = 240Left = 16Top = 168Top = 112{******************************************************************************}{ }{ MyHomeLib }{ }{ Version 0.9 }{ 20.08.2008 }{ Copyright (c) Aleksey Penkov alex.penkov@gmail.com }{ }{ @author Nick Rymanov nrymanov@gmail.com }{ }{******************************************************************************}{ TODO -oNickR -cBug : . . }IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, RzPrgres;lblS1: TLabel;lblStatus: TLabel;Bar: TRzProgressBar;procedure HTTPWorkBegin(ASender: TObject; AWorkMode: TWorkMode;AWorkCountMax: Int64);procedure HTTPWork(ASender: TObject; AWorkMode: TWorkMode;AWorkCount: Int64);procedure HTTPWorkEnd(ASender: TObject; AWorkMode: TWorkMode);{ Private declarations }FDownloadSize : Int64;FDownloadSize : Extended;{$R *.dfm}{$R *.dfm}{ TframeNCWDownload }{ TframeNCWDownload }lblS1.Caption := ' ...';lblStatus.Caption := ' ...';Bar.Percent := 0;Bar.Position := 0;Result := True;//--------------------------------Result := True;FTerminated := False;Responce := TMemoryStream.Create;procedure TframeNCWDownload.HTTPWork(ASender: TObject; AWorkMode: TWorkMode;procedure TframeNCWDownload.HTTPWorkBegin(ASender: TObject; AWorkMode: TWorkMode; AWorkCountMax: Int64);AWorkCount: Int64);beginBar.Position := 0;FDownloadSize := AWorkCountMax;FStartDate := Now;end;procedure TframeNCWDownload.HTTPWork(ASender: TObject; AWorkMode: TWorkMode; AWorkCount: Int64);KB : extended;KB : Int64;KB := AWorkCount / 1024;KB := AWorkCount div 1024;Bar.Percent:= round(KB / FDownloadSize * 100);Bar.Position := AWorkCount * 100 div FDownloadSize;lblS1.Caption := Format(' %d %d (%n /)', [round(KB), round(FDownloadSize), KB / ElapsedTime]);{ TODO -oNickR -cRefactoring : FormatSize }lblStatus.Caption := Format(' %d %d (%n /)',[KB, FDownloadSize div 1024, KB / ElapsedTime]);procedure TframeNCWDownload.HTTPWorkBegin(ASender: TObject;AWorkMode: TWorkMode; AWorkCountMax: Int64);beginBar.Percent := 0;FDownloadSize := AWorkCountMax / 1024;FStartDate := Now;end;lblS1.Caption := ' ';lblStatus.Caption := ' ';Width = 474Width = 460ExplicitWidth = 474ExplicitWidth = 460Width = 446Width = 432Width = 474Width = 460ExplicitWidth = 474ExplicitWidth = 460Width = 446Width = 432Width = 439Width = 425Width = 453Width = 439Width = 460Width = 446Constraints.MinWidth = 460460446Top = 3Top = 5Left = 147Left = 102Width = 225Width = 256Left = 378Left = 364Height = 342Height = 350Constraints.MinHeight = 240Constraints.MinHeight = 350ExplicitHeight = 342ExplicitHeight = 350Left = 18Left = 14Width = 294Width = 302Margins.Left = 18Margins.Left = 14Margins.Right = 18Margins.Right = 14Left = 18Left = 14Width = 294Width = 302Margins.Left = 18Margins.Left = 14Margins.Right = 18Margins.Right = 14Left = 18Left = 14Width = 294Width = 302Margins.Left = 18Margins.Left = 14Margins.Right = 18Margins.Right = 14Left = 18Left = 14Width = 294Width = 302Margins.Left = 18Margins.Left = 14Margins.Right = 18Margins.Right = 14{******************************************************************************}{ ****************************************************************************** }{ }{ }{ MyHomeLib }{ MyHomeLib }{ }{ }{ Version 0.9 }{ Version 0.9 }{ 20.08.2008 }{ 20.08.2008 }{ Copyright (c) Aleksey Penkov alex.penkov@gmail.com }{ Copyright (c) Aleksey Penkov alex.penkov@gmail.com }{ }{ }{ }{ }{******************************************************************************}{ ****************************************************************************** }Dialogs, frame_InteriorPageBase, StdCtrls, ExtCtrls, unit_StaticTip, unit_NCWParams,unit_NCWParams,FGroups : array of string;{$R *.dfm}{$R *.dfm}DefaultGroups : array [0..2] of string = (' Lib.rus.ec',' flibusta.net',' ');DefaultGroups: array [0 .. 2] of string = (' Lib.rus.ec', ' flibusta.net', ' ');DefaultCollections : array [0 .. 8] of TCollectionDesc = (DefaultCollections: array [0 .. 8] of TCollectionDesc =(Group: 0; Title: 'Lib.rus.ec [FB2]'; Desc: ' FB2 (fb2-xxxxxx-xxxxxx.zip)'; INPX: 'librusec.inpx'),((Group: 0; Title: 'Lib.rus.ec [USR]'; Desc: ' USR (usr-xxxxxx-xxxxxx.zip)'; INPX: 'librusec_usr.inpx'),(Group: 0; Title: 'Lib.rus.ec [FB2]'; Desc: ' FB2 (fb2-xxxxxx-xxxxxx.zip)'; INPX: 'librusec.inpx'),(Group: 0; Title: 'Lib.rus.ec [ALLBOOKS]'; Desc: ' (fb2-xxxxxx-xxxxxx.zip usr-xxxxxx-xxxxxx.zip)'; INPX: 'librusec_allbooks.inpx'),(Group: 0; Title: 'Lib.rus.ec [USR]'; Desc: ' USR (usr-xxxxxx-xxxxxx.zip)'; INPX: 'librusec_usr.inpx'),(Group: 0; Title: 'Lib.rus.ec [ALLBOOKS]'; Desc: ' (fb2-xxxxxx-xxxxxx.zip usr-xxxxxx-xxxxxx.zip)'; INPX: 'librusec_allbooks.inpx'),(Group: 1; Title: 'Flibusta OnLine [FB2]'; Desc: ' flibusta.net'; INPX: 'flibusta_online.inpx'),(Group: 2; Title: 'Traum 2.11 [FB2]'; Desc: ' 2.11'; INPX: 'Traum_2-11.inpx'),(Group: 2; Title: 'Traum 2.12 [FB2]'; Desc: ' 2.12'; INPX: 'Traum_2-12.inpx'),(Group: 2; Title: 'Traum 2.13 [FB2]'; Desc: ' 2.13 ( FB2)'; INPX: 'Traum_2-13_fb2.inpx'),(Group: 2; Title: 'Traum 2.13 [ALLBOOKS]'; Desc: ' 2.13 ()'; INPX: 'Traum_2-13_full.inpx'));I: Integer;I: integer;G : TListGroup;lvCollections.Groups.Clear;lvCollections.Items.Clear;for I := 0 to High(FGroups) dobeginG := lvCollections.Groups.Add;G.Header := FGroups[i];end;for I := 0 to High(FCollections) dolvCollections.Items.BeginUpdate;begintryItem := lvCollections.Items.Add;lvCollections.Groups.Clear;Item.Caption := FCollections[i].Title;lvCollections.Items.Clear;Item.GroupID := FCollections[i].Group;for I := 0 to High(FGroups) dobeginG := lvCollections.Groups.Add;G.Header := FGroups[I];end;for I := 0 to High(FCollections) dobeginItem := lvCollections.Items.Add;Item.Caption := FCollections[I].Title;Item.GroupID := FCollections[I].Group;end;finallylvCollections.Items.EndUpdate;i: Integer;I: integer;INIFile := TMemIniFile.Create(Settings.WorkPath + 'collections.ini');iniFile.ReadSection(INPX_GROUP_SECTION, sl);INIFile.ReadSection(INPX_SECTION, sl);////if sl.Count > 0 thenbeginSetLength(FGroups, sl.Count);SetLength(FCollections, sl.Count);for i := 0 to sl.Count - 1 doslHelper := TStringList.Create;if Pos(INPX_GROUP_KEY_PREFIX, sl[i]) = 1 thentryFGroups[i] := iniFile.ReadString(INPX_GROUP_SECTION, sl[i], '');slHelper.QuoteChar := '"';slHelper.Delimiter := ';';end // ifslHelper.StrictDelimiter := True;elsefor I := 0 to sl.Count - 1 dobegin//end;iniFile.ReadSection(INPX_SECTION, sl);//if sl.Count > 0 thenbeginSetLength(FCollections, sl.Count);slHelper := TStringList.Create;tryslHelper.QuoteChar := '"';slHelper.Delimiter := ';';slHelper.StrictDelimiter := True;for i := 0 to sl.Count - 1 dobeginif Pos(INPX_KEY_PREFIX, sl[i]) = 1 thenslHelper.DelimitedText := iniFile.ReadString(INPX_SECTION, sl[i], '');if Pos(INPX_KEY_PREFIX, sl[I]) = 1 thenif slHelper.Count > 4 thenFCollections[i].Group := StrToInt(slHelper[0]);slHelper.DelimitedText := INIFile.ReadString(INPX_SECTION, sl[I], '');FCollections[i].Title := slHelper[1];if slHelper.Count > 4 thenFCollections[i].Desc := slHelper[2];beginFCollections[i].Inpx := slHelper[3];FCollections[I].Group := StrToInt(slHelper[0]);FCollections[I].Title := slHelper[1];FCollections[I].Desc := slHelper[2];FCollections[I].INPX := slHelper[3];end;finallyend // ifslHelper.Free;elsebegin// inpx// SetLength(FCollections, 9);// FCollections := DefaultCollections;end // iffinallyelsesl.Free;begin// inpx// SetLength(FCollections, 9);// FCollections := DefaultCollections;sl.Free;INIFile.Free;IniFile.Free;procedure TframeNCWInpxSource.lvCollectionsChange(Sender: TObject; Item: TListItem; Change: TItemChange);Item: TListItem; Change: TItemChange);FPPArams^.INPXUrl := Settings.InpxURL + FCollections[Item.Index].INPX;FPParams^.INPXUrl := Settings.INPXUrl + FCollections[Item.Index].INPX;else pageHint.Caption := SERVERDOWNLOAD;pageHint.Caption := SERVERDOWNLOAD;Height = 214Height = 210Constraints.MinHeight = 190Constraints.MinHeight = 210ExplicitHeight = 214ExplicitHeight = 210Caption = '&'#1053#1086#1074#1072#1103' '#1087#1091#1089#1090#1072#1103' '#1082#1086#1083#1083#1077#1082#1094#1080#1103object Bar: TRzProgressBar [1]Left = 11Left = 14Top = 86Top = 83Width = 438Width = 432Margins.Left = 11Height = 17Margins.Top = 10Margins.Left = 14Margins.Right = 11Margins.Top = 7Margins.Right = 14Margins.Bottom = 0BorderOuter = fsFlatRoundedTabOrder = 3BorderWidth = 0InteriorOffset = 0PartsComplete = 0Percent = 0ThemeAware = FalseTotalParts = 0ExplicitLeft = 14ExplicitTop = 92ExplicitWidth = 292Top = 120Top = 107Height = 137Height = 150ExplicitTop = 107ExplicitHeight = 150unit_WorkerThread, unit_NCWParams, RzPrgres;Bar: TRzProgressBar;Result := [wbCancel, wbCancel];Bar.Percent := 0;Bar.Position := 0;Bar.Percent := Percent;Bar.Position := Percent;Left = 21Left = 28Left = 147Left = 105Width = 218Width = 260// FParams.CollectionType := ltEmpty;// FParams.CollectionType := ltEmpty;{ TODO -oAlex -cRefactoring : ! ? }{ TODO -oAlex -cRefactoring : ! ? }