Merge "Multi-profile support" into tizen tizen_3.0.2014.q4_common tizen_3.0.2015.q1_common accepted/tizen/common/20150205.080850 submit/tizen/20150205.011244
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 4 Feb 2015 18:03:54 +0000 (10:03 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 4 Feb 2015 18:03:55 +0000 (10:03 -0800)
adaptors/base/environment-options.cpp
adaptors/base/environment-options.h
adaptors/base/environment-variables.h
adaptors/common/adaptor-impl.cpp

index 936c2f4..4dc7e78 100644 (file)
@@ -33,7 +33,10 @@ EnvironmentOptions::EnvironmentOptions()
   mPerformanceLoggingLevel(0),
   mPanGestureLoggingLevel(0),
   mPanGesturePredictionMode(-1),
-  mPanGesturePredictionAmount(-1.0f), ///< only sets value in pan gesture if greater than 0
+  mPanGesturePredictionAmount(-1), ///< only sets value in pan gesture if greater than 0
+  mPanGestureMaxPredictionAmount(-1),
+  mPanGestureMinPredictionAmount(-1),
+  mPanGesturePredictionAmountAdjustment(-1),
   mPanGestureSmoothingMode(-1),
   mPanGestureSmoothingAmount(-1.0f),
   mPanMinimumDistance(-1),
@@ -95,11 +98,26 @@ int EnvironmentOptions::GetPanGesturePredictionMode() const
   return mPanGesturePredictionMode;
 }
 
-float EnvironmentOptions::GetPanGesturePredictionAmount() const
+int EnvironmentOptions::GetPanGesturePredictionAmount() const
 {
   return mPanGesturePredictionAmount;
 }
 
+int EnvironmentOptions::GetPanGestureMaximumPredictionAmount() const
+{
+  return mPanGestureMaxPredictionAmount;
+}
+
+int EnvironmentOptions::GetPanGestureMinimumPredictionAmount() const
+{
+  return mPanGestureMinPredictionAmount;
+}
+
+int EnvironmentOptions::GetPanGesturePredictionAmountAdjustment() const
+{
+  return mPanGesturePredictionAmountAdjustment;
+}
+
 int EnvironmentOptions::GetPanGestureSmoothingMode() const
 {
   return mPanGestureSmoothingMode;
@@ -130,6 +148,21 @@ void EnvironmentOptions::SetPanGesturePredictionAmount( unsigned int amount )
   mPanGesturePredictionAmount = amount;
 }
 
+void EnvironmentOptions::SetPanGestureMaximumPredictionAmount( unsigned int amount )
+{
+  mPanGestureMaxPredictionAmount = amount;
+}
+
+void EnvironmentOptions::SetPanGestureMinimumPredictionAmount( unsigned int amount )
+{
+  mPanGestureMinPredictionAmount = amount;
+}
+
+void EnvironmentOptions::SetPanGesturePredictionAmountAdjustment( unsigned int amount )
+{
+  mPanGesturePredictionAmountAdjustment = amount;
+}
+
 void EnvironmentOptions::SetPanGestureSmoothingMode( unsigned int mode )
 {
   mPanGestureSmoothingMode = mode;
index 360cdfc..5d107d3 100644 (file)
@@ -97,7 +97,22 @@ public:
   /**
    * @return pan-gesture prediction amount
    */
-  float GetPanGesturePredictionAmount() const;
+  int GetPanGesturePredictionAmount() const;
+
+  /**
+   * @return maximum pan-gesture prediction amount
+   */
+  int GetPanGestureMaximumPredictionAmount() const;
+
+  /**
+   * @return minimum pan-gesture prediction amount
+   */
+  int GetPanGestureMinimumPredictionAmount() const;
+
+  /**
+   * @return pan-gesture prediction amount adjustment
+   */
+  int GetPanGesturePredictionAmountAdjustment() const;
 
   /**
    * @return pan-gesture smoothing mode ( -1 means not set so no smoothing, 0 = no smoothing )
@@ -120,9 +135,9 @@ public:
   int GetMinimumPanEvents() const;
 
   /**
-   * @brief Sets the mode used to smooth pan gesture movement properties calculated on the Update thread
+   * @brief Sets the mode used to predict pan gesture movement
    *
-   * @param[in] mode The smoothing mode to use
+   * @param[in] mode The prediction mode to use
    */
   void SetPanGesturePredictionMode( unsigned int mode );
 
@@ -134,6 +149,31 @@ public:
   void SetPanGesturePredictionAmount( unsigned int amount );
 
   /**
+   * @brief Sets the upper bound of the prediction amount for clamping
+   *
+   * @param[in] amount The prediction amount in milliseconds
+   */
+  void SetPanGestureMaximumPredictionAmount( unsigned int amount );
+
+  /**
+   * @brief Sets the lower bound of the prediction amount for clamping
+   *
+   * @param[in] amount The prediction amount in milliseconds
+   */
+  void SetPanGestureMinimumPredictionAmount( unsigned int amount );
+
+  /**
+   * @brief Sets the prediction amount to adjust when the pan velocity is changed.
+   * If the pan velocity is accelerating, the prediction amount will be increased
+   * by the specified amount until it reaches the upper bound. If the pan velocity
+   * is decelerating, the prediction amount will be decreased by the specified
+   * amount until it reaches the lower bound.
+   *
+   * @param[in] amount The prediction amount in milliseconds
+   */
+  void SetPanGesturePredictionAmountAdjustment( unsigned int amount );
+
+  /**
    * @brief Called to set how pan gestures smooth input
    *
    * @param[in] mode The smoothing mode to use
@@ -141,7 +181,7 @@ public:
   void SetPanGestureSmoothingMode( unsigned int mode );
 
   /**
-   * @brief Sets the prediction amount of the pan gesture
+   * @brief Sets the mode used to smooth pan gesture movement properties calculated on the Update thread
    *
    * @param[in] amount The smoothing amount [0.0f,1.0f] - 0.0f would be no smoothing, 1.0f maximum smoothing
    */
@@ -181,7 +221,10 @@ private:
   unsigned int mPerformanceLoggingLevel;          ///< performance log level
   unsigned int mPanGestureLoggingLevel;           ///< pan-gesture log level
   int mPanGesturePredictionMode;                  ///< prediction mode for pan gestures
-  float mPanGesturePredictionAmount;              ///< prediction amount for pan gestures
+  int mPanGesturePredictionAmount;                ///< prediction amount for pan gestures
+  int mPanGestureMaxPredictionAmount;             ///< maximum prediction amount for pan gestures
+  int mPanGestureMinPredictionAmount;             ///< minimum prediction amount for pan gestures
+  int mPanGesturePredictionAmountAdjustment;      ///< adjustment of prediction amount for pan gestures
   int mPanGestureSmoothingMode;                  ///< prediction mode for pan gestures
   float mPanGestureSmoothingAmount;              ///< prediction amount for pan gestures
   int mPanMinimumDistance;                        ///< minimum distance required before pan starts
index 07b37f8..de7760f 100644 (file)
@@ -41,6 +41,12 @@ namespace Adaptor
 
 #define DALI_ENV_PAN_PREDICTION_AMOUNT "DALI_PAN_PREDICTION_AMOUNT"
 
+#define DALI_ENV_PAN_MAX_PREDICTION_AMOUNT "DALI_PAN_MAX_PREDICTION_AMOUNT"
+
+#define DALI_ENV_PAN_MIN_PREDICTION_AMOUNT "DALI_PAN_MIN_PREDICTION_AMOUNT"
+
+#define DALI_ENV_PAN_PREDICTION_AMOUNT_ADJUSTMENT "DALI_PAN_PREDICTION_AMOUNT_ADJUSTMENT"
+
 #define DALI_ENV_PAN_SMOOTHING_MODE "DALI_PAN_SMOOTHING_MODE"
 
 #define DALI_ENV_PAN_SMOOTHING_AMOUNT "DALI_PAN_SMOOTHING_AMOUNT"
index f91c1a6..e0982ca 100644 (file)
@@ -141,7 +141,7 @@ void Adaptor::ParseEnvironmentOptions()
   {
     mEnvironmentOptions.SetPanGesturePredictionMode(predictionMode);
   }
-  int predictionAmount = -1;
+  int predictionAmount(-1);
   if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_PREDICTION_AMOUNT, predictionAmount) )
   {
     if( predictionAmount < 0 )
@@ -151,6 +151,36 @@ void Adaptor::ParseEnvironmentOptions()
     }
     mEnvironmentOptions.SetPanGesturePredictionAmount(predictionAmount);
   }
+  int minPredictionAmount(-1);
+  if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_MIN_PREDICTION_AMOUNT, minPredictionAmount) )
+  {
+    if( minPredictionAmount < 0 )
+    {
+      // do not support times in the past
+      minPredictionAmount = 0;
+    }
+    mEnvironmentOptions.SetPanGestureMinimumPredictionAmount(minPredictionAmount);
+  }
+  int maxPredictionAmount(-1);
+  if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_MAX_PREDICTION_AMOUNT, maxPredictionAmount) )
+  {
+    if( minPredictionAmount > -1 && maxPredictionAmount < minPredictionAmount )
+    {
+      // maximum amount should not be smaller than minimum amount
+      maxPredictionAmount = minPredictionAmount;
+    }
+    mEnvironmentOptions.SetPanGestureMaximumPredictionAmount(maxPredictionAmount);
+  }
+  int predictionAmountAdjustment(-1);
+  if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_PREDICTION_AMOUNT_ADJUSTMENT, predictionAmountAdjustment) )
+  {
+    if( predictionAmountAdjustment < 0 )
+    {
+      // negative amount doesn't make sense
+      predictionAmountAdjustment = 0;
+    }
+    mEnvironmentOptions.SetPanGesturePredictionAmountAdjustment(predictionAmountAdjustment);
+  }
   int smoothingMode;
   if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_SMOOTHING_MODE, smoothingMode) )
   {
@@ -243,10 +273,22 @@ void Adaptor::Initialize(Dali::Configuration::ContextLoss configuration)
   {
     Integration::SetPanGesturePredictionMode(mEnvironmentOptions.GetPanGesturePredictionMode());
   }
-  if( mEnvironmentOptions.GetPanGesturePredictionAmount() >= 0.0f )
+  if( mEnvironmentOptions.GetPanGesturePredictionAmount() >= 0 )
   {
     Integration::SetPanGesturePredictionAmount(mEnvironmentOptions.GetPanGesturePredictionAmount());
   }
+  if( mEnvironmentOptions.GetPanGestureMaximumPredictionAmount() >= 0 )
+  {
+    Integration::SetPanGestureMaximumPredictionAmount(mEnvironmentOptions.GetPanGestureMaximumPredictionAmount());
+  }
+  if( mEnvironmentOptions.GetPanGestureMinimumPredictionAmount() >= 0 )
+  {
+    Integration::SetPanGestureMinimumPredictionAmount(mEnvironmentOptions.GetPanGestureMinimumPredictionAmount());
+  }
+  if( mEnvironmentOptions.GetPanGesturePredictionAmountAdjustment() >= 0 )
+  {
+    Integration::SetPanGesturePredictionAmountAdjustment(mEnvironmentOptions.GetPanGesturePredictionAmountAdjustment());
+  }
   if( mEnvironmentOptions.GetPanGestureSmoothingMode() >= 0 )
   {
     Integration::SetPanGestureSmoothingMode(mEnvironmentOptions.GetPanGestureSmoothingMode());