• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

digikam

album.h

Go to the documentation of this file.
00001 /* ============================================================
00002  *
00003  * This file is a part of digiKam project
00004  * http://www.digikam.org
00005  *
00006  * Date        : 2004-06-15
00007  * Description : digiKam album types
00008  *
00009  * Copyright (C) 2004-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu>
00010  * Copyright (C) 2006-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
00011  *
00012  * This program is free software; you can redistribute it
00013  * and/or modify it under the terms of the GNU General
00014  * Public License as published by the Free Software Foundation;
00015  * either version 2, or (at your option)
00016  * any later version.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * ============================================================ */
00024 
00027 #ifndef ALBUM_H
00028 #define ALBUM_H
00029 
00030 // Qt includes.
00031 
00032 #include <QList>
00033 #include <QString>
00034 #include <QDateTime>
00035 #include <QMap>
00036 
00037 // KDE includes.
00038 
00039 #include <kurl.h>
00040 
00041 // Local includes.
00042 
00043 #include "albuminfo.h"
00044 #include "databaseurl.h"
00045 
00046 namespace Digikam
00047 {
00048 
00060 class Album
00061 {
00062 public:
00063 
00064     enum Type
00065     {
00066         PHYSICAL=0, 
00067         TAG,        
00068         DATE,       
00069         SEARCH      
00070     };
00071 
00075     Album*  parent() const;
00076 
00080     Album*  firstChild() const;
00081 
00085     Album*  lastChild() const;
00086 
00092     Album*  next() const;
00093 
00099     Album*  prev() const;
00100 
00105     Type    type() const;
00106 
00116     int     id() const;
00117 
00135     int     globalID() const;
00136 
00140     QString title() const;
00141 
00145     virtual DatabaseUrl databaseUrl() const = 0;
00146 
00150     bool    isRoot() const;
00151 
00158     bool    isAncestorOf(Album* album) const;
00159 
00189     void    setExtraData(const void* key, void *value);
00190 
00198     void    removeExtraData(const void* key);
00199 
00207     void*   extraData(const void* key) const;
00208 
00209 protected:
00210 
00214     Album(Album::Type type, int id, bool root);
00215 
00221     virtual ~Album();
00222 
00226     void    clear();
00227 
00235     void setTitle(const QString& title);
00236 
00244     void setParent(Album* parent);
00245 
00253     void insertChild(Album* child);
00254 
00262     void removeChild(Album* child);
00263 
00264 private:
00265 
00269     Album();
00270     Album(const Album&);
00271     Album& operator==(const Album&);
00272 
00273 private:
00274 
00275     bool                     m_root;
00276     bool                     m_clearing;
00277 
00278     int                      m_id;
00279 
00280     QString                  m_title;
00281     QMap<const void*, void*> m_extraMap;
00282 
00283     Type                     m_type;
00284 
00285     Album*                   m_parent;
00286     Album*                   m_firstChild;
00287     Album*                   m_lastChild;
00288     Album*                   m_next;
00289     Album*                   m_prev;
00290 
00291     friend class AlbumManager;
00292 };
00293 
00299 class PAlbum : public Album
00300 {
00301 public:
00302 
00304     PAlbum(const QString& title);
00306     PAlbum(int albumRoot, const QString &label);
00308     PAlbum(int albumRoot, const QString &parentPath, const QString& title, int id);
00309     ~PAlbum();
00310 
00311     void setCaption(const QString& caption);
00312     void setCollection(const QString& collection);
00313     void setDate(const QDate& date);
00314 
00315     QString     albumRootPath() const;
00316     int         albumRootId() const;
00317     QString     caption() const;
00318     QString     collection() const;
00319     QDate       date() const;
00320     QString     albumPath() const;
00321     QString     prettyUrl() const;
00322     QString     folderPath() const;
00323     DatabaseUrl databaseUrl() const;
00324     KUrl        fileUrl() const;
00325     QString     icon() const;
00326     KUrl        iconKURL() const;
00327 
00328     bool        isAlbumRoot() const;
00329 
00330 private:
00331 
00332     int        m_albumRootId;
00333 
00334     QString    m_path;
00335     QString    m_parentPath;
00336     QString    m_collection;
00337     QString    m_caption;
00338     QString    m_icon;
00339 
00340     bool       m_isAlbumRootAlbum;
00341 
00342     QDate      m_date;
00343 
00344     friend class AlbumManager;
00345 };
00346 
00352 class TAlbum : public Album
00353 {
00354 public:
00355 
00356     TAlbum(const QString& title, int id, bool root=false);
00357     ~TAlbum();
00358 
00364     QString     tagPath(bool leadingSlash = true) const;
00365     DatabaseUrl databaseUrl() const;
00366     QString     prettyUrl() const;
00367     QString     icon() const;
00368     QList<int>  tagIDs() const;
00369 
00370 private:
00371 
00372     int     m_pid;
00373 
00374     QString m_icon;
00375 
00376     friend class AlbumManager;
00377 };
00378 
00384 class DAlbum : public Album
00385 {
00386 public:
00387 
00388     enum Range
00389     {
00390         Month = 0,
00391         Year
00392     };
00393 
00394     DAlbum(const QDate& date, bool root=false, Range range=Month);
00395     ~DAlbum();
00396 
00397     QDate date() const;
00398     Range range() const;
00399     DatabaseUrl databaseUrl() const;
00400 
00401 private:
00402 
00403     static int  m_uniqueID;
00404 
00405     QDate       m_date;
00406 
00407     Range       m_range;
00408 
00409     friend class AlbumManager;
00410 };
00411 
00417 class SAlbum : public Album
00418 {
00419 public:
00420 
00421     SAlbum(const QString &title, int id, bool root=false);
00422     ~SAlbum();
00423 
00424     DatabaseUrl          databaseUrl() const;
00425     QString              query() const;
00426     DatabaseSearch::Type type() const;
00427     bool                 isNormalSearch() const;
00428     bool                 isAdvancedSearch() const;
00429     bool                 isKeywordSearch() const;
00430     bool                 isTimelineSearch() const;
00431     bool                 isHaarSearch() const;
00432     bool                 isMapSearch() const;
00433     bool                 isDuplicatesSearch() const;
00434 
00435 private:
00436 
00437     void setSearch(DatabaseSearch::Type type, const QString &query);
00438 
00439 private:
00440 
00441     QString              m_query;
00442     DatabaseSearch::Type m_type;
00443 
00444     friend class AlbumManager;
00445 };
00446 
00465 class AlbumIterator
00466 {
00467 public:
00468 
00469     AlbumIterator(Album *album);
00470     ~AlbumIterator();
00471 
00472     AlbumIterator& operator++();
00473     Album*         operator*();
00474     Album*         current() const;
00475 
00476 private:
00477 
00478     AlbumIterator() {}
00479     AlbumIterator(const AlbumIterator&) {}
00480     AlbumIterator& operator=(const AlbumIterator&){ return *this; }
00481 
00482 private:
00483 
00484     Album* m_current;
00485     Album* m_root;
00486 };
00487 
00488 }  // namespace Digikam
00489 
00490 #endif /* ALBUM_H */

digikam

Skip menu "digikam"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • digikam
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal