1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2018-07-26
7  * Description : common items needed for web services
8  *
9  * Copyright (C) 2018 by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * ============================================================ */
22 
23 #ifndef DIGIKAM_WS_ITEM_H
24 #define DIGIKAM_WS_ITEM_H
25 
26 // Qt includes
27 
28 #include <QString>
29 #include <QStringList>
30 
31 // Local includes
32 
33 #include "digikam_export.h"
34 
35 namespace Digikam
36 {
37 
38 class DIGIKAM_EXPORT WSAlbum
39 {
40 
41 public:
42 
WSAlbum()43     explicit WSAlbum()
44       : parentID(QLatin1String("")),
45         isRoot(true),
46         description(QLatin1String("")),
47         url(QLatin1String("")),
48         uploadable(true)
49     {
50     }
51 
52     /**
53      * This method is used by derived class of WSAblum,
54      * to set the attributes inherited from WSAlbum, knowing
55      * a WSAlbum.
56      */
setBaseAlbum(const WSAlbum & album)57     void setBaseAlbum(const WSAlbum& album)
58     {
59         id          = album.id;
60         parentID    = album.parentID;
61         isRoot      = album.isRoot;
62         title       = album.title;
63         description = album.description;
64         location    = album.location;
65         url         = album.url;
66         uploadable  = album.uploadable;
67     }
68 
69     QString   id;
70     QString   parentID;
71     bool      isRoot;
72 
73     QString   title;
74     QString   description;
75     QString   location;
76     QString   url;
77     bool      uploadable;
78 };
79 
80 /**
81  * This class is used when parsing response of listAlbums().
82  * It contains only the most important attributes of an album,
83  * which is needed for further usage (e.g upload photos, create new album).
84  */
85 class DIGIKAM_EXPORT AlbumSimplified
86 {
87 
88 public:
89 
AlbumSimplified()90     explicit AlbumSimplified()
91       : uploadable(true)
92     {
93     }
94 
AlbumSimplified(const QString & title)95     explicit AlbumSimplified(const QString& title)
96       : title(title),
97         uploadable(true)
98     {
99     }
100 
AlbumSimplified(const QString & title,bool uploadable)101     explicit AlbumSimplified(const QString& title, bool uploadable)
102       : title(title),
103         uploadable(uploadable)
104     {
105     }
106 
107 public:
108 
109     QString     title;
110     QStringList childrenIDs;
111     bool        uploadable;
112 };
113 
114 } // namespace Digikam
115 
116 #endif // DIGIKAM_WS_ITEM_H
117