TizenRefApp-5765 Implement base Logs/Details/DetailsView and Integrate to LogList 80/60280/2
authorNataliia Kamyshna <n.kamyshna@samsung.com>
Wed, 24 Feb 2016 13:23:29 +0000 (15:23 +0200)
committerNataliia Kamyshna <n.kamyshna@samsung.com>
Thu, 25 Feb 2016 06:31:38 +0000 (08:31 +0200)
Change-Id: I3faf4043dbcc8120972c59a8b39bfb275a53aaa3
Signed-off-by: Nataliia Kamyshna <n.kamyshna@samsung.com>
lib-logs/inc/Logs/Details/DetailsView.h [new file with mode: 0644]
lib-logs/inc/Logs/List/LogItem.h
lib-logs/src/Logs/Details/DetailsView.cpp [new file with mode: 0644]
lib-logs/src/Logs/List/LogItem.cpp
lib-logs/src/Logs/List/LogsView.cpp

diff --git a/lib-logs/inc/Logs/Details/DetailsView.h b/lib-logs/inc/Logs/Details/DetailsView.h
new file mode 100644 (file)
index 0000000..d76d6d3
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 LOGS_DETAILS_DETAILS_VIEW_H
+#define LOGS_DETAILS_DETAILS_VIEW_H
+
+#include "Ui/View.h"
+
+namespace Ui
+{
+       class Genlist;
+}
+
+namespace Logs
+{
+       namespace Model
+       {
+               class LogGroup;
+       }
+       namespace Details
+       {
+               /**
+                * @brief Log details view.
+                */
+               class DetailsView : public Ui::View
+               {
+               public:
+
+                       /**
+                        * @brief Create log details view.
+                        */
+                       DetailsView(Model::LogGroup *group);
+
+               private:
+                       virtual Evas_Object *onCreate(Evas_Object *parent) override;
+
+                       Model::LogGroup *m_Group;
+                       Ui::Genlist *m_Genlist;
+               };
+       }
+}
+
+#endif /* LOGS_DETAILS_DETAILS_VIEW_H */
index ac4d0c6..d8d28b6 100644 (file)
@@ -46,6 +46,11 @@ namespace Logs
                        typedef std::function<void(LogItem *item)> DeleteCallback;
 
                        /**
+                        * @brief Item details callback
+                        */
+                       typedef std::function<void(LogItem *item)> DetailsCallback;
+
+                       /**
                         * @brief Create log item
                         * @param[in]   group       Log group
                         * @param[in]   mode        Item mode
@@ -65,6 +70,17 @@ namespace Logs
                        void setDeleteCallback(DeleteCallback callback);
 
                        /**
+                        * @brief Set log details callback
+                        * @param[in]   callback    Details callback
+                        */
+                       void setDetailsCallback(DetailsCallback callback);
+
+                       /**
+                        * @brief Get group
+                        */
+                       Model::LogGroup *getGroup() const;
+
+                       /**
                         * @brief Remove group
                         */
                        void removeGroup();
@@ -77,11 +93,13 @@ namespace Logs
                        Evas_Object *createLayout(Evas_Object *parent, const char *layoutName);
                        Evas_Object *createIcon(Evas_Object *parent, const char *path);
                        const char *getImagePath(int type);
+                       void onInfoIconPressed();
 
                        void updateItem();
                        void setUpdateCallback();
 
                        DeleteCallback m_OnDelete;
+                       DetailsCallback m_OnDetails;
                        Model::LogGroup *m_Group;
                        ItemMode m_Mode;
                };
diff --git a/lib-logs/src/Logs/Details/DetailsView.cpp b/lib-logs/src/Logs/Details/DetailsView.cpp
new file mode 100644 (file)
index 0000000..011bb2b
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 "Logs/Details/DetailsView.h"
+#include "Logs/Model/LogGroup.h"
+
+#include "App/Path.h"
+#include "Ui/Genlist.h"
+
+using namespace Logs::Model;
+using namespace Logs::Details;
+
+DetailsView::DetailsView(LogGroup *group)
+       : m_Group(group), m_Genlist(nullptr)
+{
+}
+
+Evas_Object *DetailsView::onCreate(Evas_Object *parent)
+{
+       m_Genlist = new Ui::Genlist();
+       return m_Genlist->create(parent);
+}
index 0f637cf..a5c5c1d 100644 (file)
@@ -18,6 +18,8 @@
 #include "Logs/List/LogItem.h"
 #include "Logs/Model/Log.h"
 #include "Logs/Model/LogGroup.h"
+#include "Logs/Details/DetailsView.h"
+#include "Utils/Callback.h"
 
 #include "App/Path.h"
 #include "Ui/Scale.h"
@@ -44,6 +46,7 @@
 using namespace Ui;
 using namespace Logs::List;
 using namespace Logs::Model;
+using namespace Logs::Details;
 
 namespace
 {
@@ -51,7 +54,7 @@ namespace
 }
 
 LogItem::LogItem(LogGroup *group, ItemMode mode)
-       :m_Group(group), m_Mode(mode)
+       : m_Group(group), m_Mode(mode)
 {
        setUpdateCallback();
 }
@@ -67,6 +70,23 @@ void LogItem::setDeleteCallback(DeleteCallback callback)
        m_OnDelete = std::move(callback);
 }
 
+void LogItem::setDetailsCallback(DetailsCallback callback)
+{
+       m_OnDetails = std::move(callback);
+}
+
+void LogItem::onInfoIconPressed()
+{
+       if (m_OnDetails) {
+               m_OnDetails(this);
+       }
+}
+
+LogGroup *LogItem::getGroup() const
+{
+       return m_Group;
+}
+
 void LogItem::removeGroup()
 {
        m_Group->remove();
@@ -110,7 +130,11 @@ Evas_Object *LogItem::getContent(Evas_Object *parent, const char *part)
                if (m_Mode == ItemMode::Pick) {
                        return GenlistCheckItem::getContent(parent, part);
                } else {
-                       return createIcon(parent, ICON_INFO);
+                       Evas_Object *icon = createIcon(parent, ICON_INFO);
+                       evas_object_propagate_events_set(icon, EINA_FALSE);
+                       evas_object_smart_callback_add(icon, "clicked",
+                                       (Evas_Smart_Cb) makeCallback(&LogItem::onInfoIconPressed), this);
+                       return icon;
                }
        }
 
index ffb3c34..3d2f699 100644 (file)
@@ -18,6 +18,7 @@
 #include "Logs/List/LogsView.h"
 #include "Logs/List/LogGroupItem.h"
 #include "Logs/List/LogItem.h"
+#include "Logs/Details/DetailsView.h"
 
 #include "Ui/Genlist.h"
 #include "Ui/Menu.h"
@@ -26,6 +27,7 @@
 
 using namespace Logs::Model;
 using namespace Logs::List;
+using namespace Logs::Details;
 using namespace std::placeholders;
 
 LogsView::LogsView(FilterType filterType)
@@ -163,6 +165,10 @@ LogItem *LogsView::createLogItem(LogGroup *group)
                }
        });
 
+       item->setDetailsCallback([this](LogItem *item) {
+               getNavigator()->navigateTo(new DetailsView(item->getGroup()));
+       });
+
        return item;
 }