YourDefrag  SVN
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
YDWorkThread Class Reference

Defragmenter work thread. More...

#include <YDWorkThread.h>

List of all members.

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.

Detailed Description

Defragmenter work thread.

This thread triggers the single disk defragmentation procedure.


Constructor & Destructor Documentation

YDWorkThread::YDWorkThread ( QString  name,
QObject *  parent = NULL 
)

Defragmenter work thread constructor.

This function initializes internal state of defragmenter thread.

Parameters:
[in]nameName of disk/path to defragment.
[in]parentParent object.
YDWorkThread::~YDWorkThread ( )

Defragmenter work thread destructor.


Member Function Documentation

void YDWorkThread::clearScreen ( WCHAR *  format,
va_list  varArgs 
) [private, virtual]

Clear a screen.

This function is not implemented.

Parameters:
[in]formatText message.
[in]varArgsVariable arguments list.
QStringList YDWorkThread::defaultExcludes ( ) [static]

Get default excludes.

This function returns default list of excludes.

Returns:
Default excludes list.
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.

Returns:
Default space hogs list.
QString YDWorkThread::diskName ( ) const [inline]

Get disk name string.

Returns:
Disk name string.
QString YDWorkThread::diskState ( ) const [inline]

Get disk progress state string.

Returns:
State name string.
void YDWorkThread::drawCluster ( struct DefragDataStruct data,
ULONG64  clusterStart,
ULONG64  clusterEnd,
int  color 
) [private, virtual]

Draw a cluster state.

This function is not implemented.

Parameters:
[in]dataData representing current state of defragmenter.
[in]clusterStartBeginning of cluster.
[in]clusterEndEnd of cluster.
[in]colorColor the cluster should be drawn.
QStringList YDWorkThread::excludes ( ) const [inline]

Get exclude list.

Returns:
Current exclude list.
void YDWorkThread::finished ( QThread *  thread) [signal]

Defragmenter thread finish signal.

The code of this function is generated by meta-object compiler.

This function is a user defined signal and is generated automatically by meta-object compiler.
int YDWorkThread::freeSpace ( ) const [inline]

Get reserved free space.

Returns:
Current reserved free space value.
bool YDWorkThread::loadConfig ( QString  fileName = QString::null) [inline]

Load defragmenter config.

Parameters:
[in]fileNameFile name to load config from.
Returns:
  • false if configuration failed be loaded;
  • true if configuration is loaded successfully.
QTextStream * YDWorkThread::logStream ( ) const [inline]

Get logging text stream.

Returns:
Current logging stream.
int YDWorkThread::mode ( ) const [inline]

Get defragmenter mode.

Returns:
Current defragmenter mode value.
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.

Parameters:
[in]fileNameFile name to store config to.
[in]hiddenMark the result file as hidden.
Returns:
  • false if configuration failed be saved;
  • true if configuration is saved successfully.
void YDWorkThread::setExcludes ( QStringList  _list) [inline]

Set exclude list.

Parameters:
[in]_listNew exclude list.
void YDWorkThread::setFreeSpace ( int  freeSpace) [inline]

Set reserved free space value.

Parameters:
[in]freeSpaceNew reserved free space value.
void YDWorkThread::setLogStream ( QTextStream *  logStream) [inline]

Set logging text stream.

Parameters:
[in]logStreamNew logging stream.
void YDWorkThread::setMode ( int  mode) [inline]

Set defragmenter mode.

Parameters:
[in]modeNew defragmenter mode value.
void YDWorkThread::setSpaceHogs ( QStringList  _list) [inline]

Set space hogs list.

Parameters:
[in]_listNew space hogs list.
void YDWorkThread::setSpeed ( int  speed) [inline]

Set defragmenter speed value.

Parameters:
[in]speedNew defragmenter speed value.
void YDWorkThread::setStartFlag ( int  startFlag) [inline]

Set start flag value.

Parameters:
[in]startFlagNew start flag value.
void YDWorkThread::setVerbose ( int  verbose) [inline]

Set verbosity level.

Parameters:
[in]verboseNew verbosity value.
void YDWorkThread::showAnalyze ( struct DefragDataStruct data,
struct ItemStruct item 
) [private, virtual]

Show analyze progress.

This function is not implemented.

Parameters:
[in]dataData representing current state of defragmenter.
[in]itemCurrent 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.

Parameters:
[in]levelLogging level.
[in]itemCurrent data item being processed.
[in]messageText message.
[in]varArgsVariable 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.

Parameters:
[in]itemCurrent data item being processed.
[in]clustersSize of data fragment in clusters.
[in]fromLcnInitial position of data fragment.
[in]toLcnResulting position of data fragment.
[in]fromVcnFile offset.
void YDWorkThread::showStatus ( struct DefragDataStruct data) [private, virtual]

Show progress status.

This fuction forms a defragmenter state and prints one to logging stream.

Parameters:
[in]dataData representing current state of defragmenter.
QStringList YDWorkThread::spaceHogs ( ) const [inline]

Get space hogs list.

Returns:
Current space hogs list.
int YDWorkThread::speed ( ) const [inline]

Get defragmenter speed.

Returns:
Current defragmenter speed value.
int YDWorkThread::startFlag ( ) const [inline]

Get start flag.

Returns:
Current start flag value.
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.

Returns:
Current verbosity value.

Friends And Related Function Documentation

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.

Parameters:
[in]formatText 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.

Parameters:
[in]dataData representing current state of defragmenter.
[in]clusterStartBeginning of cluster.
[in]clusterEndEnd of cluster.
[in]colorColor 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.

Parameters:
[in]dataData representing current state of defragmenter.
[in]itemCurrent 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.

Parameters:
[in]levelLogging level.
[in]itemCurrent data item being processed.
[in]messageText 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.

Parameters:
[in]itemCurrent data item being moved.
[in]clustersSize of data fragment in clusters.
[in]fromLcnInitial position of data fragment.
[in]toLcnResulting position of data fragment.
[in]fromVcnFile 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.

Parameters:
[in]dataData representing current state of defragmenter.

Member Data Documentation

Defragmenter config file.

QString YDWorkThread::m_diskState [protected]

Disk state string.

QTextStream * YDWorkThread::m_logStream [protected]

Logging text stream.

Screen redraw flag.

int YDWorkThread::m_running [protected]

Defragmenter run flag.

int YDWorkThread::m_verbose [protected]

Defragmenter verbosity level.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines