Simplified the Scripted UI example. 57/246457/4
authorGyörgy Straub <g.straub@partner.samsung.com>
Wed, 28 Oct 2020 11:52:56 +0000 (11:52 +0000)
committerGyörgy Straub <g.straub@partner.samsung.com>
Mon, 2 Nov 2020 13:17:43 +0000 (13:17 +0000)
- there is no need to pre-populate the item view; it will be populated upon activation;
- removed branching & multiple returns in FileWatcher::FileHasChanged();

Change-Id: I47a92d5f0e3d84701f1688ba083f4a6850b6d909
Signed-off-by: György Straub <g.straub@partner.samsung.com>
examples/builder/examples.cpp

index 4835599..cf0f140 100644 (file)
@@ -201,16 +201,9 @@ bool FileWatcher::FileHasChanged(void)
   }
   else
   {
-    if(buf.st_mtime > mLastTime)
-    {
-      mLastTime = buf.st_mtime;
-      return true;
-    }
-    else
-    {
-      mLastTime = buf.st_mtime;
-      return false;
-    }
+    const bool result = buf.st_mtime > mLastTime;
+    mLastTime = buf.st_mtime;
+    return result;
   }
 
   return false;
@@ -305,7 +298,6 @@ public:
 
     std::sort(files.begin(), files.end());
 
-    ItemId itemId = 0;
     for(FileList::iterator iter = files.begin(); iter != files.end(); ++iter)
     {
       JsonParser parser = JsonParser::New();
@@ -329,12 +321,6 @@ public:
           if(node->Size())
           {
             mFiles.push_back(*iter);
-
-            mItemView.InsertItem(Item(itemId,
-                                      MenuItem(ShortName(*iter))),
-                                 0.5f);
-
-            itemId++;
           }
           else
           {