Check-in [ebd6f87c86]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Specify default times (in case no calendar info could be loaded). Handle calendar loading errors more gracefully (i.e. refresh the bar anyway). Updated project to Delphi XE7. Includes new executable.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ebd6f87c864dc546b09a150de662da7c00632ec0
User & Date: tinus 2014-12-02 12:27:51
Context
2014-12-03
08:22
Default start and stop time can now be specified in the .ini file. Renamed the sample .ini file. The form is now always invalidated after a refresh; even when an exception occurs. check-in: 5b7709bef6 user: tinus tags: trunk
2014-12-02
12:27
Specify default times (in case no calendar info could be loaded). Handle calendar loading errors more gracefully (i.e. refresh the bar anyway). Updated project to Delphi XE7. Includes new executable. check-in: ebd6f87c86 user: tinus tags: trunk
2013-05-23
07:29
Added Application.MainFormOnTaskbar := False, so the main form's window is not visible on the taskbar. check-in: c5cc44ca2e user: MCO tags: trunk
Changes

Changes to out/TempusFugit.exe.

cannot compute difference between binary files

Changes to src/F_Main.dfm.

33
34
35
36
37
38
39


40
41
42
43
44
45
46
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
    Request.ContentLength = -1
    Request.ContentRangeEnd = -1
    Request.ContentRangeStart = -1
    Request.ContentRangeInstanceLength = -1
    Request.Accept = 'text/xml, text/html, */*'
    Request.BasicAuthentication = False
    Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'


    HTTPOptions = [hoForceEncodeParams]
    Left = 32
    Top = 72
  end
  object tmrFetchTimes: TTimer
    Enabled = False
    Interval = 900000
................................................................................
      OnClick = miCloseClick
    end
  end
  object imlMain: TImageList
    Left = 32
    Top = 232
    Bitmap = {
      494C010102000400180010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
      0000000000003600000028000000400000001000000001002000000000000010
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000







>
>







 







|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
    Request.ContentLength = -1
    Request.ContentRangeEnd = -1
    Request.ContentRangeStart = -1
    Request.ContentRangeInstanceLength = -1
    Request.Accept = 'text/xml, text/html, */*'
    Request.BasicAuthentication = False
    Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
    Request.Ranges.Units = 'bytes'
    Request.Ranges = <>
    HTTPOptions = [hoForceEncodeParams]
    Left = 32
    Top = 72
  end
  object tmrFetchTimes: TTimer
    Enabled = False
    Interval = 900000
................................................................................
      OnClick = miCloseClick
    end
  end
  object imlMain: TImageList
    Left = 32
    Top = 232
    Bitmap = {
      494C010102000400200010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
      0000000000003600000028000000400000001000000001002000000000000010
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000

Changes to src/F_Main.pas.

106
107
108
109
110
111
112



113
114
115
116
117
118
119
...
484
485
486
487
488
489
490

491
492
493
494
495
496
497
...
518
519
520
521
522
523
524

525


526
527
528
529
530
531

532
533
534
535
536
537
538
...
575
576
577
578
579
580
581



582
583
584
585
586
587
588
  Percentage: integer;
begin
  FSettings := TIniFile.Create(ChangeFileExt(ParamStr(0), '.ini'));
  FErrorFetchesAgo := -1;

  Application.HintHidePause := FSettings.ReadInteger('General', 'HintTimeout', 5000);




  SetLength(FWaypoints, 4);
  FWaypoints[0].RGB.Color := StringToColor(FSettings.ReadString('Gradient', 'StartColor', 'clHighlight'));
  FWaypoints[0].Position := 0;
  FWaypoints[0].MapArg := FSettings.ReadInteger('Gradient', 'StartCurve', 4);

  FWaypoints[1].RGB.Color := StringToColor(FSettings.ReadString('Gradient', 'CloseColor', '$007F00'));
  FWaypoints[1].Position := 0.5; //(IncHour(FStopTime, -1) - FStartTime) / Duration;
................................................................................
procedure TfrmMain.FetchHoursOnline();
var
  URL: string;
  DateOffset: integer;
  QueryDate: TDate;
  HourQuery, LunchQuery: string;
  Start, Stop: string;

  { -------------------------------------------------------------------------------------------- }
  function FetchHours(Query: string; out Start, Stop: string): boolean;
  var
    Content: TMemoryStream;
    SA: TStreamAdapter;
    xmlDoc, xmlEntry: OleVariant;
  begin
................................................................................
        xmlEntry := xmlDoc.selectSingleNode('/atom:feed/atom:entry[atom:title="' + Query + '"]');
        if not (VarIsClear(xmlEntry) or VarIsNull(xmlEntry)) then begin
          Result := True;
          Start := xmlEntry.selectSingleNode('gd:when/@startTime').text;
          Stop := xmlEntry.selectSingleNode('gd:when/@endTime').text;
        end;
      end else begin

        raise EIdHTTPProtocolException.CreateError(httpClient.ResponseCode, httpClient.ResponseText, httpClient.ResponseText);


      end;
    finally
      Content.Free;
    end;
  end;
begin

  // Determine the events to look for
  HourQuery := FSettings.ReadString('Google Calendar', 'WorkingHours', '');
  LunchQuery := FSettings.ReadString('Google Calendar', 'LunchHours', '');

  // Determine the date
  DateOffset := FSettings.ReadInteger('Debug', 'DateOffset', 0);
  QueryDate := IncDay(Date, DateOffset);
................................................................................

  // Schedule the next update
  if (Now > FStartTime) then begin
    tmrFetchTimes.Interval := 7200000; // once every 2 hours
  end else begin
    tmrFetchTimes.Interval := 1800000; // once every 30 minutes
  end;



end;

{ ------------------------------------------------------------------------------------------------ }
function TfrmMain.DateTimeFromXML(ISODateTime: string): TDateTime;
var
  CharPos: integer;
  Offset: TDateTime;







>
>
>







 







>







 







>
|
>
>






>







 







>
>
>







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
...
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
...
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
...
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
  Percentage: integer;
begin
  FSettings := TIniFile.Create(ChangeFileExt(ParamStr(0), '.ini'));
  FErrorFetchesAgo := -1;

  Application.HintHidePause := FSettings.ReadInteger('General', 'HintTimeout', 5000);

  FStartTime := Date + EncodeTime(8, 0, 0, 0);
  FStopTime := Date + EncodeTime(17, 0, 0, 0);

  SetLength(FWaypoints, 4);
  FWaypoints[0].RGB.Color := StringToColor(FSettings.ReadString('Gradient', 'StartColor', 'clHighlight'));
  FWaypoints[0].Position := 0;
  FWaypoints[0].MapArg := FSettings.ReadInteger('Gradient', 'StartCurve', 4);

  FWaypoints[1].RGB.Color := StringToColor(FSettings.ReadString('Gradient', 'CloseColor', '$007F00'));
  FWaypoints[1].Position := 0.5; //(IncHour(FStopTime, -1) - FStartTime) / Duration;
................................................................................
procedure TfrmMain.FetchHoursOnline();
var
  URL: string;
  DateOffset: integer;
  QueryDate: TDate;
  HourQuery, LunchQuery: string;
  Start, Stop: string;
  Exc: Exception;
  { -------------------------------------------------------------------------------------------- }
  function FetchHours(Query: string; out Start, Stop: string): boolean;
  var
    Content: TMemoryStream;
    SA: TStreamAdapter;
    xmlDoc, xmlEntry: OleVariant;
  begin
................................................................................
        xmlEntry := xmlDoc.selectSingleNode('/atom:feed/atom:entry[atom:title="' + Query + '"]');
        if not (VarIsClear(xmlEntry) or VarIsNull(xmlEntry)) then begin
          Result := True;
          Start := xmlEntry.selectSingleNode('gd:when/@startTime').text;
          Stop := xmlEntry.selectSingleNode('gd:when/@endTime').text;
        end;
      end else begin
        if not Assigned(Exc) then begin
          Exc := EIdHTTPProtocolException.CreateError(httpClient.ResponseCode, httpClient.ResponseText, httpClient.ResponseText);
        end;
        Exit;
      end;
    finally
      Content.Free;
    end;
  end;
begin
  Exc := nil;
  // Determine the events to look for
  HourQuery := FSettings.ReadString('Google Calendar', 'WorkingHours', '');
  LunchQuery := FSettings.ReadString('Google Calendar', 'LunchHours', '');

  // Determine the date
  DateOffset := FSettings.ReadInteger('Debug', 'DateOffset', 0);
  QueryDate := IncDay(Date, DateOffset);
................................................................................

  // Schedule the next update
  if (Now > FStartTime) then begin
    tmrFetchTimes.Interval := 7200000; // once every 2 hours
  end else begin
    tmrFetchTimes.Interval := 1800000; // once every 30 minutes
  end;

  if Assigned(Exc) then
    raise Exc;
end;

{ ------------------------------------------------------------------------------------------------ }
function TfrmMain.DateTimeFromXML(ISODateTime: string): TDateTime;
var
  CharPos: integer;
  Offset: TDateTime;

Changes to src/prj/d2009/TempusFugit.dproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15





16
17
18
19
20
21
22
23
24
25
26
27

28
29

30
31
32
33
34
35
36
37
38
39
40
41
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
...
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <ProjectGuid>{6D193C34-4617-40F0-A1F0-F4ABDB7FFD3B}</ProjectGuid>
        <MainSource>TempusFugit.dpr</MainSource>
        <Config Condition="'$(Config)'==''">Debug</Config>
        <DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
        <ProjectVersion>14.6</ProjectVersion>
        <FrameworkType>VCL</FrameworkType>
        <Base>True</Base>
        <Platform Condition="'$(Platform)'==''">Win32</Platform>
        <TargetedPlatforms>1</TargetedPlatforms>
        <AppType>Application</AppType>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
        <Base>true</Base>





    </PropertyGroup>
    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
        <Cfg_1>true</Cfg_1>
        <CfgParent>Base</CfgParent>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
        <Cfg_2>true</Cfg_2>
        <CfgParent>Base</CfgParent>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Base)'!=''">

        <VerInfo_PreRelease>true</VerInfo_PreRelease>
        <Manifest_File>None</Manifest_File>

        <Icon_MainIcon>..\..\..\res\Stopwatch.ico</Icon_MainIcon>
        <VerInfo_Locale>1043</VerInfo_Locale>
        <VerInfo_Build>7</VerInfo_Build>
        <VerInfo_AutoGenVersion>true</VerInfo_AutoGenVersion>
        <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)</DCC_Namespace>
        <VerInfo_Keys>CompanyName=Voronwë;FileDescription=TempusFugit;FileVersion=1.0.0.7;InternalName=TempusFugit;LegalCopyright=© Martijn Coppoolse;LegalTrademarks=;OriginalFilename=TempusFugit.exe;ProductName=Tempus Fugit;ProductVersion=1.0.0.0;Comments=http://martijn.coppoolse.com/software/</VerInfo_Keys>
        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
        <DCC_DependencyCheckOutputName>..\..\..\out\TempusFugit.exe</DCC_DependencyCheckOutputName>
        <DCC_UnitSearchPath>..\..;..\..\Lib;W:\Lib;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
        <DCC_UsePackage>vcl;rtl;vclx;dbrtl;vcldb;adortl;xmlrtl;vclactnband;inet;vclie;inetdbbde;inetdbxpress;IndyCore;IndySystem;dclOfficeXP;VclSmp;soaprtl;dsnap;IndyProtocols;bdertl;teeui;teedb;tee;vcldbx;TMSD2006;Scit;DL_Geo_100;DL_Base_100;S303_r100;B305_r100;DL_Control_100;DL_GDI_100;RaizeComponentsVcl;$(DCC_UsePackage)</DCC_UsePackage>
        <DCC_ImageBase>00400000</DCC_ImageBase>
        <DCC_RangeChecking>true</DCC_RangeChecking>
................................................................................
        <DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Cfg_1)'!=''">
        <VerInfo_PreRelease>false</VerInfo_PreRelease>
        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
        <DCC_DebugInformation>false</DCC_DebugInformation>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Cfg_2)'!=''">
        <VerInfo_Debug>true</VerInfo_Debug>
        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
        <DCC_OutputDependencies>true</DCC_OutputDependencies>
        <DCC_Optimize>false</DCC_Optimize>
        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
................................................................................
                    <VersionInfoKeys Name="LegalTrademarks"/>
                    <VersionInfoKeys Name="OriginalFilename">TempusFugit.exe</VersionInfoKeys>
                    <VersionInfoKeys Name="ProductName">Tempus Fugit</VersionInfoKeys>
                    <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
                    <VersionInfoKeys Name="Comments">http://martijn.coppoolse.com/software/</VersionInfoKeys>
                </VersionInfoKeys>
                <Excluded_Packages>
                    <Excluded_Packages Name="%BDSBIN%\dcloffice2k160.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
                    <Excluded_Packages Name="%BDSBIN%\dclofficexp160.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
                </Excluded_Packages>
            </Delphi.Personality>
            <Platforms>
                <Platform value="Win32">True</Platform>
                <Platform value="Win64">False</Platform>
            </Platforms>
        </BorlandProject>
        <ProjectFileVersion>12</ProjectFileVersion>
    </ProjectExtensions>
    <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
</Project>






|








>
>
>
>
>












>

<
>




|







 







|







 







|
|











1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

35
36
37
38
39
40
41
42
43
44
45
46
47
..
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <ProjectGuid>{6D193C34-4617-40F0-A1F0-F4ABDB7FFD3B}</ProjectGuid>
        <MainSource>TempusFugit.dpr</MainSource>
        <Config Condition="'$(Config)'==''">Debug</Config>
        <DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
        <ProjectVersion>16.0</ProjectVersion>
        <FrameworkType>VCL</FrameworkType>
        <Base>True</Base>
        <Platform Condition="'$(Platform)'==''">Win32</Platform>
        <TargetedPlatforms>1</TargetedPlatforms>
        <AppType>Application</AppType>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
        <Base_Win32>true</Base_Win32>
        <CfgParent>Base</CfgParent>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
        <Cfg_1>true</Cfg_1>
        <CfgParent>Base</CfgParent>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
        <Cfg_2>true</Cfg_2>
        <CfgParent>Base</CfgParent>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Base)'!=''">
        <SanitizedProjectName>TempusFugit</SanitizedProjectName>
        <VerInfo_PreRelease>true</VerInfo_PreRelease>

        <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
        <Icon_MainIcon>..\..\..\res\Stopwatch.ico</Icon_MainIcon>
        <VerInfo_Locale>1043</VerInfo_Locale>
        <VerInfo_Build>7</VerInfo_Build>
        <VerInfo_AutoGenVersion>true</VerInfo_AutoGenVersion>
        <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;$(DCC_Namespace)</DCC_Namespace>
        <VerInfo_Keys>CompanyName=Voronwë;FileDescription=TempusFugit;FileVersion=1.0.0.7;InternalName=TempusFugit;LegalCopyright=© Martijn Coppoolse;LegalTrademarks=;OriginalFilename=TempusFugit.exe;ProductName=Tempus Fugit;ProductVersion=1.0.0.0;Comments=http://martijn.coppoolse.com/software/</VerInfo_Keys>
        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
        <DCC_DependencyCheckOutputName>..\..\..\out\TempusFugit.exe</DCC_DependencyCheckOutputName>
        <DCC_UnitSearchPath>..\..;..\..\Lib;W:\Lib;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
        <DCC_UsePackage>vcl;rtl;vclx;dbrtl;vcldb;adortl;xmlrtl;vclactnband;inet;vclie;inetdbbde;inetdbxpress;IndyCore;IndySystem;dclOfficeXP;VclSmp;soaprtl;dsnap;IndyProtocols;bdertl;teeui;teedb;tee;vcldbx;TMSD2006;Scit;DL_Geo_100;DL_Base_100;S303_r100;B305_r100;DL_Control_100;DL_GDI_100;RaizeComponentsVcl;$(DCC_UsePackage)</DCC_UsePackage>
        <DCC_ImageBase>00400000</DCC_ImageBase>
        <DCC_RangeChecking>true</DCC_RangeChecking>
................................................................................
        <DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Cfg_1)'!=''">
        <VerInfo_PreRelease>false</VerInfo_PreRelease>
        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
        <DCC_DebugInformation>0</DCC_DebugInformation>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Cfg_2)'!=''">
        <VerInfo_Debug>true</VerInfo_Debug>
        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
        <DCC_OutputDependencies>true</DCC_OutputDependencies>
        <DCC_Optimize>false</DCC_Optimize>
        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
................................................................................
                    <VersionInfoKeys Name="LegalTrademarks"/>
                    <VersionInfoKeys Name="OriginalFilename">TempusFugit.exe</VersionInfoKeys>
                    <VersionInfoKeys Name="ProductName">Tempus Fugit</VersionInfoKeys>
                    <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
                    <VersionInfoKeys Name="Comments">http://martijn.coppoolse.com/software/</VersionInfoKeys>
                </VersionInfoKeys>
                <Excluded_Packages>
                    <Excluded_Packages Name="$(BDSBIN)\dcloffice2k210.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
                    <Excluded_Packages Name="$(BDSBIN)\dclofficexp210.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
                </Excluded_Packages>
            </Delphi.Personality>
            <Platforms>
                <Platform value="Win32">True</Platform>
                <Platform value="Win64">False</Platform>
            </Platforms>
        </BorlandProject>
        <ProjectFileVersion>12</ProjectFileVersion>
    </ProjectExtensions>
    <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
</Project>

Deleted src/prj/d2009/TempusFugit.res.

cannot compute difference between binary files