From 6871e4ff04ccfd4e1f92ed45a651decab4b527e0 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Thu, 7 Nov 2019 00:04:16 +0100 Subject: [PATCH] =?UTF-8?q?Ver=C3=A4nderungen=20vorgenommen,=20so=20dass?= =?UTF-8?q?=20sich=20das=20Programm=20auch=20f=C3=BCr=20andere=20Belege=20?= =?UTF-8?q?und=20Ordner=20eignet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Belegscanner.lps | 62 ++++++++++++++++++++++++------------------------ scanner.pas | 23 +++++++++--------- 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/Belegscanner.lps b/Belegscanner.lps index a1d1ace..5610665 100644 --- a/Belegscanner.lps +++ b/Belegscanner.lps @@ -19,7 +19,7 @@ - + @@ -81,123 +81,123 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/scanner.pas b/scanner.pas index aa0ccad..8f77f77 100644 --- a/scanner.pas +++ b/scanner.pas @@ -55,7 +55,6 @@ type procedure TypeSelectorChange(Sender: TObject); function ExportConfig(): string; function ExportOptions(dropDown: TComboBox): string; - procedure UpdateTypes(); procedure UpdateFolder(); procedure MixLocations(d1: TComboBox; d2: TComboBox; d3: TComboBox); private @@ -97,6 +96,8 @@ begin num := num +1; fname := 'scan_'; if (num<10) then fname:=fname+'0'; + if (num<100) then fname:=fname+'0'; + if (num<1000) then fname:=fname+'0'; fname := fname+IntToStr(num)+'.jpg'; until not FileExists(folder+fname); fpSystem('scanimage -x '+IntToStr(s.x)+' -y '+IntToStr(s.y)+' --mode Color --resolution '+r+' --format jpeg > "'+folder+fname+'"'); @@ -141,7 +142,8 @@ end; function TScanForm.ExportConfig(): string; begin - Result := 'types:' + ExportOptions(TypeSelector) + #13; + Result := 'folder:'+BaseFolder.Caption+#13; + Result := Result + 'types:' + ExportOptions(TypeSelector) + #13; Result := Result + 'items:' + ExportOptions(Product) + #13; MixLocations(Origin, Destination, Stop); Result := Result + 'locations:' + ExportOPtions(Origin) + #13; @@ -190,7 +192,6 @@ end; procedure TScanForm.CalendarChange(Sender: TObject); begin date := Calendar.DateTime; - UpdateTypes(); TypeSelector.Enabled := True; UpdateFolder(); end; @@ -232,7 +233,7 @@ begin finally config.Free; end; - ScanThread.Create(ScanButton,BaseFolder.Caption+FolderName.Caption+'/',size,Resolution.Caption,Preview,DropButton); + ScanThread.Create(ScanButton,BaseFolder.Caption+'/'+FolderName.Caption+'/',size,Resolution.Caption,Preview,DropButton); end; procedure TScanForm.StopChange(Sender: TObject); @@ -270,7 +271,7 @@ var line: String; index: integer; begin - BaseFolder.Caption:=GetEnvironmentVariable('HOME') + '/Documents/Quittungen/'; + BaseFolder.Caption:=GetEnvironmentVariable('HOME'); filename := GetEnvironmentVariable('HOME') + '/.config/belegscanner.conf'; lines := TStringList.Create; try @@ -278,6 +279,11 @@ begin for index := 0 to lines.Count-1 do begin line:=lines.Strings[index]; + if line.StartsWith('folder:') then + begin + line:=line.Substring(7); + BaseFolder.Caption:=line; + end; if line.StartsWith('types:') then begin line := line.Substring(6); @@ -324,7 +330,7 @@ procedure TScanForm.UpdateFolder(); var tx: string; begin - tx := FormatDateTime('YYYY', date) + '/' + FormatDateTime('YYYY-MM-DD', date) + ' - '; + tx := FormatDateTime('YYYY-MM-DD', date) + ' - '; if (Product.Enabled and (Product.Tag > 0) and not( Product.Text = '') and not (Product.Text = 'Produkt')) then tx := tx + Product.Text + ' von '; if (TypeSelector.Tag > 0) then @@ -338,9 +344,4 @@ begin FolderName.Caption := tx; end; -procedure TScanForm.UpdateTypes(); -begin - -end; - end.