File indexing completed on 2025-01-05 03:58:35
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-09-19 0007 * Description : Track file reader 0008 * 0009 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2010-2014 by Michael G. Hansen <mike at mghansen dot de> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_TRACK_READER_H 0017 #define DIGIKAM_TRACK_READER_H 0018 0019 // Qt includes 0020 0021 #include <QXmlStreamReader> 0022 0023 // local includes 0024 0025 #include "trackmanager.h" 0026 #include "digikam_export.h" 0027 0028 class TestTracks; 0029 0030 namespace Digikam 0031 { 0032 0033 class DIGIKAM_EXPORT TrackReader : public QObject 0034 { 0035 Q_OBJECT 0036 0037 public: 0038 0039 class TrackReadResult 0040 { 0041 public: 0042 0043 explicit TrackReadResult() 0044 : track (), 0045 isValid (false), 0046 loadError() 0047 { 0048 } 0049 0050 TrackManager::Track track; 0051 bool isValid; 0052 QString loadError; 0053 0054 typedef QList<TrackReadResult> List; 0055 }; 0056 0057 public: 0058 0059 explicit TrackReader(TrackReadResult* const dataTarget); 0060 ~TrackReader() override; 0061 0062 static TrackReadResult loadTrackFile(const QUrl& url); 0063 static QDateTime ParseTime(const QString& tstring); 0064 0065 private: 0066 0067 void parseTrack(QXmlStreamReader& xml); 0068 explicit TrackReader(QObject*); 0069 0070 private: 0071 0072 class Private; 0073 const QScopedPointer<Private> d; 0074 0075 friend class ::TestTracks; 0076 }; 0077 0078 } // namespace Digikam 0079 0080 #endif // DIGIKAM_TRACK_READER_H