File indexing completed on 2025-01-19 03:57:45
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2014-07-02 0007 * Description : Simple program to load a track for timing tests. 0008 * 0009 * SPDX-FileCopyrightText: 2014 by Michael G. Hansen <mike at mghansen dot de> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 // Qt includes 0016 0017 #include <QDateTime> 0018 #include <QTextStream> 0019 #include <QCoreApplication> 0020 0021 // Local includes 0022 0023 #include "digikam_debug.h" 0024 #include "digikam_globals.h" 0025 #include "trackmanager.h" 0026 #include "trackreader.h" 0027 0028 using namespace Digikam; 0029 0030 namespace 0031 { 0032 QTextStream qout(stdout); 0033 QTextStream qerr(stderr); 0034 } 0035 0036 /** 0037 * @brief Test loading of a GPX file directly 0038 */ 0039 bool testSaxLoader(const QString& filename) 0040 { 0041 TrackReader::TrackReadResult fileData = TrackReader::loadTrackFile(QUrl::fromLocalFile(filename)); 0042 0043 return fileData.isValid; 0044 } 0045 0046 int main(int argc, char* argv[]) 0047 { 0048 QCoreApplication app(argc, argv); 0049 0050 if (argc < 2) 0051 { 0052 qerr << QLatin1String("Need a filename as argument to load") << QT_ENDL; 0053 return 1; 0054 } 0055 0056 const QString filename = QString::fromLatin1(argv[1]); 0057 qerr << "Loading file: " << filename << QT_ENDL; 0058 const bool success = testSaxLoader(filename); 0059 0060 if (!success) 0061 { 0062 qerr << "Loading failed" << QT_ENDL; 0063 return 1; 0064 } 0065 0066 qerr << "Loaded successfully." << QT_ENDL; 0067 0068 return 0; 0069 }