VHISTlib
1.84.0.3018
|
A queue datastructure which extracts embedded files from a VHIST file to the harddisk. More...
#include <extractionqueue.h>
Public Slots | |
void | cancelExtraction () |
Cancels the extraction currently running and clears the queue. | |
Signals | |
void | fileProcessed (int id, bool valid) |
This signal is emitted each time a file has been completely processed. | |
void | percentFinishedChanged (int percent, const QString filename) |
This signal is emitted after each call to process and informs all connected slots about the percentage of work finished, yet. | |
Public Member Functions | |
ExtractionQueue (VhistParser *parser=NULL) | |
Creates a new ExtractionQueue object. | |
virtual | ~ExtractionQueue () |
Destroys an ExtractionQueue object. | |
void | reset (VhistParser *parser) |
Resets the ExtractionQueue object and associates the queue with another VhistParser object. | |
void | addExtractees (QHash< int, QString > files) |
Adds a list of files, which should be extracted, to the ExtractionQueue. | |
bool | process () |
Continues extraction of the current file to disk. |
A queue datastructure which extracts embedded files from a VHIST file to the harddisk.
Files can be enqueued at the end of the queue and the files are extracted in the order in which they are inserted into the queue.
Each call to the process() method extracts only a limited amount of data. This way, the application is still responsive in case that large files are extracted.
Information about the progress of the extraction is published via the signals of the class.
ExtractionQueue::ExtractionQueue | ( | VhistParser * | parser = NULL | ) |
Creates a new ExtractionQueue object.
The object is identified with a VhistParser object. All embedded files are taken from this parser.
[in] | parser | The parser associated with the ExtractionQueue. The parser must not be NULL . |
void ExtractionQueue::addExtractees | ( | QHash< int, QString > | filesToExtract | ) |
Adds a list of files, which should be extracted, to the ExtractionQueue.
[in] | filesToExtract | A hashtable with file ids as keys and the filenames of the files on disk as values. |
void ExtractionQueue::cancelExtraction | ( | ) | [slot] |
Cancels the extraction currently running and clears the queue.
If the current file has not been extracted completely, the incomplete file will still be in the filesystem.
void ExtractionQueue::fileProcessed | ( | int | id, |
bool | valid | ||
) | [signal] |
This signal is emitted each time a file has been completely processed.
[in] | id | The id of the processed file. |
[in] | valid | true if the file was valid and extraction succeeded. |
void ExtractionQueue::percentFinishedChanged | ( | int | percent, |
const QString | filename | ||
) | [signal] |
This signal is emitted after each call to process and informs all connected slots about the percentage of work finished, yet.
It also states the name of the file currently processed.
[in] | percent | The percentage of work already done. |
[in] | filename | The name of the file which is currently extracted. |
bool ExtractionQueue::process | ( | ) |
Continues extraction of the current file to disk.
The method will only process a limited amount of data before it returns. This way, the application stays responsive, even when large files are extracted. This is especially important for applications with graphical userinterfaces.
false
if the last file has been extracted and the queue is empty, now. Otherwise true
. void ExtractionQueue::reset | ( | VhistParser * | parser | ) |
Resets the ExtractionQueue object and associates the queue with another VhistParser object.
[in] | parser | The new VhistParser object. Must not be NULL . |