+++ /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 __GALLERY_CONFIG_H__
-#define __GALLERY_CONFIG_H__
-
-#define GALLERY_LOG_TAG "GALLERY"
-
-namespace gallery {
-
- constexpr auto WINDOW_NAME = "org.tizen.gallery";
-
- constexpr auto BASE_SCALE = 1.3;
-
- // TODO Temporary feature while support only offline mode
- constexpr auto SCAN_MEDIA_ON_RESUME = false;
-}
-
-#endif // __GALLERY_CONFIG_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 __GALLERY_CONFIG_H__
+#define __GALLERY_CONFIG_H__
+
+#define GALLERY_LOG_TAG "GALLERY"
+
+namespace gallery {
+
+ constexpr auto WINDOW_NAME = "org.tizen.gallery";
+
+ constexpr auto BASE_SCALE = 1.3;
+
+ // TODO Temporary feature while support only offline mode
+ constexpr auto SCAN_MEDIA_ON_RESUME = false;
+}
+
+#endif // __GALLERY_CONFIG_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 __GALLERY_MODEL_GALLERY_H__
+#define __GALLERY_MODEL_GALLERY_H__
+
+#include "IMediaAlbum.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(Gallery);
+
+ class Gallery final : public ucl::NonCopyable {
+ public:
+ static GallerySRef newInstance();
+ ~Gallery();
+
+ IMediaAlbumSRef getAlbum();
+
+ private:
+ friend class ucl::RefCountObj<Gallery>;
+ Gallery();
+
+ ucl::Result prepare();
+
+ private:
+ IMediaAlbumSRef m_album;
+ bool m_isMediaDbConnected;
+ };
+}
+
+#endif // __GALLERY_MODEL_GALLERY_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 __GALLERY_MODEL_I_JOB_H__
+#define __GALLERY_MODEL_I_JOB_H__
+
+#include "types.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(IJob);
+
+ class IJob : public ucl::Polymorphic {
+ public:
+ virtual ucl::Result getResult() const = 0;
+ virtual bool isCancelable() const = 0;
+ virtual ucl::Result cancel() = 0;
+ };
+}
+
+#endif // __GALLERY_MODEL_I_JOB_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 __GALLERY_MODEL_I_MEDIA_ALBUM_H__
+#define __GALLERY_MODEL_I_MEDIA_ALBUM_H__
+
+#include "MediaItem.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(IMediaAlbum);
+
+ class IMediaAlbum : public ucl::Polymorphic {
+ public:
+ using EachCb = ucl::Delegate<bool(MediaItemSRef &&media)>;
+
+ public:
+ virtual void addChangeHandler(const NotiHandler &handler) = 0;
+ virtual void delChangeHandler(const NotiHandler &handler) = 0;
+
+ virtual ucl::Result forEachMedia(EachCb cb) const = 0;
+ virtual ucl::Result getMediaCount(int &count) const = 0;
+
+ virtual void defragment() = 0;
+ };
+
+ // Non-member functions //
+
+ bool isEmpty(const IMediaAlbum &album);
+}
+
+#include "IMediaAlbum.hpp"
+
+#endif // __GALLERY_MODEL_I_MEDIA_ALBUM_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 "ucl/util/logging.h"
+
+namespace gallery {
+
+ // Non-member functions //
+
+ inline bool isEmpty(const IMediaAlbum &album)
+ {
+ int count = 0;
+ UCL_FAIL_RETURN_VALUE(album.getMediaCount(count), true,
+ "album.getMediaCount() failed!");
+ return (count == 0);
+ }
+}
--- /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 __GALLERY_MODEL_MEDIA_ITEM_H__
+#define __GALLERY_MODEL_MEDIA_ITEM_H__
+
+#include <vector>
+
+#include <media_content.h>
+
+#include "ucl/misc/AutoHandle.h"
+
+#include "IJob.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(MediaItem);
+
+ using MediaItems = std::vector<MediaItemSRef>;
+
+ class MediaItem : public ucl::Polymorphic {
+ public:
+ using ThumbnailPathGetCb =
+ ucl::WeakDelegate<void(ucl::Result, const std::string &path)>;
+
+ class Remover;
+ class RemoverBuilder final {
+ public:
+ RemoverBuilder &setItems(MediaItems items);
+ IJobSRef build(const NotiHandler &onComplete) const;
+ private:
+ ucl::SharedRef<MediaItems> m_items;
+ };
+
+ class Saver;
+ class SaverBuilder final {
+ public:
+ SaverBuilder &setItem(const MediaItemSRef &item);
+ IJobSRef build(const NotiHandler &onComplete) const;
+ private:
+ MediaItemSRef m_item;
+ };
+
+ enum {
+ FLAG_THUMBNAIL = 1,
+ FLAG_REMOVE = 2,
+ FLAG_SAVE = 4,
+ FLAG_RESOLUTION = 8,
+
+ FLAGS_FROM_MEDIA_DB = (FLAG_THUMBNAIL | FLAG_REMOVE |
+ FLAG_RESOLUTION),
+ FLAGS_SIMPLE_FILE = (FLAG_SAVE)
+ };
+
+ public:
+ static MediaItemSRef newInstance(media_info_h media);
+ static MediaItemSRef newInstance(std::string filePath);
+ virtual ~MediaItem();
+
+ bool isValid() const;
+ int getFlags() const;
+ MediaType getType() const;
+
+ const std::string &getId() const;
+
+ ucl::Result getResolution(int &x, int &y) const;
+
+ const std::string &getFilePath() const;
+
+ ucl::Result getThumbnailPath(const ThumbnailPathGetCb &cb) const;
+ void cancelThumbnailPathGet() const;
+
+ ucl::Result removeFile();
+ ucl::Result saveToDevice();
+
+ protected:
+ friend class ucl::RefCountObj<MediaItem>;
+ MediaItem(int flags, MediaType type);
+
+ ucl::Result prepare(media_info_h media);
+ ucl::Result prepareImage(media_info_h media);
+ ucl::Result prepare(std::string filePath);
+
+ private:
+ ucl::Result initThumbPath(media_info_h media) const;
+
+ private:
+ // XXX This proxy is needed to deal with cases when
+ // media_thumbnail_completed_cb can't be cancelled
+ struct ThumbCbProxy {
+ const MediaItem *item;
+ ThumbnailPathGetCb callback;
+
+ void completeCb(media_content_error_e error, const char *path);
+ };
+
+ private:
+ using AutoMediaInfo = ucl::AutoHandle<
+ media_info_h, int, media_info_destroy>;
+
+ private:
+ const int m_flags;
+ const MediaType m_type;
+ std::string m_mediaId;
+ std::string m_filePath;
+ int m_resolutionX;
+ int m_resolutionY;
+ mutable AutoMediaInfo m_media;
+ mutable std::string m_thumbPath;
+ mutable std::unique_ptr<ThumbCbProxy> m_thumbCbProxy;
+ bool m_isValid;
+ };
+}
+
+#endif // __GALLERY_MODEL_MEDIA_ITEM_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 __GALLERY_MODEL_SOUND_MANAGER_H__
+#define __GALLERY_MODEL_SOUND_MANAGER_H__
+
+#include <sound_manager.h>
+
+#include "ucl/misc/Event.h"
+
+#include "types.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(SoundManager);
+
+ class SoundManager final : public ucl::NonCopyable {
+ public:
+ static SoundManagerSRef newInstance();
+
+ bool isMediaDeviceReady() const;
+
+ int getCurrentMediaVolume() const;
+ int getMaxMediaVolume() const;
+
+ void addMediaDeviceStateChangeHandler(const NotiHandler &handler);
+ void delMediaDeviceStateChangeHandler(const NotiHandler &handler);
+
+ void addMediaVolumeChangeHandler(const NotiHandler &handler);
+ void delMediaVolumeChangeHandler(const NotiHandler &handler);
+
+ private:
+ friend class ucl::RefCountObj<SoundManager>;
+ SoundManager();
+ ~SoundManager();
+
+ ucl::Result prepare();
+
+ void setMediaDeviceState(bool isReady);
+ void setCurrentMediaVolume(int value);
+
+ ucl::Result updateMediaDeviceState();
+
+ void onDeviceConnectionChanged(sound_device_h device, bool isConnected);
+ void onDeviceStateChanged(sound_device_h device,
+ sound_device_state_e state);
+ void onVolumeChanged(sound_type_e type, unsigned int volume);
+
+ private:
+ ucl::Event<NotiHandler> m_onMediaDeviceStateChange;
+ ucl::Event<NotiHandler> m_onMediaVolumeChange;
+ int m_devConnChangedCbId;
+ int m_devStateChangedCbId;
+ int m_volumeChangedCbId;
+ int m_currentMediaVolume;
+ int m_maxMediaVolume;
+ bool m_isMediaDeviceReady;
+ };
+}
+
+#endif // __GALLERY_MODEL_SOUND_MANAGER_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 __GALLERY_MODEL_TYPES_H__
+#define __GALLERY_MODEL_TYPES_H__
+
+#include "gallery/types.h"
+
+namespace gallery {
+
+ enum class MediaType {
+ IMAGE,
+ VIDEO,
+ SOUND,
+ MUSIC,
+ OTHERS
+ };
+}
+
+#endif // __GALLERY_MODEL_TYPES_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 __GALLERY_PRESENTERS_ALERT_DIALOG_H__
+#define __GALLERY_PRESENTERS_ALERT_DIALOG_H__
+
+#include "ucl/gui/StyledWidget.h"
+#include "ucl/gui/Layout.h"
+
+#include "Presenter.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(AlertDialog);
+
+ class AlertDialog final : public Presenter,
+ public ucl::IDisposable {
+ public:
+ enum class Type {
+ OK_CANCEL
+ };
+
+ enum Event {
+ EVENT_CANCEL,
+ EVENT_OK,
+ EVENT_BACK
+ };
+
+ using EventHandler = ucl::WeakDelegate<
+ bool(AlertDialog &dialog, int event)>;
+
+ class Builder {
+ public:
+ Builder();
+ Builder &setType(Type type);
+ Builder &setTitle(ucl::TString title);
+ Builder &setText(ucl::TString text);
+ Builder &setHandler(const EventHandler &handler);
+ AlertDialogWRef build(ucl::ElmWidget &parent) const;
+ private:
+ Type m_type;
+ ucl::TString m_title;
+ ucl::TString m_text;
+ EventHandler m_handler;
+ };
+
+ public:
+ void dismiss();
+
+ // ucl::IDisposable //
+
+ virtual void dispose() final override;
+ virtual bool isDisposed() const final override;
+
+ private:
+ friend class ucl::RefCountObj<AlertDialog>;
+ AlertDialog(ucl::RefCountObjBase &rc,
+ const EventHandler &handler);
+ virtual ~AlertDialog();
+
+ ucl::Result prepare(ucl::ElmWidget &parent, Type type);
+ ucl::Result createPopup(ucl::ElmWidget &parent, ucl::ElmStyle style);
+ ucl::Result createLayout(ucl::LayoutTheme theme);
+ ucl::Result createButton(Event event, ucl::EdjePart part,
+ ucl::ElmStyle btnStyle, ucl::LayoutTheme iconTheme,
+ const ucl::TString &text = nullptr);
+
+ void setTitle(const ucl::TString &title);
+ void setText(const ucl::TString &text);
+
+ void handleEvent(Event event);
+ bool dispatchEvent(Event event);
+
+ void onPopupDismissed(ucl::Widget &widget, void *eventInfo);
+ void onPopupHWBackKey(Evas_Object *obj, void *eventInfo);
+
+ void onBtnClick(ucl::Widget &widget, void *eventInfo);
+
+ private:
+ const EventHandler m_handler;
+ ucl::StyledWidgetSRef m_popup;
+ ucl::LayoutWRef m_layout;
+ bool m_isDismissed;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_ALERT_DIALOG_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 __GALLERY_PRESENTERS_ATSPI_HIGHLIGH_HELPER_H__
+#define __GALLERY_PRESENTERS_ATSPI_HIGHLIGH_HELPER_H__
+
+#include "Presenter.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(AtspiHighlightHelper);
+
+ class AtspiHighlightHelper final : public Presenter {
+ public:
+ using EventHandler = ucl::WeakDelegate<Elm_Interface_Atspi_Accessible *(
+ ucl::Widget &widget, Elm_Atspi_Relation_Type flowRelation)>;
+
+ public:
+ static AtspiHighlightHelperSRef newInstance(ucl::ElmWidget &rootWidget);
+
+ void setEventHandler(EventHandler handler);
+ void registerWidget(ucl::ElmWidget &widget);
+
+ private:
+ friend class ucl::RefCountObj<AtspiHighlightHelper>;
+ AtspiHighlightHelper(ucl::RefCountObjBase &rc);
+ virtual ~AtspiHighlightHelper();
+
+ ucl::Result prepare(ucl::ElmWidget &rootWidget);
+
+ private:
+ void onAtspiGesture(ucl::Widget &widget, void *eventInfo);
+
+ private:
+ EventHandler m_eventHandler;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_ATSPI_HIGHLIGH_HELPER_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 __GALLERY_PRESENTERS_INSTANCE_H__
+#define __GALLERY_PRESENTERS_INSTANCE_H__
+
+#include "ucl/appfw/IInstance.h"
+#include "ucl/appfw/IInstanceAppControlExt.h"
+#include "ucl/appfw/SysEventProvider.h"
+
+#include "ucl/gui/Theme.h"
+#include "ucl/gui/Naviframe.h"
+
+#include "gallery/model/Gallery.h"
+#include "Page.h"
+
+namespace gallery {
+
+ class Instance final : public ucl::RefCountAware,
+ public ucl::IInstance,
+ public ucl::IInstanceAppControlExt {
+ public:
+ Instance(ucl::RefCountObjBase &rc,
+ ucl::SysEventProvider &sysEventProvider);
+ virtual ~Instance();
+
+ // IInstance //
+
+ virtual ucl::Result onCreate(
+ ucl::IInstanceContext *context) final override;
+ virtual void onPause() final override;
+ virtual void onResume() final override;
+
+ // IInstanceAppControlExt //
+
+ virtual void onAppControl(app_control_h appControl) final override;
+
+ private:
+ ucl::Result setupTheme();
+
+ void rescanMediaContent();
+ void stopMediaContentScan();
+ void startMediaContentScan();
+ void onScanComplete(media_content_error_e error);
+
+ ucl::Result handleAppControl(app_control_h appControl);
+ ucl::Result handleSingleMode(const std::string &operation,
+ app_control_h appControl);
+ ucl::Result handleGroupMode(const std::string &operation,
+ app_control_h appControl);
+
+ ucl::Result ensureGalleryModel();
+
+ void createNoContentPage();
+ void createThumbnailPage();
+ void createViewerPage(const MediaItemSRef &media);
+ void createVideoPlayerPage(const MediaItemSRef &media);
+
+ void onAlbumChanged();
+ void onPageExitRequest(Page &page);
+
+ void onSysEvent(const ucl::SysEvent sysEvent);
+
+ private:
+ ucl::SysEventProvider &m_sysEventProvider;
+ ucl::IInstanceContext *m_context;
+
+ GallerySRef m_gallery;
+ bool m_isScanInProgress;
+
+ ucl::WindowSRef m_win;
+ ucl::Theme m_theme;
+ ucl::NaviframeSRef m_navi;
+
+ PageWRef m_page;
+
+ bool m_isGroupMode;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_INSTANCE_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 __GALLERY_PRESENTERS_INSTANCE_MANAGER_H__
+#define __GALLERY_PRESENTERS_INSTANCE_MANAGER_H__
+
+#include "ucl/appfw/InstanceManagerBase.h"
+
+#include "types.h"
+
+namespace gallery {
+
+ class InstanceManager : public ucl::InstanceManagerBase {
+ public:
+ InstanceManager();
+
+ // ucl::InstanceManagerBase //
+
+ virtual ucl::IInstanceSRef newInstance() const final override;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_INSTANCE_MANAGER_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 __GALLERY_PRESENTERS_MORE_OPTIONS_PRESENTER_H__
+#define __GALLERY_PRESENTERS_MORE_OPTIONS_PRESENTER_H__
+
+#include <list>
+
+#include "ucl/misc/HashMap.h"
+
+#include "Presenter.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(MoreOptionsPresenter);
+
+ class MoreOptionsPresenter final : public Presenter {
+ public:
+ UCL_DECLARE_REF_ALIASES(IListener);
+
+ struct Option {
+ int id;
+ ucl::TString text;
+ ucl::TString subText;
+ ucl::LayoutTheme iconTheme;
+ };
+
+ using MoreOptions = std::list<Option>;
+
+ class Builder {
+ public:
+ Builder();
+ ~Builder();
+ bool isEmpty() const;
+ Builder &clear();
+ Builder &addOption(Option option);
+ MoreOptionsPresenterSRef build(ucl::ElmWidget &parent) const;
+ private:
+ ucl::SharedRef<MoreOptions> m_options;
+ };
+
+ class IListener : public ucl::Polymorphic {
+ public:
+ virtual void onMoreOptionClicked(MoreOptionsPresenter &sender,
+ const Option &option) = 0;
+ virtual void onMoreOptionSelected(MoreOptionsPresenter &sender,
+ const Option &option) {};
+ virtual void onMoreOptionsOpened(MoreOptionsPresenter &sender) {};
+ virtual void onMoreOptionsClosed(MoreOptionsPresenter &sender) {};
+ };
+
+ public:
+ void setListener(const IListenerWRef &listener);
+
+ ucl::Widget &getWidget();
+
+ void setOpened(bool isOpened);
+ bool isOpened() const;
+
+ void setOpenedDelayed(bool isOpened, double timeout);
+
+ private:
+ using MoreOptionsCSRef = ucl::SharedRef<const MoreOptions>;
+
+ private:
+ friend class ucl::RefCountObj<MoreOptionsPresenter>;
+ MoreOptionsPresenter(ucl::RefCountObjBase &rc,
+ const MoreOptionsCSRef &options);
+ virtual ~MoreOptionsPresenter();
+
+ ucl::Result prepare(ucl::ElmWidget &parent);
+ ucl::Result addItem(const Option &option);
+
+ bool resetTimer(double timeout);
+ void stopTimer();
+
+ Eina_Bool onTimer();
+
+ void onOpened(ucl::Widget &widget, void *eventInfo);
+ void onClosed(ucl::Widget &widget, void *eventInfo);
+ void onItemClicked(ucl::Widget &widget, void *eventInfo);
+ void onItemSelected(ucl::Widget &widget, void *eventInfo);
+
+ private:
+ const MoreOptionsCSRef m_options;
+ ucl::HashMap<void *, const Option *> m_map;
+ ucl::ElmWidgetSRef m_widget;
+ IListenerWRef m_listener;
+ Ecore_Timer *m_timer;
+ bool m_newOpenedState;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_MORE_OPTIONS_PRESENTER_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 __GALLERY_PRESENTERS_NO_CONTENT_PAGE_H__
+#define __GALLERY_PRESENTERS_NO_CONTENT_PAGE_H__
+
+#include "Page.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(NoContentPage);
+
+ class NoContentPage final : public Page {
+ public:
+ class Builder {
+ public:
+ Builder();
+ ~Builder();
+ Builder &setNaviframe(const ucl::NaviframeSRef &navi);
+ NoContentPageWRef build(
+ const ExitRequestHandler &onExitRequest) const;
+ private:
+ ucl::NaviframeSRef m_navi;
+ };
+
+ private:
+ friend class ucl::RefCountObj<NoContentPage>;
+ NoContentPage(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
+ const ExitRequestHandler &onExitRequest);
+ virtual ~NoContentPage();
+
+ ucl::Result prepare();
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_NO_CONTENT_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 __GALLERY_PRESENTERS_PAGE_H__
+#define __GALLERY_PRESENTERS_PAGE_H__
+
+#include "ucl/gui/Naviframe.h"
+
+#include "Presenter.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(Page);
+
+ class Page : public Presenter {
+ public:
+ using ExitRequestHandler = ucl::WeakDelegate<void(Page &page)>;
+
+ public:
+ ucl::Naviframe &getNaviframe();
+
+ bool isAtTop() const;
+ bool isAtBottom() const;
+
+ void exit();
+ void exitNoTransition();
+
+ void popTo();
+ void deleteTo();
+ void promote();
+
+ template <class ...ARGS>
+ ucl::NaviItem insertAfter(ARGS &&...args);
+
+ template <class ...ARGS>
+ ucl::NaviItem insertBefore(ARGS &&...args);
+
+ protected:
+ Page(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
+ const ExitRequestHandler &onExitRequest);
+ virtual ~Page();
+
+ template <class ITEM_FACTORY>
+ ucl::Result prepare(ITEM_FACTORY &&makeItem);
+
+ ucl::NaviItem getItem();
+
+ void requestExit();
+
+ virtual void onBackKey();
+
+ private:
+ ucl::Result preparePart2();
+
+ void dispatchTopPageChanged();
+
+ void updateActiveState();
+
+ void onTransitionStarted(ucl::Widget &widget, void *eventInfo);
+ void onTransitionFinished(ucl::Widget &widget, void *eventInfo);
+ void onTopPageChanged(ucl::Widget &widget, void *eventInfo);
+
+ void onHWBackKey(Evas_Object *obj, void *eventInfo);
+ void onItemDel(Evas_Object *obj, void *eventInfo);
+
+ private:
+ const ucl::NaviframeSRef m_navi;
+ const ExitRequestHandler m_onExitRequest;
+ ucl::NaviItem m_item;
+ };
+
+ // Non-member functions //
+
+ bool isLast(const Page &page);
+}
+
+#include "Page.hpp"
+
+#endif // __GALLERY_PRESENTERS_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.
+ */
+
+#include "ucl/util/logging.h"
+
+namespace gallery {
+
+ template <class ITEM_FACTORY>
+ inline ucl::Result Page::prepare(ITEM_FACTORY &&makeItem)
+ {
+ m_item = makeItem();
+ if (!m_item) {
+ UCL_LOG_RETURN(ucl::RES_FAIL, "m_item is NULL");
+ }
+ return preparePart2();
+ }
+
+ template <class ...ARGS>
+ inline ucl::NaviItem Page::insertAfter(ARGS &&...args)
+ {
+ return m_navi->insertAfter(m_item, std::forward<ARGS>(args)...);
+ }
+
+ template <class ...ARGS>
+ inline ucl::NaviItem Page::insertBefore(ARGS &&...args)
+ {
+ return m_navi->insertBefore(m_item, std::forward<ARGS>(args)...);
+ }
+
+ inline ucl::Naviframe &Page::getNaviframe()
+ {
+ UCL_ASSERT(m_navi, "m_navi is NULL");
+ return *m_navi;
+ }
+
+ inline bool Page::isAtTop() const
+ {
+ return (m_navi->getTopItem() == m_item);
+ }
+
+ inline bool Page::isAtBottom() const
+ {
+ return (m_navi->getBottomItem() == m_item);
+ }
+
+ // Non-member functions //
+
+ inline bool isLast(const Page &page)
+ {
+ return (page.isAtBottom() && page.isAtTop());
+ }
+}
--- /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 __GALLERY_PRESENTERS_PRESENTER_H__
+#define __GALLERY_PRESENTERS_PRESENTER_H__
+
+#include <unordered_set>
+
+#include "ucl/gui/Window.h"
+
+#include "types.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(Presenter);
+
+ class Presenter : public ucl::RefCountAware {
+ public:
+ struct DeactivatorInfo {
+ void *deactivator;
+ bool isBroadcast;
+ };
+
+ public:
+ bool isActive() const;
+ bool isDeactivatedBy(void *deactivator) const;
+
+ void activateBy(void *deactivator);
+ void deactivateBy(void *deactivator);
+
+ protected:
+ Presenter(ucl::RefCountObjBase &rc);
+ virtual ~Presenter();
+
+ ucl::Result prepare(ucl::ElmWidget &widget);
+
+ ucl::Window &getWindow();
+ bool isWindowReady() const;
+
+ void addDeactivatorSource(ucl::Widget &source);
+ void addDeactivatorException(void *deactivator);
+
+ void sendActivateBy(ucl::Widget &sender, void *deactivator);
+ void sendDeactivateBy(ucl::Widget &sender, void *deactivator);
+
+ void broadcastActivateBy(void *deactivator);
+ void broadcastDeactivateBy(void *deactivator);
+
+ virtual void onActivate();
+ virtual void onDeactivate();
+ virtual void onActivateBy(const DeactivatorInfo &info);
+ virtual void onDeactivateBy(const DeactivatorInfo &info);
+
+ private:
+ void sendDeactivator(ucl::Widget &sender,
+ ucl::SmartEvent event, void *deactivator);
+ void broadcastDeactivator(ucl::SmartEvent event, void *deactivator);
+
+ void sendDeactivatorInfo(ucl::Widget &sender, ucl::SmartEvent event,
+ const DeactivatorInfo &info);
+
+ void activateByImpl(const DeactivatorInfo &info);
+ void deactivateByImpl(const DeactivatorInfo &info);
+
+ void onActivateBySmart(ucl::Widget &widget, void *eventInfo);
+ void onDeactivateBySmart(ucl::Widget &widget, void *eventInfo);
+
+ private:
+ std::unordered_set<void *> m_deactivatorExceptions;
+ std::unordered_set<void *> m_deactivators;
+ ucl::WindowSRef m_window;
+ bool m_isPrepared;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_PRESENTER_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 __GALLERY_PRESENTERS_PREVIEW_PAGE_H__
+#define __GALLERY_PRESENTERS_PREVIEW_PAGE_H__
+
+#include "Page.h"
+
+#include "gallery/model/IMediaAlbum.h"
+
+#include "gallery/view/PageContent.h"
+#include "gallery/view/ImageGrid.h"
+
+#include "MoreOptionsPresenter.h"
+#include "SelectModePresenter.h"
+#include "AlertDialog.h"
+#include "ProcessingPresenter.h"
+#include "AtspiHighlightHelper.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(PreviewPage);
+
+ class PreviewPage final : public Page,
+ private ImageGrid::IListener,
+ private MoreOptionsPresenter::IListener,
+ private SelectModePresenter::IListener {
+ public:
+ class Builder {
+ public:
+ Builder();
+ ~Builder();
+ Builder &setNaviframe(const ucl::NaviframeSRef &navi);
+ Builder &setAlbum(const IMediaAlbumSRef &album);
+ Builder &setStartItemIndex(int index);
+ Builder &setSelectModeStartup(bool value);
+ Builder &setAutoSelectStartItem(bool value);
+ PreviewPageWRef build(
+ const ExitRequestHandler &onExitRequest) const;
+ private:
+ ucl::NaviframeSRef m_navi;
+ IMediaAlbumSRef m_album;
+ int m_startItemIndex;
+ bool m_selectModeStartup;
+ bool m_autoSelectStartItem;
+ };
+
+ public:
+ int getCurrentItemIndex() const;
+
+ private:
+ friend class ucl::RefCountObj<PreviewPage>;
+ PreviewPage(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
+ const ExitRequestHandler &onExitRequest,
+ const IMediaAlbumSRef &album, bool selectModeStartup);
+ virtual ~PreviewPage();
+
+ ucl::Result prepare(int startItemIndex);
+ void showItem(int itemIndex);
+ void selectItem(int itemIndex);
+ int getSafeItemIndex(int itemIndex) const;
+
+ void reload();
+ void checkViewerPage();
+
+ void onAlbumChanged();
+ bool onEachMedia(MediaItemSRef &&media);
+
+ void closeTempViews();
+ void switchToSelectMode();
+ void switchToNormalMode();
+ void toggleItemSelected(int itemIndex);
+ void confirmItemsDelete();
+ void openViewer(int itemIndex, int x, int y);
+
+ void onPageExitRequest(Page &page);
+
+ bool onAlertEvent(AlertDialog &dialog, int event);
+ void onJobComplete();
+
+ Elm_Interface_Atspi_Accessible *onAtspiHighlight(
+ ucl::Widget &widget, Elm_Atspi_Relation_Type flowRelation);
+
+ // Presenter //
+
+ virtual void onActivateBy(const DeactivatorInfo &info) final override;
+ virtual void onDeactivateBy(const DeactivatorInfo &info) final override;
+
+ // Page //
+
+ virtual void onBackKey() final override;
+
+ // ImageGrid::IListener //
+
+ virtual void onItemRealized(int itemIndex) final override;
+ virtual void onItemUnrealized(int itemIndex) final override;
+ virtual void onItemEvent(int itemIndex,
+ ImageGrid::ItemEvent event, int x, int y) final override;
+ virtual void onTransitionFinished() final override;
+ virtual Elm_Interface_Atspi_Accessible *onAccessObjectRequest(
+ bool isFlowsTo) final override;
+
+ // MoreOptionsPresenter::IListener //
+
+ virtual void onMoreOptionClicked(MoreOptionsPresenter &sender,
+ const MoreOptionsPresenter::Option &option) final override;
+
+ // SelectModePresenter::IListener //
+
+ virtual void onSelectModeEvent(
+ SelectModePresenter::Event event) final override;
+
+ private:
+ class Item;
+ using ItemSRef = ucl::SharedRef<Item>;
+
+ private:
+ const IMediaAlbumSRef m_album;
+ const bool m_selectModeStartup;
+ ImageGridSRef m_imageGrid;
+ std::vector<ItemSRef> m_items;
+ IJobSRef m_job;
+
+ PageContentSRef m_content;
+ MoreOptionsPresenterSRef m_more;
+ SelectModePresenterSRef m_smp;
+ AlertDialogWRef m_alert;
+ ProcessingPresenterSRef m_processing;
+ AtspiHighlightHelperSRef m_atspiHelper;
+
+ PageWRef m_page;
+ int m_selectCount;
+ bool m_isInSelectMode;
+ bool m_needReload;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_PREVIEW_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 __GALLERY_PRESENTERS_PROCESSING_PRESENTER_H__
+#define __GALLERY_PRESENTERS_PROCESSING_PRESENTER_H__
+
+#include "ucl/gui/Layout.h"
+#include "ucl/gui/StyledWidget.h"
+
+#include "Presenter.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(ProcessingPresenter);
+
+ class ProcessingPresenter final : public Presenter {
+ public:
+ enum class IconType {
+ NONE,
+ CHECK
+ };
+
+ class Builder {
+ public:
+ Builder();
+ Builder &setProcessingText(ucl::TString text);
+ Builder &setForceProgress(bool value);
+ ProcessingPresenterSRef build(ucl::ElmWidget &parent) const;
+ private:
+ ucl::TString m_processingText;
+ bool m_forceProgress;
+ };
+
+ using DismissHandler = ucl::WeakDelegate<void()>;
+
+ public:
+ void complete(const ucl::TString &completeText,
+ IconType iconType = IconType::NONE);
+
+ void setDismissHandler(const DismissHandler &handler);
+
+ private:
+ friend class ucl::RefCountObj<ProcessingPresenter>;
+ ProcessingPresenter(ucl::RefCountObjBase &rc);
+ virtual ~ProcessingPresenter();
+
+ ucl::Result prepare(ucl::ElmWidget &parent,
+ const ucl::TString &processingText,
+ bool forceProgress);
+
+ ucl::Result createWidget(ucl::ElmWidget &parent,
+ const ucl::TString &processingText);
+ ucl::Result moveWidget();
+ ucl::Result createProgress();
+ ucl::Result createPopup();
+ ucl::Result createIcon();
+
+ bool resetTimer(double timeout);
+ void stopTimer();
+
+ void showProgress();
+
+ void tryShowPopup();
+ void dismissPopup();
+ void deletePopup();
+
+ void animateIcon();
+
+ Eina_Bool onTimer();
+
+ void onPopupDismissed(ucl::Widget &widget, void *eventInfo);
+ void onPopupHWBackKey(Evas_Object *obj, void *eventInfo);
+
+ private:
+ enum class State {
+ WAITING,
+ PROCESSING,
+ POPUP_ANIMATION,
+ COMPLETE
+ };
+
+ private:
+ ucl::LayoutSRef m_widget;
+ ucl::StyledWidgetSRef m_popup;
+ ucl::LayoutWRef m_icon;
+ IconType m_iconType;
+ DismissHandler m_dismissHandler;
+ Ecore_Timer *m_timer;
+ State m_state;
+ bool m_mayComplete;
+ bool m_isComplete;
+ bool m_isDismissed;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_PROCESSING_PRESENTER_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 __GALLERY_PRESENTERS_SELECT_MODE_PRESENTER_H__
+#define __GALLERY_PRESENTERS_SELECT_MODE_PRESENTER_H__
+
+#include "ucl/gui/StyledWidget.h"
+
+#include "Presenter.h"
+
+#include "gallery/view/PageContent.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(SelectModePresenter);
+
+ class SelectModePresenter final : public Presenter {
+ public:
+ UCL_DECLARE_REF_ALIASES(IListener);
+
+ enum {
+ FLAG_NO_BOTTOM_BUTTON = 1,
+ FLAG_NO_MORE_OPTIONS = 2,
+ FLAG_NO_DIM_ON_ZERO_SELECT = 4,
+ FLAG_NO_DISMISS_ON_ROTARY = 8
+ };
+
+ class Builder {
+ public:
+ Builder();
+ Builder &setFlags(int flags);
+ SelectModePresenterSRef build(PageContent &content) const;
+ private:
+ int m_flags;
+ };
+
+ enum class Event {
+ SELECT_ALL,
+ DESELECT_ALL,
+ BOTTOM_BUTTON_CLICK
+ };
+
+ class IListener : public ucl::Polymorphic {
+ public:
+ virtual void onSelectModeEvent(Event event) = 0;
+ };
+
+ public:
+ void setListener(const IListenerWRef &listener);
+
+ void setVisible(bool value);
+ bool isVisible() const;
+
+ ucl::ElmWidget &getSelectButton();
+ ucl::ElmWidget &getBottomButton();
+
+ void setBottomButtonText(const ucl::TString &value);
+
+ void update(int selectCount, int totalCount = -1);
+
+ private:
+ friend class ucl::RefCountObj<SelectModePresenter>;
+ SelectModePresenter(ucl::RefCountObjBase &rc,
+ PageContent &content, int flags);
+ virtual ~SelectModePresenter();
+
+ ucl::Result prepare();
+
+ void doUpdate();
+
+ void showPopup();
+ void movePopup();
+ void dismissPopup();
+ void deletePopup();
+
+ void dispatchEvent(Event event);
+
+ void onPopupDismissed(ucl::Widget &widget, void *eventInfo);
+ void onPopupHWBackKey(Evas_Object *obj, void *eventInfo);
+
+ void onSelectAll(Evas_Object *obj, void *eventInfo);
+ void onDeselectAll(Evas_Object *obj, void *eventInfo);
+
+ void onSelectBtnClick(ucl::Widget &widget, void *eventInfo);
+ void onBottomBtnClick(ucl::Widget &widget, void *eventInfo);
+ Eina_Bool onRotary(Eext_Rotary_Event_Info *info);
+
+ // Presenter //
+ virtual void onDeactivate() final override;
+
+ private:
+ const PageContentSRef m_content;
+ const int m_flags;
+ ucl::StyledWidgetSRef m_selectButton;
+ ucl::StyledWidgetSRef m_bottomButton;
+ ucl::StyledWidgetSRef m_popup;
+ IListenerWRef m_listener;
+ int m_totalCount;
+ int m_selectCount;
+ bool m_isVisible;
+ bool m_isPopupDismissed;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_SELECT_MODE_PRESENTER_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 __GALLERY_PRESENTERS_THUMBNAIL_PAGE_H__
+#define __GALLERY_PRESENTERS_THUMBNAIL_PAGE_H__
+
+#include "Page.h"
+
+#include "gallery/model/IMediaAlbum.h"
+
+#include "gallery/view/PageContent.h"
+#include "gallery/view/ImageGrid.h"
+
+#include "MoreOptionsPresenter.h"
+#include "AtspiHighlightHelper.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(ThumbnailPage);
+
+ class ThumbnailPage final : public Page,
+ private ImageGrid::IListener,
+ private MoreOptionsPresenter::IListener {
+ public:
+ class Builder {
+ public:
+ Builder();
+ ~Builder();
+ Builder &setNaviframe(const ucl::NaviframeSRef &navi);
+ Builder &setAlbum(const IMediaAlbumSRef &album);
+ ThumbnailPageWRef build(
+ const ExitRequestHandler &onExitRequest) const;
+ private:
+ ucl::NaviframeSRef m_navi;
+ IMediaAlbumSRef m_album;
+ };
+
+ private:
+ friend class ucl::RefCountObj<ThumbnailPage>;
+ ThumbnailPage(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
+ const ExitRequestHandler &onExitRequest,
+ const IMediaAlbumSRef &album);
+ virtual ~ThumbnailPage();
+
+ ucl::Result prepare();
+
+ void reload();
+
+ int getSafeItemIndex(int itemIndex) const;
+
+ void onAlbumChanged();
+ bool onEachMedia(MediaItemSRef &&media);
+
+ void onPageExitRequest(Page &page);
+
+ Elm_Interface_Atspi_Accessible *onAtspiHighlight(
+ ucl::Widget &widget, Elm_Atspi_Relation_Type flowRelation);
+
+ // Presenter //
+
+ virtual void onActivateBy(const DeactivatorInfo &info) final override;
+ virtual void onDeactivateBy(const DeactivatorInfo &info) final override;
+
+ // ImageGrid::IListener //
+
+ virtual void onItemRealized(int itemIndex) final override;
+ virtual void onItemUnrealized(int itemIndex) final override;
+ virtual void onItemEvent(int itemIndex,
+ ImageGrid::ItemEvent event, int x, int y) final override;
+
+ // MoreOptionsPresenter::IListener //
+
+ virtual void onMoreOptionClicked(MoreOptionsPresenter &sender,
+ const MoreOptionsPresenter::Option &option) final override;
+
+ private:
+ class RealizedItem;
+ using RealizedItemSRef = ucl::SharedRef<RealizedItem>;
+
+ private:
+ const IMediaAlbumSRef m_album;
+ MediaItems m_mediaItems;
+
+ std::vector<RealizedItemSRef> m_realizedItems;
+
+ PageContentSRef m_content;
+ ImageGridSRef m_imageGrid;
+ MoreOptionsPresenterSRef m_more;
+ AtspiHighlightHelperSRef m_atspiHelper;
+
+ PageWRef m_page;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_THUMBNAIL_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 __GALLERY_PRESENTERS_VIDEO_PLAYER_PAGE_H__
+#define __GALLERY_PRESENTERS_VIDEO_PLAYER_PAGE_H__
+
+#include <player.h>
+
+#include "ucl/gui/Layout.h"
+
+#include "Page.h"
+
+#include "gallery/model/SoundManager.h"
+#include "gallery/model/MediaItem.h"
+
+#include "gallery/view/TouchParser.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(VideoPlayerPage);
+
+ class VideoPlayerPage final : public Page {
+ public:
+ class Builder {
+ public:
+ Builder();
+ ~Builder();
+ Builder &setNaviframe(const ucl::NaviframeSRef &navi);
+ Builder &setMedia(const MediaItemSRef &media);
+ VideoPlayerPageWRef build(
+ const ExitRequestHandler &onExitRequest) const;
+ private:
+ ucl::NaviframeSRef m_navi;
+ MediaItemSRef m_media;
+ };
+
+ private:
+ friend class ucl::RefCountObj<VideoPlayerPage>;
+ VideoPlayerPage(ucl::RefCountObjBase &rc,
+ const ucl::NaviframeSRef &navi,
+ const ExitRequestHandler &onExitRequest,
+ const MediaItemSRef &media);
+ virtual ~VideoPlayerPage();
+
+ ucl::Result prepare();
+
+ ucl::Result prepareSoundManager();
+
+ void createImage();
+ ucl::Result preparePlayer();
+ ucl::Result seekToStart();
+
+ void createControls();
+ ucl::StyledWidgetSRef createButton(ucl::ElmStyle style,
+ ucl::EdjePart part, const ucl::WidgetEventHandler &handler);
+
+ bool resetTimer(Ecore_Timer *&timer, double timeout, Ecore_Task_Cb func);
+ void stopTimer(Ecore_Timer *&timer);
+
+ bool resetAutoStartTimer();
+ bool resetControlsHideTimer();
+ bool resetTickTimer();
+
+ void showControls();
+ void hideControls();
+ void showVolumeBtn();
+
+ bool updatePlayTimeText();
+ void updatePlayTimeText(int timeMs);
+
+ player_state_e getPlayerState() const;
+ void startPlayback();
+ void pausePlayback();
+
+ void setScreenAlwaysOn(bool isAlwaysOn);
+
+ ucl::Result launchVolumeSettings();
+
+ void onMediaDeviceStateChanged();
+ void onMediaVolumeChanged();
+
+ void onPlaybackComplete();
+ void onPlaybackInterrupted(player_interrupted_code_e code);
+ void onSeekComplete();
+
+ Eina_Bool onAutoStartTimer();
+ Eina_Bool onControlsHideTimer();
+ Eina_Bool onTickTimer();
+
+ void onVolumeBtnClick(ucl::Widget &sender, void *eventInfo);
+ void onPlayBtnClick(ucl::Widget &sender, void *eventInfo);
+ void onPauseBtnClick(ucl::Widget &sender, void *eventInfo);
+ void onTap(int x, int y);
+ Eina_Bool onRotary(Eext_Rotary_Event_Info *info);
+
+ void onInstancePaused(ucl::Widget &sender, void *eventInfo);
+ void onInstanceResumed(ucl::Widget &sender, void *eventInfo);
+
+ private:
+ enum class State {
+ PAUSED,
+ PLAYING
+ };
+
+ private:
+ const MediaItemSRef m_media;
+ SoundManagerSRef m_soundMgr;
+ ucl::LayoutSRef m_content;
+ ucl::WidgetSRef m_image;
+ ucl::StyledWidgetSRef m_volumeMuteBtn;
+ TouchParserSRef m_touchParser;
+ player_h m_player;
+ int m_videoDuration;
+ Ecore_Timer *m_autoStartTimer;
+ Ecore_Timer *m_controlsHideTimer;
+ Ecore_Timer *m_tickTimer;
+ State m_state;
+ bool m_isControlsVisible;
+ bool m_needAutoStart;
+ bool m_isPlaybackCompleted;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_VIDEO_PLAYER_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 __GALLERY_PRESENTERS_VIEWER_PAGE_H__
+#define __GALLERY_PRESENTERS_VIEWER_PAGE_H__
+
+#include "Page.h"
+
+#include "gallery/model/MediaItem.h"
+
+#include "gallery/view/PageContent.h"
+#include "gallery/view/ImageViewer.h"
+#include "gallery/view/TouchParser.h"
+
+#include "MoreOptionsPresenter.h"
+#include "ProcessingPresenter.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(ViewerPage);
+
+ class ViewerPage final : public Page,
+ private MoreOptionsPresenter::IListener {
+ public:
+ class Builder {
+ public:
+ Builder();
+ ~Builder();
+ Builder &setNaviframe(const ucl::NaviframeSRef &navi);
+ Builder &setMedia(const MediaItemSRef &media);
+ Builder &setZoomIn(int x, int y);
+ Builder &setImageLoadSize(int size, bool isFull);
+ Builder &setExitOnZoomOut(bool value);
+ ViewerPageWRef build(
+ const ExitRequestHandler &onExitRequest) const;
+ private:
+ ucl::NaviframeSRef m_navi;
+ MediaItemSRef m_media;
+ int m_zoomInX;
+ int m_zoomInY;
+ int m_imageLoadSize;
+ bool m_isImageLoadSizeFull;
+ bool m_exitOnZoomOut;
+ };
+
+ public:
+ const std::string &getMediaId() const;
+
+ private:
+ friend class ucl::RefCountObj<ViewerPage>;
+ ViewerPage(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
+ const ExitRequestHandler &onExitRequest,
+ const MediaItemSRef &media, bool exitOnZoomOut);
+ virtual ~ViewerPage();
+
+ ucl::Result prepare(int imageLoadSize, bool isImageLoadSizeFull);
+
+ void zoomIn(int originX, int originY);
+
+ void onThumbnail(ucl::Result result, const std::string &path);
+ void onZoomEnd(ucl::Widget &widget, void *eventInfo);
+ void onDoubleTap(int x, int y);
+
+ void onJobComplete();
+
+ // Presenter //
+
+ virtual void onActivateBy(const DeactivatorInfo &info) final override;
+ virtual void onDeactivateBy(const DeactivatorInfo &info) final override;
+
+ // Page //
+
+ virtual void onBackKey() final override;
+
+ // MoreOptionsPresenter::IListener //
+
+ virtual void onMoreOptionClicked(MoreOptionsPresenter &sender,
+ const MoreOptionsPresenter::Option &option) final override;
+
+ private:
+ const MediaItemSRef m_media;
+ const bool m_exitOnZoomOut;
+ ImageViewerSRef m_imageViewer;
+ TouchParserSRef m_touchParser;
+ IJobSRef m_job;
+ PageContentSRef m_content;
+ MoreOptionsPresenterSRef m_more;
+ ProcessingPresenterSRef m_processing;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_VIEWER_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 __GALLERY_PRESENTERS_TYPES_H__
+#define __GALLERY_PRESENTERS_TYPES_H__
+
+#include "gallery/view/types.h"
+#include "gallery/model/types.h"
+
+#endif // __GALLERY_PRESENTERS_TYPES_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 __GALLERY_RESOURCES_H__
+#define __GALLERY_RESOURCES_H__
+
+#include "ucl/misc/TString.h"
+
+#include "config.h"
+
+namespace gallery {
+
+ constexpr auto THEME_EDJE_PATH = "edje/theme.edj";
+
+ constexpr auto ICON_NO_PHOTOS = "gallery_icon_no_photos.png";
+
+ constexpr auto ICON_MORE_OPT_DELETE = "gallery_more_opt_delete.png";
+ constexpr auto ICON_MORE_OPT_SAVE = "gallery_more_opt_save.png";
+ constexpr auto ICON_MORE_OPT_SEND = "gallery_more_opt_send_to_mobile.png";
+
+ constexpr auto ICON_POPUP_OK = "tw_ic_popup_btn_check.png";
+ constexpr auto ICON_POPUP_CANCEL = "tw_ic_popup_btn_delete.png";
+
+ extern const ucl::TString STR_APP_NAME;
+ extern const ucl::TString STR_NO_PHOTOS;
+ extern const ucl::TString STR_SELECT_ALL;
+ extern const ucl::TString STR_DESELECT_ALL;
+ extern const ucl::TString STR_DELETE;
+ extern const ucl::TString STR_DELETE_CAPS;
+ extern const ucl::TString STR_DELETE_1_PHOTO;
+ extern const ucl::TString STR_DELETE_N_PHOTO;
+ extern const ucl::TString STR_DELETING;
+ extern const ucl::TString STR_DELETED;
+ extern const ucl::TString STR_FAILED;
+ extern const ucl::TString STR_SAVE_TO_GEAR;
+ extern const ucl::TString STR_SAVING;
+ extern const ucl::TString STR_SAVED;
+}
+
+#endif // __GALLERY_RESOURCES_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 __GALLERY_TYPES_H__
+#define __GALLERY_TYPES_H__
+
+#include "config.h"
+
+#include "ucl/util/types.h"
+#include "ucl/util/memory.h"
+#include "ucl/util/delegation.h"
+#include "ucl/util/smartDelegation.h"
+
+namespace gallery {
+
+ using NotiHandler = ucl::WeakDelegate<void()>;
+}
+
+#endif // __GALLERY_TYPES_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 __GALLERY_VIEW_IMAGE_GRID_H__
+#define __GALLERY_VIEW_IMAGE_GRID_H__
+
+#include <deque>
+
+#include "ucl/gui/StyledWidget.h"
+
+#include "ucl/misc/Timeout.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(ImageGrid);
+
+ class ImageGrid : public ucl::ElmWidget {
+ public:
+ UCL_DECLARE_REF_ALIASES(IListener);
+
+ enum class Type {
+ HCOMB_3X3,
+ LINEAR
+ };
+
+ class Builder {
+ public:
+ Builder();
+ Builder &setType(Type value);
+ Builder &setListener(const IListenerWRef &value);
+ Builder &setSelectModeStartup(bool value);
+ ImageGridSRef build(ElmWidget &parent) const;
+ private:
+ Type m_type;
+ IListenerWRef m_listener;
+ bool m_selectModeStartup;
+ };
+
+ enum class ItemEvent {
+ CLICK,
+ DOUBLE_TAP,
+ TAP_AND_HOLD
+ };
+
+ class IListener : public ucl::Polymorphic {
+ public:
+ virtual void onItemRealized(int itemIndex) = 0;
+ virtual void onItemUnrealized(int itemIndex) = 0;
+ virtual void onItemEvent(int itemIndex,
+ ItemEvent event, int x, int y) = 0;
+ virtual void onTransitionFinished() {}
+ virtual Elm_Interface_Atspi_Accessible *onAccessObjectRequest(
+ bool isFlowsTo) { return nullptr; }
+ };
+
+ enum {
+ UF_LOSE_IMAGE = 1,
+ UF_LOSE_BG = 2,
+ UF_BLOCK_CLICKS = 4,
+ UF_SELECTED = 8
+ };
+
+ struct ItemParams {
+ std::string imagePath;
+ std::string bgImagePath;
+ int imageWidth;
+ int imageHeight;
+ int flags;
+ };
+
+ struct ItemInfo {
+ int imageLoadSize;
+ bool isImageLoadSizeFull;
+ bool isImageLoaded;
+ };
+
+ class Unrealizer : ucl::NonCopyable {
+ public:
+ Unrealizer(ImageGrid &imageGrid);
+ ~Unrealizer();
+ private:
+ ImageGrid &m_imageGrid;
+ };
+
+ public:
+ void setListener(const IListenerWRef &listener);
+
+ ucl::Result setItemCount(int count);
+
+ ucl::Result setSelectModeEnabled(bool enabled);
+ bool isInSelectMode() const;
+ bool isInTransition() const;
+
+ void update();
+
+ ucl::Result updateItem(int itemIndex, const ItemParams ¶ms);
+
+ ucl::Result isItemRealized(int itemIndex) const;
+
+ ucl::Result getItemInfo(int itemIndex, ItemInfo &info) const;
+ Elm_Interface_Atspi_Accessible *getAccessObject(bool isFlowsTo);
+
+ int getScrolledToItemIndex() const;
+ ucl::Result scrollToItem(int itemIndex);
+ ucl::Result bringInItem(int itemIndex);
+
+ void activateRotary();
+ void deactivateRotary();
+
+ private:
+ class Slot;
+ using SlotUPtr = std::unique_ptr<Slot>;
+
+ struct Info;
+ struct HcombInfo;
+ struct LinearInfo;
+
+ private:
+ friend class ucl::RefCountObj<ImageGrid>;
+ ImageGrid(ucl::RefCountObjBase *rc, Evas_Object *scroller,
+ Type type, bool selectModeStartup);
+ virtual ~ImageGrid();
+
+ static const Info &getInfo(Type type);
+
+ template <class FUNC>
+ ucl::Result doWithItem(int itemIndex, FUNC &&func) const;
+ template <class FUNC>
+ ucl::Result doWithCell(int itemIndex, FUNC &&func) const;
+
+ template <class SHOW_FUNC>
+ ucl::Result showItem(int itemIndex, SHOW_FUNC &&showFunc);
+
+ bool isItemFullyVisible(int itemIndex);
+ bool isItemFullyVisible(int itemIndex,
+ int &minVisibleOffset, int &maxVisibleOffset) const;
+ bool isItemFullyVisible(int slotIndex, int itemOffset,
+ int &minVisibleOffset, int &maxVisibleOffset) const;
+
+ void forceBoxSizeCalculate();
+
+ void addUnrealizeLock();
+ void removeUnrealizeLock();
+
+ void handleItemEvent(int itemIndex,
+ ItemEvent event, int x, int y) const;
+
+ // Accessibility
+
+ void onItemHighlighted(int itemIndex);
+ void onItemUnhighlighted(int itemIndex);
+ void onKeeperUnhighlighted(Widget &sender, void *eventInfo);
+
+ void updateHighlightTimeout();
+ void onHighlightTimeout(ucl::Timeout *sender);
+
+ Elm_Interface_Atspi_Accessible *requestAtspi(int itemIndex);
+ Elm_Interface_Atspi_Accessible *getItemAtspi(int itemIndex);
+
+ // Selection mode hanling
+ void evalSlotSizes();
+ void finalizeTransition();
+ Eina_Bool onAnimationFrame();
+ void onSlotResize(Widget &widget, void *eventInfo);
+ void onBoxResize(Evas *e, Evas_Object *obj, void *eventInfo);
+ void onTransitonFinished(Evas_Object *obj, const char *emission,
+ const char *source);
+
+ // Initialization
+ void prepare();
+ void createCircleScroller();
+ void createHighlighKeeper();
+
+ // Actual slots count
+ bool updateSlotCount();
+ int calcSlotCount();
+ void setSlotCount(int newSlotCount);
+
+ // Optimal slots count
+ bool updateOptimalSlotCount();
+ int calcOptimalSlotCount();
+
+ // Maximum slots count
+ bool updateMaxSlotCount();
+ int calcMaxSlotCount();
+
+ // Actual begin slot index
+ bool updateBeginSlotIndex();
+ int calcBeginSlotIndex();
+ void setBeginSlotIndex(int newBeginSlotIndex);
+
+ // Maximum begin slot index
+ bool updateMaxBeginSlotIndex();
+ int calcMaxBeginSlotIndex();
+
+ // Misc
+ void updatePadSizes();
+ void updateScrollBias();
+ void updateRectMins();
+
+ // Slot size
+ bool updateSlotSize();
+ void setSlotSize(int newSlotSize);
+
+ // Scroller size
+ bool updateScrollerSize();
+ int calcScrollerSize();
+
+ // Scroller scroll offset
+ bool updateScrollOffset();
+ int calcScrollOffset();
+
+ // Slots rotations
+ void rotateSlotsRight(int count);
+ void rotateSlotsLeft(int count);
+
+ // Slots realization/unrealization
+ void realizeSlots();
+ void unrealizeSlots(int beginSlotOffset, int endSlotOffset);
+
+ // Event handling
+ void handleScrolling();
+ void handleResize();
+
+ // Events
+ void onScrollerResize(Widget &sender, void *eventInfo);
+ void onScrollerMove(Widget &sender, void *eventInfo);
+ void onBoxMove(Widget &sender, void *eventInfo);
+
+ private:
+ const Info &m_info;
+
+ ucl::StyledWidgetWRef m_scroller;
+ ucl::ElmWidget m_box;
+ ucl::Widget m_rect1;
+ ucl::Widget m_rect2;
+ Evas_Object *m_circleScroller;
+
+ IListenerWRef m_listener;
+ int m_itemCount;
+
+ std::deque<SlotUPtr> m_slots;
+
+ int m_slotCount;
+ int m_optimalSlotCount;
+ int m_maxSlotCount;
+
+ int m_beginSlotIndex;
+ int m_maxBeginSlotIndex;
+
+ int m_scrollBias;
+ int m_padSize1;
+ int m_padSize2;
+
+ int m_slotSize;
+ int m_scrollerSize;
+ int m_scrollOffset;
+
+ int m_unrealizeLock;
+ int m_eventsLock;
+
+ Ecore_Animator *m_animator;
+ int m_scrollLockIndex;
+ bool m_isInSelectMode;
+ bool m_isRotaryActive;
+
+ ucl::ElmWidgetSRef m_highlighKeeper;
+ ucl::TimeoutSRef m_highlightTimeout;
+ int m_highlightID;
+ bool m_isHighlightLocked;
+ };
+}
+
+#endif // __GALLERY_VIEW_IMAGE_GRID_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 __GALLERY_VIEW_IMAGE_VIEWER_H__
+#define __GALLERY_VIEW_IMAGE_VIEWER_H__
+
+#include "ucl/gui/StyledWidget.h"
+#include "ucl/gui/Layout.h"
+
+#include "types.h"
+
+namespace gallery {
+
+ constexpr ucl::SmartEvent IMAGE_VIEWER_ZOOM_END {"gallery,zoom,end"};
+
+ UCL_DECLARE_REF_ALIASES(ImageViewer);
+
+ class ImageViewer final : public ucl::ElmWidget {
+ public:
+ class Builder {
+ public:
+ Builder();
+ Builder &setHighResImagePath(std::string path);
+ Builder &setLoadSize(int value);
+ Builder &setForceLoad(bool value);
+ ImageViewerSRef build(ucl::ElmWidget &parent) const;
+ private:
+ std::string m_highResPath;
+ int m_loadSize;
+ bool m_forceLoad;
+ };
+
+ public:
+ void setLowResImagePath(const std::string &path);
+ bool zoomIn(int originX, int originY);
+ bool zoomOut();
+
+ bool isZooming() const;
+ bool isZoomedIn() const;
+ bool isZoomedOut() const;
+
+ private:
+ friend class ucl::RefCountObj<ImageViewer>;
+ ImageViewer(ucl::RefCountObjBase &rc, Evas_Object *scroller,
+ const std::string &highResPath, int loadSize, bool forceLoad);
+ virtual ~ImageViewer();
+
+ void prepare(const std::string &highResPath,
+ int loadSize, bool forceLoad);
+
+ void onImagePreloaded(ucl::Widget &widget, void *eventInfo);
+ void onScrollerResize(ucl::Widget &widget, void *eventInfo);
+
+ bool updateScrollerSize();
+ void updateScales();
+ void updateGridSize();
+ void updateScrollOffset();
+
+ void calcZoomInFactors(int originX, int originY);
+ void calcZoomOutFactors();
+ void startAnimation();
+
+ Eina_Bool onAnimationStartTimer();
+ Eina_Bool onAnimationFrame(double pos);
+
+ private:
+ enum class State {
+ ZOOMED_OUT,
+ ZOOMED_IN,
+ ZOOMING_OUT,
+ ZOOMING_IN
+ };
+
+ private:
+ ucl::StyledWidgetWRef m_scroller;
+ ucl::Layout m_layout;
+ ucl::Widget m_grid;
+ ucl::Widget m_lowResImage;
+ ucl::Widget m_highResImage;
+
+ int m_imageW;
+ int m_imageH;
+
+ int m_scrollerW;
+ int m_scrollerH;
+ int m_gridW;
+ int m_gridH;
+ double m_scale0;
+ double m_scale1;
+
+ double m_xf1;
+ double m_yf1;
+ double m_xf2;
+ double m_yf2;
+ double m_zoom;
+
+ Ecore_Timer *m_animationStartTimer;
+ Ecore_Animator *m_animator;
+ State m_state;
+ };
+}
+
+#endif // __GALLERY_VIEW_IMAGE_VIEWER_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 __GALLERY_VIEW_PAGE_CONTENT_H__
+#define __GALLERY_VIEW_PAGE_CONTENT_H__
+
+#include "ucl/gui/Layout.h"
+
+#include "types.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(PageContent);
+
+ class PageContent : public ucl::ElmWidget {
+ public:
+ class Builder {
+ public:
+ Builder();
+ Builder &setFlags(int flags);
+ PageContentSRef build(ucl::ElmWidget &parent) const;
+ private:
+ int m_flags;
+ };
+
+ enum {
+ FLAG_MORE_OPTIONS = 1,
+ FLAG_SELECT_BUTTON = 2,
+ FLAG_BOTTOM_BUTTON = 4,
+
+ FLAGS_SELECT_MODE = (FLAG_SELECT_BUTTON | FLAG_BOTTOM_BUTTON),
+ FLAGS_ALL = (FLAG_MORE_OPTIONS | FLAGS_SELECT_MODE)
+ };
+
+ enum class Part {
+ DEFAULT,
+ OVERLAY,
+ MORE_OPTIONS,
+ SELECT_BUTTON,
+ BOTTOM_BUTTON
+ };
+
+ public:
+ ucl::Result set(Evas_Object *eo, Part part = Part::DEFAULT);
+ Evas_Object *unset(Part part = Part::DEFAULT);
+
+ Evas_Object *get(Part part = Part::DEFAULT) const;
+
+ ucl::Result setSelectButtonVisible(bool visible);
+ ucl::Result setMoreOptionsVisible(bool visible);
+
+ private:
+ friend class ucl::RefCountObj<PageContent>;
+ PageContent(ucl::RefCountObjBase &rc,
+ const ucl::LayoutSRef &layout, int flags);
+ virtual ~PageContent();
+
+ void prepare(int flags);
+
+ template <class FUNC>
+ ucl::Result doWithPart(Part part, FUNC &&func) const;
+
+ ucl::Layout *getTopLayout() const;
+
+ private:
+ ucl::LayoutWRef m_moreOptions;
+ ucl::LayoutSRef m_selectMode;
+ ucl::LayoutSRef m_bottomButton;
+ };
+}
+
+#endif // __GALLERY_VIEW_PAGE_CONTENT_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 __GALLERY_VIEW_TOUCH_PARSER_H__
+#define __GALLERY_VIEW_TOUCH_PARSER_H__
+
+#include "ucl/gui/Widget.h"
+
+#include "types.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(TouchParser);
+
+ class TouchParser final : public ucl::RefCountAware {
+ public:
+ using TapHandler = ucl::WeakDelegate<void(int x, int y)>;
+
+ private:
+ friend class ucl::RefCountObj<TouchParser>;
+ TouchParser(ucl::RefCountObjBase &rc, ucl::Widget &eventSource);
+ virtual ~TouchParser();
+
+ public:
+ void setTapHandler(const TapHandler &handler);
+ void setDoubleTapHandler(const TapHandler &handler);
+ void setTapAndHoldHandler(const TapHandler &handler);
+
+ private:
+ void onMouseDown(ucl::Widget &widget, void *eventInfo);
+ void onMouseUp(ucl::Widget &widget, void *eventInfo);
+ void onMouseMove(ucl::Widget &widget, void *eventInfo);
+
+ void updateIsTapPossible(int flags, int curX, int curY);
+
+ bool isFastTap(ucl::UInt curTime, int curX, int curY) const;
+ double calcDownDistance(int curX, int curY) const;
+
+ void restartHoldTimer();
+ void stopHoldTimer();
+ Eina_Bool onHoldTimer();
+
+ private:
+ TapHandler m_tapHandler;
+ TapHandler m_doubleTapHandler;
+ TapHandler m_tapAndHoldHandler;
+ Ecore_Timer *m_holdTimer;
+ ucl::UInt m_downTime;
+ int m_downX;
+ int m_downY;
+ int m_tapCounter;
+ bool m_isMouseDown;
+ bool m_isTapPossible;
+ };
+}
+
+#endif // __GALLERY_VIEW_TOUCH_PARSER_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 __GALLERY_VIEW_HELPERS_H__
+#define __GALLERY_VIEW_HELPERS_H__
+
+#include "ucl/gui/Naviframe.h"
+
+#include "types.h"
+
+namespace gallery { namespace util {
+
+ ucl::Result createCircleSurface(ucl::Naviframe &navi);
+ Eext_Circle_Surface *getCircleSurface(const ucl::ElmWidget &widget);
+
+ ucl::ElmWidgetSRef createFakeAccessObject(ucl::ElmWidget &parent);
+}}
+
+namespace gallery {
+
+ void addRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data);
+ void delRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data);
+
+ ucl::LayoutTheme getImageTheme(const char *fileName);
+
+ Elm_Atspi_Relation_Type getFlowRelation(Elm_Atspi_Gesture_Info gestureInfo);
+}
+
+#endif // __GALLERY_VIEW_HELPERS_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 __GALLERY_VIEW_TYPES_H__
+#define __GALLERY_VIEW_TYPES_H__
+
+#include <efl_extension.h>
+
+#include "ucl/gui/types.h"
+
+#include "gallery/types.h"
+
+#endif // __GALLERY_VIEW_TYPES_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 __GALLERY_MODEL_GALLERY_H__
-#define __GALLERY_MODEL_GALLERY_H__
-
-#include "IMediaAlbum.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(Gallery);
-
- class Gallery final : public ucl::NonCopyable {
- public:
- static GallerySRef newInstance();
- ~Gallery();
-
- IMediaAlbumSRef getAlbum();
-
- private:
- friend class ucl::RefCountObj<Gallery>;
- Gallery();
-
- ucl::Result prepare();
-
- private:
- IMediaAlbumSRef m_album;
- bool m_isMediaDbConnected;
- };
-}
-
-#endif // __GALLERY_MODEL_GALLERY_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 __GALLERY_MODEL_I_JOB_H__
-#define __GALLERY_MODEL_I_JOB_H__
-
-#include "types.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(IJob);
-
- class IJob : public ucl::Polymorphic {
- public:
- virtual ucl::Result getResult() const = 0;
- virtual bool isCancelable() const = 0;
- virtual ucl::Result cancel() = 0;
- };
-}
-
-#endif // __GALLERY_MODEL_I_JOB_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 __GALLERY_MODEL_I_MEDIA_ALBUM_H__
-#define __GALLERY_MODEL_I_MEDIA_ALBUM_H__
-
-#include "MediaItem.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(IMediaAlbum);
-
- class IMediaAlbum : public ucl::Polymorphic {
- public:
- using EachCb = ucl::Delegate<bool(MediaItemSRef &&media)>;
-
- public:
- virtual void addChangeHandler(const NotiHandler &handler) = 0;
- virtual void delChangeHandler(const NotiHandler &handler) = 0;
-
- virtual ucl::Result forEachMedia(EachCb cb) const = 0;
- virtual ucl::Result getMediaCount(int &count) const = 0;
-
- virtual void defragment() = 0;
- };
-
- // Non-member functions //
-
- bool isEmpty(const IMediaAlbum &album);
-}
-
-#include "IMediaAlbum.hpp"
-
-#endif // __GALLERY_MODEL_I_MEDIA_ALBUM_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 "ucl/util/logging.h"
-
-namespace gallery {
-
- // Non-member functions //
-
- inline bool isEmpty(const IMediaAlbum &album)
- {
- int count = 0;
- UCL_FAIL_RETURN_VALUE(album.getMediaCount(count), true,
- "album.getMediaCount() failed!");
- return (count == 0);
- }
-}
+++ /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 __GALLERY_MODEL_MEDIA_ITEM_H__
-#define __GALLERY_MODEL_MEDIA_ITEM_H__
-
-#include <vector>
-
-#include <media_content.h>
-
-#include "ucl/misc/AutoHandle.h"
-
-#include "IJob.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(MediaItem);
-
- using MediaItems = std::vector<MediaItemSRef>;
-
- class MediaItem : public ucl::Polymorphic {
- public:
- using ThumbnailPathGetCb =
- ucl::WeakDelegate<void(ucl::Result, const std::string &path)>;
-
- class Remover;
- class RemoverBuilder final {
- public:
- RemoverBuilder &setItems(MediaItems items);
- IJobSRef build(const NotiHandler &onComplete) const;
- private:
- ucl::SharedRef<MediaItems> m_items;
- };
-
- class Saver;
- class SaverBuilder final {
- public:
- SaverBuilder &setItem(const MediaItemSRef &item);
- IJobSRef build(const NotiHandler &onComplete) const;
- private:
- MediaItemSRef m_item;
- };
-
- enum {
- FLAG_THUMBNAIL = 1,
- FLAG_REMOVE = 2,
- FLAG_SAVE = 4,
- FLAG_RESOLUTION = 8,
-
- FLAGS_FROM_MEDIA_DB = (FLAG_THUMBNAIL | FLAG_REMOVE |
- FLAG_RESOLUTION),
- FLAGS_SIMPLE_FILE = (FLAG_SAVE)
- };
-
- public:
- static MediaItemSRef newInstance(media_info_h media);
- static MediaItemSRef newInstance(std::string filePath);
- virtual ~MediaItem();
-
- bool isValid() const;
- int getFlags() const;
- MediaType getType() const;
-
- const std::string &getId() const;
-
- ucl::Result getResolution(int &x, int &y) const;
-
- const std::string &getFilePath() const;
-
- ucl::Result getThumbnailPath(const ThumbnailPathGetCb &cb) const;
- void cancelThumbnailPathGet() const;
-
- ucl::Result removeFile();
- ucl::Result saveToDevice();
-
- protected:
- friend class ucl::RefCountObj<MediaItem>;
- MediaItem(int flags, MediaType type);
-
- ucl::Result prepare(media_info_h media);
- ucl::Result prepareImage(media_info_h media);
- ucl::Result prepare(std::string filePath);
-
- private:
- ucl::Result initThumbPath(media_info_h media) const;
-
- private:
- // XXX This proxy is needed to deal with cases when
- // media_thumbnail_completed_cb can't be cancelled
- struct ThumbCbProxy {
- const MediaItem *item;
- ThumbnailPathGetCb callback;
-
- void completeCb(media_content_error_e error, const char *path);
- };
-
- private:
- using AutoMediaInfo = ucl::AutoHandle<
- media_info_h, int, media_info_destroy>;
-
- private:
- const int m_flags;
- const MediaType m_type;
- std::string m_mediaId;
- std::string m_filePath;
- int m_resolutionX;
- int m_resolutionY;
- mutable AutoMediaInfo m_media;
- mutable std::string m_thumbPath;
- mutable std::unique_ptr<ThumbCbProxy> m_thumbCbProxy;
- bool m_isValid;
- };
-}
-
-#endif // __GALLERY_MODEL_MEDIA_ITEM_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 __GALLERY_MODEL_SOUND_MANAGER_H__
-#define __GALLERY_MODEL_SOUND_MANAGER_H__
-
-#include <sound_manager.h>
-
-#include "ucl/misc/Event.h"
-
-#include "types.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(SoundManager);
-
- class SoundManager final : public ucl::NonCopyable {
- public:
- static SoundManagerSRef newInstance();
-
- bool isMediaDeviceReady() const;
-
- int getCurrentMediaVolume() const;
- int getMaxMediaVolume() const;
-
- void addMediaDeviceStateChangeHandler(const NotiHandler &handler);
- void delMediaDeviceStateChangeHandler(const NotiHandler &handler);
-
- void addMediaVolumeChangeHandler(const NotiHandler &handler);
- void delMediaVolumeChangeHandler(const NotiHandler &handler);
-
- private:
- friend class ucl::RefCountObj<SoundManager>;
- SoundManager();
- ~SoundManager();
-
- ucl::Result prepare();
-
- void setMediaDeviceState(bool isReady);
- void setCurrentMediaVolume(int value);
-
- ucl::Result updateMediaDeviceState();
-
- void onDeviceConnectionChanged(sound_device_h device, bool isConnected);
- void onDeviceStateChanged(sound_device_h device,
- sound_device_state_e state);
- void onVolumeChanged(sound_type_e type, unsigned int volume);
-
- private:
- ucl::Event<NotiHandler> m_onMediaDeviceStateChange;
- ucl::Event<NotiHandler> m_onMediaVolumeChange;
- int m_devConnChangedCbId;
- int m_devStateChangedCbId;
- int m_volumeChangedCbId;
- int m_currentMediaVolume;
- int m_maxMediaVolume;
- bool m_isMediaDeviceReady;
- };
-}
-
-#endif // __GALLERY_MODEL_SOUND_MANAGER_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 __GALLERY_MODEL_TYPES_H__
-#define __GALLERY_MODEL_TYPES_H__
-
-#include "../types.h"
-
-namespace gallery {
-
- enum class MediaType {
- IMAGE,
- VIDEO,
- SOUND,
- MUSIC,
- OTHERS
- };
-}
-
-#endif // __GALLERY_MODEL_TYPES_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 __GALLERY_PRESENTERS_ALERT_DIALOG_H__
-#define __GALLERY_PRESENTERS_ALERT_DIALOG_H__
-
-#include "ucl/gui/StyledWidget.h"
-#include "ucl/gui/Layout.h"
-
-#include "Presenter.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(AlertDialog);
-
- class AlertDialog final : public Presenter,
- public ucl::IDisposable {
- public:
- enum class Type {
- OK_CANCEL
- };
-
- enum Event {
- EVENT_CANCEL,
- EVENT_OK,
- EVENT_BACK
- };
-
- using EventHandler = ucl::WeakDelegate<
- bool(AlertDialog &dialog, int event)>;
-
- class Builder {
- public:
- Builder();
- Builder &setType(Type type);
- Builder &setTitle(ucl::TString title);
- Builder &setText(ucl::TString text);
- Builder &setHandler(const EventHandler &handler);
- AlertDialogWRef build(ucl::ElmWidget &parent) const;
- private:
- Type m_type;
- ucl::TString m_title;
- ucl::TString m_text;
- EventHandler m_handler;
- };
-
- public:
- void dismiss();
-
- // ucl::IDisposable //
-
- virtual void dispose() final override;
- virtual bool isDisposed() const final override;
-
- private:
- friend class ucl::RefCountObj<AlertDialog>;
- AlertDialog(ucl::RefCountObjBase &rc,
- const EventHandler &handler);
- virtual ~AlertDialog();
-
- ucl::Result prepare(ucl::ElmWidget &parent, Type type);
- ucl::Result createPopup(ucl::ElmWidget &parent, ucl::ElmStyle style);
- ucl::Result createLayout(ucl::LayoutTheme theme);
- ucl::Result createButton(Event event, ucl::EdjePart part,
- ucl::ElmStyle btnStyle, ucl::LayoutTheme iconTheme,
- const ucl::TString &text = nullptr);
-
- void setTitle(const ucl::TString &title);
- void setText(const ucl::TString &text);
-
- void handleEvent(Event event);
- bool dispatchEvent(Event event);
-
- void onPopupDismissed(ucl::Widget &widget, void *eventInfo);
- void onPopupHWBackKey(Evas_Object *obj, void *eventInfo);
-
- void onBtnClick(ucl::Widget &widget, void *eventInfo);
-
- private:
- const EventHandler m_handler;
- ucl::StyledWidgetSRef m_popup;
- ucl::LayoutWRef m_layout;
- bool m_isDismissed;
- };
-}
-
-#endif // __GALLERY_PRESENTERS_ALERT_DIALOG_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 __GALLERY_PRESENTERS_ATSPI_HIGHLIGH_HELPER_H__
-#define __GALLERY_PRESENTERS_ATSPI_HIGHLIGH_HELPER_H__
-
-#include "Presenter.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(AtspiHighlightHelper);
-
- class AtspiHighlightHelper final : public Presenter {
- public:
- using EventHandler = ucl::WeakDelegate<Elm_Interface_Atspi_Accessible *(
- ucl::Widget &widget, Elm_Atspi_Relation_Type flowRelation)>;
-
- public:
- static AtspiHighlightHelperSRef newInstance(ucl::ElmWidget &rootWidget);
-
- void setEventHandler(EventHandler handler);
- void registerWidget(ucl::ElmWidget &widget);
-
- private:
- friend class ucl::RefCountObj<AtspiHighlightHelper>;
- AtspiHighlightHelper(ucl::RefCountObjBase &rc);
- virtual ~AtspiHighlightHelper();
-
- ucl::Result prepare(ucl::ElmWidget &rootWidget);
-
- private:
- void onAtspiGesture(ucl::Widget &widget, void *eventInfo);
-
- private:
- EventHandler m_eventHandler;
- };
-}
-
-#endif // __GALLERY_PRESENTERS_ATSPI_HIGHLIGH_HELPER_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 __GALLERY_PRESENTERS_INSTANCE_H__
-#define __GALLERY_PRESENTERS_INSTANCE_H__
-
-#include "ucl/appfw/IInstance.h"
-#include "ucl/appfw/IInstanceAppControlExt.h"
-#include "ucl/appfw/SysEventProvider.h"
-
-#include "ucl/gui/Theme.h"
-#include "ucl/gui/Naviframe.h"
-
-#include "model/Gallery.h"
-#include "Page.h"
-
-namespace gallery {
-
- class Instance final : public ucl::RefCountAware,
- public ucl::IInstance,
- public ucl::IInstanceAppControlExt {
- public:
- Instance(ucl::RefCountObjBase &rc,
- ucl::SysEventProvider &sysEventProvider);
- virtual ~Instance();
-
- // IInstance //
-
- virtual ucl::Result onCreate(
- ucl::IInstanceContext *context) final override;
- virtual void onPause() final override;
- virtual void onResume() final override;
-
- // IInstanceAppControlExt //
-
- virtual void onAppControl(app_control_h appControl) final override;
-
- private:
- ucl::Result setupTheme();
-
- void rescanMediaContent();
- void stopMediaContentScan();
- void startMediaContentScan();
- void onScanComplete(media_content_error_e error);
-
- ucl::Result handleAppControl(app_control_h appControl);
- ucl::Result handleSingleMode(const std::string &operation,
- app_control_h appControl);
- ucl::Result handleGroupMode(const std::string &operation,
- app_control_h appControl);
-
- ucl::Result ensureGalleryModel();
-
- void createNoContentPage();
- void createThumbnailPage();
- void createViewerPage(const MediaItemSRef &media);
- void createVideoPlayerPage(const MediaItemSRef &media);
-
- void onAlbumChanged();
- void onPageExitRequest(Page &page);
-
- void onSysEvent(const ucl::SysEvent sysEvent);
-
- private:
- ucl::SysEventProvider &m_sysEventProvider;
- ucl::IInstanceContext *m_context;
-
- GallerySRef m_gallery;
- bool m_isScanInProgress;
-
- ucl::WindowSRef m_win;
- ucl::Theme m_theme;
- ucl::NaviframeSRef m_navi;
-
- PageWRef m_page;
-
- bool m_isGroupMode;
- };
-}
-
-#endif // __GALLERY_PRESENTERS_INSTANCE_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 __GALLERY_PRESENTERS_INSTANCE_MANAGER_H__
-#define __GALLERY_PRESENTERS_INSTANCE_MANAGER_H__
-
-#include "ucl/appfw/InstanceManagerBase.h"
-
-#include "types.h"
-
-namespace gallery {
-
- class InstanceManager : public ucl::InstanceManagerBase {
- public:
- InstanceManager();
-
- // ucl::InstanceManagerBase //
-
- virtual ucl::IInstanceSRef newInstance() const final override;
- };
-}
-
-#endif // __GALLERY_PRESENTERS_INSTANCE_MANAGER_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 __GALLERY_PRESENTERS_MORE_OPTIONS_PRESENTER_H__
-#define __GALLERY_PRESENTERS_MORE_OPTIONS_PRESENTER_H__
-
-#include <list>
-
-#include "ucl/misc/HashMap.h"
-
-#include "Presenter.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(MoreOptionsPresenter);
-
- class MoreOptionsPresenter final : public Presenter {
- public:
- UCL_DECLARE_REF_ALIASES(IListener);
-
- struct Option {
- int id;
- ucl::TString text;
- ucl::TString subText;
- ucl::LayoutTheme iconTheme;
- };
-
- using MoreOptions = std::list<Option>;
-
- class Builder {
- public:
- Builder();
- ~Builder();
- bool isEmpty() const;
- Builder &clear();
- Builder &addOption(Option option);
- MoreOptionsPresenterSRef build(ucl::ElmWidget &parent) const;
- private:
- ucl::SharedRef<MoreOptions> m_options;
- };
-
- class IListener : public ucl::Polymorphic {
- public:
- virtual void onMoreOptionClicked(MoreOptionsPresenter &sender,
- const Option &option) = 0;
- virtual void onMoreOptionSelected(MoreOptionsPresenter &sender,
- const Option &option) {};
- virtual void onMoreOptionsOpened(MoreOptionsPresenter &sender) {};
- virtual void onMoreOptionsClosed(MoreOptionsPresenter &sender) {};
- };
-
- public:
- void setListener(const IListenerWRef &listener);
-
- ucl::Widget &getWidget();
-
- void setOpened(bool isOpened);
- bool isOpened() const;
-
- void setOpenedDelayed(bool isOpened, double timeout);
-
- private:
- using MoreOptionsCSRef = ucl::SharedRef<const MoreOptions>;
-
- private:
- friend class ucl::RefCountObj<MoreOptionsPresenter>;
- MoreOptionsPresenter(ucl::RefCountObjBase &rc,
- const MoreOptionsCSRef &options);
- virtual ~MoreOptionsPresenter();
-
- ucl::Result prepare(ucl::ElmWidget &parent);
- ucl::Result addItem(const Option &option);
-
- bool resetTimer(double timeout);
- void stopTimer();
-
- Eina_Bool onTimer();
-
- void onOpened(ucl::Widget &widget, void *eventInfo);
- void onClosed(ucl::Widget &widget, void *eventInfo);
- void onItemClicked(ucl::Widget &widget, void *eventInfo);
- void onItemSelected(ucl::Widget &widget, void *eventInfo);
-
- private:
- const MoreOptionsCSRef m_options;
- ucl::HashMap<void *, const Option *> m_map;
- ucl::ElmWidgetSRef m_widget;
- IListenerWRef m_listener;
- Ecore_Timer *m_timer;
- bool m_newOpenedState;
- };
-}
-
-#endif // __GALLERY_PRESENTERS_MORE_OPTIONS_PRESENTER_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 __GALLERY_PRESENTERS_NO_CONTENT_PAGE_H__
-#define __GALLERY_PRESENTERS_NO_CONTENT_PAGE_H__
-
-#include "Page.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(NoContentPage);
-
- class NoContentPage final : public Page {
- public:
- class Builder {
- public:
- Builder();
- ~Builder();
- Builder &setNaviframe(const ucl::NaviframeSRef &navi);
- NoContentPageWRef build(
- const ExitRequestHandler &onExitRequest) const;
- private:
- ucl::NaviframeSRef m_navi;
- };
-
- private:
- friend class ucl::RefCountObj<NoContentPage>;
- NoContentPage(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
- const ExitRequestHandler &onExitRequest);
- virtual ~NoContentPage();
-
- ucl::Result prepare();
- };
-}
-
-#endif // __GALLERY_PRESENTERS_NO_CONTENT_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 __GALLERY_PRESENTERS_PAGE_H__
-#define __GALLERY_PRESENTERS_PAGE_H__
-
-#include "ucl/gui/Naviframe.h"
-
-#include "Presenter.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(Page);
-
- class Page : public Presenter {
- public:
- using ExitRequestHandler = ucl::WeakDelegate<void(Page &page)>;
-
- public:
- ucl::Naviframe &getNaviframe();
-
- bool isAtTop() const;
- bool isAtBottom() const;
-
- void exit();
- void exitNoTransition();
-
- void popTo();
- void deleteTo();
- void promote();
-
- template <class ...ARGS>
- ucl::NaviItem insertAfter(ARGS &&...args);
-
- template <class ...ARGS>
- ucl::NaviItem insertBefore(ARGS &&...args);
-
- protected:
- Page(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
- const ExitRequestHandler &onExitRequest);
- virtual ~Page();
-
- template <class ITEM_FACTORY>
- ucl::Result prepare(ITEM_FACTORY &&makeItem);
-
- ucl::NaviItem getItem();
-
- void requestExit();
-
- virtual void onBackKey();
-
- private:
- ucl::Result preparePart2();
-
- void dispatchTopPageChanged();
-
- void updateActiveState();
-
- void onTransitionStarted(ucl::Widget &widget, void *eventInfo);
- void onTransitionFinished(ucl::Widget &widget, void *eventInfo);
- void onTopPageChanged(ucl::Widget &widget, void *eventInfo);
-
- void onHWBackKey(Evas_Object *obj, void *eventInfo);
- void onItemDel(Evas_Object *obj, void *eventInfo);
-
- private:
- const ucl::NaviframeSRef m_navi;
- const ExitRequestHandler m_onExitRequest;
- ucl::NaviItem m_item;
- };
-
- // Non-member functions //
-
- bool isLast(const Page &page);
-}
-
-#include "Page.hpp"
-
-#endif // __GALLERY_PRESENTERS_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.
- */
-
-#include "ucl/util/logging.h"
-
-namespace gallery {
-
- template <class ITEM_FACTORY>
- inline ucl::Result Page::prepare(ITEM_FACTORY &&makeItem)
- {
- m_item = makeItem();
- if (!m_item) {
- UCL_LOG_RETURN(ucl::RES_FAIL, "m_item is NULL");
- }
- return preparePart2();
- }
-
- template <class ...ARGS>
- inline ucl::NaviItem Page::insertAfter(ARGS &&...args)
- {
- return m_navi->insertAfter(m_item, std::forward<ARGS>(args)...);
- }
-
- template <class ...ARGS>
- inline ucl::NaviItem Page::insertBefore(ARGS &&...args)
- {
- return m_navi->insertBefore(m_item, std::forward<ARGS>(args)...);
- }
-
- inline ucl::Naviframe &Page::getNaviframe()
- {
- UCL_ASSERT(m_navi, "m_navi is NULL");
- return *m_navi;
- }
-
- inline bool Page::isAtTop() const
- {
- return (m_navi->getTopItem() == m_item);
- }
-
- inline bool Page::isAtBottom() const
- {
- return (m_navi->getBottomItem() == m_item);
- }
-
- // Non-member functions //
-
- inline bool isLast(const Page &page)
- {
- return (page.isAtBottom() && page.isAtTop());
- }
-}
+++ /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 __GALLERY_PRESENTERS_PRESENTER_H__
-#define __GALLERY_PRESENTERS_PRESENTER_H__
-
-#include <unordered_set>
-
-#include "ucl/gui/Window.h"
-
-#include "types.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(Presenter);
-
- class Presenter : public ucl::RefCountAware {
- public:
- struct DeactivatorInfo {
- void *deactivator;
- bool isBroadcast;
- };
-
- public:
- bool isActive() const;
- bool isDeactivatedBy(void *deactivator) const;
-
- void activateBy(void *deactivator);
- void deactivateBy(void *deactivator);
-
- protected:
- Presenter(ucl::RefCountObjBase &rc);
- virtual ~Presenter();
-
- ucl::Result prepare(ucl::ElmWidget &widget);
-
- ucl::Window &getWindow();
- bool isWindowReady() const;
-
- void addDeactivatorSource(ucl::Widget &source);
- void addDeactivatorException(void *deactivator);
-
- void sendActivateBy(ucl::Widget &sender, void *deactivator);
- void sendDeactivateBy(ucl::Widget &sender, void *deactivator);
-
- void broadcastActivateBy(void *deactivator);
- void broadcastDeactivateBy(void *deactivator);
-
- virtual void onActivate();
- virtual void onDeactivate();
- virtual void onActivateBy(const DeactivatorInfo &info);
- virtual void onDeactivateBy(const DeactivatorInfo &info);
-
- private:
- void sendDeactivator(ucl::Widget &sender,
- ucl::SmartEvent event, void *deactivator);
- void broadcastDeactivator(ucl::SmartEvent event, void *deactivator);
-
- void sendDeactivatorInfo(ucl::Widget &sender, ucl::SmartEvent event,
- const DeactivatorInfo &info);
-
- void activateByImpl(const DeactivatorInfo &info);
- void deactivateByImpl(const DeactivatorInfo &info);
-
- void onActivateBySmart(ucl::Widget &widget, void *eventInfo);
- void onDeactivateBySmart(ucl::Widget &widget, void *eventInfo);
-
- private:
- std::unordered_set<void *> m_deactivatorExceptions;
- std::unordered_set<void *> m_deactivators;
- ucl::WindowSRef m_window;
- bool m_isPrepared;
- };
-}
-
-#endif // __GALLERY_PRESENTERS_PRESENTER_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 __GALLERY_PRESENTERS_PREVIEW_PAGE_H__
-#define __GALLERY_PRESENTERS_PREVIEW_PAGE_H__
-
-#include "Page.h"
-
-#include "model/IMediaAlbum.h"
-
-#include "view/PageContent.h"
-#include "view/ImageGrid.h"
-
-#include "MoreOptionsPresenter.h"
-#include "SelectModePresenter.h"
-#include "AlertDialog.h"
-#include "ProcessingPresenter.h"
-#include "AtspiHighlightHelper.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(PreviewPage);
-
- class PreviewPage final : public Page,
- private ImageGrid::IListener,
- private MoreOptionsPresenter::IListener,
- private SelectModePresenter::IListener {
- public:
- class Builder {
- public:
- Builder();
- ~Builder();
- Builder &setNaviframe(const ucl::NaviframeSRef &navi);
- Builder &setAlbum(const IMediaAlbumSRef &album);
- Builder &setStartItemIndex(int index);
- Builder &setSelectModeStartup(bool value);
- Builder &setAutoSelectStartItem(bool value);
- PreviewPageWRef build(
- const ExitRequestHandler &onExitRequest) const;
- private:
- ucl::NaviframeSRef m_navi;
- IMediaAlbumSRef m_album;
- int m_startItemIndex;
- bool m_selectModeStartup;
- bool m_autoSelectStartItem;
- };
-
- public:
- int getCurrentItemIndex() const;
-
- private:
- friend class ucl::RefCountObj<PreviewPage>;
- PreviewPage(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
- const ExitRequestHandler &onExitRequest,
- const IMediaAlbumSRef &album, bool selectModeStartup);
- virtual ~PreviewPage();
-
- ucl::Result prepare(int startItemIndex);
- void showItem(int itemIndex);
- void selectItem(int itemIndex);
- int getSafeItemIndex(int itemIndex) const;
-
- void reload();
- void checkViewerPage();
-
- void onAlbumChanged();
- bool onEachMedia(MediaItemSRef &&media);
-
- void closeTempViews();
- void switchToSelectMode();
- void switchToNormalMode();
- void toggleItemSelected(int itemIndex);
- void confirmItemsDelete();
- void openViewer(int itemIndex, int x, int y);
-
- void onPageExitRequest(Page &page);
-
- bool onAlertEvent(AlertDialog &dialog, int event);
- void onJobComplete();
-
- Elm_Interface_Atspi_Accessible *onAtspiHighlight(
- ucl::Widget &widget, Elm_Atspi_Relation_Type flowRelation);
-
- // Presenter //
-
- virtual void onActivateBy(const DeactivatorInfo &info) final override;
- virtual void onDeactivateBy(const DeactivatorInfo &info) final override;
-
- // Page //
-
- virtual void onBackKey() final override;
-
- // ImageGrid::IListener //
-
- virtual void onItemRealized(int itemIndex) final override;
- virtual void onItemUnrealized(int itemIndex) final override;
- virtual void onItemEvent(int itemIndex,
- ImageGrid::ItemEvent event, int x, int y) final override;
- virtual void onTransitionFinished() final override;
- virtual Elm_Interface_Atspi_Accessible *onAccessObjectRequest(
- bool isFlowsTo) final override;
-
- // MoreOptionsPresenter::IListener //
-
- virtual void onMoreOptionClicked(MoreOptionsPresenter &sender,
- const MoreOptionsPresenter::Option &option) final override;
-
- // SelectModePresenter::IListener //
-
- virtual void onSelectModeEvent(
- SelectModePresenter::Event event) final override;
-
- private:
- class Item;
- using ItemSRef = ucl::SharedRef<Item>;
-
- private:
- const IMediaAlbumSRef m_album;
- const bool m_selectModeStartup;
- ImageGridSRef m_imageGrid;
- std::vector<ItemSRef> m_items;
- IJobSRef m_job;
-
- PageContentSRef m_content;
- MoreOptionsPresenterSRef m_more;
- SelectModePresenterSRef m_smp;
- AlertDialogWRef m_alert;
- ProcessingPresenterSRef m_processing;
- AtspiHighlightHelperSRef m_atspiHelper;
-
- PageWRef m_page;
- int m_selectCount;
- bool m_isInSelectMode;
- bool m_needReload;
- };
-}
-
-#endif // __GALLERY_PRESENTERS_PREVIEW_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 __GALLERY_PRESENTERS_PROCESSING_PRESENTER_H__
-#define __GALLERY_PRESENTERS_PROCESSING_PRESENTER_H__
-
-#include "ucl/gui/Layout.h"
-#include "ucl/gui/StyledWidget.h"
-
-#include "Presenter.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(ProcessingPresenter);
-
- class ProcessingPresenter final : public Presenter {
- public:
- enum class IconType {
- NONE,
- CHECK
- };
-
- class Builder {
- public:
- Builder();
- Builder &setProcessingText(ucl::TString text);
- Builder &setForceProgress(bool value);
- ProcessingPresenterSRef build(ucl::ElmWidget &parent) const;
- private:
- ucl::TString m_processingText;
- bool m_forceProgress;
- };
-
- using DismissHandler = ucl::WeakDelegate<void()>;
-
- public:
- void complete(const ucl::TString &completeText,
- IconType iconType = IconType::NONE);
-
- void setDismissHandler(const DismissHandler &handler);
-
- private:
- friend class ucl::RefCountObj<ProcessingPresenter>;
- ProcessingPresenter(ucl::RefCountObjBase &rc);
- virtual ~ProcessingPresenter();
-
- ucl::Result prepare(ucl::ElmWidget &parent,
- const ucl::TString &processingText,
- bool forceProgress);
-
- ucl::Result createWidget(ucl::ElmWidget &parent,
- const ucl::TString &processingText);
- ucl::Result moveWidget();
- ucl::Result createProgress();
- ucl::Result createPopup();
- ucl::Result createIcon();
-
- bool resetTimer(double timeout);
- void stopTimer();
-
- void showProgress();
-
- void tryShowPopup();
- void dismissPopup();
- void deletePopup();
-
- void animateIcon();
-
- Eina_Bool onTimer();
-
- void onPopupDismissed(ucl::Widget &widget, void *eventInfo);
- void onPopupHWBackKey(Evas_Object *obj, void *eventInfo);
-
- private:
- enum class State {
- WAITING,
- PROCESSING,
- POPUP_ANIMATION,
- COMPLETE
- };
-
- private:
- ucl::LayoutSRef m_widget;
- ucl::StyledWidgetSRef m_popup;
- ucl::LayoutWRef m_icon;
- IconType m_iconType;
- DismissHandler m_dismissHandler;
- Ecore_Timer *m_timer;
- State m_state;
- bool m_mayComplete;
- bool m_isComplete;
- bool m_isDismissed;
- };
-}
-
-#endif // __GALLERY_PRESENTERS_PROCESSING_PRESENTER_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 __GALLERY_PRESENTERS_SELECT_MODE_PRESENTER_H__
-#define __GALLERY_PRESENTERS_SELECT_MODE_PRESENTER_H__
-
-#include "ucl/gui/StyledWidget.h"
-
-#include "Presenter.h"
-
-#include "view/PageContent.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(SelectModePresenter);
-
- class SelectModePresenter final : public Presenter {
- public:
- UCL_DECLARE_REF_ALIASES(IListener);
-
- enum {
- FLAG_NO_BOTTOM_BUTTON = 1,
- FLAG_NO_MORE_OPTIONS = 2,
- FLAG_NO_DIM_ON_ZERO_SELECT = 4,
- FLAG_NO_DISMISS_ON_ROTARY = 8
- };
-
- class Builder {
- public:
- Builder();
- Builder &setFlags(int flags);
- SelectModePresenterSRef build(PageContent &content) const;
- private:
- int m_flags;
- };
-
- enum class Event {
- SELECT_ALL,
- DESELECT_ALL,
- BOTTOM_BUTTON_CLICK
- };
-
- class IListener : public ucl::Polymorphic {
- public:
- virtual void onSelectModeEvent(Event event) = 0;
- };
-
- public:
- void setListener(const IListenerWRef &listener);
-
- void setVisible(bool value);
- bool isVisible() const;
-
- ucl::ElmWidget &getSelectButton();
- ucl::ElmWidget &getBottomButton();
-
- void setBottomButtonText(const ucl::TString &value);
-
- void update(int selectCount, int totalCount = -1);
-
- private:
- friend class ucl::RefCountObj<SelectModePresenter>;
- SelectModePresenter(ucl::RefCountObjBase &rc,
- PageContent &content, int flags);
- virtual ~SelectModePresenter();
-
- ucl::Result prepare();
-
- void doUpdate();
-
- void showPopup();
- void movePopup();
- void dismissPopup();
- void deletePopup();
-
- void dispatchEvent(Event event);
-
- void onPopupDismissed(ucl::Widget &widget, void *eventInfo);
- void onPopupHWBackKey(Evas_Object *obj, void *eventInfo);
-
- void onSelectAll(Evas_Object *obj, void *eventInfo);
- void onDeselectAll(Evas_Object *obj, void *eventInfo);
-
- void onSelectBtnClick(ucl::Widget &widget, void *eventInfo);
- void onBottomBtnClick(ucl::Widget &widget, void *eventInfo);
- Eina_Bool onRotary(Eext_Rotary_Event_Info *info);
-
- // Presenter //
- virtual void onDeactivate() final override;
-
- private:
- const PageContentSRef m_content;
- const int m_flags;
- ucl::StyledWidgetSRef m_selectButton;
- ucl::StyledWidgetSRef m_bottomButton;
- ucl::StyledWidgetSRef m_popup;
- IListenerWRef m_listener;
- int m_totalCount;
- int m_selectCount;
- bool m_isVisible;
- bool m_isPopupDismissed;
- };
-}
-
-#endif // __GALLERY_PRESENTERS_SELECT_MODE_PRESENTER_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 __GALLERY_PRESENTERS_THUMBNAIL_PAGE_H__
-#define __GALLERY_PRESENTERS_THUMBNAIL_PAGE_H__
-
-#include "Page.h"
-
-#include "model/IMediaAlbum.h"
-
-#include "view/PageContent.h"
-#include "view/ImageGrid.h"
-
-#include "MoreOptionsPresenter.h"
-#include "AtspiHighlightHelper.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(ThumbnailPage);
-
- class ThumbnailPage final : public Page,
- private ImageGrid::IListener,
- private MoreOptionsPresenter::IListener {
- public:
- class Builder {
- public:
- Builder();
- ~Builder();
- Builder &setNaviframe(const ucl::NaviframeSRef &navi);
- Builder &setAlbum(const IMediaAlbumSRef &album);
- ThumbnailPageWRef build(
- const ExitRequestHandler &onExitRequest) const;
- private:
- ucl::NaviframeSRef m_navi;
- IMediaAlbumSRef m_album;
- };
-
- private:
- friend class ucl::RefCountObj<ThumbnailPage>;
- ThumbnailPage(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
- const ExitRequestHandler &onExitRequest,
- const IMediaAlbumSRef &album);
- virtual ~ThumbnailPage();
-
- ucl::Result prepare();
-
- void reload();
-
- int getSafeItemIndex(int itemIndex) const;
-
- void onAlbumChanged();
- bool onEachMedia(MediaItemSRef &&media);
-
- void onPageExitRequest(Page &page);
-
- Elm_Interface_Atspi_Accessible *onAtspiHighlight(
- ucl::Widget &widget, Elm_Atspi_Relation_Type flowRelation);
-
- // Presenter //
-
- virtual void onActivateBy(const DeactivatorInfo &info) final override;
- virtual void onDeactivateBy(const DeactivatorInfo &info) final override;
-
- // ImageGrid::IListener //
-
- virtual void onItemRealized(int itemIndex) final override;
- virtual void onItemUnrealized(int itemIndex) final override;
- virtual void onItemEvent(int itemIndex,
- ImageGrid::ItemEvent event, int x, int y) final override;
-
- // MoreOptionsPresenter::IListener //
-
- virtual void onMoreOptionClicked(MoreOptionsPresenter &sender,
- const MoreOptionsPresenter::Option &option) final override;
-
- private:
- class RealizedItem;
- using RealizedItemSRef = ucl::SharedRef<RealizedItem>;
-
- private:
- const IMediaAlbumSRef m_album;
- MediaItems m_mediaItems;
-
- std::vector<RealizedItemSRef> m_realizedItems;
-
- PageContentSRef m_content;
- ImageGridSRef m_imageGrid;
- MoreOptionsPresenterSRef m_more;
- AtspiHighlightHelperSRef m_atspiHelper;
-
- PageWRef m_page;
- };
-}
-
-#endif // __GALLERY_PRESENTERS_THUMBNAIL_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 __GALLERY_PRESENTERS_VIDEO_PLAYER_PAGE_H__
-#define __GALLERY_PRESENTERS_VIDEO_PLAYER_PAGE_H__
-
-#include <player.h>
-
-#include "ucl/gui/Layout.h"
-
-#include "Page.h"
-
-#include "model/SoundManager.h"
-#include "model/MediaItem.h"
-
-#include "view/TouchParser.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(VideoPlayerPage);
-
- class VideoPlayerPage final : public Page {
- public:
- class Builder {
- public:
- Builder();
- ~Builder();
- Builder &setNaviframe(const ucl::NaviframeSRef &navi);
- Builder &setMedia(const MediaItemSRef &media);
- VideoPlayerPageWRef build(
- const ExitRequestHandler &onExitRequest) const;
- private:
- ucl::NaviframeSRef m_navi;
- MediaItemSRef m_media;
- };
-
- private:
- friend class ucl::RefCountObj<VideoPlayerPage>;
- VideoPlayerPage(ucl::RefCountObjBase &rc,
- const ucl::NaviframeSRef &navi,
- const ExitRequestHandler &onExitRequest,
- const MediaItemSRef &media);
- virtual ~VideoPlayerPage();
-
- ucl::Result prepare();
-
- ucl::Result prepareSoundManager();
-
- void createImage();
- ucl::Result preparePlayer();
- ucl::Result seekToStart();
-
- void createControls();
- ucl::StyledWidgetSRef createButton(ucl::ElmStyle style,
- ucl::EdjePart part, const ucl::WidgetEventHandler &handler);
-
- bool resetTimer(Ecore_Timer *&timer, double timeout, Ecore_Task_Cb func);
- void stopTimer(Ecore_Timer *&timer);
-
- bool resetAutoStartTimer();
- bool resetControlsHideTimer();
- bool resetTickTimer();
-
- void showControls();
- void hideControls();
- void showVolumeBtn();
-
- bool updatePlayTimeText();
- void updatePlayTimeText(int timeMs);
-
- player_state_e getPlayerState() const;
- void startPlayback();
- void pausePlayback();
-
- void setScreenAlwaysOn(bool isAlwaysOn);
-
- ucl::Result launchVolumeSettings();
-
- void onMediaDeviceStateChanged();
- void onMediaVolumeChanged();
-
- void onPlaybackComplete();
- void onPlaybackInterrupted(player_interrupted_code_e code);
- void onSeekComplete();
-
- Eina_Bool onAutoStartTimer();
- Eina_Bool onControlsHideTimer();
- Eina_Bool onTickTimer();
-
- void onVolumeBtnClick(ucl::Widget &sender, void *eventInfo);
- void onPlayBtnClick(ucl::Widget &sender, void *eventInfo);
- void onPauseBtnClick(ucl::Widget &sender, void *eventInfo);
- void onTap(int x, int y);
- Eina_Bool onRotary(Eext_Rotary_Event_Info *info);
-
- void onInstancePaused(ucl::Widget &sender, void *eventInfo);
- void onInstanceResumed(ucl::Widget &sender, void *eventInfo);
-
- private:
- enum class State {
- PAUSED,
- PLAYING
- };
-
- private:
- const MediaItemSRef m_media;
- SoundManagerSRef m_soundMgr;
- ucl::LayoutSRef m_content;
- ucl::WidgetSRef m_image;
- ucl::StyledWidgetSRef m_volumeMuteBtn;
- TouchParserSRef m_touchParser;
- player_h m_player;
- int m_videoDuration;
- Ecore_Timer *m_autoStartTimer;
- Ecore_Timer *m_controlsHideTimer;
- Ecore_Timer *m_tickTimer;
- State m_state;
- bool m_isControlsVisible;
- bool m_needAutoStart;
- bool m_isPlaybackCompleted;
- };
-}
-
-#endif // __GALLERY_PRESENTERS_VIDEO_PLAYER_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 __GALLERY_PRESENTERS_VIEWER_PAGE_H__
-#define __GALLERY_PRESENTERS_VIEWER_PAGE_H__
-
-#include "Page.h"
-
-#include "model/MediaItem.h"
-
-#include "view/PageContent.h"
-#include "view/ImageViewer.h"
-#include "view/TouchParser.h"
-
-#include "MoreOptionsPresenter.h"
-#include "ProcessingPresenter.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(ViewerPage);
-
- class ViewerPage final : public Page,
- private MoreOptionsPresenter::IListener {
- public:
- class Builder {
- public:
- Builder();
- ~Builder();
- Builder &setNaviframe(const ucl::NaviframeSRef &navi);
- Builder &setMedia(const MediaItemSRef &media);
- Builder &setZoomIn(int x, int y);
- Builder &setImageLoadSize(int size, bool isFull);
- Builder &setExitOnZoomOut(bool value);
- ViewerPageWRef build(
- const ExitRequestHandler &onExitRequest) const;
- private:
- ucl::NaviframeSRef m_navi;
- MediaItemSRef m_media;
- int m_zoomInX;
- int m_zoomInY;
- int m_imageLoadSize;
- bool m_isImageLoadSizeFull;
- bool m_exitOnZoomOut;
- };
-
- public:
- const std::string &getMediaId() const;
-
- private:
- friend class ucl::RefCountObj<ViewerPage>;
- ViewerPage(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
- const ExitRequestHandler &onExitRequest,
- const MediaItemSRef &media, bool exitOnZoomOut);
- virtual ~ViewerPage();
-
- ucl::Result prepare(int imageLoadSize, bool isImageLoadSizeFull);
-
- void zoomIn(int originX, int originY);
-
- void onThumbnail(ucl::Result result, const std::string &path);
- void onZoomEnd(ucl::Widget &widget, void *eventInfo);
- void onDoubleTap(int x, int y);
-
- void onJobComplete();
-
- // Presenter //
-
- virtual void onActivateBy(const DeactivatorInfo &info) final override;
- virtual void onDeactivateBy(const DeactivatorInfo &info) final override;
-
- // Page //
-
- virtual void onBackKey() final override;
-
- // MoreOptionsPresenter::IListener //
-
- virtual void onMoreOptionClicked(MoreOptionsPresenter &sender,
- const MoreOptionsPresenter::Option &option) final override;
-
- private:
- const MediaItemSRef m_media;
- const bool m_exitOnZoomOut;
- ImageViewerSRef m_imageViewer;
- TouchParserSRef m_touchParser;
- IJobSRef m_job;
- PageContentSRef m_content;
- MoreOptionsPresenterSRef m_more;
- ProcessingPresenterSRef m_processing;
- };
-}
-
-#endif // __GALLERY_PRESENTERS_VIEWER_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 __GALLERY_PRESENTERS_TYPES_H__
-#define __GALLERY_PRESENTERS_TYPES_H__
-
-#include "view/types.h"
-#include "model/types.h"
-
-#endif // __GALLERY_PRESENTERS_TYPES_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 __GALLERY_RESOURCES_H__
-#define __GALLERY_RESOURCES_H__
-
-#include "ucl/misc/TString.h"
-
-#include "config.h"
-
-namespace gallery {
-
- constexpr auto THEME_EDJE_PATH = "edje/theme.edj";
-
- constexpr auto ICON_NO_PHOTOS = "gallery_icon_no_photos.png";
-
- constexpr auto ICON_MORE_OPT_DELETE = "gallery_more_opt_delete.png";
- constexpr auto ICON_MORE_OPT_SAVE = "gallery_more_opt_save.png";
- constexpr auto ICON_MORE_OPT_SEND = "gallery_more_opt_send_to_mobile.png";
-
- constexpr auto ICON_POPUP_OK = "tw_ic_popup_btn_check.png";
- constexpr auto ICON_POPUP_CANCEL = "tw_ic_popup_btn_delete.png";
-
- extern const ucl::TString STR_APP_NAME;
- extern const ucl::TString STR_NO_PHOTOS;
- extern const ucl::TString STR_SELECT_ALL;
- extern const ucl::TString STR_DESELECT_ALL;
- extern const ucl::TString STR_DELETE;
- extern const ucl::TString STR_DELETE_CAPS;
- extern const ucl::TString STR_DELETE_1_PHOTO;
- extern const ucl::TString STR_DELETE_N_PHOTO;
- extern const ucl::TString STR_DELETING;
- extern const ucl::TString STR_DELETED;
- extern const ucl::TString STR_FAILED;
- extern const ucl::TString STR_SAVE_TO_GEAR;
- extern const ucl::TString STR_SAVING;
- extern const ucl::TString STR_SAVED;
-}
-
-#endif // __GALLERY_RESOURCES_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 __GALLERY_TYPES_H__
-#define __GALLERY_TYPES_H__
-
-#include "config.h"
-
-#include "ucl/util/types.h"
-#include "ucl/util/memory.h"
-#include "ucl/util/delegation.h"
-#include "ucl/util/smartDelegation.h"
-
-namespace gallery {
-
- using NotiHandler = ucl::WeakDelegate<void()>;
-}
-
-#endif // __GALLERY_TYPES_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 __GALLERY_VIEW_IMAGE_GRID_H__
-#define __GALLERY_VIEW_IMAGE_GRID_H__
-
-#include <deque>
-
-#include "ucl/gui/StyledWidget.h"
-
-#include "ucl/misc/Timeout.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(ImageGrid);
-
- class ImageGrid : public ucl::ElmWidget {
- public:
- UCL_DECLARE_REF_ALIASES(IListener);
-
- enum class Type {
- HCOMB_3X3,
- LINEAR
- };
-
- class Builder {
- public:
- Builder();
- Builder &setType(Type value);
- Builder &setListener(const IListenerWRef &value);
- Builder &setSelectModeStartup(bool value);
- ImageGridSRef build(ElmWidget &parent) const;
- private:
- Type m_type;
- IListenerWRef m_listener;
- bool m_selectModeStartup;
- };
-
- enum class ItemEvent {
- CLICK,
- DOUBLE_TAP,
- TAP_AND_HOLD
- };
-
- class IListener : public ucl::Polymorphic {
- public:
- virtual void onItemRealized(int itemIndex) = 0;
- virtual void onItemUnrealized(int itemIndex) = 0;
- virtual void onItemEvent(int itemIndex,
- ItemEvent event, int x, int y) = 0;
- virtual void onTransitionFinished() {}
- virtual Elm_Interface_Atspi_Accessible *onAccessObjectRequest(
- bool isFlowsTo) { return nullptr; }
- };
-
- enum {
- UF_LOSE_IMAGE = 1,
- UF_LOSE_BG = 2,
- UF_BLOCK_CLICKS = 4,
- UF_SELECTED = 8
- };
-
- struct ItemParams {
- std::string imagePath;
- std::string bgImagePath;
- int imageWidth;
- int imageHeight;
- int flags;
- };
-
- struct ItemInfo {
- int imageLoadSize;
- bool isImageLoadSizeFull;
- bool isImageLoaded;
- };
-
- class Unrealizer : ucl::NonCopyable {
- public:
- Unrealizer(ImageGrid &imageGrid);
- ~Unrealizer();
- private:
- ImageGrid &m_imageGrid;
- };
-
- public:
- void setListener(const IListenerWRef &listener);
-
- ucl::Result setItemCount(int count);
-
- ucl::Result setSelectModeEnabled(bool enabled);
- bool isInSelectMode() const;
- bool isInTransition() const;
-
- void update();
-
- ucl::Result updateItem(int itemIndex, const ItemParams ¶ms);
-
- ucl::Result isItemRealized(int itemIndex) const;
-
- ucl::Result getItemInfo(int itemIndex, ItemInfo &info) const;
- Elm_Interface_Atspi_Accessible *getAccessObject(bool isFlowsTo);
-
- int getScrolledToItemIndex() const;
- ucl::Result scrollToItem(int itemIndex);
- ucl::Result bringInItem(int itemIndex);
-
- void activateRotary();
- void deactivateRotary();
-
- private:
- class Slot;
- using SlotUPtr = std::unique_ptr<Slot>;
-
- struct Info;
- struct HcombInfo;
- struct LinearInfo;
-
- private:
- friend class ucl::RefCountObj<ImageGrid>;
- ImageGrid(ucl::RefCountObjBase *rc, Evas_Object *scroller,
- Type type, bool selectModeStartup);
- virtual ~ImageGrid();
-
- static const Info &getInfo(Type type);
-
- template <class FUNC>
- ucl::Result doWithItem(int itemIndex, FUNC &&func) const;
- template <class FUNC>
- ucl::Result doWithCell(int itemIndex, FUNC &&func) const;
-
- template <class SHOW_FUNC>
- ucl::Result showItem(int itemIndex, SHOW_FUNC &&showFunc);
-
- bool isItemFullyVisible(int itemIndex);
- bool isItemFullyVisible(int itemIndex,
- int &minVisibleOffset, int &maxVisibleOffset) const;
- bool isItemFullyVisible(int slotIndex, int itemOffset,
- int &minVisibleOffset, int &maxVisibleOffset) const;
-
- void forceBoxSizeCalculate();
-
- void addUnrealizeLock();
- void removeUnrealizeLock();
-
- void handleItemEvent(int itemIndex,
- ItemEvent event, int x, int y) const;
-
- // Accessibility
-
- void onItemHighlighted(int itemIndex);
- void onItemUnhighlighted(int itemIndex);
- void onKeeperUnhighlighted(Widget &sender, void *eventInfo);
-
- void updateHighlightTimeout();
- void onHighlightTimeout(ucl::Timeout *sender);
-
- Elm_Interface_Atspi_Accessible *requestAtspi(int itemIndex);
- Elm_Interface_Atspi_Accessible *getItemAtspi(int itemIndex);
-
- // Selection mode hanling
- void evalSlotSizes();
- void finalizeTransition();
- Eina_Bool onAnimationFrame();
- void onSlotResize(Widget &widget, void *eventInfo);
- void onBoxResize(Evas *e, Evas_Object *obj, void *eventInfo);
- void onTransitonFinished(Evas_Object *obj, const char *emission,
- const char *source);
-
- // Initialization
- void prepare();
- void createCircleScroller();
- void createHighlighKeeper();
-
- // Actual slots count
- bool updateSlotCount();
- int calcSlotCount();
- void setSlotCount(int newSlotCount);
-
- // Optimal slots count
- bool updateOptimalSlotCount();
- int calcOptimalSlotCount();
-
- // Maximum slots count
- bool updateMaxSlotCount();
- int calcMaxSlotCount();
-
- // Actual begin slot index
- bool updateBeginSlotIndex();
- int calcBeginSlotIndex();
- void setBeginSlotIndex(int newBeginSlotIndex);
-
- // Maximum begin slot index
- bool updateMaxBeginSlotIndex();
- int calcMaxBeginSlotIndex();
-
- // Misc
- void updatePadSizes();
- void updateScrollBias();
- void updateRectMins();
-
- // Slot size
- bool updateSlotSize();
- void setSlotSize(int newSlotSize);
-
- // Scroller size
- bool updateScrollerSize();
- int calcScrollerSize();
-
- // Scroller scroll offset
- bool updateScrollOffset();
- int calcScrollOffset();
-
- // Slots rotations
- void rotateSlotsRight(int count);
- void rotateSlotsLeft(int count);
-
- // Slots realization/unrealization
- void realizeSlots();
- void unrealizeSlots(int beginSlotOffset, int endSlotOffset);
-
- // Event handling
- void handleScrolling();
- void handleResize();
-
- // Events
- void onScrollerResize(Widget &sender, void *eventInfo);
- void onScrollerMove(Widget &sender, void *eventInfo);
- void onBoxMove(Widget &sender, void *eventInfo);
-
- private:
- const Info &m_info;
-
- ucl::StyledWidgetWRef m_scroller;
- ucl::ElmWidget m_box;
- ucl::Widget m_rect1;
- ucl::Widget m_rect2;
- Evas_Object *m_circleScroller;
-
- IListenerWRef m_listener;
- int m_itemCount;
-
- std::deque<SlotUPtr> m_slots;
-
- int m_slotCount;
- int m_optimalSlotCount;
- int m_maxSlotCount;
-
- int m_beginSlotIndex;
- int m_maxBeginSlotIndex;
-
- int m_scrollBias;
- int m_padSize1;
- int m_padSize2;
-
- int m_slotSize;
- int m_scrollerSize;
- int m_scrollOffset;
-
- int m_unrealizeLock;
- int m_eventsLock;
-
- Ecore_Animator *m_animator;
- int m_scrollLockIndex;
- bool m_isInSelectMode;
- bool m_isRotaryActive;
-
- ucl::ElmWidgetSRef m_highlighKeeper;
- ucl::TimeoutSRef m_highlightTimeout;
- int m_highlightID;
- bool m_isHighlightLocked;
- };
-}
-
-#endif // __GALLERY_VIEW_IMAGE_GRID_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 __GALLERY_VIEW_IMAGE_VIEWER_H__
-#define __GALLERY_VIEW_IMAGE_VIEWER_H__
-
-#include "ucl/gui/StyledWidget.h"
-#include "ucl/gui/Layout.h"
-
-#include "types.h"
-
-namespace gallery {
-
- constexpr ucl::SmartEvent IMAGE_VIEWER_ZOOM_END {"gallery,zoom,end"};
-
- UCL_DECLARE_REF_ALIASES(ImageViewer);
-
- class ImageViewer final : public ucl::ElmWidget {
- public:
- class Builder {
- public:
- Builder();
- Builder &setHighResImagePath(std::string path);
- Builder &setLoadSize(int value);
- Builder &setForceLoad(bool value);
- ImageViewerSRef build(ucl::ElmWidget &parent) const;
- private:
- std::string m_highResPath;
- int m_loadSize;
- bool m_forceLoad;
- };
-
- public:
- void setLowResImagePath(const std::string &path);
- bool zoomIn(int originX, int originY);
- bool zoomOut();
-
- bool isZooming() const;
- bool isZoomedIn() const;
- bool isZoomedOut() const;
-
- private:
- friend class ucl::RefCountObj<ImageViewer>;
- ImageViewer(ucl::RefCountObjBase &rc, Evas_Object *scroller,
- const std::string &highResPath, int loadSize, bool forceLoad);
- virtual ~ImageViewer();
-
- void prepare(const std::string &highResPath,
- int loadSize, bool forceLoad);
-
- void onImagePreloaded(ucl::Widget &widget, void *eventInfo);
- void onScrollerResize(ucl::Widget &widget, void *eventInfo);
-
- bool updateScrollerSize();
- void updateScales();
- void updateGridSize();
- void updateScrollOffset();
-
- void calcZoomInFactors(int originX, int originY);
- void calcZoomOutFactors();
- void startAnimation();
-
- Eina_Bool onAnimationStartTimer();
- Eina_Bool onAnimationFrame(double pos);
-
- private:
- enum class State {
- ZOOMED_OUT,
- ZOOMED_IN,
- ZOOMING_OUT,
- ZOOMING_IN
- };
-
- private:
- ucl::StyledWidgetWRef m_scroller;
- ucl::Layout m_layout;
- ucl::Widget m_grid;
- ucl::Widget m_lowResImage;
- ucl::Widget m_highResImage;
-
- int m_imageW;
- int m_imageH;
-
- int m_scrollerW;
- int m_scrollerH;
- int m_gridW;
- int m_gridH;
- double m_scale0;
- double m_scale1;
-
- double m_xf1;
- double m_yf1;
- double m_xf2;
- double m_yf2;
- double m_zoom;
-
- Ecore_Timer *m_animationStartTimer;
- Ecore_Animator *m_animator;
- State m_state;
- };
-}
-
-#endif // __GALLERY_VIEW_IMAGE_VIEWER_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 __GALLERY_VIEW_PAGE_CONTENT_H__
-#define __GALLERY_VIEW_PAGE_CONTENT_H__
-
-#include "ucl/gui/Layout.h"
-
-#include "types.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(PageContent);
-
- class PageContent : public ucl::ElmWidget {
- public:
- class Builder {
- public:
- Builder();
- Builder &setFlags(int flags);
- PageContentSRef build(ucl::ElmWidget &parent) const;
- private:
- int m_flags;
- };
-
- enum {
- FLAG_MORE_OPTIONS = 1,
- FLAG_SELECT_BUTTON = 2,
- FLAG_BOTTOM_BUTTON = 4,
-
- FLAGS_SELECT_MODE = (FLAG_SELECT_BUTTON | FLAG_BOTTOM_BUTTON),
- FLAGS_ALL = (FLAG_MORE_OPTIONS | FLAGS_SELECT_MODE)
- };
-
- enum class Part {
- DEFAULT,
- OVERLAY,
- MORE_OPTIONS,
- SELECT_BUTTON,
- BOTTOM_BUTTON
- };
-
- public:
- ucl::Result set(Evas_Object *eo, Part part = Part::DEFAULT);
- Evas_Object *unset(Part part = Part::DEFAULT);
-
- Evas_Object *get(Part part = Part::DEFAULT) const;
-
- ucl::Result setSelectButtonVisible(bool visible);
- ucl::Result setMoreOptionsVisible(bool visible);
-
- private:
- friend class ucl::RefCountObj<PageContent>;
- PageContent(ucl::RefCountObjBase &rc,
- const ucl::LayoutSRef &layout, int flags);
- virtual ~PageContent();
-
- void prepare(int flags);
-
- template <class FUNC>
- ucl::Result doWithPart(Part part, FUNC &&func) const;
-
- ucl::Layout *getTopLayout() const;
-
- private:
- ucl::LayoutWRef m_moreOptions;
- ucl::LayoutSRef m_selectMode;
- ucl::LayoutSRef m_bottomButton;
- };
-}
-
-#endif // __GALLERY_VIEW_PAGE_CONTENT_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 __GALLERY_VIEW_TOUCH_PARSER_H__
-#define __GALLERY_VIEW_TOUCH_PARSER_H__
-
-#include "ucl/gui/Widget.h"
-
-#include "types.h"
-
-namespace gallery {
-
- UCL_DECLARE_REF_ALIASES(TouchParser);
-
- class TouchParser final : public ucl::RefCountAware {
- public:
- using TapHandler = ucl::WeakDelegate<void(int x, int y)>;
-
- private:
- friend class ucl::RefCountObj<TouchParser>;
- TouchParser(ucl::RefCountObjBase &rc, ucl::Widget &eventSource);
- virtual ~TouchParser();
-
- public:
- void setTapHandler(const TapHandler &handler);
- void setDoubleTapHandler(const TapHandler &handler);
- void setTapAndHoldHandler(const TapHandler &handler);
-
- private:
- void onMouseDown(ucl::Widget &widget, void *eventInfo);
- void onMouseUp(ucl::Widget &widget, void *eventInfo);
- void onMouseMove(ucl::Widget &widget, void *eventInfo);
-
- void updateIsTapPossible(int flags, int curX, int curY);
-
- bool isFastTap(ucl::UInt curTime, int curX, int curY) const;
- double calcDownDistance(int curX, int curY) const;
-
- void restartHoldTimer();
- void stopHoldTimer();
- Eina_Bool onHoldTimer();
-
- private:
- TapHandler m_tapHandler;
- TapHandler m_doubleTapHandler;
- TapHandler m_tapAndHoldHandler;
- Ecore_Timer *m_holdTimer;
- ucl::UInt m_downTime;
- int m_downX;
- int m_downY;
- int m_tapCounter;
- bool m_isMouseDown;
- bool m_isTapPossible;
- };
-}
-
-#endif // __GALLERY_VIEW_TOUCH_PARSER_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 __GALLERY_VIEW_HELPERS_H__
-#define __GALLERY_VIEW_HELPERS_H__
-
-#include "ucl/gui/Naviframe.h"
-
-#include "types.h"
-
-namespace gallery { namespace util {
-
- ucl::Result createCircleSurface(ucl::Naviframe &navi);
- Eext_Circle_Surface *getCircleSurface(const ucl::ElmWidget &widget);
-
- ucl::ElmWidgetSRef createFakeAccessObject(ucl::ElmWidget &parent);
-}}
-
-namespace gallery {
-
- void addRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data);
- void delRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data);
-
- ucl::LayoutTheme getImageTheme(const char *fileName);
-
- Elm_Atspi_Relation_Type getFlowRelation(Elm_Atspi_Gesture_Info gestureInfo);
-}
-
-#endif // __GALLERY_VIEW_HELPERS_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 __GALLERY_VIEW_TYPES_H__
-#define __GALLERY_VIEW_TYPES_H__
-
-#include <efl_extension.h>
-
-#include "ucl/gui/types.h"
-
-#include "../types.h"
-
-#endif // __GALLERY_VIEW_TYPES_H__
#undef UCL_LOG_TAG
#define UCL_LOG_TAG GALLERY_LOG_TAG
-#include "internal.h"
+#include "helpers.h"
namespace gallery {
--- /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 __GALLERY_HELPERS_H__
+#define __GALLERY_HELPERS_H__
+
+#include "gallery/types.h"
+
+namespace gallery { namespace util {
+
+ template <class GETTER, class V, class ...ARGS>
+ ucl::Result get(GETTER &&getter, V &result, ARGS &&...args);
+
+ template <class GETTER, class V, class ...ARGS>
+ ucl::Result getNz(GETTER &&getter, V &result, ARGS &&...args);
+
+ template <class FUNC, class ...ARGS>
+ ucl::Result call(FUNC &&func, ARGS &&...args);
+}}
+
+#include "helpers.hpp"
+
+#endif // __GALLERY_HELPERS_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 "ucl/util/helpers.h"
+#include "ucl/util/logging.h"
+
+namespace gallery { namespace util { namespace himpl {
+
+ template <class GETTER, class ...ARGS>
+ inline ucl::Result get(GETTER &&getter, bool optional,
+ std::string &result, ARGS &&...args)
+ {
+ char *value = nullptr;
+ const int ret = getter(std::forward<ARGS>(args)..., &value);
+ if ((ret != 0) || (!optional && ucl::isEmpty(value))) {
+ UCL_ELOG("get() failed: %d", ret);
+ return ucl::RES_FAIL;
+ }
+
+ if (value) {
+ result = value;
+ free(value);
+ } else {
+ result.clear();
+ }
+
+ return ucl::RES_OK;
+ }
+
+ template <class GETTER, class V, class ...ARGS>
+ inline ucl::Result get(GETTER &&getter, bool optional,
+ V &result, ARGS &&...args)
+ {
+ typename std::remove_pointer<decltype(&result)>::type value = {};
+
+ const int ret = getter(std::forward<ARGS>(args)..., &value);
+ if ((ret != 0) || (!optional && !value)) {
+ UCL_ELOG("get() failed: %d", ret);
+ return ucl::RES_FAIL;
+ }
+
+ result = value;
+
+ return ucl::RES_OK;
+ }
+}}}
+
+namespace gallery { namespace util {
+
+ template <class GETTER, class V, class ...ARGS>
+ inline ucl::Result get(GETTER &&getter, V &result, ARGS &&...args)
+ {
+ return himpl::get(std::forward<GETTER>(getter), true,
+ result, std::forward<ARGS>(args)...);
+ }
+
+ template <class GETTER, class V, class ...ARGS>
+ inline ucl::Result getNz(GETTER &&getter, V &result, ARGS &&...args)
+ {
+ return himpl::get(std::forward<GETTER>(getter), false,
+ result, std::forward<ARGS>(args)...);
+ }
+
+ template <class FUNC, class ...ARGS>
+ inline ucl::Result call(FUNC &&func, ARGS &&...args)
+ {
+ const int ret = func(std::forward<ARGS>(args)...);
+ if (ret != 0) {
+ UCL_ELOG("func() failed: %d", ret);
+ return ucl::RES_FAIL;
+ }
+ return ucl::RES_OK;
+ }
+}}
+++ /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 __GALLERY_INTERNAL_H__
-#define __GALLERY_INTERNAL_H__
-
-#include "types.h"
-
-namespace gallery { namespace util {
-
- template <class GETTER, class V, class ...ARGS>
- ucl::Result get(GETTER &&getter, V &result, ARGS &&...args);
-
- template <class GETTER, class V, class ...ARGS>
- ucl::Result getNz(GETTER &&getter, V &result, ARGS &&...args);
-
- template <class FUNC, class ...ARGS>
- ucl::Result call(FUNC &&func, ARGS &&...args);
-}}
-
-#include "internal.hpp"
-
-#endif // __GALLERY_INTERNAL_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 "ucl/util/helpers.h"
-#include "ucl/util/logging.h"
-
-namespace gallery { namespace util { namespace himpl {
-
- template <class GETTER, class ...ARGS>
- inline ucl::Result get(GETTER &&getter, bool optional,
- std::string &result, ARGS &&...args)
- {
- char *value = nullptr;
- const int ret = getter(std::forward<ARGS>(args)..., &value);
- if ((ret != 0) || (!optional && ucl::isEmpty(value))) {
- UCL_ELOG("get() failed: %d", ret);
- return ucl::RES_FAIL;
- }
-
- if (value) {
- result = value;
- free(value);
- } else {
- result.clear();
- }
-
- return ucl::RES_OK;
- }
-
- template <class GETTER, class V, class ...ARGS>
- inline ucl::Result get(GETTER &&getter, bool optional,
- V &result, ARGS &&...args)
- {
- typename std::remove_pointer<decltype(&result)>::type value = {};
-
- const int ret = getter(std::forward<ARGS>(args)..., &value);
- if ((ret != 0) || (!optional && !value)) {
- UCL_ELOG("get() failed: %d", ret);
- return ucl::RES_FAIL;
- }
-
- result = value;
-
- return ucl::RES_OK;
- }
-}}}
-
-namespace gallery { namespace util {
-
- template <class GETTER, class V, class ...ARGS>
- inline ucl::Result get(GETTER &&getter, V &result, ARGS &&...args)
- {
- return himpl::get(std::forward<GETTER>(getter), true,
- result, std::forward<ARGS>(args)...);
- }
-
- template <class GETTER, class V, class ...ARGS>
- inline ucl::Result getNz(GETTER &&getter, V &result, ARGS &&...args)
- {
- return himpl::get(std::forward<GETTER>(getter), false,
- result, std::forward<ARGS>(args)...);
- }
-
- template <class FUNC, class ...ARGS>
- inline ucl::Result call(FUNC &&func, ARGS &&...args)
- {
- const int ret = func(std::forward<ARGS>(args)...);
- if (ret != 0) {
- UCL_ELOG("func() failed: %d", ret);
- return ucl::RES_FAIL;
- }
- return ucl::RES_OK;
- }
-}}
#include "ucl/appfw/UIApp.h"
-#include "presenters/InstanceManager.h"
+#include "gallery/presenters/InstanceManager.h"
#include "common.h"
#include "ucl/util/threading/Thread.h"
-#include "model/IJob.h"
+#include "gallery/model/IJob.h"
namespace gallery {
* limitations under the License.
*/
-#include "model/Gallery.h"
+#include "gallery/model/Gallery.h"
#include "GalleryAlbum.h"
#include "ucl/misc/Event.h"
-#include "model/IMediaAlbum.h"
+#include "gallery/model/IMediaAlbum.h"
namespace gallery {
* limitations under the License.
*/
-#include "model/MediaItem.h"
+#include "gallery/model/MediaItem.h"
#include <Ecore_File.h>
#include <storage.h>
* limitations under the License.
*/
-#include "model/SoundManager.h"
+#include "gallery/model/SoundManager.h"
#include "common.h"
#ifndef __GALLERY_MODEL_COMMON_H__
#define __GALLERY_MODEL_COMMON_H__
-#include "internal.h"
+#include "helpers.h"
#include "../common.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 "helpers.h"
+
+#include <Ecore_File.h>
+#include <storage.h>
+
+#include "common.h"
+
+namespace gallery { namespace { namespace impl {
+
+ constexpr auto UNIQUE_PATH_RESERVE = 10;
+}}}
+
+namespace gallery {
+
+ using ucl::Mutex;
+
+ Mutex &getMediaMutex()
+ {
+ static Mutex mutex{true};
+ return mutex;
+ }
+
+ Result getInternalStorageId(int &result)
+ {
+ struct StorageIdRec {
+ int id;
+ bool valid;
+ } storageIdRec {0, false};
+
+ const int ret = storage_foreach_device_supported(
+ [](int storageId, storage_type_e type,
+ storage_state_e state, const char *path, void *userData)
+ {
+ if ((type != STORAGE_TYPE_INTERNAL) ||
+ (state != STORAGE_STATE_MOUNTED)) {
+ return true;
+ }
+ auto &storageIdRec = *static_cast<StorageIdRec *>(userData);
+ storageIdRec.id = storageId;
+ storageIdRec.valid = true;
+ return false;
+ },
+ &storageIdRec);
+ if (ret != 0) {
+ LOG_RETURN(RES_FAIL,
+ "storage_foreach_device_supported() failed: %d", ret);
+ }
+
+ if (!storageIdRec.valid) {
+ LOG_RETURN(RES_FAIL, "Writable internal storage not found!");
+ }
+
+ result = storageIdRec.id;
+
+ return RES_OK;
+ }
+}
+
+namespace gallery { namespace util {
+
+ std::string extractFileName(const std::string &path)
+ {
+ const auto bsPos = path.rfind('/');
+ if (bsPos == (path.size() - 1)) {
+ return {};
+ }
+ return path.substr(bsPos + 1);
+ }
+
+ std::string extractFileExtension(const std::string &name)
+ {
+ const auto dotPos = name.rfind('.');
+ if ((dotPos == std::string::npos) ||
+ (dotPos == 0) || (dotPos == (name.size() - 1))) {
+ return {};
+ }
+ return name.substr(dotPos + 1);
+ }
+
+ void splitFilePath(const std::string &path, std::string &directory,
+ std::string &baseName, std::string &extension)
+ {
+ splitFileName(path, baseName, extension);
+ if (isNotEmpty(baseName)) {
+ directory = path.substr(0, (path.size() - baseName.size() -
+ (isNotEmpty(extension) ? (extension.size() - 1) : 0)));
+ } else {
+ directory = path;
+ }
+ }
+
+ void splitFileName(const std::string &path,
+ std::string &baseName, std::string &extension)
+ {
+ baseName = extractFileName(path);
+ if (isNotEmpty(baseName)) {
+ extension = extractFileExtension(baseName);
+ if (isNotEmpty(extension)) {
+ baseName.resize(baseName.size() - extension.size() - 1);
+ }
+ } else {
+ extension.clear();
+ }
+ }
+
+ std::string makeUniqueFilePath(const std::string &srcPath,
+ const std::string &dstDir)
+ {
+ std::string baseName;
+ std::string extension;
+ splitFileName(srcPath, baseName, extension);
+
+ std::string result;
+ result.reserve(dstDir.size() + baseName.size() +
+ extension.size() + impl::UNIQUE_PATH_RESERVE);
+
+ result = dstDir;
+ if (isNotEmpty(result) && (result.back() != '/')) {
+ result += '/';
+ }
+ result += baseName;
+
+ const auto baseSize = result.size();
+
+ for (int counter = 2; ; ++counter) {
+ if (isNotEmpty(extension)) {
+ result += '.';
+ result += extension;
+ }
+ if (!ecore_file_exists(result.c_str())) {
+ break;
+ }
+ result.resize(baseSize);
+ result += " (";
+ result += std::to_string(counter);
+ 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.
+ */
+
+#ifndef __GALLERY_MODEL_HELPERS_H__
+#define __GALLERY_MODEL_HELPERS_H__
+
+#include <media_content.h>
+
+#include "ucl/util/threading.h"
+
+#include "gallery/model/types.h"
+
+namespace gallery {
+
+ MediaType toMediaType(media_content_type_e contentType);
+
+ ucl::Mutex &getMediaMutex();
+
+ ucl::Result getInternalStorageId(int &result);
+}
+
+namespace gallery { namespace util {
+
+ std::string extractFileName(const std::string &path);
+
+ std::string extractFileExtension(const std::string &name);
+
+ void splitFilePath(const std::string &path, std::string &directory,
+ std::string &baseName, std::string &extension);
+
+ void splitFileName(const std::string &path,
+ std::string &baseName, std::string &extension);
+
+ std::string makeUniqueFilePath(const std::string &srcPath,
+ const std::string &dstDir);
+
+ bool beginsWith(const std::string &str, const std::string &prefix,
+ bool caseSensitive = true);
+ bool removePrefix(std::string &str, const std::string &prefix,
+ bool caseSensitive = true);
+}}
+
+#include "helpers.hpp"
+
+#endif // __GALLERY_MODEL_HELPERS_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.
+ */
+
+namespace gallery {
+
+ inline MediaType toMediaType(const media_content_type_e contentType)
+ {
+ switch (contentType) {
+ case MEDIA_CONTENT_TYPE_IMAGE: return MediaType::IMAGE;
+ case MEDIA_CONTENT_TYPE_VIDEO: return MediaType::VIDEO;
+ case MEDIA_CONTENT_TYPE_SOUND: return MediaType::SOUND;
+ case MEDIA_CONTENT_TYPE_MUSIC: return MediaType::MUSIC;
+ default:
+ break;
+ }
+ return MediaType::OTHERS;
+ }
+}
+
+namespace gallery { namespace util {
+
+ inline bool beginsWith(const std::string &str, const std::string &prefix,
+ bool caseSensitive)
+ {
+ if (caseSensitive) {
+ return (str.compare(0, prefix.size(), prefix) == 0);
+ }
+ return (strncasecmp(str.c_str(), prefix.c_str(), prefix.size()) == 0);
+ }
+
+ inline bool removePrefix(std::string &str, const std::string &prefix,
+ bool caseSensitive)
+ {
+ if (beginsWith(str, prefix, caseSensitive)) {
+ str = str.substr(prefix.size());
+ return true;
+ }
+ return 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 "internal.h"
-
-#include <Ecore_File.h>
-#include <storage.h>
-
-#include "common.h"
-
-namespace gallery { namespace { namespace impl {
-
- constexpr auto UNIQUE_PATH_RESERVE = 10;
-}}}
-
-namespace gallery {
-
- using ucl::Mutex;
-
- Mutex &getMediaMutex()
- {
- static Mutex mutex{true};
- return mutex;
- }
-
- Result getInternalStorageId(int &result)
- {
- struct StorageIdRec {
- int id;
- bool valid;
- } storageIdRec {0, false};
-
- const int ret = storage_foreach_device_supported(
- [](int storageId, storage_type_e type,
- storage_state_e state, const char *path, void *userData)
- {
- if ((type != STORAGE_TYPE_INTERNAL) ||
- (state != STORAGE_STATE_MOUNTED)) {
- return true;
- }
- auto &storageIdRec = *static_cast<StorageIdRec *>(userData);
- storageIdRec.id = storageId;
- storageIdRec.valid = true;
- return false;
- },
- &storageIdRec);
- if (ret != 0) {
- LOG_RETURN(RES_FAIL,
- "storage_foreach_device_supported() failed: %d", ret);
- }
-
- if (!storageIdRec.valid) {
- LOG_RETURN(RES_FAIL, "Writable internal storage not found!");
- }
-
- result = storageIdRec.id;
-
- return RES_OK;
- }
-}
-
-namespace gallery { namespace util {
-
- std::string extractFileName(const std::string &path)
- {
- const auto bsPos = path.rfind('/');
- if (bsPos == (path.size() - 1)) {
- return {};
- }
- return path.substr(bsPos + 1);
- }
-
- std::string extractFileExtension(const std::string &name)
- {
- const auto dotPos = name.rfind('.');
- if ((dotPos == std::string::npos) ||
- (dotPos == 0) || (dotPos == (name.size() - 1))) {
- return {};
- }
- return name.substr(dotPos + 1);
- }
-
- void splitFilePath(const std::string &path, std::string &directory,
- std::string &baseName, std::string &extension)
- {
- splitFileName(path, baseName, extension);
- if (isNotEmpty(baseName)) {
- directory = path.substr(0, (path.size() - baseName.size() -
- (isNotEmpty(extension) ? (extension.size() - 1) : 0)));
- } else {
- directory = path;
- }
- }
-
- void splitFileName(const std::string &path,
- std::string &baseName, std::string &extension)
- {
- baseName = extractFileName(path);
- if (isNotEmpty(baseName)) {
- extension = extractFileExtension(baseName);
- if (isNotEmpty(extension)) {
- baseName.resize(baseName.size() - extension.size() - 1);
- }
- } else {
- extension.clear();
- }
- }
-
- std::string makeUniqueFilePath(const std::string &srcPath,
- const std::string &dstDir)
- {
- std::string baseName;
- std::string extension;
- splitFileName(srcPath, baseName, extension);
-
- std::string result;
- result.reserve(dstDir.size() + baseName.size() +
- extension.size() + impl::UNIQUE_PATH_RESERVE);
-
- result = dstDir;
- if (isNotEmpty(result) && (result.back() != '/')) {
- result += '/';
- }
- result += baseName;
-
- const auto baseSize = result.size();
-
- for (int counter = 2; ; ++counter) {
- if (isNotEmpty(extension)) {
- result += '.';
- result += extension;
- }
- if (!ecore_file_exists(result.c_str())) {
- break;
- }
- result.resize(baseSize);
- result += " (";
- result += std::to_string(counter);
- 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.
- */
-
-#ifndef __GALLERY_MODEL_INTERNAL_H__
-#define __GALLERY_MODEL_INTERNAL_H__
-
-#include <media_content.h>
-
-#include "ucl/util/threading.h"
-
-#include "model/types.h"
-
-namespace gallery {
-
- MediaType toMediaType(media_content_type_e contentType);
-
- ucl::Mutex &getMediaMutex();
-
- ucl::Result getInternalStorageId(int &result);
-}
-
-namespace gallery { namespace util {
-
- std::string extractFileName(const std::string &path);
-
- std::string extractFileExtension(const std::string &name);
-
- void splitFilePath(const std::string &path, std::string &directory,
- std::string &baseName, std::string &extension);
-
- void splitFileName(const std::string &path,
- std::string &baseName, std::string &extension);
-
- std::string makeUniqueFilePath(const std::string &srcPath,
- const std::string &dstDir);
-
- bool beginsWith(const std::string &str, const std::string &prefix,
- bool caseSensitive = true);
- bool removePrefix(std::string &str, const std::string &prefix,
- bool caseSensitive = true);
-}}
-
-#include "internal.hpp"
-
-#endif // __GALLERY_MODEL_INTERNAL_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.
- */
-
-namespace gallery {
-
- inline MediaType toMediaType(const media_content_type_e contentType)
- {
- switch (contentType) {
- case MEDIA_CONTENT_TYPE_IMAGE: return MediaType::IMAGE;
- case MEDIA_CONTENT_TYPE_VIDEO: return MediaType::VIDEO;
- case MEDIA_CONTENT_TYPE_SOUND: return MediaType::SOUND;
- case MEDIA_CONTENT_TYPE_MUSIC: return MediaType::MUSIC;
- default:
- break;
- }
- return MediaType::OTHERS;
- }
-}
-
-namespace gallery { namespace util {
-
- inline bool beginsWith(const std::string &str, const std::string &prefix,
- bool caseSensitive)
- {
- if (caseSensitive) {
- return (str.compare(0, prefix.size(), prefix) == 0);
- }
- return (strncasecmp(str.c_str(), prefix.c_str(), prefix.size()) == 0);
- }
-
- inline bool removePrefix(std::string &str, const std::string &prefix,
- bool caseSensitive)
- {
- if (beginsWith(str, prefix, caseSensitive)) {
- str = str.substr(prefix.size());
- return true;
- }
- return false;
- }
-}}
* limitations under the License.
*/
-#include "presenters/AlertDialog.h"
+#include "gallery/presenters/AlertDialog.h"
+
+#include "gallery/resources.h"
-#include "resources.h"
#include "common.h"
namespace gallery { namespace { namespace impl {
* limitations under the License.
*/
-#include "presenters/AtspiHighlightHelper.h"
+#include "gallery/presenters/AtspiHighlightHelper.h"
#include "common.h"
* limitations under the License.
*/
-#include "presenters/Instance.h"
+#include "gallery/presenters/Instance.h"
#include <system_settings.h>
#include "ucl/appfw/helpers.h"
-#include "presenters/NoContentPage.h"
-#include "presenters/ThumbnailPage.h"
-#include "presenters/ViewerPage.h"
-#include "presenters/VideoPlayerPage.h"
+#include "gallery/presenters/NoContentPage.h"
+#include "gallery/presenters/ThumbnailPage.h"
+#include "gallery/presenters/ViewerPage.h"
+#include "gallery/presenters/VideoPlayerPage.h"
+
+#include "gallery/resources.h"
-#include "resources.h"
#include "common.h"
namespace gallery { namespace { namespace impl {
* limitations under the License.
*/
-#include "presenters/InstanceManager.h"
+#include "gallery/presenters/InstanceManager.h"
-#include "presenters/Instance.h"
+#include "gallery/presenters/Instance.h"
#include "common.h"
* limitations under the License.
*/
-#include "presenters/MoreOptionsPresenter.h"
+#include "gallery/presenters/MoreOptionsPresenter.h"
#include "ucl/gui/Layout.h"
* limitations under the License.
*/
-#include "presenters/NoContentPage.h"
+#include "gallery/presenters/NoContentPage.h"
#include "ucl/gui/Layout.h"
-#include "resources.h"
+#include "gallery/resources.h"
+
#include "common.h"
namespace gallery {
* limitations under the License.
*/
-#include "presenters/Page.h"
+#include "gallery/presenters/Page.h"
#include "common.h"
* limitations under the License.
*/
-#include "presenters/Presenter.h"
+#include "gallery/presenters/Presenter.h"
#include "common.h"
* limitations under the License.
*/
-#include "presenters/PreviewPage.h"
+#include "gallery/presenters/PreviewPage.h"
-#include "presenters/ViewerPage.h"
+#include "gallery/presenters/ViewerPage.h"
+
+#include "gallery/resources.h"
-#include "resources.h"
#include "common.h"
namespace gallery { namespace { namespace impl {
* limitations under the License.
*/
-#include "presenters/ProcessingPresenter.h"
+#include "gallery/presenters/ProcessingPresenter.h"
#include "common.h"
* limitations under the License.
*/
-#include "presenters/SelectModePresenter.h"
+#include "gallery/presenters/SelectModePresenter.h"
#include "ucl/gui/WidgetItem.h"
-#include "resources.h"
+#include "gallery/resources.h"
+
#include "common.h"
namespace gallery { namespace { namespace impl {
* limitations under the License.
*/
-#include "presenters/ThumbnailPage.h"
+#include "gallery/presenters/ThumbnailPage.h"
-#include "presenters/PreviewPage.h"
+#include "gallery/presenters/PreviewPage.h"
+
+#include "gallery/resources.h"
-#include "resources.h"
#include "common.h"
namespace gallery { namespace { namespace impl {
* limitations under the License.
*/
-#include "presenters/VideoPlayerPage.h"
+#include "gallery/presenters/VideoPlayerPage.h"
#include <efl_util.h>
#include "ucl/appfw/types.h"
-#include "resources.h"
+#include "gallery/resources.h"
+
#include "common.h"
namespace gallery { namespace { namespace impl {
* limitations under the License.
*/
-#include "presenters/ViewerPage.h"
+#include "gallery/presenters/ViewerPage.h"
+
+#include "gallery/resources.h"
-#include "resources.h"
#include "common.h"
namespace gallery { namespace { namespace impl {
#ifndef __GALLERY_PRESENTERS_COMMON_H__
#define __GALLERY_PRESENTERS_COMMON_H__
-#include "internal.h"
+#include "helpers.h"
#include "../view/common.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 "helpers.h"
+
+#include "common.h"
+
+namespace gallery { namespace { namespace impl {
+
+ constexpr EoDataKey INSTANCE_PTR {"gallery,instance,data,ptr"};
+}}}
+
+namespace gallery {
+
+ using ucl::Window;
+
+ void setInstancePaused(Window &win, const bool value)
+ {
+ win.setData(impl::INSTANCE_PTR, reinterpret_cast<void *>(value));
+ win.callEvent((value ? INSTANCE_PAUSED : INSTANCE_RESUMED), nullptr);
+ }
+
+ bool isInstancePaused(const Window &win)
+ {
+ return (reinterpret_cast<intptr_t>(
+ win.getData(impl::INSTANCE_PTR)) != 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.
+ */
+
+#ifndef __GALLERY_PRESENTERS_HELPERS_H__
+#define __GALLERY_PRESENTERS_HELPERS_H__
+
+#include "ucl/gui/Window.h"
+
+namespace gallery {
+
+ constexpr ucl::SmartEvent INSTANCE_PAUSED {"gallery,instance,paused"};
+ constexpr ucl::SmartEvent INSTANCE_RESUMED {"gallery,instance,resumed"};
+
+ void setInstancePaused(ucl::Window &win, bool value);
+ bool isInstancePaused(const ucl::Window &win);
+}
+
+#endif // __GALLERY_PRESENTERS_HELPERS_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 "internal.h"
-
-#include "common.h"
-
-namespace gallery { namespace { namespace impl {
-
- constexpr EoDataKey INSTANCE_PTR {"gallery,instance,data,ptr"};
-}}}
-
-namespace gallery {
-
- using ucl::Window;
-
- void setInstancePaused(Window &win, const bool value)
- {
- win.setData(impl::INSTANCE_PTR, reinterpret_cast<void *>(value));
- win.callEvent((value ? INSTANCE_PAUSED : INSTANCE_RESUMED), nullptr);
- }
-
- bool isInstancePaused(const Window &win)
- {
- return (reinterpret_cast<intptr_t>(
- win.getData(impl::INSTANCE_PTR)) != 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.
- */
-
-#ifndef __GALLERY_PRESENTERS_INTERNAL_H__
-#define __GALLERY_PRESENTERS_INTERNAL_H__
-
-#include "ucl/gui/Window.h"
-
-namespace gallery {
-
- constexpr ucl::SmartEvent INSTANCE_PAUSED {"gallery,instance,paused"};
- constexpr ucl::SmartEvent INSTANCE_RESUMED {"gallery,instance,resumed"};
-
- void setInstancePaused(ucl::Window &win, bool value);
- bool isInstancePaused(const ucl::Window &win);
-}
-
-#endif // __GALLERY_PRESENTERS_INTERNAL_H__
* limitations under the License.
*/
-#include "resources.h"
+#include "gallery/resources.h"
namespace gallery {
* limitations under the License.
*/
-#include "view/ImageGrid.h"
+#include "gallery/view/ImageGrid.h"
#include <array>
#include <vector>
#include "ucl/gui/Layout.h"
#include "ucl/gui/Window.h"
-#include "view/TouchParser.h"
+#include "gallery/view/TouchParser.h"
#include "common.h"
* limitations under the License.
*/
-#include "view/ImageViewer.h"
+#include "gallery/view/ImageViewer.h"
#include "common.h"
* limitations under the License.
*/
-#include "view/PageContent.h"
+#include "gallery/view/PageContent.h"
#include "common.h"
* limitations under the License.
*/
-#include "view/TouchParser.h"
+#include "gallery/view/TouchParser.h"
#include "common.h"
#include "ucl/gui/stdTheme.h"
#include "ucl/gui/helpers.h"
-#include "view/helpers.h"
+#include "gallery/view/helpers.h"
#include "../common.h"
* limitations under the License.
*/
-#include "view/helpers.h"
+#include "gallery/view/helpers.h"
#include <vector>