TizenRefApp-8277 [Gallery] Implement NoContentPage 86/122486/1
authorIgor Nazarov <i.nazarov@samsung.com>
Fri, 31 Mar 2017 15:20:23 +0000 (18:20 +0300)
committerIgor Nazarov <i.nazarov@samsung.com>
Fri, 31 Mar 2017 16:16:18 +0000 (19:16 +0300)
- Implemented NoContentPage and integrated into application;
- Added IMediaAlbum::getMediaCount() method;
- Added images.edc for image resources;
- Removed using namespace in .hpp file;
- UCL updated.

Change-Id: I4fe9d7e230d992beea6366910de2c58f68324cea

26 files changed:
edc/colors.h
edc/images.edc [new file with mode: 0644]
edc/images/gallery_icon_no_photos.png [new file with mode: 0644]
inc/model/IMediaAlbum.h
inc/model/IMediaAlbum.hpp [new file with mode: 0644]
inc/presentation/Instance.h
inc/presentation/NoContentPage.h [new file with mode: 0644]
inc/presentation/Page.hpp
inc/presentation/ThumbnailPage.h
inc/presentation/ViewerPage.h
inc/presentation/types.h
inc/resources.h
res/edje/theme.edc
src/common.h
src/model/GalleryAlbum.cpp
src/model/GalleryAlbum.h
src/presentation/Instance.cpp
src/presentation/NoContentPage.cpp [new file with mode: 0644]
src/presentation/ThumbnailPage.cpp
src/presentation/ViewerPage.cpp
src/resources.cpp [new file with mode: 0644]
ucl/inc/ucl/gui/Layout.hpp
ucl/inc/ucl/gui/stdTheme/common.h
ucl/inc/ucl/gui/stdTheme/layout.h
ucl/inc/ucl/util/helpers.h
ucl/src/gui/Layout.cpp

index 7675467e5c4174612e3535a43baae051efefacd0..5b75cd7050b2adc669110c87524346cf2c30645a 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef __GALLERY_EDC_COLORS_H__
 #define __GALLERY_EDC_COLORS_H__
 
+#define GALLERY_COLOR_WHITE 255 255 255 255
+
 #define GALLERY_COLOR_AO0112 0 0 0 0
 #define GALLERY_COLOR_AO0112P 0 0 0 102
 #define GALLERY_COLOR_AO0112D 0 0 0 77
diff --git a/edc/images.edc b/edc/images.edc
new file mode 100644 (file)
index 0000000..da436dd
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define RES_IMAGE(FILE_NAME, WIDTH, HEIGHT, COLOR) \
+   group { "elm/layout/gallery_image/"FILE_NAME; \
+      images.image: FILE_NAME COMP; \
+      parts { \
+         image { "image"; \
+            scale: 1; \
+            description { "default"; \
+               image.normal: FILE_NAME; \
+               min: WIDTH HEIGHT; \
+               max: WIDTH HEIGHT; \
+               aspect: (WIDTH / HEIGHT) (WIDTH / HEIGHT); \
+               aspect_preference: BOTH; \
+               color: COLOR; \
+            } \
+         } \
+      } \
+   }
+
+#define RES_SQUARE_IMAGE(FILE_NAME, SIZE, COLOR) \
+    RES_IMAGE(FILE_NAME, SIZE, SIZE, COLOR)
+
+RES_SQUARE_IMAGE("gallery_icon_no_photos.png", 98, GALLERY_COLOR_WHITE)
diff --git a/edc/images/gallery_icon_no_photos.png b/edc/images/gallery_icon_no_photos.png
new file mode 100644 (file)
index 0000000..f94aaaa
Binary files /dev/null and b/edc/images/gallery_icon_no_photos.png differ
index 452568fa31d86c241bbfd77ec51e4f5466489757..3a8a172dc67ff615541087b3aadf3b1ce393c74e 100644 (file)
@@ -27,7 +27,14 @@ namespace gallery {
 
        public:
                virtual ucl::Result forEachMedia(EachCb cb) const = 0;
+               virtual ucl::Result getMediaCount(int &count) const = 0;
        };
+
+       // Non-member functions //
+
+       bool isEmpty(const IMediaAlbum &album);
 }
 
+#include "IMediaAlbum.hpp"
+
 #endif // __GALLERY_MODEL_I_MEDIA_ALBUM_H__
diff --git a/inc/model/IMediaAlbum.hpp b/inc/model/IMediaAlbum.hpp
new file mode 100644 (file)
index 0000000..5793dfc
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ucl/util/logging.h"
+
+namespace gallery {
+
+       // Non-member functions //
+
+       inline bool isEmpty(const IMediaAlbum &album)
+       {
+               int count = 0;
+               UCL_FAIL_RETURN_VALUE(album.getMediaCount(count), true,
+                               "album.getMediaCount() failed!");
+               return (count == 0);
+       }
+}
index 6c48c9421a15b56895537c37252de8e35e401fde..0440c14a4ad2d56ea967a58b6d0e92a7627df74e 100644 (file)
@@ -56,10 +56,13 @@ namespace gallery {
                void startMediaContentScan();
                void onScanComplete(media_content_error_e error);
 
-               void onSysEvent(const ucl::SysEvent sysEvent);
+               void createNoContentPage();
+               void createThumbnailPage();
 
                void onPageExitRequest(Page &page);
 
+               void onSysEvent(const ucl::SysEvent sysEvent);
+
        private:
                ucl::SysEventProvider &m_sysEventProvider;
                ucl::IInstanceContext *m_context;
diff --git a/inc/presentation/NoContentPage.h b/inc/presentation/NoContentPage.h
new file mode 100644 (file)
index 0000000..e83674b
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __GALLERY_PRESENTATION_NO_CONTENT_PAGE_H__
+#define __GALLERY_PRESENTATION_NO_CONTENT_PAGE_H__
+
+#include "Page.h"
+
+namespace gallery {
+
+       class NoContentPage final : public Page {
+       public:
+               class Builder {
+               public:
+                       Builder();
+                       ~Builder();
+                       Builder &setNaviframe(const ucl::NaviframeSRef &navi);
+                       NoContentPageSRef build(ExitRequestHandler onExitRequest) const;
+               private:
+                       ucl::NaviframeSRef m_navi;
+               };
+
+       private:
+               friend class ucl::RefCountObj<NoContentPage>;
+               NoContentPage(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
+                               ExitRequestHandler onExitRequest);
+               virtual ~NoContentPage();
+
+               ucl::Result prepare();
+       };
+}
+
+#endif // __GALLERY_PRESENTATION_NO_CONTENT_PAGE_H__
index 909e6ed700cbd375f26146389975427e396edee4..58be44b8725200af230965f299e3c7e395945e7f 100644 (file)
 
 namespace gallery {
 
-       using namespace ucl;
-
        template <class ITEM_FACTORY>
-       inline Result Page::prepare(ITEM_FACTORY &&makeItem)
+       inline ucl::Result Page::prepare(ITEM_FACTORY &&makeItem)
        {
                m_item = makeItem();
                if (isNotValid(m_item)) {
-                       UCL_LOG_RETURN(RES_FAIL, "m_item is NULL");
+                       UCL_LOG_RETURN(ucl::RES_FAIL, "m_item is NULL");
                }
                return preparePart2();
        }
 
        template <class ...ARGS>
-       inline NaviItem Page::insertAfter(ARGS &&...args)
+       inline ucl::NaviItem Page::insertAfter(ARGS &&...args)
        {
                return m_navi->insertAfter(m_item, std::forward<ARGS>(args)...);
        }
 
        template <class ...ARGS>
-       inline NaviItem Page::insertBefore(ARGS &&...args)
+       inline ucl::NaviItem Page::insertBefore(ARGS &&...args)
        {
                return m_navi->insertBefore(m_item, std::forward<ARGS>(args)...);
        }
 
-       inline Naviframe &Page::getNaviframe()
+       inline ucl::Naviframe &Page::getNaviframe()
        {
                UCL_ASSERT(m_navi, "m_navi is NULL");
                return *m_navi;
index 7bf1589af67eac920998bfcff1909812040f0fc4..4f46e3b5b88e9fce5b3283b1850ea180c2019f5a 100644 (file)
@@ -49,7 +49,7 @@ namespace gallery {
                                ExitRequestHandler onExitRequest, const IMediaAlbumSRef &album);
                virtual ~ThumbnailPage();
 
-               Result prepare();
+               ucl::Result prepare();
 
                bool onEachMedia(MediaItemUPtr &&media);
 
index 49a7d36d836d941348b6f32dd05011118d55bf0e..4f89dc8e051224564363524b315987434c4b4623 100644 (file)
@@ -51,7 +51,7 @@ namespace gallery {
                                ExitRequestHandler onExitRequest, const IMediaAlbumSRef &album);
                virtual ~ViewerPage();
 
-               Result prepare();
+               ucl::Result prepare();
                void showItem(int itemIndex);
 
                bool onEachMedia(MediaItemUPtr &&media);
index a73b00d17e1777e976a0d7537ee072cddbe0bac7..f07d41788ee14c6f7cc39a30a4bb5d4150b98672 100644 (file)
@@ -30,8 +30,8 @@ namespace gallery {
        UCL_DECLARE_REF_ALIASES(Page);
 
        UCL_DECLARE_REF_ALIASES(ThumbnailPage);
-
        UCL_DECLARE_REF_ALIASES(ViewerPage);
+       UCL_DECLARE_REF_ALIASES(NoContentPage);
 }
 
 #endif // __GALLERY_PRESENTATION_TYPES_H__
index 720ee58a7701a1a8573055478edd24a2fd8b5f6c..fbdef93ae13152a28c0c3ec0c8a3e6982ebed301 100644 (file)
 
 #include "config.h"
 
+#include "ucl/misc/TString.h"
+
 namespace gallery {
 
        constexpr auto THEME_EDJE_PATH = "edje/theme.edj";
+
+       extern const ucl::TString STR_APP_NAME;
+       extern const ucl::TString STR_NO_PHOTOS;
 }
 
 #endif // __GALLERY_RESOURCES_H__
index c08bd4a4607d440ae5013018d7fe47a9c0b15e9c..c54fad30f187fc381d9fae5ab3b3f4a7bb55f46f 100644 (file)
@@ -26,6 +26,7 @@ collections {
    }
 
    #include "../../edc/colors.h"
+   #include "../../edc/images.edc"
    #include "../../edc/image-grid.edc"
    #include "../../edc/button.edc"
 }
index 3f4af9305f61948990e1ad31a1d228ce47015c39..e617be6a357e5dea9420ac5ec9fc6de1c7c16e1e 100644 (file)
@@ -28,6 +28,8 @@
 #include "ucl/gui/stdTheme.h"
 #include "ucl/gui/helpers.h"
 
+#include "resources.h"
+
 #undef UCL_LOG_TAG
 #define UCL_LOG_TAG "GALLERY"
 
index a612f1d3c2d833a316a71e157e16a39a11e404fd..c79359f100bec3b7ea91bddeeb6d23a3872a7d3f 100644 (file)
@@ -104,4 +104,15 @@ namespace gallery {
 
                return RES_OK;
        }
+
+       Result GalleryAlbum::getMediaCount(int &count) const
+       {
+               const int ret = media_info_get_media_count_from_db(m_filter, &count);
+               if ((ret != 0) || (count < 0)) {
+                       count = 0;
+                       LOG_RETURN(RES_FAIL,
+                                       "media_info_foreach_media_from_db() failed: %d", ret);
+               }
+               return RES_OK;
+       }
 }
index 2df59008c58506923c7436e1c39b39f02e8e55b2..f5816a792efcd0a3ae0d0cdf5edc51ff471b2043 100644 (file)
@@ -31,6 +31,7 @@ namespace gallery {
                // IMediaAlbum //
 
                virtual ucl::Result forEachMedia(EachCb cb) const final override;
+               virtual ucl::Result getMediaCount(int &count) const final override;
 
        private:
                friend class ucl::RefCountObj<GalleryAlbum>;
index 3586a7626ec75fe27658f3e60469bb48ebd30fce..33a5f657e8296161f0710c7e4acc1c241d8eecad 100644 (file)
 #include "ucl/appfw/helpers.h"
 
 #include "model/Gallery.h"
+#include "model/IMediaAlbum.h"
 
+#include "presentation/NoContentPage.h"
 #include "presentation/ThumbnailPage.h"
 
-#include "resources.h"
-
 #include "common.h"
 
 namespace gallery { namespace { namespace impl {
@@ -106,6 +106,8 @@ namespace gallery {
                if (SCAN_MEDIA_ON_RESUME) {
                        rescanMediaContent();
                }
+
+               ecore_animator_frametime_set(1.0 / 60.0);
        }
 
        void Instance::rescanMediaContent()
@@ -148,9 +150,21 @@ namespace gallery {
                m_isScanInProgress = false;
 
                const auto thumbPage = dynamicRefCast<ThumbnailPage>(m_page);
-               if (thumbPage) {
-                       DLOG("Reloading the ThumbnailPage...");
-                       thumbPage->reload();
+
+               if (isNotEmpty(m_gallery->getAlbum())) {
+                       if (thumbPage) {
+                               DLOG("Reloading the ThumbnailPage...");
+                               thumbPage->reload();
+                       } else {
+                               if (m_page) {
+                                       m_page->exitNoTransition();
+                               }
+                               createThumbnailPage();
+                       }
+               } else if (thumbPage) {
+                       DLOG("Exit from ThumbnailPage witout transition...");
+                       thumbPage->exitNoTransition();
+                       createNoContentPage();
                }
        }
 
@@ -159,11 +173,11 @@ namespace gallery {
                DLOG("APP CONTROL");
 
                if (!m_page) {
-                       DLOG("Creating ThumbnailPage.");
-                       m_page = ThumbnailPage::Builder().
-                                       setNaviframe(m_navi).
-                                       setAlbum(m_gallery->getAlbum()).
-                                       build(DELEGATE(Instance::onPageExitRequest, this));
+                       if (isEmpty(m_gallery->getAlbum())) {
+                               createNoContentPage();
+                       } else {
+                               createThumbnailPage();
+                       }
                }
 
                if (!m_win->isVisible()) {
@@ -172,6 +186,32 @@ namespace gallery {
                }
        }
 
+       void Instance::createNoContentPage()
+       {
+               DLOG("Creating NoContentPage.");
+               m_page = NoContentPage::Builder().setNaviframe(m_navi).
+                               build(DELEGATE(Instance::onPageExitRequest, this));
+       }
+
+       void Instance::createThumbnailPage()
+       {
+               DLOG("Creating ThumbnailPage.");
+               m_page = ThumbnailPage::Builder().setNaviframe(m_navi).
+                               setAlbum(m_gallery->getAlbum()).
+                               build(DELEGATE(Instance::onPageExitRequest, this));
+       }
+
+       void Instance::onPageExitRequest(Page &page)
+       {
+               if (page.isAtBottom()) {
+                       DLOG("Bottom page. Lowering the window.");
+                       m_win->lower();
+               } else {
+                       DLOG("Exit page.");
+                       page.exit();
+               }
+       }
+
        void Instance::onSysEvent(const SysEvent sysEvent)
        {
                switch(sysEvent) {
@@ -190,15 +230,4 @@ namespace gallery {
                        break;
                }
        }
-
-       void Instance::onPageExitRequest(Page &page)
-       {
-               if (isLast(page)) {
-                       DLOG("Last page. Lowering the window.");
-                       m_win->lower();
-               } else {
-                       DLOG("Exit page.");
-                       page.exit();
-               }
-       }
 }
diff --git a/src/presentation/NoContentPage.cpp b/src/presentation/NoContentPage.cpp
new file mode 100644 (file)
index 0000000..0b9fd1c
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "presentation/NoContentPage.h"
+
+#include "ucl/gui/Layout.h"
+
+#include "common.h"
+
+namespace gallery {namespace { namespace impl {
+
+       using namespace ucl;
+
+       constexpr LayoutTheme ICON_THEME
+                       {"layout", "gallery_image", "gallery_icon_no_photos.png"};
+}}}
+
+namespace gallery {
+
+       using namespace ucl;
+
+       // NoContentPage::Builder //
+
+       NoContentPage::Builder::Builder()
+       {
+       }
+
+       NoContentPage::Builder::~Builder()
+       {
+       }
+
+       NoContentPage::Builder &NoContentPage::Builder::setNaviframe(
+                       const NaviframeSRef &navi)
+       {
+               m_navi = navi;
+               return *this;
+       }
+
+       NoContentPageSRef NoContentPage::Builder::build(
+                       const ExitRequestHandler onExitRequest) const
+       {
+               if (!onExitRequest) {
+                       LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {},
+                                       "onExitRequest is NULL");
+               }
+               if (!m_navi) {
+                       LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "m_navi is NULL");
+               }
+
+               auto result = makeShared<NoContentPage>(m_navi, onExitRequest);
+
+               FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+
+               return result;
+       }
+
+       // NoContentPage //
+
+       NoContentPage::NoContentPage(RefCountObjBase &rc,
+                       const NaviframeSRef &navi,
+                       const ExitRequestHandler onExitRequest) :
+               Page(rc, navi, onExitRequest)
+       {
+       }
+
+       NoContentPage::~NoContentPage()
+       {
+       }
+
+       Result NoContentPage::prepare()
+       {
+               const auto layout = Layout::Builder().
+                               setIsOwner(true).
+                               setTheme(LAYOUT_NO_CONTENTS).
+                               build(getNaviframe());
+               if (!layout) {
+                       LOG_RETURN(RES_FAIL, "Layout::build() failed!");
+               }
+
+               const auto icon = Layout::Builder().
+                               setTheme(impl::ICON_THEME).
+                               build(*layout);
+               if (!layout) {
+                       LOG_RETURN(RES_FAIL, "Layout::build() failed!");
+               }
+
+               layout->setContent(*icon);
+               layout->setText(PART_TITLE, STR_APP_NAME);
+               layout->setText(STR_NO_PHOTOS);
+
+               FAIL_RETURN(Page::prepare(
+                       [this, &layout]()
+                       {
+                               return getNaviframe().push(*layout);
+                       }),
+                       "Page::prepare() failed!");
+
+               layout->setIsOwner(false);
+
+               return RES_OK;
+       }
+}
index f4d4ecdc31af699cbe7a0d00643bf60066f7309f..ee15ea9a06cf6e0e2b603c6f59936e24b677c34c 100644 (file)
@@ -59,11 +59,9 @@ namespace gallery {
                        LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {},
                                        "onExitRequest is NULL");
                }
-
                if (!m_navi) {
                        LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "m_navi is NULL");
                }
-
                if (!m_album) {
                        LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "m_album is NULL");
                }
@@ -128,6 +126,9 @@ namespace gallery {
 
        ThumbnailPage::~ThumbnailPage()
        {
+               if (m_page) {
+                       m_page->exitNoTransition();
+               }
                m_imageGrid->setListener(nullptr);
        }
 
index c2292050b21717d09329f627f090e9e4fdaab221..c1e8b4e35f5f7089ac442bb7ed9dc4e53b5c3935 100644 (file)
@@ -66,11 +66,9 @@ namespace gallery {
                        LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {},
                                        "onExitRequest is NULL");
                }
-
                if (!m_navi) {
                        LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "m_navi is NULL");
                }
-
                if (!m_album) {
                        LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "m_album is NULL");
                }
diff --git a/src/resources.cpp b/src/resources.cpp
new file mode 100644 (file)
index 0000000..c0668d2
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "resources.h"
+
+namespace gallery {
+
+       // TODO replace with IDS in the future
+
+       const ucl::TString STR_APP_NAME {"Gallery"};
+       const ucl::TString STR_NO_PHOTOS {"No photos"};
+}
index b4bc8a8d57fdd391294596022fff2c768b32c842..13f7d686db47965263da118074d9a5b48a2c4371 100644 (file)
@@ -20,7 +20,7 @@ namespace ucl {
 
        inline Layout::Builder::Builder() :
                m_isOwner(false),
-               m_needBindToEo(true)
+               m_needBindToEo(false)
        {
        }
 
index c5b3d8bbe7b5fd0ca0594752bb1d36de8f0a25a3..a3eef5214c314601870ded15e4d39370b4d7f495 100644 (file)
@@ -27,8 +27,11 @@ namespace ucl {
 
        // Parts //
 
-       constexpr EdjePart PART_TEXT    {"elm.text"};
+       constexpr EdjePart PART_TEXT  {"elm.text"};
+       constexpr EdjePart PART_TITLE {"elm.text.title"};
+
        constexpr EdjePart PART_CONTENT {"elm.swallow.content"};
+       constexpr EdjePart PART_ICON    {"elm.swallow.icon"};
 }
 
 #endif // __UCL_GUI_STD_THEME_COMMON_H__
index 31e25f974caaf06b23334c9560e1e50d932997fe..79ff4267387c759189a996ae56f3add5cae9dbb4 100644 (file)
@@ -22,6 +22,9 @@
 namespace ucl {
 
        constexpr LayoutTheme LAYOUT_DEFAULT {"layout", "application", "default"};
+
+       constexpr LayoutTheme LAYOUT_NO_CONTENTS
+                       {"layout", "nocontents", "default"};
 }
 
 #endif // __UCL_GUI_STD_THEME_LAYOUT_H__
index 8c059c0c8cd69e220a31c1f3a5ff3796eef3486d..82e3d4cd8570cab8d476c9b0f906c8212c63ba85 100644 (file)
@@ -33,6 +33,12 @@ namespace ucl {
 
        constexpr bool isEmpty(const char *value);
 
+       template <class T>
+       constexpr auto isEmpty(const T &value) -> decltype(isEmpty(*value))
+       {
+               return isEmpty(*value);
+       }
+
        template <class T>
        constexpr auto isEmpty(const T &value) -> decltype(value.empty())
        {
index 0d2adc568ac5746e98bd2895b79874ed870ae886..7f20f756c284d2704f2dca4b135df4edb9ca5927 100644 (file)
@@ -28,8 +28,7 @@ namespace ucl {
        {
                Evas_Object *const eo = elm_layout_add(parent);
                if (!eo) {
-                       ELOG("elm_layout_add() failed!");
-                       return {};
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "elm_layout_add() failed!");
                }
 
                auto result = makeShared<Layout>(eo, m_isOwner);
@@ -38,10 +37,17 @@ namespace ucl {
                        result->bindToEo();
                }
 
+               bool isOk = false;
+
                if (isNotEmpty(m_edjeFilePath) && isValid(m_edjeGroup)) {
-                       result->setEdjeFile(m_edjeFilePath, m_edjeGroup);
+                       isOk = result->setEdjeFile(m_edjeFilePath, m_edjeGroup);
                } else {
-                       result->setTheme(isValid(m_theme) ? m_theme : LAYOUT_DEFAULT);
+                       isOk = result->setTheme(isValid(m_theme) ?
+                                       m_theme : LAYOUT_DEFAULT);
+               }
+
+               if (!isOk) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "Layout init failed!");
                }
 
                show(*result);