| @@ -3,3 +3,4 @@ | |||||
| /release/* | /release/* | ||||
| /debug/* | /debug/* | ||||
| /ZTStats.pro.user | /ZTStats.pro.user | ||||
| *.xlsx | |||||
| @@ -62,6 +62,7 @@ public: | |||||
| QString mStationName; | QString mStationName; | ||||
| bool mFileProtected; | bool mFileProtected; | ||||
| int mFileVersion; | int mFileVersion; | ||||
| bool mDetectionFlagsValid; | |||||
| }; | }; | ||||
| //QDataStream &operator<<(QDataStream &out, const CZT1LogElement &source); | //QDataStream &operator<<(QDataStream &out, const CZT1LogElement &source); | ||||
| //QDataStream &operator>>(QDataStream &in, CZT1LogElement &dest); | //QDataStream &operator>>(QDataStream &in, CZT1LogElement &dest); | ||||
| @@ -79,6 +80,7 @@ public: | |||||
| QString mStationName; | QString mStationName; | ||||
| CZT2FlagsData mFlags; | CZT2FlagsData mFlags; | ||||
| bool mFileProtected; | bool mFileProtected; | ||||
| bool mDetectionFlagsValid; | |||||
| }; | }; | ||||
| class COutilZT; | class COutilZT; | ||||
| @@ -1,20 +1,22 @@ | |||||
| #include "MainWindow.h" | #include "MainWindow.h" | ||||
| #include "ui_MainWindow.h" | #include "ui_MainWindow.h" | ||||
| #include "version.h" | |||||
| CMainWindow::CMainWindow(QWidget *parent) : | CMainWindow::CMainWindow(QWidget *parent) : | ||||
| QMainWindow(parent), | QMainWindow(parent), | ||||
| ui(new Ui::CMainWindow) | ui(new Ui::CMainWindow) | ||||
| { | { | ||||
| ui->setupUi(this); | ui->setupUi(this); | ||||
| setWindowTitle("Générateur de rapport ZT"); | |||||
| QString Title = QString("Générateur de Rapport ZT %1").arg(SOFTWARE_VERSION); | |||||
| setWindowTitle(Title); | |||||
| mMainWindowTabWidget = new QTabWidget(this); | mMainWindowTabWidget = new QTabWidget(this); | ||||
| mReportPage = new CReportPage(this); | mReportPage = new CReportPage(this); | ||||
| mSettingsPage = new CSettingsPage(this); | |||||
| // mSettingsPage = new CSettingsPage(this); | |||||
| setCentralWidget(mMainWindowTabWidget); | setCentralWidget(mMainWindowTabWidget); | ||||
| mMainWindowTabWidget->addTab(mReportPage,"Rapport"); | mMainWindowTabWidget->addTab(mReportPage,"Rapport"); | ||||
| mMainWindowTabWidget->addTab(mSettingsPage,"Paramètres"); | |||||
| // mMainWindowTabWidget->addTab(mSettingsPage,"Paramètres"); | |||||
| } | } | ||||
| CMainWindow::~CMainWindow() | CMainWindow::~CMainWindow() | ||||
| @@ -134,6 +134,13 @@ int CReportGenerator::GenerateExcelReport() | |||||
| ExcelDoc.write(5,5,QString("Composition")); | ExcelDoc.write(5,5,QString("Composition")); | ||||
| ExcelDoc.write(5,6,QString("Déclenchement")); | ExcelDoc.write(5,6,QString("Déclenchement")); | ||||
| ExcelDoc.write(5,7,QString("Rang")); | ExcelDoc.write(5,7,QString("Rang")); | ||||
| ExcelDoc.write(5,8,QString("Fonction FN")); | |||||
| ExcelDoc.write(5,9,QString("Fonction PG")); | |||||
| ExcelDoc.write(5,10,QString("Fonction PP")); | |||||
| ExcelDoc.write(5,11,QString("Fonction ZT1")); | |||||
| ExcelDoc.write(5,12,QString("Fonction ZT2")); | |||||
| for(int log = 0; log < PassageLogData->size(); log++) | for(int log = 0; log < PassageLogData->size(); log++) | ||||
| { | { | ||||
| @@ -150,6 +157,55 @@ int CReportGenerator::GenerateExcelReport() | |||||
| ExcelDoc.write(row,5,QString("%1-%2-%3").arg(Element->mFlags.mTrainCompo1).arg(Element->mFlags.mTrainCompo2).arg(Element->mFlags.mTrainCompo3)); | ExcelDoc.write(row,5,QString("%1-%2-%3").arg(Element->mFlags.mTrainCompo1).arg(Element->mFlags.mTrainCompo2).arg(Element->mFlags.mTrainCompo3)); | ||||
| ExcelDoc.write(row,6,"---"); | ExcelDoc.write(row,6,"---"); | ||||
| ExcelDoc.write(row,7,"---"); | ExcelDoc.write(row,7,"---"); | ||||
| if(Element->mDetectionFlagsValid == false) | |||||
| { | |||||
| ExcelDoc.write(row,8,QString("N/D")); //Fonction FN | |||||
| ExcelDoc.write(row,9,QString("N/D")); //Fonction PG | |||||
| ExcelDoc.write(row,10,QString("N/D")); //Fonction PPE | |||||
| ExcelDoc.write(row,11,QString("N/D")); //Fonction ZT1 | |||||
| ExcelDoc.write(row,12,QString("N/D")); //Fonction ZT2 | |||||
| } | |||||
| else | |||||
| { | |||||
| QString Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_FN_MASK) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,8,Status); //Fonction FN | |||||
| Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_PG_MASK) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,9,Status); //Fonction PG | |||||
| Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_PP) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,10,Status); //Fonction PP | |||||
| Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_ZT1_MASK) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,11,Status); //ZT1 | |||||
| Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_ZT2_MASK) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,12,Status); //ZT2 | |||||
| } | |||||
| row++; | row++; | ||||
| } | } | ||||
| @@ -224,6 +280,55 @@ int CReportGenerator::GenerateExcelReport() | |||||
| ExcelDoc.write(row,5,QString("%1-%2-%3").arg(Element->mFlags.mTrainCompo1).arg(Element->mFlags.mTrainCompo2).arg(Element->mFlags.mTrainCompo3)); | ExcelDoc.write(row,5,QString("%1-%2-%3").arg(Element->mFlags.mTrainCompo1).arg(Element->mFlags.mTrainCompo2).arg(Element->mFlags.mTrainCompo3)); | ||||
| ExcelDoc.write(row,6,DetectionName); | ExcelDoc.write(row,6,DetectionName); | ||||
| ExcelDoc.write(row,7,Element->mZTDetections.at(detect)->mRank); | ExcelDoc.write(row,7,Element->mZTDetections.at(detect)->mRank); | ||||
| if(Element->mDetectionFlagsValid == false) | |||||
| { | |||||
| ExcelDoc.write(row,8,QString("N/D")); //Fonction FN | |||||
| ExcelDoc.write(row,9,QString("N/D")); //Fonction PG | |||||
| ExcelDoc.write(row,10,QString("N/D")); //Fonction PPE | |||||
| ExcelDoc.write(row,11,QString("N/D")); //Fonction ZT1 | |||||
| ExcelDoc.write(row,12,QString("N/D")); //Fonction ZT2 | |||||
| } | |||||
| else | |||||
| { | |||||
| QString Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_FN_MASK) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,8,Status); //Fonction FN | |||||
| Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_PG_MASK) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,9,Status); //Fonction PG | |||||
| Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_PP) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,10,Status); //Fonction PP | |||||
| Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_ZT1_MASK) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,11,Status); //ZT1 | |||||
| Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_ZT2_MASK) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,12,Status); //ZT2 | |||||
| } | |||||
| row++; | row++; | ||||
| IncPassage = true; //we had ad least one log added, this passage must count... | IncPassage = true; //we had ad least one log added, this passage must count... | ||||
| } | } | ||||
| @@ -249,6 +354,45 @@ int CReportGenerator::GenerateExcelReport() | |||||
| ExcelDoc.write(row,5,QString("%1-%2-%3").arg(Element->mFlags.mTrainCompo1).arg(Element->mFlags.mTrainCompo2).arg(Element->mFlags.mTrainCompo3)); | ExcelDoc.write(row,5,QString("%1-%2-%3").arg(Element->mFlags.mTrainCompo1).arg(Element->mFlags.mTrainCompo2).arg(Element->mFlags.mTrainCompo3)); | ||||
| ExcelDoc.write(row,6,"---"); | ExcelDoc.write(row,6,"---"); | ||||
| ExcelDoc.write(row,7,"---"); | ExcelDoc.write(row,7,"---"); | ||||
| if(Element->mDetectionFlagsValid == false) | |||||
| { | |||||
| ExcelDoc.write(row,8,QString("N/D")); //Fonction FN | |||||
| ExcelDoc.write(row,9,QString("N/D")); //Fonction PG | |||||
| ExcelDoc.write(row,10,QString("N/D")); //Fonction PPE | |||||
| ExcelDoc.write(row,11,QString("N/D")); //Fonction ZT1 | |||||
| ExcelDoc.write(row,12,QString("N/D")); //Fonction ZT2 | |||||
| } | |||||
| else | |||||
| { | |||||
| ExcelDoc.write(row,8,QString("N/A")); //Fonction FN | |||||
| ExcelDoc.write(row,9,QString("N/A")); //Fonction PG | |||||
| QString Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_PP2) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,10,Status); //Fonction PP | |||||
| Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_ZT1_MASK) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,11,Status); //ZT1 | |||||
| Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_ZT2_MASK) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,12,Status); //ZT2 | |||||
| } | |||||
| row++; | row++; | ||||
| } | } | ||||
| @@ -307,6 +451,45 @@ int CReportGenerator::GenerateExcelReport() | |||||
| ExcelDoc.write(row,5,QString("%1-%2-%3").arg(Element->mFlags.mTrainCompo1).arg(Element->mFlags.mTrainCompo2).arg(Element->mFlags.mTrainCompo3)); | ExcelDoc.write(row,5,QString("%1-%2-%3").arg(Element->mFlags.mTrainCompo1).arg(Element->mFlags.mTrainCompo2).arg(Element->mFlags.mTrainCompo3)); | ||||
| ExcelDoc.write(row,6,DetectionName); | ExcelDoc.write(row,6,DetectionName); | ||||
| ExcelDoc.write(row,7,Element->mZTDetections.at(detect)->mRank); | ExcelDoc.write(row,7,Element->mZTDetections.at(detect)->mRank); | ||||
| if(Element->mDetectionFlagsValid == false) | |||||
| { | |||||
| ExcelDoc.write(row,8,QString("N/D")); //Fonction FN | |||||
| ExcelDoc.write(row,9,QString("N/D")); //Fonction PG | |||||
| ExcelDoc.write(row,10,QString("N/D")); //Fonction PPE | |||||
| ExcelDoc.write(row,11,QString("N/D")); //Fonction ZT1 | |||||
| ExcelDoc.write(row,12,QString("N/D")); //Fonction ZT2 | |||||
| } | |||||
| else | |||||
| { | |||||
| ExcelDoc.write(row,8,QString("N/A")); //Fonction FN | |||||
| ExcelDoc.write(row,9,QString("N/A")); //Fonction PG | |||||
| QString Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_PP2) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,10,Status); //Fonction PP | |||||
| Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_ZT1_MASK) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,11,Status); //ZT1 | |||||
| Status = "Hors service"; | |||||
| if(Element->mFlags.mZTDetectionsConfig & DETECTION_FCT_ZT2_MASK) | |||||
| { | |||||
| Status = "En service"; | |||||
| } | |||||
| ExcelDoc.write(row,12,Status); //ZT2 | |||||
| } | |||||
| row++; | row++; | ||||
| IncPassage = true; //we had ad least one log added, this passage must count... | IncPassage = true; //we had ad least one log added, this passage must count... | ||||
| } | } | ||||
| @@ -273,6 +273,7 @@ CLogElement* CTrainLogFileMgr::OpenTrainLog(QString LogFilePathName,unsigned int | |||||
| InputStream->setVersion(QDataStream::Qt_4_8); | InputStream->setVersion(QDataStream::Qt_4_8); | ||||
| quint32 MagicNbr,NbLogEntry,NbDetections,LogType; | quint32 MagicNbr,NbLogEntry,NbDetections,LogType; | ||||
| bool IsDetectFunctionFlagsValid = false; | |||||
| *InputStream >> MagicNbr; | *InputStream >> MagicNbr; | ||||
| if(MagicNbr == 0xDEADBEEF) | if(MagicNbr == 0xDEADBEEF) | ||||
| @@ -295,7 +296,7 @@ CLogElement* CTrainLogFileMgr::OpenTrainLog(QString LogFilePathName,unsigned int | |||||
| LogFileVersion = 2; | LogFileVersion = 2; | ||||
| FileProtected = true; | FileProtected = true; | ||||
| } | } | ||||
| else if(MagicNbr == 0xDEADBEEF+15) | |||||
| else if(MagicNbr >= 0xDEADBEEF+15) | |||||
| { | { | ||||
| LogFileVersion = 3; | LogFileVersion = 3; | ||||
| @@ -313,6 +314,12 @@ CLogElement* CTrainLogFileMgr::OpenTrainLog(QString LogFilePathName,unsigned int | |||||
| { | { | ||||
| FileProtected = false; | FileProtected = false; | ||||
| } | } | ||||
| if(MagicNbr == 0xDEADBEEF+16) | |||||
| { | |||||
| IsDetectFunctionFlagsValid = true; | |||||
| } | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -339,6 +346,8 @@ CLogElement* CTrainLogFileMgr::OpenTrainLog(QString LogFilePathName,unsigned int | |||||
| PassageLog = (CZT1LogElement*)TargetElement; //It is the responsibility of the caller to make shure TargetElement is empty | PassageLog = (CZT1LogElement*)TargetElement; //It is the responsibility of the caller to make shure TargetElement is empty | ||||
| } | } | ||||
| PassageLog->mDetectionFlagsValid = IsDetectFunctionFlagsValid; | |||||
| PassageLog->mLogFileName = LogFilePathName; | PassageLog->mLogFileName = LogFilePathName; | ||||
| PassageLog->mFileProtected = FileProtected; | PassageLog->mFileProtected = FileProtected; | ||||
| @@ -435,6 +444,8 @@ CLogElement* CTrainLogFileMgr::OpenTrainLog(QString LogFilePathName,unsigned int | |||||
| PassageLog = (CZT2LogElement*) TargetElement; //It is the responsibility of the caller to make shure TargetElement is empty | PassageLog = (CZT2LogElement*) TargetElement; //It is the responsibility of the caller to make shure TargetElement is empty | ||||
| } | } | ||||
| PassageLog->mDetectionFlagsValid = IsDetectFunctionFlagsValid; | |||||
| *InputStream >> NbLogEntry; | *InputStream >> NbLogEntry; | ||||
| *InputStream >> NbDetections; | *InputStream >> NbDetections; | ||||
| *InputStream >> PassageLog->mStationName; | *InputStream >> PassageLog->mStationName; | ||||
| @@ -171,7 +171,7 @@ QDataStream &operator<<(QDataStream &out, const CZT1FlagsData &source) | |||||
| << source.mTrainCompo3 | << source.mTrainCompo3 | ||||
| << source.mModbusTrainType | << source.mModbusTrainType | ||||
| << source.mZT1ITI | << source.mZT1ITI | ||||
| << source.mUnusedFlag13 | |||||
| << source.mZTDetectionsConfig | |||||
| << source.mUnusedFlag14 | << source.mUnusedFlag14 | ||||
| << source.mUnusedFlag15 | << source.mUnusedFlag15 | ||||
| << source.mUnusedFlag16 | << source.mUnusedFlag16 | ||||
| @@ -196,7 +196,7 @@ QDataStream &operator>>(QDataStream &in, CZT1FlagsData &dest) | |||||
| >> dest.mTrainCompo3 | >> dest.mTrainCompo3 | ||||
| >> dest.mModbusTrainType | >> dest.mModbusTrainType | ||||
| >> dest.mZT1ITI | >> dest.mZT1ITI | ||||
| >> dest.mUnusedFlag13 | |||||
| >> dest.mZTDetectionsConfig | |||||
| >> dest.mUnusedFlag14 | >> dest.mUnusedFlag14 | ||||
| >> dest.mUnusedFlag15 | >> dest.mUnusedFlag15 | ||||
| >> dest.mUnusedFlag16 | >> dest.mUnusedFlag16 | ||||
| @@ -309,7 +309,7 @@ QDataStream &operator<<(QDataStream &out, const CZT2FlagsData &source) | |||||
| << source.mTrainCompo2 | << source.mTrainCompo2 | ||||
| << source.mTrainCompo3 | << source.mTrainCompo3 | ||||
| << source.mModbusTrainType | << source.mModbusTrainType | ||||
| << source.mUnusedFlag6 | |||||
| << source.mZTDetectionsConfig | |||||
| << source.mUnusedFlag7 | << source.mUnusedFlag7 | ||||
| << source.mUnusedFlag8 | << source.mUnusedFlag8 | ||||
| << source.mUnusedFlag9 | << source.mUnusedFlag9 | ||||
| @@ -325,7 +325,7 @@ QDataStream &operator>>(QDataStream &in, CZT2FlagsData &dest) | |||||
| >> dest.mTrainCompo2 | >> dest.mTrainCompo2 | ||||
| >> dest.mTrainCompo3 | >> dest.mTrainCompo3 | ||||
| >> dest.mModbusTrainType | >> dest.mModbusTrainType | ||||
| >> dest.mUnusedFlag6 | |||||
| >> dest.mZTDetectionsConfig | |||||
| >> dest.mUnusedFlag7 | >> dest.mUnusedFlag7 | ||||
| >> dest.mUnusedFlag8 | >> dest.mUnusedFlag8 | ||||
| >> dest.mUnusedFlag9 | >> dest.mUnusedFlag9 | ||||
| @@ -98,6 +98,16 @@ enum eDetectionFunctionID | |||||
| DETECTION_FCT_MAX_FCT | DETECTION_FCT_MAX_FCT | ||||
| }; | }; | ||||
| enum eDetectionFunctionMask | |||||
| { | |||||
| DETECTION_FCT_FN_MASK = 0x00000001, | |||||
| DETECTION_FCT_PG_MASK = 0x00000002, | |||||
| DETECTION_FCT_PP_MASK = 0x00000004, | |||||
| DETECTION_FCT_PP2_MASK = 0x00000008, | |||||
| DETECTION_FCT_ZT1_MASK = 0x00000010, | |||||
| DETECTION_FCT_ZT2_MASK = 0x00000020 | |||||
| }; | |||||
| enum eTrainTypeID | enum eTrainTypeID | ||||
| { | { | ||||
| TRAIN_TYPE_UNKNOWN, | TRAIN_TYPE_UNKNOWN, | ||||
| @@ -222,7 +232,7 @@ public: | |||||
| qint32 mTrainCompo3; | qint32 mTrainCompo3; | ||||
| qint32 mModbusTrainType; | qint32 mModbusTrainType; | ||||
| qint32 mZT1ITI; | qint32 mZT1ITI; | ||||
| qint32 mUnusedFlag13; | |||||
| qint32 mZTDetectionsConfig; | |||||
| qint32 mUnusedFlag14; | qint32 mUnusedFlag14; | ||||
| qint32 mUnusedFlag15; | qint32 mUnusedFlag15; | ||||
| qint32 mUnusedFlag16; | qint32 mUnusedFlag16; | ||||
| @@ -299,7 +309,7 @@ public: | |||||
| qint32 mTrainCompo2; | qint32 mTrainCompo2; | ||||
| qint32 mTrainCompo3; | qint32 mTrainCompo3; | ||||
| qint32 mModbusTrainType; | qint32 mModbusTrainType; | ||||
| qint32 mUnusedFlag6; | |||||
| qint32 mZTDetectionsConfig; | |||||
| qint32 mUnusedFlag7; | qint32 mUnusedFlag7; | ||||
| qint32 mUnusedFlag8; | qint32 mUnusedFlag8; | ||||
| qint32 mUnusedFlag9; | qint32 mUnusedFlag9; | ||||
| @@ -0,0 +1,15 @@ | |||||
| #ifndef VERSION_H | |||||
| #define VERSION_H | |||||
| #define SOFTWARE_VERSION "V1.1" | |||||
| //Description des changements | |||||
| //V1.1 | |||||
| //-Ajout des flags de l'état des fonctions de détection | |||||
| //-Retrait de l'onglet paramètres | |||||
| //V1.0 | |||||
| //-Version initiale | |||||
| #endif // VERSION_H | |||||
| @@ -49,7 +49,8 @@ HEADERS += \ | |||||
| Sources/SettingsPage.h \ | Sources/SettingsPage.h \ | ||||
| Sources/ReportSettingsData.h \ | Sources/ReportSettingsData.h \ | ||||
| Sources/ReportGenerator.h \ | Sources/ReportGenerator.h \ | ||||
| Sources/ZTStats.h | |||||
| Sources/ZTStats.h \ | |||||
| Sources/version.h | |||||
| Sources/MainWindow.h | Sources/MainWindow.h | ||||
| FORMS += MainWindow.ui \ | FORMS += MainWindow.ui \ | ||||