digiKam
collectionlocation.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2007-04-09
7  * Description : Collection location abstraction
8  *
9  * Copyright (C) 2007-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
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)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_COLLECTION_LOCATION_H
25 #define DIGIKAM_COLLECTION_LOCATION_H
26 
27 // Qt includes
28 
29 #include <QString>
30 #include <QHash>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
35 #include "coredbalbuminfo.h"
36 
37 namespace Digikam
38 {
39 
40 class DIGIKAM_DATABASE_EXPORT CollectionLocation
41 {
42 
43 public:
44 
45  enum Status
46  {
52 
57 
63 
69 
74  LocationDeleted
75  };
76 
77 public:
78 
79  enum Type
80  {
85  TypeVolumeHardWired = AlbumRoot::VolumeHardWired,
86 
92  TypeVolumeRemovable = AlbumRoot::VolumeRemovable,
93 
98  TypeNetwork = AlbumRoot::Network
99  };
100 
101 public:
102 
104 
108  int id() const;
109 
113  Status status() const;
114 
118  Type type() const;
119 
124  QString albumRootPath() const;
125 
129  QString label() const;
130 
131  bool isAvailable() const
132  {
133  return (m_status == LocationAvailable);
134  }
135 
136  bool isNull() const
137  {
138  return (m_status == LocationNull);
139  }
140 
141  uint hash() const
142  {
143  return ::qHash(m_id);
144  }
145 
146 protected:
147 
148  int m_id;
149  QString m_path;
152  QString m_label;
153 };
154 
155 inline uint qHash(const CollectionLocation& loc)
156 {
157  return loc.hash();
158 }
159 
160 } // namespace Digikam
161 
162 #endif // DIGIKAM_COLLECTION_LOCATION_H
uint qHash(const QList< Digikam::Album * > &key)
Definition: albumhistory.cpp:44
Definition: collectionlocation.h:41
Status m_status
Definition: collectionlocation.h:150
QString m_label
Definition: collectionlocation.h:152
uint hash() const
Definition: collectionlocation.h:141
QString m_path
Definition: collectionlocation.h:149
bool isAvailable() const
Definition: collectionlocation.h:131
int m_id
Definition: collectionlocation.h:148
Type
Definition: collectionlocation.h:80
Status
Definition: collectionlocation.h:46
@ LocationNull
Definition: collectionlocation.h:51
@ LocationHidden
Definition: collectionlocation.h:62
@ LocationUnavailable
Definition: collectionlocation.h:68
@ LocationAvailable
Definition: collectionlocation.h:56
bool isNull() const
Definition: collectionlocation.h:136
Type m_type
Definition: collectionlocation.h:151
@ VolumeRemovable
Definition: coredbconstants.h:48
@ VolumeHardWired
Definition: coredbconstants.h:47
@ Network
Definition: coredbconstants.h:49
Status
Definition: coredbconstants.h:85
Definition: datefolderview.cpp:43
uint qHash(const PAlbumPath &id)
Definition: albummanager_p.h:141
Type
Definition: gpsitemcontainer.h:45