Files
GoldenCheetah/src/DataProcessor.h
Mark Liversedge aa8605e8d5 QT5 -- 1 of 3
Porting the codebase to QT 5 (5.2) to get the
latest bug fixes, performance and improved platform
support.

This first part is to fixup the codebase to compile
on Qt 5, but some aspects have been broken (video).

The second part is to migrate from Qwt 6.0.1 to the
latest Qwt for multiaxis support.

The third part will be to fixup any platform specific
issues or issues identified at runtime.
2013-12-09 09:57:13 +00:00

124 lines
3.5 KiB
C++

/*
* Copyright (c) 2010 Mark Liversedge (liversedge@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 _DataProcessor_h
#define _DataProcessor_h
#include "GoldenCheetah.h"
#include "RideFile.h"
#include "RideFileCommand.h"
#include "RideItem.h"
#include <QtGui>
#include <QWidget>
#include <QDialog>
#include <QDate>
#include <QDir>
#include <QLabel>
#include <QFile>
#include <QList>
#include <QTextEdit>
#include <QLineEdit>
#include <QMap>
#include <QVector>
// This file defines four classes:
//
// DataProcessorConfig is a base QWidget that must be supplied by the
// DataProcessor to enable the user to configure its options
//
// DataProcessor is an abstract base class for function-objects that take a
// rideFile and manipulate it. Examples include fixing gaps in recording or
// creating the .notes or .cpi file
//
// DataProcessorFactory is a singleton that maintains a mapping of
// all DataProcessor objects that can be applied to rideFiles
//
// ManualDataProcessorDialog is a dialog box to manually execute a
// dataprocessor on the current ride and is called from the mainWindow menus
//
// every data processor must supply a configuration Widget
// when its processorConfig member is called
class DataProcessorConfig : public QWidget
{
Q_OBJECT
G_OBJECT
public:
DataProcessorConfig(QWidget *parent=0) : QWidget(parent) {}
virtual ~DataProcessorConfig() {}
virtual void readConfig() = 0;
virtual void saveConfig() = 0;
virtual QString explain() = 0;
};
// the data processor abstract base class
class DataProcessor
{
public:
DataProcessor() {}
virtual ~DataProcessor() {}
virtual bool postProcess(RideFile *, DataProcessorConfig*settings=0) = 0;
virtual DataProcessorConfig *processorConfig(QWidget *parent) = 0;
virtual QString name() = 0; // Localized Name for user interface
};
// all data processors
class DataProcessorFactory {
private:
static DataProcessorFactory *instance_;
QMap<QString,DataProcessor*> processors;
DataProcessorFactory() {}
public:
static DataProcessorFactory &instance();
bool registerProcessor(QString name, DataProcessor *processor);
QMap<QString,DataProcessor*> getProcessors() const { return processors; }
bool autoProcess(RideFile *); // run auto processes (after open rideFile)
};
class Context;
class ManualDataProcessorDialog : public QDialog
{
Q_OBJECT
G_OBJECT
public:
ManualDataProcessorDialog(Context *, QString, RideItem *);
private slots:
void cancelClicked();
void okClicked();
private:
Context *context;
RideItem *ride;
DataProcessor *processor;
DataProcessorConfig *config;
QTextEdit *explain;
QPushButton *ok, *cancel;
};
#endif // _DataProcessor_h