+++ /dev/null
-/*
- * 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 APP_APP_CONTROL_REQUEST_H
-#define APP_APP_CONTROL_REQUEST_H
-
-#include "App/AppControl.h"
-#include "App/AppControlUtils.h"
-#include "Utils/Range.h"
-
-#define APP_CONTROL_OPERATION_SETTING_CALL "http://tizen.org/appcontrol/operation/setting/call"
-
-#define APP_CONTROL_MIME_CONTACT "application/vnd.tizen.contact"
-#define APP_CONTROL_MIME_IMAGE "image/*"
-#define APP_CONTROL_MIME_VCARD "text/vcard"
-
-#define APP_CONTROL_URI_SCHEME_FILE "file://"
-
-#define APP_CONTROL_SELECT_SINGLE "single"
-#define APP_CONTROL_SELECT_MULTIPLE "multiple"
-
-#define APP_CONTROL_RESULT_ID "id"
-#define APP_CONTROL_RESULT_PHONE "phone"
-#define APP_CONTROL_RESULT_EMAIL "email"
-#define APP_CONTROL_RESULT_VCARD "vcf"
-#define APP_CONTROL_RESULT_ACTION "action"
-#define APP_CONTROL_RESULT_CALL "call"
-#define APP_CONTROL_RESULT_MESSAGE "message"
-
-#define APP_CONTROL_RINGTONE_IS_DEFAULT "is_default"
-#define APP_CONTROL_RINGTONE_TRUE "true"
-
-namespace App
-{
- /**
- * @brief Request contact creation operation
- * @param[in] number Phone number to save to the new contact
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestContactCreate(const char *number);
-
- /**
- * @brief Request contact view operation
- * @param[in] personId ID of person to view
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestContactDetails(int personId);
-
- /**
- * @brief Request contact edit operation
- * @param[in] personId ID of person to edit or 0 to launch pick first
- * @param[in] number Phone number to add to the edited contact
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestContactEdit(int personId, const char *number);
-
- /**
- * @brief Request contact pick operation
- * @param[in] selectionMode One of APP_CONTROL_SELECT_* values
- * @param[in] resultType One of APP_CONTROL_RESULT_* values
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestContactPick(const char *selectionMode, const char *resultType);
-
- /**
- * @brief Request telephony call
- * @param[in] number Number to call
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestTelephonyCall(const char *number);
-
- /**
- * @brief Request launch call settings
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestCallSettings();
-
- /**
- * @brief Request message or email composer for single recipient.
- * @param[in] scheme URI scheme (e.g. sms: or mmsto: for message, mailto: for email)
- * @param[in] to Recipient
- * @param[in] subject Subject
- * @param[in] text Text
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestComposer(const char *scheme, const char *to,
- const char *subject = nullptr, const char *text = nullptr);
-
- /**
- * @brief Request message or email composer for multiple recipients.
- * @param[in] scheme URI scheme (e.g. sms: or mmsto: for message, mailto: for email)
- * @param[in] recipients Multiple recipients
- * @param[in] subject Subject
- * @param[in] text Text
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestComposer(const char *scheme, Utils::Range<const char **> recipients,
- const char *subject = nullptr, const char *text = nullptr);
-
- /**
- * @brief Request camera image capture
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestCameraImage();
-
- /**
- * @brief Request pick image from gallery
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestGalleryImage();
-
- /**
- * @brief Request view image
- * @param[in] path Path to image file
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestViewImage(const char *path);
-
- /**
- * @brief Request share contact via other application
- * @param[in] personId Contact's person ID
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestShareContact(int personId);
-
- /**
- * @brief Request share text to other application
- * @param[in] text Information in text representation
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestShareText(const char *text);
-
- /**
- * @brief Request share memo to other application.
- * @param[in] text Information in text representation.
- * @param[in] paths File paths.
- * @param[in] count Paths count.
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestShareMemo(const char *text, const char **paths, int count = 0);
-
- /**
- * @brief Request share "My Profile" via other application
- * @param[in] recordId "My Profile" record ID
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestShareMyProfile(int recordId);
-
- /**
- * @brief Request share of multiple contacts via other application
- * @param[in] personIds Contact's person IDs
- * @param[in] count Person IDs count
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestMultiShareContacts(const char **personIds, int count);
-
- /**
- * @brief Request pick vcard(s) from filesystem
- * @param[in] path Path of storage from where files should be picked
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestPickVcard(const char *path);
-
- /**
- * @brief Request pick ringtone from Settings
- * @param[in] selectedPath Path of currently selected ringtone
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestPickRingtone(const char *selectedPath = nullptr);
-
- /**
- * @brief Request view storage settings
- * @return AppControl wrapper
- */
- AppControl EXPORT_API requestViewStorageSettings();
-}
-
-#endif /* APP_APP_CONTROL_REQUEST_H */
+++ /dev/null
-/*
- * 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 I18N_COLLATOR_H
-#define I18N_COLLATOR_H
-
-#include "I18n/UniString.h"
-#include <utils_i18n_ucollator.h>
-
-namespace I18n
-{
- /**
- * @brief Provides locale-dependent string comparison.
- */
- class EXPORT_API Collator
- {
- public:
- /**
- * @brief Create collator.
- * @param[in] strength Collation strength
- * @see i18n_ucollator_strength_e
- */
- explicit Collator(i18n_ucollator_strength_e strength = I18N_UCOLLATOR_PRIMARY);
- Collator(const Collator &that) = delete;
- Collator(Collator &&that);
- ~Collator();
-
- Collator &operator=(const Collator &that) = delete;
- Collator &operator=(Collator &&that);
-
- /**
- * @brief Initialize the collator with current locale.
- * @remark Can be called several times.
- */
- void initialize();
-
- /**
- * @brief Compare two strings.
- * @pre Should be initialized by calling initialize().
- * @param[in] str1 First string
- * @param[in] str2 Second string
- * @return 0 if equal, -1 if str1 < str2, otherwise 1.
- */
- int compare(const UniString &str1, const UniString &str2);
-
- private:
- i18n_ucollator_strength_e m_Strength;
- i18n_ucollator_h m_Handle;
- };
-}
-
-#endif /* I18N_COLLATOR_H */
+++ /dev/null
-/*
- * 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 I18N_UNI_STRING_H
-#define I18N_UNI_STRING_H
-
-#include "Utils/String.h"
-#include <utils_i18n.h>
-#include <string>
-
-namespace I18n
-{
- /**
- * @brief Class wrapper for convenient work with multibyte UTF8 unicode string
- */
- class EXPORT_API UniString
- {
- public:
- /**
- * @brief Instantiation of the basic_string class template,
- * that uses i18n_uchar as its character type
- */
- typedef std::basic_string<i18n_uchar> I18nString;
-
- UniString() = default;
- /**
- * @brief Create new object, based on @a utf8Str string
- * @param[in] utf8Str UTF8 multibyte unicode string
- */
- UniString(const char *utf8Str);
-
- bool operator<(const UniString &that) const;
- bool operator>(const UniString &that) const;
- bool operator==(const UniString &that) const;
- bool operator!=(const UniString &that) const;
- bool operator<=(const UniString &that) const;
- bool operator>=(const UniString &that) const;
-
- /**
- * @return I18n string
- */
- const I18nString &getI18nStr() const;
-
- /**
- * @return UTF8 multibyte string
- */
- const std::string &getUtf8Str() const;
-
- /**
- * @brief Erases the contents of the string
- */
- void clear();
-
- /**
- * @brief Convert I18n string into UTF-8.
- * @param[in] ustring I18n string.
- * @return The converted string (in UTF-8).
- */
- static std::string toUtf8(const I18nString &ustring);
-
- /**
- * @brief Convert UTF-8 string into I18n.
- * Inline function needed because of crash when fromUtf8
- * receive empty string(Compiler problem).
- * @param[in] utf8Str String (in UTF-8).
- * @return The converted I18n string.
- */
- static I18nString fromUtf8(const std::string &utf8Str);
-
- private:
- mutable std::string m_Utf8Str;
- I18nString m_UniStr;
- };
-}
-
-#endif /* I18N_UNI_STRING_H */
+++ /dev/null
-/*
- * 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 SYSTEM_SETTINGS_H
-#define SYSTEM_SETTINGS_H
-
-#include <system_settings.h>
-#include "Utils/CallbackManager.h"
-
-namespace System
-{
- namespace Settings
- {
- typedef Utils::CallbackManager<system_settings_key_e> CallbackManager;
-
- /**
- * @see system_settings_set_changed_cb()
- */
- EXPORT_API void addCallback(system_settings_key_e key, CallbackManager::Callback callback);
-
- /**
- * @see system_settings_unset_changed_cb()
- */
- EXPORT_API void removeCallback(system_settings_key_e key, void *subscriber);
- };
-}
-
-#endif /* SYSTEM_SETTINGS_H */
+++ /dev/null
-/*
- * 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 UI_BUTTON_H
-#define UI_BUTTON_H
-
-#include "Ui/Control.h"
-#include <functional>
-
-namespace Ui
-{
- /**
- * @brief Provides convenient press and longpress events handling.
- */
- class EXPORT_API Button : public Control
- {
- public:
- Button();
- virtual ~Button() override;
-
- /**
- * @brief Set press-event callback.
- */
- void setPressedCallback(std::function<void(Button &)> callback);
-
- /**
- * @brief Set longpress-event callback.
- * @details Callback should return true if the event was handled.
- * If callback returns false onPressed event will be delivered
- * as well when the button is released.
- */
- void setLongpressedCallback(std::function<bool(Button &)> callback);
-
- private:
- virtual Evas_Object *onCreate(Evas_Object *parent) override;
- virtual void onCreated() override;
-
- void onMouseDown(Evas *evas, Evas_Object *obj, void *eventInfo);
- void onMouseUp(Evas *evas, Evas_Object *obj, void *eventInfo);
- void onMouseOut(Evas *evas, Evas_Object *obj, void *eventInfo);
-
- void resetTimer();
- Eina_Bool onTimeout();
-
- Ecore_Timer *m_Timer;
- bool m_IsLongpressed;
-
- std::function<void(Button &)> m_OnPressed;
- std::function<bool(Button &)> m_OnLongpressed;
- };
-}
-
-#endif /* UI_BUTTON_H */
+++ /dev/null
-/*
- * 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 UI_HOVERSEL_H
-#define UI_HOVERSEL_H
-
-#include "Ui/Selector.h"
-
-namespace Ui
-{
- class View;
-
- class EXPORT_API Hoversel : public Selector
- {
- public:
- Hoversel();
- virtual ~Hoversel() override;
-
- /**
- * @brief Add item with text.
- * @param[in] text Item text
- * @param[in] value Item data
- * @return Added item on success, otherwise nullptr.
- * @see Selector::addItem()
- */
- Elm_Object_Item *addItem(const char *text, void *data);
-
- /**
- * @see Selector::addItem()
- */
- virtual Elm_Object_Item *addItem(void *data) override;
-
- /**
- * @brief Set text of currently selected item.
- * @param[in] text Text to be displayed in hoversel button
- */
- void setText(const char *text);
-
- /**
- * @see Selector::setSelectedItem()
- */
- virtual void setSelectedItem(Elm_Object_Item *item) override;
-
- protected:
- virtual Evas_Object *onCreate(Evas_Object *parent) override;
-
- private:
- void onViewNavigation(Evas_Object *obj, void *eventInfo);
- void onSelected(Evas_Object *hoversel, Elm_Object_Item *item);
- static void onExpanded(void *data, Evas_Object *hoversel, void *eventInfo);
- static void onDismissed(void *data, Evas_Object *hoversel, void *eventInfo);
- static void onBackPressed(void *data, Evas_Object *hoversel, void *eventInfo);
-
- View *m_View;
- };
-}
-
-#endif /* UI_HOVERSEL_H */
+++ /dev/null
-/*
- * 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 UI_LIST_POPUP_H
-#define UI_LIST_POPUP_H
-
-#include "Ui/Popup.h"
-
-namespace Ui
-{
- class EXPORT_API ListPopup : public Popup
- {
- public:
- /**
- * @brief Specific item selection callback.
- */
- typedef std::function<void()> ItemSelectCallback;
-
- /**
- * @brief Any item selection callback.
- * @param[in] Item data
- */
- typedef std::function<void(void *)> SelectCallback;
-
- /**
- * @brief Create list popup
- * @param[in] itemStyle Genlist item style
- */
- ListPopup(const char *itemStyle = "type1");
- virtual ~ListPopup() override;
-
- /**
- * @brief Add ListPopup item
- * @param[in] text Main text of the item
- * @param[in] data Data associated with the item
- * @param[in] callback Callback to be called when item is selected
- * @return Added item on success, otherwise nullptr
- */
- Elm_Object_Item *addItem(std::string text, void *data, ItemSelectCallback callback = nullptr);
- Elm_Object_Item *addItem(std::string text, ItemSelectCallback callback = nullptr);
- Elm_Object_Item *addItem(void *data, ItemSelectCallback callback = nullptr);
-
- /**
- * @brief Set item selection callback.
- * @param[in] callback Callback to be called when any item is selected
- */
- void setSelectCallback(SelectCallback callback);
-
- protected:
- /**
- * @see Control::onCreate()
- */
- virtual Evas_Object *onCreate(Evas_Object *parent) override;
-
- /**
- * @brief Create genlist
- */
- Evas_Object *createGenlist(Evas_Object *parent);
-
- /**
- * @brief Called when item's text part needs to be updated.
- * @details If "elm.text" part is not handled in this function then it will
- * contain the text specified in ListPopup::addItem().
- * @see Elm_Gen_Item_Text_Get_Cb.
- */
- virtual char *getItemText(void *data, const char *part) { return nullptr; }
-
- /**
- * @brief Called when item's content part needs to be updated.
- * @see Elm_Gen_Item_Content_Get_Cb.
- */
- virtual Evas_Object *getItemContent(void *data, const char *part) { return nullptr; }
-
- /**
- * @brief Called when any item is selected.
- * @param[in] data Item data
- */
- virtual void onItemSelected(void *data) { }
-
- private:
- struct ItemData;
-
- static char *getText(ItemData *itemData, Evas_Object *genlist, const char *part);
- static Evas_Object *getContent(ItemData *itemData, Evas_Object *genlist, const char *part);
- static void onSelected(ListPopup *popup, Evas_Object *genlist, Elm_Object_Item *item);
-
- void updateGenlistHeight();
- void updateMaxHeight();
-
- void onGenlistResized(Evas *e, Evas_Object *genlist, void *eventInfo);
- void onWindowResized(Evas *e, Evas_Object *window, void *eventInfo);
-
- Evas_Coord_Size m_GenlistSize;
- int m_MaxHeight;
- bool m_IsResizing;
-
- Evas_Object *m_Window;
- Evas_Object *m_Genlist;
- Elm_Genlist_Item_Class *m_ItemClass;
- SelectCallback m_OnSelected;
- };
-}
-
-#endif /* UI_LIST_POPUP_H */
+++ /dev/null
-/*
- * 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 UI_PROCESS_POPUP_H
-#define UI_PROCESS_POPUP_H
-
-#include "Ui/Popup.h"
-
-namespace Ui
-{
- class EXPORT_API ProcessPopup : public Popup
- {
- public:
- enum Size
- {
- SizeSmall,
- SizeMedium
- };
-
- /**
- * @brief Create popup.
- * @param[in] size Popup size
- * @param[in] showDelayTime Delay before showing popup
- * @param[in] showMinTime Minimum time popup should be shown
- */
- explicit ProcessPopup(Size size = SizeMedium,
- double showDelayTime = 0.2, double showMinTime = 1.0);
- virtual ~ProcessPopup() override;
-
- /**
- * @brief Allows method overload instead of shadowing
- */
- using Control::create;
-
- /**
- * @brief Create process popup with text.
- * @param[in] parent Popup parent
- * @param[in] text Popup text
- * @param[in] size Popup size
- * @return Created popup
- */
- static ProcessPopup *create(Evas_Object *parent, const char *text, Size size = SizeMedium);
-
- /**
- * @brief Set Popup text.
- * @param[in] text Popup text
- */
- void setText(const char *text);
-
- /**
- * @brief Close the popup once minimum show time has elapsed.
- */
- void close();
-
- protected:
- virtual Evas_Object *onCreate(Evas_Object *parent) override;
-
- private:
- Eina_Bool onShowDelayElapsed();
- Eina_Bool onShowMinElapsed();
-
- Size m_Size;
- Evas_Object *m_Layout;
-
- Ecore_Timer *m_ShowDelayTimer;
- Ecore_Timer *m_ShowMinTimer;
- bool m_IsDestroyPending;
- };
-}
-
-#endif /* UI_PROCESS_POPUP_H */
+++ /dev/null
-/*
- * 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 PROGRESS_CONTROLLER_H
-#define PROGRESS_CONTROLLER_H
-
-#include <Elementary.h>
-#include <condition_variable>
-#include <functional>
-#include <tizen.h>
-
-namespace Ui
-{
- class ProgressPopup;
-
- /**
- * @brief Controller for ProgressPopup
- */
- class EXPORT_API ProgressController
- {
- public:
- /**
- * @brief Finish progress callback.
- */
- typedef std::function<void()> FinishCallback;
-
- /**
- * @brief Cancel progress callback.
- */
- typedef std::function<void()> CancelCallback;
-
- /**
- * @brief Create controller for ProgressPopup.
- * @param[in] parent Parent object
- * @param[in] title Progress popup title
- * @param[in] maxValue max value of progress popup
- */
- ProgressController(Evas_Object *parent, const char *title, int maxValue);
- ProgressController(const ProgressController &that) = delete;
- virtual ~ProgressController();
-
- ProgressController & operator=(const ProgressController &that) = delete;
-
- /**
- * @brief Run progress.
- */
- void run();
-
- /**
- * @brief Cancel the thread in which progress is running.
- */
- void cancel();
-
- /**
- * @brief Set finish function which is called when the progress is over.
- * @param[in] callback Finish function
- */
- void setFinishCallback(FinishCallback callback);
-
- /**
- * @brief Set function which is called on progress cancellation
- * @param[in] callback Cancel function
- */
- void setCancelCallback(CancelCallback callback);
-
- /**
- * @return Total count of progressed items
- */
- virtual size_t getTotalCount() const = 0;
-
- protected:
- /**
- * @brief Called from another thread when progress starts.
- */
- virtual void onStart() = 0;
-
- /**
- * @brief Called from main loop if the running progress is canceled or failed to start.
- */
- virtual void onCanceled() { }
-
- /**
- * @brief Called when user cancels the progress.
- * @return true for further cancellation of progress's thread, false - do nothing.
- */
- virtual bool onCancel();
-
- /**
- * @brief Set progress value.
- * @remark Should be called from onStart().
- * @param[in] value The value that will be set to progress.
- * @return false if progress's thread is pending cancellation, otherwise - true.
- */
- bool onProgress(size_t value);
-
- /**
- * @brief Set max value for progress popup
- * @param[in] value Progress total count value
- */
- void setTotalCount(size_t value);
-
- private:
- void createProgressPopup(Evas_Object *parent, const char *title, int maxValue);
-
- static void onStart(void *data, Ecore_Thread *thread);
- static void onNotify(void *data, Ecore_Thread *thread, void *msgData);
- static void onFinish(void *data, Ecore_Thread *thread);
- static void onCanceled(void *data, Ecore_Thread *thread);
-
- private:
- bool m_IsPopupUpdating;
- FinishCallback m_OnFinish;
- CancelCallback m_OnCancel;
-
- std::condition_variable m_ContinueCondition;
- Ecore_Thread *m_MainThread;
- Ecore_Thread *m_Thread;
-
- ProgressPopup *m_ProgressPopup;
- Evas_Object *m_CancelButton;
- };
-}
-
-#endif /* PROGRESS_CONTROLLER_H */
+++ /dev/null
-/*
- * 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 UI_PROGRESS_POPUP_H
-#define UI_PROGRESS_POPUP_H
-
-#include "Ui/Popup.h"
-
-namespace Ui
-{
- class EXPORT_API ProgressPopup : public Popup
- {
- public:
- /**
- * @brief Create progress popup.
- * @param[in] maxValue Max value of progressbar
- */
- explicit ProgressPopup(size_t maxValue = 0);
-
- /**
- * @brief Set progress of the progressbar
- * @param[in] value Progress value
- */
- void setProgress(size_t value);
-
- /**
- * @brief Set max value of progressbar
- * @param[in] maxValue Max value of progressbar
- */
- void setMaxValue(size_t maxValue);
-
- /**
- * @return Max value of progressbar
- */
- size_t getMaxValue() const;
-
- private:
- virtual Evas_Object *onCreate(Evas_Object *parent) override;
- void updateTotalText();
-
- size_t m_CurrentValue;
- size_t m_MaxValue;
- Evas_Object *m_Progressbar;
- };
-}
-
-#endif /* UI_PROGRESS_POPUP_H */
+++ /dev/null
-/*
- * 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 UI_RADIO_POPUP_H
-#define UI_RADIO_POPUP_H
-
-#include "Ui/ListPopup.h"
-#include <string>
-
-namespace Ui
-{
- /**
- * @brief Radio popup
- */
- class EXPORT_API RadioPopup : public ListPopup
- {
- public:
- RadioPopup();
-
- /**
- * @brief Set selected item
- * @param[in] value Selected item value
- */
- void setSelectedItem(int value);
-
- private:
- virtual Evas_Object *onCreate(Evas_Object *parent) override;
- virtual Evas_Object *getItemContent(void *data, const char *part) override;
- virtual void onItemSelected(void *data) override;
-
- Evas_Object *m_RadioGroup;
- };
-}
-#endif /* UI_RADIO_POPUP_H */
+++ /dev/null
-/*
- * 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 UI_SCROLL_NAVIGATOR_H
-#define UI_SCROLL_NAVIGATOR_H
-
-#include "Ui/TabNavigator.h"
-#include "Ui/ScrollPage.h"
-#include <vector>
-
-namespace Ui
-{
- /**
- * @brief Scrollable page navigator.
- */
- class EXPORT_API ScrollNavigator : public TabNavigator
- {
- public:
- /**
- * @see TabNavigator::TabNavigator()
- */
- explicit ScrollNavigator(Selector *selector = nullptr);
-
- /**
- * @brief Set whether navigation is allowed either by user or by calling navigateTo().
- * @param[in] isEnabled Whether navigation is enabled
- */
- void setNavigationEnabled(bool isEnabled);
-
- protected:
- virtual Evas_Object *onCreate(Evas_Object *parent) override;
- virtual ScrollPage *addPage(View *view) override;
- virtual ScrollPage *createPage(View *view, Elm_Object_Item *item) override;
- virtual void changePage(TabPage *page) override;
-
- private:
- size_t getPageIndex(TabPage *page) const;
- TabPage *getPageByIndex(size_t index) const;
-
- void onPageChanged(Evas_Object *obj, void *eventInfo);
- void onResize(Evas *e, Evas_Object *obj, void *eventInfo);
-
- Evas_Object *m_Scroller;
- Evas_Object *m_Box;
-
- Evas_Coord m_Width;
- Evas_Coord m_Height;
-
- bool m_IsNavigationEnabled;
- };
-}
-
-#endif /* UI_SCROLL_NAVIGATOR_H */
+++ /dev/null
-/*
- * 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 UI_SCROLL_PAGE_H
-#define UI_SCROLL_PAGE_H
-
-#include "Ui/TabPage.h"
-
-namespace Ui
-{
- /**
- * @brief ScrollNavigator page.
- */
- class EXPORT_API ScrollPage : public TabPage
- {
- public:
- /**
- * @brief Create page.
- * @param[in] tabItem Selector control item
- */
- ScrollPage(Elm_Object_Item *tabItem);
-
- /**
- * @see NavigatorPage::setExpanded()
- */
- virtual void setExpanded(bool isExpanded) override;
-
- private:
- friend class ScrollNavigator;
- virtual Evas_Object *onCreate(Evas_Object *parent) override;
-
- Evas_Object *m_Sizer;
- };
-}
-
-#endif /* UI_SCROLL_PAGE_H */
+++ /dev/null
-/*
- * 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 UI_SELECTOR_H
-#define UI_SELECTOR_H
-
-#include "Ui/Control.h"
-#include <functional>
-
-namespace Ui
-{
- /**
- * @brief Interface for controls that provide item selection functionality.
- */
- class EXPORT_API Selector : public Control
- {
- public:
- /**
- * @brief Item selection callback.
- * @param[in] Item data
- * @return Whether to perform the default action if any.
- */
- typedef std::function<bool(void *)> SelectCallback;
-
- /**
- * @brief Add item.
- * @param[in] value Item data which will be passed to SelectedCallback
- * @return Added item on success, otherwise nullptr.
- */
- virtual Elm_Object_Item *addItem(void *data) = 0;
-
- /**
- * @brief Set whether selection is enabled.
- * @param[in] isEnabled Whether selection is enabled
- */
- virtual void setSelectEnabled(bool isEnabled);
-
- /**
- * @brief Set which item is currently selected.
- * @param[in] item Item to be selected
- */
- virtual void setSelectedItem(Elm_Object_Item *item) = 0;
-
- /**
- * @brief Set item selection callback.
- * @param[in] callback Callback to be called after item was selected
- */
- void setSelectCallback(SelectCallback callback);
-
- protected:
- /**
- * @brief Item selection callback.
- * @param[in] item Selected item
- */
- bool onSelected(Elm_Object_Item *item);
-
- SelectCallback m_OnSelected;
- };
-}
-
-#endif /* UI_SELECTOR_H */
+++ /dev/null
-/*
- * 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 UI_TAB_NAVIGATOR_H
-#define UI_TAB_NAVIGATOR_H
-
-#include "Ui/Navigator.h"
-#include "Ui/TabPage.h"
-#include <vector>
-
-namespace Ui
-{
- class Selector;
-
- /**
- * @brief Basic tab navigator with optional selector control.
- */
- class EXPORT_API TabNavigator : public Navigator
- {
- public:
- /**
- * @brief Create TabNavigator.
- * @param[in] selector Selector control to use for navigation
- */
- explicit TabNavigator(Selector *selector = nullptr);
-
- protected:
- /**
- * @brief Navigator's pages.
- */
- typedef std::vector<TabPage *> Pages;
-
- /**
- * @see Control::onCreate()
- */
- virtual Evas_Object *onCreate(Evas_Object *parent) override;
-
- /**
- * @brief Sets page style and inserts selector.
- * @see View::onPageAttached()
- */
- virtual void onPageAttached(NavigatorPage *page) override;
-
- /**
- * @return Selector control used for navigation.
- */
- Selector *getSelector() const;
-
- /**
- * @return Navigator's pages.
- */
- const Pages &getPages() const;
-
- /**
- * @see Navigator::addPage()
- */
- virtual TabPage *addPage(View *view) override;
-
- /**
- * @see Navigator::removePage()
- */
- virtual bool removePage(NavigatorPage *page) override;
-
- /**
- * @see Navigator::navigateToPage()
- */
- virtual void navigateToPage(NavigatorPage *page) override;
-
- /**
- * @brief Create page specific to the navigator.
- * @param[in] view View to create page for
- * @param[in] item Selector item associated with the page
- * @return New navigator page.
- */
- virtual TabPage *createPage(View *view, Elm_Object_Item *item);
-
- /**
- * @brief Switch from current page to another page.
- * @param[in] page Page to show
- */
- virtual void changePage(TabPage *page);
-
- private:
- bool onSelected(void *data);
-
- Evas_Object *m_Layout;
- Selector *m_Selector;
- Pages m_Pages;
- };
-}
-
-#endif /* UI_TAB_NAVIGATOR_H */
+++ /dev/null
-/*
- * 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 UI_TAB_PAGE_H
-#define UI_TAB_PAGE_H
-
-#include "Ui/Control.h"
-#include "Ui/NavigatorPage.h"
-
-namespace Ui
-{
- /**
- * @brief TabNavigator page.
- */
- class EXPORT_API TabPage : public Control, public NavigatorPage
- {
- public:
- /**
- * @brief Create page.
- * @param[in] tabItem Selector control item associated with the page
- */
- TabPage(Elm_Object_Item *tabItem);
- virtual ~TabPage() override;
-
- /**
- * @brief Set tab item title to be different from page title.
- * @param[in] title Tab item title text
- */
- void setTabTitle(const char *title);
-
- /**
- * @brief Set tab item title to be the same as page title.
- */
- void unsetTabTitle();
-
- /**
- * @see NavigatorPage::setTitle()
- */
- virtual void setTitle(const char *title) override;
-
- /**
- * @see NavigatorPage::setSubtitle()
- */
- virtual void setSubtitle(const char *subtitle) override;
-
- /**
- * @see NavigatorPage::setTitleVisibility()
- */
- virtual void setTitleVisibility(bool isVisible) override;
-
- /**
- * @see NavigatorPage::setStyle()
- */
- virtual void setStyle(const char *style) override;
-
- /**
- * @see NavigatorPage::setContent()
- */
- virtual void setContent(const char *part, Evas_Object *content) override;
-
- protected:
- /**
- * @return Selector control item associated with the page.
- */
- Elm_Object_Item *getTabItem() const;
-
- /**
- * @brief Creates page layout.
- * @see Control::onCreate()
- */
- virtual Evas_Object *onCreate(Evas_Object *parent) override;
-
- private:
- friend class TabNavigator;
- void onTabItemDestroy(Evas_Object *obj, void *eventInfo);
-
- Elm_Object_Item *m_TabItem;
- Evas_Object *m_Page;
- bool m_HasTabTitle;
- };
-}
-
-#endif /* UI_TAB_PAGE_H */
+++ /dev/null
-/*
- * 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 UI_TABBAR_H
-#define UI_TABBAR_H
-
-#include "Ui/Selector.h"
-
-namespace Ui
-{
- /**
- * @brief Selector control for switching between tabs.
- */
- class EXPORT_API Tabbar : public Selector
- {
- public:
- /**
- * @see Selector::addItem()
- */
- virtual Elm_Object_Item *addItem(void *data) override;
-
- /**
- * @see Selector::setSelectEnabled()
- */
- virtual void setSelectEnabled(bool isEnabled) override;
-
- /**
- * @see Selector::setSelectedItem()
- */
- virtual void setSelectedItem(Elm_Object_Item *item) override;
-
- protected:
- /**
- * @see Control::onCreate()
- */
- virtual Evas_Object *onCreate(Evas_Object *parent) override;
-
- private:
- void onSelected(Evas_Object *tabbar, Elm_Object_Item *item);
- };
-}
-
-#endif /* UI_TABBAR_H */
+++ /dev/null
-/*
- * 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 UI_THUMBNAIL_H
-#define UI_THUMBNAIL_H
-
-#include "Ui/Control.h"
-
-namespace Ui
-{
- class EXPORT_API Thumbnail : public Control
- {
- public:
- enum Size
- {
- SizeSmall,
- SizeMedium,
- SizeLarge
- };
-
- /**
- * @brief Create thumbnail
- * @param[in] size Thumbnail size
- */
- Thumbnail(Size size);
-
- /**
- * @brief Allows method overload instead of shadowing
- */
- using Control::create;
-
- /**
- * @brief Create thumbnail
- * @param[in] parent Thumbnail parent
- * @param[in] size Thumbnail size
- * @param[in] path Thumbnail Image path or nullptr for default image
- * @return Created thumbnail
- */
- static Thumbnail *create(Evas_Object *parent, Size size, const char *path = nullptr);
-
- /**
- * @return Thumbnail image object.
- */
- Evas_Object *getImage() const;
-
- /**
- * @brief Set thumbnail image path
- * @param[in] path Image path or nullptr for default image
- */
- void setImagePath(const char *path);
-
- /**
- * @brief Set whether minimal size hint is set for image
- * @param[in] isSet Whether to set image size hint
- */
- void setSizeHint(bool isSet);
-
- protected:
- virtual Evas_Object *onCreate(Evas_Object *parent) override;
-
- private:
- Size m_Size;
- Evas_Object *m_Image;
- };
-}
-
-#endif /* UI_THUMBNAIL_H */
+++ /dev/null
-/*
- * 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 UTILS_CALLBACK_PAIR_H
-#define UTILS_CALLBACK_PAIR_H
-
-#include <functional>
-
-namespace Utils
-{
- /**
- * @brief Represents two callbacks to be called subsequently.
- * @details Next callback is called each time when operator() is used.
- */
- class CallbackPair
- {
- public:
- typedef std::function<void()> Callback;
-
- /**
- * @brief Create callback pair.
- * @param[in] first First callback
- * @param[in] second Second callback
- */
- CallbackPair(Callback first, Callback second)
- : m_Callbacks{ std::move(first), std::move(second) }, m_IsFirst(true)
- {
- }
-
- /**
- * @brief Call next callback.
- */
- void operator()()
- {
- if (m_IsFirst) {
- m_Callbacks.first();
- } else {
- m_Callbacks.second();
- }
- m_IsFirst = !m_IsFirst;
- }
-
- private:
- std::pair<Callback, Callback> m_Callbacks;
- bool m_IsFirst;
- };
-
- /**
- * @brief Provides possibility to pass a result from first callback to the second.
- * @see CallbackPair.
- */
- template <typename ResultType>
- class CallbackPairWithResult
- {
- public:
- /**
- * @brief First callback.
- * @return Result to pass to the second callback.
- */
- typedef std::function<ResultType()> FirstCallback;
-
- /**
- * @brief Second callback.
- * @param[in] Result received from the first callback.
- */
- typedef std::function<void(ResultType)> SecondCallback;
-
- /**
- * @brief Create callback pair.
- * @param[in] first First callback
- * @param[in] second Second callback
- */
- CallbackPairWithResult(FirstCallback first, SecondCallback second)
- : m_Callbacks{ std::move(first), std::move(second) }, m_IsFirst(true)
- {
- }
-
- /**
- * @brief Call next callback.
- */
- void operator()()
- {
- if (m_IsFirst) {
- m_Result = m_Callbacks.first();
- } else {
- m_Callbacks.second(std::move(m_Result));
- }
- m_IsFirst = !m_IsFirst;
- }
-
- private:
- std::pair<FirstCallback, SecondCallback> m_Callbacks;
- ResultType m_Result;
- bool m_IsFirst;
- };
-}
-
-#endif /* UTILS_CALLBACK_PAIR_H */
+++ /dev/null
-/*
- * 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 UTILS_ITERATOR_H
-#define UTILS_ITERATOR_H
-
-#include <iterator>
-#include <stddef.h>
-
-namespace Utils
-{
- /**
- * @brief Base class for index-based iterators.
- * @details CRTP (Curiously Recurring Template Pattern) is used to generate
- * operators that return or use derived type.
- */
- template <typename DerivedIterator,
- typename ValueType,
- typename Pointer = ValueType *,
- typename Reference = ValueType &,
- typename Distance = ptrdiff_t>
- class IndexIterator :
- public std::iterator<std::bidirectional_iterator_tag, ValueType, Distance, Pointer, Reference>
- {
- public:
- /**
- * @brief Create iterator from index.
- * @param[in] index Current position of iterator
- */
- IndexIterator(size_t index = 0)
- : m_Index(index) { }
-
- /**
- * @brief Dereference iterator.
- */
- Pointer operator->() const { return &*getDerived(); }
-
- /**
- * @brief Increment iterator.
- */
- DerivedIterator &operator++() { ++m_Index; return getDerived(); }
- DerivedIterator operator++(int) { auto it(getDerived()); ++*this; return it; }
-
- /**
- * @brief Decrement iterator.
- */
- DerivedIterator &operator--() { --m_Index; return getDerived(); }
- DerivedIterator operator--(int) { auto it(getDerived()); --*this; return it; }
-
- /**
- * @brief Compare iterators.
- */
- bool operator==(const IndexIterator &that) { return m_Index == that.m_Index; }
- bool operator!=(const IndexIterator &that) { return m_Index != that.m_Index; }
-
- protected:
- /**
- * @return Current index.
- */
- size_t getIndex() const { return m_Index; }
-
- private:
- DerivedIterator &getDerived() { return static_cast<DerivedIterator &>(*this); }
- const DerivedIterator &getDerived() const { return static_cast<const DerivedIterator &>(*this); }
-
- size_t m_Index;
- };
-}
-
-#endif /* UTILS_ITERATOR_H */
+++ /dev/null
-/*
- * 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 UTILS_THREAD_H
-#define UTILS_THREAD_H
-
-#include <Ecore.h>
-#include <tizen.h>
-#include "Utils/CallbackPair.h"
-
-namespace Utils
-{
- class EXPORT_API Thread
- {
- public:
- typedef std::function<void()> Callback;
-
- /**
- * @brief Create and start a thread.
- * @param[in] callbackPair Task and finish callbacks
- * @see Utils::CallbackPair
- */
- explicit Thread(Callback callbackPair);
-
- /**
- * @brief Create and start a thread.
- * @param[in] task Task to be executed in the thread
- * @param[in] finishCallback Callback to be called when thread is finished
- */
- Thread(Callback task, Callback finishCallback);
-
- private:
- void onStart(Ecore_Thread *thread);
- void onFinished(Ecore_Thread *thread);
-
- Callback m_Callback;
- };
-}
-
-#endif /* UTILS_THREAD_H */
+++ /dev/null
-/*
- * 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 UX_DATE_POPUP_H
-#define UX_DATE_POPUP_H
-
-#include "Ui/Popup.h"
-#include <string>
-
-namespace Ux
-{
- /**
- * @brief Popup with date picker.
- */
- class EXPORT_API DatePopup : public Ui::Popup
- {
- public:
- /**
- * @brief Date input result callback.
- * @param[in] Inputed date
- */
- typedef std::function<void(const tm &)> ResultCallback;
-
- /**
- * @brief Translatable strings table for popup elements.
- */
- struct Strings
- {
- const char *popupTitle; /**< Popup title */
- const char *buttonDone; /**< "Done" button text */
- const char *buttonCancel; /**< "Cancel" button text */
- };
-
- /**
- * @brief Create date popup.
- * @param[in] format Data format for elm_datetime_format_set()
- * @param[in] date Initial date value
- */
- DatePopup(const char *format, tm date);
-
- /**
- * @brief Set translatable strings for popup.
- * @remark Should be called before create().
- * @param[in] strings Translatable strings table
- */
- void setStrings(Strings strings);
-
- /**
- * @brief Set date input result callback.
- * @param[in] callback Callback to be called when user confirmed inputed date
- */
- void setResultCallback(ResultCallback callback);
-
- /**
- * @return Contained date picker.
- */
- Evas_Object *getDatePicker() const;
-
- protected:
- /**
- * @brief Creates date picker and popup buttons.
- * @see Control::onCreate()
- */
- virtual void onCreated() override;
-
- private:
- bool onDonePressed();
-
- std::string m_Format;
- tm m_Date;
-
- Evas_Object *m_DatePicker;
- ResultCallback m_OnResult;
- Strings m_Strings;
- };
-}
-
-#endif /* UX_DATE_POPUP_H */
+++ /dev/null
-/*
- * 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 UX_EDITFIELD_POPUP_H
-#define UX_EDITFIELD_POPUP_H
-
-#include "Ui/Popup.h"
-
-namespace Ui
-{
- class Editfield;
-}
-
-namespace Ux
-{
- /**
- * @brief Popup with editfield.
- */
- class EXPORT_API EditfieldPopup : public Ui::Popup
- {
- public:
- /**
- * @brief Called when user confirmation button is pressed.
- * @param[in] Inputed text
- * @return Whether to destroy the popup.
- */
- typedef std::function<bool(const char *)> ResultCallback;
-
- /**
- * @brief Translatable strings table for popup elements.
- */
- struct Strings
- {
- const char *popupTitle; /**< Popup title */
- const char *guideText; /**< Entry guide text */
- const char *buttonDone; /**< "Done" button text */
- const char *buttonCancel; /**< "Cancel" button text */
- const char *limitToastText; /**< Text of toast shown on reach of entry text limit */
- };
-
- EditfieldPopup();
-
- /**
- * @brief Set translatable strings for popup.
- * @remark Should be called before create().
- * @param[in] strings Translatable strings table
- */
- void setStrings(Strings strings);
-
- /**
- * @brief Set result callback.
- * @param[in] callback Result callback
- */
- void setResultCallback(ResultCallback callback);
-
- /**
- * @return Contained editfield.
- */
- Ui::Editfield *getEditfield() const;
-
- protected:
- /**
- * @brief Creates editfield and popup buttons.
- * @see Control::onCreated()
- */
- virtual void onCreated() override;
-
- private:
- bool onDoneButtonPressed();
- void onDoneKeyPressed(Evas_Object *entry, void *eventInfo);
- static void onEntryChanged(Evas_Object *button, Evas_Object *entry, void *eventInfo);
-
- Ui::Editfield *m_Editfield;
- ResultCallback m_OnResult;
- Strings m_Strings;
- };
-}
-
-#endif /* UX_EDITFIELD_POPUP_H */
+++ /dev/null
-/*
- * 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 APPS_COMMON_POPUP_H
-#define APPS_COMMON_POPUP_H
-
-#include "AppsCommonPath.h"
-
-#define APPS_COMMON_POPUP_EDJ APPS_COMMON_EDJ_DIR"apps-common-popup.edj"
-
-#define LAYOUT_PROGRESS "progress"
-#define LAYOUT_PROCESS_SMALL "process_small"
-#define LAYOUT_PROCESS_MEDIUM "process_medium"
-
-#endif /* APPS_COMMON_POPUP_H */
+++ /dev/null
-/*
- * 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 APPS_COMMON_THUMBNAIL_H
-#define APPS_COMMON_THUMBNAIL_H
-
-#include "AppsCommonPath.h"
-
-#define APPS_COMMON_THUMBNAIL_EDJ APPS_COMMON_EDJ_DIR"apps-common-thumbnail.edj"
-
-#define THUMBNAIL_DEFAULT_SMALL APPS_COMMON_IMG_DIR"contacts_caller_id_default_02.png"
-#define THUMBNAIL_DEFAULT_MEDIUM APPS_COMMON_IMG_DIR"contacts_caller_id_default_05.png"
-#define THUMBNAIL_DEFAULT_LARGE APPS_COMMON_IMG_DIR"contacts_caller_id_default_04.png"
-
-#define THUMBNAIL_BG_SMALL APPS_COMMON_IMG_DIR"contacts_caller_id_default_bg_02.png"
-#define THUMBNAIL_BG_MEDIUM APPS_COMMON_IMG_DIR"contacts_caller_id_default_bg_05.png"
-#define THUMBNAIL_BG_LARGE APPS_COMMON_IMG_DIR"contacts_caller_id_default_bg_04.png"
-
-#define THUMBNAIL_MASK_SMALL APPS_COMMON_IMG_DIR"contacts_caller_id_default_masking_02.png"
-#define THUMBNAIL_MASK_MEDIUM APPS_COMMON_IMG_DIR"contacts_caller_id_default_masking_05.png"
-#define THUMBNAIL_MASK_LARGE APPS_COMMON_IMG_DIR"contacts_caller_id_default_masking_04.png"
-
-#define LAYOUT_THUMBNAIL_SMALL "thumbnail_small"
-#define LAYOUT_THUMBNAIL_MEDIUM "thumbnail_medium"
-#define LAYOUT_THUMBNAIL_LARGE "thumbnail_large"
-
-#define LAYOUT_THUMBNAIL_DEFAULT_SMALL "default_thumbnail_small"
-#define LAYOUT_THUMBNAIL_DEFAULT_MEDIUM "default_thumbnail_medium"
-#define LAYOUT_THUMBNAIL_DEFAULT_LARGE "default_thumbnail_large"
-
-#define THUMBNAIL_SMALL_SIZE 98
-#define THUMBNAIL_MEDIUM_SIZE 180
-#define THUMBNAIL_LARGE_SIZE 270
-
-#endif /* APPS_COMMON_THUMBNAIL_H */
+++ /dev/null
-/*
- * 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 "AppsCommonPopup.h"
-
-#define PROGRESS_LR 32
-#define PROGRESS_TB 17
-
-#define PROCESS_SMALL_POPUP_H 78
-#define PROCESS_SMALL_PROGRESS_LR 32
-#define PROCESS_SMALL_PROGRESS_WH 44
-#define PROCESS_SMALL_TEXT_SIZE 40
-
-#define PROCESS_MEDIUM_POPUP_H 120
-#define PROCESS_MEDIUM_PROGRESS_LR 32
-#define PROCESS_MEDIUM_PROGRESS_W 56
-#define PROCESS_MEDIUM_TEXT_SIZE 40
-
-styles {
- style {
- name: "process_small";
- base: "font=Tizen:style=Light font_size="PROCESS_SMALL_TEXT_SIZE" align=right color=#3db9ccff";
- }
- style {
- name: "process_medium";
- base: "font=Tizen:style=Light font_size="PROCESS_MEDIUM_TEXT_SIZE" align=left color=#000000ff";
- }
-}
-
-collections {
- base_scale: 2.6;
-
- group { LAYOUT_PROGRESS;
- parts {
- spacer { "spacer.left_top"; scale;
- desc { "default";
- min: PROGRESS_LR PROGRESS_TB;
- align: 0.0 0.0;
- rel1.relative: 0.0 0.0;
- rel2.relative: 0.0 0.0;
- }
- }
- spacer { "spacer.right_bottom"; scale;
- desc { "default";
- min: PROGRESS_LR PROGRESS_TB;
- align: 1.0 1.0;
- rel1.relative: 1.0 1.0;
- rel2.relative: 1.0 1.0;
- }
- }
- swallow { "elm.swallow.content"; scale;
- desc { "default";
- rel1 { relative: 1.0 1.0; to: "spacer.left_top"; }
- rel2 { relative: 0.0 0.0; to: "spacer.right_bottom"; }
- }
- }
- }
- }
-
- group { LAYOUT_PROCESS_SMALL;
- parts {
- spacer { "spacer.base"; scale;
- desc { "default";
- min: 0 PROCESS_SMALL_POPUP_H;
- }
- }
- spacer { "spacer.progress_right"; scale;
- desc { "default";
- min: PROCESS_SMALL_PROGRESS_LR 0;
- align: 1.0 0.5;
- rel1.relative: 1.0 0.0;
- rel2.relative: 1.0 1.0;
- }
- }
- swallow { "elm.swallow.content"; scale;
- desc { "default";
- min: PROCESS_SMALL_PROGRESS_WH PROCESS_SMALL_PROGRESS_WH;
- align: 1.0 0.5;
- rel1 { relative: 0.0 0.5; to_x: "spacer.progress_right"; }
- rel2 { relative: 0.0 0.5; to_x: "spacer.progress_right"; }
- }
- }
- spacer { "spacer.text_right"; scale;
- desc { "default";
- min: PROCESS_SMALL_PROGRESS_LR 0;
- align: 1.0 0.5;
- rel1 { relative: 0.0 0.0; to_x: "elm.swallow.content"; }
- rel2 { relative: 0.0 1.0; to_x: "elm.swallow.content"; }
- }
- }
- textblock { "elm.text"; scale;
- desc { "default";
- align: 0.0 0.5;
- rel1 { relative: 0.0 0.0; }
- rel2 { relative: 0.0 1.0; to_x: "spacer.text_right"; }
- text.style: "process_small";
- }
- }
- }
- }
-
- group { LAYOUT_PROCESS_MEDIUM;
- parts {
- spacer { "spacer.base"; scale;
- desc { "default";
- min: 0 PROCESS_MEDIUM_POPUP_H;
- }
- }
- spacer { "spacer.progress_left"; scale;
- desc { "default";
- min: PROCESS_MEDIUM_PROGRESS_LR 0;
- align: 0.0 0.5;
- rel1.relative: 0.0 0.0;
- rel2.relative: 0.0 1.0;
- }
- }
- swallow { "elm.swallow.content"; scale;
- desc { "default";
- min: PROCESS_MEDIUM_PROGRESS_W 0;
- align: 0.0 0.5;
- rel1 { relative: 1.0 0.5; to_x: "spacer.progress_left"; }
- rel2 { relative: 1.0 0.5; to_x: "spacer.progress_left"; }
- }
- }
- spacer { "spacer.text_left"; scale;
- desc { "default";
- min: PROCESS_MEDIUM_PROGRESS_LR 0;
- align: 0.0 0.5;
- rel1 { relative: 1.0 0.0; to_x: "elm.swallow.content"; }
- rel2 { relative: 1.0 1.0; to_x: "elm.swallow.content"; }
- }
- }
- textblock { "elm.text"; scale;
- desc { "default";
- align: 0.0 0.5;
- rel1 { relative: 1.0 0.0; to_x: "spacer.text_left"; }
- rel2 { relative: 1.0 1.0; }
- text.style: "process_medium";
- }
- }
- }
- }
-}
+++ /dev/null
-/*
- * 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 "AppsCommonThumbnail.h"
-#include "apps-common-utils.edc"
-
-color_classes {
- color_class { //A03O003
- name: "thumbnail_bg";
- color: 255 255 255 255;
- }
- color_class { //A03O003L1
- name: "thumbnail_default";
- color: 61 185 204 128;
- }
-}
-
-collections {
- IMAGE_WITH_MASK(LAYOUT_THUMBNAIL_SMALL, THUMBNAIL_MASK_SMALL)
- IMAGE_WITH_MASK(LAYOUT_THUMBNAIL_MEDIUM, THUMBNAIL_MASK_MEDIUM)
- IMAGE_WITH_MASK(LAYOUT_THUMBNAIL_LARGE, THUMBNAIL_MASK_LARGE)
-
- IMAGE_WITH_COLOR_AND_BG(LAYOUT_THUMBNAIL_DEFAULT_SMALL, THUMBNAIL_DEFAULT_SMALL, "thumbnail_default", THUMBNAIL_BG_SMALL, "thumbnail_bg")
- IMAGE_WITH_COLOR_AND_BG(LAYOUT_THUMBNAIL_DEFAULT_MEDIUM, THUMBNAIL_DEFAULT_MEDIUM, "thumbnail_default", THUMBNAIL_BG_MEDIUM, "thumbnail_bg")
- IMAGE_WITH_COLOR_AND_BG(LAYOUT_THUMBNAIL_DEFAULT_LARGE, THUMBNAIL_DEFAULT_LARGE, "thumbnail_default", THUMBNAIL_BG_LARGE, "thumbnail_bg")
-}
+++ /dev/null
-/*
- * 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 "App/AppControlRequest.h"
-
-using namespace App;
-
-AppControl App::requestContactCreate(const char *number)
-{
- AppControl request(APP_CONTROL_OPERATION_ADD, APP_CONTROL_MIME_CONTACT);
- request.addExtra(APP_CONTROL_DATA_PHONE, number);
- return request;
-}
-
-AppControl App::requestContactDetails(int personId)
-{
- AppControl request(APP_CONTROL_OPERATION_VIEW, APP_CONTROL_MIME_CONTACT);
- request.addExtra(APP_CONTROL_DATA_ID, std::to_string(personId).c_str());
- return request;
-}
-
-AppControl App::requestContactEdit(int personId, const char *number)
-{
- AppControl request(APP_CONTROL_OPERATION_EDIT, APP_CONTROL_MIME_CONTACT);
- if (personId > 0) {
- request.addExtra(APP_CONTROL_DATA_ID, std::to_string(personId).c_str());
- }
-
- request.addExtra(APP_CONTROL_DATA_PHONE, number);
- return request;
-}
-
-AppControl App::requestContactPick(const char *selectionMode, const char *resultType)
-{
- AppControl request(APP_CONTROL_OPERATION_PICK, APP_CONTROL_MIME_CONTACT);
- request.addExtra(APP_CONTROL_DATA_SELECTION_MODE, selectionMode);
- request.addExtra(APP_CONTROL_DATA_TYPE, resultType);
- return request;
-}
-
-AppControl App::requestTelephonyCall(const char *number)
-{
- return AppControl(APP_CONTROL_OPERATION_CALL, nullptr,
- std::string("tel:").append(number).c_str());
-}
-
-AppControl App::requestCallSettings()
-{
- return AppControl(APP_CONTROL_OPERATION_SETTING_CALL, nullptr);
-}
-
-AppControl App::requestComposer(const char *scheme, const char *to,
- const char *subject, const char *text)
-{
- std::string uri = scheme;
- if (to) {
- uri.append(to);
- }
- AppControl request(APP_CONTROL_OPERATION_COMPOSE, nullptr, uri.c_str());
- request.addExtra(APP_CONTROL_DATA_TITLE, subject);
- request.addExtra(APP_CONTROL_DATA_TEXT, text);
- return request;
-}
-
-AppControl App::requestComposer(const char *scheme, Utils::Range<const char **> recipients,
- const char *subject, const char *text)
-{
- AppControl request = requestComposer(scheme, nullptr, subject, text);
- request.addExtra(APP_CONTROL_DATA_TO, recipients.begin(), recipients.count());
- return request;
-}
-
-AppControl App::requestCameraImage()
-{
- return AppControl(APP_CONTROL_OPERATION_CREATE_CONTENT, APP_CONTROL_MIME_IMAGE);
-}
-
-AppControl App::requestGalleryImage()
-{
- AppControl request(APP_CONTROL_OPERATION_PICK, APP_CONTROL_MIME_IMAGE);
- app_control_set_app_id(request.getHandle(), "org.tizen.ug-gallery-efl");
- return request;
-}
-
-AppControl App::requestViewImage(const char *path)
-{
- return AppControl(APP_CONTROL_OPERATION_VIEW, APP_CONTROL_MIME_IMAGE,
- std::string(APP_CONTROL_URI_SCHEME_FILE).append(path).c_str());
-}
-
-AppControl App::requestShareContact(int personId)
-{
- AppControl request(APP_CONTROL_OPERATION_SHARE, APP_CONTROL_MIME_CONTACT);
- request.addExtra(APP_CONTROL_DATA_ID, std::to_string(personId).c_str());
- return request;
-}
-
-AppControl App::requestShareText(const char *text)
-{
- AppControl request(APP_CONTROL_OPERATION_SHARE_TEXT, nullptr);
- request.addExtra(APP_CONTROL_DATA_TEXT, text);
- return request;
-}
-
-AppControl App::requestShareMemo(const char *text, const char **paths, int count)
-{
- AppControl request(APP_CONTROL_OPERATION_SHARE_TEXT, nullptr);
- request.addExtra(APP_CONTROL_DATA_TEXT, text);
- if (count > 0) {
- request.addExtra(APP_CONTROL_DATA_PATH, paths, count);
- }
-
- return request;
-}
-
-AppControl App::requestShareMyProfile(int recordId)
-{
- AppControl request = requestShareContact(recordId);
- request.addExtra(APP_CONTROL_DATA_TYPE, "my_profile");
- return request;
-}
-
-AppControl App::requestMultiShareContacts(const char **personIds, int count)
-{
- AppControl request(APP_CONTROL_OPERATION_MULTI_SHARE, APP_CONTROL_MIME_CONTACT);
- request.addExtra(APP_CONTROL_DATA_ID, personIds, count);
- return request;
-}
-
-AppControl App::requestPickVcard(const char *path)
-{
- AppControl request(APP_CONTROL_OPERATION_PICK, APP_CONTROL_MIME_VCARD,
- std::string(APP_CONTROL_URI_SCHEME_FILE).append(path).c_str());
- request.addExtra(APP_CONTROL_DATA_SELECTION_MODE, APP_CONTROL_SELECT_MULTIPLE);
- return request;
-}
-
-AppControl App::requestPickRingtone(const char *selectedPath)
-{
- AppControl request("org.tizen.setting-ringtone");
- if (selectedPath) {
- request.addExtra(APP_CONTROL_DATA_SELECTED, &selectedPath, 1);
- }
- return request;
-}
-
-AppControl App::requestViewStorageSettings()
-{
- AppControl request("org.tizen.setting-storage");
- return request;
-}
+++ /dev/null
-/*
- * 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 "I18n/Collator.h"
-#include <system_settings.h>
-
-using namespace I18n;
-
-Collator::Collator(i18n_ucollator_strength_e strength)
- : m_Strength(strength), m_Handle(nullptr)
-{
-}
-
-Collator::Collator(Collator &&that)
- : m_Strength(that.m_Strength), m_Handle(that.m_Handle)
-{
- that.m_Handle = nullptr;
-}
-
-Collator::~Collator()
-{
- i18n_ucollator_destroy(m_Handle);
-}
-
-Collator &Collator::operator=(Collator &&that)
-{
- i18n_ucollator_destroy(m_Handle);
- m_Strength = that.m_Strength;
- m_Handle = that.m_Handle;
- that.m_Handle = nullptr;
- return *this;
-}
-
-void Collator::initialize()
-{
- if (m_Handle) {
- i18n_ucollator_destroy(m_Handle);
- m_Handle = nullptr;
- }
-
- char *lang = nullptr;
- system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang);
- i18n_ucollator_create(lang, &m_Handle);
- i18n_ucollator_set_strength(m_Handle, m_Strength);
- free(lang);
-}
-
-int Collator::compare(const UniString& str1, const UniString &str2)
-{
- int result = 0;
- i18n_ucollator_str_collator(m_Handle,
- str1.getI18nStr().c_str(), -1,
- str2.getI18nStr().c_str(), -1,
- (i18n_ucollator_result_e *) &result);
- return result;
-}
+++ /dev/null
-/*
- * 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 "I18n/UniString.h"
-
-using namespace I18n;
-
-UniString::UniString(const char *utf8Str)
-{
- if (utf8Str) {
- m_Utf8Str = utf8Str;
- }
- m_UniStr = fromUtf8(m_Utf8Str);
-}
-
-bool UniString::operator<(const UniString &that) const
-{
- return i18n_ustring_compare_code_point_order(m_UniStr.c_str(), that.m_UniStr.c_str()) < 0;
-}
-
-bool UniString::operator>(const UniString &that) const
-{
- return i18n_ustring_compare_code_point_order(m_UniStr.c_str(), that.m_UniStr.c_str()) > 0;
-}
-
-bool UniString::operator==(const UniString &that) const
-{
- return i18n_ustring_compare_code_point_order(m_UniStr.c_str(), that.m_UniStr.c_str()) == 0;
-}
-
-bool UniString::operator!=(const UniString &that) const
-{
- return i18n_ustring_compare_code_point_order(m_UniStr.c_str(), that.m_UniStr.c_str()) != 0;
-}
-
-bool UniString::operator<=(const UniString &that) const
-{
- return i18n_ustring_compare_code_point_order(m_UniStr.c_str(), that.m_UniStr.c_str()) <= 0;
-}
-
-bool UniString::operator>=(const UniString &that) const
-{
- return i18n_ustring_compare_code_point_order(m_UniStr.c_str(), that.m_UniStr.c_str()) >= 0;
-}
-
-const UniString::I18nString &UniString::getI18nStr() const
-{
- return m_UniStr;
-}
-
-const std::string &UniString::getUtf8Str() const
-{
- if (m_Utf8Str.empty() && !m_UniStr.empty()) {
- m_Utf8Str = toUtf8(m_UniStr);
- }
-
- return m_Utf8Str;
-}
-
-void UniString::clear()
-{
- m_Utf8Str.clear();
- m_UniStr.clear();
-}
-
-std::string UniString::toUtf8(const I18nString &ustring)
-{
- char fakeValue;
- int length = 0;
- i18n_error_code_e err = I18N_ERROR_NONE;
- i18n_ustring_to_UTF8(&fakeValue, 1, &length, ustring.c_str(), -1, &err);
-
- std::string retVal(length + 1, 0);
- i18n_ustring_to_UTF8(&retVal[0], length + 1, &length, ustring.c_str(), -1, &err);
-
- return retVal;
-}
-
-UniString::I18nString UniString::fromUtf8(const std::string &utf8Str)
-{
- i18n_uchar fakeValue;
- int length = 0;
- i18n_error_code_e err = I18N_ERROR_NONE;
- i18n_ustring_from_UTF8(&fakeValue, 1, &length, utf8Str.c_str(), -1, &err);
-
- I18nString retVal(length + 1, 0);
- i18n_ustring_from_UTF8(&retVal[0], length + 1, &length, utf8Str.c_str(), -1, &err);
-
- return retVal;
-}
+++ /dev/null
-/*
- * 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 "System/Settings.h"
-#include "Utils/Callback.h"
-
-#include <algorithm>
-#include <list>
-
-using namespace System::Settings;
-
-namespace
-{
- class KeyManager : public CallbackManager
- {
- public:
- explicit KeyManager(system_settings_key_e key)
- : m_Key(key)
- {
- system_settings_set_changed_cb(m_Key,
- makeCallbackWithLastParam(&KeyManager::operator()), this);
- }
-
- ~KeyManager()
- {
- system_settings_unset_changed_cb(m_Key);
- }
-
- bool operator==(system_settings_key_e key) const
- {
- return m_Key == key;
- }
-
- private:
- system_settings_key_e m_Key;
- };
-
- std::list<KeyManager> keyManagers;
-}
-
-void System::Settings::addCallback(system_settings_key_e key, KeyManager::Callback callback)
-{
- auto manager = std::find(keyManagers.begin(), keyManagers.end(), key);
- if (manager == keyManagers.end()) {
- keyManagers.emplace_back(key);
- manager = --keyManagers.end();
- }
-
- (*manager) += (callback);
-}
-
-void System::Settings::removeCallback(system_settings_key_e key, void *subscriber)
-{
- auto manager = std::find(keyManagers.begin(), keyManagers.end(), key);
- if (manager == keyManagers.end()) {
- return;
- }
-
- (*manager) -= subscriber;
- if (!*manager) {
- keyManagers.erase(manager);
- }
-}
+++ /dev/null
-/*
- * 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 "Ui/Button.h"
-#include "Utils/Callback.h"
-
-#include <Ecore.h>
-
-using namespace Ui;
-
-Button::Button()
- : m_Timer(nullptr), m_IsLongpressed(false)
-{
-}
-
-Button::~Button()
-{
- resetTimer();
-}
-
-void Button::setPressedCallback(std::function<void(Button&)> callback)
-{
- m_OnPressed = std::move(callback);
-}
-
-void Button::setLongpressedCallback(std::function<bool(Button&)> callback)
-{
- m_OnLongpressed = std::move(callback);
-}
-
-Evas_Object *Button::onCreate(Evas_Object *parent)
-{
- Evas_Object *button = elm_button_add(parent);
- return button;
-}
-
-void Button::onCreated()
-{
- evas_object_event_callback_add(getEvasObject(), EVAS_CALLBACK_MOUSE_DOWN,
- makeCallback(&Button::onMouseDown), this);
- evas_object_event_callback_add(getEvasObject(), EVAS_CALLBACK_MOUSE_UP,
- makeCallback(&Button::onMouseUp), this);
- evas_object_event_callback_add(getEvasObject(), EVAS_CALLBACK_MOUSE_OUT,
- makeCallback(&Button::onMouseOut), this);
-}
-
-void Button::onMouseDown(Evas *evas, Evas_Object *obj, void *eventInfo)
-{
- m_IsLongpressed = false;
- m_Timer = ecore_timer_add(elm_config_longpress_timeout_get(),
- makeCallback(&Button::onTimeout), this);
-}
-
-void Button::onMouseUp(Evas *evas, Evas_Object *obj, void *eventInfo)
-{
- Evas_Event_Mouse_Up *e = (Evas_Event_Mouse_Up *) eventInfo;
-
- if (!m_IsLongpressed) {
- int x = 0, y = 0, w = 0, h = 0;
- evas_object_geometry_get(obj, &x, &y, &w, &h);
-
- if (m_OnPressed) {
- if (e->output.x >= x && e->output.x <= x + w
- && e->output.y >= y && e->output.x <= y + h) {
- m_OnPressed(*this);
- }
- }
-
- resetTimer();
- }
-}
-
-void Button::onMouseOut(Evas *evas, Evas_Object *obj, void *eventInfo)
-{
- resetTimer();
-}
-
-void Button::resetTimer()
-{
- ecore_timer_del(m_Timer);
- m_Timer = nullptr;
-}
-
-Eina_Bool Button::onTimeout()
-{
- if (m_OnLongpressed) {
- m_IsLongpressed = m_OnLongpressed(*this);
- }
-
- resetTimer();
- return ECORE_CALLBACK_CANCEL;
-}
+++ /dev/null
-/*
- * 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 "Ui/Hoversel.h"
-#include "Ui/View.h"
-#include "Ui/Window.h"
-#include "Utils/Callback.h"
-
-#include <efl_extension.h>
-
-using namespace Ui;
-
-Hoversel::Hoversel()
- : m_View(nullptr)
-{
-}
-
-Hoversel::~Hoversel()
-{
- if (m_View) {
- evas_object_smart_callback_del_full(m_View->getEvasObject(), EVENT_VIEW_NAVIGATION,
- makeCallback(&Hoversel::onViewNavigation), this);
- }
-}
-
-Elm_Object_Item *Hoversel::addItem(const char *text, void *data)
-{
- Elm_Object_Item *item = elm_hoversel_item_add(getEvasObject(), text,
- nullptr, ELM_ICON_NONE, nullptr, data);
- elm_object_item_text_translatable_set(item, EINA_TRUE);
- return item;
-}
-
-Elm_Object_Item *Hoversel::addItem(void *data)
-{
- return addItem(nullptr, data);
-}
-
-void Hoversel::setText(const char *text)
-{
- elm_object_translatable_text_set(getEvasObject(), text);
-}
-
-void Hoversel::setSelectedItem(Elm_Object_Item *item)
-{
- setText(elm_object_item_translatable_text_get(item));
-}
-
-Evas_Object *Hoversel::onCreate(Evas_Object *parent)
-{
- Evas_Object *hoversel = elm_hoversel_add(parent);
- evas_object_smart_callback_add(hoversel, "selected",
- (Evas_Smart_Cb) makeCallback(&Hoversel::onSelected), this);
- evas_object_smart_callback_add(hoversel, "expanded",
- &Hoversel::onExpanded, this);
- evas_object_smart_callback_add(hoversel, "dismissed",
- &Hoversel::onDismissed, this);
-
- m_View = findParent<View>(parent);
- if (m_View) {
- evas_object_smart_callback_add(m_View->getEvasObject(), EVENT_VIEW_NAVIGATION,
- makeCallback(&Hoversel::onViewNavigation), this);
- }
-
- auto window = findParent<Window>(parent);
- if (window) {
- elm_hoversel_hover_parent_set(hoversel, window->getEvasObject());
- }
-
- return hoversel;
-}
-
-void Hoversel::onViewNavigation(Evas_Object *obj, void *eventInfo)
-{
- if (!eventInfo) {
- elm_hoversel_hover_end(getEvasObject());
- }
-}
-
-void Hoversel::onSelected(Evas_Object *hoversel, Elm_Object_Item *item)
-{
- if (Selector::onSelected(item)) {
- setSelectedItem(item);
- }
-}
-
-void Hoversel::onExpanded(void *data, Evas_Object *hoversel, void *eventInfo)
-{
- eext_object_event_callback_add(hoversel, EEXT_CALLBACK_BACK,
- &Hoversel::onBackPressed, nullptr);
-}
-
-void Hoversel::onDismissed(void *data, Evas_Object *hoversel, void *eventInfo)
-{
- eext_object_event_callback_del(hoversel, EEXT_CALLBACK_BACK,
- &Hoversel::onBackPressed);
-}
-
-void Hoversel::onBackPressed(void *data, Evas_Object *hoversel, void *eventInfo)
-{
- elm_hoversel_hover_end(hoversel);
-}
+++ /dev/null
-/*
- * 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 "Ui/ListPopup.h"
-#include "Utils/Callback.h"
-#include <app_i18n.h>
-
-#define POPUP_HEIGHT_RATIO 0.75
-
-using namespace Ui;
-
-struct ListPopup::ItemData
-{
- std::string text;
- void *userData;
- ItemSelectCallback callback;
-};
-
-ListPopup::ListPopup(const char *itemStyle)
- : m_GenlistSize{0}, m_MaxHeight(0), m_IsResizing(false),
- m_Window(nullptr), m_Genlist(nullptr)
-{
- m_ItemClass = elm_genlist_item_class_new();
- m_ItemClass->item_style = itemStyle;
- m_ItemClass->func.text_get = (Elm_Gen_Item_Text_Get_Cb) &ListPopup::getText;
- m_ItemClass->func.content_get = (Elm_Gen_Item_Content_Get_Cb) &ListPopup::getContent;
- m_ItemClass->func.del = [](void *data, Evas_Object *obj) {
- delete (ItemData *) data;
- };
-}
-
-ListPopup::~ListPopup()
-{
- evas_object_event_callback_del_full(m_Window, EVAS_CALLBACK_RESIZE,
- makeCallback(&ListPopup::onWindowResized), this);
- elm_genlist_item_class_free(m_ItemClass);
-}
-
-Elm_Object_Item *ListPopup::addItem(std::string text, void *data, ItemSelectCallback callback)
-{
- ItemData *itemData = new ItemData{ std::move(text), data, std::move(callback) };
- return elm_genlist_item_append(m_Genlist, m_ItemClass, itemData,
- nullptr, ELM_GENLIST_ITEM_NONE, nullptr, nullptr);
-}
-
-Elm_Object_Item *ListPopup::addItem(std::string text, ItemSelectCallback callback)
-{
- return addItem(std::move(text), nullptr, std::move(callback));
-}
-
-Elm_Object_Item *ListPopup::addItem(void *data, ItemSelectCallback callback)
-{
- return addItem("", data, std::move(callback));
-}
-
-void ListPopup::setSelectCallback(SelectCallback callback)
-{
- m_OnSelected = std::move(callback);
-}
-
-Evas_Object *ListPopup::onCreate(Evas_Object *parent)
-{
- Evas_Object *popup = Popup::onCreate(parent);
- elm_object_style_set(popup, "theme_bg");
- elm_object_part_content_set(popup, "elm.swallow.content", createGenlist(popup));
-
- m_Window = elm_object_top_widget_get(popup);
- evas_object_event_callback_add(m_Window, EVAS_CALLBACK_RESIZE,
- makeCallback(&ListPopup::onWindowResized), this);
- updateMaxHeight();
-
- return popup;
-}
-
-Evas_Object *ListPopup::createGenlist(Evas_Object *parent)
-{
- m_Genlist = elm_genlist_add(parent);
- elm_genlist_homogeneous_set(m_Genlist, EINA_TRUE);
- elm_genlist_mode_set(m_Genlist, ELM_LIST_EXPAND);
- evas_object_event_callback_add(m_Genlist, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- makeCallback(&ListPopup::onGenlistResized), this);
-
- evas_object_smart_data_set(m_Genlist, this);
- evas_object_smart_callback_add(m_Genlist, "selected",
- (Evas_Smart_Cb) &ListPopup::onSelected, this);
- return m_Genlist;
-}
-
-char *ListPopup::getText(ItemData *itemData, Evas_Object *genlist, const char *part)
-{
- ListPopup *popup = (ListPopup *) evas_object_smart_data_get(genlist);
- char *text = popup->getItemText(itemData->userData, part);
- if (!text && strcmp(part, "elm.text") == 0) {
- text = strdup(_(itemData->text.c_str()));
- }
-
- return text;
-}
-
-Evas_Object *ListPopup::getContent(ItemData *itemData, Evas_Object *genlist, const char *part)
-{
- ListPopup *popup = (ListPopup *) evas_object_smart_data_get(genlist);
- return popup->getItemContent(itemData->userData, part);
-}
-
-void ListPopup::onSelected(ListPopup *popup, Evas_Object *genlist, Elm_Object_Item *item)
-{
- ItemData *itemData = (ItemData *) elm_object_item_data_get(item);
- popup->onItemSelected(itemData->userData);
-
- if (itemData->callback) {
- itemData->callback();
- }
-
- if (popup->m_OnSelected) {
- popup->m_OnSelected(itemData->userData);
- }
-
- elm_genlist_item_selected_set(item, EINA_FALSE);
- popup->close();
-}
-
-void ListPopup::updateGenlistHeight()
-{
- if (m_GenlistSize.h > m_MaxHeight) {
- int itemHeight = 0;
- int count = elm_genlist_items_count(m_Genlist);
- if (count > 0) {
- itemHeight = m_GenlistSize.h / count;
- }
-
- if (itemHeight) {
- m_IsResizing = true;
- int genlistHeight = m_MaxHeight - m_MaxHeight % itemHeight;
- evas_object_size_hint_min_set(m_Genlist, m_GenlistSize.w, genlistHeight);
- m_IsResizing = false;
- }
- }
-}
-
-void ListPopup::updateMaxHeight()
-{
- evas_object_geometry_get(m_Window, nullptr, nullptr, nullptr, &m_MaxHeight);
- m_MaxHeight *= POPUP_HEIGHT_RATIO;
-}
-
-void ListPopup::onGenlistResized(Evas *e, Evas_Object *genlist, void *eventInfo)
-{
- if (!m_IsResizing) {
- evas_object_size_hint_min_get(m_Genlist, &m_GenlistSize.w, &m_GenlistSize.h);
- updateGenlistHeight();
- }
-}
-
-void ListPopup::onWindowResized(Evas *e, Evas_Object *window, void *eventInfo)
-{
- updateMaxHeight();
- updateGenlistHeight();
-}
+++ /dev/null
-/*
- * 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 "Ui/ProcessPopup.h"
-#include "Ui/Window.h"
-
-#include "App/Path.h"
-#include "Utils/Callback.h"
-#include "AppsCommonPopup.h"
-
-using namespace Ui;
-
-ProcessPopup::ProcessPopup(Size size, double showDelayTime, double showMinTime)
- : m_Size(size), m_Layout(nullptr),
- m_ShowDelayTimer(nullptr), m_ShowMinTimer(nullptr),
- m_IsDestroyPending(false)
-{
- m_ShowDelayTimer = ecore_timer_add(showDelayTime,
- makeCallback(&ProcessPopup::onShowDelayElapsed), this);
- ecore_timer_freeze(m_ShowDelayTimer);
- m_ShowMinTimer = ecore_timer_add(showMinTime,
- makeCallback(&ProcessPopup::onShowMinElapsed), this);
- ecore_timer_freeze(m_ShowMinTimer);
-
- setCancelCallback([this] {
- return false;
- });
-}
-
-ProcessPopup::~ProcessPopup()
-{
- ecore_timer_del(m_ShowDelayTimer);
- ecore_timer_del(m_ShowMinTimer);
-}
-
-ProcessPopup *ProcessPopup::create(Evas_Object *parent, const char *text, Size size)
-{
- ProcessPopup *popup = new ProcessPopup(size);
- popup->create(parent);
- popup->setText(text);
- return popup;
-}
-
-void ProcessPopup::setText(const char *text)
-{
- elm_object_translatable_part_text_set(m_Layout, "elm.text", text);
-}
-
-void ProcessPopup::close()
-{
- if (m_ShowDelayTimer) {
- delete this;
- } else if (m_ShowMinTimer) {
- m_IsDestroyPending = true;
- } else {
- Popup::close();
- }
-}
-
-Evas_Object *ProcessPopup::onCreate(Evas_Object *parent)
-{
- static struct {
- const char *layout;
- const char *progress;
- } styles[] = {
- /* SizeSmall = */ { LAYOUT_PROCESS_SMALL, "process_small" },
- /* SizeMedium = */ { LAYOUT_PROCESS_MEDIUM, "process_medium" }
- };
-
- Evas_Object *popup = Popup::onCreate(parent);
- auto &style = styles[m_Size];
-
- m_Layout = elm_layout_add(popup);
- elm_layout_file_set(m_Layout, App::getResourcePath(APPS_COMMON_POPUP_EDJ).c_str(), style.layout);
- elm_object_content_set(popup, m_Layout);
-
- Evas_Object *progressbar = elm_progressbar_add(m_Layout);
- elm_object_style_set(progressbar, style.progress);
- elm_progressbar_pulse_set(progressbar, EINA_TRUE);
- elm_progressbar_pulse(progressbar, EINA_TRUE);
- elm_object_content_set(m_Layout, progressbar);
-
- ecore_timer_thaw(m_ShowDelayTimer);
- return popup;
-}
-
-Eina_Bool ProcessPopup::onShowDelayElapsed()
-{
- evas_object_show(getEvasObject());
- ecore_timer_thaw(m_ShowMinTimer);
-
- m_ShowDelayTimer = nullptr;
- return EINA_FALSE;
-}
-
-Eina_Bool ProcessPopup::onShowMinElapsed()
-{
- m_ShowMinTimer = nullptr;
- if (m_IsDestroyPending) {
- Popup::close();
- }
- return EINA_FALSE;
-}
+++ /dev/null
-/*
- * 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 "Ui/ProgressController.h"
-#include "Ui/ProgressPopup.h"
-#include "Utils/Logger.h"
-
-#define PROGRESS_VALUE_LIMIT 10
-
-using namespace Ui;
-
-ProgressController::ProgressController(Evas_Object *parent, const char *title, int maxValue)
- : m_IsPopupUpdating(false),
- m_MainThread(nullptr), m_Thread(nullptr),
- m_ProgressPopup(nullptr), m_CancelButton(nullptr)
-{
- createProgressPopup(parent, title, maxValue);
-}
-
-ProgressController::~ProgressController()
-{
- m_ProgressPopup->close();
-}
-
-void ProgressController::run()
-{
- m_MainThread = ecore_thread_feedback_run(onStart, onNotify, onFinish, onCanceled, this, EINA_FALSE);
-
- if (m_ProgressPopup->getMaxValue() > PROGRESS_VALUE_LIMIT) {
- m_ProgressPopup->show();
- }
-}
-
-void ProgressController::setFinishCallback(FinishCallback callback)
-{
- m_OnFinish = std::move(callback);
-}
-
-void ProgressController::setCancelCallback(CancelCallback callback)
-{
- m_OnCancel = std::move(callback);
-}
-
-bool ProgressController::onCancel()
-{
- return true;
-}
-
-void ProgressController::cancel()
-{
- ecore_thread_cancel(m_MainThread);
- elm_object_disabled_set(m_CancelButton, EINA_TRUE);
-}
-
-bool ProgressController::onProgress(size_t value)
-{
- ecore_thread_feedback(m_Thread, (void *)value);
- m_IsPopupUpdating = true;
-
- std::mutex condVariableMutex;
- std::unique_lock<std::mutex> locker(condVariableMutex);
- m_ContinueCondition.wait(locker, [this]{
- return !m_IsPopupUpdating;
- });
-
- return !ecore_thread_check(m_Thread);
-}
-
-void ProgressController::setTotalCount(size_t value)
-{
- m_ProgressPopup->setMaxValue(value);
-}
-
-void ProgressController::createProgressPopup(Evas_Object *parent, const char *title, int maxValue)
-{
- m_ProgressPopup = new Ui::ProgressPopup(maxValue);
- RETM_IF(!m_ProgressPopup, "m_ProgressPopup is NULL");
-
- m_ProgressPopup->create(parent);
- m_ProgressPopup->setTitle(title);
-
- m_CancelButton = m_ProgressPopup->addButton("IDS_PB_BUTTON_CANCEL");
- m_ProgressPopup->setCancelCallback([this] {
- if (!ecore_thread_check(m_MainThread)) {
- if (onCancel()) {
- cancel();
- }
- }
- return false;
- });
-}
-
-void ProgressController::onStart(void *data, Ecore_Thread *thread)
-{
- RETM_IF(!data, "invalid data");
-
- ProgressController *controller = (ProgressController *)data;
- controller->m_Thread = thread;
- controller->onStart();
-}
-
-void ProgressController::onNotify(void *data, Ecore_Thread *thread, void *msgData)
-{
- RETM_IF(!data || !msgData, "invalid data");
- ProgressController *controller = (ProgressController *)data;
-
- if (!ecore_thread_check(thread)) {
- controller->m_ProgressPopup->setProgress((size_t)msgData);
- }
-
- controller->m_IsPopupUpdating = false;
- controller->m_ContinueCondition.notify_one();
-}
-
-void ProgressController::onFinish(void *data, Ecore_Thread *thread)
-{
- RETM_IF(!data, "invalid data");
- ProgressController *controller = (ProgressController *)data;
- if (controller->m_OnFinish) {
- controller->m_OnFinish();
- }
-
- delete controller;
-}
-
-void ProgressController::onCanceled(void *data, Ecore_Thread *thread)
-{
- RETM_IF(!data, "invalid data");
- ProgressController *controller = (ProgressController *)data;
- controller->onCanceled();
-
- if (controller->m_OnCancel) {
- controller->m_OnCancel();
- }
-
- delete controller;
-}
+++ /dev/null
-/*
- * 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 "App/Path.h"
-#include "Ui/ProgressPopup.h"
-#include "Utils/Logger.h"
-
-#include "AppsCommonPopup.h"
-
-#define BUFFER_SIZE 64
-
-#define ZERO_PROGRESS "0%"
-
-using namespace Ui;
-
-namespace
-{
- const std::string layoutFilePath = App::getResourcePath(APPS_COMMON_POPUP_EDJ);
-}
-
-ProgressPopup::ProgressPopup(size_t maxValue)
- : m_CurrentValue(0), m_MaxValue(maxValue), m_Progressbar(nullptr)
-{
-}
-
-void ProgressPopup::setProgress(size_t value)
-{
- RETM_IF(value > m_MaxValue, "value is bigger than max value");
- m_CurrentValue = value;
- double progressValue = (double)value / m_MaxValue;
-
- char progress[BUFFER_SIZE] = { 0, };
- snprintf(progress, sizeof(progress), "%d%%", (int)(100.0 * progressValue));
-
- elm_progressbar_value_set(m_Progressbar, progressValue);
- elm_object_part_text_set(m_Progressbar, "elm.text.bottom.left", progress);
-
- updateTotalText();
-}
-
-void ProgressPopup::setMaxValue(size_t maxValue)
-{
- m_MaxValue = maxValue;
- updateTotalText();
-}
-
-size_t ProgressPopup::getMaxValue() const
-{
- return m_MaxValue;
-}
-
-Evas_Object *ProgressPopup::onCreate(Evas_Object *parent)
-{
- Evas_Object *popup = Popup::onCreate(parent);
-
- Evas_Object *layout = elm_layout_add(popup);
- elm_layout_file_set(layout, layoutFilePath.c_str(), LAYOUT_PROGRESS);
-
- m_Progressbar = elm_progressbar_add(layout);
- elm_progressbar_pulse(m_Progressbar, EINA_TRUE);
-
- elm_object_part_text_set(m_Progressbar, "elm.text.bottom.left", ZERO_PROGRESS);
- updateTotalText();
-
- elm_object_content_set(layout, m_Progressbar);
- elm_object_content_set(popup, layout);
-
- return popup;
-}
-
-void ProgressPopup::updateTotalText()
-{
- char total[BUFFER_SIZE] = { 0, };
- snprintf(total, sizeof(total), "%zu/%zu", m_CurrentValue, m_MaxValue);
- elm_object_part_text_set(m_Progressbar, "elm.text.bottom.right", total);
-}
+++ /dev/null
-/*
- * 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 "Ui/RadioPopup.h"
-
-using namespace Ui;
-
-RadioPopup::RadioPopup()
- : m_RadioGroup(nullptr)
-{
-}
-
-void RadioPopup::setSelectedItem(int value)
-{
- elm_radio_value_set(m_RadioGroup, value);
-}
-
-Evas_Object *RadioPopup::onCreate(Evas_Object *parent)
-{
- Evas_Object *popup = ListPopup::onCreate(parent);
-
- m_RadioGroup = elm_radio_add(popup);
- elm_radio_state_value_set(m_RadioGroup, -1);
-
- return popup;
-}
-
-Evas_Object *RadioPopup::getItemContent(void *data, const char *part)
-{
- if (strcmp(part, "elm.swallow.end") == 0) {
- Evas_Object *radio = elm_radio_add(getEvasObject());
- elm_radio_group_add(radio, m_RadioGroup);
- elm_radio_state_value_set(radio, (long) data);
- elm_object_signal_emit(radio, "elm,event,pass,enabled", "elm");
- return radio;
- }
-
- return nullptr;
-}
-
-void RadioPopup::onItemSelected(void *data)
-{
- setSelectedItem((long) data);
-}
+++ /dev/null
-/*
- * 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 "Ui/ScrollNavigator.h"
-#include "Ui/ScrollPage.h"
-#include "Ui/Selector.h"
-#include "Utils/Callback.h"
-
-using namespace Ui;
-
-ScrollNavigator::ScrollNavigator(Selector *selector)
- : TabNavigator(selector),
- m_Scroller(nullptr), m_Box(nullptr),
- m_Width(0), m_Height(0),
- m_IsNavigationEnabled(true)
-{
-}
-
-void ScrollNavigator::setNavigationEnabled(bool isEnabled)
-{
- m_IsNavigationEnabled = isEnabled;
- getSelector()->setSelectEnabled(isEnabled);
- elm_scroller_movement_block_set(m_Scroller,
- isEnabled ? ELM_SCROLLER_MOVEMENT_NO_BLOCK : ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL);
-}
-
-Evas_Object *ScrollNavigator::onCreate(Evas_Object *parent)
-{
- m_Scroller = elm_scroller_add(parent);
- elm_scroller_page_relative_set(m_Scroller, 1.0, 0.0);
- elm_scroller_page_scroll_limit_set(m_Scroller, 1, 0);
- elm_scroller_loop_set(m_Scroller, EINA_FALSE, EINA_FALSE);
- elm_scroller_policy_set(m_Scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
- elm_object_scroll_lock_y_set(m_Scroller, EINA_TRUE);
-
- evas_object_event_callback_add(m_Scroller, EVAS_CALLBACK_RESIZE,
- makeCallback(&ScrollNavigator::onResize), this);
- evas_object_smart_callback_add(m_Scroller, "scroll,page,changed",
- makeCallback(&ScrollNavigator::onPageChanged), this);
-
- m_Box = elm_box_add(m_Scroller);
- elm_box_horizontal_set(m_Box, EINA_TRUE);
- elm_object_content_set(m_Scroller, m_Box);
-
- return m_Scroller;
-}
-
-ScrollPage *ScrollNavigator::addPage(View *view)
-{
- auto page = static_cast<ScrollPage *>(TabNavigator::addPage(view));
- evas_object_size_hint_min_set(page->m_Sizer, m_Width, m_Height);
- elm_box_pack_end(m_Box, page->getEvasObject());
- evas_object_show(page->getEvasObject());
- return page;
-}
-
-ScrollPage *ScrollNavigator::createPage(View *view, Elm_Object_Item *item)
-{
- return new ScrollPage(item);
-}
-
-void ScrollNavigator::changePage(TabPage *page)
-{
- size_t pageIndex = getPageIndex(page);
- size_t currentIndex = 0;
- elm_scroller_current_page_get(m_Scroller, (int *) ¤tIndex, nullptr);
-
- if (currentIndex != pageIndex) {
- elm_scroller_page_show(m_Scroller, pageIndex, 0);
- }
-}
-
-size_t ScrollNavigator::getPageIndex(TabPage *page) const
-{
- Eina_List *list = elm_box_children_get(m_Box);
- size_t index = eina_list_data_idx(list, page->getEvasObject());
- eina_list_free(list);
- return index;
-}
-
-TabPage *ScrollNavigator::getPageByIndex(size_t index) const
-{
- Eina_List *list = elm_box_children_get(m_Box);
-
- Evas_Object *obj = (Evas_Object *) eina_list_nth(list, index);
- eina_list_free(list);
- return static_cast<TabPage *>(Control::getControl(obj));
-}
-
-void ScrollNavigator::onPageChanged(Evas_Object *obj, void *eventInfo)
-{
- /* Page count might be invalid until scroller is properly resized,
- so we cannot reliably use page index at that point */
- size_t count = 0;
- elm_scroller_last_page_get(m_Scroller, (int *) &count, nullptr);
- if (count + 1 != getPages().size()) {
- return;
- }
-
- size_t index = 0;
- elm_scroller_current_page_get(m_Scroller, (int *) &index, nullptr);
- if (auto page = getPageByIndex(index)) {
- navigateTo(page->getView());
- }
-}
-
-void ScrollNavigator::onResize(Evas *e, Evas_Object *obj, void *eventInfo)
-{
- evas_object_geometry_get(obj, nullptr, nullptr, &m_Width, &m_Height);
- for (auto &&page : getPages()) {
- auto scrollPage = static_cast<ScrollPage *>(page);
- evas_object_size_hint_min_set(scrollPage->m_Sizer, m_Width, m_Height);
- }
-
- if (auto page = static_cast<ScrollPage *>(getCurrentPage())) {
- elm_scroller_page_show(m_Scroller, getPageIndex(page), 0);
- }
-}
+++ /dev/null
-/*
- * 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 "Ui/ScrollPage.h"
-#include "Ui/ScrollNavigator.h"
-
-using namespace Ui;
-
-ScrollPage::ScrollPage(Elm_Object_Item *tabItem)
- : TabPage(tabItem), m_Sizer(nullptr)
-{
-}
-
-Evas_Object *ScrollPage::onCreate(Evas_Object *parent)
-{
- m_Sizer = evas_object_rectangle_add(evas_object_evas_get(parent));
- evas_object_color_set(m_Sizer, 0, 0, 0, 0);
-
- Evas_Object *layout = elm_layout_add(parent);
- elm_layout_theme_set(layout, "layout", "application", "default");
- elm_object_part_content_set(layout, "elm.swallow.bg", m_Sizer);
- elm_object_part_content_set(layout, "elm.swallow.content", TabPage::onCreate(layout));
-
- return layout;
-}
-
-void ScrollPage::setExpanded(bool isExpanded)
-{
- auto navigator = static_cast<ScrollNavigator *>(getNavigator());
- navigator->setNavigationEnabled(!isExpanded);
- NavigatorPage::setExpanded(isExpanded);
-}
+++ /dev/null
-/*
- * 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 "Ui/Selector.h"
-
-using namespace Ui;
-
-void Selector::setSelectEnabled(bool isEnabled)
-{
- elm_object_disabled_set(getEvasObject(), !isEnabled);
-}
-
-void Selector::setSelectCallback(SelectCallback callback)
-{
- m_OnSelected = std::move(callback);
-}
-
-bool Selector::onSelected(Elm_Object_Item *item)
-{
- void *data = elm_object_item_data_get(item);
- return !m_OnSelected || m_OnSelected(data);
-}
+++ /dev/null
-/*
- * 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 "Ui/TabNavigator.h"
-#include "Ui/Selector.h"
-
-#include <algorithm>
-
-using namespace Ui;
-using namespace std::placeholders;
-
-TabNavigator::TabNavigator(Selector *selector)
- : m_Layout(nullptr), m_Selector(selector)
-{
- if (m_Selector) {
- m_Selector->setSelectCallback(std::bind(&TabNavigator::onSelected, this, _1));
- }
-}
-
-Evas_Object *TabNavigator::onCreate(Evas_Object *parent)
-{
- m_Layout = elm_layout_add(parent);
- elm_layout_theme_set(m_Layout, "layout", "application", "default");
- return m_Layout;
-}
-
-void TabNavigator::onPageAttached(NavigatorPage *page)
-{
- page->setStyle("tabbar/notitle");
- if (m_Selector) {
- page->setContent("tabbar", m_Selector->create(getEvasObject()));
- }
-}
-
-Selector *TabNavigator::getSelector() const
-{
- return m_Selector;
-}
-
-const TabNavigator::Pages &TabNavigator::getPages() const
-{
- return m_Pages;
-}
-
-TabPage *TabNavigator::addPage(View *view)
-{
- TabPage *page = createPage(view, m_Selector ? m_Selector->addItem(nullptr) : nullptr);
- m_Pages.push_back(page);
-
- Evas_Object *layout = page->create(getEvasObject());
- page->setContent("elm.swallow.content", view->create(layout));
-
- return page;
-}
-
-bool TabNavigator::removePage(NavigatorPage *page)
-{
- if (m_Pages.size() == 1) {
- return false;
- }
-
- auto it = std::find(m_Pages.begin(), m_Pages.end(), page);
- if (page == getCurrentPage()) {
- if (page != m_Pages.back()) {
- navigateTo((*++it)->getView());
- } else if (page != m_Pages.front()) {
- navigateTo((*--it)->getView());
- }
- }
-
- m_Pages.erase(it);
- delete page;
- return true;
-}
-
-void TabNavigator::navigateToPage(NavigatorPage *page)
-{
- TabPage *tabPage = static_cast<TabPage *>(page);
- setCurrentPage(tabPage);
- changePage(tabPage);
-
- if (m_Selector) {
- m_Selector->setSelectedItem(tabPage->getTabItem());
- }
-}
-
-TabPage *TabNavigator::createPage(View *view, Elm_Object_Item *item)
-{
- return new TabPage(item);
-}
-
-void TabNavigator::changePage(TabPage *page)
-{
- evas_object_hide(elm_object_content_unset(m_Layout));
- elm_object_content_set(m_Layout, page->getEvasObject());
-}
-
-bool TabNavigator::onSelected(void *data)
-{
- TabPage *page = (TabPage *) data;
- if (page) {
- navigateTo(page->getView());
- }
-
- return true;
-}
+++ /dev/null
-/*
- * 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 "Ui/TabPage.h"
-#include "Utils/Callback.h"
-
-#define BUFFER_SIZE 64
-
-using namespace Ui;
-
-TabPage::TabPage(Elm_Object_Item *tabItem)
- : m_TabItem(tabItem), m_Page(nullptr), m_HasTabTitle(false)
-{
- elm_object_item_data_set(tabItem, this);
- elm_object_item_del_cb_set(tabItem, makeCallback(&TabPage::onTabItemDestroy));
-}
-
-TabPage::~TabPage()
-{
- elm_object_item_del(m_TabItem);
-}
-
-void TabPage::setTabTitle(const char *title)
-{
- elm_object_item_translatable_text_set(m_TabItem, title);
- m_HasTabTitle = true;
-}
-
-void TabPage::unsetTabTitle()
-{
- const char *title = elm_object_translatable_part_text_get(m_Page, "elm.text.title");
- elm_object_item_translatable_text_set(m_TabItem, title);
- m_HasTabTitle = false;
-}
-
-void TabPage::setTitle(const char *title)
-{
- if (!m_HasTabTitle) {
- elm_object_item_translatable_text_set(m_TabItem, title);
- }
- elm_object_translatable_part_text_set(m_Page, "elm.text.title", title);
-}
-
-void TabPage::setSubtitle(const char *subtitle)
-{
- elm_object_translatable_part_text_set(m_Page, "elm.text.subtitle", subtitle);
-}
-
-void TabPage::setTitleVisibility(bool isVisible)
-{
- elm_layout_signal_emit(m_Page, isVisible ? "elm,state,title,show" : "elm,state,title,hide", "elm");
-}
-
-void TabPage::setStyle(const char *style)
-{
- char buffer[BUFFER_SIZE];
- snprintf(buffer, sizeof(buffer), "%s/default", style);
- elm_layout_theme_set(m_Page, "naviframe", "item", buffer);
-}
-
-void TabPage::setContent(const char *part, Evas_Object *content)
-{
- char buffer[BUFFER_SIZE];
- snprintf(buffer, sizeof(buffer), "elm,state,%s,%s", part, content ? "show" : "hide");
- elm_layout_signal_emit(m_Page, buffer, "elm");
- elm_object_part_content_set(m_Page, part, content);
-}
-
-Elm_Object_Item *TabPage::getTabItem() const
-{
- return m_TabItem;
-}
-
-Evas_Object *TabPage::onCreate(Evas_Object *parent)
-{
- m_Page = elm_layout_add(parent);
- elm_layout_theme_set(m_Page, "naviframe", "item", "basic/default");
- elm_layout_signal_emit(m_Page, "elm,state,title,hide", "elm");
- elm_layout_signal_emit(m_Page, "elm,state,toolbar,hide", "elm");
-
- return m_Page;
-}
-
-void TabPage::onTabItemDestroy(Evas_Object *obj, void *eventInfo)
-{
- m_TabItem = nullptr;
-}
+++ /dev/null
-/*
- * 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 "Ui/Tabbar.h"
-#include "Utils/Callback.h"
-
-using namespace Ui;
-
-Elm_Object_Item *Tabbar::addItem(void *data)
-{
- return elm_toolbar_item_append(getEvasObject(), nullptr, nullptr, nullptr, data);
-}
-
-void Tabbar::setSelectEnabled(bool isEnabled)
-{
- elm_toolbar_select_mode_set(getEvasObject(),
- isEnabled ? ELM_OBJECT_SELECT_MODE_ALWAYS : ELM_OBJECT_SELECT_MODE_NONE);
-}
-
-void Tabbar::setSelectedItem(Elm_Object_Item *item)
-{
- elm_toolbar_item_selected_set(item, EINA_TRUE);
-}
-
-Evas_Object *Tabbar::onCreate(Evas_Object *parent)
-{
- Evas_Object *tabbar = elm_toolbar_add(parent);
- elm_toolbar_shrink_mode_set(tabbar, ELM_TOOLBAR_SHRINK_EXPAND);
- elm_toolbar_select_mode_set(tabbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
- elm_toolbar_transverse_expanded_set(tabbar, EINA_TRUE);
- evas_object_smart_callback_add(tabbar, "selected",
- (Evas_Smart_Cb) makeCallback(&Tabbar::onSelected), this);
- return tabbar;
-}
-
-void Tabbar::onSelected(Evas_Object *tabbar, Elm_Object_Item *item)
-{
- Selector::onSelected(item);
-}
+++ /dev/null
-/*
- * 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 "Ui/Thumbnail.h"
-#include "Ui/Scale.h"
-
-#include "App/Path.h"
-#include "AppsCommonThumbnail.h"
-
-using namespace Ui;
-
-namespace
-{
- const struct
- {
- int size;
- const char *groupMask;
- const char *groupDefault;
- } params[] = {
- { THUMBNAIL_SMALL_SIZE, LAYOUT_THUMBNAIL_SMALL, LAYOUT_THUMBNAIL_DEFAULT_SMALL },
- { THUMBNAIL_MEDIUM_SIZE, LAYOUT_THUMBNAIL_MEDIUM, LAYOUT_THUMBNAIL_DEFAULT_MEDIUM },
- { THUMBNAIL_LARGE_SIZE, LAYOUT_THUMBNAIL_LARGE, LAYOUT_THUMBNAIL_DEFAULT_LARGE }
- };
-
- const std::string layoutPath = App::getResourcePath(APPS_COMMON_THUMBNAIL_EDJ);
-}
-
-Thumbnail::Thumbnail(Size size)
- : m_Size(size), m_Image(nullptr)
-{
-}
-
-Thumbnail *Thumbnail::create(Evas_Object *parent, Size size, const char *path)
-{
- Thumbnail *thumbnail = new Thumbnail(size);
- thumbnail->create(parent);
- thumbnail->setImagePath(path);
- return thumbnail;
-}
-
-Evas_Object *Thumbnail::getImage() const
-{
- return m_Image;
-}
-
-void Thumbnail::setImagePath(const char *path)
-{
- if (path && *path) {
- elm_image_file_set(m_Image, path, nullptr);
- } else {
- elm_image_file_set(m_Image, layoutPath.c_str(), params[m_Size].groupDefault);
- }
-}
-
-void Thumbnail::setSizeHint(bool isSet)
-{
- int size = 0;
- if (isSet) {
- size = getScaledValue(params[m_Size].size);
- }
-
- evas_object_size_hint_min_set(m_Image, size, size);
-}
-
-Evas_Object *Thumbnail::onCreate(Evas_Object *parent)
-{
- Evas_Object *layout = elm_layout_add(parent);
- elm_layout_file_set(layout, layoutPath.c_str(), params[m_Size].groupMask);
-
- m_Image = elm_image_add(layout);
- elm_image_prescale_set(m_Image, getScaledValue(params[m_Size].size) * 2);
- elm_image_aspect_fixed_set(m_Image, EINA_TRUE);
- elm_image_fill_outside_set(m_Image, EINA_TRUE);
- elm_object_part_content_set(layout, "elm.swallow.content", m_Image);
-
- return layout;
-}
+++ /dev/null
-/*
- * 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 "Utils/Thread.h"
-#include "Utils/Callback.h"
-
-using namespace Utils;
-
-
-Thread::Thread(Callback callbackPair)
- : m_Callback(std::move(callbackPair))
-{
- ecore_thread_run(makeCallback(&Thread::onStart), makeCallback(&Thread::onFinished),
- nullptr, this);
-}
-
-Thread::Thread(Callback task, Callback finishCallback)
- : Thread(CallbackPair(std::move(task), std::move(finishCallback)))
-{
-}
-
-void Thread::onStart(Ecore_Thread *thread)
-{
- if (m_Callback) {
- m_Callback();
- }
-}
-
-void Thread::onFinished(Ecore_Thread *thread)
-{
- if (m_Callback) {
- m_Callback();
- }
-
- delete this;
-}
+++ /dev/null
-/*
- * 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 "Ux/DatePopup.h"
-
-using namespace Ux;
-
-DatePopup::DatePopup(const char *format, tm date)
- : m_Format(format ? format : ""), m_Date(date),
- m_DatePicker(nullptr), m_Strings{ nullptr }
-{
-}
-
-void DatePopup::setStrings(Strings strings)
-{
- m_Strings = strings;
-}
-
-void DatePopup::setResultCallback(ResultCallback callback)
-{
- m_OnResult = std::move(callback);
-}
-
-Evas_Object *DatePopup::getDatePicker() const
-{
- return m_DatePicker;
-}
-
-void DatePopup::onCreated()
-{
- setTitle(m_Strings.popupTitle);
- addButton(m_Strings.buttonCancel);
- addButton(m_Strings.buttonDone, std::bind(&DatePopup::onDonePressed, this));
-
- m_DatePicker = elm_datetime_add(getEvasObject());
- elm_datetime_format_set(m_DatePicker, m_Format.c_str());
- elm_datetime_value_set(m_DatePicker, &m_Date);
- setContent(m_DatePicker);
-}
-
-bool DatePopup::onDonePressed()
-{
- if (m_OnResult) {
- elm_datetime_value_get(m_DatePicker, &m_Date);
- m_OnResult(m_Date);
- }
-
- return true;
-}
+++ /dev/null
-/*
- * 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 "Ux/EditfieldPopup.h"
-#include "Ui/Editfield.h"
-#include "Utils/Callback.h"
-#include "Utils/String.h"
-
-using namespace Ui;
-using namespace Ux;
-
-EditfieldPopup::EditfieldPopup()
- : m_Editfield(nullptr), m_Strings{ nullptr }
-{
-}
-
-void EditfieldPopup::setStrings(Strings strings)
-{
- m_Strings = strings;
-}
-
-void EditfieldPopup::setResultCallback(ResultCallback callback)
-{
- m_OnResult = std::move(callback);
-}
-
-Editfield *EditfieldPopup::getEditfield() const
-{
- return m_Editfield;
-}
-
-void EditfieldPopup::onCreated()
-{
- m_Editfield = Editfield::create(getEvasObject(), m_Strings.guideText);
- m_Editfield->setLimitToastText(m_Strings.limitToastText);
-
- setTitle(m_Strings.popupTitle);
- setContent(m_Editfield->getEvasObject());
- addButton(m_Strings.buttonCancel);
-
- Evas_Object *button = addButton(m_Strings.buttonDone, std::bind(&EditfieldPopup::onDoneButtonPressed, this));
- elm_object_focus_allow_set(button, EINA_FALSE);
-
- Evas_Object *entry = m_Editfield->getEntry();
- elm_entry_input_panel_return_key_type_set(entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
- elm_entry_input_panel_return_key_disabled_set(entry, EINA_TRUE);
-
- evas_object_smart_callback_add(entry, "changed",
- (Evas_Smart_Cb) &EditfieldPopup::onEntryChanged, button);
- evas_object_smart_callback_add(entry, "activated",
- makeCallback(&EditfieldPopup::onDoneKeyPressed), this);
-
- elm_object_disabled_set(button, EINA_TRUE);
- elm_object_focus_set(entry, EINA_TRUE);
-}
-
-bool EditfieldPopup::onDoneButtonPressed()
-{
- bool shouldClose = true;
- if (m_OnResult) {
- char *text = elm_entry_markup_to_utf8(elm_entry_entry_get(m_Editfield->getEntry()));
- shouldClose = m_OnResult(text);
- free(text);
- }
-
- return shouldClose;
-}
-
-void EditfieldPopup::onDoneKeyPressed(Evas_Object *entry, void *eventInfo)
-{
- if (onDoneButtonPressed()) {
- close();
- }
-}
-
-void EditfieldPopup::onEntryChanged(Evas_Object *button, Evas_Object *entry, void *eventInfo)
-{
- bool isEmpty = Utils::isStrEmpty(elm_entry_entry_get(entry));
- elm_object_disabled_set(button, isEmpty);
- elm_entry_input_panel_return_key_disabled_set(entry, isEmpty);
-}
--- /dev/null
+/*
+ * 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 COMMON_APP_CONTROL_REQUESTS_H
+#define COMMON_APP_CONTROL_REQUESTS_H
+
+#include "App/AppControl.h"
+
+namespace Common
+{
+ /**
+ * @brief Request share memo to other application.
+ * @param[in] text Information in text representation.
+ * @param[in] paths File paths.
+ * @param[in] count Paths count.
+ * @return AppControl wrapper
+ */
+ EXPORT_API App::AppControl requestShareMemo(const char *text, const char **paths, int count = 0);
+
+ /**
+ * @brief Request view storage settings
+ * @return AppControl wrapper
+ */
+ EXPORT_API App::AppControl requestViewStorageSettings();
+}
+
+#endif /* COMMON_APP_CONTROL_REQUESTS_H */
--- /dev/null
+/*
+ * 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 "Common/AppControlRequests.h"
+
+using namespace App;
+
+AppControl Common::requestShareMemo(const char *text, const char **paths, int count)
+{
+ AppControl request(APP_CONTROL_OPERATION_SHARE_TEXT, nullptr);
+ request.addExtra(APP_CONTROL_DATA_TEXT, text);
+ if (count > 0) {
+ request.addExtra(APP_CONTROL_DATA_PATH, paths, count);
+ }
+
+ return request;
+}
+
+AppControl Common::requestViewStorageSettings()
+{
+ AppControl request("org.tizen.setting-storage");
+ return request;
+}
#include "Input/DetailsView.h"
#include "Input/TitleField.h"
+#include "Common/AppControlRequests.h"
#include "Common/Model/MemoConsumer.h"
#include "Common/Model/ShareTool.h"
-#include "App/AppControlRequest.h"
#include "Ui/Menu.h"
#include "Ui/Popup.h"
#include "Utils/Callback.h"
{
std::string text = getTextFromMemo(getMemo());
std::vector<const char *> files = getFilesFromMemo(getMemo());
- m_AppControl = App::requestShareMemo(text.c_str(), files.data(), files.size());
+ m_AppControl = Common::requestShareMemo(text.c_str(), files.data(), files.size());
m_AppControl.launch();
}
#include "Ui/Scale.h"
#include "Ui/Window.h"
#include "Utils/Callback.h"
-#include "I18n/UniString.h"
#include "InputLayout.h"
using namespace Input;
using namespace Common::Model;
-using namespace I18n;
namespace
{
*/
#include "Input/OutOfStoragePopup.h"
-#include "App/AppControlRequest.h"
+#include "Common/AppControlRequests.h"
using namespace Input;
setText("IDS_EMAIL_POP_THERE_IS_NOT_ENOUGH_SPACE_IN_YOUR_DEVICE_STORAGE_GO_TO_SETTINGS_MSG");
addButton("IDS_MEMO_BUTTON_CANCEL_ABB2");
addButton("IDS_IDLE_BUTTON_SETTINGS_ABB", [] {
- App::AppControl request = App::requestViewStorageSettings();
+ App::AppControl request = Common::requestViewStorageSettings();
request.launch();
request.detach();
return true;
#include "OperationEditController.h"
-#include "App/AppControlRequest.h"
+#include "App/AppControlUtils.h"
#include "Common/Model/MemoConsumer.h"
#include "Input/DetailsView.h"
#include "Ui/Navigator.h"