TizenRefApp-8181 [Gallery] Implement Model sceleton 36/119936/1
authorIgor Nazarov <i.nazarov@samsung.com>
Mon, 20 Mar 2017 16:58:24 +0000 (18:58 +0200)
committerIgor Nazarov <i.nazarov@samsung.com>
Mon, 20 Mar 2017 16:58:24 +0000 (18:58 +0200)
Change-Id: I2d2f893d4538eca644b314ce0dd5ac8039c8ebff

inc/model/Gallery.h [new file with mode: 0644]
inc/model/IMediaAlbum.h [new file with mode: 0644]
inc/model/MediaItem.h [new file with mode: 0644]
inc/model/types.h [new file with mode: 0644]
src/model/Gallery.cpp [new file with mode: 0644]
src/model/MediaItem.cpp [new file with mode: 0644]

diff --git a/inc/model/Gallery.h b/inc/model/Gallery.h
new file mode 100644 (file)
index 0000000..cc5f749
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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 {
+
+       class Gallery final : public ucl::NonCopyable {
+       public:
+               Gallery();
+               ~Gallery();
+
+               IMediaAlbum &getAlbum();
+       };
+}
+
+#endif // __GALLERY_MODEL_GALLERY_H__
diff --git a/inc/model/IMediaAlbum.h b/inc/model/IMediaAlbum.h
new file mode 100644 (file)
index 0000000..40cba07
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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 "types.h"
+
+namespace gallery {
+
+       class IMediaAlbum : public ucl::Polymorphic {
+       public:
+               using EachCb = ucl::Delegate<void(MediaItemUPtr item)>;
+
+       public:
+               virtual ucl::Result forEachMedia(EachCb cb) const = 0;
+       };
+}
+
+#endif // __GALLERY_MODEL_I_MEDIA_ALBUM_H__
diff --git a/inc/model/MediaItem.h b/inc/model/MediaItem.h
new file mode 100644 (file)
index 0000000..1ce85f8
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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 "types.h"
+
+namespace gallery {
+
+       class MediaItem : public ucl::Polymorphic {
+       public:
+               using ThumbnailPathGetCb =
+                               std::function<void(ucl::Result, const std::string &path)>;
+
+       public:
+               MediaItem(media_info_h info);
+               virtual ~MediaItem();
+
+               bool isValid() const;
+               MediaType getType() const;
+
+               const std::string &getFilePath() const;
+
+               ucl::Result getThumbnailPath(ThumbnailPathGetCb cb) const;
+               void cancelThumbnailPathGet() const;
+
+               ucl::Result removeFile();
+
+       private:
+               const MediaType m_type;
+               media_info_h m_info;
+               mutable ThumbnailPathGetCb m_thumbGetCb;
+               mutable std::string m_filePath;
+               mutable std::string m_thumbPath;
+       };
+}
+
+#endif // __GALLERY_MODEL_MEDIA_ITEM_H__
diff --git a/inc/model/types.h b/inc/model/types.h
new file mode 100644 (file)
index 0000000..a0f6103
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __GALLERY_MODEL_TYPES_H__
+#define __GALLERY_MODEL_TYPES_H__
+
+#include <media_content.h>
+
+#include "../types.h"
+
+namespace gallery {
+
+       enum class MediaType {
+               IMAGE,
+               VIDEO,
+               SOUND,
+               MUSIC,
+               OTHER
+       };
+
+       class MediaItem;
+       using MediaItemUPtr = std::unique_ptr<MediaItem>;
+}
+
+#endif // __GALLERY_MODEL_TYPES_H__
diff --git a/src/model/Gallery.cpp b/src/model/Gallery.cpp
new file mode 100644 (file)
index 0000000..34d6d60
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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 "model/Gallery.h"
+
+#include "../common.h"
+
+namespace gallery {
+
+       using namespace ucl;
+
+       Gallery::Gallery()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Gallery::~Gallery()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       IMediaAlbum &Gallery::getAlbum()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+}
diff --git a/src/model/MediaItem.cpp b/src/model/MediaItem.cpp
new file mode 100644 (file)
index 0000000..df68d7a
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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 "model/MediaItem.h"
+
+#include "../common.h"
+
+namespace gallery {
+
+       using namespace ucl;
+
+       MediaItem::MediaItem(media_info_h info) :
+               m_type(MediaType::OTHER)
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       MediaItem::~MediaItem()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       bool MediaItem::isValid() const
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       MediaType MediaItem::getType() const
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       const std::string &MediaItem::getFilePath() const
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result MediaItem::getThumbnailPath(ThumbnailPathGetCb cb) const
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       void MediaItem::cancelThumbnailPathGet() const
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+
+       Result MediaItem::removeFile()
+       {
+               UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!");
+       }
+}