YourDefrag  SVN
Public Slots | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
YDGuiApplication Class Reference

Defragmenter GUI application class. More...

#include <YDGuiApplication.h>

List of all members.

Public Slots

void threadFinished (QThread *thread)
 Defragmenter thread finish slot function.
void cleanup ()
 Defragmenter cleanup slot function.

Public Member Functions

 YDGuiApplication (int &argc, char **argv)
 Application class constructor.
 ~YDGuiApplication ()
 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.

Detailed Description

Defragmenter GUI application class.

This class handles basic behavior of defragmenter application.


Constructor & Destructor Documentation

YDGuiApplication::YDGuiApplication ( int &  argc,
char **  argv 
)

Application class constructor.

This function prepares application connections and starts defragmenter threads for each of command line arguments. ODD IMPLEMENTATION!!!

Parameters:
[in]argcCount of command line arguments.
[in]argvList of command line arguments.
YDGuiApplication::~YDGuiApplication ( )

Application class destructor.

This function makes cleanup and deinitializes connections.


Member Function Documentation

void YDGuiApplication::addAllDisks ( ) [private]

Add all disks.

This function finds all disks in the system and adds them to the task list.

Todo:
Add filtering for local physical disks to remove networks shares and optical medias.
void YDGuiApplication::cleanup ( ) [slot]

Defragmenter cleanup slot function.

This function is called to perform an application cleanup. This function tries to stop all remaining defragmenter threads.

This function is a user defined slot and can be connected to one or more signals.
void YDGuiApplication::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.

Parameters:
[in]sigNumSignal number.
void YDGuiApplication::parseArguments ( ) [private]

Parse arguments.

This function parses command line arguments.

void YDGuiApplication::showUsage ( ) [private, virtual]

Show usage message.

This function prints usage information to console.

void YDGuiApplication::startDefrag ( )

Start defragmantation.

This function starts all defragmenter threads.

void YDGuiApplication::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.

This function is a user defined slot and can be connected to one or more signals.
Parameters:
[in]threadPointer to finished thread object.
int YDGuiApplication::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().


Member Data Documentation

QStringList YDGuiApplication::m_args [private]

List of command line arguments.

QWaitCondition YDGuiApplication::m_end [private]

End-of-work wait condition.

QStringList YDGuiApplication::m_excludes [private]

List of excludes to be used for all defragmented disks.

Application free space in percents.

Ignore config flag.

QFile * YDGuiApplication::m_logFile [private]

Logging file.

QTextStream * YDGuiApplication::m_logStream [private]

Logging text stream.

int YDGuiApplication::m_mode [private]

Application defragment mode.

QMutex YDGuiApplication::m_mutex [private]

Protective mutex.

QStringList YDGuiApplication::m_spaceHogs [private]

List of space hogs to be used for all defragmented disks.

Application speed in percents.

QStringList YDGuiApplication::m_tasks [private]

List of disks to defragment.

List of worker threads.

Application verbosity level.

Write config flag.


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