calculator/src/CalcManager
Seulgi Kim af8322617f Restore user preferences (#456)
### Description of the changes:
**1) Do not set units to default values if they already have valid values** 
This fixes the actual issue. `UnitConverter::InitializeSelectedUnits()` ( this function resets all units to their default units if available for the current category ) gets called after `UnitConverterViewModel::RestoreUserPreferences()` ( this function restores user preferences ).
So Calculator has been restoring saved values, and then overriding the restored values with default values.
I modified `InitializeSelectedUnits()` so that we only initialize units only when they are not already set to valid units for the current category.

**2) Removed `m_isFirstTime`** 
I noticed that we are calling `RestoreUserPreferences()`  twice when Calculator starts up, and the function is restoring the same value both times

The below happens when Calculator starts up
1) On startup, in `UnitConverterViewModel::InitializeView()`, `RestoreUserPreferences()` is called.
2) `RestoreUserPreferences()` in turn triggers `OnUnitChanged()`
3) During the first call to `OnUnitChanged()`, m_IsFirstTime is `True`, so we call `RestoreUserPreferences()` again while also setting `m_IsFirstTime` to `False`. 
4) `RestoreUserPreference()` again triggers `OnUnitChanged()`
5) During the second call to `OnUnitChanged()`,  m_IsFirstTime is `False`, so we call `SaveUserPreferences()`

I think we should only call `SaveUserPreferences()` inside `OnUnitChanged()` since we already restored user preferences during view initialization. I can't really think of a reason to restore units after view has been initialized. This led me to just delete `m_isFirstTime`.


### How changes were validated:
Manually tested that units and the current category are properly selected when you quit and start Calculator.

![GifMaker_20190414182150911](https://user-images.githubusercontent.com/3166423/56102706-88f73400-5ee3-11e9-8bbf-7a0c8e051a5c.gif)

![GifMaker_20190414183403644](https://user-images.githubusercontent.com/3166423/56102763-f0ad7f00-5ee3-11e9-99ef-3b932f587393.gif)

## Fixes #445.
2019-07-29 09:39:19 -07:00
..
CEngine Ensure gldPrevious is scoped to its own translation unit (#556) 2019-06-18 13:05:18 -07:00
Header Files Fix type of m_openParenCount (#550) 2019-06-17 17:10:15 -07:00
Ratpack Drop __inline from conflicting declarations (#545) 2019-06-10 14:36:05 -07:00
CalcManager.vcxproj Unit Converter - Calculate the rounding precision of results based on the source (#498) 2019-07-16 17:00:57 -07:00
CalcManager.vcxproj.filters Unit Converter - Calculate the rounding precision of results based on the source (#498) 2019-07-16 17:00:57 -07:00
CalculatorHistory.cpp Secondary formatting changes (#489) 2019-05-02 16:48:33 -07:00
CalculatorHistory.h Secondary formatting changes (#489) 2019-05-02 16:48:33 -07:00
CalculatorManager.cpp Fix #563: Odd dependency cycle (#570) 2019-07-25 23:24:12 -07:00
CalculatorManager.h Fix #563: Odd dependency cycle (#570) 2019-07-25 23:24:12 -07:00
CalculatorResource.h Fix the project code style, as it is not consistent. (#236) 2019-05-02 11:59:19 -07:00
CalculatorVector.h Applying NR 1 to CalculatorVector.h (#491) 2019-07-11 12:46:13 -05:00
CMakeLists.txt Add CMake project, GCC support (#540) 2019-06-06 14:08:31 -07:00
Command.h Fix the project code style, as it is not consistent. (#236) 2019-05-02 11:59:19 -07:00
ExpressionCommand.cpp Removed need for trimIdx and fDigitsFound, resulting in less code. (#576) 2019-07-16 14:53:34 -05:00
ExpressionCommand.h Fix the project code style, as it is not consistent. (#236) 2019-05-02 11:59:19 -07:00
ExpressionCommandInterface.h Fix the project code style, as it is not consistent. (#236) 2019-05-02 11:59:19 -07:00
NumberFormattingUtils.cpp Unit Converter - Calculate the rounding precision of results based on the source (#498) 2019-07-16 17:00:57 -07:00
NumberFormattingUtils.h Unit Converter - Calculate the rounding precision of results based on the source (#498) 2019-07-16 17:00:57 -07:00
pch.cpp Compile CalcManager project with or without precompiled headers (#436) 2019-04-17 17:28:45 -07:00
pch.h Unit Converter - Calculate the rounding precision of results based on the source (#498) 2019-07-16 17:00:57 -07:00
sal_cross_platform.h Add CMake project, GCC support (#540) 2019-06-06 14:08:31 -07:00
UnitConverter.cpp Restore user preferences (#456) 2019-07-29 09:39:19 -07:00
UnitConverter.h Unit Converter - Calculate the rounding precision of results based on the source (#498) 2019-07-16 17:00:57 -07:00
winerror_cross_platform.h Add CMake project, GCC support (#540) 2019-06-06 14:08:31 -07:00