Browse Source

Displaying information about tracing and reporting and exploring the log file when the application closes

Source commit: 167b90f73ae34a7fbc3be33c6b88c158991c3163
Martin Prikryl 9 years ago
parent
commit
8e3c6db001

+ 1 - 1
source/forms/CustomScpExplorer.cpp

@@ -5740,7 +5740,7 @@ void __fastcall TCustomScpExplorerForm::NeedSession(bool ReloadSessions)
     if (!WinConfiguration->KeepOpenWhenNoSession &&
         (!Terminal || !Terminal->Active))
     {
-      Application->Terminate();
+      TerminateApplication();
     }
   }
 }

+ 1 - 1
source/forms/Editor.cpp

@@ -726,7 +726,7 @@ __fastcall TEditorForm::~TEditorForm()
 
   if (FStandaloneEditor)
   {
-    Application->Terminate();
+    TerminateApplication();
   }
 }
 //---------------------------------------------------------------------------

+ 9 - 4
source/forms/MessageDlg.cpp

@@ -22,6 +22,11 @@
 //---------------------------------------------------------------------------
 #pragma package(smart_init)
 //---------------------------------------------------------------------------
+const UnicodeString MessagePanelName(L"Panel");
+const UnicodeString MainMessageLabelName(L"MainMessage");
+const UnicodeString MessageLabelName(L"Message");
+const UnicodeString YesButtonName(L"Yes");
+//---------------------------------------------------------------------------
 class TMessageButton : public TButton
 {
 public:
@@ -736,7 +741,7 @@ void __fastcall AnswerNameAndCaption(
   {
     case qaYes:
       Caption = LoadStr(_SMsgDlgYes.Identifier);
-      Name = L"Yes";
+      Name = YesButtonName;
       break;
 
     case qaNo:
@@ -1014,7 +1019,7 @@ TForm * __fastcall TMessageForm::Create(const UnicodeString & Msg,
 
   TPanel * Panel = CreateBlankPanel(Result);
   Result->ContentsPanel = Panel;
-  Panel->Name = L"Panel";
+  Panel->Name = MessagePanelName;
   Panel->Parent = Result;
   Panel->Color = clWindow;
   Panel->ParentBackground = false;
@@ -1094,14 +1099,14 @@ TForm * __fastcall TMessageForm::Create(const UnicodeString & Msg,
     {
       case 0:
         LabelMsg = MainMsg;
-        LabelName = L"MainMessage";
+        LabelName = MainMessageLabelName;
         LabelColor = MainInstructionColor;
         LabelFont = MainInstructionFont;
         break;
 
       case 1:
         LabelMsg = BodyMsg;
-        LabelName = L"Message";
+        LabelName = MessageLabelName;
         break;
 
       default:

+ 1 - 0
source/resource/HelpWin.h

@@ -56,5 +56,6 @@
 #define HELP_DRAGEXT_TARGET_UNKNOWN  HELP_DRAGEXT_TARGET_NOT_INSTALLED
 #define HELP_KEY_TYPE_UNSUPPORTED    "ui_puttygen#other_formats"
 #define HELP_TIPS                    "ui_tips"
+#define HELP_DEBUGGING               "debugging"
 
 #endif // TextsWin

+ 25 - 1
source/windows/GUITools.cpp

@@ -684,10 +684,15 @@ void __fastcall LoadDialogImage(TImage * Image, const UnicodeString & ImageName)
   }
   // When showing an exception from wWinMain, the glyphs module does not exist anymore.
   // We expect errors only.
-  else if (DebugAlwaysTrue(ImageName == L"Error"))
+  else if (ImageName == L"Error")
   {
     Image->Picture->Icon->Handle = LoadIcon(0, IDI_HAND);
   }
+  // For showing an information about trace files
+  else if (DebugAlwaysTrue(ImageName == L"Information"))
+  {
+    Image->Picture->Icon->Handle = LoadIcon(0, IDI_APPLICATION);
+  }
 }
 //---------------------------------------------------------------------------
 int __fastcall DialogImageSize()
@@ -869,6 +874,25 @@ void __fastcall NavigateBrowserToUrl(TWebBrowserEx * WebBrowser, const UnicodeSt
   }
 }
 //---------------------------------------------------------------------------
+TComponent * __fastcall FindComponentRecursively(TComponent * Root, const UnicodeString & Name)
+{
+  for (int Index = 0; Index < Root->ComponentCount; Index++)
+  {
+    TComponent * Component = Root->Components[Index];
+    if (CompareText(Component->Name, Name) == 0)
+    {
+      return Component;
+    }
+
+    Component = FindComponentRecursively(Component, Name);
+    if (Component != NULL)
+    {
+      return Component;
+    }
+  }
+  return NULL;
+}
+//---------------------------------------------------------------------------
 TLocalCustomCommand::TLocalCustomCommand()
 {
 }

+ 1 - 0
source/windows/GUITools.h

@@ -60,6 +60,7 @@ void __fastcall SetBrowserDesignModeOff(TWebBrowserEx * WebBrowser);
 void __fastcall AddBrowserLinkHandler(TWebBrowserEx * WebBrowser,
   const UnicodeString & Url, TNotifyEvent Handler);
 void __fastcall NavigateBrowserToUrl(TWebBrowserEx * WebBrowser, const UnicodeString & Url);
+TComponent * __fastcall FindComponentRecursively(TComponent * Root, const UnicodeString & Name);
 //---------------------------------------------------------------------------
 class TLocalCustomCommand : public TFileCustomCommand
 {

+ 3 - 4
source/windows/Setup.cpp

@@ -1331,7 +1331,7 @@ void __fastcall TUpdateDownloadThread::UpdateDownloaded()
   }
 
   Configuration->Usage->Inc(L"UpdateRuns");
-  Application->Terminate();
+  TerminateApplication();
 }
 //---------------------------------------------------------------------------
 void __fastcall TUpdateDownloadThread::DownloadNotVerified()
@@ -1954,13 +1954,12 @@ static void __fastcall UpdateTipsForm(TCustomForm * Form)
 {
   TTipsData * TipsData = TTipsData::Retrieve(Form);
 
-  TButton * PrevButton = DebugNotNull(dynamic_cast<TButton *>(Form->FindComponent(L"Yes")));
+  TButton * PrevButton = DebugNotNull(dynamic_cast<TButton *>(Form->FindComponent(YesButtonName)));
   PrevButton->Enabled = (TipsData->Index > 0);
   TButton * NextButton = DebugNotNull(dynamic_cast<TButton *>(Form->FindComponent(L"No")));
   NextButton->Enabled = (TipsData->Index < TipsData->Tips->Count - 1);
 
-  TPanel * Panel = DebugNotNull(dynamic_cast<TPanel *>(Form->FindComponent(L"Panel")));
-  TLabel * MessageLabel = DebugNotNull(dynamic_cast<TLabel *>(Panel->FindComponent(L"MainMessage")));
+  TLabel * MessageLabel = DebugNotNull(dynamic_cast<TLabel *>(FindComponentRecursively(Form, MainMessageLabelName)));
   MessageLabel->Caption = TipsMessage(TipsData);
 }
 //---------------------------------------------------------------------------

+ 6 - 1
source/windows/UserInterface.cpp

@@ -125,6 +125,11 @@ void __fastcall ShowExtendedException(Exception * E)
   ShowExtendedExceptionEx(NULL, E);
 }
 //---------------------------------------------------------------------------
+void __fastcall TerminateApplication()
+{
+  Application->Terminate();
+}
+//---------------------------------------------------------------------------
 void __fastcall ShowExtendedExceptionEx(TTerminal * Terminal,
   Exception * E)
 {
@@ -231,7 +236,7 @@ void __fastcall ShowExtendedExceptionEx(TTerminal * Terminal,
         DebugAssert(CloseOnCompletion);
         DebugAssert(Terminate != NULL);
         DebugAssert(Terminate->Operation != odoIdle);
-        Application->Terminate();
+        TerminateApplication();
 
         switch (Terminate->Operation)
         {

+ 1 - 0
source/windows/WinInterface.cpp

@@ -23,6 +23,7 @@
 #include "JclHookExcept.hpp"
 #include <StrUtils.hpp>
 #include <WinApi.h>
+#include "Tools.h"
 //---------------------------------------------------------------------------
 #pragma package(smart_init)
 //---------------------------------------------------------------------------

+ 5 - 0
source/windows/WinInterface.h

@@ -78,6 +78,7 @@ extern const UnicodeString AppName;
 void __fastcall SetOnForeground(bool OnForeground);
 void __fastcall FlashOnBackground();
 
+void __fastcall TerminateApplication();
 void __fastcall ShowExtendedExceptionEx(TTerminal * Terminal, Exception * E);
 void __fastcall FormHelp(TCustomForm * Form);
 void __fastcall SearchHelp(const UnicodeString & Message);
@@ -387,6 +388,10 @@ TForm * __fastcall CreateMoreMessageDialogEx(const UnicodeString Message, TStrin
 unsigned int __fastcall ExecuteMessageDialog(TForm * Dialog, unsigned int Answers, const TMessageParams * Params);
 void __fastcall InsertPanelToMessageDialog(TCustomForm * Form, TPanel * Panel);
 void __fastcall NavigateMessageDialogToUrl(TCustomForm * Form, const UnicodeString & Url);
+extern const UnicodeString MessagePanelName;
+extern const UnicodeString MainMessageLabelName;
+extern const UnicodeString MessageLabelName;
+extern const UnicodeString YesButtonName;
 
 // windows\Console.cpp
 enum TConsoleMode { cmNone, cmScripting, cmHelp, cmBatchSettings, cmKeyGen, cmFingerprintScan };