[tuxdroid-svn] r5178 - software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_br
Status: Beta
Brought to you by:
ks156
|
From: jerome <c2m...@c2...> - 2009-07-28 07:52:37
|
Author: jerome
Date: 2009-07-28 09:52:26 +0200 (Tue, 28 Jul 2009)
New Revision: 5178
Modified:
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.dcu
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.pas
Log:
* Getting tray icon states only if tuxdroid server is started.
Modified: software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.dcu
===================================================================
(Binary files differ)
Modified: software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.pas
===================================================================
--- software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.pas 2009-07-28 07:36:52 UTC (rev 5177)
+++ software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.pas 2009-07-28 07:52:26 UTC (rev 5178)
@@ -159,7 +159,7 @@
//Setting app icon.
AppIcon := TIcon.Create;
- ImageList1.GetIcon(0, AppIcon);
+ ImageList1.GetIcon(1, AppIcon);
Application.Icon := AppIcon;
Form1.Icon := AppIcon;
@@ -403,94 +403,99 @@
temp : TStringList;
begin
- try
- TuxUtils.getStates(temp);
- dongle := TuxUtils.isDongleConnected(temp);
- sound := TuxUtils.isSoundOn(temp);
- radio := TuxUtils.isRadioConnected(temp);
- activity := TuxUtils.isOnActivity(temp);
- except
- on e : Exception do
- begin
- dongle := false;
- sound := true;
- radio := false;
- activity := false;
+ server := TuxUtils.isTuxDroidServerStarted();
+
+ //Trying to get states only if server is started.
+ if server then
+ begin
+ try
+ TuxUtils.getStates(temp);
+ dongle := TuxUtils.isDongleConnected(temp);
+ sound := TuxUtils.isSoundOn(temp);
+ radio := TuxUtils.isRadioConnected(temp);
+ activity := TuxUtils.isOnActivity(temp);
+ except
+ on e : Exception do
+ begin
+ dongle := false;
+ sound := true;
+ radio := false;
+ activity := false;
+ end;
end;
- end;
- temp.Free;
- server := TuxUtils.isTuxDroidServerStarted();
+ temp.Free;
- connection := server and dongle and radio;
+ connection := server and dongle and radio;
- //Changing tray icon 'connection' if server isn't started or no radio detected and
- //State has changed since last knowledge register.
- if connection and sound and ( not activity ) and ( ( TuxUtils.knowed_mute
- and ( not TuxUtils.knowed_activity )) <> ( sound and (not activity) )) then
- begin
- if balloonShowed then
- Form1.HideBalloonTips();
+ //Changing tray icon 'connection' if server isn't started or no radio detected and
+ //State has changed since last knowledge register.
+ if connection and sound and ( not activity ) and ( ( TuxUtils.knowed_mute
+ and ( not TuxUtils.knowed_activity )) <> ( sound and (not activity) )) then
+ begin
+ if balloonShowed then
+ Form1.HideBalloonTips();
- ImageList1.GetIcon(0, AppIcon);
- IconData.hIcon := AppIcon.Handle;
- Shell_NotifyIcon(Nim_Modify, @IconData);
- end
+ ImageList1.GetIcon(0, AppIcon);
+ IconData.hIcon := AppIcon.Handle;
+ Shell_NotifyIcon(Nim_Modify, @IconData);
+ end
- //Changing tray icon 'mute' only if last registered values <> new sound and
- //activity values.
- else if connection and ( not sound ) and ( not activity ) and
- ( ( ( not sound ) and ( not activity ) ) <> ( ( not TuxUtils.knowed_mute )
- and ( not TuxUtils.knowed_activity ) ) )then
- begin
- if balloonShowed then
- Form1.HideBalloonTips();
+ //Changing tray icon 'mute' only if last registered values <> new sound and
+ //activity values.
+ else if connection and ( not sound ) and ( not activity ) and
+ ( ( ( not sound ) and ( not activity ) ) <> ( ( not TuxUtils.knowed_mute )
+ and ( not TuxUtils.knowed_activity ) ) )then
+ begin
+ if balloonShowed then
+ Form1.HideBalloonTips();
- ImageList1.GetIcon(4, AppIcon);
- IconData.hIcon := AppIcon.Handle;
- Shell_NotifyIcon(Nim_Modify, @IconData);
- end
+ ImageList1.GetIcon(4, AppIcon);
+ IconData.hIcon := AppIcon.Handle;
+ Shell_NotifyIcon(Nim_Modify, @IconData);
+ end
- else if connection and activity and sound and ( ( sound and activity ) <>
- ( TuxUtils.knowed_mute and TuxUtils.knowed_activity ) ) then
- begin
- if balloonShowed then
- Form1.HideBalloonTips();
+ else if connection and activity and sound and ( ( sound and activity ) <>
+ ( TuxUtils.knowed_mute and TuxUtils.knowed_activity ) ) then
+ begin
+ if balloonShowed then
+ Form1.HideBalloonTips();
- ImageList1.GetIcon(3, AppIcon);
- IconData.hIcon := AppIcon.Handle;
- Shell_NotifyIcon(Nim_Modify, @IconData);
- end
+ ImageList1.GetIcon(3, AppIcon);
+ IconData.hIcon := AppIcon.Handle;
+ Shell_NotifyIcon(Nim_Modify, @IconData);
+ end
- //Changing icon only if last state <> new state.
- else if connection <> ( TuxUtils.knowed_server and TuxUtils.knowed_radio and TuxUtils.knowed_dongle)
- or ( not started ) then
- begin
- if balloonShowed then
- Form1.HideBalloonTips();
+ //Changing icon only if last state <> new state.
+ else if connection <> ( TuxUtils.knowed_server and TuxUtils.knowed_radio and TuxUtils.knowed_dongle)
+ or ( not started ) then
+ begin
+ if balloonShowed then
+ Form1.HideBalloonTips();
- ImageList1.GetIcon(1, AppIcon);
- IconData.hIcon := AppIcon.Handle;
- Shell_NotifyIcon(Nim_Modify, @IconData);
- end;
+ ImageList1.GetIcon(1, AppIcon);
+ IconData.hIcon := AppIcon.Handle;
+ Shell_NotifyIcon(Nim_Modify, @IconData);
+ end;
- if sound then
- //Updating tick from popup menu ( sound on ).
- Mute1.ImageIndex := -1
- else
- //Updating tick from popup menu ( sound off ).
- Mute1.ImageIndex := 5;
+ if sound then
+ //Updating tick from popup menu ( sound on ).
+ Mute1.ImageIndex := -1
+ else
+ //Updating tick from popup menu ( sound off ).
+ Mute1.ImageIndex := 5;
- //Registering new values.
- TuxUtils.knowed_mute := sound;
- TuxUtils.knowed_radio := radio;
- TuxUtils.knowed_dongle := dongle;
- TuxUtils.knowed_server := server;
- TuxUtils.knowed_activity := activity;
+ //Registering new values.
+ TuxUtils.knowed_mute := sound;
+ TuxUtils.knowed_radio := radio;
+ TuxUtils.knowed_dongle := dongle;
+ TuxUtils.knowed_server := server;
+ TuxUtils.knowed_activity := activity;
- if not started then
- started := true;
-
+ if not started then
+ started := true;
+ end;
+
Application.ProcessMessages;
end;
@@ -593,7 +598,7 @@
closeFile(F);
result := strtobool(res);
except
-
+ result := true;
end;
end;
end;
|