[tuxdroid-svn] r5209 - 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 13:53:12
|
Author: jerome
Date: 2009-07-28 15:52:42 +0200 (Tue, 28 Jul 2009)
New Revision: 5209
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.pas
Log:
* Updated the way to stop the server.
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-28 13:00:59 UTC (rev 5208)
+++ software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/TuxUtils.pas 2009-07-28 13:52:42 UTC (rev 5209)
@@ -294,20 +294,10 @@
{#### This function stops the tux droid server. ####}
function stopServer() : boolean;
-const
- command_stop = 'http://127.0.0.1:270/0/server/stop?';
var
request_result : string;
begin
- if TuxUtils.isTuxDroidServerStarted then
- begin
- request_result := TuxUtils.DownloadHTTP(command_stop);
- result := TuxUtils.getResult(request_result);
- end
- else
- begin
- result := true;
- end;
+ ShellExecute(HWND(nil), 'open', PChar('smart_server_stop'), nil, nil, SW_HIDE);
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.pas
===================================================================
--- software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.pas 2009-07-28 13:00:59 UTC (rev 5208)
+++ software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.pas 2009-07-28 13:52:42 UTC (rev 5209)
@@ -155,12 +155,14 @@
var
- Form1 : TForm1;
- url : String;
- Tray : TNotifyIconData;
- AppIcon : TIcon;
- started : boolean;
- balloonShowed : boolean;
+ Form1 : TForm1;
+ TUXBOX_CONF_FILE : string;
+ url : string;
+ language : string;
+ Tray : TNotifyIconData;
+ AppIcon : TIcon;
+ started : boolean;
+ balloonShowed : boolean;
implementation
@@ -176,6 +178,8 @@
begin
url := 'http://127.0.0.1:270/user/';
+ TUXBOX_CONF_FILE := Form1.GetTuxDroidDataBaseDirectory
+ + '\configurations\TuxBox2.0.conf';
started := false;
//Setting app icon.
@@ -197,7 +201,7 @@
gnugettext.UseLanguage('en');
TP_GlobalIgnoreClassProperty(TEmbeddedWB, 'StatusText');
TP_Ignore(self, '.StatusText');
- TranslateComponent (self);
+ TranslateComponent(self);
//Starting server if not started yet.
if not TuxUtils.isTuxDroidServerStarted() then
@@ -242,12 +246,12 @@
procedure TForm1.WMQueryEndSession(var Message: TWMQueryEndSession);
begin
- inherited;
- ConnectionChecker.Enabled := false;
- TuxUtils.stopServer();
- Shell_NotifyIcon(Nim_DELETE, @IconData);
- Application.Terminate;
- Message.Result:=1;
+ inherited;
+ ConnectionChecker.Enabled := false;
+ TuxUtils.stopServer();
+ Shell_NotifyIcon(Nim_DELETE, @IconData);
+ Application.Terminate;
+ Message.Result:=1;
end;
@@ -259,16 +263,16 @@
procedure TForm1.ShowHide1Click(Sender: TObject);
begin
if Form1.Visible then
- begin
- EmbeddedWB1.Go('about:blank');
- Form1.Visible := false;
- SetForegroundWindow(Application.Handle);
- end
+ begin
+ EmbeddedWB1.Go('about:blank');
+ Form1.Visible := false;
+ SetForegroundWindow(Application.Handle);
+ end
else
- begin
- EmbeddedWB1.Go(url);
- Form1.Visible := true;
- end;
+ begin
+ EmbeddedWB1.Go(url);
+ Form1.Visible := true;
+ end;
end;
@@ -313,8 +317,8 @@
else
begin
Mute1.ImageIndex := -1;
+ end;
end;
- end;
end;
@@ -362,9 +366,9 @@
end;
if Browser = '' then
- begin
- Exit;
- end;
+ begin
+ Exit;
+ end;
Browser := Copy(Browser, Pos('"', Browser) + 1, Length(Browser)) ;
Browser := Copy(Browser, 1, Pos('"', Browser) - 1) ;
@@ -380,28 +384,28 @@
//Clique droit de la souris
if msg.LParam = Wm_LButtonDBLCLK then
- begin
- //Showing application.
- if Form1.Visible then
- begin
- EmbeddedWB1.Go('about:blank');
- Form1.Visible := false;
- end
- else
- begin
- EmbeddedWB1.Go(url);
- Form1.Visible := true;
- SetForegroundWindow(Application.Handle);
- end;
+ begin
+ //Showing application.
+ if Form1.Visible then
+ begin
+ EmbeddedWB1.Go('about:blank');
+ Form1.Visible := false;
+ end
+ else
+ begin
+ EmbeddedWB1.Go(url);
+ Form1.Visible := true;
+ SetForegroundWindow(Application.Handle);
+ end;
- end
+ end
else if msg.LParam = Wm_RButtonDown then
- begin
- SetForegroundWindow(Handle);
- GetCursorPos(Cursor);
- PopupMenu1.Popup(Cursor.X, Cursor.Y);
- PostMessage(Handle, WM_NULL, 0, 0);
- end
+ begin
+ SetForegroundWindow(Handle);
+ GetCursorPos(Cursor);
+ PopupMenu1.Popup(Cursor.X, Cursor.Y);
+ PostMessage(Handle, WM_NULL, 0, 0);
+ end
else if msg.LParam = NIN_BALLOONUSERCLICK then
begin
@@ -418,28 +422,28 @@
options : TUserInterfaceOptions;
begin
if EmbeddedWB1.OleObject.Document.Body.ScrollHeight <= self.EmbeddedWB1.Height then
- begin
-
- if not ( DontUseScrollBars in self.EmbeddedWB1.UserInterfaceOptions ) then
begin
- options := [EnablesFormsAutoComplete,EnableThemes, DontUseScrollBars];
- EmbeddedWB1.UserInterfaceOptions := options;
- EmbeddedWB1.Refresh2;
- end;
- end
+ if not ( DontUseScrollBars in self.EmbeddedWB1.UserInterfaceOptions ) then
+ begin
+ options := [EnablesFormsAutoComplete,EnableThemes, DontUseScrollBars];
+ EmbeddedWB1.UserInterfaceOptions := options;
+ EmbeddedWB1.Refresh2;
+ end;
+ end
+
else
- begin
+ begin
- if DontUseScrollBars in self.EmbeddedWB1.UserInterfaceOptions then
- begin
- options := [EnablesFormsAutoComplete,EnableThemes];
- EmbeddedWB1.UserInterfaceOptions := options;
- EmbeddedWB1.Refresh2;
+ if DontUseScrollBars in self.EmbeddedWB1.UserInterfaceOptions then
+ begin
+ options := [EnablesFormsAutoComplete,EnableThemes];
+ EmbeddedWB1.UserInterfaceOptions := options;
+ EmbeddedWB1.Refresh2;
+ end;
+
end;
-
- end;
end;
@@ -542,7 +546,14 @@
if not started then
started := true;
end;
-
+
+ //Checking for language change.
+ if language <> TuxUtils.getUserLanguage then
+ begin
+ language := TuxUtils.getUserLanguage();
+ gnugettext.UseLanguage(language);
+ end;
+
Application.ProcessMessages;
end;
@@ -619,25 +630,24 @@
*}
function TForm1.GetAllUsersDir : string;
begin
- result := GetEnvironmentVariable('ALLUSERSPROFILE');
+ result := GetEnvironmentVariable('ALLUSERSPROFILE');
end;
{ \brief Get the Tux Droid data base directory return A string.}
function TForm1.GetTuxDroidDataBaseDirectory : string;
begin
- result := GetAllUsersDir + '\Kysoh\Tux Droid';
+ result := GetAllUsersDir + '\Kysoh\Tux Droid';
end;
{ Return true if the balloon can be showed. }
function TForm1.isBalloonCanShow() : boolean;
var
- path : string;
res : string;
F : TextFile;
+ beginPos : Integer;
begin
- path := GetTuxDroidDataBaseDirectory + '\configurations\TuxBox2.0.conf';
- if not FileExists(path) then
+ if not FileExists(TUXBOX_CONF_FILE) then
begin
//Creating state file.
Form1.setBalloonCanShow(true);
@@ -646,11 +656,23 @@
else
begin
try
- AssignFile(F, path);
+ AssignFile(F, TUXBOX_CONF_FILE);
reset(F);
readLn(F, res);
closeFile(F);
- result := strtobool(res);
+ beginPos := Pos('show_balloon=', res) + Length('show_balloon=');
+ if(beginPos <> 0) then
+ begin
+ try
+ result := strtobool(Copy(res, beginPos, SizeOf(res) - 1))
+ except
+ on e : Exception do
+ result := true;
+ end;
+ end
+ else
+ result := true;
+
except
result := true;
end;
@@ -661,15 +683,13 @@
{ Set the balloon visible or not }
procedure TForm1.setBalloonCanShow(showable : boolean);
var
- path : string;
F : TextFile;
begin
{$i+}
- path := GetTuxDroidDataBaseDirectory + '\configurations\TuxBox2.0.conf';
try
- AssignFile(F, path);
+ AssignFile(F, TUXBOX_CONF_FILE);
rewrite(F);
- writeLn(F, booltostr(showable));
+ writeLn(F, 'show_balloon=' + booltostr(showable));
closeFile(F);
except
|