83 lines
2.0 KiB
C++
83 lines
2.0 KiB
C++
#include "ZTStats.h"
|
|
#include "MainWindow.h"
|
|
#include <QFile>
|
|
|
|
CZTStats::CZTStats(CMainWindow *MainWindowPtr)
|
|
{
|
|
mMainWindow = MainWindowPtr;
|
|
mReportGenerator.mProgramPtr = this;
|
|
}
|
|
|
|
void CZTStats::Init()
|
|
{
|
|
mMainWindow->mReportPage->mProgramHandle = this;
|
|
// mProgramConfig.mDataSourceDirectoryPaths.append("D:\\Main\\Dev\\ZTStats\\LOGS");
|
|
QString Path = "C:";
|
|
QFile *CfgFile = new QFile("Source.txt");
|
|
if(CfgFile != 0)
|
|
{
|
|
|
|
CfgFile->open(QIODevice::ReadOnly | QIODevice::Text);
|
|
while(!CfgFile->atEnd())
|
|
{
|
|
Path = QString(CfgFile->readLine()).trimmed();
|
|
if(Path.contains("#") == false)
|
|
{
|
|
QDir test(Path);
|
|
if(test.exists() == true)
|
|
{
|
|
mProgramConfig.mDataSourceDirectoryPaths.append(Path);
|
|
}
|
|
else
|
|
{
|
|
mMainWindow->mReportPage->UpdateProgressStatus(QString("Répertoire invalide dans le fichier de configuration: %1").arg(Path));
|
|
}
|
|
}
|
|
}
|
|
|
|
// if(Path.isEmpty())
|
|
// {
|
|
// Path = "C:";
|
|
// }
|
|
|
|
CfgFile->close();
|
|
delete CfgFile;
|
|
}
|
|
|
|
|
|
|
|
for(int i = 0; i < mProgramConfig.mDataSourceDirectoryPaths.size(); i++)
|
|
{
|
|
UpdateReportProgressStatus(QString("Répertoire source: %1").arg(mProgramConfig.mDataSourceDirectoryPaths.at(i)));
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
void CZTStats::Run()
|
|
{
|
|
|
|
}
|
|
|
|
int CZTStats::GenerateReportRequest(QString OutputFileName, CReportConfigData ReportConfigFilters)
|
|
{
|
|
mReportGenerator.GenerateReport(OutputFileName,mProgramConfig,ReportConfigFilters);
|
|
return RET_OK;
|
|
}
|
|
|
|
void CZTStats::UpdateReportProgressStatus(QString status)
|
|
{
|
|
mMainWindow->mReportPage->UpdateProgressStatus(status);
|
|
}
|
|
|
|
void CZTStats::ReportCreationFinished(QString ReportFilePath)
|
|
{
|
|
mMainWindow->mReportPage->ReportCreationFinished(ReportFilePath);
|
|
}
|
|
|
|
void CZTStats::AbortReportCreationRequest()
|
|
{
|
|
mReportGenerator.AbortReportCreation();
|
|
}
|