#ifndef ACTIVITYLOG_H #define ACTIVITYLOG_H #include #include #include #include #include #include #include #include "constants.h" class ActivityLog : public QWidget { Q_OBJECT public: ActivityLog(); // Default constructor. ~ActivityLog(); // Default destructor. void write( QString cLine, int lType ); // Write the given QString to correct log and file. QPlainTextEdit* getLogPointer( int logType ); // Get the pointer to the log of the given type. QGroupBox* getGroupBox( QString title ); // Get the pointer to the layout with the tab widget holding the logs. private: QString getCurrTime(); // Get the current system time and return a QString containing the time. void writeToLog( QString textLine, QString timeLine, QPlainTextEdit* log ); // Write the given time and text to the log. void writeToFile( QString textLine, QString timeLine, QFile* file ); // Write the given time and text to the file. void checkFileSizes(); // Ensure the number of lines written to each file has not exceeded the maximum. QString timeStamp(); // Return a string with the current time in a special format for files. // Pointers to the logs. QPlainTextEdit* normalLog; QPlainTextEdit* debugLog; QPlainTextEdit* cmdLineLog; QPlainTextEdit* clientLog; QTabWidget* logTabs; // Pointer to the Log Tab Widget QHBoxLayout* layout; // Pointer to the main layout of the tab widget. QGroupBox* logBox; // Pointer to the group box containing the tab layout. // Pointers to the files. QFile* normalFile; QFile* debugFile; QFile* cmdLineFile; QFile* clientFile; // Variables for the number of lines written to the current file. int normalSize; int debugSize; int cmdLineSize; int clientSize; // Variables for the file number. int normalNum; int debugNum; int cmdLineNum; int clientNum; }; #endif // ACTIVITYLOG_H