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()));
50 bool state = (bool)State;
52 ui->OnlyInfoPage->setEnabled(state);
53 ui->LimitToAssoc->setEnabled(state);
58 bool state = (bool)State;
60 ui->OfferPaypal->setEnabled(state);
65 bool state = (bool)State;
67 ui->DoxygenOptions->setEnabled(state);
92 QString filter_string;
98 filter_string =
"*.png *.xpm *.jpg *.svg";
99 prompt_name =
"Image";
103 filter_string =
"*.htm *.html";
104 prompt_name =
"HTML";
108 filter_string =
"*.css";
113 QString file_name = QFileDialog::getOpenFileName(
nullptr, prompt_name, InitialName, filter_string);
114 if (file_name ==
"")file_name = InitialName;
121 ui->SelectProjectList->clear();
122 ui->SelectProjectList->clearEditText();
125 QSqlQuery project_list_query(
"select project_index, project_name, project_lock from project where project_index > 1 order by project_index");
130 while ( project_list_query.next() )
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;
138 ui->SelectProjectList->addItem(list_entry, project_number);
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());
166 ui->SelectProjectList->setEnabled(state);
170 ui->SelectProjectList->clear();
171 ui->SaveProject->setEnabled(
false);
172 ui->AbortNewProject->setEnabled(
false);
183 ui->ExecutableName->setReadOnly(
false);
184 ui->SelectProjectList->clearEditText();
185 ui->SelectProjectList->setEnabled(
false);
186 ui->CreateNewProject->setEnabled(
false);
196 log_entry.
Mode = Mode;
203 QString item_text =
ui->SelectProjectList->itemText(Item);
205 uint project_index =
ui->SelectProjectList->itemData(Item).toInt();
208 ShowMessage(QString(
"Unable to Reserve Project \"%1\" for Editing").arg(item_text));
226 QMessageBox message_box;
227 message_box.setText(Message);
237 QSqlQuery read_project_query(QString(
"select * from project where project_index = %1").arg(QString::number(Item)));
239 while ( read_project_query.next() )
267 ui->InAssociationList->setCurrentIndex(
project_info.InAssocInfo.InAssociationIndex);
275 if (row_counter == 1)
278 ui->FullDescription->setPlainText(
project_info.ProjectDesc.FullDescription);
279 ui->InAssociationList->setCurrentIndex(
project_info.InAssocInfo.InAssociationIndex);
280 ui->SelectProjectList->setEnabled(
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);
310 ui->SaveProject->setEnabled(State);
311 ui->AbortNewProject->setEnabled(State);
312 ui->EnableProjectEdit->setEnabled(!State);
315 ui->ExecutableName->setReadOnly(!
ui->ExecutableName->text().isEmpty());
319 ui->ExecutableName->setReadOnly(
true);
326 ui->ProjectInfoGroupBox->setEnabled(State);
327 ui->ProjectOptionsGroupBox->setEnabled(State);
342 ui->ProjectStatusDate->setDateTime(QDateTime::currentDateTime());
348 msgBox.setText(
"Enter all fields with red prompts");
358 QString full_description_field_string =
", full_description ";
361 if (
ui->FullDescription->document()->toPlainText().isEmpty())
363 full_description_field_string +=
"= null";
367 full_description_field_string += QString(
"= \"") +
ui->FullDescription->document()->toPlainText() + QString(
"\"");
370 QString project_icon_field_string =
"', icon_filename ";
373 if (
ui->ProjectIcon->text().isEmpty())
375 project_icon_field_string +=
"= null";
379 project_icon_field_string += QString(
"= '") +
ui->ProjectIcon->text() + QString(
"'");
383 QString doxy_extra_field_string =
", doxy_extra_stylesheet_filename ";
386 if (
project_info.DoxyOptions.DoxyExtraStylesheetFilename.isEmpty())
388 doxy_extra_field_string +=
"= null";
392 doxy_extra_field_string += QString(
"= '") +
project_info.DoxyOptions.DoxyExtraStylesheetFilename + QString(
"'");
396 QString doxy_footer_field_string =
", doxy_html_footer_filename ";
399 if (
project_info.DoxyOptions.DoxyHtmlFooterFilename.isEmpty())
401 doxy_footer_field_string +=
"= null";
405 doxy_footer_field_string += QString(
"= '") +
project_info.DoxyOptions.DoxyHtmlFooterFilename + QString(
"'");
409 QString doxy_header_field_string =
", doxy_html_header_filename ";
412 if (
project_info.DoxyOptions.DoxyHtmlHeaderFilename.isEmpty())
414 doxy_header_field_string +=
"= null";
418 doxy_header_field_string += QString(
"= '") +
project_info.DoxyOptions.DoxyHtmlHeaderFilename + QString(
"'");
422 QString doxy_project_logo_field_string =
"', doxy_project_logo_filename ";
425 if (
project_info.DoxyOptions.DoxyLogoFilename.isEmpty())
427 doxy_project_logo_field_string +=
"= null";
431 doxy_project_logo_field_string += QString(
"= '") +
project_info.DoxyOptions.DoxyLogoFilename + QString(
"'");
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
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);
470 QSqlQuery update_query;
471 if (update_query.exec(update_command_string))
493 uint project_number=0;
496 QString query_string = QString(
"select max(project_index) from project");
497 QSqlDatabase db = QSqlDatabase::database();
499 QSqlQuery licence_query(query_string);
500 while(licence_query.next())
502 project_number = licence_query.value(0).toUInt();
510 QString project_identifier =
ui->ProjectPrefix->currentText() +
"-" + QStringLiteral(
"%1").arg(project_number,
ui->ProjectNumberSize->value(), 10, QLatin1Char(
'0'));
511 ui->ProjectIdent->setText(project_identifier);
514 return(project_number);
519 uint licence_index = -1;
522 QString query_string = QString(
"select licence_index from licence where short_name = '%1'").arg(LicenceName);
523 QSqlDatabase db = QSqlDatabase::database();
525 QSqlQuery licence_query(query_string);
526 while(licence_query.next())
528 licence_index = licence_query.value(0).toInt();
530 return(licence_index);
537 ui->ProjectStatusDate->setDateTime(QDateTime::currentDateTime());
539 QString insert_command_template = QString(
"INSERT INTO project(%1) VALUES (%2);");
541 QString storage_location;
542 if(
ui->LocalDevDirectory->text().isEmpty()) storage_location =
ui->ProjectIdent->text();
else storage_location =
ui->LocalDevDirectory->text() +
"/" +
ui->ProjectIdent->text();
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");
549 QString value_string = QString::number(project_number) +
",'" +
550 ui->ProjectName->text() +
"'," +
551 QString::number(
ui->MajorVersion->value()) +
"," +
552 QString::number(
ui->MinorVersion->value()) +
"," +
553 QString::number(
ui->Revision->value()) +
",'" +
554 ui->BriefDescription->text() +
"'," +
555 QString::number(
ui->DevelopmentFamily->currentIndex() + 1) +
"," +
556 QString::number(
ui->LanguageFamily->currentIndex() + 1) +
"," +
557 QString::number(
ui->ProjectStatus->currentIndex() + 1) +
"," +
560 QString::number(
ui->PrimaryTool->currentIndex() + 1) +
",'" +
561 ui->ProjectStatusDate->dateTime().toString(
"yyyy-MM-dd hh:mm:ss.zzz") +
"'," +
562 QString::number(
GetLicenceIndex(
ui->DocumentationLicenceList->currentText())) +
"," +
565 QString::number(
ui->ProjectContactList->currentIndex() + 1) +
" ,'" +
566 ui->FullDescription->document()->toPlainText() +
"','" +
567 storage_location +
"','" +
568 ui->ProjectIcon->text() +
"'," +
571 ui->ProjectIdent->text() +
"','" +
572 ui->DoxyProjectLogo->text() +
"','" +
573 ui->DoxyHeader->text() +
"','" +
574 ui->DoxyFooter->text() +
"','" +
575 ui->DoxyStylesheet->text() +
"'," +
576 QString::number(
ui->InAssociationList->currentIndex()) +
"," +
578 QString::number(
ui->TargetFamily->currentIndex() + 1) +
"', '" +
579 ui->DepartureURL->text() +
"', '" +
580 ui->ExecutableDirectory->text() +
"', '" +
582 ui->ExecutableName->text() +
"', '" +
583 ui->DotImageType->currentText() +
"', " +
584 QString::number(
ui->DoxyTabSize->value());
586 QString insert_command_string = insert_command_template.arg(field_string).arg(value_string);
588 QSqlQuery insert_query;
589 bool insert_result = insert_query.exec(insert_command_string);
596 QString source_directory =
ui->SharedTemplateDir->text() +
"/project_template";
604 source_directory =
ui->SharedTemplateDir->text() +
"/family_template/" +
ui->DevelopmentFamily->currentText();
611 LogAdd(
LOG_ERROR,
MODE_DATABASE, QString(
"Failed to add %1 information to %2.").arg(
ui->DevelopmentFamily->currentText()).arg(source_directory) );
615 source_directory =
ui->SharedTemplateDir->text() +
"/language_template/" +
ui->LanguageFamily->currentText();
627 source_directory =
ui->SharedTemplateDir->text() +
"/tool_template/" +
ui->PrimaryTool->currentText();
639 QString code_directory = storage_location +
"/source/" +
ui->ExecutableName->text();
641 if (!dir.mkdir(code_directory))
650 QString autosrc_template =
ui->SharedTemplateDir->text() +
"/autosrc_template/" +
ui->LanguageFamily->currentText();
673 return(insert_result);
678 ui->SaveSubstituitions->setEnabled(!State);
679 ui->ReloadSubstituitions->setEnabled(!State);
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();
694 QFileInfo srcFileInfo(srcFilePath);
695 if (srcFileInfo.isDir())
698 QDir targetDir(tgtFilePath);
699 if ( !targetDir.exists() )
703 if (!targetDir.mkpath(QFileInfo(tgtFilePath).fileName()))
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;
727 if (!QFile::copy(srcFilePath, tgtFilePath))
729 LogAdd(
LOG_ERROR,
MODE_FILE, QString(
"Error in file copy from '" ) + srcFilePath + QString(
"' to '") + tgtFilePath +
"." );
747 Arg <<
"init" << SrcFilePath <<
"--template=/usr/share/git-core/templates";
749 git.start(
"git", QStringList() << Arg );
750 if (!git.waitForStarted())
757 if (git.waitForFinished())
762 Arg <<
"commit -m \"Initial creation by ProjectManager.\"";
763 git.start(
"git", QStringList() << Arg );
764 if (!git.waitForStarted())
771 if (git.waitForFinished())
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);
807 git.start(
"git", QStringList() << Arg );
808 if (!git.waitForStarted())
815 if (git.waitForFinished())
832 QString update_command_string = QString(
"UPDATE project SET project_lock = ") + QVariant(LockState).toString() +
" "
833 +
"where project_index = " + QString::number(ProjectIndex);
835 QSqlQuery update_query;
836 if (update_query.exec(update_command_string))
Class for utilising the Doxygen tool.
bool InitiasliseGitDirectory(QString SrcFilePath)
Initialise the Project's Git Directory.
~ProjectDocManager()
ProjectManager Class Deconstructor.
void ReceiveProjectId(PROJECT_INFORMATION ProjectId)
Receive the Project's Information for processing.
int CreateProjectId(void)
Create the next unused project number.
void GetDoxyHeader(void)
Get Custom Doxygen Header.
void LogAdd(LOGGING_SEVERITY Severity, LOGGING_MODE Mode, const QString Message)
Send Message to the Log.
QString GetFile(QString InitialName, GET_FILE_TYPE FileType)
Read a file into a String.
void LoadSubstituteTable()
Load System Substituitions.
void StartProject(void)
Enable the Project User Interface for editing.
void SendLogEntry(REMOTE_LOG_ENTRY LogEntry)
Send Log Entry via the Signal-Slot Method.
ProjectDocManager(Ui::MainWindow *UI_Window)
ProjectManager Class Constructor.
void SaveLocalSubstitutes(void)
Send a Trigger to Load.
void SetDonationsWelcome(int State)
Enable/Disable Donation Options.
bool CommitGitDirectory(QString SrcFilePath, QString VersionsString, QString Message)
Commit Project Files to Git.
void ShowMessage(QString Message)
Shows Message in popup window.
void SaveProject(void)
Save a new project to the database.
void SendSubstituteState(bool State)
Send the Substitute Enable State.
void GetDoxyLogo(void)
Get the Doxygen Logo from known image files.
bool CopyRecursively(const QString &SourceFilePath, const QString &TargetFilePath)
Recursively copy files from Source to Destination.
void GetDoxyFooter(void)
Get Custom Doxygen Footer.
PROJECT_INFORMATION project_info
Structure to hold Project Information.
int GetLicenceIndex(QString LicenceName)
Get the Licence Database Index from the Licence Name.
bool LockProject(int ProjectIndex, bool LockState)
Lock/Unlock Project in the Database.
void SetDocAccess(int State)
Enable/Disable Document Access Restrictions.
void LoadProjectList()
Load Select Project List from Database.
void UpdateProjectToDatabase(void)
Updates an Existing Project.
void LoadProjectFromDatabase(int Item)
Load Project Information from Database.
void DoEditSave(void)
Abort Editing after Saving.
void SetDoxyOptions(int State)
Enable/Disable Custom Doxy Options.
void SendClear(void)
Send a Project Clear Command.
void SetEditButtons(bool State)
Enable/Disable Edit buttons.
void SendProjectId(PROJECT_INFORMATION *ProjectId)
Send out Project Information for Updates.
bool IsSaveAvailable(void)
Check if Project Save is Enabled.
void LockSubsButtons(bool State)
Lock/unlock the Substitution Buttons.
bool InsertNewProjectInDatabase(void)
Inserts new project into the database.
void ReadActivated(int Item)
Load a Project & Enable editing.
void GetDoxyStylesheet(void)
Get Custom Doxygen Stylesheet.
void EnableUserInterface(bool State)
Enable the Project User Interface.
void SetEditState(int State)
Enable/Disable editing.
Ui::MainWindow * ui
Pointer to the Main Window.
void DoEditAbort(void)
Abort Editing without Saving.
Common Structure Defintitions.
#define ONLY_UPDATE_SOURCE
Mask to Test if Only Source Code should be Processed.
@ PT_DOXY_HTML_HEADER_FILENAME
@ PT_DOXY_EXTRA_STYLESHEET_FILENAME
@ PT_EXECUTABLE_DIRECTORY
@ PT_DOXY_HTML_FOOTER_FILENAME
@ PT_DOXY_PROJECT_LOGO_FILENAME
ReadProjectInfo * read_project_info
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
PROJECT_INFORMATION project_information
DoxygenManager * doxy_manager
ProjectSubstitute * project_subs_manager
int current_locked_project
Database Index of currently locked Project.
GET_FILE_TYPE
Type of File to Search for.
Class Controlling the Database Creation.
Class Controlling Text Substitution.
Class for Reading Projects.
LOGGING_SEVERITY Severity