Updated demos to use DALi clang-format
[platform/core/uifw/dali-demo.git] / examples / builder / examples.cpp
index f7ace86..4835599 100644 (file)
 //
 //------------------------------------------------------------------------------
 
-#include <dali/dali.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/builder/builder.h>
-#include <dali-toolkit/devel-api/builder/tree-node.h>
 #include <dali-toolkit/devel-api/builder/json-parser.h>
-#include <dali-toolkit/devel-api/controls/popup/popup.h>
+#include <dali-toolkit/devel-api/builder/tree-node.h>
 #include <dali-toolkit/devel-api/controls/navigation-view/navigation-view.h>
+#include <dali-toolkit/devel-api/controls/popup/popup.h>
+#include <dali/dali.h>
 
-#include <map>
-#include <string>
-#include <fstream>
-#include <streambuf>
-#include <sstream>
 #include <dirent.h>
 #include <stdio.h>
+#include <fstream>
 #include <iostream>
+#include <map>
+#include <sstream>
+#include <streambuf>
+#include <string>
 
-#include "sys/stat.h"
-#include <ctime>
 #include <cstring>
+#include <ctime>
+#include "sys/stat.h"
 
-#include <dali/integration-api/debug.h>
 #include <dali/devel-api/adaptor-framework/file-loader.h>
+#include <dali/integration-api/debug.h>
 #include "shared/view.h"
 
 #define TOKEN_STRING(x) #x
@@ -52,15 +52,15 @@ using namespace Dali::Toolkit;
 
 namespace
 {
-
-const char* BACKGROUND_IMAGE( "" );
-const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" );
-const char* EDIT_IMAGE( DEMO_IMAGE_DIR "icon-change.png" );
-const char* EDIT_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-change-selected.png" );
+const char* BACKGROUND_IMAGE("");
+const char* TOOLBAR_IMAGE(DEMO_IMAGE_DIR "top-bar.png");
+const char* EDIT_IMAGE(DEMO_IMAGE_DIR "icon-change.png");
+const char* EDIT_IMAGE_SELECTED(DEMO_IMAGE_DIR "icon-change-selected.png");
 
 std::string USER_DIRECTORY;
 
-std::string JSON_BROKEN("                                      \
+std::string JSON_BROKEN(
+  "                                      \
 {                                                              \
   'stage':                                                     \
   [                                                            \
@@ -74,7 +74,7 @@ std::string JSON_BROKEN("                                      \
 }                                                              \
 ");
 
-std::string ReplaceQuotes(const std::string &single_quoted)
+std::string ReplaceQuotes(const std::stringsingle_quoted)
 {
   std::string s(single_quoted);
 
@@ -84,32 +84,32 @@ std::string ReplaceQuotes(const std::string &single_quoted)
   return s;
 }
 
-std::string GetFileContents(const std::string &fn)
+std::string GetFileContents(const std::stringfn)
 {
-  std::streampos bufferSize = 0;
+  std::streampos     bufferSize = 0;
   Dali::Vector<char> fileBuffer;
-  if( !Dali::FileLoader::ReadFile( fn, bufferSize, fileBuffer, FileLoader::FileType::BINARY ) )
+  if(!Dali::FileLoader::ReadFile(fn, bufferSize, fileBuffer, FileLoader::FileType::BINARY))
   {
     return std::string();
   }
 
-  return std::string( &fileBuffer[0], bufferSize );
+  return std::string(&fileBuffer[0], bufferSize);
 };
 
 typedef std::vector<std::string> FileList;
 
 void DirectoryFileList(const std::string& directory, FileList& files)
 {
-  DIR           *d;
-  struct dirent *dir;
+  DIR*           d;
+  struct direntdir;
   d = opendir(directory.c_str());
-  if (d)
+  if(d)
   {
-    while ((dir = readdir(d)) != NULL)
+    while((dir = readdir(d)) != NULL)
     {
-      if (dir->d_type == DT_REG)
+      if(dir->d_type == DT_REG)
       {
-        files.push_back( directory + std::string(dir->d_name) );
+        files.push_back(directory + std::string(dir->d_name));
       }
     }
 
@@ -119,7 +119,7 @@ void DirectoryFileList(const std::string& directory, FileList& files)
 
 void DirectoryFilesByType(const std::string& dir, const std::string& fileType /* ie "json" */, FileList& files)
 {
-  typedef FileList Collection;
+  typedef FileList           Collection;
   typedef FileList::iterator Iter;
 
   Collection allFiles;
@@ -127,25 +127,25 @@ void DirectoryFilesByType(const std::string& dir, const std::string& fileType /*
 
   for(Iter iter = allFiles.begin(); iter != allFiles.end(); ++iter)
   {
-    size_t pos = (*iter).rfind( '.' );
-    if( pos != std::string::npos )
+    size_t pos = (*iter).rfind('.');
+    if(pos != std::string::npos)
     {
-      if( (*iter).substr( pos+1 ) == fileType )
+      if((*iter).substr(pos + 1) == fileType)
       {
-        files.push_back( (*iter) );
+        files.push_back((*iter));
       }
     }
   }
 }
 
-const std::string ShortName( const std::string& name )
+const std::string ShortName(const std::string& name)
 {
-  size_t pos = name.rfind( '/' );
+  size_t pos = name.rfind('/');
 
-  if( pos != std::string::npos )
+  if(pos != std::string::npos)
   {
     pos++;
-    return name.substr( pos );
+    return name.substr(pos);
   }
   else
   {
@@ -163,13 +163,19 @@ class FileWatcher
 public:
   FileWatcher(void);
   ~FileWatcher(void);
-  explicit FileWatcher(const std::string &fn) { SetFilename(fn) ; };
+  explicit FileWatcher(const std::string& fn)
+  {
+    SetFilename(fn);
+  };
 
-  void SetFilename(const std::string &fn);
+  void        SetFilename(const std::string& fn);
   std::string GetFilename() const;
 
-  bool FileHasChanged(void);
-  std::string GetFileContents(void) const { return ::GetFileContents(mstringPath) ; };
+  bool        FileHasChanged(void);
+  std::string GetFileContents(void) const
+  {
+    return ::GetFileContents(mstringPath);
+  };
 
 private:
   // compiler does
@@ -178,10 +184,10 @@ private:
 
   std::time_t mLastTime;
   std::string mstringPath;
-
 };
 
-FileWatcher::FileWatcher(void) : mLastTime(0)
+FileWatcher::FileWatcher(void)
+: mLastTime(0)
 {
 }
 
@@ -214,7 +220,7 @@ FileWatcher::~FileWatcher()
 {
 }
 
-void FileWatcher::SetFilename(const std::string &fn)
+void FileWatcher::SetFilename(const std::stringfn)
 {
   mstringPath = fn;
   FileHasChanged(); // update last time
@@ -225,9 +231,7 @@ std::string FileWatcher::GetFilename(void) const
   return mstringPath;
 }
 
-
-} // anon namespace
-
+} // namespace
 
 //------------------------------------------------------------------------------
 //
@@ -237,28 +241,30 @@ std::string FileWatcher::GetFilename(void) const
 class ExampleApp : public ConnectionTracker, public Toolkit::ItemFactory
 {
 public:
-  ExampleApp(Application &app) : mApp(app)
+  ExampleApp(Application& app)
+  : mApp(app)
   {
     app.InitSignal().Connect(this, &ExampleApp::Create);
   }
 
-  ~ExampleApp() {}
+  ~ExampleApp()
+  {
+  }
 
 public:
-
   void SetTitle(const std::string& title)
   {
     if(!mTitleActor)
     {
-      mTitleActor = DemoHelper::CreateToolBarLabel( "" );
+      mTitleActor = DemoHelper::CreateToolBarLabel("");
       // Add title to the tool bar.
-      mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HORIZONTAL_CENTER );
+      mToolBar.AddControl(mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HORIZONTAL_CENTER);
     }
 
-    mTitleActor.SetProperty( TextLabel::Property::TEXT, title );
+    mTitleActor.SetProperty(TextLabel::Property::TEXT, title);
   }
 
-  bool OnBackButtonPressed( Toolkit::Button button )
+  bool OnBackButtonPressed(Toolkit::Button button)
   {
     OnQuitOrBack();
     return true;
@@ -269,32 +275,32 @@ public:
     Window window = mApp.GetWindow();
 
     mTapDetector = TapGestureDetector::New();
-    mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap );
+    mTapDetector.DetectedSignal().Connect(this, &ExampleApp::OnTap);
 
     mFiles.clear();
 
     mItemView = ItemView::New(*this);
 
-    mItemView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
-    mItemView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
-    mLayout = DefaultItemLayout::New( DefaultItemLayout::LIST );
+    mItemView.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+    mItemView.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+    mLayout = DefaultItemLayout::New(DefaultItemLayout::LIST);
 
-    mLayout->SetItemSize( Vector3( window.GetSize().GetWidth(), 50, 1 ) );
+    mLayout->SetItemSize(Vector3(window.GetSize().GetWidth(), 50, 1));
 
-    mItemView.AddLayout( *mLayout );
+    mItemView.AddLayout(*mLayout);
 
-    mItemView.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
+    mItemView.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
 
     mFiles.clear();
     FileList files;
 
-    if( USER_DIRECTORY.size() )
+    if(USER_DIRECTORY.size())
     {
-      DirectoryFilesByType( USER_DIRECTORY, "json", files );
+      DirectoryFilesByType(USER_DIRECTORY, "json", files);
     }
     else
     {
-      DirectoryFilesByType( DEMO_SCRIPT_DIR, "json", files );
+      DirectoryFilesByType(DEMO_SCRIPT_DIR, "json", files);
     }
 
     std::sort(files.begin(), files.end());
@@ -304,29 +310,29 @@ public:
     {
       JsonParser parser = JsonParser::New();
 
-      std::string data( GetFileContents( *iter ) );
+      std::string data(GetFileContents(*iter));
 
-      parser.Parse( data );
+      parser.Parse(data);
 
-      if( parser.ParseError() )
+      if(parser.ParseError())
       {
         std::cout << "Parser Error:" << *iter << std::endl;
         std::cout << parser.GetErrorLineNumber() << "(" << parser.GetErrorColumn() << "):" << parser.GetErrorDescription() << std::endl;
         exit(1);
       }
 
-      if( parser.GetRoot() )
+      if(parser.GetRoot())
       {
-        if( const TreeNode* node = parser.GetRoot()->Find("stage") )
+        if(const TreeNode* node = parser.GetRoot()->Find("stage"))
         {
           // only those with a stage section
-          if( node->Size() )
+          if(node->Size())
           {
-            mFiles.push_back( *iter );
+            mFiles.push_back(*iter);
 
-            mItemView.InsertItem( Item(itemId,
-                                       MenuItem( ShortName( *iter ) ) ),
-                                  0.5f );
+            mItemView.InsertItem(Item(itemId,
+                                      MenuItem(ShortName(*iter))),
+                                 0.5f);
 
             itemId++;
           }
@@ -344,34 +350,33 @@ public:
 
     // Activate the layout
     Vector3 size(window.GetSize());
-    mItemView.ActivateLayout(0, size, 0.0f/*immediate*/);
+    mItemView.ActivateLayout(0, size, 0.0f /*immediate*/);
   }
 
-
-  void OnTap( Actor actor, const TapGesture& tap )
+  void OnTap(Actor actor, const TapGesture& tap)
   {
-    ItemId id = mItemView.GetItemId( actor );
+    ItemId id = mItemView.GetItemId(actor);
 
-    LoadFromFileList( id );
+    LoadFromFileList(id);
   }
 
   Actor MenuItem(const std::string& text)
   {
-    TextLabel label = TextLabel::New( ShortName( text ) );
-    label.SetStyleName( "BuilderLabel" );
-    label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+    TextLabel label = TextLabel::New(ShortName(text));
+    label.SetStyleName("BuilderLabel");
+    label.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
 
     // Hook up tap detector
-    mTapDetector.Attach( label );
+    mTapDetector.Attach(label);
 
     return label;
   }
 
   bool OnTimer()
   {
-    if( mFileWatcher.FileHasChanged() )
+    if(mFileWatcher.FileHasChanged())
     {
-      LoadFromFile( mFileWatcher.GetFilename() );
+      LoadFromFile(mFileWatcher.GetFilename());
     }
 
     return true;
@@ -382,26 +387,26 @@ public:
     Window window = mApp.GetWindow();
 
     builder = Builder::New();
-    builder.QuitSignal().Connect( this, &ExampleApp::OnQuitOrBack );
+    builder.QuitSignal().Connect(this, &ExampleApp::OnQuitOrBack);
 
     Property::Map defaultDirs;
-    defaultDirs[ TOKEN_STRING(DEMO_IMAGE_DIR) ]  = DEMO_IMAGE_DIR;
-    defaultDirs[ TOKEN_STRING(DEMO_MODEL_DIR) ]  = DEMO_MODEL_DIR;
-    defaultDirs[ TOKEN_STRING(DEMO_SCRIPT_DIR) ] = DEMO_SCRIPT_DIR;
+    defaultDirs[TOKEN_STRING(DEMO_IMAGE_DIR)]  = DEMO_IMAGE_DIR;
+    defaultDirs[TOKEN_STRING(DEMO_MODEL_DIR)]  = DEMO_MODEL_DIR;
+    defaultDirs[TOKEN_STRING(DEMO_SCRIPT_DIR)] = DEMO_SCRIPT_DIR;
 
-    builder.AddConstants( defaultDirs );
+    builder.AddConstants(defaultDirs);
 
     // render tasks may have been setup last load so remove them
     RenderTaskList taskList = window.GetRenderTaskList();
-    if( taskList.GetTaskCount() > 1 )
+    if(taskList.GetTaskCount() > 1)
     {
       typedef std::vector<RenderTask> Collection;
-      typedef Collection::iterator ColIter;
-      Collection tasks;
+      typedef Collection::iterator    ColIter;
+      Collection                      tasks;
 
       for(unsigned int i = 1; i < taskList.GetTaskCount(); ++i)
       {
-        tasks.push_back( taskList.GetTask(i) );
+        tasks.push_back(taskList.GetTask(i));
       }
 
       for(ColIter iter = tasks.begin(); iter != tasks.end(); ++iter)
@@ -410,15 +415,15 @@ public:
       }
 
       RenderTask defaultTask = taskList.GetTask(0);
-      defaultTask.SetSourceActor( window.GetRootLayer() );
-      defaultTask.SetFrameBuffer( FrameBuffer() );
+      defaultTask.SetSourceActor(window.GetRootLayer());
+      defaultTask.SetFrameBuffer(FrameBuffer());
     }
 
     unsigned int numChildren = layer.GetChildCount();
 
-    for(unsigned int i=0; i<numChildren; ++i)
+    for(unsigned int i = 0; i < numChildren; ++i)
     {
-      layer.Remove( layer.GetChildAt(0) );
+      layer.Remove(layer.GetChildAt(0));
     }
 
     std::string data(GetFileContents(filename));
@@ -432,31 +437,30 @@ public:
       builder.LoadFromString(ReplaceQuotes(JSON_BROKEN));
     }
 
-    builder.AddActors( layer );
+    builder.AddActors(layer);
   }
 
-
-  void LoadFromFileList( size_t index )
+  void LoadFromFileList(size_t index)
   {
-    if( index < mFiles.size())
+    if(index < mFiles.size())
     {
       const std::string& name = mFiles[index];
-      mFileWatcher.SetFilename( name );
-      LoadFromFile( name );
+      mFileWatcher.SetFilename(name);
+      LoadFromFile(name);
     }
   }
 
-  void LoadFromFile( const std::string& name )
+  void LoadFromFile(const std::string& name)
   {
-    ReloadJsonFile( name, mBuilder, mBuilderLayer );
+    ReloadJsonFile(name, mBuilder, mBuilderLayer);
 
-    mBuilderLayer.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_CENTER);
-    mBuilderLayer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_CENTER);
-    Dali::Vector3 size = mApp.GetWindow().GetRootLayer().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
+    mBuilderLayer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER);
+    mBuilderLayer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER);
+    Dali::Vector3 size = mApp.GetWindow().GetRootLayer().GetCurrentProperty<Vector3>(Actor::Property::SIZE);
     size.y -= DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight;
-    mBuilderLayer.SetProperty( Actor::Property::SIZE, size );
+    mBuilderLayer.SetProperty(Actor::Property::SIZE, size);
 
-    mNavigationView.Push( mBuilderLayer );
+    mNavigationView.Push(mBuilderLayer);
   }
 
   void Create(Application& app)
@@ -465,12 +469,12 @@ public:
 
     window.KeyEventSignal().Connect(this, &ExampleApp::OnKeyEvent);
 
-    Layer contents = DemoHelper::CreateView( app,
-                                             mView,
-                                             mToolBar,
-                                             BACKGROUND_IMAGE,
-                                             TOOLBAR_IMAGE,
-                                             "" );
+    Layer contents = DemoHelper::CreateView(app,
+                                            mView,
+                                            mToolBar,
+                                            BACKGROUND_IMAGE,
+                                            TOOLBAR_IMAGE,
+                                            "");
 
     SetTitle("Select Example");
 
@@ -478,40 +482,34 @@ public:
 
     // Create an edit mode button. (left of toolbar)
     Toolkit::PushButton backButton = Toolkit::PushButton::New();
-    backButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, EDIT_IMAGE );
-    backButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, EDIT_IMAGE_SELECTED );
-    backButton.ClickedSignal().Connect( this, &ExampleApp::OnBackButtonPressed);
-    backButton.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
-    mToolBar.AddControl( backButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HORIZONTAL_LEFT, DemoHelper::DEFAULT_MODE_SWITCH_PADDING  );
+    backButton.SetProperty(Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, EDIT_IMAGE);
+    backButton.SetProperty(Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, EDIT_IMAGE_SELECTED);
+    backButton.ClickedSignal().Connect(this, &ExampleApp::OnBackButtonPressed);
+    backButton.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
+    mToolBar.AddControl(backButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HORIZONTAL_LEFT, DemoHelper::DEFAULT_MODE_SWITCH_PADDING);
 
     mNavigationView = Toolkit::NavigationView::New();
-    mNavigationView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-    mNavigationView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+    mNavigationView.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
+    mNavigationView.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
 
-    window.Add( mNavigationView );
+    window.Add(mNavigationView);
 
     // Set up the background gradient.
     Property::Array stopOffsets;
-    stopOffsets.PushBack( 0.0f );
-    stopOffsets.PushBack( 1.0f );
+    stopOffsets.PushBack(0.0f);
+    stopOffsets.PushBack(1.0f);
     Property::Array stopColors;
-    stopColors.PushBack( Color::WHITE );
-    stopColors.PushBack( Vector4( 0.45f, 0.70f, 0.80f, 1.0f ) ); // Medium bright, pastel blue
+    stopColors.PushBack(Color::WHITE);
+    stopColors.PushBack(Vector4(0.45f, 0.70f, 0.80f, 1.0f)); // Medium bright, pastel blue
     const float percentageWindowHeight = window.GetSize().GetHeight() * 0.6f;
 
-    mNavigationView.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map()
-      .Add( Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::GRADIENT )
-      .Add( Toolkit::GradientVisual::Property::STOP_OFFSET, stopOffsets )
-      .Add( Toolkit::GradientVisual::Property::STOP_COLOR, stopColors )
-      .Add( Toolkit::GradientVisual::Property::START_POSITION, Vector2( 0.0f, -percentageWindowHeight ) )
-      .Add( Toolkit::GradientVisual::Property::END_POSITION, Vector2( 0.0f, percentageWindowHeight ) )
-      .Add( Toolkit::GradientVisual::Property::UNITS, Toolkit::GradientVisual::Units::USER_SPACE ) );
+    mNavigationView.SetProperty(Toolkit::Control::Property::BACKGROUND, Dali::Property::Map().Add(Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::GRADIENT).Add(Toolkit::GradientVisual::Property::STOP_OFFSET, stopOffsets).Add(Toolkit::GradientVisual::Property::STOP_COLOR, stopColors).Add(Toolkit::GradientVisual::Property::START_POSITION, Vector2(0.0f, -percentageWindowHeight)).Add(Toolkit::GradientVisual::Property::END_POSITION, Vector2(0.0f, percentageWindowHeight)).Add(Toolkit::GradientVisual::Property::UNITS, Toolkit::GradientVisual::Units::USER_SPACE));
 
     SetUpItemView();
-    mNavigationView.Push( mItemView );
+    mNavigationView.Push(mItemView);
 
-    mTimer = Timer::New( 500 ); // ms
-    mTimer.TickSignal().Connect( this, &ExampleApp::OnTimer);
+    mTimer = Timer::New(500); // ms
+    mTimer.TickSignal().Connect(this, &ExampleApp::OnTimer);
     mTimer.Start();
 
   } // Create(app)
@@ -523,8 +521,8 @@ public:
 
   virtual Actor NewItem(unsigned int itemId)
   {
-    DALI_ASSERT_DEBUG( itemId < mFiles.size() );
-    return MenuItem( ShortName( mFiles[itemId] ) );
+    DALI_ASSERT_DEBUG(itemId < mFiles.size());
+    return MenuItem(ShortName(mFiles[itemId]));
   }
 
   /**
@@ -534,7 +532,7 @@ public:
   {
     if(event.GetState() == KeyEvent::DOWN)
     {
-      if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
+      if(IsKey(event, Dali::DALI_KEY_ESCAPE) || IsKey(event, Dali::DALI_KEY_BACK))
       {
         OnQuitOrBack();
       }
@@ -546,7 +544,7 @@ public:
    */
   void OnQuitOrBack()
   {
-    if ( mItemView.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
+    if(mItemView.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
     {
       mApp.Quit();
     }
@@ -559,14 +557,14 @@ public:
 private:
   Application& mApp;
 
-  ItemLayoutPtr mLayout;
-  ItemView mItemView;
+  ItemLayoutPtr           mLayout;
+  ItemView                mItemView;
   Toolkit::NavigationView mNavigationView;
 
   Toolkit::Control mView;
 
   Toolkit::ToolBar mToolBar;
-  TextLabel mTitleActor;
+  TextLabel        mTitleActor;
 
   Layer mBuilderLayer;
 
@@ -578,7 +576,7 @@ private:
   FileList mFiles;
 
   FileWatcher mFileWatcher;
-  Timer mTimer;
+  Timer       mTimer;
 };
 
 //------------------------------------------------------------------------------
@@ -586,7 +584,7 @@ private:
 //
 //
 //------------------------------------------------------------------------------
-int DALI_EXPORT_API main(int argc, char **argv)
+int DALI_EXPORT_API main(int argc, char** argv)
 {
   if(argc > 2)
   {