16 docs_filter <<
"*.dox" <<
"Doxyfile" <<
"footer.html" <<
"header.html" <<
"customdoxygen.css" <<
"*.dia" <<
"*.uml" <<
"*.txt" <<
"*.pdf" <<
"*.doc" <<
"*.docx" <<
"*.tcw" <<
"*.tct" <<
"*.dwg" ;
19 source_filter <<
"*.c" <<
"*.cpp" <<
"*.h" <<
".hpp" <<
"*.ui" <<
"*.pro" <<
"*.pro.user" <<
"*.qrc" <<
"*.php" <<
"*.php" <<
"*.php4" <<
"*.php5" <<
"*.py" <<
"*.f" <<
"*.for" <<
"*.js" <<
"*.sh" <<
"*.sql";
31 log_entry.
Mode = Mode;
104 if (!doxygen.waitForStarted())
113 doxygen.closeWriteChannel();
114 if (!doxygen.waitForFinished( 480000 ))
124 QFile file(source_file);
147 QMap<QString, QString> subs_map = Project->
SubsMap;
154 QString found_key = SourceLine.sliced(key_start, (key_end - key_start));
155 QString found_value = subs_map.value(found_key);
156 SourceLine.replace(found_key, found_value);
171 QFile output_file( DestinationFile );
174 if ( output_file.remove() )
180 if (output_file.exists())
194 if (output_file.open(QIODevice::ReadWrite))
196 QTextStream out( &output_file );
198 QFile input_file( SourceFile );
199 if (input_file.open(QIODevice::ReadOnly))
201 QTextStream in( &input_file );
205 QString line = in.readLine();
206 QString output_line =
UpdateLine(Project, line);
207 out << output_line <<
"\n";
211 LogAdd(
LOG_DEBUG,
MODE_FILE, QString(
"Update of File " ) + SourceFile +
" to " + DestinationFile + QString(
" completed." ) );
232 QFileInfo srcFileInfo(srcFilePath);
233 if (srcFileInfo.isDir())
236 QDir targetDir(tgtFilePath);
237 if ( !targetDir.exists() )
241 if (!targetDir.mkpath(QFileInfo(tgtFilePath).fileName()))
248 QDir sourceDir(srcFilePath);
249 QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
250 foreach (
const QString &fileName, fileNames) {
251 const QString newSrcFilePath
252 = srcFilePath + QLatin1Char(
'/') + fileName;
253 const QString newTgtFilePath
254 = tgtFilePath + QLatin1Char(
'/') + fileName;
265 if (!
UpdateFile(Store, srcFilePath, tgtFilePath ))
267 LogAdd(
LOG_ERROR,
MODE_FILE, QString(
"Error in file translation from '" ) + srcFilePath + QString(
"' to '") + tgtFilePath +
"." );
282 QString code_directory = source_directory +
"/source/" + ProjectInfo->
ProjectDesc.
ExeName;
291 if (!dir.mkpath(destination_directory +
"/html"))
293 LogAdd(
LOG_ERROR,
MODE_FILE, QString(
"Default webpage directory for Project %1 was NOT created.").arg(project_ident));
300 if (
UpdateFile (ProjectInfo, source_directory +
"/defaults/index.html", destination_directory +
"/html/index.html"))
317 QString cloc_output =
CountLines(ProjectInfo, code_directory);
318 ProjectInfo->
SubsMap.insert(
"[#CLOC_INFO#]", cloc_output);
322 ProjectInfo->
SubsMap.insert(
"[#LIBRARY_LIST#]", ldd_output);
328 cpp_check =
CppCheck( ProjectInfo );
332 cpp_check =
"Currently Only available for C/C++ language.";
334 ProjectInfo->
SubsMap.insert(
"[#CPP_CHECK#]", cpp_check);
348 QString source_image_directory = source_directory +
"/images";
349 QString destination_image_directory = destination_directory +
"/images";
351 if (
RecursiveCopy(source_image_directory, destination_image_directory))
361 QString source_docs_directory = source_directory +
"/docs";
362 QString destination_docs_directory = destination_directory +
"/docs";
365 if (
RecursiveCopy(source_docs_directory, destination_docs_directory))
392 dir.removeRecursively();
396 result = dir.mkpath(Directory);
412 dir.setNameFilters(FileFilter);
413 QStringList file_list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks, QDir::NoSort);
414 for (
int index = 0; index < file_list.size(); ++index)
416 if (!dir.remove(file_list.at(index))) result =
false;
424 QString html_result_table =
"<TABLE BORDER=1><TR><TH>Language</TH><TH>Files</TH><TH>Blank</TH><TH>Comment</TH><TH>Code</TH></TR>";
425 QString html_result_rows =
"";
426 QString html_result_totals =
"";
428 QDir::setCurrent( Directory );
432 QString output_file = scratchdir +
"cloc_output.txt";
434 cloc.setStandardErrorFile( scratchdir +
"cloc_error.txt", QIODevice::WriteOnly | QIODevice::Text );
435 cloc.setStandardOutputFile( scratchdir +
"cloc_output.txt", QIODevice::WriteOnly | QIODevice::Text );
437 Arg << Directory <<
"--no-recurse";
438 cloc.start(
"cloc", QStringList() << Arg );
439 if (!cloc.waitForStarted())
442 html_result_table +=
"<TR><TD COLSPAN=5>Unable to Count Lines of Code.</TD></TR>";
448 if (!cloc.waitForFinished(100000))
451 html_result_table +=
"<TR><TD COLSPAN=5>Error occurred during Count Lines of Code.</TD></TR>";
458 QFile cloc_file(output_file);
459 if ( !cloc_file.open( QIODevice::ReadOnly | QIODevice::Text ) )
462 html_result_table +=
"<TR><TD COLSPAN=5>Error occurred reading cloc results.</TD></TR>";
466 int comment_count = 0;
469 while( !cloc_file.atEnd() )
471 text_line = cloc_file.readLine();
472 if ( text_line.contains(
"----", Qt::CaseInsensitive ) )
479 if ( comment_count == 1 )
481 QStringList tokens= text_line.split(
" ",Qt::SkipEmptyParts);
483 html_result_table +=
"<TR><TD>" + tokens[0] +
"</TD><TD>" + tokens[1] +
"</TD><TD>" + tokens[2] +
"</TD><TD>" +
484 tokens[3] +
"</TD><TD>" + tokens[4] +
"</TD></TR>";
488 else if ( comment_count == 2 )
491 QString language_name = text_line.first(25);
492 language_name = language_name.trimmed();
493 text_line = text_line.mid(25);
494 QStringList tokens= text_line.split(
" ",Qt::SkipEmptyParts);
496 html_result_rows +=
"<TR><TD><B><span style=\"color:red\">" + language_name +
"</span></B></TD><TD><B><span style=\"color:red\">" + tokens[0] +
497 "</span></B></TD><TD><B><span style=\"color:red\">" + tokens[1] +
"</span></B></TD><TD><B><span style=\"color:red\">" +
498 tokens[2] +
"</span></B></TD><TD><B><span style=\"color:red\">" + tokens[3] +
"</span></B></TD></TR>";
500 else if (comment_count ==3)
502 QStringList tokens= text_line.split(
" ",Qt::SkipEmptyParts);
504 html_result_totals =
"<TR><TD><B>" + tokens[0] +
"</B></TD><TD>" + tokens[1] +
"</TD><TD>" + tokens[2] +
"</TD><TD>" +
505 tokens[3] +
"</TD><TD>" + tokens[4] +
"</TD></TR>";
513 html_result_table += html_result_rows + html_result_totals +
"</TABLE>";
518 return ( html_result_table );
524 QString table_string;
526 QFile ldd_file( ResultFilename );
527 if ( !ldd_file.open( QIODevice::ReadOnly | QIODevice::Text ) )
530 table_string +=
"<tr><td>Error occurred reading ldd results.</td></tr>";
534 while( !ldd_file.atEnd() )
536 QString text_line = ldd_file.readLine();
537 table_string += QString(
"<tr><td>" + text_line + QString(
"</td></tr>" ) );
542 table_string += QString(
"</table>" );
544 return( table_string );
552 QString html_result_table =
"<table><tr><th>Dynamic Libraries Linked to Program</th></tr>";
553 if ( QSysInfo::kernelType() ==
"linux" )
555 QFile exe_file(program_file);
558 if (exe_file.exists())
560 QFileDevice::Permissions permissions = exe_file.permissions();
561 if(permissions & QFileDevice::ExeOwner)
565 ldd.setStandardErrorFile( scratchdir +
"ldd_error.txt", QIODevice::WriteOnly | QIODevice::Text );
566 ldd.setStandardOutputFile( scratchdir +
"ldd_output.txt", QIODevice::WriteOnly | QIODevice::Text );
569 ldd.start(
"ldd", QStringList() << Arg );
570 if (!ldd.waitForStarted(10000))
573 html_result_table +=
"<tr><td>Error - Unable to find dynamically lined libraries.</td></tr>";
579 if ( !ldd.waitForFinished(100000))
582 html_result_table +=
"<tr><td>Error occurred while finding Dynamically Linked Libraries.</td></tr>";
591 QFile::remove( scratchdir +
"ldd_error.txt" );
592 QFile::remove( scratchdir +
"ldd_output.txt" );
596 html_result_table +=
"<tr><td>File is not currently directly executable.</td></tr>";
601 html_result_table +=
"<tr><td>File does not currently exist.</td></tr>";
606 html_result_table +=
"Currently only Linux Files can be checked for library requirements.</td></tr>";
608 html_result_table +=
"</TABLE>";
610 return ( html_result_table );
615 QString search_string =
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName";
616 QString target_string;
617 QString version_string;
619 QTextStream in (&ProUserFile);
623 line = in.readLine();
624 if (!line.contains(search_string, Qt::CaseSensitive))
626 target_string = line;
630 while (!line.isNull());
633 if (!target_string.isNull())
635 int qt_index = line.indexOf(
"Qt");
638 int version_start = qt_index + 3;
639 int space_index = line.indexOf(
" ", version_start);
640 version_string = line.sliced(version_start, space_index - version_start);
643 return(version_string);
659 if (!dir.mkpath(destination_path))
669 dir.cd( source_path );
670 QString archive_file = destination_path +
"/" + ProjectInfo->
ProjectDesc.
ExeName +
".tar.gz";
674 Arg <<
"-czf" << archive_file <<
"--exclude=build" << source_path;
675 tar.start(
"tar", QStringList() << Arg );
676 if (!tar.waitForStarted())
684 tar.closeWriteChannel();
685 if (!tar.waitForFinished())
703 QString dev_language = DevLanguage.toUpper();
706 QStringList file_filter;
709 if ( dev_language ==
"ASM" )
711 file_filter <<
"*.asm" <<
"*.s";
713 else if ( dev_language ==
"BASH" )
715 file_filter <<
"*.sh";
717 else if ( dev_language ==
"BASIC" )
719 file_filter <<
"*.bas" <<
"*.vb";
721 else if ( dev_language ==
"C++" )
723 file_filter <<
"*.cpp" <<
"*.c" <<
"*.cxx" <<
"*.ino" <<
"*.h" <<
"*.hpp";
725 else if ( dev_language ==
"CAD" )
727 file_filter <<
"*.tcw" <<
"*.tct" <<
"*.dwg" <<
"*.stl" <<
"*.dxf";
729 else if ( dev_language ==
"FORTRAN" )
731 file_filter <<
"*.f" <<
"*.f90" <<
"*.f95" <<
"*.f03";
733 else if ( dev_language ==
"HTML" )
735 file_filter <<
"*.htm" <<
"*.html" <<
"*.css" <<
"*.js" <<
"*.php";
737 else if ( dev_language ==
"JAVA" )
739 file_filter <<
"*.java" <<
"*.jar" <<
"*.ins";
741 else if ( dev_language ==
"JAVASCRIPT" )
743 file_filter <<
"*.js";
745 else if ( dev_language ==
"OCTAVE" )
747 file_filter <<
"*.m";
749 else if ( dev_language ==
"PERL" )
751 file_filter <<
"*.pl" <<
"*.pm";
753 else if ( dev_language ==
"PHP" )
755 file_filter <<
"*.php" <<
"*.phtml" <<
"*.php3" <<
"*.php4" <<
"*.php5" <<
"*.php7" <<
"*.phps";
757 else if (dev_language ==
"LINDENSCRIPT")
759 file_filter <<
"*.lsl" <<
"*.osl";
763 QDir source_directory( Directory );
764 source_directory.setFilter( QDir::Files | QDir::NoDotAndDotDot | QDir::Readable );
767 QStringList file_list;
768 file_list = source_directory.entryList( file_filter );
771 QFile result_file( ResultFileName );
772 if ( !result_file.open( QIODevice::WriteOnly | QIODevice::Text ) )
781 QTextStream out( &result_file );
784 for (
const auto& filename : file_list )
786 out << filename <<
"\n";
796 QString result_table;
802 QFile file(file_list);
814 QDir::setCurrent(directory);
821 cppcheck.setStandardErrorFile( error_file, QIODevice::WriteOnly | QIODevice::Text );
822 cppcheck.setStandardOutputFile( output_file, QIODevice::WriteOnly | QIODevice::Text );
824 arg <<
"--enable=all" <<
"-UDEBUG" <<
"--inconclusive" << QString(
"--file-list=" ) + file_list;
826 cppcheck.start(
"cppcheck", arg );
827 if (!cppcheck.waitForStarted(10000))
830 result_table +=
"ERROR - Unable to scan .cpp code.<BR>";
836 if (!cppcheck.waitForFinished(100000))
839 result_table +=
"ERROR - cppcheck failed during execution.<BR>";
846 QFile ccpcheck_file( error_file );
847 if ( !ccpcheck_file.open( QIODevice::ReadOnly | QIODevice::Text ) )
850 result_table +=
"ERROR - Unable to read ccpcheck results.<BR>";
854 while( !ccpcheck_file.atEnd() )
856 QString line = ccpcheck_file.readLine();
857 line.replace(
"/*!<",
"[").replace(
"*/",
"]");
858 result_table += line +
"<BR>";
863 QFile cpp_file(check_filename);
864 if (cpp_file.open(QIODevice::ReadWrite))
866 QTextStream stream(&cpp_file);
867 stream << result_table << Qt::endl;
882 return(result_table);
889 QFileInfo srcFileInfo(Source);
890 if (srcFileInfo.isDir())
893 QDir targetDir(Destination);
894 if ( !targetDir.exists() )
898 if (!targetDir.mkpath(QFileInfo(Destination).fileName()))
905 QDir sourceDir(Source);
906 QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
907 foreach (
const QString &fileName, fileNames)
909 const QString newSrcFilePath = Source + QLatin1Char(
'/') + fileName;
910 const QString newTgtFilePath = Destination + QLatin1Char(
'/') + fileName;
921 if (!QFile(Source).copy(Destination))
return(
false);
QString FindQtBuildVersion(QString ConfigFile)
Find the Qt Builder Version.
Worker(QObject *parent=nullptr)
Worker Class Constructor.
QStringList source_filter
void DoWork(PROJECT_INFORMATION *ProjectInfo)
Process the Generation of Documentation by Doxygen & other processes.
void DoDoxygen(PROJECT_INFORMATION *ProjectInfo)
Run Doxygen to Generate the Source Documentaiton.
bool CreateSourceListFile(const QString Directory, const QString ResultFileName, const QString DevLanguage)
Create a List of Project Software Source Files.
QString ParserLddResults(QString ResultFilename)
Converts the Library List into an HTML compatible format.
bool TrimDirectory(QString Directory, QStringList FileFilter)
Remove files defined by the FileFilter from the Directory.
bool CreateInstallScript(PROJECT_INFORMATION *ProjectInfo)
bool CleanDirectory(QString Directory)
Clean a Directory Tree by recursively removing all files and subdirectories.
QString CountLines(PROJECT_INFORMATION *Store, QString Directory)
bool TranslateRecursively(PROJECT_INFORMATION *Store, const QString &srcFilePath, const QString &tgtFilePath)
Recursively process text substituition for a Directory Tree.
void LogAdd(LOGGING_SEVERITY Severity, LOGGING_MODE Mode, const QString Message)
Send Message to the Log.
QString CppCheck(PROJECT_INFORMATION *ProjectInfo)
Conduct Static Analysis of C++ code.
void SendLogEntry(REMOTE_LOG_ENTRY LogEntry)
QString UpdateLine(PROJECT_INFORMATION *Project, QString SourceLine)
Process text substitutions for a single line.
bool UpdateFile(PROJECT_INFORMATION *Project, QString SourceFile, QString DestinationFile)
Process text substituitions for a complete text file.
bool CreateSourceArchive(PROJECT_INFORMATION *Store)
Create an Archive using git.
bool RecursiveCopy(QString Source, QString Destination)
void WorkDone(PROJECT_INFORMATION *ProjectInfo)
QString FindLibraries(PROJECT_INFORMATION *Store)
Find the shared libraries the program needs to run.
bool PreProcessProject(PROJECT_INFORMATION *ProjectInfo)
Preprocess the Project's Documentation.
#define DOXY_LOG_FILE
The name of the Doxygen Log File.
#define EXCLUDE_PROJECT_LIST
Exclude Project from Public List Mask.
#define CONTROL_DOC_ACCESS
Control Document Access to Public Mask.
@ TARGET_OPEN_SIM_PROJECT
#define ONLY_DEFAULT_PAGE
Only Display Default Page to Public Mask.
#define CREATE_SOURCE_ARCHIVE
Create a SOurce Archive when Documentation Generated.
LOGGING_SEVERITY
Log Severity allow the selection of logging events based on Severity.
LOGGING_MODE
Log Severity allow the selection of logging events based on the mode.
ProjectOptionsManager * project_opts_manager
Class Controlling the Database Creation.
Class for Reading Projects.
LOGGING_SEVERITY Severity