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);
145 QMap<QString, QString> subs_map = Project->
SubsMap;
152 QString found_key = SourceLine.sliced(key_start, (key_end - key_start));
153 QString found_value = subs_map.value(found_key);
154 SourceLine.replace(found_key, found_value);
169 QFile output_file( DestinationFile );
172 if ( output_file.remove() )
178 if (output_file.exists())
192 if (output_file.open(QIODevice::ReadWrite))
194 QTextStream out( &output_file );
196 QFile input_file( SourceFile );
197 if (input_file.open(QIODevice::ReadOnly))
199 QTextStream in( &input_file );
203 QString line = in.readLine();
204 QString output_line =
UpdateLine(Project, line);
205 out << output_line <<
"\n";
209 LogAdd(
LOG_DEBUG,
MODE_FILE, QString(
"Update of File " ) + SourceFile +
" to " + DestinationFile + QString(
" completed." ) );
230 QFileInfo srcFileInfo(srcFilePath);
231 if (srcFileInfo.isDir())
234 QDir targetDir(tgtFilePath);
235 if ( !targetDir.exists() )
239 if (!targetDir.mkpath(QFileInfo(tgtFilePath).fileName()))
246 QDir sourceDir(srcFilePath);
247 QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
248 foreach (
const QString &fileName, fileNames) {
249 const QString newSrcFilePath
250 = srcFilePath + QLatin1Char(
'/') + fileName;
251 const QString newTgtFilePath
252 = tgtFilePath + QLatin1Char(
'/') + fileName;
263 if (!
UpdateFile(Store, srcFilePath, tgtFilePath ))
265 LogAdd(
LOG_ERROR,
MODE_FILE, QString(
"Error in file translation from '" ) + srcFilePath + QString(
"' to '") + tgtFilePath +
"." );
280 QString code_directory = source_directory +
"/source/" + ProjectInfo->
ProjectDesc.
ExeName;
289 if (!dir.mkpath(destination_directory +
"/html"))
291 LogAdd(
LOG_ERROR,
MODE_FILE, QString(
"Default webpage directory for Project %1 was NOT created.").arg(project_ident));
298 if (
UpdateFile (ProjectInfo, source_directory +
"/defaults/index.html", destination_directory +
"/html/index.html"))
315 QString cloc_output =
CountLines(ProjectInfo, code_directory);
316 ProjectInfo->
SubsMap.insert(
"[#CLOC_INFO#]", cloc_output);
320 ProjectInfo->
SubsMap.insert(
"[#LIBRARY_LIST#]", ldd_output);
326 cpp_check =
CppCheck( ProjectInfo );
330 cpp_check =
"Currently Only available for C/C++ language.";
332 ProjectInfo->
SubsMap.insert(
"[#CPP_CHECK#]", cpp_check);
346 QString source_image_directory = source_directory +
"/images";
347 QString destination_image_directory = destination_directory +
"/images";
349 if (
RecursiveCopy(source_image_directory, destination_image_directory))
359 QString source_docs_directory = source_directory +
"/docs";
360 QString destination_docs_directory = destination_directory +
"/docs";
363 if (
RecursiveCopy(source_docs_directory, destination_docs_directory))
390 dir.removeRecursively();
394 result = dir.mkpath(Directory);
410 dir.setNameFilters(FileFilter);
411 QStringList file_list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks, QDir::NoSort);
412 for (
int index = 0; index < file_list.size(); ++index)
414 if (!dir.remove(file_list.at(index))) result =
false;
422 QString html_result_table =
"<TABLE BORDER=1><TR><TH>Language</TH><TH>Files</TH><TH>Blank</TH><TH>Comment</TH><TH>Code</TH></TR>";
423 QString html_result_rows =
"";
424 QString html_result_totals =
"";
426 QDir::setCurrent( Directory );
430 QString output_file = scratchdir +
"cloc_output.txt";
432 cloc.setStandardErrorFile( scratchdir +
"cloc_error.txt", QIODevice::WriteOnly | QIODevice::Text );
433 cloc.setStandardOutputFile( scratchdir +
"cloc_output.txt", QIODevice::WriteOnly | QIODevice::Text );
435 Arg << Directory <<
"--no-recurse";
436 cloc.start(
"cloc", QStringList() << Arg );
437 if (!cloc.waitForStarted())
440 html_result_table +=
"<TR><TD COLSPAN=5>Unable to Count Lines of Code.</TD></TR>";
446 if (!cloc.waitForFinished(100000))
449 html_result_table +=
"<TR><TD COLSPAN=5>Error occurred during Count Lines of Code.</TD></TR>";
456 QFile cloc_file(output_file);
457 if ( !cloc_file.open( QIODevice::ReadOnly | QIODevice::Text ) )
460 html_result_table +=
"<TR><TD COLSPAN=5>Error occurred reading cloc results.</TD></TR>";
464 int comment_count = 0;
467 while( !cloc_file.atEnd() )
469 text_line = cloc_file.readLine();
470 if ( text_line.contains(
"----", Qt::CaseInsensitive ) )
477 if ( comment_count == 1 )
479 QStringList tokens= text_line.split(
" ",Qt::SkipEmptyParts);
481 html_result_table +=
"<TR><TD>" + tokens[0] +
"</TD><TD>" + tokens[1] +
"</TD><TD>" + tokens[2] +
"</TD><TD>" +
482 tokens[3] +
"</TD><TD>" + tokens[4] +
"</TD></TR>";
486 else if ( comment_count == 2 )
489 QString language_name = text_line.first(25);
490 language_name = language_name.trimmed();
491 text_line = text_line.mid(25);
492 QStringList tokens= text_line.split(
" ",Qt::SkipEmptyParts);
494 html_result_rows +=
"<TR><TD><B><span style=\"color:red\">" + language_name +
"</span></B></TD><TD><B><span style=\"color:red\">" + tokens[0] +
495 "</span></B></TD><TD><B><span style=\"color:red\">" + tokens[1] +
"</span></B></TD><TD><B><span style=\"color:red\">" +
496 tokens[2] +
"</span></B></TD><TD><B><span style=\"color:red\">" + tokens[3] +
"</span></B></TD></TR>";
498 else if (comment_count ==3)
500 QStringList tokens= text_line.split(
" ",Qt::SkipEmptyParts);
502 html_result_totals =
"<TR><TD><B>" + tokens[0] +
"</B></TD><TD>" + tokens[1] +
"</TD><TD>" + tokens[2] +
"</TD><TD>" +
503 tokens[3] +
"</TD><TD>" + tokens[4] +
"</TD></TR>";
511 html_result_table += html_result_rows + html_result_totals +
"</TABLE>";
516 return ( html_result_table );
522 QString table_string;
524 QFile ldd_file( ResultFilename );
525 if ( !ldd_file.open( QIODevice::ReadOnly | QIODevice::Text ) )
528 table_string +=
"<tr><td>Error occurred reading ldd results.</td></tr>";
532 while( !ldd_file.atEnd() )
534 QString text_line = ldd_file.readLine();
535 table_string += QString(
"<tr><td>" + text_line + QString(
"</td></tr>" ) );
540 table_string += QString(
"</table>" );
542 return( table_string );
550 QString html_result_table =
"<table><tr><th>Dynamic Libraries Linked to Program</th></tr>";
551 if ( QSysInfo::kernelType() ==
"linux" )
553 QFile exe_file(program_file);
556 if (exe_file.exists())
558 QFileDevice::Permissions permissions = exe_file.permissions();
559 if(permissions & QFileDevice::ExeOwner)
563 ldd.setStandardErrorFile( scratchdir +
"ldd_error.txt", QIODevice::WriteOnly | QIODevice::Text );
564 ldd.setStandardOutputFile( scratchdir +
"ldd_output.txt", QIODevice::WriteOnly | QIODevice::Text );
567 ldd.start(
"ldd", QStringList() << Arg );
568 if (!ldd.waitForStarted(10000))
571 html_result_table +=
"<tr><td>Error - Unable to find dynamically lined libraries.</td></tr>";
577 if ( !ldd.waitForFinished(100000))
580 html_result_table +=
"<tr><td>Error occurred while finding Dynamically Linked Libraries.</td></tr>";
589 QFile::remove( scratchdir +
"ldd_error.txt" );
590 QFile::remove( scratchdir +
"ldd_output.txt" );
594 html_result_table +=
"<tr><td>File is not currently directly executable.</td></tr>";
599 html_result_table +=
"<tr><td>File does not currently exist.</td></tr>";
604 html_result_table +=
"Currently only Linux Files can be checked for library requirements.</td></tr>";
606 html_result_table +=
"</TABLE>";
608 return ( html_result_table );
613 QString search_string =
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName";
614 QString target_string;
615 QString version_string;
617 QTextStream in (&ProUserFile);
621 line = in.readLine();
622 if (!line.contains(search_string, Qt::CaseSensitive))
624 target_string = line;
628 while (!line.isNull());
631 if (!target_string.isNull())
633 int qt_index = line.indexOf(
"Qt");
636 int version_start = qt_index + 3;
637 int space_index = line.indexOf(
" ", version_start);
638 version_string = line.sliced(version_start, space_index - version_start);
641 return(version_string);
657 if (!dir.mkpath(destination_path))
667 dir.cd( source_path );
668 QString archive_file = destination_path +
"/" + ProjectInfo->
ProjectDesc.
ExeName +
".tar.gz";
672 Arg <<
"-czf" << archive_file <<
"--exclude=build" << source_path;
673 tar.start(
"tar", QStringList() << Arg );
674 if (!tar.waitForStarted())
682 tar.closeWriteChannel();
683 if (!tar.waitForFinished())
701 QString dev_language = DevLanguage.toUpper();
704 QStringList file_filter;
707 if ( dev_language ==
"ASM" )
709 file_filter <<
"*.asm" <<
"*.s";
711 else if ( dev_language ==
"BASH" )
713 file_filter <<
"*.sh";
715 else if ( dev_language ==
"BASIC" )
717 file_filter <<
"*.bas" <<
"*.vb";
719 else if ( dev_language ==
"C++" )
721 file_filter <<
"*.cpp" <<
"*.c" <<
"*.cxx" <<
"*.ino" <<
"*.h" <<
"*.hpp";
723 else if ( dev_language ==
"CAD" )
725 file_filter <<
"*.tcw" <<
"*.tct" <<
"*.dwg" <<
"*.stl" <<
"*.dxf";
727 else if ( dev_language ==
"FORTRAN" )
729 file_filter <<
"*.f" <<
"*.f90" <<
"*.f95" <<
"*.f03";
731 else if ( dev_language ==
"HTML" )
733 file_filter <<
"*.htm" <<
"*.html" <<
"*.css" <<
"*.js" <<
"*.php";
735 else if ( dev_language ==
"JAVA" )
737 file_filter <<
"*.java" <<
"*.jar" <<
"*.ins";
739 else if ( dev_language ==
"JAVASCRIPT" )
741 file_filter <<
"*.js";
743 else if ( dev_language ==
"OCTAVE" )
745 file_filter <<
"*.m";
747 else if ( dev_language ==
"PERL" )
749 file_filter <<
"*.pl" <<
"*.pm";
751 else if ( dev_language ==
"PHP" )
753 file_filter <<
"*.php" <<
"*.phtml" <<
"*.php3" <<
"*.php4" <<
"*.php5" <<
"*.php7" <<
"*.phps";
755 else if (dev_language ==
"LINDENSCRIPT")
757 file_filter <<
"*.lsl" <<
"*.osl";
761 QDir source_directory( Directory );
762 source_directory.setFilter( QDir::Files | QDir::NoDotAndDotDot | QDir::Readable );
765 QStringList file_list;
766 file_list = source_directory.entryList( file_filter );
769 QFile result_file( ResultFileName );
770 if ( !result_file.open( QIODevice::WriteOnly | QIODevice::Text ) )
779 QTextStream out( &result_file );
782 for (
const auto& filename : file_list )
784 out << filename <<
"\n";
794 QString result_table;
800 QFile file(file_list);
812 QDir::setCurrent(directory);
819 cppcheck.setStandardErrorFile( error_file, QIODevice::WriteOnly | QIODevice::Text );
820 cppcheck.setStandardOutputFile( output_file, QIODevice::WriteOnly | QIODevice::Text );
822 arg <<
"--enable=all" <<
"-UDEBUG" <<
"--inconclusive" << QString(
"--file-list=" ) + file_list;
824 cppcheck.start(
"cppcheck", arg );
825 if (!cppcheck.waitForStarted(10000))
828 result_table +=
"ERROR - Unable to scan .cpp code.<BR>";
834 if (!cppcheck.waitForFinished(100000))
837 result_table +=
"ERROR - cppcheck failed during execution.<BR>";
844 QFile ccpcheck_file( error_file );
845 if ( !ccpcheck_file.open( QIODevice::ReadOnly | QIODevice::Text ) )
848 result_table +=
"ERROR - Unable to read ccpcheck results.<BR>";
852 while( !ccpcheck_file.atEnd() )
854 QString line = ccpcheck_file.readLine();
855 line.replace(
"/*!<",
"[").replace(
"*/",
"]");
856 result_table += line +
"<BR>";
861 QFile cpp_file(check_filename);
862 if (cpp_file.open(QIODevice::ReadWrite))
864 QTextStream stream(&cpp_file);
865 stream << result_table << Qt::endl;
880 return(result_table);
887 QFileInfo srcFileInfo(Source);
888 if (srcFileInfo.isDir())
891 QDir targetDir(Destination);
892 if ( !targetDir.exists() )
896 if (!targetDir.mkpath(QFileInfo(Destination).fileName()))
903 QDir sourceDir(Source);
904 QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
905 foreach (
const QString &fileName, fileNames)
907 const QString newSrcFilePath = Source + QLatin1Char(
'/') + fileName;
908 const QString newTgtFilePath = Destination + QLatin1Char(
'/') + fileName;
919 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