YourDefrag
SVN
|
Defragmenter work thread. More...
#include <YDWorkThread.h>
Public Slots | |
void | stop () |
Stop the defragmenter thread. | |
Signals | |
void | finished (QThread *thread) |
Defragmenter thread finish signal. | |
Public Member Functions | |
YDWorkThread (QString name, QObject *parent=NULL) | |
Defragmenter work thread constructor. | |
~YDWorkThread () | |
Defragmenter work thread destructor. | |
QString | diskState () const |
Get disk progress state string. | |
QString | diskName () const |
Get disk name string. | |
void | setExcludes (QStringList _list) |
Set exclude list. | |
QStringList | excludes () const |
Get exclude list. | |
void | setSpaceHogs (QStringList _list) |
Set space hogs list. | |
QStringList | spaceHogs () const |
Get space hogs list. | |
void | setVerbose (int verbose) |
Set verbosity level. | |
int | verbose () const |
Get verbosity level. | |
void | setMode (int mode) |
Set defragmenter mode. | |
int | mode () const |
Get defragmenter mode. | |
void | setSpeed (int speed) |
Set defragmenter speed value. | |
int | speed () const |
Get defragmenter speed. | |
void | setFreeSpace (int freeSpace) |
Set reserved free space value. | |
int | freeSpace () const |
Get reserved free space. | |
void | setStartFlag (int startFlag) |
Set start flag value. | |
int | startFlag () const |
Get start flag. | |
void | setLogStream (QTextStream *logStream) |
Set logging text stream. | |
QTextStream * | logStream () const |
Get logging text stream. | |
bool | loadConfig (QString fileName=QString::null) |
Load defragmenter config. | |
bool | saveConfig (QString fileName=QString::null, bool hidden=true) |
Save defragmenter config. | |
Static Public Member Functions | |
static QStringList | defaultExcludes () |
Get default excludes. | |
static QStringList | defaultSpaceHogs () |
Get default space hogs. | |
Protected Member Functions | |
void | run () |
Defragmenter working thread code. | |
Protected Attributes | |
QString | m_diskState |
Disk state string. | |
YDConfigFile | m_configFile |
Defragmenter config file. | |
int | m_running |
Defragmenter run flag. | |
int | m_redrawScreen |
Screen redraw flag. | |
int | m_verbose |
Defragmenter verbosity level. | |
QTextStream * | m_logStream |
Logging text stream. | |
Private Member Functions | |
virtual void | showStatus (struct DefragDataStruct *data) |
Show progress status. | |
virtual void | showMove (struct ItemStruct *item, ULONG64 clusters, ULONG64 fromLcn, ULONG64 toLcn, ULONG64 fromVcn) |
Show data move. | |
virtual void | showAnalyze (struct DefragDataStruct *data, struct ItemStruct *item) |
Show analyze progress. | |
virtual void | showDebug (int level, struct ItemStruct *item, WCHAR *message, va_list varArgs) |
Show debug printout. | |
virtual void | drawCluster (struct DefragDataStruct *data, ULONG64 clusterStart, ULONG64 clusterEnd, int color) |
Draw a cluster state. | |
virtual void | clearScreen (WCHAR *format, va_list varArgs) |
Clear a screen. | |
Friends | |
void __cdecl | YDShowStatus (struct DefragDataStruct *data) |
Defragmentation show status callback. | |
void __cdecl | YDShowMove (struct ItemStruct *item, ULONG64 clusters, ULONG64 fromLcn, ULONG64 toLcn, ULONG64 fromVcn) |
Defragmentation show move callback. | |
void __cdecl | YDShowAnalyze (struct DefragDataStruct *data, struct ItemStruct *item) |
Analyze show status callback. | |
void __cdecl | YDShowDebug (int level, struct ItemStruct *item, WCHAR *message,...) |
Defragmentation debugging output callback. | |
void __cdecl | YDDrawCluster (struct DefragDataStruct *data, ULONG64 clusterStart, ULONG64 clusterEnd, int color) |
Defragmentation progress visualization callback. | |
void __cdecl | YDClearScreen (WCHAR *format,...) |
Defragmentation progress visualization callback. |
Defragmenter work thread.
This thread triggers the single disk defragmentation procedure.
YDWorkThread::YDWorkThread | ( | QString | name, |
QObject * | parent = NULL |
||
) |
Defragmenter work thread constructor.
This function initializes internal state of defragmenter thread.
[in] | name | Name of disk/path to defragment. |
[in] | parent | Parent object. |
YDWorkThread::~YDWorkThread | ( | ) |
Defragmenter work thread destructor.
void YDWorkThread::clearScreen | ( | WCHAR * | format, |
va_list | varArgs | ||
) | [private, virtual] |
Clear a screen.
This function is not implemented.
[in] | format | Text message. |
[in] | varArgs | Variable arguments list. |
QStringList YDWorkThread::defaultExcludes | ( | ) | [static] |
Get default excludes.
This function returns default list of excludes.
QStringList YDWorkThread::defaultSpaceHogs | ( | ) | [static] |
Get default space hogs.
This function returns default list of space hogs. This list is initially hardcoded in jkDefrag.dll code.
QString YDWorkThread::diskName | ( | ) | const [inline] |
Get disk name string.
QString YDWorkThread::diskState | ( | ) | const [inline] |
Get disk progress state string.
void YDWorkThread::drawCluster | ( | struct DefragDataStruct * | data, |
ULONG64 | clusterStart, | ||
ULONG64 | clusterEnd, | ||
int | color | ||
) | [private, virtual] |
Draw a cluster state.
This function is not implemented.
[in] | data | Data representing current state of defragmenter. |
[in] | clusterStart | Beginning of cluster. |
[in] | clusterEnd | End of cluster. |
[in] | color | Color the cluster should be drawn. |
QStringList YDWorkThread::excludes | ( | ) | const [inline] |
Get exclude list.
void YDWorkThread::finished | ( | QThread * | thread | ) | [signal] |
Defragmenter thread finish signal.
The code of this function is generated by meta-object compiler.
int YDWorkThread::freeSpace | ( | ) | const [inline] |
Get reserved free space.
bool YDWorkThread::loadConfig | ( | QString | fileName = QString::null | ) | [inline] |
Load defragmenter config.
[in] | fileName | File name to load config from. |
QTextStream * YDWorkThread::logStream | ( | ) | const [inline] |
Get logging text stream.
int YDWorkThread::mode | ( | ) | const [inline] |
Get defragmenter mode.
void YDWorkThread::run | ( | ) | [protected] |
Defragmenter working thread code.
This function uses defragmenter code implemented in jkDefrag.dll. This function prepares defragmenter configuration parameters and calls defragmenter code from jkDefrag.dll. At the end this function emits signal finished() to inform an application about defragmentation is finished.
bool YDWorkThread::saveConfig | ( | QString | fileName = QString::null , |
bool | hidden = true |
||
) | [inline] |
Save defragmenter config.
[in] | fileName | File name to store config to. |
[in] | hidden | Mark the result file as hidden. |
void YDWorkThread::setExcludes | ( | QStringList | _list | ) | [inline] |
Set exclude list.
[in] | _list | New exclude list. |
void YDWorkThread::setFreeSpace | ( | int | freeSpace | ) | [inline] |
Set reserved free space value.
[in] | freeSpace | New reserved free space value. |
void YDWorkThread::setLogStream | ( | QTextStream * | logStream | ) | [inline] |
Set logging text stream.
[in] | logStream | New logging stream. |
void YDWorkThread::setMode | ( | int | mode | ) | [inline] |
Set defragmenter mode.
[in] | mode | New defragmenter mode value. |
void YDWorkThread::setSpaceHogs | ( | QStringList | _list | ) | [inline] |
Set space hogs list.
[in] | _list | New space hogs list. |
void YDWorkThread::setSpeed | ( | int | speed | ) | [inline] |
Set defragmenter speed value.
[in] | speed | New defragmenter speed value. |
void YDWorkThread::setStartFlag | ( | int | startFlag | ) | [inline] |
Set start flag value.
[in] | startFlag | New start flag value. |
void YDWorkThread::setVerbose | ( | int | verbose | ) | [inline] |
Set verbosity level.
[in] | verbose | New verbosity value. |
void YDWorkThread::showAnalyze | ( | struct DefragDataStruct * | data, |
struct ItemStruct * | item | ||
) | [private, virtual] |
Show analyze progress.
This function is not implemented.
[in] | data | Data representing current state of defragmenter. |
[in] | item | Current data item being processed. |
void YDWorkThread::showDebug | ( | int | level, |
struct ItemStruct * | item, | ||
WCHAR * | message, | ||
va_list | varArgs | ||
) | [private, virtual] |
Show debug printout.
This function prints defragmenter debugging output.
[in] | level | Logging level. |
[in] | item | Current data item being processed. |
[in] | message | Text message. |
[in] | varArgs | Variable arguments list. |
void YDWorkThread::showMove | ( | struct ItemStruct * | item, |
ULONG64 | clusters, | ||
ULONG64 | fromLcn, | ||
ULONG64 | toLcn, | ||
ULONG64 | fromVcn | ||
) | [private, virtual] |
Show data move.
This function prints data move status to logging stream.
[in] | item | Current data item being processed. |
[in] | clusters | Size of data fragment in clusters. |
[in] | fromLcn | Initial position of data fragment. |
[in] | toLcn | Resulting position of data fragment. |
[in] | fromVcn | File offset. |
void YDWorkThread::showStatus | ( | struct DefragDataStruct * | data | ) | [private, virtual] |
Show progress status.
This fuction forms a defragmenter state and prints one to logging stream.
[in] | data | Data representing current state of defragmenter. |
QStringList YDWorkThread::spaceHogs | ( | ) | const [inline] |
Get space hogs list.
int YDWorkThread::speed | ( | ) | const [inline] |
Get defragmenter speed.
int YDWorkThread::startFlag | ( | ) | const [inline] |
Get start flag.
void YDWorkThread::stop | ( | ) | [slot] |
Stop the defragmenter thread.
This function tries to interrupt currently running defragmentation procedure implemented by jkDefrag.dll.
int YDWorkThread::verbose | ( | ) | const [inline] |
Get verbosity level.
void __cdecl YDClearScreen | ( | WCHAR * | format, |
... | |||
) | [friend] |
Defragmentation progress visualization callback.
This function is called by jkDefrag.dll code when it's required to clear a screen duging defragmentation.
[in] | format | Text message. |
void __cdecl YDDrawCluster | ( | struct DefragDataStruct * | data, |
ULONG64 | clusterStart, | ||
ULONG64 | clusterEnd, | ||
int | color | ||
) | [friend] |
Defragmentation progress visualization callback.
This function is called by jkDefrag.dll code when it's required to show colored disk mask during defragmentation.
[in] | data | Data representing current state of defragmenter. |
[in] | clusterStart | Beginning of cluster. |
[in] | clusterEnd | End of cluster. |
[in] | color | Color the cluster should be drawn. |
void __cdecl YDShowAnalyze | ( | struct DefragDataStruct * | data, |
struct ItemStruct * | item | ||
) | [friend] |
Analyze show status callback.
This function is called by jkDefrag.dll code when it's required to show a state if analyze poccess.
[in] | data | Data representing current state of defragmenter. |
[in] | item | Current data item being processed. |
void __cdecl YDShowDebug | ( | int | level, |
struct ItemStruct * | item, | ||
WCHAR * | message, | ||
... | |||
) | [friend] |
Defragmentation debugging output callback.
This function is called by jkDefrag.dll code when it's required to show debugging output during defragmentation.
[in] | level | Logging level. |
[in] | item | Current data item being processed. |
[in] | message | Text message. |
void __cdecl YDShowMove | ( | struct ItemStruct * | item, |
ULONG64 | clusters, | ||
ULONG64 | fromLcn, | ||
ULONG64 | toLcn, | ||
ULONG64 | fromVcn | ||
) | [friend] |
Defragmentation show move callback.
This function is called by jkDefrag.dll code when it's required to show a data move process during defragmentation.
[in] | item | Current data item being moved. |
[in] | clusters | Size of data fragment in clusters. |
[in] | fromLcn | Initial position of data fragment. |
[in] | toLcn | Resulting position of data fragment. |
[in] | fromVcn | File offset. |
void __cdecl YDShowStatus | ( | struct DefragDataStruct * | data | ) | [friend] |
Defragmentation show status callback.
This function is called by jkDefrag.dll code when it's required to show a change of defragmenter state.
[in] | data | Data representing current state of defragmenter. |
YDConfigFile YDWorkThread::m_configFile [protected] |
Defragmenter config file.
QString YDWorkThread::m_diskState [protected] |
Disk state string.
QTextStream * YDWorkThread::m_logStream [protected] |
Logging text stream.
int YDWorkThread::m_redrawScreen [protected] |
Screen redraw flag.
int YDWorkThread::m_running [protected] |
Defragmenter run flag.
int YDWorkThread::m_verbose [protected] |
Defragmenter verbosity level.