Author: jerome
Date: 2009-07-23 20:15:18 +0200 (Thu, 23 Jul 2009)
New Revision: 5146

Modified:
   
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/TuxUtils.dcu
   
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/TuxUtils.pas
   
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.dfm
   
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.pas
Log:
* Implemented 'activity' dynamic tray icon changes ( based on alerts activity ).

Modified: 
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/TuxUtils.dcu
===================================================================
(Binary files differ)

Modified: 
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/TuxUtils.pas
===================================================================
--- 
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/TuxUtils.pas
      2009-07-23 12:54:43 UTC (rev 5145)
+++ 
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/TuxUtils.pas
      2009-07-23 18:15:18 UTC (rev 5146)
@@ -45,8 +45,8 @@
   while Integer(ContinueLoop) <> 0 do
   begin
     if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
-         UpperCase('PythonForTuxDroid.exe')) or 
(UpperCase(FProcessEntry32.szExeFile) =
-         UpperCase('PythonForTuxDroid.exe')))
+         UpperCase('pythonForTuxdroid.exe')) or 
(UpperCase(FProcessEntry32.szExeFile) =
+         UpperCase('pythonForTuxdroid.exe')))
     then begin
       Result := True;
     end;
@@ -125,7 +125,7 @@
     values.add(Copy(aString, beginPos, endPos - beginPos));
   except
     on e : Exception do
-      values.add('off');
+        values.add('off');
   end;
 
   try
@@ -139,9 +139,12 @@
   end;
 
   try
-    //Searching for activity state ( <gadgets>   )
-    //beginPos := Pos('<alerts>', aString) + Length('<alerts>');
-    values.add('off');
+    //Searching for activity state ( <alert>   )
+    beginPos := Pos('<alert>', aString);
+    if beginPos > 0 then
+      values.Add('on')
+    else
+      values.Add('off');
   except
     on e : Exception do
       values.Add('off');
@@ -176,11 +179,11 @@
 begin
   if states <> nil then
      if states[0] = 'on' then
-       result := true
+         result := true
      else
-       result := false
+         result := false
   else
-     result := false;
+      result := false;
 end;
 
 
@@ -213,9 +216,11 @@
 {#### Return true if a gadget is in activity ####}
 function isOnActivity(states : TStringList) : boolean;
 begin
-   //3
    if states <> nil then
-     result := false
+     if states[3] = 'on' then
+       result := true
+     else
+       result := false
    else
      result := false;
 end;

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.dfm
===================================================================
--- 
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.dfm
 2009-07-23 12:54:43 UTC (rev 5145)
+++ 
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.dfm
 2009-07-23 18:15:18 UTC (rev 5146)
@@ -1,8 +1,9 @@
 object Form1: TForm1
-  Left = 267
-  Top = 168
-  Width = 1024
-  Height = 768
+  Left = 306
+  Top = 153
+  Width = 963
+  Height = 653
+  AutoSize = True
   Caption = 'TuxBox 2.0'
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
@@ -48,6 +49,7 @@
     0000F0030000C001000080000000800000000000000000000000000000000000
     000000000000000100000001000080030000C0030000E0070000F01F0000}
   OldCreateOrder = False
+  Position = poScreenCenter
   OnCloseQuery = FormCloseQuery
   OnCreate = FormCreate
   PixelsPerInch = 96
@@ -55,9 +57,8 @@
   object EmbeddedWB1: TEmbeddedWB
     Left = 0
     Top = 0
-    Width = 1016
-    Height = 715
-    Align = alClient
+    Width = 955
+    Height = 619
     TabOrder = 0
     Silent = False
     RegisterAsBrowser = True
@@ -87,8 +88,8 @@
   end
   object StatusBar1: TStatusBar
     Left = 0
-    Top = 715
-    Width = 1016
+    Top = 600
+    Width = 955
     Height = 19
     Panels = <>
     SimplePanel = False
@@ -530,7 +531,6 @@
     Top = 8
   end
   object ConnectionChecker: TTimer
-    Interval = 2000
     OnTimer = ConnectionCheckerTimer
     Left = 104
     Top = 8

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-23 12:54:43 UTC (rev 5145)
+++ 
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.pas
 2009-07-23 18:15:18 UTC (rev 5146)
@@ -44,8 +44,8 @@
     Quit1: TMenuItem;
     ImageList1: TImageList;
     EwbControl1: TEwbControl;
+    ConnectionChecker: TTimer;
     StatusBar1: TStatusBar;
-    ConnectionChecker: TTimer;
 
     procedure FormCreate(Sender: TObject);
     procedure ShowHide1Click(Sender: TObject);
@@ -273,7 +273,7 @@
 {####  Check server and dongle state every 3000 ms  ####}
 procedure TForm1.ConnectionCheckerTimer(Sender: TObject);
 var
-  server, dongle , sound, radio : boolean;
+  server, dongle , sound, radio, activity, connection : boolean;
   temp : TStringList;
 
 begin
@@ -282,28 +282,42 @@
     dongle := TuxUtils.isDongleConnected(temp);
     sound := TuxUtils.isSoundOn(temp);
     radio := TuxUtils.isRadioConnected(temp);
+    activity := TuxUtils.isOnActivity(temp);
   except
-    dongle := false;
-    sound := true;
-    radio := false;
+    on e : Exception do
+      begin
+        showmessage(e.Message);
+        dongle := false;
+        sound := true;
+        radio := false;
+        activity := false;
+      end;
   end;
 
   temp.Free;
   server := TuxUtils.isTuxDroidServerStarted();
 
+  connection := server and dongle and radio;
+
   //Changing tray icon if server isn't started or no radio detected.
-  if ( server and dongle and radio and sound ) then
+  if connection and sound and ( not activity ) then
     begin
       ImageList1.GetIcon(0, AppIcon);
       Tray.hIcon := AppIcon.Handle;
       Shell_NotifyIcon(Nim_Modify, @tray);
     end
-  else if (not sound) and (server and dongle and radio) then
+  else if connection and ( not sound ) and ( not activity ) then
     begin
       ImageList1.GetIcon(4, AppIcon);
       Tray.hIcon := AppIcon.Handle;
       Shell_NotifyIcon(Nim_Modify, @tray);
     end
+  else if connection and activity and sound then
+    begin
+      ImageList1.GetIcon(3, AppIcon);
+      Tray.hIcon := AppIcon.Handle;
+      Shell_NotifyIcon(Nim_Modify, @tray);
+    end
   else
     begin
       ImageList1.GetIcon(1, AppIcon);


------------------------------------------------------------------------------
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to