added option to vacuum databases on exit. default false. previously always true.

This commit is contained in:
dazedcat19 2020-09-22 13:11:01 +08:00
parent 4dd8041d1c
commit 2e70501ce8
16 changed files with 119 additions and 45 deletions

View File

@ -272,6 +272,7 @@ type
property SortColumn: Integer read FSortColumn write FSortColumn;
property TransferRate: Integer read GetTransferRate;
property Task[const TaskId: Integer]: TTaskContainer read GetTask; default;
property DB: TDownloadsDB read FDownloadsDB;
end;
resourcestring
@ -1359,24 +1360,28 @@ begin
inherited Create;
InitCriticalSection(CS_Task);
InitCriticalSection(CS_ItemsActiveTask);
ForceDirectories(USERDATA_FOLDER);
DownloadedChapters := TDownloadedChaptersDB.Create;
DownloadedChapters.Filename := DOWNLOADEDCHAPTERSDB_FILE;
DownloadedChapters.OnError := @MainForm.ExceptionHandler;
DownloadedChapters.Open;
InitCriticalSection(CS_StatusCount);
Items := TTaskContainers.Create;
ItemsActiveTask := TTaskContainers.Create;
isFinishTaskAccessed := False;
isRunningBackup := False;
isRunningBackupDownloadedChaptersList := False;
isReadyForExit := False;
FUpdateOrderCount:=0;
InitCriticalSection(CS_StatusCount);
for ds := Low(StatusCount) to High(StatusCount) do
StatusCount[ds] := 0;
DisabledCount := 0;
Items := TTaskContainers.Create;
ItemsActiveTask := TTaskContainers.Create;
ForceDirectories(USERDATA_FOLDER);
DownloadedChapters := TDownloadedChaptersDB.Create;
DownloadedChapters.AutoVacuum:=False;
DownloadedChapters.Filename := DOWNLOADEDCHAPTERSDB_FILE;
DownloadedChapters.OnError := @MainForm.ExceptionHandler;
DownloadedChapters.Open;
FDownloadsDB := TDownloadsDB.Create(DOWNLOADSDB_FILE);
FDownloadsDB.Open(False, False);
end;

View File

@ -161,6 +161,7 @@ type
property isAuto: Boolean read FIsAuto write FIsAuto;
property isRunning: Boolean read FIsRunning write FIsRunning;
property Favorite[const Index: Integer]: TFavoriteContainer read GetFavorite; default;
property DB: TFavoritesDB read FFavoritesDB;
end;
resourcestring

View File

@ -1022,6 +1022,10 @@ msgstr "Remove duplicate local data when updating manga list"
msgid "Use proxy"
msgstr "Proxy benutzen"
#: tmainform.cboptionvacuumdatabasesonexit.caption
msgid "Vacuum databases on exit"
msgstr ""
#: tmainform.cbpngcompressionlevel.text
msgctxt "tmainform.cbpngcompressionlevel.text"
msgid "Fastest"

View File

@ -1014,6 +1014,10 @@ msgstr "Κατάργηση διπλότυπων τοπικών δεδομένω
msgid "Use proxy"
msgstr "Χρήση διακομιστή μεσολάβησης"
#: tmainform.cboptionvacuumdatabasesonexit.caption
msgid "Vacuum databases on exit"
msgstr ""
#: tmainform.cbpngcompressionlevel.text
msgctxt "tmainform.cbpngcompressionlevel.text"
msgid "Fastest"

View File

@ -1017,6 +1017,10 @@ msgstr "Remove duplicate local data when updating manga list"
msgid "Use proxy"
msgstr "Use proxy"
#: tmainform.cboptionvacuumdatabasesonexit.caption
msgid "Vacuum databases on exit"
msgstr ""
#: tmainform.cbpngcompressionlevel.text
msgctxt "tmainform.cbpngcompressionlevel.text"
msgid "Fastest"

View File

@ -1022,6 +1022,10 @@ msgstr "Remover los Datos Locales Duplicados Cuando se Actualiza la Lista de Man
msgid "Use proxy"
msgstr "Usar Proxy"
#: tmainform.cboptionvacuumdatabasesonexit.caption
msgid "Vacuum databases on exit"
msgstr ""
#: tmainform.cbpngcompressionlevel.text
msgctxt "tmainform.cbpngcompressionlevel.text"
msgid "Fastest"

View File

@ -1024,6 +1024,10 @@ msgstr "Supprimer les doublons locaux lors de la mise à jour du catalogue"
msgid "Use proxy"
msgstr "Utiliser un proxy"
#: tmainform.cboptionvacuumdatabasesonexit.caption
msgid "Vacuum databases on exit"
msgstr ""
#: tmainform.cbpngcompressionlevel.text
msgctxt "tmainform.cbpngcompressionlevel.text"
msgid "Fastest"

View File

@ -1021,6 +1021,10 @@ msgstr "Hapus data lokal duplikat saat memutakhirkan daftar komik"
msgid "Use proxy"
msgstr "Gunakan proxy"
#: tmainform.cboptionvacuumdatabasesonexit.caption
msgid "Vacuum databases on exit"
msgstr ""
#: tmainform.cbpngcompressionlevel.text
msgctxt "tmainform.cbpngcompressionlevel.text"
msgid "Fastest"

View File

@ -1033,6 +1033,10 @@ msgstr "Usuwanie zduplikowane lokalne dane podczas aktualizacji listy mang"
msgid "Use proxy"
msgstr "Użyj proxy"
#: tmainform.cboptionvacuumdatabasesonexit.caption
msgid "Vacuum databases on exit"
msgstr ""
#: tmainform.cbpngcompressionlevel.text
msgctxt "tmainform.cbpngcompressionlevel.text"
msgid "Fastest"

View File

@ -956,6 +956,10 @@ msgstr ""
msgid "Use proxy"
msgstr ""
#: tmainform.cboptionvacuumdatabasesonexit.caption
msgid "Vacuum databases on exit"
msgstr ""
#: tmainform.cbpngcompressionlevel.text
msgid "Fastest"
msgstr ""

View File

@ -1021,6 +1021,10 @@ msgstr "Remover dados locais duplicados quando atualizando lista de mangás"
msgid "Use proxy"
msgstr "Usar proxy"
#: tmainform.cboptionvacuumdatabasesonexit.caption
msgid "Vacuum databases on exit"
msgstr ""
#: tmainform.cbpngcompressionlevel.text
msgctxt "tmainform.cbpngcompressionlevel.text"
msgid "Fastest"

View File

@ -1021,6 +1021,10 @@ msgstr "Удалять повторяющиеся локальные данны
msgid "Use proxy"
msgstr "Использовать прокси"
#: tmainform.cboptionvacuumdatabasesonexit.caption
msgid "Vacuum databases on exit"
msgstr ""
#: tmainform.cbpngcompressionlevel.text
msgctxt "tmainform.cbpngcompressionlevel.text"
msgid "Fastest"

View File

@ -1023,6 +1023,10 @@ msgstr "Manga listesini güncellerken çift yerel veriyi kaldır"
msgid "Use proxy"
msgstr "Proxy kullan"
#: tmainform.cboptionvacuumdatabasesonexit.caption
msgid "Vacuum databases on exit"
msgstr ""
#: tmainform.cbpngcompressionlevel.text
msgctxt "tmainform.cbpngcompressionlevel.text"
msgid "Fastest"

View File

@ -13,6 +13,7 @@ object MainForm: TMainForm
OnDestroy = FormDestroy
OnWindowStateChange = FormWindowStateChange
ShowHint = True
LCLVersion = '2.1.0.0'
object pcMain: TPageControl
Left = 2
Height = 610
@ -37,6 +38,7 @@ object MainForm: TMainForm
Align = alClient
Position = 200
object pssDownloadsFilter: TPairSplitterSide
Cursor = crArrow
Left = 0
Height = 574
Top = 0
@ -180,6 +182,7 @@ object MainForm: TMainForm
end
end
object pssDownloads: TPairSplitterSide
Cursor = crArrow
Left = 205
Height = 574
Top = 0
@ -548,6 +551,7 @@ object MainForm: TMainForm
Align = alClient
Position = 200
object pssInfoList: TPairSplitterSide
Cursor = crArrow
Left = 0
Height = 574
Top = 0
@ -799,6 +803,7 @@ object MainForm: TMainForm
end
end
object pssInfo: TPairSplitterSide
Cursor = crArrow
Left = 205
Height = 574
Top = 0
@ -2775,12 +2780,12 @@ object MainForm: TMainForm
Height = 500
Top = 4
Width = 845
ActivePage = tsConnections
ActivePage = tsGeneral
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Bottom = 16
ParentFont = False
TabIndex = 2
TabIndex = 0
TabOrder = 0
object tsGeneral: TTabSheet
Caption = 'General'
@ -2796,7 +2801,7 @@ object MainForm: TMainForm
Top = 8
Width = 829
HorzScrollBar.Page = 300
VertScrollBar.Page = 439
VertScrollBar.Page = 456
Align = alClient
BorderStyle = bsNone
ChildSizing.LeftRightSpacing = 4
@ -2804,14 +2809,16 @@ object MainForm: TMainForm
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 4
ClientHeight = 456
ClientWidth = 829
ClientWidth = 812
TabOrder = 0
object gbOptionExternal: TGroupBox
AnchorSideLeft.Control = sbGeneralSettings
AnchorSideTop.Control = cbOptionVacuumDatabasesOnExit
AnchorSideTop.Side = asrBottom
Left = 4
Height = 118
Top = 313
Width = 667
Top = 336
Width = 650
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 20
Caption = 'External program'
@ -2820,14 +2827,14 @@ object MainForm: TMainForm
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 4
ClientHeight = 98
ClientWidth = 663
ClientWidth = 646
ParentFont = False
TabOrder = 0
object lbOptionExternal: TLabel
Left = 4
Height = 15
Top = 4
Width = 655
Width = 638
Align = alTop
Caption = 'Open manga by using external program:'
ParentColor = False
@ -2836,7 +2843,7 @@ object MainForm: TMainForm
Left = 4
Height = 15
Top = 50
Width = 655
Width = 638
Align = alTop
Caption = 'Parameters:'
ParentColor = False
@ -2848,7 +2855,7 @@ object MainForm: TMainForm
Left = 4
Height = 23
Top = 69
Width = 628
Width = 611
Anchors = [akTop, akLeft, akRight]
TabOrder = 1
TextHint = 'External program parameters'
@ -2858,7 +2865,7 @@ object MainForm: TMainForm
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = edOptionExternalParams
AnchorSideTop.Side = asrCenter
Left = 636
Left = 619
Height = 15
Top = 73
Width = 13
@ -2873,7 +2880,7 @@ object MainForm: TMainForm
Left = 4
Height = 23
Top = 23
Width = 655
Width = 638
Align = alTop
ButtonWidth = 23
Glyph.Data = {
@ -2958,7 +2965,7 @@ object MainForm: TMainForm
Left = 4
Height = 15
Top = 8
Width = 821
Width = 804
Align = alTop
Caption = 'Language:'
ParentColor = False
@ -3070,6 +3077,17 @@ object MainForm: TMainForm
Caption = 'Sort Downloads when adding new download tasks'
TabOrder = 9
end
object cbOptionVacuumDatabasesOnExit: TCheckBox
AnchorSideLeft.Control = sbGeneralSettings
AnchorSideTop.Control = cbOptionSortDownloadsWhenAddingNewDownloadTasks
AnchorSideTop.Side = asrBottom
Left = 4
Height = 19
Top = 297
Width = 158
Caption = 'Vacuum databases on exit'
TabOrder = 10
end
end
end
object tsView: TTabSheet
@ -4521,11 +4539,11 @@ object MainForm: TMainForm
ChildSizing.TopBottomSpacing = 8
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 4
ClientHeight = 449
ClientHeight = 472
ClientWidth = 837
object pcWebsiteOptions: TPageControl
Left = 4
Height = 433
Height = 456
Top = 8
Width = 829
ActivePage = tsWebsiteSelection
@ -4534,11 +4552,11 @@ object MainForm: TMainForm
TabOrder = 0
object tsWebsiteSelection: TTabSheet
Caption = 'Websites'
ClientHeight = 405
ClientHeight = 428
ClientWidth = 821
object vtOptionMangaSiteSelection: TVirtualStringTree
Left = 0
Height = 370
Height = 393
Top = 35
Width = 821
Align = alClient
@ -4752,8 +4770,8 @@ object MainForm: TMainForm
ChildSizing.TopBottomSpacing = 4
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 4
ClientHeight = 343
ClientWidth = 515
ClientHeight = 428
ClientWidth = 821
object ckEnableLogging: TCheckBox
Left = 4
Height = 19
@ -4878,7 +4896,7 @@ object MainForm: TMainForm
Left = 4
Height = 23
Top = 46
Width = 506
Width = 812
Anchors = [akTop, akLeft, akRight]
ButtonWidth = 23
Glyph.Data = {

View File

@ -167,6 +167,7 @@
{"hash":69131508,"name":"tmainform.cboptionminimizeonstart.caption","sourcebytes":[77,105,110,105,109,105,122,101,32,111,110,32,115,116,97,114,116],"value":"Minimize on start"},
{"hash":134851429,"name":"tmainform.cboptiondeletecompletedtasksonclose.caption","sourcebytes":[68,101,108,101,116,101,32,99,111,109,112,108,101,116,101,100,32,116,97,115,107,115,32,111,110,32,99,108,111,115,101],"value":"Delete completed tasks on close"},
{"hash":162994819,"name":"tmainform.cboptionsortdownloadswhenaddingnewdownloadtasks.caption","sourcebytes":[83,111,114,116,32,68,111,119,110,108,111,97,100,115,32,119,104,101,110,32,97,100,100,105,110,103,32,110,101,119,32,100,111,119,110,108,111,97,100,32,116,97,115,107,115],"value":"Sort Downloads when adding new download tasks"},
{"hash":136457908,"name":"tmainform.cboptionvacuumdatabasesonexit.caption","sourcebytes":[86,97,99,117,117,109,32,100,97,116,97,98,97,115,101,115,32,111,110,32,101,120,105,116],"value":"Vacuum databases on exit"},
{"hash":380871,"name":"tmainform.tsview.caption","sourcebytes":[86,105,101,119],"value":"View"},
{"hash":126054082,"name":"tmainform.cboptionshowdownloadtoolbar.caption","sourcebytes":[83,104,111,119,32,100,111,119,110,108,111,97,100,115,32,116,111,111,108,98,97,114],"value":"Show downloads toolbar"},
{"hash":157437400,"name":"tmainform.gbdroptarget.caption","sourcebytes":[68,114,111,112,32,66,111,120],"value":"Drop Box"},

View File

@ -67,6 +67,7 @@ type
cbOptionShowDownloadToolbar: TCheckBox;
cbOptionShowDownloadToolbarLeft: TCheckBox;
cbOptionShowDownloadToolbarDeleteAll: TCheckBox;
cbOptionVacuumDatabasesOnExit: TCheckBox;
cbOptionUpdateListNoMangaInfo: TCheckBox;
cbOptionDigitVolume: TCheckBox;
cbOptionDigitChapter: TCheckBox;
@ -1428,16 +1429,15 @@ end;
procedure TMainForm.FormDestroy(Sender: TObject);
begin
SilentThreadManager.Free;
DLManager.Free;
FavoriteManager.Free;
dataProcess.Free;
SetLength(ChapterList, 0);
FreeAndNil(mangaInfo);
FreeAndNil(SilentThreadManager);
FreeAndNil(DLManager);
FreeAndNil(FavoriteManager);
FreeAndNil(dataProcess);
FreeAndNil(gifWaiting);
FreeAndNil(mangaCover);
mangaInfo.Free;
gifWaiting.Free;
mangaCover.Free;
if isNormalExit then
Logger.Send(QuotedStrd(Application.Title)+' exit normally [PID:'+IntToStr(GetProcessID)+']')
@ -1971,6 +1971,10 @@ begin
WebsiteSettingsForm.LoadWebsiteSettings;
AccountManagerForm.LoadAccounts;
//restore everything after all modules loaded
DLManager.Restore;
FavoriteManager.Restore;
//load settings_file
LoadMangaOptions;
LoadOptions;
@ -1980,9 +1984,6 @@ begin
Logger.SendException('tmStartup Error!', E);
end;
//restore everything after all modules loaded
DLManager.Restore;
FavoriteManager.Restore;
if OptionAutoCheckLatestVersion then
begin
@ -5107,6 +5108,7 @@ begin
miChapterListHighlight.Checked := ReadBool('general', 'HighlightDownloadedChapters', True);
miChapterListAscending.Checked := ReadBool('general', 'SortChapterListAscending', True);
miChapterListDescending.Checked := not miChapterListAscending.Checked;
cbOptionVacuumDatabasesOnExit.Checked := ReadBool('general', 'VacuumDatabasesOnExit', False);
// view
cbOptionShowDownloadToolbar.Checked := ReadBool('view', 'ShowDownloadsToolbar', True);
@ -5262,6 +5264,7 @@ begin
WriteBool('general', 'AddAsStopped', cbAddAsStopped.Checked);
WriteBool('general', 'HighlightNewManga', miHighlightNewManga.Checked);
WriteBool('general', 'HighlightDownloadedChapters', miChapterListHighlight.Checked);
WriteBool('general', 'VacuumDatabasesOnExit', cbOptionVacuumDatabasesOnExit.Checked);
// view
WriteBool('view', 'ShowDownloadsToolbar', cbOptionShowDownloadToolbar.Checked);
@ -5398,12 +5401,12 @@ begin
if cbSelectManga.Items.Count > 0 then
begin
cbSelectManga.ItemIndex := 0;
// Disable download manga list dialog when applying options:
b := cbOptionShowDownloadMangalistDialog.Checked;
cbOptionShowDownloadMangalistDialog.Checked := False;
// Disable download manga list dialog when applying options:
b := cbOptionShowDownloadMangalistDialog.Checked;
cbOptionShowDownloadMangalistDialog.Checked := False;
cbSelectMangaEditingDone(cbSelectManga);
// Revert state back to like it was before:
cbOptionShowDownloadMangalistDialog.Checked := b;
// Revert state back to like it was before:
cbOptionShowDownloadMangalistDialog.Checked := b;
end
else
begin
@ -5437,6 +5440,8 @@ begin
OptionEnableLoadCover := cbOptionEnableLoadCover.Checked;
OptionDeleteCompletedTasksOnClose := cbOptionDeleteCompletedTasksOnClose.Checked;
OptionSortDownloadsWhenAddingNewDownloadTasks := cbOptionSortDownloadsWhenAddingNewDownloadTasks.Checked;
DLManager.DB.AutoVacuum:=cbOptionVacuumDatabasesOnExit.Checked;
FavoriteManager.DB.AutoVacuum:=cbOptionVacuumDatabasesOnExit.Checked;
//view
ToolBarDownload.Visible := cbOptionShowDownloadToolbar.Checked;