mirror of
https://bitbucket.org/Dennis07/lina-components.git
synced 2024-11-24 08:02:12 +02:00
Version 1.0 DEV 1.02
Signed-off-by: Dennis07 <den.goehlert@t-online.de>
This commit is contained in:
parent
a903c5e989
commit
93182ccbbc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -12,7 +12,7 @@ uses
|
||||
{ Standard-Units }
|
||||
SysUtils, Classes, Windows,
|
||||
{ Andere Package-Units }
|
||||
uBase;
|
||||
uBase, uSysTools;
|
||||
|
||||
type
|
||||
{ Hilfsklassen }
|
||||
@ -23,12 +23,14 @@ type
|
||||
TBattery = class(TComponent)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
function BatteryFlag(Flag: Integer): TBatteryFlag;
|
||||
function SecToTime(Sec: Integer): TDateTime;
|
||||
FAbout: TComponentAbout;
|
||||
protected
|
||||
{ Protected-Deklarationen }
|
||||
function BatteryFlag(Flag: Integer): TBatteryFlag;
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create;
|
||||
destructor Destroy;
|
||||
function GetPowerStatus: TBatteryStatus;
|
||||
function GetBatteryTime: TDateTime;
|
||||
function GetBatteryFullTime: TDateTime;
|
||||
@ -37,6 +39,7 @@ type
|
||||
function GetBatteryPercent: Byte;
|
||||
published
|
||||
{ Published-Deklarationen }
|
||||
property About: TComponentAbout read FAbout;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
@ -52,7 +55,7 @@ const
|
||||
PS_LOW = 'Low';
|
||||
PS_CRITICAL = 'Critical';
|
||||
PS_CHARGE = 'Charge';
|
||||
PS_HEALTHYACCU = 'Healthy (Akku)';
|
||||
PS_HEALTHYACCU = 'HealthyAccu';
|
||||
PS_NONE = 'None';
|
||||
PS_UNKNOWN = 'Unknown';
|
||||
|
||||
@ -76,23 +79,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBattery.SecToTime(Sec: Integer): TDateTime;
|
||||
var
|
||||
H, M, S: String;
|
||||
ZH, ZM, ZS: Integer;
|
||||
constructor TBattery.Create;
|
||||
begin
|
||||
if Sec < 0 then
|
||||
begin
|
||||
Result := StrToTime('00:00:00');
|
||||
Exit;
|
||||
end;
|
||||
ZH := Sec div 3600;
|
||||
ZM := Sec div 60 - ZH * 60;
|
||||
ZS := Sec - (ZH * 3600 + ZM * 60) ;
|
||||
H := IntToStr(ZH) ;
|
||||
M := IntToStr(ZM) ;
|
||||
S := IntToStr(ZS) ;
|
||||
Result := StrToTime(H + ':' + M + ':' + S);
|
||||
FAbout := TComponentAbout.Create(BatteryComponent_Name,BatteryComponent_Version,BatteryComponent_Copyright,BatteryComponent_Author);
|
||||
end;
|
||||
|
||||
destructor TBattery.Destroy;
|
||||
begin
|
||||
FAbout.Free;
|
||||
end;
|
||||
|
||||
function TBattery.GetPowerStatus: TBatteryStatus;
|
||||
|
@ -16,7 +16,7 @@ interface
|
||||
uses
|
||||
{ Standard-Units }
|
||||
Classes, SysUtils, ShellAPI, Forms, Winapi.Windows, Dialogs,
|
||||
{$IFNDEF NOGENERIC}
|
||||
{$IFNDEF NO_GENERIC}
|
||||
Generics.Collections,
|
||||
{$ENDIF}
|
||||
{ Andere Package-Units }
|
||||
|
@ -204,7 +204,7 @@ type
|
||||
property OnChange: TSplashChangeEvent read FChangeEvent write FChangeEvent;
|
||||
property OnTimer: TSplashTimerEvent read FTimerEvent write FTimerEvent;
|
||||
{ Eigenschaften }
|
||||
property About: TComponentAbout read FAbout write FAbout;
|
||||
property About: TComponentAbout read FAbout;
|
||||
property SplashForm: TSplashForm read FSplashForm write FSplashForm;
|
||||
property SplashProgressBar: TSplashProgressBar read FSplashProgressBar write FSplashProgressBar;
|
||||
property SplashImage: TSplashImage read FSplashImage write FSplashImage;
|
||||
@ -446,6 +446,7 @@ begin
|
||||
ProgressBarObject.Position := SplashProgressBar.Position;
|
||||
ProgressBarObject.Max := SplashProgressBar.Max;
|
||||
ProgressBarObject.Min := SplashProgressBar.Min;
|
||||
ProgressBarObject.Cursor := FormObject.Cursor;
|
||||
ProgressBarObject.Align := SplashProgressBar.Align;
|
||||
ProgressBarObject.BackgroundColor := SplashProgressBar.BackgroundColor;
|
||||
ProgressBarObject.BarColor := SplashProgressBar.BarColor;
|
||||
|
@ -61,7 +61,7 @@ type
|
||||
destructor Destroy; override;
|
||||
published
|
||||
{ Published-Deklarationen }
|
||||
property About: TComponentAbout read FAbout write FAbout;
|
||||
property About: TComponentAbout read FAbout;
|
||||
property Languages: TLocalizations read FLanguages write FLanguages;
|
||||
property Current: TLocalization read FCurrent write FCurrent;
|
||||
property Default: TLocalization read FDefault write FDefault;
|
||||
|
@ -17,7 +17,7 @@ interface
|
||||
uses
|
||||
{ Standard-Units }
|
||||
Classes, SysUtils, Math, Windows,
|
||||
{$IFNDEF NOGENERIC}
|
||||
{$IFNDEF NO_GENERIC}
|
||||
Types, Generics.Collections,
|
||||
{$ENDIF}
|
||||
{ Andere Package-Units }
|
||||
@ -26,29 +26,33 @@ uses
|
||||
type
|
||||
{ Fehlermeldungen }
|
||||
EWinUserInformation = class(Exception);
|
||||
EInvalidValueType = class(Exception);
|
||||
|
||||
type
|
||||
{$IFNDEF NOGENERIC}
|
||||
{$IFNDEF NO_GENERIC}
|
||||
TIntegerList = TList<Integer>;
|
||||
TBooleanList = TList<Boolean>;
|
||||
TFloatList = TList<Extended>;
|
||||
TPointList = TList<TPoint>;
|
||||
{$ENDIF}
|
||||
|
||||
{ Typenumwandelungen }
|
||||
function BoolToInt(B: Boolean): Integer;
|
||||
function IntToBool(Value: Integer): Boolean;
|
||||
|
||||
{ Typen-Äquivalenz-Prüfungen }
|
||||
function StrIsInt(const S: String): Boolean;
|
||||
function StrIsFloat(const S: String): Boolean;
|
||||
function StrIsBool(const S: String): Boolean;
|
||||
function FloatIsInt(Value: Extended): Boolean;
|
||||
|
||||
function SystemLanguage: String;
|
||||
|
||||
{ WinUser }
|
||||
function WinUserName: String;
|
||||
function WinUserDirectory: String;
|
||||
function WinUserAdmin: Boolean;
|
||||
function WinUserExists(UsrNme: String): Boolean;
|
||||
{ Sonstige }
|
||||
function SecToTime(const Sec: Cardinal): TTime;
|
||||
function SystemLanguage: String;
|
||||
function Empty(var Val): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
@ -94,11 +98,48 @@ begin
|
||||
Result := (Ceil(Value) = Floor(Value));
|
||||
end;
|
||||
|
||||
function SecToTime(const Sec: Cardinal): TTime;
|
||||
var
|
||||
TH, TM, TS: String;
|
||||
SH, SM, SS: Integer;
|
||||
begin
|
||||
if Sec <= 0 then
|
||||
begin
|
||||
Result := StrToTime('00:00:00');
|
||||
Exit;
|
||||
end;
|
||||
SH := Sec div 3600;
|
||||
SM := Sec div 60 - SH * 60;
|
||||
SS := Sec - (SH * 3600 + SM * 60) ;
|
||||
TH := IntToStr(SH);
|
||||
TM := IntToStr(SM);
|
||||
TS := IntToStr(SS);
|
||||
Result := StrToTime(TH + ':' + TM + ':' + TS);
|
||||
end;
|
||||
|
||||
function SystemLanguage: String;
|
||||
begin
|
||||
Result := Languages.NameFromLocaleID[Languages.UserDefaultLocale];
|
||||
end;
|
||||
|
||||
function Empty(var Val): Boolean;
|
||||
begin
|
||||
if Val is Pointer then
|
||||
begin
|
||||
Result := (Val = nil);
|
||||
end else
|
||||
begin
|
||||
if Val is TObject then
|
||||
begin
|
||||
Val = (Val as TObject).
|
||||
|
||||
end else
|
||||
begin
|
||||
raise EInvalidValueType.Create('Unsupported value type: ' + ToString(Val));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function WinUserName: String;
|
||||
var
|
||||
Buffer: array [0..255] of Char;
|
||||
@ -180,7 +221,8 @@ end;
|
||||
|
||||
function WinUserExists(UsrNme: String): Boolean;
|
||||
begin
|
||||
//...
|
||||
Result := False;
|
||||
//... MUSS NOCH GESCHRIEBEN WERDEN!!!
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user