1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
#ifndef CONVERTITEM_H
#define CONVERTITEM_H
#include "pluginloader.h"
#include <kio/job.h>
#include <QList>
#include <QTime>
#include <QWeakPointer>
class FileListItem;
class KProcess;
/**
* @short The items for the conversion (for every active file)
* @author Daniel Faust <hessijames@gmail.com>
*/
class ConvertItem
{
public:
/**
* A list of flags for knowing what to do
*/
enum Mode {
initial = 0x0000, // Initial state
get = 0x0001, // Copy the file to tmp
convert = 0x0002, // Convert the file
rip = 0x0004, // Ripping the file (only for the current state)
decode = 0x0008, // Decoding the file (only for the current state)
filter = 0x0010, // Applying filters (only for the current state)
encode = 0x0020, // Encoding the file (only for the current state)
wait_replaygain = 0x0040, // Wait for replaygain
replaygain = 0x0080 // Apply replaygain
// write_tags = 0x0100, // Write the tags to the file
// execute_userscript = 0x0200 // Run the user script
};
/** Constructor, @p item a pointer to the file list item */
explicit ConvertItem( FileListItem *item );
/** Destructor */
~ConvertItem();
/** a reference to the file list item, in case it's a convert item */
FileListItem *fileListItem;
/** a list of conversion pipes that are suitable for this item */
QList<ConversionPipe> conversionPipes;
/** a list of replaygain pipes that are suitable for this item */
QList<ReplayGainPipe> replaygainPipes;
/** number of the current attempt to convert the file/add replaygain (for the pipes lists) */
int take;
/** number of the last try in case the conversion wasn't successful in the end */
int lastTake; // TODO use cleaner solution
/** for the conversion and moving the file to a temporary place */
QWeakPointer<KProcess> process;
/** for moving the file to the temporary directory */
QWeakPointer<KIO::FileCopyJob> kioCopyJob;
/** the active plugin */
BackendPlugin *backendPlugin;
/** the id from the active plugin (-1 if false) */
int backendID;
/** the current conversion step */
int conversionPipesStep;
/** has the process been killed on purpose? */
bool killed;
/** has the internal replaygain been used in this conversion take? */
bool internalReplayGainUsed;
/** the url from fileListItem or the download temp file */
KUrl inputUrl;
/** the path and the name of the output file */
KUrl outputUrl;
/** the downloaded input file */
KUrl tempInputUrl;
/** the temp files for the conversion */
QList<KUrl> tempConvertUrls;
KUrl generateTempUrl( const QString& prefix, const QString& extension, bool useSharedMemory = false );
/** what shall we do with the file? */
Mode mode;
/** and what are we doing with the file? */
Mode state;
/** the id with that the item is registered at the logger */
int logID;
/** the time from the file list item splitted up */
float getTime;
QList<float> convertTimes;
float replaygainTime;
float finishedTime; // the time of the finished conversion steps
void updateTimes();
/** the current conversion progress */
float progress;
QTime progressedTime;
};
#endif // CONVERTITEM_H
|