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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2005-04-21
0007  * Description : Handling access to one item and associated data
0008  *
0009  * SPDX-FileCopyrightText: 2005      by Renchi Raju <renchi dot raju at gmail dot com>
0010  * SPDX-FileCopyrightText: 2007-2013 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0011  * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0012  * SPDX-FileCopyrightText: 2013      by Michael G. Hansen <mike at mghansen dot de>
0013  *
0014  * SPDX-License-Identifier: GPL-2.0-or-later
0015  *
0016  * ============================================================ */
0017 
0018 #include "iteminfo_p.h"
0019 
0020 namespace Digikam
0021 {
0022 
0023 ThumbnailIdentifier ItemInfo::thumbnailIdentifier() const
0024 {
0025     if (!m_data)
0026     {
0027         return ThumbnailIdentifier();
0028     }
0029 
0030     ThumbnailIdentifier id;
0031     id.id       = m_data->id;
0032     id.filePath = filePath();
0033 
0034     return id;
0035 }
0036 
0037 ThumbnailInfo ItemInfo::thumbnailInfo() const
0038 {
0039     if (!m_data)
0040     {
0041         return ThumbnailInfo();
0042     }
0043 
0044     ThumbnailInfo thumbinfo;
0045 
0046     thumbinfo.id               = m_data->id;
0047     thumbinfo.filePath         = filePath();
0048     thumbinfo.fileName         = name();
0049     thumbinfo.isAccessible     = CollectionManager::instance()->locationForAlbumRootId(m_data->albumRootId).isAvailable();
0050     thumbinfo.modificationDate = modDateTime();
0051     thumbinfo.orientationHint  = orientation();
0052     thumbinfo.uniqueHash       = uniqueHash();
0053     thumbinfo.fileSize         = fileSize();
0054 
0055     if      (category() == DatabaseItem::Image)
0056     {
0057         thumbinfo.mimeType = QLatin1String("image");
0058     }
0059     else if (category() == DatabaseItem::Video)
0060     {
0061         thumbinfo.mimeType = QLatin1String("video");
0062     }
0063 
0064     return thumbinfo;
0065 }
0066 
0067 ThumbnailIdentifier ItemInfo::thumbnailIdentifier(qlonglong id)
0068 {
0069     ItemInfo info(id);
0070 
0071     return info.thumbnailIdentifier();
0072 }
0073 
0074 } // namespace Digikam