1 /* ============================================================ 2 * 3 * This file is a part of digiKam project 4 * https://www.digikam.org 5 * 6 * Date : 2014-07-02 7 * Description : Simple program to load a track for timing tests. 8 * 9 * Copyright (C) 2014 by Michael G. Hansen <mike at mghansen dot de> 10 * 11 * This program is free software; you can redistribute it 12 * and/or modify it under the terms of the GNU General 13 * Public License as published by the Free Software Foundation; 14 * either version 2, or (at your option) 15 * any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * ============================================================ */ 23 24 // Qt includes 25 26 #include <QDateTime> 27 #include <QTextStream> 28 #include <QCoreApplication> 29 30 // Local includes 31 32 #include "digikam_debug.h" 33 #include "trackmanager.h" 34 #include "trackreader.h" 35 36 using namespace Digikam; 37 38 namespace 39 { 40 QTextStream qout(stdout); 41 QTextStream qerr(stderr); 42 } 43 44 /** 45 * @brief Test loading of a GPX file directly 46 */ testSaxLoader(const QString & filename)47bool testSaxLoader(const QString& filename) 48 { 49 TrackReader::TrackReadResult fileData = TrackReader::loadTrackFile(QUrl::fromLocalFile(filename)); 50 51 return fileData.isValid; 52 } 53 main(int argc,char * argv[])54int main(int argc, char* argv[]) 55 { 56 QCoreApplication app(argc, argv); 57 58 if (argc < 2) 59 { 60 qerr << QLatin1String("Need a filename as argument to load") << endl; 61 return 1; 62 } 63 64 const QString filename = QString::fromLatin1(argv[1]); 65 qerr << "Loading file: " << filename << endl; 66 const bool success = testSaxLoader(filename); 67 68 if (!success) 69 { 70 qerr << "Loading failed" << endl; 71 return 1; 72 } 73 74 qerr << "Loaded successfully." << endl; 75 76 return 0; 77 } 78