@@ -196,7 +196,7 @@ internal sealed class ConfigManager
196
196
public string BrowserPath { get ; private set ; } = "" ;
197
197
public bool DisableHotkeys { get ; set ; } // = false;
198
198
public bool GlobalHotKeys { get ; private set ; } = true ;
199
- public bool StopIncreasingTimeStatWhenMinimized { get ; private set ; } = true ;
199
+ public bool StopIncreasingTimeAndCharStatsWhenMinimized { get ; private set ; } // = false ;
200
200
public bool StripPunctuationBeforeCalculatingCharacterCount { get ; private set ; } = true ;
201
201
public bool MineToFileInsteadOfAnki { get ; private set ; } // = false;
202
202
public bool AutoAdjustFontSizesOnResolutionChange { get ; private set ; } // = false;
@@ -317,7 +317,7 @@ public void ApplyPreferences(SqliteConnection connection)
317
317
HighlightLongestMatch = ConfigDBManager . GetValueFromConfig ( connection , HighlightLongestMatch , nameof ( HighlightLongestMatch ) , bool . TryParse ) ;
318
318
AutoPlayAudio = ConfigDBManager . GetValueFromConfig ( connection , AutoPlayAudio , nameof ( AutoPlayAudio ) , bool . TryParse ) ;
319
319
GlobalHotKeys = ConfigDBManager . GetValueFromConfig ( connection , GlobalHotKeys , nameof ( GlobalHotKeys ) , bool . TryParse ) ;
320
- StopIncreasingTimeStatWhenMinimized = ConfigDBManager . GetValueFromConfig ( connection , StopIncreasingTimeStatWhenMinimized , nameof ( StopIncreasingTimeStatWhenMinimized ) , bool . TryParse ) ;
320
+ StopIncreasingTimeAndCharStatsWhenMinimized = ConfigDBManager . GetValueFromConfig ( connection , StopIncreasingTimeAndCharStatsWhenMinimized , nameof ( StopIncreasingTimeAndCharStatsWhenMinimized ) , bool . TryParse ) ;
321
321
MineToFileInsteadOfAnki = ConfigDBManager . GetValueFromConfig ( connection , MineToFileInsteadOfAnki , nameof ( MineToFileInsteadOfAnki ) , bool . TryParse ) ;
322
322
AlwaysOnTop = ConfigDBManager . GetValueFromConfig ( connection , AlwaysOnTop , nameof ( AlwaysOnTop ) , bool . TryParse ) ;
323
323
mainWindow . Topmost = AlwaysOnTop ;
@@ -534,6 +534,17 @@ public void ApplyPreferences(SqliteConnection connection)
534
534
WinApi . UnregisterAllGlobalHotKeys ( mainWindow . WindowHandle ) ;
535
535
KeyGestureUtils . GlobalKeyGestureNameToKeyGestureDict . Clear ( ) ;
536
536
537
+ if ( ( ! StopIncreasingTimeAndCharStatsWhenMinimized || mainWindow . WindowState is not WindowState . Minimized )
538
+ && ( coreConfigManager . CaptureTextFromClipboard || coreConfigManager . CaptureTextFromWebSocket ) )
539
+ {
540
+ StatsUtils . StartTimeStatStopWatch ( ) ;
541
+ StatsUtils . InitializeIdleTimeTimer ( ) ;
542
+ }
543
+ else
544
+ {
545
+ StatsUtils . StopTimeStatStopWatch ( ) ;
546
+ }
547
+
537
548
DisableHotkeysKeyGesture = KeyGestureUtils . GetKeyGestureFromConfig ( connection , nameof ( DisableHotkeysKeyGesture ) , DisableHotkeysKeyGesture ) ;
538
549
MiningModeKeyGesture = KeyGestureUtils . GetKeyGestureFromConfig ( connection , nameof ( MiningModeKeyGesture ) , MiningModeKeyGesture ) ;
539
550
PlayAudioKeyGesture = KeyGestureUtils . GetKeyGestureFromConfig ( connection , nameof ( PlayAudioKeyGesture ) , PlayAudioKeyGesture ) ;
@@ -882,7 +893,7 @@ public void LoadPreferenceWindow(PreferencesWindow preferenceWindow)
882
893
preferenceWindow . CheckForJLUpdatesOnStartUpCheckBox . IsChecked = coreConfigManager . CheckForJLUpdatesOnStartUp ;
883
894
preferenceWindow . TrackTermLookupCountsCheckBox . IsChecked = coreConfigManager . TrackTermLookupCounts ;
884
895
preferenceWindow . GlobalHotKeysCheckBox . IsChecked = GlobalHotKeys ;
885
- preferenceWindow . StopIncreasingTimeStatWhenMinimizedCheckBox . IsChecked = StopIncreasingTimeStatWhenMinimized ;
896
+ preferenceWindow . StopIncreasingTimeAndCharStatsWhenMinimizedCheckBox . IsChecked = StopIncreasingTimeAndCharStatsWhenMinimized ;
886
897
preferenceWindow . StripPunctuationBeforeCalculatingCharacterCountCheckBox . IsChecked = StripPunctuationBeforeCalculatingCharacterCount ;
887
898
preferenceWindow . MineToFileInsteadOfAnkiCheckBox . IsChecked = MineToFileInsteadOfAnki ;
888
899
preferenceWindow . AlwaysOnTopCheckBox . IsChecked = AlwaysOnTop ;
@@ -981,6 +992,7 @@ public void LoadPreferenceWindow(PreferencesWindow preferenceWindow)
981
992
preferenceWindow . MaxDelayBetweenCopiesForMergingMatchingSequentialTextsInMillisecondsNumericUpDown . Value = MaxDelayBetweenCopiesForMergingMatchingSequentialTextsInMilliseconds ;
982
993
preferenceWindow . TextBoxCustomLineHeightNumericUpDown . Value = TextBoxCustomLineHeight ;
983
994
preferenceWindow . AutoHidePopupIfMouseIsNotOverItDelayInMillisecondsNumericUpDown . Value = AutoHidePopupIfMouseIsNotOverItDelayInMilliseconds ;
995
+ preferenceWindow . MinCharactersPerMinuteBeforeStoppingTimeTrackingNumericUpDown . Value = coreConfigManager . MinCharactersPerMinuteBeforeStoppingTimeTracking ;
984
996
preferenceWindow . DefinitionsFontSizeNumericUpDown . Value = DefinitionsFontSize ;
985
997
preferenceWindow . FrequencyFontSizeNumericUpDown . Value = FrequencyFontSize ;
986
998
preferenceWindow . PrimarySpellingFontSizeNumericUpDown . Value = PrimarySpellingFontSize ;
@@ -1261,8 +1273,8 @@ public async Task SavePreferences(PreferencesWindow preferenceWindow)
1261
1273
1262
1274
ConfigDBManager . UpdateSetting ( connection , nameof ( GlobalHotKeys ) , preferenceWindow . GlobalHotKeysCheckBox . IsChecked . ToString ( ) ! ) ;
1263
1275
1264
- ConfigDBManager . UpdateSetting ( connection , nameof ( StopIncreasingTimeStatWhenMinimized ) ,
1265
- preferenceWindow . StopIncreasingTimeStatWhenMinimizedCheckBox . IsChecked . ToString ( ) ! ) ;
1276
+ ConfigDBManager . UpdateSetting ( connection , nameof ( StopIncreasingTimeAndCharStatsWhenMinimized ) ,
1277
+ preferenceWindow . StopIncreasingTimeAndCharStatsWhenMinimizedCheckBox . IsChecked . ToString ( ) ! ) ;
1266
1278
1267
1279
ConfigDBManager . UpdateSetting ( connection , nameof ( StripPunctuationBeforeCalculatingCharacterCount ) ,
1268
1280
preferenceWindow . StripPunctuationBeforeCalculatingCharacterCountCheckBox . IsChecked . ToString ( ) ! ) ;
@@ -1426,6 +1438,9 @@ public async Task SavePreferences(PreferencesWindow preferenceWindow)
1426
1438
ConfigDBManager . UpdateSetting ( connection , nameof ( AutoHidePopupIfMouseIsNotOverItDelayInMilliseconds ) ,
1427
1439
preferenceWindow . AutoHidePopupIfMouseIsNotOverItDelayInMillisecondsNumericUpDown . Value . ToString ( CultureInfo . InvariantCulture ) ) ;
1428
1440
1441
+ ConfigDBManager . UpdateSetting ( connection , nameof ( CoreConfigManager . MinCharactersPerMinuteBeforeStoppingTimeTracking ) ,
1442
+ preferenceWindow . MinCharactersPerMinuteBeforeStoppingTimeTrackingNumericUpDown . Value . ToString ( CultureInfo . InvariantCulture ) ) ;
1443
+
1429
1444
ConfigDBManager . UpdateSetting ( connection , nameof ( AutoLookupFirstTermWhenTextIsCopiedFromClipboard ) ,
1430
1445
preferenceWindow . AutoLookupFirstTermWhenTextIsCopiedFromClipboardCheckBox . IsChecked . ToString ( ) ! ) ;
1431
1446
0 commit comments