improved program:
- date selecter now preselects current date - added button to open scanned file with external program
This commit is contained in:
117
Belegscanner.lps
117
Belegscanner.lps
@@ -3,13 +3,13 @@
|
||||
<ProjectSession>
|
||||
<Version Value="10"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="9">
|
||||
<Units Count="15">
|
||||
<Unit0>
|
||||
<Filename Value="Belegscanner.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos X="11" Y="8"/>
|
||||
<UsageCount Value="29"/>
|
||||
<CursorPos X="17" Y="10"/>
|
||||
<UsageCount Value="31"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="scanner.pas"/>
|
||||
@@ -18,9 +18,9 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="205"/>
|
||||
<CursorPos X="53" Y="234"/>
|
||||
<UsageCount Value="29"/>
|
||||
<TopLine Value="301"/>
|
||||
<CursorPos Y="340"/>
|
||||
<UsageCount Value="31"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
@@ -77,127 +77,172 @@
|
||||
<CursorPos Y="141"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/objpas/classes/classesh.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1834"/>
|
||||
<CursorPos X="14" Y="1873"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/calendar.pp"/>
|
||||
<UnitName Value="Calendar"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="64"/>
|
||||
<CursorPos X="14" Y="104"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="scanner.lfm"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos X="20" Y="22"/>
|
||||
<UsageCount Value="10"/>
|
||||
<DefaultSyntaxHighlighter Value="LFM"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/objpas/sysutils/filutilh.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="110"/>
|
||||
<CursorPos X="10" Y="155"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/unix/unix.pp"/>
|
||||
<UnitName Value="Unix"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="58"/>
|
||||
<CursorPos X="6" Y="98"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/controls.pp"/>
|
||||
<UnitName Value="Controls"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1663"/>
|
||||
<CursorPos X="14" Y="1696"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit14>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="102" TopLine="46"/>
|
||||
<Caret Line="327" Column="53" TopLine="295"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="104" TopLine="48"/>
|
||||
<Caret Line="334" Column="6" TopLine="240"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="229" Column="112" TopLine="209"/>
|
||||
<Caret Line="235" Column="3" TopLine="228"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="23" Column="29" TopLine="4"/>
|
||||
<Caret Line="109" Column="11" TopLine="70"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="29" Column="80"/>
|
||||
<Caret Line="110" Column="134" TopLine="70"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="75" Column="128"/>
|
||||
<Caret Line="333" Column="10" TopLine="295"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="106" Column="12" TopLine="66"/>
|
||||
<Caret Line="334" Column="3" TopLine="295"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="108" Column="26" TopLine="68"/>
|
||||
<Caret Line="342" Column="13" TopLine="295"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="305" Column="38" TopLine="252"/>
|
||||
<Caret Line="23" Column="119"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="306" Column="6" TopLine="252"/>
|
||||
<Caret Line="30" Column="15"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="268" Column="157" TopLine="253"/>
|
||||
<Caret Line="48" Column="25"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="316" Column="106" TopLine="254"/>
|
||||
<Caret Line="83" Column="126" TopLine="22"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="75" Column="30" TopLine="50"/>
|
||||
<Caret Line="86" Column="21" TopLine="25"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="233" Column="73" TopLine="112"/>
|
||||
<Caret Line="246" Column="120" TopLine="185"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="235" Column="73" TopLine="155"/>
|
||||
<Caret Line="334" Column="33" TopLine="273"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="340" TopLine="261"/>
|
||||
<Caret Line="335" Column="44" TopLine="274"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="48" Column="25" TopLine="18"/>
|
||||
<Caret Line="338" Column="31" TopLine="277"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="143" Column="45" TopLine="102"/>
|
||||
<Caret Line="340" Column="24" TopLine="279"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="284" Column="33" TopLine="235"/>
|
||||
<Caret Line="342" Column="13" TopLine="281"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="193" TopLine="153"/>
|
||||
<Caret Line="340" Column="3" TopLine="297"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="192" Column="3" TopLine="190"/>
|
||||
<Caret Line="30" Column="15" TopLine="12"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="58" Column="27" TopLine="18"/>
|
||||
<Caret Line="23" Column="119" TopLine="12"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="187" Column="15" TopLine="114"/>
|
||||
<Caret Line="30" Column="15" TopLine="12"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="194" Column="15" TopLine="121"/>
|
||||
<Caret Line="48" Column="25" TopLine="12"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="200" Column="15" TopLine="127"/>
|
||||
<Caret Line="83" Column="126" TopLine="22"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="240" Column="15" TopLine="167"/>
|
||||
<Caret Line="86" Column="21" TopLine="25"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="250" Column="15" TopLine="177"/>
|
||||
<Caret Line="83" Column="141" TopLine="125"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="256" Column="15" TopLine="183"/>
|
||||
<Caret Line="23" Column="149" TopLine="25"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="262" Column="15" TopLine="189"/>
|
||||
<Caret Line="224" Column="51" TopLine="213"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="331" Column="10" TopLine="265"/>
|
||||
<Caret Line="338" Column="39" TopLine="302"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectSession>
|
||||
|
||||
36
scanner.lfm
36
scanner.lfm
@@ -1,7 +1,7 @@
|
||||
object ScanForm: TScanForm
|
||||
Left = 1534
|
||||
Left = 2222
|
||||
Height = 869
|
||||
Top = 299
|
||||
Top = 198
|
||||
Width = 1188
|
||||
Caption = 'Belegscanner'
|
||||
ClientHeight = 869
|
||||
@@ -10,7 +10,7 @@ object ScanForm: TScanForm
|
||||
LCLVersion = '1.8.2.0'
|
||||
object TypeSelector: TComboBox
|
||||
Left = 904
|
||||
Height = 29
|
||||
Height = 28
|
||||
Top = 208
|
||||
Width = 276
|
||||
Enabled = False
|
||||
@@ -21,7 +21,7 @@ object ScanForm: TScanForm
|
||||
end
|
||||
object Origin: TComboBox
|
||||
Left = 904
|
||||
Height = 29
|
||||
Height = 28
|
||||
Top = 240
|
||||
Width = 272
|
||||
Enabled = False
|
||||
@@ -32,7 +32,7 @@ object ScanForm: TScanForm
|
||||
end
|
||||
object Destination: TComboBox
|
||||
Left = 904
|
||||
Height = 29
|
||||
Height = 28
|
||||
Top = 304
|
||||
Width = 272
|
||||
Enabled = False
|
||||
@@ -54,7 +54,7 @@ object ScanForm: TScanForm
|
||||
end
|
||||
object Product: TComboBox
|
||||
Left = 904
|
||||
Height = 29
|
||||
Height = 28
|
||||
Top = 240
|
||||
Width = 276
|
||||
Enabled = False
|
||||
@@ -76,7 +76,7 @@ object ScanForm: TScanForm
|
||||
end
|
||||
object Resolution: TComboBox
|
||||
Left = 904
|
||||
Height = 29
|
||||
Height = 28
|
||||
Top = 368
|
||||
Width = 72
|
||||
ItemHeight = 0
|
||||
@@ -90,9 +90,9 @@ object ScanForm: TScanForm
|
||||
end
|
||||
object DPI: TLabel
|
||||
Left = 984
|
||||
Height = 17
|
||||
Height = 16
|
||||
Top = 376
|
||||
Width = 17
|
||||
Width = 19
|
||||
Caption = 'dpi'
|
||||
ParentColor = False
|
||||
end
|
||||
@@ -110,7 +110,7 @@ object ScanForm: TScanForm
|
||||
end
|
||||
object Stop: TComboBox
|
||||
Left = 904
|
||||
Height = 29
|
||||
Height = 28
|
||||
Top = 272
|
||||
Width = 272
|
||||
Enabled = False
|
||||
@@ -132,13 +132,13 @@ object ScanForm: TScanForm
|
||||
Height = 190
|
||||
Top = 8
|
||||
Width = 276
|
||||
DateTime = 43775
|
||||
DateTime = 0
|
||||
OnChange = CalendarChange
|
||||
TabOrder = 0
|
||||
end
|
||||
object PicSize: TComboBox
|
||||
Left = 904
|
||||
Height = 29
|
||||
Height = 28
|
||||
Top = 336
|
||||
Width = 272
|
||||
ItemHeight = 0
|
||||
@@ -153,6 +153,8 @@ object ScanForm: TScanForm
|
||||
Caption = 'Löschen'
|
||||
Enabled = False
|
||||
OnClick = DropButtonClick
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 9
|
||||
end
|
||||
object Swap: TButton
|
||||
@@ -164,6 +166,16 @@ object ScanForm: TScanForm
|
||||
OnClick = SwapClick
|
||||
TabOrder = 10
|
||||
end
|
||||
object extButton: TButton
|
||||
Left = 904
|
||||
Height = 49
|
||||
Top = 456
|
||||
Width = 272
|
||||
Caption = 'extern öffnen'
|
||||
Enabled = False
|
||||
OnClick = extButtonClick
|
||||
TabOrder = 11
|
||||
end
|
||||
object BaseFolderDialog: TSelectDirectoryDialog
|
||||
left = 520
|
||||
top = 128
|
||||
|
||||
31
scanner.pas
31
scanner.pas
@@ -13,18 +13,19 @@ type
|
||||
{ ScanThread }
|
||||
ScanThread = class(TThread)
|
||||
private
|
||||
dbtn, sbtn : TButton;
|
||||
dbtn, obtn, sbtn : TButton;
|
||||
folder,r :String;
|
||||
s:TPoint;
|
||||
p:TImage;
|
||||
protected
|
||||
procedure Execute; override;
|
||||
public
|
||||
constructor Create(scanButton: TButton; dir: String; size: TPoint; resolution: String; preview: TImage; dropButton: TButton);
|
||||
constructor Create(scanButton: TButton; dir: String; size: TPoint; resolution: String; preview: TImage; dropButton: TButton; openButton: TButton);
|
||||
end;
|
||||
|
||||
{ TScanForm }
|
||||
TScanForm = class(TForm)
|
||||
extButton: TButton;
|
||||
Swap: TButton;
|
||||
DropButton: TButton;
|
||||
Calendar: TCalendar;
|
||||
@@ -43,6 +44,7 @@ type
|
||||
TypeSelector: TComboBox;
|
||||
|
||||
procedure BaseFolderClick(Sender: TObject);
|
||||
procedure extButtonClick(Sender: TObject);
|
||||
procedure DropButtonClick(Sender: TObject);
|
||||
procedure CalendarChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
@@ -60,8 +62,11 @@ type
|
||||
private
|
||||
date: TDateTime;
|
||||
function getSize(): TPoint;
|
||||
public
|
||||
|
||||
public
|
||||
const
|
||||
SCANNING : Integer = 1;
|
||||
IDLE: Integer = 0;
|
||||
end;
|
||||
|
||||
var
|
||||
@@ -73,9 +78,10 @@ implementation
|
||||
|
||||
{ ScanThread }
|
||||
|
||||
constructor ScanThread.Create(scanButton: TButton; dir: String; size: TPoint; resolution: String; preview: TImage; dropButton: TButton );
|
||||
constructor ScanThread.Create(scanButton: TButton; dir: String; size: TPoint; resolution: String; preview: TImage; dropButton: TButton; openButton: TButton );
|
||||
begin
|
||||
sbtn := scanButton;
|
||||
obtn := openButton;
|
||||
dbtn := dropButton;
|
||||
folder:=dir;
|
||||
s:=size;
|
||||
@@ -111,7 +117,9 @@ begin
|
||||
dbtn.Hint:=folder+fname;
|
||||
dbtn.Caption:=fname+' löschen';
|
||||
dbtn.Enabled:=true;
|
||||
obtn.Enabled:=true;
|
||||
sbtn.Enabled:=true;
|
||||
sbtn.Tag := TScanForm.IDLE;
|
||||
end;
|
||||
|
||||
function allowed(s: String): boolean;
|
||||
@@ -186,7 +194,7 @@ begin
|
||||
Swap.Enabled:=state;
|
||||
Product.Enabled := not state;
|
||||
Product.Visible := not state;
|
||||
ScanButton.Enabled:=true;
|
||||
if (ScanButton.Tag <> TScanForm.SCANNING) then ScanButton.Enabled:=true;
|
||||
UpdateFolder();
|
||||
end;
|
||||
|
||||
@@ -225,6 +233,7 @@ var
|
||||
size: TPoint;
|
||||
begin
|
||||
ScanButton.Enabled:=false;
|
||||
ScanButton.Tag:=TScanForm.SCANNING;
|
||||
filename := GetEnvironmentVariable('HOME') + '/.config/belegscanner.conf';
|
||||
size := getSize();
|
||||
json := ExportConfig();
|
||||
@@ -234,7 +243,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,extButton);
|
||||
end;
|
||||
|
||||
procedure TScanForm.StopChange(Sender: TObject);
|
||||
@@ -275,6 +284,7 @@ begin
|
||||
BaseFolder.Caption:=GetEnvironmentVariable('HOME');
|
||||
filename := GetEnvironmentVariable('HOME') + '/.config/belegscanner.conf';
|
||||
lines := TStringList.Create;
|
||||
Calendar.DateTime:=Now;
|
||||
try
|
||||
lines.LoadFromFile(filename);
|
||||
for index := 0 to lines.Count-1 do
|
||||
@@ -319,11 +329,20 @@ begin
|
||||
BaseFolder.Caption := BaseFolderDialog.FileName;
|
||||
end;
|
||||
|
||||
procedure TScanForm.extButtonClick(Sender: TObject);
|
||||
var
|
||||
cmd: string;
|
||||
begin
|
||||
cmd := 'gvfs-open "'+DropButton.Hint+'"';
|
||||
fpSystem(cmd);
|
||||
end;
|
||||
|
||||
procedure TScanForm.DropButtonClick(Sender: TObject);
|
||||
begin
|
||||
DeleteFile(DropButton.Hint);
|
||||
Preview.Picture:=nil;
|
||||
DropButton.Enabled:=false;
|
||||
extButton.Enabled:=false;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user