Missed off previous commit

An errant git rebase lost these changes, this is
to support the GTC export file support and updates
the Json parser to use the new call semantics and
gets the Import wizard to clear up temporary files
when it closes.
This commit is contained in:
Mark Liversedge
2011-08-05 21:37:28 +01:00
parent 03b0dea597
commit 2909e09373
3 changed files with 7 additions and 20 deletions

View File

@@ -229,7 +229,7 @@ static int jsonFileReaderRegistered =
"json", "GoldenCheetah Json Format", new JsonFileReader());
RideFile *
JsonFileReader::openRideFile(QFile &file, QStringList &errors) const
JsonFileReader::openRideFile(QFile &file, QStringList &errors, QList<RideFile*>*) const
{
// jsonRide is local and static, used in the parser
// JsonRideFilein is the FILE * used by the lexer

View File

@@ -34,6 +34,7 @@
// drag and drop passes urls ... convert to a list of files and call main constructor
RideImportWizard::RideImportWizard(QList<QUrl> *urls, QDir &home, MainWindow *main, QWidget *parent) : QDialog(parent), mainWindow(main)
{
setAttribute(Qt::WA_DeleteOnClose);
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
QList<QString> filenames;
for (int i=0; i<urls->count(); i++)
@@ -303,6 +304,7 @@ RideImportWizard::process()
TcxFileReader reader;
QFile target(fulltarget);
reader.writeRideFile(mainWindow, mainWindow->cyclist, extracted, target);
deleteMe.append(fulltarget);
// now add each temporary file ...
filenames.insert(here, fulltarget);
@@ -867,27 +869,10 @@ RideImportWizard::abortClicked()
aborted = false;
}
// destructor - not sure it ever gets called tho, even by RideImportWizard::done()
// clean up files
RideImportWizard::~RideImportWizard()
{
// Fill in the filenames and all the textItems
for (int i=0; i < filenames.count(); i++) {
QTableWidgetItem *t;
t = tableWidget->item(i,0); delete t;
t = tableWidget->item(i,1); delete t;
t = tableWidget->item(i,2); delete t;
t = tableWidget->item(i,3); delete t;
t = tableWidget->item(i,4); delete t;
t = tableWidget->item(i,5); delete t;
}
delete tableWidget;
filenames.clear();
delete phaseLabel;
delete progressBar;
delete abortButton;
delete cancelButton;
delete todayButton;
delete overFiles;
foreach(QString name, deleteMe) QFile(name).remove();
}

View File

@@ -67,6 +67,8 @@ private:
QCheckBox *overFiles; // chance to set overwrite when asking for dates
bool overwriteFiles; // flag to overwrite files from checkbox
MainWindow *mainWindow; // caller
QStringList deleteMe; // list of temp files created during import
};
// Item Delegate for Editing Date and Time of Ride inside the