YourDefrag
SVN
|
Defragmenter console application class. More...
#include <YDCmdApplication.h>
Public Slots | |
void | threadFinished (QThread *thread) |
Defragmenter thread finish slot function. | |
void | cleanup () |
Defragmenter cleanup slot function. | |
Public Member Functions | |
YDCmdApplication (int &argc, char **argv) | |
Application class constructor. | |
~YDCmdApplication () | |
Application class destructor. | |
void | startDefrag () |
Start defragmantation. | |
int | wait () |
Wait for the end. | |
Private Member Functions | |
virtual void | showUsage () |
Show usage message. | |
void | parseArguments () |
Parse arguments. | |
void | addAllDisks () |
Add all disks. | |
Static Private Member Functions | |
static void | handleSignal (int sigNum) |
Defragmenter signal handler. | |
Private Attributes | |
YDWorkThreadList | m_threadList |
List of worker threads. | |
QWaitCondition | m_end |
End-of-work wait condition. | |
QMutex | m_mutex |
Protective mutex. | |
QStringList | m_args |
List of command line arguments. | |
QStringList | m_tasks |
List of disks to defragment. | |
QStringList | m_excludes |
List of excludes to be used for all defragmented disks. | |
QStringList | m_spaceHogs |
List of space hogs to be used for all defragmented disks. | |
int | m_verbose |
Application verbosity level. | |
int | m_mode |
Application defragment mode. | |
int | m_speed |
Application speed in percents. | |
int | m_freeSpace |
Application free space in percents. | |
int | m_write |
Write config flag. | |
int | m_ignore |
Ignore config flag. | |
QFile * | m_logFile |
Logging file. | |
QTextStream * | m_logStream |
Logging text stream. |
Defragmenter console application class.
This class handles basic behavior of defragmenter application.
YDCmdApplication::YDCmdApplication | ( | int & | argc, |
char ** | argv | ||
) |
Application class constructor.
This function prepares application connections and starts defragmenter threads for each of command line arguments. ODD IMPLEMENTATION!!!
[in] | argc | Count of command line arguments. |
[in] | argv | List of command line arguments. |
YDCmdApplication::~YDCmdApplication | ( | ) |
Application class destructor.
This function makes cleanup and deinitializes connections.
void YDCmdApplication::addAllDisks | ( | ) | [private] |
Add all disks.
This function finds all disks in the system and adds them to the task list.
void YDCmdApplication::cleanup | ( | ) | [slot] |
Defragmenter cleanup slot function.
This function is called to perform an application cleanup. This function tries to stop all remaining defragmenter threads.
void YDCmdApplication::handleSignal | ( | int | sigNum | ) | [static, private] |
Defragmenter signal handler.
This function is called when application receives one of unix signals registered by application. This function triggers application cleanup.
[in] | sigNum | Signal number. |
void YDCmdApplication::parseArguments | ( | ) | [private] |
Parse arguments.
This function parses command line arguments.
void YDCmdApplication::showUsage | ( | ) | [private, virtual] |
Show usage message.
This function prints usage information to console.
void YDCmdApplication::startDefrag | ( | ) |
Start defragmantation.
This function starts all defragmenter threads.
void YDCmdApplication::threadFinished | ( | QThread * | thread | ) | [slot] |
Defragmenter thread finish slot function.
This function is called by meta-object code in case when one of defragmenter threads has finish it's task.
[in] | thread | Pointer to finished thread object. |
int YDCmdApplication::wait | ( | ) |
Wait for the end.
This function blocks execution of caller thread till the moment when all defragmenter threads will end. It's intended to call this function from main().
QStringList YDCmdApplication::m_args [private] |
List of command line arguments.
QWaitCondition YDCmdApplication::m_end [private] |
End-of-work wait condition.
QStringList YDCmdApplication::m_excludes [private] |
List of excludes to be used for all defragmented disks.
int YDCmdApplication::m_freeSpace [private] |
Application free space in percents.
int YDCmdApplication::m_ignore [private] |
Ignore config flag.
QFile * YDCmdApplication::m_logFile [private] |
Logging file.
QTextStream * YDCmdApplication::m_logStream [private] |
Logging text stream.
int YDCmdApplication::m_mode [private] |
Application defragment mode.
QMutex YDCmdApplication::m_mutex [private] |
Protective mutex.
QStringList YDCmdApplication::m_spaceHogs [private] |
List of space hogs to be used for all defragmented disks.
int YDCmdApplication::m_speed [private] |
Application speed in percents.
QStringList YDCmdApplication::m_tasks [private] |
List of disks to defragment.
List of worker threads.
int YDCmdApplication::m_verbose [private] |
Application verbosity level.
int YDCmdApplication::m_write [private] |
Write config flag.