Use environment option to set the name of the window
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 16 Jun 2015 14:36:04 +0000 (15:36 +0100)
committerYoonsang Lee <ysang114.lee@samsung.com>
Tue, 23 Jun 2015 02:30:58 +0000 (11:30 +0900)
Change-Id: I58fde9c92fc5612a3897bf943451d4619a70d57b

adaptors/base/environment-options.cpp
adaptors/base/environment-options.h
adaptors/base/environment-variables.h
adaptors/common/application-impl.cpp

index 4859efe..c4e3698 100644 (file)
@@ -74,9 +74,16 @@ bool GetFloatEnvironmentVariable( const char* variable, float& floatValue )
   return true;
 }
 
+const char * GetCharEnvironmentVariable( const char * variable )
+{
+  return std::getenv( variable );
 }
+
+} // unnamed namespace
+
 EnvironmentOptions::EnvironmentOptions()
-: mNetworkControl(0),
+: mWindowName(),
+  mNetworkControl(0),
   mFpsFrequency(0),
   mUpdateStatusFrequency(0),
   mPerformanceStatsLevel(0),
@@ -270,6 +277,19 @@ void EnvironmentOptions::SetWindowHeight( int height )
   mWindowHeight = height;
 }
 
+void EnvironmentOptions::SetWindowName( const char * name )
+{
+  if ( name )
+  {
+    mWindowName = name;
+  }
+}
+
+const std::string& EnvironmentOptions::GetWindowName() const
+{
+  return mWindowName;
+}
+
 bool EnvironmentOptions::PerformanceServerRequired() const
 {
   return ( (GetPerformanceStatsLoggingOptions() > 0) ||
@@ -370,6 +390,7 @@ void EnvironmentOptions::ParseEnvironmentOptions()
     SetWindowHeight( windowHeight );
   }
 
+  SetWindowName( GetCharEnvironmentVariable( DALI_WINDOW_NAME ) );
 }
 
 } // Adaptor
index 438c1a6..6dffb2c 100644 (file)
@@ -247,6 +247,16 @@ public:
    */
   bool PerformanceServerRequired() const;
 
+  /**
+   * @brief Sets the window name.
+   */
+  void SetWindowName( const char * name );
+
+  /**
+   * @return Gets the window name. NULL if not set
+   */
+  const std::string& GetWindowName() const;
+
 private: // Internal
 
   /**
@@ -257,6 +267,7 @@ private: // Internal
 
 private: // Data
 
+  std::string mWindowName;                        ///< name of the window
   unsigned int mNetworkControl;                   ///< whether network control is enabled
   unsigned int mFpsFrequency;                     ///< how often fps is logged out in seconds
   unsigned int mUpdateStatusFrequency;            ///< how often update status is logged out in frames
index 9029dc1..b83b2ee 100644 (file)
@@ -82,6 +82,8 @@ namespace Adaptor
 
 #define DALI_WINDOW_HEIGHT "DALI_WINDOW_HEIGHT"
 
+#define DALI_WINDOW_NAME "DALI_WINDOW_NAME"
+
 } // namespace Adaptor
 
 } // namespace Internal
index b7ef064..d864db6 100644 (file)
@@ -83,9 +83,11 @@ Application::Application( int* argc, char** argv[], const std::string& styleshee
   mInitialized( false ),
   mSlotDelegate( this )
 {
-  // Copy mName from command-line args
-  if( argc && ( *argc > 0 ) )
+  // Get mName from environment options
+  mName = mEnvironmentOptions.GetWindowName();
+  if( mName.empty() && argc && ( *argc > 0 ) )
   {
+    // Set mName from command-line args if environment option not set
     mName = (*argv)[0];
   }