Project Documentation Manager BRIGADOON-0002
Project Documentation Manager
Loading...
Searching...
No Matches
ProjectDocManager Class Reference

Project Document Control Class. More...

#include <projectdocmanager.h>

Inheritance diagram for ProjectDocManager:
[legend]
Collaboration diagram for ProjectDocManager:
[legend]

Public Slots

void LoadProjectList ()
 Load Select Project List from Database.
void ReceiveProjectId (PROJECT_INFORMATION ProjectId)
 Receive the Project's Information for processing.
void SaveProject (void)
 Save a new project to the database.
int CreateProjectId (void)
 Create the next unused project number.

Signals

void SendClear (void)
 Send a Project Clear Command.
void SendLogEntry (REMOTE_LOG_ENTRY LogEntry)
 Send Log Entry via the Signal-Slot Method.
void SendDevelopmentFamily (DEVELOPMENT_FAMILY DevFamily)
 Send Development Family Information Structure for Update.
void SendLicenceState (LICENCE_STATE ProjectLicences)
 Send out the current Licence States.
void SendProjectId (PROJECT_INFORMATION *ProjectId)
 Send out Project Information for Updates.
void SendVersion (REMOTE_VERSION_ENTRY VersionInfo)
 Send out the Project Version Information.
void SendSubstituteState (bool State)
 Send the Substitute Enable State.
void SaveLocalSubstitutes (void)
 Send a Trigger to Load.
void LoadSubstituteTable ()
 Load System Substituitions.

Public Member Functions

 ProjectDocManager (Ui::MainWindow *UI_Window)
 ProjectManager Class Constructor.
 ~ProjectDocManager ()
 ProjectManager Class Deconstructor.
bool CommitGitDirectory (QString SrcFilePath, QString VersionsString, QString Message)
 Commit Project Files to Git.

Private Slots

void SetDocAccess (int State)
 Enable/Disable Document Access Restrictions.
void SetDoxyOptions (int State)
 Enable/Disable Custom Doxy Options.
void SetDonationsWelcome (int State)
 Enable/Disable Donation Options.
void GetDoxyLogo (void)
 Get the Doxygen Logo from known image files.
void GetDoxyHeader (void)
 Get Custom Doxygen Header.
void GetDoxyFooter (void)
 Get Custom Doxygen Footer.
void GetDoxyStylesheet (void)
 Get Custom Doxygen Stylesheet.
void StartProject (void)
 Enable the Project User Interface for editing.
void SetEditState (int State)
 Enable/Disable editing.
void ReadActivated (int Item)
 Load a Project & Enable editing.
void DoEditAbort (void)
 Abort Editing without Saving.
void DoEditSave (void)
 Abort Editing after Saving.
void EnableUserInterface (bool State)
 Enable the Project User Interface.

Private Member Functions

QString GetFile (QString InitialName, GET_FILE_TYPE FileType)
 Read a file into a String.
void LogAdd (LOGGING_SEVERITY Severity, LOGGING_MODE Mode, const QString Message)
 Send Message to the Log.
void ShowMessage (QString Message)
 Shows Message in popup window.
void LoadProjectFromDatabase (int Item)
 Load Project Information from Database.
void SetEditButtons (bool State)
 Enable/Disable Edit buttons.
int GetLicenceIndex (QString LicenceName)
 Get the Licence Database Index from the Licence Name.
bool IsSaveAvailable (void)
 Check if Project Save is Enabled.
void UpdateProjectToDatabase (void)
 Updates an Existing Project.
bool InsertNewProjectInDatabase (void)
 Inserts new project into the database.
bool CopyRecursively (const QString &SourceFilePath, const QString &TargetFilePath)
 Recursively copy files from Source to Destination.
bool InitiasliseGitDirectory (QString SrcFilePath)
 Initialise the Project's Git Directory.
bool LockProject (int ProjectIndex, bool LockState)
 Lock/Unlock Project in the Database.
void LockSubsButtons (bool State)
 Lock/unlock the Substitution Buttons.

Private Attributes

Ui::MainWindow * ui
 Pointer to the Main Window.
PROJECT_INFORMATION project_info
 Structure to hold Project Information.

Detailed Description

Project Document Control Class.

Definition at line 34 of file projectdocmanager.h.

Constructor & Destructor Documentation

◆ ProjectDocManager()

ProjectDocManager::ProjectDocManager ( Ui::MainWindow * UI_Window)

ProjectManager Class Constructor.

Parameters
UI_WindowPointer to the Main Window

Definition at line 25 of file projectdocmanager.cpp.

26{
27 ui = UI_Window;
28
29 // Connect to the Relevant Controls
30 QObject::connect(ui->ControlDocAccess, SIGNAL(stateChanged(int)), this, SLOT(SetDocAccess(int)));
31 QObject::connect(ui->EnableDoxyOptions, SIGNAL(stateChanged(int)), this, SLOT(SetDoxyOptions(int)));
32 QObject::connect(ui->DonationsWelcome, SIGNAL(stateChanged(int)), this, SLOT(SetDonationsWelcome(int)));
33 QObject::connect(ui->GetDoxyLogo, SIGNAL(pressed()), this, SLOT(GetDoxyLogo()));
34 QObject::connect(ui->GetDoxyHeader, SIGNAL(pressed()), this, SLOT(GetDoxyHeader()));
35 QObject::connect(ui->GetDoxyFooter, SIGNAL(pressed()), this, SLOT(GetDoxyFooter()));
36 QObject::connect(ui->GetDoxyStylesheet, SIGNAL(pressed()), this, SLOT(GetDoxyStylesheet()));
37 QObject::connect(ui->EnableProjectEdit, SIGNAL(stateChanged(int)), this, SLOT(SetEditState(int)));
38 QObject::connect(ui->SelectProjectList, SIGNAL(activated(int)), this, SLOT(ReadActivated(int)));
39 QObject::connect(ui->CreateNewProject, SIGNAL(pressed()), this, SLOT(StartProject()));
40 QObject::connect(ui->AbortNewProject, SIGNAL(pressed()), this, SLOT(DoEditAbort()));
41}
void GetDoxyHeader(void)
Get Custom Doxygen Header.
void StartProject(void)
Enable the Project User Interface for editing.
void SetDonationsWelcome(int State)
Enable/Disable Donation Options.
void GetDoxyLogo(void)
Get the Doxygen Logo from known image files.
void GetDoxyFooter(void)
Get Custom Doxygen Footer.
void SetDocAccess(int State)
Enable/Disable Document Access Restrictions.
void SetDoxyOptions(int State)
Enable/Disable Custom Doxy Options.
void ReadActivated(int Item)
Load a Project & Enable editing.
void GetDoxyStylesheet(void)
Get Custom Doxygen Stylesheet.
void SetEditState(int State)
Enable/Disable editing.
Ui::MainWindow * ui
Pointer to the Main Window.
void DoEditAbort(void)
Abort Editing without Saving.

References DoEditAbort(), GetDoxyFooter(), GetDoxyHeader(), GetDoxyLogo(), GetDoxyStylesheet(), ReadActivated(), SetDocAccess(), SetDonationsWelcome(), SetDoxyOptions(), SetEditState(), StartProject(), and ui.

Here is the call graph for this function:

◆ ~ProjectDocManager()

ProjectDocManager::~ProjectDocManager ( )

ProjectManager Class Deconstructor.

Definition at line 43 of file projectdocmanager.cpp.

44{
46}
bool SetProjectStatus(int ProjectIndex, bool LockState, bool QueueState)
Set the Locked and Queued State of the Project.
ReadProjectInfo * read_project_info
int current_locked_project
Database Index of currently locked Project.

References current_locked_project, and read_project_info.

Member Function Documentation

◆ CommitGitDirectory()

bool ProjectDocManager::CommitGitDirectory ( QString SrcFilePath,
QString VersionsString,
QString Message )

Commit Project Files to Git.

Parameters
SrcFilePathPath to the Source Directory
VersionStringProject's Version Number as String
MessageString identifying reason for the Version
Returns
Success or Failure

Definition at line 791 of file projectdocmanager.cpp.

792{
793 bool result = false;
794
795 // Move to the default .git Directory
796 QDir dir;
797 dir.cd(SrcFilePath);
798
799 // Output the git Command
800 QProcess git;
801 QStringList Arg;
802 QString commit_string = QString("Version: %1. %2").arg(VersionString).arg(Message);
803 QString arg_string = QString("commit -m \"Project Version %1\"").arg(commit_string);
804
805 Arg << arg_string;
806
807 git.start( "git", QStringList() << Arg );
808 if (!git.waitForStarted())
809 {
810 LogAdd( LOG_ERROR, MODE_THREAD, "git did NOT Start." );
811 }
812 else
813 {
814 LogAdd( LOG_DEBUG, MODE_THREAD, QString("Started git Process with %1").arg(arg_string));
815 if (git.waitForFinished())
816 {
817 result = true;
818
819 }
820 else
821 {
822 LogAdd( LOG_ERROR, MODE_THREAD, "git Commit did NOT finish on time." );
823 }
824 }
825 return(result);
826}
void LogAdd(LOGGING_SEVERITY Severity, LOGGING_MODE Mode, const QString Message)
Send Message to the Log.
@ LOG_ERROR
Definition logger.h:52
@ LOG_DEBUG
Definition logger.h:56
@ MODE_THREAD
Definition logger.h:25

References LOG_DEBUG, LOG_ERROR, LogAdd(), and MODE_THREAD.

Here is the call graph for this function:

◆ CopyRecursively()

bool ProjectDocManager::CopyRecursively ( const QString & SourceFilePath,
const QString & TargetFilePath )
private

Recursively copy files from Source to Destination.

Parameters
SourceFilePathSource Directory
TargetFilePathDestination Directory
Returns
Success (true) or Failure (false)

Definition at line 691 of file projectdocmanager.cpp.

692{
693 // Check if the Source is a File or a Directory
694 QFileInfo srcFileInfo(srcFilePath);
695 if (srcFileInfo.isDir())
696 {
697 // If the Target Directory Doesn't Exist, Create It
698 QDir targetDir(tgtFilePath);
699 if ( !targetDir.exists() )
700 {
701 // Go Up a Level and Create the Directory
702 targetDir.cdUp();
703 if (!targetDir.mkpath(QFileInfo(tgtFilePath).fileName()))
704 {
705 return false;
706 }
707 }
708
709 // Copy Each Entry in the Directory to the Target
710 QDir sourceDir(srcFilePath);
711 QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
712 foreach (const QString &fileName, fileNames) {
713 const QString newSrcFilePath
714 = srcFilePath + QLatin1Char('/') + fileName;
715 const QString newTgtFilePath
716 = tgtFilePath + QLatin1Char('/') + fileName;
717 if (!CopyRecursively(newSrcFilePath, newTgtFilePath))
718 {
719 return false;
720 }
721 }
722 }
723
724 // If it is a File Copy It
725 else
726 {
727 if (!QFile::copy(srcFilePath, tgtFilePath))
728 {
729 LogAdd( LOG_ERROR, MODE_FILE, QString( "Error in file copy from '" ) + srcFilePath + QString("' to '") + tgtFilePath + "." );
730 return false;
731 }
732 }
733 return true;
734}
bool CopyRecursively(const QString &SourceFilePath, const QString &TargetFilePath)
Recursively copy files from Source to Destination.
@ MODE_FILE
Definition logger.h:32

References CopyRecursively(), LOG_ERROR, LogAdd(), and MODE_FILE.

Referenced by CopyRecursively(), and InsertNewProjectInDatabase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateProjectId

int ProjectDocManager::CreateProjectId ( void )
slot

Create the next unused project number.

Returns
Next unused project number

Definition at line 491 of file projectdocmanager.cpp.

492{
493 uint project_number=0;
494
495 // Find the Next Project Number
496 QString query_string = QString("select max(project_index) from project");
497 QSqlDatabase db = QSqlDatabase::database();
498
499 QSqlQuery licence_query(query_string);
500 while(licence_query.next())
501 {
502 project_number = licence_query.value(0).toUInt();
503 }
504
505 // Get the Next Number
506 project_number++;
507 project_info.ProjectDesc.ProjectIndex = project_number;
508
509 // Create the Project Identifier
510 QString project_identifier = ui->ProjectPrefix->currentText() + "-" + QStringLiteral("%1").arg(project_number, ui->ProjectNumberSize->value(), 10, QLatin1Char('0'));
511 ui->ProjectIdent->setText(project_identifier);
512
513 // Return the Project Number
514 return(project_number);
515}
PROJECT_INFORMATION project_info
Structure to hold Project Information.

References project_info, and ui.

Referenced by InsertNewProjectInDatabase().

Here is the caller graph for this function:

◆ DoEditAbort

void ProjectDocManager::DoEditAbort ( void )
privateslot

Abort Editing without Saving.

Definition at line 285 of file projectdocmanager.cpp.

286{
287 emit SendClear();
288 SetEditButtons(false);
289 ui->EnableProjectEdit->setChecked(false);
290 ui->FullDescription->clear();
291 ui->PrimaryTool->clear();
292 ui->DepartureURL->clear();
293 ui->ExecutableName->clear();
294 ui->ExecutableName->setReadOnly(true);
295 ui->CreateNewProject->setEnabled(true);
296 ui->EnableStatusEditing->setCheckState(Qt::Unchecked);
297 EnableUserInterface(false);
298 LockProject(project_info.ProjectDesc.ProjectIndex, false);
299 project_info.ProjectDesc.ProjectIndex = 0;
300}
bool LockProject(int ProjectIndex, bool LockState)
Lock/Unlock Project in the Database.
void SendClear(void)
Send a Project Clear Command.
void SetEditButtons(bool State)
Enable/Disable Edit buttons.
void EnableUserInterface(bool State)
Enable the Project User Interface.

References EnableUserInterface(), LockProject(), project_info, SendClear(), SetEditButtons(), and ui.

Referenced by DoEditSave(), and ProjectDocManager().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoEditSave

void ProjectDocManager::DoEditSave ( void )
privateslot

Abort Editing after Saving.

Definition at line 302 of file projectdocmanager.cpp.

303{
304 DoEditAbort();
305 LogAdd(LOG_INFO, MODE_DATABASE, "Project Updated to Database.");
306}
@ LOG_INFO
Definition logger.h:55
@ MODE_DATABASE
Definition logger.h:35

References DoEditAbort(), LOG_INFO, LogAdd(), and MODE_DATABASE.

Referenced by InsertNewProjectInDatabase(), and UpdateProjectToDatabase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnableUserInterface

void ProjectDocManager::EnableUserInterface ( bool State)
privateslot

Enable the Project User Interface.

Definition at line 323 of file projectdocmanager.cpp.

324{
325 emit SendSubstituteState(State);
326 ui->ProjectInfoGroupBox->setEnabled(State);
327 ui->ProjectOptionsGroupBox->setEnabled(State);
328}
void SendSubstituteState(bool State)
Send the Substitute Enable State.

References SendSubstituteState(), and ui.

Referenced by DoEditAbort(), ReadActivated(), and StartProject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDoxyFooter

void ProjectDocManager::GetDoxyFooter ( void )
privateslot

Get Custom Doxygen Footer.

This routine brings up a file selector for operator action

Definition at line 80 of file projectdocmanager.cpp.

81{
82 ui->DoxyFooter->setText(GetFile(ui->DoxyFooter->text(), GET_HTML_FILE));
83}
QString GetFile(QString InitialName, GET_FILE_TYPE FileType)
Read a file into a String.
@ GET_HTML_FILE

References GET_HTML_FILE, GetFile(), and ui.

Referenced by ProjectDocManager().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDoxyHeader

void ProjectDocManager::GetDoxyHeader ( void )
privateslot

Get Custom Doxygen Header.

This routine brings up a file selector for operator action

Definition at line 75 of file projectdocmanager.cpp.

76{
77 ui->DoxyHeader->setText(GetFile(ui->DoxyHeader->text(), GET_HTML_FILE));
78}

References GET_HTML_FILE, GetFile(), and ui.

Referenced by ProjectDocManager().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDoxyLogo

void ProjectDocManager::GetDoxyLogo ( void )
privateslot

Get the Doxygen Logo from known image files.

Definition at line 70 of file projectdocmanager.cpp.

71{
72 ui->DoxyProjectLogo->setText(GetFile(ui->DoxyProjectLogo->text(), GET_IMAGE_FILE));
73}
@ GET_IMAGE_FILE

References GET_IMAGE_FILE, GetFile(), and ui.

Referenced by ProjectDocManager().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDoxyStylesheet

void ProjectDocManager::GetDoxyStylesheet ( void )
privateslot

Get Custom Doxygen Stylesheet.

This routine brings up a file selector for operator action

Definition at line 85 of file projectdocmanager.cpp.

86{
87 ui->DoxyStylesheet->setText(GetFile(ui->DoxyStylesheet->text(), GET_CSS_FILE));
88}
@ GET_CSS_FILE

References GET_CSS_FILE, GetFile(), and ui.

Referenced by ProjectDocManager().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetFile()

QString ProjectDocManager::GetFile ( QString InitialName,
GET_FILE_TYPE FileType )
private

Read a file into a String.

Parameters
InitialNameName of the File to read
Typeof File for which to filter
Returns
Contents of the file in a string

This routine returns an empty string if the read failed.

Definition at line 90 of file projectdocmanager.cpp.

91{
92 QString filter_string;
93 QString prompt_name;
94
95 switch(FileType)
96 {
97 case GET_IMAGE_FILE:
98 filter_string = "*.png *.xpm *.jpg *.svg";
99 prompt_name = "Image";
100 break;
101
102 case GET_HTML_FILE:
103 filter_string = "*.htm *.html";
104 prompt_name = "HTML";
105 break;
106
107 case GET_CSS_FILE:
108 filter_string = "*.css";
109 prompt_name = "CSS";
110 break;
111 }
112
113 QString file_name = QFileDialog::getOpenFileName(nullptr, prompt_name, InitialName, filter_string);
114 if (file_name == "")file_name = InitialName;
115 return(file_name);
116}

References GET_CSS_FILE, GET_HTML_FILE, and GET_IMAGE_FILE.

Referenced by GetDoxyFooter(), GetDoxyHeader(), GetDoxyLogo(), and GetDoxyStylesheet().

Here is the caller graph for this function:

◆ GetLicenceIndex()

int ProjectDocManager::GetLicenceIndex ( QString LicenceName)
private

Get the Licence Database Index from the Licence Name.

Parameters
LicenceNameShort Name of the Licence
Returns
Licence Table Index Number

Definition at line 517 of file projectdocmanager.cpp.

518{
519 uint licence_index = -1;
520
521 // Find the Licence Index of the Software Licence
522 QString query_string = QString("select licence_index from licence where short_name = '%1'").arg(LicenceName);
523 QSqlDatabase db = QSqlDatabase::database();
524
525 QSqlQuery licence_query(query_string);
526 while(licence_query.next())
527 {
528 licence_index = licence_query.value(0).toInt();
529 }
530 return(licence_index);
531}

Referenced by InsertNewProjectInDatabase(), and UpdateProjectToDatabase().

Here is the caller graph for this function:

◆ InitiasliseGitDirectory()

bool ProjectDocManager::InitiasliseGitDirectory ( QString SrcFilePath)
private

Initialise the Project's Git Directory.

Parameters
SrcFilePathSource Directory
Returns
Success (true) or Failure (false)

Definition at line 736 of file projectdocmanager.cpp.

737{
738 bool result = false;
739
740 // Move to the default .git Directory
741 QDir dir;
742 dir.cd(SrcFilePath);
743
744 // Output the git Command
745 QProcess git;
746 QStringList Arg;
747 Arg << "init" << SrcFilePath << "--template=/usr/share/git-core/templates";
748
749 git.start( "git", QStringList() << Arg );
750 if (!git.waitForStarted())
751 {
752 LogAdd( LOG_ERROR, MODE_THREAD, "git did NOT Start." );
753 }
754 else
755 {
756 LogAdd( LOG_DEBUG, MODE_THREAD, QString( "Started git Process with \"init\"" ) );
757 if (git.waitForFinished())
758 {
759 LogAdd( LOG_DEBUG, MODE_THREAD, "git finished on time." );
760 // Commit the git Entries
761 Arg.clear();
762 Arg << "commit -m \"Initial creation by ProjectManager.\"";
763 git.start( "git", QStringList() << Arg );
764 if (!git.waitForStarted())
765 {
766 LogAdd( LOG_ERROR, MODE_THREAD, "git did NOT Start on time." );
767 }
768 else
769 {
770 LogAdd( LOG_DEBUG, MODE_THREAD, QString( "Started git Process with \"commit\"") );
771 if (git.waitForFinished())
772 {
773 LogAdd( LOG_DEBUG, MODE_THREAD, "git finished on time." );
774 result = true;
775 }
776 else
777 {
778 LogAdd( LOG_ERROR, MODE_THREAD, "git did NOT finish on time." );
779 }
780
781 }
782 }
783 else
784 {
785 LogAdd( LOG_ERROR, MODE_THREAD, "git did NOT finish on time." );
786 }
787 }
788 return(result);
789}

References LOG_DEBUG, LOG_ERROR, LogAdd(), and MODE_THREAD.

Referenced by InsertNewProjectInDatabase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InsertNewProjectInDatabase()

bool ProjectDocManager::InsertNewProjectInDatabase ( void )
private

Inserts new project into the database.

Returns
Success (true) or Failure (false)

Definition at line 533 of file projectdocmanager.cpp.

534{
535 int project_number = CreateProjectId();
536
537 ui->ProjectStatusDate->setDateTime(QDateTime::currentDateTime());
538
539 QString insert_command_template = QString("INSERT INTO project(%1) VALUES (%2);");
540
541 QString storage_location;
542 if(ui->LocalDevDirectory->text().isEmpty()) storage_location = ui->ProjectIdent->text(); else storage_location = ui->LocalDevDirectory->text() + "/" + ui->ProjectIdent->text();
543
544 QString field_string = QString("project_index, project_name, major_version, minor_version, revision, brief_description, dev_family, compiler_family, project_status, project_lock, ") +
545 QString("compiler_type, status_date, doc_licence, software_licence, hardware_licence, project_contact, full_description, project_directory, icon_filename, project_options, ") +
546 QString("project_ident, doxy_project_logo_filename, doxy_html_header_filename, doxy_html_footer_filename, doxy_extra_stylesheet_filename, assoc_group, project_queued, target_family, departure_url, executable_directory, ") +
547 QString("executable_name, dot_image_type, doxy_tab_size");
548
549 QString value_string = QString::number(project_number) + ",'" + // Project Index
550 ui->ProjectName->text() + "'," + // Project Name
551 QString::number(ui->MajorVersion->value()) + "," + // Major Version
552 QString::number(ui->MinorVersion->value()) + "," + // Minor Version
553 QString::number(ui->Revision->value()) + ",'" + // Revision
554 ui->BriefDescription->text() + "'," + // Brief Description
555 QString::number(ui->DevelopmentFamily->currentIndex() + 1) + "," + // Development Family
556 QString::number(ui->LanguageFamily->currentIndex() + 1) + "," + // Compiler Family
557 QString::number(ui->ProjectStatus->currentIndex() + 1) + "," + // Project Status
558 "false," + // Project Lock
559
560 QString::number(ui->PrimaryTool->currentIndex() + 1) + ",'" + // Compiler Type
561 ui->ProjectStatusDate->dateTime().toString("yyyy-MM-dd hh:mm:ss.zzz") + "'," + // Status DateTime
562 QString::number(GetLicenceIndex(ui->DocumentationLicenceList->currentText())) + "," + // Documentation Licence
563 QString::number(GetLicenceIndex(ui->SoftwareLicenceList->currentText())) + "," + // Software Licence
564 QString::number(GetLicenceIndex(ui->HardwareLicenceList->currentText())) + "," + // Hardware Licence
565 QString::number(ui->ProjectContactList->currentIndex() + 1) +" ,'" + // Project Contact
566 ui->FullDescription->document()->toPlainText() + "','" + // Project Full Description
567 storage_location + "','" + // Project Storage Location
568 ui->ProjectIcon->text() + "'," + // Project Icon Name
569 QString::number(project_opts_manager->WriteOptionState()) + ",'" + // Project Options
570
571 ui->ProjectIdent->text() + "','" + // Project Identification String
572 ui->DoxyProjectLogo->text() + "','" + // Doxygen Project Logo Filename
573 ui->DoxyHeader->text() + "','" + // Doxygen Project header Filemame
574 ui->DoxyFooter->text() + "','" + // Doxygen Project Footer Filename
575 ui->DoxyStylesheet->text() + "'," + // Doxygen Extra Stylesheet Filename
576 QString::number(ui->InAssociationList->currentIndex()) + "," + // The Group Associated with the Project
577 "false,'" + // Project Queued
578 QString::number(ui->TargetFamily->currentIndex() + 1) + "', '" + // Target Family
579 ui->DepartureURL->text() + "', '" + // Departure (Return) URL
580 ui->ExecutableDirectory->text() + "', '" + // Executable's Directory
581
582 ui->ExecutableName->text() + "', '" + // Name of the Executable
583 ui->DotImageType->currentText() + "', " + // Dot Image Type
584 QString::number(ui->DoxyTabSize->value()); // Doxygen Tab Size
585
586 QString insert_command_string = insert_command_template.arg(field_string).arg(value_string);
587
588 QSqlQuery insert_query;
589 bool insert_result = insert_query.exec(insert_command_string);
590
591 if (insert_result)
592 {
593 LogAdd(LOG_DEBUG, MODE_DATABASE, QString("Project %1 has been inserted into database.").arg(ui->ProjectName->text()) );
594
595 // Create the Basic Project Directory
596 QString source_directory = ui->SharedTemplateDir->text() + "/project_template";
597 if (CopyRecursively(source_directory, storage_location))
598 {
599 // Add the Source Directory
600
601 LogAdd(LOG_DEBUG, MODE_DATABASE, QString("Project directory %1 has been created.").arg(source_directory) );
602
603 // Add any Development Family Information to the Project Files
604 source_directory = ui->SharedTemplateDir->text() + "/family_template/" + ui->DevelopmentFamily->currentText();
605 if (CopyRecursively(source_directory, storage_location))
606 {
607 LogAdd(LOG_DEBUG, MODE_DATABASE, QString("Added %1 information to %2.").arg(ui->DevelopmentFamily->currentText()).arg(source_directory) );
608 }
609 else
610 {
611 LogAdd(LOG_ERROR, MODE_DATABASE, QString("Failed to add %1 information to %2.").arg(ui->DevelopmentFamily->currentText()).arg(source_directory) );
612 }
613
614 // Add it Any Development Language Specific Files
615 source_directory = ui->SharedTemplateDir->text() + "/language_template/" + ui->LanguageFamily->currentText();
616 if (CopyRecursively(source_directory, storage_location))
617 {
618 LogAdd(LOG_DEBUG, MODE_DATABASE, QString("Added %1 information to %2.").arg(ui->LanguageFamily->currentText()).arg(source_directory) );
619 InitiasliseGitDirectory(storage_location);
620 }
621 else
622 {
623 LogAdd(LOG_ERROR, MODE_DATABASE, QString("Failed to add %1 information to %2.").arg(ui->LanguageFamily->currentText()).arg(source_directory) );
624 }
625
626 // Add Any Tool Specific Files
627 source_directory = ui->SharedTemplateDir->text() + "/tool_template/" + ui->PrimaryTool->currentText();
628 if (CopyRecursively(source_directory, storage_location))
629 {
630 LogAdd(LOG_DEBUG, MODE_DATABASE, QString("Added %1 information to %2.").arg(ui->LanguageFamily->currentText()).arg(source_directory) );
631 InitiasliseGitDirectory(storage_location);
632 }
633 else
634 {
635 LogAdd(LOG_ERROR, MODE_DATABASE, QString("Failed to add %1 information to %2.").arg(ui->LanguageFamily->currentText()).arg(source_directory) );
636 }
637
638 // Create the Directory for the Source Code
639 QString code_directory = storage_location + "/source/" + ui->ExecutableName->text();
640 QDir dir;
641 if (!dir.mkdir(code_directory))
642 {
643 LogAdd(LOG_ERROR, MODE_FILE, QString("Could NOT create Code Directory %1").arg(code_directory));
644 }
645 else
646 {
647 LogAdd(LOG_DEBUG, MODE_FILE, QString("Created Code Directory %1").arg(code_directory));
648
649 // Copy in the AutoSrc Files.
650 QString autosrc_template = ui->SharedTemplateDir->text() + "/autosrc_template/" + ui->LanguageFamily->currentText();
651 if (CopyRecursively(autosrc_template, storage_location + "/autosrc/"))
652 {
653 LogAdd(LOG_DEBUG, MODE_FILE, QString("Transferred Auto Source Files to %1").arg(code_directory));
654 InitiasliseGitDirectory(storage_location);
655 }
656 else
657 {
658 LogAdd(LOG_ERROR, MODE_FILE, QString("Could NOT transfer Auto Source Files to %1").arg(code_directory));
659 }
660 }
661 }
662 else
663 {
664 LogAdd(LOG_ERROR, MODE_DATABASE, QString("Project directory %1 has NOT been created.").arg(source_directory) );
665 }
666 DoEditSave();
667 }
668 else
669 {
670 ShowMessage(insert_command_string);
671 LogAdd(LOG_ERROR, MODE_DATABASE, QString("Project %1 has NOT been inserted into database.").arg(ui->ProjectName->text()) );
672 }
673 return(insert_result);
674}
bool InitiasliseGitDirectory(QString SrcFilePath)
Initialise the Project's Git Directory.
int CreateProjectId(void)
Create the next unused project number.
void ShowMessage(QString Message)
Shows Message in popup window.
int GetLicenceIndex(QString LicenceName)
Get the Licence Database Index from the Licence Name.
void DoEditSave(void)
Abort Editing after Saving.
uint WriteOptionState(void)
Get the Options Encoded from User Interface.
ProjectOptionsManager * project_opts_manager

References CopyRecursively(), CreateProjectId(), DoEditSave(), GetLicenceIndex(), InitiasliseGitDirectory(), LOG_DEBUG, LOG_ERROR, LogAdd(), MODE_DATABASE, MODE_FILE, project_opts_manager, ShowMessage(), and ui.

Referenced by SaveProject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsSaveAvailable()

bool ProjectDocManager::IsSaveAvailable ( void )
private

Check if Project Save is Enabled.

Returns
Yes (true) or No (false)

Definition at line 682 of file projectdocmanager.cpp.

683{
684 return (!ui->ProjectName->text().isEmpty() &&
685 !ui->BriefDescription->text().isEmpty()) &&
686 !ui->FullDescription->toPlainText().isEmpty() &&
687 !ui->DepartureURL->text().isEmpty() &&
688 !ui->ExecutableName->text().isEmpty();
689}

References ui.

Referenced by SaveProject().

Here is the caller graph for this function:

◆ LoadProjectFromDatabase()

void ProjectDocManager::LoadProjectFromDatabase ( int Item)
private

Load Project Information from Database.

Parameters
ItemProject to be loaded from Database

Definition at line 231 of file projectdocmanager.cpp.

232{
233 // Clear the Project Display
234 emit SendClear();
235
236 // request the Project Data from the Database
237 QSqlQuery read_project_query(QString("select * from project where project_index = %1").arg(QString::number(Item)));
238 int row_counter = 0;
239 while ( read_project_query.next() )
240 {
241 project_info.ProjectDesc.ProjectIndex = read_project_query.value(PT_PROJECT_INDEX).toInt();
242 project_info.ProjectDesc.ProjectName = read_project_query.value(PT_PROJECT_NAME).toString();
243 project_info.VersionInfo.MajorVersion = read_project_query.value(PT_MAJOR_VERSION).toInt();
244 project_info.VersionInfo.MinorVersion = read_project_query.value(PT_MINOR_VERSION).toInt();
245 project_info.VersionInfo.Revision = read_project_query.value(PT_REVISION).toInt();
246 project_info.ProjectDesc.BriefDescription = read_project_query.value(PT_BRIEF_DESCRIPTION).toString();
247 project_info.DevFamilyInfo.DevFamilyIndex = read_project_query.value(PT_DEV_FAMILY).toInt();
248 project_info.LangFamilyInfo.LangFamilyIndex = read_project_query.value(PT_COMPILER_FAMILY).toInt();
249 project_info.StatusInfo.StatusIndex = read_project_query.value(PT_PROJECT_STATUS).toInt();
250 project_info.ProjectLock = read_project_query.value(PT_PROJECT_LOCK).toBool();
251 project_info.CompFamilyInfo.CompFamilyIndex = read_project_query.value(PT_COMPILER_TYPE).toInt();
252 project_info.StatusInfo.StatusDateTime = read_project_query.value(PT_STATUS_DATE).toDateTime().toLocalTime();
253 project_info.DocLicence.LicenceIndex = read_project_query.value(PT_DOC_LICENCE).toInt();
254 project_info.SoftwareLicence.LicenceIndex = read_project_query.value(PT_SOFTWARE_LICENCE).toInt();
255 project_info.HardwareLicence.LicenceIndex = read_project_query.value(PT_HARDWARE_LICENCE).toInt();
256 project_info.ProjectContact = read_project_query.value(PT_PROJECT_CONTACT).toInt();
257 project_info.ProjectDesc.FullDescription = read_project_query.value(PT_FULL_DESCRIPTION).toString();
258 project_info.ProgramInformation.LocalDevelopmentDirectory = read_project_query.value(PT_PROJECT_DIRECTORY).toString();
259 project_info.ProjectDesc.ProjectIcon = read_project_query.value(PT_ICON_FILENAME).toString();
260 project_info.ProjectDesc.ProjectOptions = read_project_query.value(PT_PROJECT_OPTIONS).toInt();
261 project_info.ProjectDesc.ProjectIdent = read_project_query.value(PT_PROJECT_IDENT).toString();
262 project_info.DoxyOptions.DoxyLogoFilename = read_project_query.value(PT_DOXY_PROJECT_LOGO_FILENAME).toString();
263 project_info.DoxyOptions.DoxyHtmlHeaderFilename = read_project_query.value(PT_DOXY_HTML_HEADER_FILENAME).toString();
264 project_info.DoxyOptions.DoxyHtmlFooterFilename = read_project_query.value(PT_DOXY_HTML_FOOTER_FILENAME).toString();
265 project_info.DoxyOptions.DoxyExtraStylesheetFilename = read_project_query.value(PT_DOXY_EXTRA_STYLESHEET_FILENAME).toString();
266 project_info.InAssocInfo.InAssociationIndex = read_project_query.value(PT_ASSOC_GROUP).toInt();
267 ui->InAssociationList->setCurrentIndex(project_info.InAssocInfo.InAssociationIndex);
268 project_info.ProjectQueued = read_project_query.value(PT_PROJECT_QUEUED).toBool();
269 project_info.TargetFamilyInfo.TargetFamilyIndex = read_project_query.value(PT_TARGET_FAMILY).toInt();
270 project_info.ProjectDesc.DepartureURL = read_project_query.value(PT_DEPARTURE_URL).toString();
271 project_info.ProjectDesc.ExeDirectory = read_project_query.value(PT_EXECUTABLE_DIRECTORY).toString();
272 project_info.ProjectDesc.ExeName = read_project_query.value(PT_EXECUTABLE_NAME).toString();
273 row_counter++;
274 }
275 if (row_counter == 1)
276 {
278 ui->FullDescription->setPlainText(project_info.ProjectDesc.FullDescription);
279 ui->InAssociationList->setCurrentIndex(project_info.InAssocInfo.InAssociationIndex);
280 ui->SelectProjectList->setEnabled(false);
281 }
282 else LogAdd(LOG_ERROR, MODE_DATABASE, QString("Unable to read Project Information for Item %1").arg(QString::number(Item)));
283}
void SendProjectId(PROJECT_INFORMATION *ProjectId)
Send out Project Information for Updates.
@ PT_SOFTWARE_LICENCE
@ PT_STATUS_DATE
@ PT_PROJECT_QUEUED
@ PT_ICON_FILENAME
@ PT_COMPILER_TYPE
@ PT_PROJECT_INDEX
@ PT_DOC_LICENCE
@ PT_REVISION
@ PT_DOXY_HTML_HEADER_FILENAME
@ PT_PROJECT_NAME
@ PT_DEV_FAMILY
@ PT_PROJECT_IDENT
@ PT_DOXY_EXTRA_STYLESHEET_FILENAME
@ PT_EXECUTABLE_NAME
@ PT_PROJECT_CONTACT
@ PT_MAJOR_VERSION
@ PT_PROJECT_OPTIONS
@ PT_ASSOC_GROUP
@ PT_PROJECT_LOCK
@ PT_DEPARTURE_URL
@ PT_MINOR_VERSION
@ PT_EXECUTABLE_DIRECTORY
@ PT_DOXY_HTML_FOOTER_FILENAME
@ PT_PROJECT_DIRECTORY
@ PT_COMPILER_FAMILY
@ PT_BRIEF_DESCRIPTION
@ PT_PROJECT_STATUS
@ PT_HARDWARE_LICENCE
@ PT_DOXY_PROJECT_LOGO_FILENAME
@ PT_TARGET_FAMILY
@ PT_FULL_DESCRIPTION

References LOG_ERROR, LogAdd(), MODE_DATABASE, project_info, PT_ASSOC_GROUP, PT_BRIEF_DESCRIPTION, PT_COMPILER_FAMILY, PT_COMPILER_TYPE, PT_DEPARTURE_URL, PT_DEV_FAMILY, PT_DOC_LICENCE, PT_DOXY_EXTRA_STYLESHEET_FILENAME, PT_DOXY_HTML_FOOTER_FILENAME, PT_DOXY_HTML_HEADER_FILENAME, PT_DOXY_PROJECT_LOGO_FILENAME, PT_EXECUTABLE_DIRECTORY, PT_EXECUTABLE_NAME, PT_FULL_DESCRIPTION, PT_HARDWARE_LICENCE, PT_ICON_FILENAME, PT_MAJOR_VERSION, PT_MINOR_VERSION, PT_PROJECT_CONTACT, PT_PROJECT_DIRECTORY, PT_PROJECT_IDENT, PT_PROJECT_INDEX, PT_PROJECT_LOCK, PT_PROJECT_NAME, PT_PROJECT_OPTIONS, PT_PROJECT_QUEUED, PT_PROJECT_STATUS, PT_REVISION, PT_SOFTWARE_LICENCE, PT_STATUS_DATE, PT_TARGET_FAMILY, SendClear(), SendProjectId(), and ui.

Referenced by ReadActivated().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadProjectList

void ProjectDocManager::LoadProjectList ( void )
slot

Load Select Project List from Database.

This routine will load the list of projects that can be edited. It will exclude all projects that are flagged as locked in the database to prevent editing and documentation generation conflicts.

Definition at line 118 of file projectdocmanager.cpp.

119{
120 // Clear the Current List
121 ui->SelectProjectList->clear();
122 ui->SelectProjectList->clearEditText();
123
124 // Get the Project Information From the Database
125 QSqlQuery project_list_query("select project_index, project_name, project_lock from project where project_index > 1 order by project_index");
126
127 // List out all the Projects
128 // Step through the Results
129 int row_index = 0;
130 while ( project_list_query.next() )
131 {
132 int project_number = project_list_query.value(0).toInt();
133 QString project_name = project_list_query.value(1).toString();
134 bool project_lock = project_list_query.value(2).toBool();
135 QString list_entry = ui->ProjectPrefix->currentText() + "-" + QString::number(project_number).rightJustified(ui->ProjectNumberSize->value(), '0') + " : " + project_name;
136 if (!project_lock)
137 {
138 ui->SelectProjectList->addItem(list_entry, project_number);
139 row_index++;
140 }
141 else
142 {
143 LogAdd(LOG_INFO, MODE_DATABASE, list_entry + " was not included in list as it is LOCKED.");
144 }
145 }
146 if (row_index == 0)
147 {
148 LogAdd(LOG_INFO, MODE_DATABASE, "No Projects were available for listing.");
149 }
150 else
151 {
152 LogAdd(LOG_DEBUG, MODE_DATABASE, QString("%1 Projects are available for listing.").arg(QString::number(row_index)));
153 }
154};

References LOG_DEBUG, LOG_INFO, LogAdd(), MODE_DATABASE, and ui.

Referenced by SetEditState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadSubstituteTable

void ProjectDocManager::LoadSubstituteTable ( )
signal

Load System Substituitions.

Referenced by StartProject().

Here is the caller graph for this function:

◆ LockProject()

bool ProjectDocManager::LockProject ( int ProjectIndex,
bool LockState )
private

Lock/Unlock Project in the Database.

Parameters
ProjectIndexProject's Database Index
LockStateLock (true) or Unlock (false)
Returns
Lock Updated (true) or Lock Update Failed (false)

Definition at line 828 of file projectdocmanager.cpp.

829{
830 bool result = false;
831
832 QString update_command_string = QString("UPDATE project SET project_lock = ") + QVariant(LockState).toString() + " "
833 + "where project_index = " + QString::number(ProjectIndex);
834
835 QSqlQuery update_query;
836 if (update_query.exec(update_command_string))
837 {
838 LogAdd(LOG_DEBUG, MODE_DATABASE, QString("Project Index: %1 Lock Updated.").arg(QString::number(ProjectIndex)) );
839 if (LockState == true)current_locked_project = ProjectIndex; else current_locked_project = 0;
840 result = true;
841 }
842 else
843 {
844 LogAdd(LOG_ERROR, MODE_DATABASE, QString("Project Index: %1 Lock NOT Updated.").arg(QString::number(ProjectIndex)) );
845 }
846 return(result);
847}

References current_locked_project, LOG_DEBUG, LOG_ERROR, LogAdd(), and MODE_DATABASE.

Referenced by DoEditAbort().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LockSubsButtons()

void ProjectDocManager::LockSubsButtons ( bool State)
private

Lock/unlock the Substitution Buttons.

Parameters
StateOn (true) or Off (false)

Definition at line 676 of file projectdocmanager.cpp.

677{
678 ui->SaveSubstituitions->setEnabled(!State);
679 ui->ReloadSubstituitions->setEnabled(!State);
680}

References ui.

Referenced by StartProject().

Here is the caller graph for this function:

◆ LogAdd()

void ProjectDocManager::LogAdd ( LOGGING_SEVERITY Severity,
LOGGING_MODE Mode,
const QString Message )
private

Send Message to the Log.

Parameters
SeveritySeverity of the Log Message
ModeWhich part of the program does the message relate to
MessageText message to be added to the Log

Definition at line 192 of file projectdocmanager.cpp.

193{
194 REMOTE_LOG_ENTRY log_entry;
195 log_entry.Severity = Severity;
196 log_entry.Mode = Mode;
197 log_entry.Message = Message;
198 emit SendLogEntry(log_entry);
199}
void SendLogEntry(REMOTE_LOG_ENTRY LogEntry)
Send Log Entry via the Signal-Slot Method.
LOGGING_MODE Mode
Definition logger.h:61
QString Message
Definition logger.h:63
LOGGING_SEVERITY Severity
Definition logger.h:62

References REMOTE_LOG_ENTRY::Message, REMOTE_LOG_ENTRY::Mode, SendLogEntry(), and REMOTE_LOG_ENTRY::Severity.

Referenced by CommitGitDirectory(), CopyRecursively(), DoEditSave(), InitiasliseGitDirectory(), InsertNewProjectInDatabase(), LoadProjectFromDatabase(), LoadProjectList(), LockProject(), ReadActivated(), and UpdateProjectToDatabase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadActivated

void ProjectDocManager::ReadActivated ( int Item)
privateslot

Load a Project & Enable editing.

Parameters
ItemProject Database Index

Definition at line 201 of file projectdocmanager.cpp.

202{
203 QString item_text = ui->SelectProjectList->itemText(Item);
204 LogAdd(LOG_DEBUG, MODE_OPERATOR, QString("Project %1 selected for editing.").arg(item_text));
205 uint project_index = ui->SelectProjectList->itemData(Item).toInt();
206 if (! read_project_info->SetProjectStatus(project_index, true, false))
207 {
208 ShowMessage(QString("Unable to Reserve Project \"%1\" for Editing").arg(item_text));
209 }
210 else
211 {
212 LoadProjectFromDatabase(project_index);
214 SetEditButtons(true);
215 }
216}
void LoadProjectFromDatabase(int Item)
Load Project Information from Database.
@ MODE_OPERATOR
Definition logger.h:34

References EnableUserInterface(), LoadProjectFromDatabase(), LOG_DEBUG, LogAdd(), MODE_OPERATOR, read_project_info, SetEditButtons(), ShowMessage(), and ui.

Referenced by ProjectDocManager().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReceiveProjectId

void ProjectDocManager::ReceiveProjectId ( PROJECT_INFORMATION ProjectId)
slot

Receive the Project's Information for processing.

Parameters
ProjectIdThe Project, Information Structure

Definition at line 218 of file projectdocmanager.cpp.

219{
220 project_info = ProjectId;
221 //emit SendProjectId(&project_info);
222}

References project_info.

◆ SaveLocalSubstitutes

void ProjectDocManager::SaveLocalSubstitutes ( void )
signal

Send a Trigger to Load.

Referenced by UpdateProjectToDatabase().

Here is the caller graph for this function:

◆ SaveProject

void ProjectDocManager::SaveProject ( void )
slot

Save a new project to the database.

Definition at line 330 of file projectdocmanager.cpp.

331{
332 if (project_info.ProjectDesc.ProjectIndex != 0)
333 {
335 }
336 else
337 {
338 // Check if the Data is There to Save a Project
339 if (IsSaveAvailable())
340 {
341 // Write the Data to the Project Table
342 ui->ProjectStatusDate->setDateTime(QDateTime::currentDateTime());
344 }
345 else
346 {
347 QMessageBox msgBox;
348 msgBox.setText("Enter all fields with red prompts");
349 msgBox.exec();
350 }
351 }
352}
void UpdateProjectToDatabase(void)
Updates an Existing Project.
bool IsSaveAvailable(void)
Check if Project Save is Enabled.
bool InsertNewProjectInDatabase(void)
Inserts new project into the database.

References InsertNewProjectInDatabase(), IsSaveAvailable(), project_info, ui, and UpdateProjectToDatabase().

Here is the call graph for this function:

◆ SendClear

void ProjectDocManager::SendClear ( void )
signal

Send a Project Clear Command.

Referenced by DoEditAbort(), LoadProjectFromDatabase(), SetEditState(), and StartProject().

Here is the caller graph for this function:

◆ SendDevelopmentFamily

void ProjectDocManager::SendDevelopmentFamily ( DEVELOPMENT_FAMILY DevFamily)
signal

Send Development Family Information Structure for Update.

Parameters
DevFamilyInformation about Development families

◆ SendLicenceState

void ProjectDocManager::SendLicenceState ( LICENCE_STATE ProjectLicences)
signal

Send out the current Licence States.

Parameters
ProjectLicencesProject Licences structure for update

◆ SendLogEntry

void ProjectDocManager::SendLogEntry ( REMOTE_LOG_ENTRY LogEntry)
signal

Send Log Entry via the Signal-Slot Method.

Parameters
LogEntryStructure holding the Log Entry parameters

Referenced by LogAdd().

Here is the caller graph for this function:

◆ SendProjectId

void ProjectDocManager::SendProjectId ( PROJECT_INFORMATION * ProjectId)
signal

Send out Project Information for Updates.

Parameters
ProjectIdProject Information Structure

Referenced by LoadProjectFromDatabase().

Here is the caller graph for this function:

◆ SendSubstituteState

void ProjectDocManager::SendSubstituteState ( bool State)
signal

Send the Substitute Enable State.

Parameters
StateEnabled (true) or Disabled (false)

Referenced by EnableUserInterface().

Here is the caller graph for this function:

◆ SendVersion

void ProjectDocManager::SendVersion ( REMOTE_VERSION_ENTRY VersionInfo)
signal

Send out the Project Version Information.

Parameters
VersionInfoProject Version Information

◆ SetDocAccess

void ProjectDocManager::SetDocAccess ( int State)
privateslot

Enable/Disable Document Access Restrictions.

Parameters
StateEnabled (true) or Disabled (false)

Definition at line 48 of file projectdocmanager.cpp.

49{
50 bool state = (bool)State;
51
52 ui->OnlyInfoPage->setEnabled(state);
53 ui->LimitToAssoc->setEnabled(state);
54}

References ui.

Referenced by ProjectDocManager().

Here is the caller graph for this function:

◆ SetDonationsWelcome

void ProjectDocManager::SetDonationsWelcome ( int State)
privateslot

Enable/Disable Donation Options.

Parameters
StateEnabled (true) or Disabled (false)

Definition at line 56 of file projectdocmanager.cpp.

57{
58 bool state = (bool)State;
59
60 ui->OfferPaypal->setEnabled(state);
61}

References ui.

Referenced by ProjectDocManager().

Here is the caller graph for this function:

◆ SetDoxyOptions

void ProjectDocManager::SetDoxyOptions ( int State)
privateslot

Enable/Disable Custom Doxy Options.

Parameters
StateEnabled (true) or Disabled (false)

Definition at line 63 of file projectdocmanager.cpp.

64{
65 bool state = (bool)State;
66
67 ui->DoxygenOptions->setEnabled(state);
68}

References ui.

Referenced by ProjectDocManager().

Here is the caller graph for this function:

◆ SetEditButtons()

void ProjectDocManager::SetEditButtons ( bool State)
private

Enable/Disable Edit buttons.

Parameters
StateEnable or Disable Flag

Definition at line 308 of file projectdocmanager.cpp.

309{
310 ui->SaveProject->setEnabled(State);
311 ui->AbortNewProject->setEnabled(State);
312 ui->EnableProjectEdit->setEnabled(!State);
313 if (State)
314 {
315 ui->ExecutableName->setReadOnly(!ui->ExecutableName->text().isEmpty());
316 }
317 else
318 {
319 ui->ExecutableName->setReadOnly(true);
320 }
321}

References ui.

Referenced by DoEditAbort(), ReadActivated(), and StartProject().

Here is the caller graph for this function:

◆ SetEditState

void ProjectDocManager::SetEditState ( int State)
privateslot

Enable/Disable editing.

Parameters
StateEnable (true) or Disable (false)

Definition at line 156 of file projectdocmanager.cpp.

157{
158 bool state = (bool)State;
159 ui->SelectProjectList->setEnabled(!state);
160 ui->CreateNewProject->setEnabled(!State);
161 ui->SelectProjectList->setEnabled(!State);
162 ui->ExecutableName->setReadOnly(!ui->ExecutableName->text().isEmpty());
163 if (state)
164 {
166 ui->SelectProjectList->setEnabled(state);
167 }
168 else
169 {
170 ui->SelectProjectList->clear();
171 ui->SaveProject->setEnabled(false);
172 ui->AbortNewProject->setEnabled(false);
173 emit SendClear();
175 }
176}
void LoadProjectList()
Load Select Project List from Database.

References current_locked_project, LoadProjectList(), read_project_info, SendClear(), and ui.

Referenced by ProjectDocManager().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowMessage()

void ProjectDocManager::ShowMessage ( QString Message)
private

Shows Message in popup window.

Parameters
MessageMessage to be displayed

Definition at line 224 of file projectdocmanager.cpp.

225{
226 QMessageBox message_box;
227 message_box.setText(Message);
228 message_box.exec();
229}

Referenced by InsertNewProjectInDatabase(), ReadActivated(), and UpdateProjectToDatabase().

Here is the caller graph for this function:

◆ StartProject

void ProjectDocManager::StartProject ( void )
privateslot

Enable the Project User Interface for editing.

Definition at line 178 of file projectdocmanager.cpp.

179{
181 emit LoadSubstituteTable();
182 SetEditButtons(true);
183 ui->ExecutableName->setReadOnly(false);
184 ui->SelectProjectList->clearEditText();
185 ui->SelectProjectList->setEnabled(false);
186 ui->CreateNewProject->setEnabled(false);
187 project_info.ProjectDesc.ProjectIndex = 0;
188 emit SendClear();
189 LockSubsButtons(true);
190}
void LoadSubstituteTable()
Load System Substituitions.
void LockSubsButtons(bool State)
Lock/unlock the Substitution Buttons.

References EnableUserInterface(), LoadSubstituteTable(), LockSubsButtons(), project_info, SendClear(), SetEditButtons(), and ui.

Referenced by ProjectDocManager().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateProjectToDatabase()

void ProjectDocManager::UpdateProjectToDatabase ( void )
private

Updates an Existing Project.

Definition at line 354 of file projectdocmanager.cpp.

355{
357
358 QString full_description_field_string = ", full_description ";
359
360 // Create Full Description Field Update
361 if (ui->FullDescription->document()->toPlainText().isEmpty())
362 {
363 full_description_field_string += "= null";
364 }
365 else
366 {
367 full_description_field_string += QString("= \"") + ui->FullDescription->document()->toPlainText() + QString("\"");
368 }
369
370 QString project_icon_field_string = "', icon_filename ";
371
372 // Create Project icon Field Update
373 if (ui->ProjectIcon->text().isEmpty())
374 {
375 project_icon_field_string += "= null";
376 }
377 else
378 {
379 project_icon_field_string += QString("= '") + ui->ProjectIcon->text() + QString("'");
380 }
381
382 // Process the doxy Extra Stylesheet Filename
383 QString doxy_extra_field_string = ", doxy_extra_stylesheet_filename ";
384
385 // Create Project icon Field Update
386 if (project_info.DoxyOptions.DoxyExtraStylesheetFilename.isEmpty())
387 {
388 doxy_extra_field_string += "= null";
389 }
390 else
391 {
392 doxy_extra_field_string += QString("= '") + project_info.DoxyOptions.DoxyExtraStylesheetFilename + QString("'");
393 }
394
395 // Process the doxy Extra Stylesheet Filename
396 QString doxy_footer_field_string = ", doxy_html_footer_filename ";
397
398 // Create Project icon Field Update
399 if (project_info.DoxyOptions.DoxyHtmlFooterFilename.isEmpty())
400 {
401 doxy_footer_field_string += "= null";
402 }
403 else
404 {
405 doxy_footer_field_string += QString("= '") + project_info.DoxyOptions.DoxyHtmlFooterFilename + QString("'");
406 }
407
408 // Process the doxy Header Filename
409 QString doxy_header_field_string = ", doxy_html_header_filename ";
410
411 // Create Project icon Field Update
412 if (project_info.DoxyOptions.DoxyHtmlHeaderFilename.isEmpty())
413 {
414 doxy_header_field_string += "= null";
415 }
416 else
417 {
418 doxy_header_field_string += QString("= '") + project_info.DoxyOptions.DoxyHtmlHeaderFilename + QString("'");
419 }
420
421 // Process the doxy Header Filename
422 QString doxy_project_logo_field_string = "', doxy_project_logo_filename ";
423
424 // Create Project icon Field Update
425 if (project_info.DoxyOptions.DoxyLogoFilename.isEmpty())
426 {
427 doxy_project_logo_field_string += "= null";
428 }
429 else
430 {
431 doxy_project_logo_field_string += QString("= '") + project_info.DoxyOptions.DoxyLogoFilename + QString("'");
432 }
433
434 QString update_command_string = QString("UPDATE project SET ")
435 + " project_name = '" + ui->ProjectName->text()
436 + "', major_version = " + QString::number(ui->MajorVersion->value())
437 + ", minor_version = " + QString::number(ui->MinorVersion->value())
438 + ", revision = " + QString::number(ui->Revision->value())
439 + ", brief_description = '" + ui->BriefDescription->text()
440 + "', dev_family = " + QString::number(ui->DevelopmentFamily->currentIndex() + 1)
441 + ", compiler_family = " + QString::number(ui->LanguageFamily->currentIndex() + 1)
442 + ", target_family = " + QString::number(ui->TargetFamily->currentIndex() + 1)
443 + ", project_status = " + QString::number(ui->ProjectStatus->currentIndex() + 1)
444 + ", project_lock = false"
445 + ", compiler_type = " + QString::number(ui->PrimaryTool->currentIndex() + 1)
446 + ", status_date = '" + ui->ProjectStatusDate->dateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")
447 + "', doc_licence = " + QString::number(GetLicenceIndex(ui->DocumentationLicenceList->currentText()))
448 + ", software_licence = " + QString::number(GetLicenceIndex(ui->SoftwareLicenceList->currentText()))
449 + ", hardware_licence = " + QString::number(GetLicenceIndex(ui->HardwareLicenceList->currentText()))
450 + ", project_contact = " + QString::number(ui->ProjectContactList->currentIndex() + 1)
451 + full_description_field_string
452 + ", project_directory = '" + (ui->LocalDevDirectory->text() + "/" + ui->ProjectIdent->text())
453 + project_icon_field_string
454 + ", project_options = " + QString::number(project_opts_manager->WriteOptionState())
455 + ", project_ident = '" + ui->ProjectIdent->text()
456 + doxy_project_logo_field_string
457 + doxy_header_field_string
458 + doxy_footer_field_string
459 + doxy_extra_field_string
460 + ", assoc_group =" + QString::number(ui->InAssociationList->currentIndex())
461 + ", project_queued = false"
462 + ", target_family = " + QString::number(ui->TargetFamily->currentIndex() + 1)
463 + ", departure_url = '" + ui->DepartureURL->text()
464 + "', executable_directory = '" + ui->ExecutableDirectory->text()
465 + "', executable_name = '" + ui->ExecutableName->text()
466 + "', dot_image_type = '" + ui->DotImageType->currentText()
467 + "', doxy_tab_size = " + QString::number(ui->DoxyTabSize->value())
468 + " where project_index = " + QString::number(project_info.ProjectDesc.ProjectIndex);
469
470 QSqlQuery update_query;
471 if (update_query.exec(update_command_string))
472 {
473 PROJECT_INFORMATION* project_file_info = new PROJECT_INFORMATION;
474 read_project_info->LoadProjectInfo(project_file_info, project_info.ProjectDesc.ProjectIndex, ui->ProjectPrefix->currentIndex());
475 project_subs_manager->LoadFileSubsList(project_file_info);
476
478 doxy_manager->ProcessProject(project_file_info);
479
480 LogAdd(LOG_DEBUG, MODE_DATABASE, QString("Project: %1 has been updated and saved.").arg(project_info.ProjectDesc.ProjectName) );
481 DoEditSave();
482 }
483 else
484 {
485 LogAdd(LOG_ERROR, MODE_DATABASE, QString("Project: %1 was NOT updated or saved.").arg(project_info.ProjectDesc.ProjectName) );
486 ShowMessage(update_command_string);
487 }
488}
void ProcessProject(PROJECT_INFORMATION *ProjectInfo)
Process documentation for a Project.
void SaveLocalSubstitutes(void)
Send a Trigger to Load.
void LoadFileSubsList(PROJECT_INFORMATION *Project)
Load the Substitution table from the Project Information.
bool LoadProjectInfo(PROJECT_INFORMATION *Store, int ProjectIndex, int ProjManIndex)
Load Project & relevant System Information into the Structure.
#define ONLY_UPDATE_SOURCE
Mask to Test if Only Source Code should be Processed.
DoxygenManager * doxy_manager
ProjectSubstitute * project_subs_manager
PROJECT_DESCRIPTION ProjectDesc

References DoEditSave(), doxy_manager, GetLicenceIndex(), LOG_DEBUG, LOG_ERROR, LogAdd(), MODE_DATABASE, ONLY_UPDATE_SOURCE, project_info, project_opts_manager, project_subs_manager, PROJECT_INFORMATION::ProjectDesc, PROJECT_DESCRIPTION::ProjectSelections, read_project_info, SaveLocalSubstitutes(), ShowMessage(), and ui.

Referenced by SaveProject().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ project_info

PROJECT_INFORMATION ProjectDocManager::project_info
private

Structure to hold Project Information.

Definition at line 106 of file projectdocmanager.h.

Referenced by CreateProjectId(), DoEditAbort(), LoadProjectFromDatabase(), ReceiveProjectId(), SaveProject(), StartProject(), and UpdateProjectToDatabase().

◆ ui


The documentation for this class was generated from the following files: