File indexing completed on 2025-01-19 03:53:20

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2004-06-15
0007  * Description : Albums manager interface - private containers.
0008  *
0009  * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2006-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0011  * SPDX-FileCopyrightText: 2015      by Mohamed_Anwer <m_dot_anwer at gmx dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #include "albummanager_p.h"
0018 
0019 namespace Digikam
0020 {
0021 
0022 PAlbumPath::PAlbumPath()
0023     : albumRootId(-1)
0024 {
0025 }
0026 
0027 PAlbumPath::PAlbumPath(int albumRootId, const QString& albumPath)
0028     : albumRootId(albumRootId),
0029       albumPath  (albumPath)
0030 {
0031 }
0032 
0033 PAlbumPath::PAlbumPath(PAlbum* const album)
0034 {
0035     if (album->isRoot())
0036     {
0037         albumRootId = -1;
0038     }
0039     else
0040     {
0041         albumRootId = album->albumRootId();
0042         albumPath   = album->albumPath();
0043     }
0044 }
0045 
0046 bool PAlbumPath::operator==(const PAlbumPath& other) const
0047 {
0048     return ((other.albumRootId == albumRootId) &&
0049             (other.albumPath   == albumPath));
0050 }
0051 
0052 // -----------------------------------------------------------------------------------
0053 
0054 AlbumManager::Private::Private()
0055     : changed                 (false),
0056       hasPriorizedDbPath      (false),
0057       showOnlyAvailableAlbums (false),
0058       longTimeMessageBoxResult(-1),
0059       askMergeMessageBoxResult(-1),
0060       albumListJob            (nullptr),
0061       dateListJob             (nullptr),
0062       tagListJob              (nullptr),
0063       personListJob           (nullptr),
0064       albumWatch              (nullptr),
0065       rootPAlbum              (nullptr),
0066       rootTAlbum              (nullptr),
0067       rootDAlbum              (nullptr),
0068       rootSAlbum              (nullptr),
0069       currentlyMovingAlbum    (nullptr),
0070       changingDB              (false),
0071       scanPAlbumsTimer        (nullptr),
0072       scanTAlbumsTimer        (nullptr),
0073       scanSAlbumsTimer        (nullptr),
0074       scanDAlbumsTimer        (nullptr),
0075       updatePAlbumsTimer      (nullptr),
0076       albumItemCountTimer     (nullptr),
0077       tagItemCountTimer       (nullptr)
0078 {
0079 }
0080 
0081 QString AlbumManager::Private::labelForAlbumRootAlbum(const CollectionLocation& location)
0082 {
0083     QString label = location.label();
0084 
0085     if (label.isEmpty())
0086     {
0087         label = location.albumRootPath();
0088     }
0089 
0090     return label;
0091 }
0092 
0093 // -----------------------------------------------------------------------------------
0094 
0095 ChangingDB::ChangingDB(AlbumManager::Private* const dd)
0096     : d(dd)
0097 {
0098     d->changingDB = true;
0099 }
0100 
0101 ChangingDB::~ChangingDB()
0102 {
0103     d->changingDB = false;
0104 }
0105 
0106 } // namespace Digikam