Files
GoldenCheetah/src/Gui/BatchProcessingDialog.h
2024-05-24 10:40:44 -03:00

115 lines
2.8 KiB
C++

/*
* Batch Export Copyright (c) 2011 Mark Liversedge (liversedge@gmail.com)
* Batch Processing Copyright (c) 2022 Paul Johnson (paulj49457@gmail.com)
*
* 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., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _BatchProcessingDialog_h
#define _BatchProcessingDialog_h
#include "GoldenCheetah.h"
#include "Context.h"
#include "Settings.h"
#include "Units.h"
#include "RideItem.h"
#include "RideFile.h"
#include <QtGui>
#include <QTreeWidget>
#include <QProgressBar>
#include <QList>
#include <QFileDialog>
#include <QCheckBox>
#include <QLabel>
#include <QListIterator>
#include <QDebug>
// Dialog class to allow batch processing of activities
class BatchProcessingDialog : public QDialog
{
Q_OBJECT
G_OBJECT
public:
BatchProcessingDialog(Context *context);
protected:
signals:
private slots:
void dpButtonClicked();
void cancelClicked();
void okClicked();
void selectClicked();
void allClicked();
void radioClicked(int);
void comboSelected();
private:
enum class bpFailureType {
unknownF,
finishedF,
userF,
dateFormatF,
timeFormatF,
noDataProcessorF };
enum class batchRadioBType {
exportB,
dataProcessorB,
metadataSetB,
deleteB };
Context *context;
bool aborted;
SpecialFields specialFields;
int processed, fails, numFilesToProcess;
batchRadioBType outputMode;
QTreeWidget *files; // choose files to export
QWidget *disableContainer, *dpContainer, *exportContainer;
QWidget *metaDataContainer;
QComboBox *fileFormat, *dataProcessorToRun;
QComboBox *metadataFieldToSet;
QLineEdit *metadataEditField;
QLabel *dirName, *status;
QCheckBox *overwrite, *all;
QPushButton *dpButton, *cancel, *ok;
void updateActionColumn();
QString getActionColumnText();
void fileSelected(QTreeWidgetItem* current);
void updateNumberSelected();
void updateMetadataTypeField();
bpFailureType exportFiles();
bpFailureType deleteFiles();
bpFailureType runDataProcessorOnActivities();
bpFailureType setMetadataForActivities();
void failedToProcessEntry(QTreeWidgetItem* current);
};
#endif // _BatchProcessingDialog_h