Skip to content

Commit

Permalink
Fixed performance problems on startup while sorting the download list…
Browse files Browse the repository at this point in the history
  • Loading branch information
SDXC committed Sep 6, 2019
1 parent 0c13278 commit cec97bd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions baseunits/uDownloadsManager.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1114,9 +1114,6 @@ procedure TTaskContainer.SetEnabled(AValue: Boolean);
constructor TTaskContainer.Create;
begin
inherited Create;

if OptionSortDownloadsWhenAddingNewDownloadTasks then
DLManager.Sort(DLManager.SortColumn);

DlId := -1;
InitCriticalSection(CS_Container);
Expand Down
4 changes: 3 additions & 1 deletion baseunits/uSilentThread.pas
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface

uses
SysUtils, fgl, uBaseUnit, uData, uDownloadsManager,
WebsiteModules, FMDOptions, httpsendthread, BaseThread, LazFileUtils;
WebsiteModules, FMDOptions, httpsendthread, BaseThread, LazFileUtils, MultiLog;

type

Expand Down Expand Up @@ -185,6 +185,8 @@ procedure TSilentThreadManager.Add(AType: TMetaDataType;
finally
LeaveCriticalsection(FCS_META);
end;
if OptionSortDownloadsWhenAddingNewDownloadTasks then
DLManager.Sort(DLManager.SortColumn);
end;
end;

Expand Down
6 changes: 4 additions & 2 deletions mangadownloader/forms/frmMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2521,8 +2521,8 @@ procedure TMainForm.btDownloadClick(Sender: TObject);
CurrentDownloadChapterPtr:=0;
SaveToDB(newdl);
end;
if OptionSortDownloadsWhenAddingNewDownloadTasks then
DLManager.Sort(DLManager.SortColumn);
if OptionSortDownloadsWhenAddingNewDownloadTasks then
DLManager.Sort(DLManager.SortColumn);
end;
DLManager.DownloadedChapters.Chapters[mangaInfo.website+mangaInfo.link]:=links.Text;
FavoriteManager.AddToDownloadedChaptersList(mangaInfo.website,mangaInfo.link,links);
Expand Down Expand Up @@ -4067,7 +4067,9 @@ procedure TMainForm.vtDownloadDragDrop(Sender : TBaseVirtualTree;
vtDownloadMoveItems(vtDownload.DropTargetNode^.Index, Mode);
end
else
begin
AddSilentThread(frmDropTarget.GetDropURLs(DataObject), MD_DownloadAll);
end;
end;

procedure TMainForm.vtDownloadDragOver(Sender : TBaseVirtualTree;
Expand Down

0 comments on commit cec97bd

Please sign in to comment.