File indexing completed on 2025-01-19 03:51:27

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2004-05-16
0007  * Description : time adjust thread.
0008  *
0009  * SPDX-FileCopyrightText: 2012      by Smit Mehta <smit dot meh at gmail dot com>
0010  * SPDX-FileCopyrightText: 2012-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  * SPDX-FileCopyrightText: 2018-2021 by Maik Qualmann <metzpinguin at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_TIME_ADJUST_THREAD_H
0018 #define DIGIKAM_TIME_ADJUST_THREAD_H
0019 
0020 // Qt includes
0021 
0022 #include <QDateTime>
0023 #include <QMap>
0024 #include <QUrl>
0025 
0026 // Local includes
0027 
0028 #include "dinfointerface.h"
0029 #include "actionthreadbase.h"
0030 #include "timeadjustcontainer.h"
0031 
0032 using namespace Digikam;
0033 
0034 namespace DigikamGenericTimeAdjustPlugin
0035 {
0036 
0037 class TimeAdjustThread : public ActionThreadBase
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042 
0043     explicit TimeAdjustThread(QObject* const parent, DInfoInterface* const iface);
0044     ~TimeAdjustThread() override;
0045 
0046     void setUpdatedDates(const QMap<QUrl, int>& itemsMap);
0047     void setPreviewDates(const QMap<QUrl, int>& itemsMap);
0048     void setSettings(const TimeAdjustContainer& settings);
0049 
0050     /** Read the Used Timestamps for the url
0051      */
0052     QDateTime readTimestamp(const QUrl& url) const;
0053     int       indexForUrl(const QUrl& url)   const;
0054 
0055 Q_SIGNALS:
0056 
0057     void signalProcessStarted(const QUrl&);
0058     void signalDateTimeForUrl(const QUrl&, const QDateTime&, bool);
0059     void signalPreviewReady(const QUrl&, const QDateTime&, const QDateTime&);
0060     void signalProcessEnded(const QUrl&, const QDateTime&, const QDateTime&, int);
0061 
0062 private:
0063 
0064     /** Called by readTimestamp() to get host timestamps
0065      */
0066     QDateTime readApplicationTimestamp(const QUrl& url) const;
0067 
0068     /** Called by readTimestamp() to get file name timestamp
0069      */
0070     QDateTime readFileNameTimestamp(const QUrl& url)    const;
0071 
0072     /** Called by readTimestamp() to get file timestamp
0073      */
0074     QDateTime readFileTimestamp(const QUrl& url)        const;
0075 
0076     /** Called by readTimestamp() to get file metadata timestamp
0077      */
0078     QDateTime readMetadataTimestamp(const QUrl& url)    const;
0079 
0080 public:
0081 
0082     class Private;
0083 
0084 private:
0085 
0086     Private* const d;
0087 };
0088 
0089 } // namespace DigikamGenericTimeAdjustPlugin
0090 
0091 #endif // DIGIKAM_TIME_ADJUST_THREAD_H