Browse Source

improving calendar

main
Stephan Richter 6 years ago
parent
commit
5ca73329b2
  1. 4
      Belegscanner.lpi
  2. 4
      Belegscanner.lpr
  3. 105
      Belegscanner.lps
  4. 148
      scanner.lfm
  5. 99
      scanner.pas

4
Belegscanner.lpi

@ -10,9 +10,6 @@
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<Icon Value="0"/> <Icon Value="0"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -38,6 +35,7 @@
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="ScanForm"/> <ComponentName Value="ScanForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
</Unit1> </Unit1>
</Units> </Units>

4
Belegscanner.lpr

@ -3,9 +3,9 @@ program Belegscanner;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
uses uses
{$IFDEF UNIX}{$IFDEF UseCThreads} {$IFDEF UNIX}
cthreads, cthreads,
{$ENDIF}{$ENDIF} {$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, scanner Forms, scanner
{ you can add units after this }; { you can add units after this };

105
Belegscanner.lps

@ -3,23 +3,24 @@
<ProjectSession> <ProjectSession>
<Version Value="10"/> <Version Value="10"/>
<BuildModes Active="Default"/> <BuildModes Active="Default"/>
<Units Count="6"> <Units Count="9">
<Unit0> <Unit0>
<Filename Value="Belegscanner.lpr"/> <Filename Value="Belegscanner.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<CursorPos X="17" Y="10"/> <CursorPos X="11" Y="8"/>
<UsageCount Value="20"/> <UsageCount Value="27"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="ScanForm"/> <ComponentName Value="ScanForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/> <IsVisibleTab Value="True"/>
<TopLine Value="54"/> <TopLine Value="10"/>
<CursorPos X="159" Y="97"/> <CursorPos Y="50"/>
<UsageCount Value="20"/> <UsageCount Value="27"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
</Unit1> </Unit1>
@ -28,7 +29,7 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="119"/> <TopLine Value="119"/>
<CursorPos X="14" Y="151"/> <CursorPos X="14" Y="151"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/extdlgs.pas"/> <Filename Value="/usr/lib/lazarus/1.8.2/lcl/extdlgs.pas"/>
@ -36,7 +37,7 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="175"/> <TopLine Value="175"/>
<CursorPos X="29" Y="215"/> <CursorPos X="29" Y="215"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/stdctrls.pp"/> <Filename Value="/usr/lib/lazarus/1.8.2/lcl/stdctrls.pp"/>
@ -44,137 +45,159 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="389"/> <TopLine Value="389"/>
<CursorPos X="14" Y="437"/> <CursorPos X="14" Y="437"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
<Filename Value="/usr/share/fpcsrc/3.0.4/packages/fcl-process/src/process.pp"/> <Filename Value="/usr/share/fpcsrc/3.0.4/packages/fcl-process/src/process.pp"/>
<EditorIndex Value="1"/> <EditorIndex Value="-1"/>
<TopLine Value="99"/> <TopLine Value="99"/>
<CursorPos X="14" Y="131"/> <CursorPos X="14" Y="131"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit5> </Unit5>
<Unit6>
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/interfaces/gtk2/gtk2int.pas"/>
<UnitName Value="Gtk2Int"/>
<EditorIndex Value="-1"/>
<TopLine Value="811"/>
<CursorPos Y="852"/>
<UsageCount Value="9"/>
</Unit6>
<Unit7>
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/graphics.pp"/>
<UnitName Value="Graphics"/>
<EditorIndex Value="-1"/>
<TopLine Value="1426"/>
<CursorPos X="15" Y="1478"/>
<UsageCount Value="10"/>
</Unit7>
<Unit8>
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/include/fpimagebitmap.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="100"/>
<CursorPos Y="141"/>
<UsageCount Value="10"/>
</Unit8>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="172" Column="11" TopLine="71"/> <Caret Line="115" Column="25" TopLine="61"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="173" Column="45" TopLine="120"/> <Caret Line="58" Column="57" TopLine="17"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="179" TopLine="139"/> <Caret Line="101" Column="63" TopLine="61"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="175" TopLine="138"/> <Caret Line="109" Column="30" TopLine="69"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="154" Column="5" TopLine="138"/> <Caret Line="208" Column="15" TopLine="199"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="30" Column="73"/> <Caret Line="214" Column="15" TopLine="199"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="140" Column="144" TopLine="137"/> <Caret Line="241" Column="104" TopLine="199"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="132" Column="3" TopLine="126"/> <Caret Line="97" Column="54" TopLine="40"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="107" Column="27" TopLine="96"/> <Caret Line="75" Column="122" TopLine="35"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="141" Column="32" TopLine="118"/> <Caret Line="18" Column="14" TopLine="5"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="142" Column="32" TopLine="119"/> <Caret Line="102" Column="18" TopLine="69"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="143" Column="32" TopLine="120"/> <Caret Line="105" Column="24" TopLine="64"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="144" Column="32" TopLine="121"/> <Caret Line="9" Column="27"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="145" Column="32" TopLine="122"/> <Caret Line="125" Column="25" TopLine="64"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="146" Column="32" TopLine="123"/> <Caret Line="141" Column="178" TopLine="85"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="147" Column="32" TopLine="124"/> <Caret Line="122" Column="9" TopLine="73"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="18" Column="12"/> <Caret Line="123" Column="30" TopLine="68"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="36" Column="61"/> <Caret Line="125" Column="18" TopLine="83"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="171" Column="79" TopLine="156"/> <Caret Line="85" Column="5" TopLine="61"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="202" Column="3" TopLine="162"/> <Caret Line="86" Column="5" TopLine="62"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="124" Column="63" TopLine="108"/> <Caret Line="85" Column="5" TopLine="61"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="196" Column="89" TopLine="164"/> <Caret Line="84" Column="5" TopLine="60"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="67" Column="27" TopLine="31"/> <Caret Line="179" TopLine="139"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="69" Column="34" TopLine="34"/> <Caret Line="270" TopLine="84"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="74" Column="17" TopLine="36"/> <Caret Line="51" Column="20" TopLine="11"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="79" Column="66" TopLine="36"/> <Caret Line="175" Column="53" TopLine="111"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="74" Column="28" TopLine="41"/> <Caret Line="174" Column="53" TopLine="110"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="97" Column="69" TopLine="59"/> <Caret Line="148" Column="26" TopLine="110"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="74" Column="77" TopLine="65"/> <Caret Line="176" Column="28" TopLine="136"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="scanner.pas"/> <Filename Value="scanner.pas"/>
<Caret Line="9" Column="17"/> <Caret Line="266" Column="5" TopLine="212"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectSession> </ProjectSession>

148
scanner.lfm

@ -1,70 +1,50 @@
object ScanForm: TScanForm object ScanForm: TScanForm
Left = 1901 Left = 1534
Height = 180 Height = 1018
Top = 631 Top = 299
Width = 663 Width = 1215
Caption = 'Belegscanner' Caption = 'Belegscanner'
ClientHeight = 180 ClientHeight = 1018
ClientWidth = 663 ClientWidth = 1215
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '1.8.2.0' LCLVersion = '1.8.2.0'
object DateView: TLabel
Left = 8
Height = 19
Top = 8
Width = 150
Caption = 'Datum auswählen!'
Font.Height = -16
Font.Name = 'Sans'
ParentColor = False
ParentFont = False
end
object dateButton: TButton
Left = 232
Height = 25
Top = 8
Width = 75
Caption = 'ändern'
OnClick = dateButtonClick
TabOrder = 0
end
object TypeSelector: TComboBox object TypeSelector: TComboBox
Left = 8 Left = 344
Height = 29 Height = 29
Top = 40 Top = 32
Width = 216 Width = 216
Enabled = False Enabled = False
ItemHeight = 0 ItemHeight = 0
OnChange = TypeSelectorChange OnChange = TypeSelectorChange
TabOrder = 1 TabOrder = 3
Text = 'Select Type' Text = 'Select Type'
end end
object Origin: TComboBox object Origin: TComboBox
Left = 232 Left = 568
Height = 29 Height = 29
Top = 40 Top = 32
Width = 184 Width = 192
Enabled = False Enabled = False
ItemHeight = 0 ItemHeight = 0
OnChange = OriginChange OnChange = OriginChange
TabOrder = 2 TabOrder = 5
Text = 'Start' Text = 'Start'
end end
object Destination: TComboBox object Destination: TComboBox
Left = 424 Left = 948
Height = 29 Height = 29
Top = 40 Top = 32
Width = 196 Width = 196
Enabled = False Enabled = False
ItemHeight = 0 ItemHeight = 0
OnChange = DestinationChange OnChange = DestinationChange
TabOrder = 3 TabOrder = 7
Text = 'Ziel' Text = 'Ziel'
end end
object FolderName: TLabel object FolderName: TLabel
Left = 8 Left = 344
Height = 19 Height = 19
Top = 96 Top = 64
Width = 103 Width = 103
Caption = 'Ordnername' Caption = 'Ordnername'
Font.Height = -16 Font.Height = -16
@ -73,10 +53,10 @@ object ScanForm: TScanForm
ParentFont = False ParentFont = False
end end
object Product: TComboBox object Product: TComboBox
Left = 232 Left = 568
Height = 29 Height = 29
Top = 40 Top = 32
Width = 184 Width = 192
Enabled = False Enabled = False
ItemHeight = 0 ItemHeight = 0
OnChange = ProductChange OnChange = ProductChange
@ -84,74 +64,75 @@ object ScanForm: TScanForm
Text = 'Produkt' Text = 'Produkt'
Visible = False Visible = False
end end
object ScnaButton: TButton object ScanButton: TButton
Left = 545 Left = 664
Height = 25 Height = 49
Top = 72 Top = 88
Width = 75 Width = 112
Caption = 'scannen!' Caption = 'scannen!'
Enabled = False Enabled = False
OnClick = ScnaButtonClick OnClick = ScanButtonClick
TabOrder = 5 TabOrder = 8
end end
object IWidth: TEdit object IWidth: TEdit
Left = 320 Left = 344
Height = 27 Height = 27
Top = 8 Top = 88
Width = 80 Width = 80
Alignment = taRightJustify Alignment = taRightJustify
TabOrder = 6 TabOrder = 0
Text = '209' Text = '209'
end end
object Times: TLabel object Times: TLabel
Left = 402 Left = 426
Height = 17 Height = 17
Top = 13 Top = 93
Width = 6 Width = 6
Caption = 'x' Caption = 'x'
ParentColor = False ParentColor = False
end end
object IHeight: TEdit object IHeight: TEdit
Left = 416 Left = 440
Height = 27 Height = 27
Top = 8 Top = 88
Width = 80 Width = 80
TabOrder = 7 TabOrder = 1
Text = '297' Text = '297'
end end
object Pixels: TLabel object Pixels: TLabel
Left = 500 Left = 524
Height = 17 Height = 17
Top = 13 Top = 93
Width = 27 Width = 27
Caption = 'px @' Caption = 'px @'
ParentColor = False ParentColor = False
end end
object Resolution: TComboBox object Resolution: TComboBox
Left = 536 Left = 560
Height = 29 Height = 29
Top = 8 Top = 88
Width = 68 Width = 68
ItemHeight = 0 ItemHeight = 0
ItemIndex = 0
Items.Strings = ( Items.Strings = (
'150' '150'
'300' '300'
) )
TabOrder = 8 TabOrder = 2
Text = '150' Text = '150'
end end
object DPI: TLabel object DPI: TLabel
Left = 608 Left = 632
Height = 17 Height = 17
Top = 13 Top = 93
Width = 17 Width = 17
Caption = 'dpi' Caption = 'dpi'
ParentColor = False ParentColor = False
end end
object BaseFolder: TLabel object BaseFolder: TLabel
Left = 8 Left = 344
Height = 19 Height = 19
Top = 76 Top = 8
Width = 88 Width = 88
Caption = 'BaseFolder' Caption = 'BaseFolder'
Font.Height = -16 Font.Height = -16
@ -160,15 +141,36 @@ object ScanForm: TScanForm
ParentFont = False ParentFont = False
OnClick = BaseFolderClick OnClick = BaseFolderClick
end end
object DateSelector: TCalendarDialog object Stop: TComboBox
Date = 43775 Left = 768
OKCaption = '&Ok' Height = 29
CancelCaption = 'Abbrechen' Top = 32
left = 352 Width = 176
top = 72 Enabled = False
ItemHeight = 0
OnChange = StopChange
TabOrder = 6
Text = 'Zwischenhalt'
end
object Preview: TImage
Left = 8
Height = 800
Top = 208
Width = 1200
Center = True
Proportional = True
end
object Calendar: TCalendar
Left = 8
Height = 190
Top = 8
Width = 324
DateTime = 43775
OnChange = CalendarChange
TabOrder = 9
end end
object BaseFolderDialog: TSelectDirectoryDialog object BaseFolderDialog: TSelectDirectoryDialog
left = 251 left = 520
top = 85 top = 128
end end
end end

99
scanner.pas

@ -6,13 +6,27 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtDlgs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtDlgs,
StdCtrls, Unix; StdCtrls, ExtCtrls, Calendar, Unix;
type type
{ TScanForm } { ScanThread }
ScanThread = class(TThread)
private
btn : TButton;
folder,w,h,r :String;
p:TImage;
protected
procedure Execute; override;
public
constructor Create(button: TButton; dir: String; width: String; height: String; resolution: String; preview: TImage);
end;
{ TScanForm }
TScanForm = class(TForm) TScanForm = class(TForm)
Calendar: TCalendar;
Preview: TImage;
Stop: TComboBox;
DPI: TLabel; DPI: TLabel;
BaseFolder: TLabel; BaseFolder: TLabel;
Resolution: TComboBox; Resolution: TComboBox;
@ -21,30 +35,27 @@ type
BaseFolderDialog: TSelectDirectoryDialog; BaseFolderDialog: TSelectDirectoryDialog;
Times: TLabel; Times: TLabel;
IWidth: TEdit; IWidth: TEdit;
ScnaButton: TButton; ScanButton: TButton;
Product: TComboBox; Product: TComboBox;
Destination: TComboBox; Destination: TComboBox;
FolderName: TLabel; FolderName: TLabel;
Origin: TComboBox; Origin: TComboBox;
TypeSelector: TComboBox; TypeSelector: TComboBox;
dateButton: TButton;
DateSelector: TCalendarDialog;
DateView: TLabel;
procedure BaseFolderClick(Sender: TObject); procedure BaseFolderClick(Sender: TObject);
procedure CalendarChange(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure ProductChange(Sender: TObject); procedure ProductChange(Sender: TObject);
procedure DestinationChange(Sender: TObject); procedure DestinationChange(Sender: TObject);
procedure dateButtonClick(Sender: TObject);
procedure OriginChange(Sender: TObject); procedure OriginChange(Sender: TObject);
procedure ScnaButtonClick(Sender: TObject); procedure ScanButtonClick(Sender: TObject);
procedure StopChange(Sender: TObject);
procedure TypeSelectorChange(Sender: TObject); procedure TypeSelectorChange(Sender: TObject);
function ExportConfig(): string; function ExportConfig(): string;
function ExportOptions(dropDown: TComboBox): string; function ExportOptions(dropDown: TComboBox): string;
procedure UpdateTypes(); procedure UpdateTypes();
procedure UpdateFolder(); procedure UpdateFolder();
procedure MixLocations(d1: TComboBox; d2: TComboBox); procedure MixLocations(d1: TComboBox; d2: TComboBox; d3: TComboBox);
procedure ScanImage();
private private
date: TDateTime; date: TDateTime;
public public
@ -58,14 +69,44 @@ implementation
{$R *.lfm} {$R *.lfm}
{ TScanForm } { ScanThread }
constructor ScanThread.Create(button: TButton; dir: String; width: String; height: String; resolution: String; preview: TImage);
begin
btn := button;
folder:=dir;
w:=width;
h:=height;
r:=resolution;
p:=preview;
inherited Create(false);
end;
procedure TScanForm.ScanImage(); procedure ScanThread.Execute;
var
fname: String;
num: Integer;
pic: TPicture;
begin begin
fpSystem('scanimage -x '+IWidth.Caption+' -y '+IHeight.Caption+' --mode Gray --resolution '+Resolution.Caption+' --format jpeg > /home/srichter/tmp/test.jpg'); ForceDirectories(folder);
num := 0;
repeat
num := num +1;
fname := '/scan_';
if (num<10) then fname:=fname+'0';
fname := fname+IntToStr(num)+'.jpg';
until not FileExists(folder+fname);
fpSystem('scanimage -x '+w+' -y '+h+' --mode Color --resolution '+r+' --format jpeg > "'+folder+fname+'"');
try
pic:=TPicture.Create;
pic.LoadFromFile(folder+fname);
p.Picture:=pic;
finally
end;
btn.Enabled:=true;
end; end;
procedure TScanForm.MixLocations(d1: TComboBox; d2: TComboBox); procedure TScanForm.MixLocations(d1: TComboBox; d2: TComboBox; d3: TComboBox);
var var
list: TStringList; list: TStringList;
begin begin
@ -73,17 +114,20 @@ begin
list.Sorted := True; list.Sorted := True;
d1.Items.Add(d1.Text); d1.Items.Add(d1.Text);
d2.Items.Add(d2.Text); d2.Items.Add(d2.Text);
if not (d3.Text = '') then d3.Items.Add(d3.Text);
list.Assign(d1.Items); list.Assign(d1.Items);
list.AddStrings(d2.Items); list.AddStrings(d2.Items);
list.AddStrings(d3.Items);
d1.Items.Assign(list); d1.Items.Assign(list);
d2.Items.Assign(list); d2.Items.Assign(list);
d3.Items.Assign(list);
end; end;
function TScanForm.ExportConfig(): string; function TScanForm.ExportConfig(): string;
begin begin
Result := 'types:' + ExportOptions(TypeSelector) + #13; Result := 'types:' + ExportOptions(TypeSelector) + #13;
Result := Result + 'items:' + ExportOptions(Product) + #13; Result := Result + 'items:' + ExportOptions(Product) + #13;
MixLocations(Origin, Destination); MixLocations(Origin, Destination, Stop);
Result := Result + 'locations:' + ExportOPtions(Origin) + #13; Result := Result + 'locations:' + ExportOPtions(Origin) + #13;
end; end;
@ -116,18 +160,19 @@ begin
state := TypeSelector.Text = 'Ticket'; state := TypeSelector.Text = 'Ticket';
Origin.Enabled := state; Origin.Enabled := state;
Origin.Visible := state; Origin.Visible := state;
Stop.Enabled := state;
Stop.Visible := state;
Destination.Enabled := state; Destination.Enabled := state;
Destination.Visible := state;
Product.Enabled := not state; Product.Enabled := not state;
Product.Visible := not state; Product.Visible := not state;
ScnaButton.Enabled:=true; ScanButton.Enabled:=true;
UpdateFolder(); UpdateFolder();
end; end;
procedure TScanForm.dateButtonClick(Sender: TObject); procedure TScanForm.CalendarChange(Sender: TObject);
begin begin
DateSelector.Execute; date := Calendar.DateTime;
date := DateSelector.Date;
DateView.Caption := FormatDateTime('YYYY-MM-DD', date);
UpdateTypes(); UpdateTypes();
TypeSelector.Enabled := True; TypeSelector.Enabled := True;
UpdateFolder(); UpdateFolder();
@ -139,12 +184,13 @@ begin
UpdateFolder(); UpdateFolder();
end; end;
procedure TScanForm.ScnaButtonClick(Sender: TObject); procedure TScanForm.ScanButtonClick(Sender: TObject);
var var
config: TFileStream; config: TFileStream;
filename: string; filename: string;
json: string; json: string;
begin begin
ScanButton.Enabled:=false;
filename := GetEnvironmentVariable('HOME') + '/.config/belegscanner.conf'; filename := GetEnvironmentVariable('HOME') + '/.config/belegscanner.conf';
json := ExportConfig(); json := ExportConfig();
try try
@ -153,7 +199,13 @@ begin
finally finally
config.Free; config.Free;
end; end;
ScanImage(); ScanThread.Create(ScanButton,BaseFolder.Caption+FolderName.Caption,IWidth.Caption,IHeight.Caption,Resolution.Caption,Preview);
end;
procedure TScanForm.StopChange(Sender: TObject);
begin
Stop.Tag := 1;
UpdateFolder();
end; end;
procedure TScanForm.DestinationChange(Sender: TObject); procedure TScanForm.DestinationChange(Sender: TObject);
@ -198,6 +250,7 @@ begin
line := line.Substring(10); line := line.Substring(10);
Origin.Items.AddStrings(line.Split(',')); Origin.Items.AddStrings(line.Split(','));
Destination.Items.AddStrings(line.Split(',')); Destination.Items.AddStrings(line.Split(','));
Stop.Items.AddStrings(line.Split(','));
end; end;
end end
finally finally
@ -223,6 +276,8 @@ begin
tx := tx + TypeSelector.Text; tx := tx + TypeSelector.Text;
if (Origin.Enabled and (Origin.Tag > 0)) then if (Origin.Enabled and (Origin.Tag > 0)) then
tx := tx + ': ' + Origin.Text; tx := tx + ': ' + Origin.Text;
if (Stop.Enabled and (Stop.Tag > 0) and not (Stop.Text = '')and not (Stop.Text = 'Zwischenhalt')) then
tx := tx + ' - ' + Stop.Text;
if (Destination.Enabled and (Destination.Tag > 0)) then if (Destination.Enabled and (Destination.Tag > 0)) then
tx := tx + ' - ' + Destination.Text; tx := tx + ' - ' + Destination.Text;
FolderName.Caption := tx; FolderName.Caption := tx;

Loading…
Cancel
Save