TizenRefApp-8097 Implement skeleton of compose frames 84/116884/1
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 1 Mar 2017 14:23:00 +0000 (16:23 +0200)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 1 Mar 2017 14:23:00 +0000 (16:23 +0200)
Change-Id: Ib358728fbe1c313c505671afa9413141a425f1f2
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
12 files changed:
.cproject
src/Common/Controller/src/NaviFrameController.cpp
src/Common/View/inc/NaviFrameView.h
src/Common/View/inc/SelectCtxPopup.h
src/Common/View/inc/ToastPopup.h
src/Common/View/src/NaviFrameView.cpp
src/Common/View/src/ToastPopup.cpp
src/Composer/Controller/inc/ComposerFrame.h [new file with mode: 0644]
src/Composer/Controller/inc/RecipFrame.h [new file with mode: 0644]
src/Composer/Controller/src/ComposerFrame.cpp [new file with mode: 0644]
src/Composer/Controller/src/RecipFrame.cpp [new file with mode: 0644]
src/MsgThread/Controller/src/MsgThreadFrame.cpp

index 93db72598e3b016938d421462b84a9e7d5bd9648..3f171c404967af57f78563f060d1f7298a7b4d58 100644 (file)
--- a/.cproject
+++ b/.cproject
                                                                </option>
                                                                <option id="gnu.cpp.compiler.option.include.paths.2037910591" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Conversation/Main/Controller/inc}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Composer/Controller/inc}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/MsgThread/View/inc}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Settings/Controller/inc}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/MsgThread/Controller/inc}&quot;"/>
                                                                </option>
                                                                <option id="gnu.cpp.compiler.option.include.paths.1895069727" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Conversation/Main/Controller/inc}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Composer/Controller/inc}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/MsgThread/View/inc}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Settings/Controller/inc}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/MsgThread/Controller/inc}&quot;"/>
index 2bd412d8f4f3ff29a2177fda382c44418b6e89c5..4559d1db339b58bb8f906d8dc14f37d7915b1d3e 100644 (file)
@@ -25,9 +25,9 @@
 #include "AppControlLauncher.h"
 #include "MsgEngine.h"
 #include "Callback.h"
+#include "ToastPopup.h"
 
 #include <memory>
-#include <notification.h>
 
 using namespace Msg;
 
@@ -64,7 +64,7 @@ bool NaviFrameController::prepare(const AppControlCommand &cmd)
     std::string errorMsg;
     if (!App::getInst().getMsgEngine().isReady(errorMsg)) {
         MSG_LOG_ERROR(errorMsg);
-        notification_status_message_post(errorMsg.c_str());
+        ToastPopup::toast(errorMsg.c_str());
         return false;
     }
     return true;
index 9b740db7ae21179d09ce370c1ea60262ec46bac0..39f4373b986fa960c5ca2157c7b279b980f58f11 100644 (file)
@@ -93,6 +93,9 @@ namespace Msg
              */
             bool getTransitionStatus() const;
 
+
+            void destroy();
+
         protected:
             virtual void onPause(NaviFrameItem &item) {};
             virtual void onResume(NaviFrameItem &item) {};
index 02c831c5fee334cda6e72acba23a9856a9f19b35..7e3ed99217b66091e42dbe3679f3ede6455147dc 100644 (file)
@@ -42,19 +42,19 @@ namespace Msg {
         setStyle("select_mode");
     }
 
-    CtxPopupItem *SelectCtxPopup::appendTopItem(const std::string &text, CtxPopupItemPressedCb cb, void *userData)
+    inline CtxPopupItem *SelectCtxPopup::appendTopItem(const std::string &text, CtxPopupItemPressedCb cb, void *userData)
     {
         m_pTopItem = appendItem(text, nullptr, cb, userData);
         return m_pTopItem;
     }
 
-    CtxPopupItem *SelectCtxPopup::appendBottomItem(const std::string &text, CtxPopupItemPressedCb cb, void *userData)
+    inline CtxPopupItem *SelectCtxPopup::appendBottomItem(const std::string &text, CtxPopupItemPressedCb cb, void *userData)
     {
         m_pBottomItem = appendItem(text, nullptr, cb, userData);
         return m_pBottomItem;
     }
 
-    void SelectCtxPopup::go()
+    inline void SelectCtxPopup::go()
     {
         show();
         if (m_pTopItem && m_pBottomItem) {
index bf4cae8b3891628bf7007946dd56320860d09704..eb51384e254df1063afa4ceef66462b0049838ce 100644 (file)
@@ -32,6 +32,7 @@ namespace Msg {
             void setText(const std::string &text);
 
             static ToastPopup *toast(const TText &text, const char *iconName = nullptr);
+            static ToastPopup *toast(const std::string &text, const char *iconName = nullptr);
     };
 }
 
index 08dd7aac2b5d9ba52956278812b7b2f779ecb7a3..647190c3d04c0fb041485250386eafac64ee90e7 100644 (file)
 #include "Logger.h"
 #include "Callback.h"
 
-#include <Elementary.h>
-
 using namespace Msg;
 
-const char *naviTitleStyleEmpty = "empty";
+namespace {
+    const char *naviTitleStyleEmpty = "empty";
+    const char *transFinishedEvent = "transition,finished";
+}
+
 
 NaviFrameView::NaviFrameView(Evas_Object *parent)
     : View()
@@ -43,7 +45,7 @@ NaviFrameView::~NaviFrameView()
 void NaviFrameView::create(Evas_Object *parent)
 {
     setEo(elm_naviframe_add(parent));
-    addSmartCb("transition,finished", makeCbFirst(&NaviFrameView::onTransitionFinished), this);
+    addSmartCb(transFinishedEvent, makeCbFirst(&NaviFrameView::onTransitionFinished), this);
     show();
 }
 
@@ -202,6 +204,12 @@ void NaviFrameView::onBeforeDelete(View &view)
     pause();
 }
 
+void NaviFrameView::destroy()
+{
+    evas_object_smart_callback_del(getEo(), transFinishedEvent, makeCbFirst(&NaviFrameView::onTransitionFinished));
+    View::destroy();
+}
+
 bool NaviFrameView::getTransitionStatus() const
 {
     // TODO: Move functionality for gets TransitionStatus to EFL (elm_naviframe) side.
index db26f01270efa2ddc21d5dc6a1c51614e739c223..0ed3ae2b2e9609e34febf1435832617f4495c37c 100644 (file)
 
 using namespace Msg;
 
+namespace {
+    ToastPopup *createToast(const char *iconName)
+    {
+        auto *toast = new ToastPopup;
+        if (iconName)
+            toast->setIcon(iconName);
+        toast->show();
+        return toast;
+    }
+}
+
 ToastPopup::ToastPopup(double timeout)
     : Popup()
 {
@@ -49,11 +60,15 @@ void ToastPopup::setText(const std::string &text)
 
 ToastPopup *ToastPopup::toast(const TText &text, const char *iconName)
 {
-    auto *toast = new ToastPopup;
+    auto *toast = createToast(iconName);
     if (text.getMsg())
         toast->setText(text);
-    if (iconName)
-        toast->setIcon(iconName);
-    toast->show();
+    return toast;
+}
+
+ToastPopup *ToastPopup::toast(const std::string &text, const char *iconName)
+{
+    auto *toast = createToast(iconName);
+    toast->setText(text);
     return toast;
 }
diff --git a/src/Composer/Controller/inc/ComposerFrame.h b/src/Composer/Controller/inc/ComposerFrame.h
new file mode 100644 (file)
index 0000000..81fb8a5
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2016  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 ComposerFrame_h_
+#define ComposerFrame_h_
+
+#include "FrameController.h"
+#include "DefaultLayout.h"
+#include "BottomButton.h"
+
+namespace Msg {
+    class ComposerFrame
+        : public FrameController {
+
+        public:
+            ComposerFrame(NaviFrameController &parent);
+            virtual ~ComposerFrame();
+
+        private:
+            // NaviFrameItem:
+            void onAttached(ViewItem &item) override;
+
+            // Hw buttons:
+            void onHwBackButtonPreessed(Evas_Object *obj, void *event);
+
+        private:
+            void prepareMainLayout();
+
+        private:
+            DefaultLayout *m_pLayout;
+    };
+}
+
+#endif /* ComposerFrame */
diff --git a/src/Composer/Controller/inc/RecipFrame.h b/src/Composer/Controller/inc/RecipFrame.h
new file mode 100644 (file)
index 0000000..2bd9570
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2016  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 RecipFrame_h_
+#define RecipFrame_h_
+
+#include "FrameController.h"
+#include "DefaultLayout.h"
+#include "BottomButton.h"
+
+namespace Msg {
+    class RecipFrame
+        : public FrameController {
+
+        public:
+            RecipFrame(NaviFrameController &parent);
+            virtual ~RecipFrame();
+
+        private:
+            // NaviFrameItem:
+            void onAttached(ViewItem &item) override;
+
+            // Hw buttons:
+            void onHwBackButtonPreessed(Evas_Object *obj, void *event);
+
+            // Bottom Button:
+            void onNextButtonClicked(Evas_Object *obj, void *event);
+
+        private:
+            void prepareMainLayout();
+            void prepareNextButton();
+
+        private:
+            DefaultLayout *m_pLayout;
+            BottomButton *m_pNextButton;
+    };
+}
+
+#endif /* RecipFrame_h_ */
diff --git a/src/Composer/Controller/src/ComposerFrame.cpp b/src/Composer/Controller/src/ComposerFrame.cpp
new file mode 100644 (file)
index 0000000..2ccc2e2
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016  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 "ComposerFrame.h"
+#include "Callback.h"
+
+using namespace Msg;
+
+ComposerFrame::ComposerFrame(NaviFrameController &parent)
+    : FrameController(parent)
+    , m_pLayout(nullptr)
+{
+    MSG_LOG("");
+    prepareMainLayout();
+}
+
+ComposerFrame::~ComposerFrame()
+{
+    MSG_LOG("");
+}
+
+void ComposerFrame::prepareMainLayout()
+{
+    if (!m_pLayout) {
+        m_pLayout = new DefaultLayout(getParent());
+        m_pLayout->addHwButtonEvent(EEXT_CALLBACK_BACK, makeCbFirst(&ComposerFrame::onHwBackButtonPreessed), this);
+    }
+}
+
+void ComposerFrame::onAttached(ViewItem &item)
+{
+    MSG_LOG("");
+    FrameController::onAttached(item);
+    setContent(*m_pLayout);
+}
+
+void ComposerFrame::onHwBackButtonPreessed(Evas_Object *obj, void *event_info)
+{
+    MSG_LOG("");
+    pop();
+}
diff --git a/src/Composer/Controller/src/RecipFrame.cpp b/src/Composer/Controller/src/RecipFrame.cpp
new file mode 100644 (file)
index 0000000..0c07d5c
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2016  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 "RecipFrame.h"
+#include "Callback.h"
+#include "ComposerFrame.h"
+
+using namespace Msg;
+
+RecipFrame::RecipFrame(NaviFrameController &parent)
+    : FrameController(parent)
+    , m_pLayout(nullptr)
+    , m_pNextButton(nullptr)
+{
+    MSG_LOG("");
+    prepareMainLayout();
+    prepareNextButton();
+}
+
+RecipFrame::~RecipFrame()
+{
+    MSG_LOG("");
+}
+
+void RecipFrame::prepareMainLayout()
+{
+    if (!m_pLayout) {
+        m_pLayout = new DefaultLayout(getParent());
+        m_pLayout->addHwButtonEvent(EEXT_CALLBACK_BACK, makeCbFirst(&RecipFrame::onHwBackButtonPreessed), this);
+    }
+}
+
+void RecipFrame::prepareNextButton()
+{
+    if (!m_pNextButton) {
+        m_pNextButton = new BottomButton(*m_pLayout);
+        View::addSmartCb(m_pNextButton->getInnerButton(), "clicked", makeCbFirst(&RecipFrame::onNextButtonClicked), this);
+        m_pNextButton->setText(msgt("Next")); // TODO: localization
+        m_pLayout->setBottomButton(*m_pNextButton);
+        m_pLayout->showBottomButton(true);
+    }
+}
+
+void RecipFrame::onAttached(ViewItem &item)
+{
+    MSG_LOG("");
+    FrameController::onAttached(item);
+    setContent(*m_pLayout);
+}
+
+void RecipFrame::onHwBackButtonPreessed(Evas_Object *obj, void *event_info)
+{
+    MSG_LOG("");
+    pop();
+}
+
+void RecipFrame::onNextButtonClicked(Evas_Object *obj, void *event)
+{
+    MSG_LOG("");
+    auto *composerFrame = new ComposerFrame(getParent());
+    getParent().push(*composerFrame);
+}
index 0c9feac8b00afda9a0d72f1d1dde52d6629f128d..ba8987772810ae0eb0a3b5b912adbcebce4fb69b 100644 (file)
@@ -24,6 +24,7 @@
 #include "LangUtils.h"
 #include "App.h"
 #include "Resource.h"
+#include "RecipFrame.h"
 
 using namespace Msg;
 
@@ -212,6 +213,8 @@ void MsgThreadFrame::onDeselectAllButtonClicked(CtxPopupItem &item)
 void MsgThreadFrame::onNewMessageClicked(MoreOption &obj)
 {
     MSG_LOG("");
+    auto *recipFrame = new RecipFrame(getParent());
+    getParent().push(*recipFrame);
 }
 
 void MsgThreadFrame::onDeleteClicked(MoreOption &obj)