Changeset 793 for cprs/branches/tmg-cprs/CPRS-Chart/fImages.pas
- Timestamp:
- Jun 10, 2010, 3:13:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/tmg-cprs/CPRS-Chart/fImages.pas
r738 r793 126 126 function CreateBarcode(MsgStr: AnsiString; ImageType: AnsiString): AnsiString; 127 127 function DecodeBarcode(LocalFNamePath,ImageType: AnsiString): AnsiString; 128 procedure EnsureImagesDownloaded(ImagesList : TStringList); 128 129 published 129 130 end; … … 152 153 153 154 procedure TfrmImages.timLoadImagesTimer(Sender: TObject); 155 //This function's goal is to download images in the background, 156 // with one image to be downloaded each time the timer fires 154 157 begin 155 158 inherited; … … 185 188 186 189 190 procedure TfrmImages.EnsureImagesDownloaded(ImagesList : TStringList); 191 //This function's goal is to download images in the FOREground, 192 // But only images matching those passed in ImagesList will be downloaded; 193 // The intent is to only download images that have links to them in HTML source 194 //Thus, if note has a large amount of images attached to it, but not referenced 195 // in HTML code, then they will not be downloaded here. (But will be downloaded 196 // later via timLoadImagesTimer 197 var i : integer; 198 Rec : TImageInfo; 199 200 begin 201 if ImagesList.Count = 0 then exit; 202 GetImageList(); 203 if ImageInfoList.Count = 0 then exit; 204 if ImageInfoList.Count > 1 then begin 205 ImageTransferForm.ProgressMsg.Caption := 'Downloading Images'; 206 ImageTransferForm.ProgressBar.Min := 0; 207 ImageTransferForm.ProgressBar.Position := 0; 208 ImageTransferForm.ProgressBar.Max := ImageInfoList.Count-1; 209 ImageTransferForm.Show; 210 end; 211 for i := 0 to ImageInfoList.Count-1 do begin 212 ImageTransferForm.ProgressBar.Position := i; 213 Rec := TImageInfo(ImageInfoList[i]); 214 if ImagesList.IndexOf(Rec.ServerFName)>-1 then begin 215 DownloadToCache(i); 216 end; 217 end; 218 ImageTransferForm.Hide; 219 end; 220 221 187 222 { TPage common methods --------------------------------------------------------------------- } 188 223 procedure TfrmImages.mnuChartTabClick(Sender: TObject); … … 211 246 CurImageToLoad := 0; 212 247 CacheDir := ExtractFilePath(ParamStr(0))+ 'Cache'; 213 NullImageName := ExtractFilePath(ParamStr(0)) + 'images\blank.htm'; 248 //NullImageName := ExtractFilePath(ParamStr(0)) + 'images\blank.htm'; 249 NullImageName := 'about:blank'; 214 250 if not DirectoryExists(CacheDir) then ForceDirectories(CacheDir); 215 251 … … 563 599 RPCBrokerV.Param[2].Value := '1'; //see comments in UploadFile re '1' hardcoding 564 600 565 RPCBrokerV.Call; //Move file into dropbox. 566 Result := (Piece(RPCBrokerV.Results[0],'^',1)='1'); //1=success, 0=failure 601 //RPCBrokerV.Call; //Move file into dropbox. 602 CallBroker; 603 if RPCBrokerV.Results.Count>0 then begin 604 Result := (Piece(RPCBrokerV.Results[0],'^',1)='1'); //1=success, 0=failure 605 end else Result := false; 567 606 end; 568 607 … … 692 731 RPCBrokerV.Param[2].Value := '1'; //see comments in UploadFile re '1' hardcoding 693 732 694 RPCBrokerV.Call; //Move file into dropbox. 733 //RPCBrokerV.Call; //Move file into dropbox. 734 CallBroker; 695 735 if RPCBrokerV.Results.Count > 0 then begin 696 736 Result := (Piece(RPCBrokerV.Results[0],'^',1)='1'); //1=success, 0=failure … … 702 742 703 743 if Result=true then begin 744 if DirectoryExists(DropboxDir) = False then begin //elh added to ensure a dropbox directory is valid 745 MessageDlg('Invalid Dropbox Directory. Please check your settings and try again.',mtError,[mbOK],0); 746 ImageTransferForm.hide; 747 exit; 748 end; 704 749 CurrentFileSize := strtoint(Piece(RPCBrokerV.Results[0],'^',3)); //Piece 3 = file size 705 750 DropboxFile := ExcludeTrailingBackslash(DropboxDir) + '\' + FName; … … 1080 1125 RPCBrokerV.Param[1].PType := list; 1081 1126 RPCBrokerV.Param[1].Mult['"IMAGE TYPE"'] := ImageType; 1082 RPCBrokerV.Call; 1127 //RPCBrokerV.Call; 1128 CallBroker; 1083 1129 1084 1130 Application.ProcessMessages;
Note:
See TracChangeset
for help on using the changeset viewer.