/*------------------------------------------------------------------------------ -- This file is a part of the QLop Software -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -------------------------------------------------------------------------------*/ /*-- Author : Alexis Jeandet -- Mail : alexis.jeandet@member.fsf.org ----------------------------------------------------------------------------*/ #include "exptimetabledownloader.h" #include #include #include #include #include #include ExpTimeTableDownLoader::ExpTimeTableDownLoader(QObject *parent) : QObject(parent) { } ExpTimeTableDownLoader::~ExpTimeTableDownLoader() { } bool ExpTimeTableDownLoader::parseFile(const QString &fileName) { QFile file(fileName); if (!file.open(QIODevice::ReadOnly)) return false; m_intervals.clear(); while (!file.atEnd()) { QString line = file.readLine(); ExpXmlDownLoaderIntervals interval; line = line.trimmed(); if(!line.contains("AMDA Search:") && (line[0]!='#') && (line.count()>0)) { QStringList lineST = line.split(" "); interval.start = lineST.at(0); interval.stop = lineST.at(1); m_intervals.append(interval); } } makeDownloadList(); return true; } void ExpTimeTableDownLoader::addDaysToDownload(QList days) { for(int i=0;i &ExpTimeTableDownLoader::daysToDownload() { return m_FilesToDownload; } void ExpTimeTableDownLoader::makeDownloadList() { for(int i=0;i daysToDl; QDateTime start,stop; start=start.fromString(m_intervals[i].start,Qt::ISODate); stop=stop.fromString(m_intervals[i].stop,Qt::ISODate); int days=start.daysTo(stop); daysToDl.append(start.date()); if(days) { for(int j=0;j