Преглед изворни кода

Generate counters - GeneratedUrls + GeneratedScripts + GeneratedScriptsTransfer + GeneratedCodes + GeneratedCodesTransfer

Source commit: 67ed69911d5645626955466cfafd8f41548ea43b
Martin Prikryl пре 9 година
родитељ
комит
1b83d7dd56
2 измењених фајлова са 23 додато и 0 уклоњено
  1. 20 0
      source/forms/GenerateUrl.cpp
  2. 3 0
      source/forms/GenerateUrl.h

+ 20 - 0
source/forms/GenerateUrl.cpp

@@ -150,6 +150,9 @@ __fastcall TGenerateUrlDialog::TGenerateUrlDialog(
   FCopyParam = CopyParam;
   FFilesSelected = FilesSelected;
   FPathsSample = false;
+  FUrlCounted = false;
+  FScriptCounted = false;
+  FAssemblyCounted = false;
 
   if (FTransfer)
   {
@@ -701,16 +704,24 @@ void __fastcall TGenerateUrlDialog::UpdateControls()
 
     UnicodeString Result;
 
+    bool * Counted = NULL;
+    UnicodeString CounterName;
     bool WordWrap = false; // shut up
     bool FixedWidth = false; // shut up
     if (OptionsPageControl->ActivePage == UrlSheet)
     {
+      Counted = &FUrlCounted;
+      CounterName = L"GeneratedUrls";
+
       Result = GenerateUrl();
       WordWrap = true;
       FixedWidth = false;
     }
     else if (OptionsPageControl->ActivePage == ScriptSheet)
     {
+      Counted = &FScriptCounted;
+      CounterName = FTransfer ? L"GeneratedScriptsTransfer" : L"GeneratedScripts";
+
       UnicodeString ScriptDescription;
       if (ScriptFormatCombo->ItemIndex == sfScriptFile)
       {
@@ -741,6 +752,9 @@ void __fastcall TGenerateUrlDialog::UpdateControls()
     }
     else if (DebugAlwaysTrue(OptionsPageControl->ActivePage == AssemblySheet))
     {
+      Counted = &FAssemblyCounted;
+      CounterName = FTransfer ? L"GeneratedCodesTransfer" : L"GeneratedCodes";
+
       UnicodeString AssemblyDescription;
       if (HostKeyUnknown)
       {
@@ -764,6 +778,12 @@ void __fastcall TGenerateUrlDialog::UpdateControls()
       FResultMemo41->ParentFont = true;
     }
 
+    if (!CounterName.IsEmpty() && !(*Counted))
+    {
+      (*Counted) = true;
+      Configuration->Usage->Inc(CounterName);
+    }
+
     Result =
       L"{\\rtf1\n"
        "{\\colortbl ;" +

+ 3 - 0
source/forms/GenerateUrl.h

@@ -66,6 +66,9 @@ private:
   TFilesSelected FFilesSelected;
   UnicodeString FSourcePath;
   TCopyParamType FCopyParam;
+  bool FUrlCounted;
+  bool FScriptCounted;
+  bool FAssemblyCounted;
 
 protected:
   void __fastcall UpdateControls();