Project Documentation Manager BRIGADOON-0002
Project Documentation Manager
Loading...
Searching...
No Matches
mainwindow.cpp
Go to the documentation of this file.
1#include <QFileDialog>
2#include <QDir>
3#include "mainwindow.h"
4#include "ui_mainwindow.h"
5#include <QProcessEnvironment>
6
7#include "projectdocmanager.h"
8#include "logger.h"
9#include "databasemanager.h"
10#include "developmentfamily.h"
11#include "projectsubstitute.h"
12#include "doxygenmanager.h"
13#include "projectlistmanager.h"
14#include "readprojectinfo.h"
15#include "common_definitions.h"
16
18
25
26MainWindow::MainWindow(QWidget *parent)
27 : QMainWindow(parent)
28 , ui(new Ui::MainWindow)
29{
30 // Set Up the Main Window
31 ui->setupUi(this);
32 ui->ProjectInfoGroupBox->setEnabled(false);
33
34 // Find the Current User
35 project_information.ProgramInformation.CurrentUser = qgetenv("USER");
36
37 // Load the Log
38 qRegisterMetaType<REMOTE_LOG_ENTRY>("REMOTE_LOG_ENTRY"); // Register Custom Meta Types for the "QObject::connect" Definitions
39 log = new Logger(ui);
40 log->Add(LOG_DEBUG, MODE_CONFIG, "Logger \"log\" has been opened.");
41
42 //Create the Database Control Class
44 QObject::connect(db_manager, SIGNAL(SendLogEntry(REMOTE_LOG_ENTRY)), log, SLOT(RemoteLog(REMOTE_LOG_ENTRY)));
45 db_manager->ReconnectDatabase();
46
47 // Load the Program Identification
49 QObject::connect(program_id, SIGNAL(SendLogEntry(REMOTE_LOG_ENTRY)), log, SLOT(RemoteLog(REMOTE_LOG_ENTRY)));
50 program_id->LoadProgramIdentification(); // Default Site - Fix Later
51
52 // Load the Program Version Control Class
53 qRegisterMetaType<REMOTE_VERSION_ENTRY>("REMOTE_VERSION_ENTRY");
55 QObject::connect(version_manager, SIGNAL(SendLogEntry(REMOTE_LOG_ENTRY)), log, SLOT(RemoteLog(REMOTE_LOG_ENTRY)));
56
57 // Create the Development Family Class
58 qRegisterMetaType<DEVELOPMENT_FAMILY>("DEVELOPMENT_FAMILY");
60 QObject::connect(dev_manager, SIGNAL(SendLogEntry(REMOTE_LOG_ENTRY)), log, SLOT(RemoteLog(REMOTE_LOG_ENTRY)));
61 dev_manager->LoadDevelopmentFamilies();
62
63 // Create the Licence Manager
65 licence_manager->LoadLicences();
66 QObject::connect(licence_manager, SIGNAL(SendLogEntry(REMOTE_LOG_ENTRY)), log, SLOT(RemoteLog(REMOTE_LOG_ENTRY)));
67 QObject::connect(dev_manager, SIGNAL(SendPrimaryToolChanged(int)), licence_manager, SLOT(ReadPrimaryTool(int)));
68
69 // Create the Status Manager
70 qRegisterMetaType<STATUS_INFO>("STATUS_INFO");
72 status_manager->LoadStatus();
73 QObject::connect(status_manager, SIGNAL(SendLogEntry(REMOTE_LOG_ENTRY)), log, SLOT(RemoteLog(REMOTE_LOG_ENTRY)));
74
75 // Create Project Identification Manager
76 qRegisterMetaType<REMOTE_LOG_ENTRY>("REMOTE_LOG_ENTRY");
78 QObject::connect(project_id_manager, SIGNAL(SendLogEntry(REMOTE_LOG_ENTRY)), log, SLOT(RemoteLog(REMOTE_LOG_ENTRY)));
79
80 // Instantiate Project Options Manager
82 QObject::connect(project_opts_manager, SIGNAL(SendLogEntry(REMOTE_LOG_ENTRY)), log, SLOT(RemoteLog(REMOTE_LOG_ENTRY)));
83
84 // Instantiate the ReadProjectInfo Library
85 //qRegisterMetaType<PROJECT_INFORMATION>("PROJECT_INFORMATION");
87 QObject::connect(read_project_info, SIGNAL(SendLogEntry(REMOTE_LOG_ENTRY)), log, SLOT(RemoteLog(REMOTE_LOG_ENTRY)));
88
89 // Create the Project Substitution List
91 QObject::connect(project_subs_manager, SIGNAL(SendLogEntry(REMOTE_LOG_ENTRY)), log, SLOT(RemoteLog(REMOTE_LOG_ENTRY)));
92 QObject::connect(licence_manager, SIGNAL(UpdateSoftwareLicence(QString)), project_subs_manager, SLOT(UpdateSoftwareLicence(QString)));
93 QObject::connect(licence_manager, SIGNAL(UpdateHardwareLicence(QString)), project_subs_manager, SLOT(UpdateHardwareLicence(QString)));
94 QObject::connect(licence_manager, SIGNAL(UpdateDocumentationLicence(QString)), project_subs_manager, SLOT(UpdateDocumentationLicence(QString)));
95 QObject::connect(version_manager, SIGNAL(SendMajorVersion(int)), project_subs_manager, SLOT(ReadMajorVersion(int)));
96 QObject::connect(version_manager, SIGNAL(SendMinorVersion(int)), project_subs_manager, SLOT(ReadMinorVersion(int)));
97 QObject::connect(version_manager, SIGNAL(SendRevision(int)), project_subs_manager, SLOT(ReadRevision(int)));
98 QObject::connect(project_id_manager, SIGNAL(SendProjectName(QString)), project_subs_manager, SLOT(UpdateProjectName(QString)));
99 QObject::connect(project_id_manager, SIGNAL(SendDepartureURL(QString)), project_subs_manager, SLOT(UpdateDepartureURL(QString)));
100 QObject::connect(project_id_manager, SIGNAL(SendProjectIcon(QString)), project_subs_manager, SLOT(UpdateProjectIcon(QString)));
101 QObject::connect(project_id_manager, SIGNAL(SendProjectBrief(QString)), project_subs_manager, SLOT(UpdateProjectBrief(QString)));
102 QObject::connect(project_id_manager, SIGNAL(SendProjectContact(QString)), project_subs_manager, SLOT(UpdateProjectContact(QString)));
103 QObject::connect(ui->DoxyProjectLogo, SIGNAL(textChanged(QString)), project_subs_manager, SLOT(UpdateDoxyProjectLogo(QString)));
104 QObject::connect(ui->DoxyHeader, SIGNAL(textChanged(QString)), project_subs_manager, SLOT(UpdateDoxyHeader(QString)));
105 QObject::connect(ui->DoxyFooter, SIGNAL(textChanged(QString)), project_subs_manager, SLOT(UpdateDoxyFooter(QString)));
106 QObject::connect(ui->DoxyStylesheet, SIGNAL(textChanged(QString)), project_subs_manager, SLOT(UpdateDoxyStylesheet(QString)));
107 QObject::connect(project_id_manager, SIGNAL(SendInAssociation(QString)), project_subs_manager, SLOT(UpdateInAssocation(QString)));
108
109 // Instantiate the Project Documentation Manager
110 qRegisterMetaType<PROJECT_INFORMATION>("PROJECT_INFORMATION");
112 QObject::connect(project_doc_manager, SIGNAL(SendLogEntry(REMOTE_LOG_ENTRY)), log, SLOT(RemoteLog(REMOTE_LOG_ENTRY)));
113 QObject::connect(project_doc_manager, SIGNAL(LoadSubstituteTable()), project_subs_manager, SLOT(LoadPresets()));
114
115 // Instantiate the Project List Manager
117 QObject::connect(ui->tabWidgetProjectManager, SIGNAL(currentChanged(int)), project_list_manager, SLOT(ProjectTabChanged(int)));
118
119 // Instantiate DOxygen Manager
120 ui->DotImageType->addItem("SVG", 0);
121 ui->DotImageType->addItem("PNG", 1);
122 ui->DotImageType->addItem("JPG", 2);
123 ui->DotImageType->addItem("GIF", 3);
124 ui->DotImageType->setEnabled(true);
125
126 //qRegisterMetaType<DOXY_OPTIONS>("DOXY_OPTIONS");
128 QObject::connect(doxy_manager, SIGNAL(SendLogEntry(REMOTE_LOG_ENTRY)), log, SLOT(RemoteLog(REMOTE_LOG_ENTRY)));
129 QObject::connect(doxy_manager, SIGNAL(PrStateChange(PROJECT_INFORMATION*)), project_list_manager, SLOT(PrStateChange(PROJECT_INFORMATION*)));
130
131 QObject::connect(project_doc_manager, SIGNAL(SendClear()), version_manager, SLOT(DoClear()));
132 QObject::connect(project_doc_manager, SIGNAL(SendClear()), dev_manager, SLOT(DoClear()));
133 QObject::connect(project_doc_manager, SIGNAL(SendClear()), licence_manager, SLOT(DoClear()));
134 QObject::connect(project_doc_manager, SIGNAL(SendClear()), status_manager, SLOT(DoClear()));
135 QObject::connect(project_doc_manager, SIGNAL(SendClear()), project_id_manager, SLOT(DoClear()));
136 QObject::connect(project_doc_manager, SIGNAL(SendClear()), project_subs_manager, SLOT(DoClear()));
137 QObject::connect(project_doc_manager, SIGNAL(SendClear()), project_opts_manager, SLOT(DoClear()));
138
139 QObject::connect(dev_manager, SIGNAL(SendDevelopmentFamily(DEVELOPMENT_FAMILY)), project_subs_manager, SLOT(UpdateDevFamily(DEVELOPMENT_FAMILY)));
140
141 QObject::connect(project_id_manager, SIGNAL(SendLicenceState(LICENCE_STATE)), licence_manager, SLOT(ReadLicenceState(LICENCE_STATE)));
142
143 QObject::connect(status_manager, SIGNAL(SendStatusInfo(STATUS_INFO)), project_subs_manager, SLOT(UpdateStatus(STATUS_INFO)));
144
145 QObject::connect(project_doc_manager, SIGNAL(SendProjectId(PROJECT_INFORMATION*)), project_id_manager, SLOT(ReadProjectId(PROJECT_INFORMATION*)));
146 QObject::connect(project_doc_manager, SIGNAL(SendProjectId(PROJECT_INFORMATION*)), dev_manager, SLOT(ReadProjectId(PROJECT_INFORMATION*)));
147 QObject::connect(project_doc_manager, SIGNAL(SendProjectId(PROJECT_INFORMATION*)), status_manager, SLOT(ReadProjectInfo(PROJECT_INFORMATION*)));
148 QObject::connect(project_doc_manager, SIGNAL(SendProjectId(PROJECT_INFORMATION*)), version_manager, SLOT(ReadProjectInfo(PROJECT_INFORMATION*)));
149 QObject::connect(project_doc_manager, SIGNAL(SendProjectId(PROJECT_INFORMATION*)), project_subs_manager, SLOT(ReadProjectId(PROJECT_INFORMATION*)));
150 QObject::connect(project_doc_manager, SIGNAL(SendProjectId(PROJECT_INFORMATION*)), project_opts_manager, SLOT(ReadProjectId(PROJECT_INFORMATION*)));
151 QObject::connect(project_doc_manager, SIGNAL(SaveLocalSubstitutes()), project_subs_manager, SLOT(SaveLocalSubstitutes()));
152
153 QObject::connect(ui->SaveProject, SIGNAL(pressed()), project_doc_manager, SLOT(SaveProject()));
154 QObject::connect(ui->UseDefaultDeparture, SIGNAL(pressed()), this, SLOT(SetDefaultDeparture()));
155
156 QObject::connect(project_doc_manager, SIGNAL(SendSubstituteState(bool)), project_subs_manager, SLOT(SetSubstituteState(bool)));
157
158 QObject::connect(project_id_manager, SIGNAL(SendProjectOptions(uint)), project_opts_manager, SLOT(ReadOptionState(uint)));
159 QObject::connect(project_opts_manager, SIGNAL(SendOptionState(uint)), project_subs_manager, SLOT(SetOptionState(uint)));
160
161 // Visual Cue Changes
162 QObject::connect(ui->ProjectName, SIGNAL(textChanged(QString)), this, SLOT(SetProjectNameColor(QString)));
163 QObject::connect(ui->DepartureURL, SIGNAL(textChanged(QString)), this, SLOT(SetDepartureURLColor(QString)));
164 QObject::connect(ui->ExecutableDirectory, SIGNAL(textChanged(QString)), this, SLOT(SetExeDirColor(QString)));
165 QObject::connect(ui->ExecutableName, SIGNAL(textChanged(QString)), this, SLOT(SetExeNameColor(QString)));
166 QObject::connect(ui->BriefDescription, SIGNAL(textChanged(QString)), this, SLOT(SetBriefDescriptionColor(QString)));
167 QObject::connect(ui->FullDescription, SIGNAL(textChanged()), this, SLOT(SetFullDesriptionColor()));
168 QObject::connect(this, SIGNAL(UpdateFullDescription(QString)), project_subs_manager, SLOT(UpdateFullDescription(QString)));
169 QObject::connect(ui->VersionDescription, SIGNAL(textChanged()), this, SLOT(SetVersionDesriptionColor()));
170 QObject::connect(ui->ProjectIcon, SIGNAL(textChanged(QString)), this, SLOT(SetProjectIconColor(QString)));
171 QObject::connect(ui->DoxyProjectLogo, SIGNAL(textChanged(QString)), this, SLOT(SetDoxyProjectLogoColor(QString)));
172 QObject::connect(ui->DoxyHeader, SIGNAL(textChanged(QString)), this, SLOT(SetDoxyHeaderColor(QString)));
173 QObject::connect(ui->DoxyFooter, SIGNAL(textChanged(QString)), this, SLOT(SetDoxyFooterColor(QString)));
174 QObject::connect(ui->DoxyStylesheet, SIGNAL(textChanged(QString)), this, SLOT(SetDoxyStylesheetColor(QString)));
175 QObject::connect(ui->ProjectIdent, SIGNAL(textChanged(QString)), this, SLOT(SetProjectIdentColor(QString)));
176
177 // Processing Buttons
178 QObject::connect(ui->UpdateSelectedProject, SIGNAL(pressed()), project_list_manager, SLOT(ProcessSelection()));
179 QObject::connect(ui->UpdateAllProjects, SIGNAL(pressed()), project_list_manager, SLOT(ProcessFullList()));
180 QObject::connect(ui->SelectExeDir, SIGNAL(pressed()), this, SLOT(SelectExeDir()));
181}
182
184{
185 delete project_doc_manager; // Unlock the project (if locked);
186 delete log; // Save Log Parameters, If Required
187 delete ui;
188}
189
190void MainWindow::SetProjectNameColor(QString TextString)
191{
192 if (TextString.length() == 0) ui->ProjectName->setStyleSheet(red_stylesheet); else ui->ProjectName->setStyleSheet(no_color_stylesheet);
193}
194
195void MainWindow::SetDepartureURLColor(QString TextString)
196{
197 if (TextString.length() == 0) ui->DepartureURL->setStyleSheet(purple_stylesheet); else ui->DepartureURL->setStyleSheet(no_color_stylesheet);
198}
199
200void MainWindow::SetExeDirColor(QString TextString)
201{
202 if (TextString.length() == 0) ui->ExecutableDirectory->setStyleSheet(red_stylesheet); else ui->ExecutableDirectory->setStyleSheet(no_color_stylesheet);
203}
204
206{
207 if (TextString.length() == 0) ui->BriefDescription->setStyleSheet(red_stylesheet); else ui->BriefDescription->setStyleSheet(no_color_stylesheet);
208}
209
211{
212 if (ui->FullDescription->toPlainText().length() == 0 ) ui->FullDescription->setStyleSheet(red_stylesheet); else ui->FullDescription->setStyleSheet(no_color_stylesheet);
213 emit UpdateFullDescription(QString(ui->FullDescription->toPlainText()));
214}
215
217{
218 if (ui->VersionDescription->toPlainText().length() == 0 ) ui->VersionDescription->setStyleSheet(red_stylesheet); else ui->VersionDescription->setStyleSheet(no_color_stylesheet);
219}
220
221void MainWindow::SetProjectIconColor(QString TextString)
222{
223 if (TextString.length() == 0) ui->ProjectIcon->setStyleSheet(grey_stylesheet); else ui->ProjectIcon->setStyleSheet(no_color_stylesheet);
224}
225
227{
228 if (TextString.length() == 0) ui->DoxyProjectLogo->setStyleSheet(grey_stylesheet); else ui->DoxyProjectLogo->setStyleSheet(no_color_stylesheet);
229}
230
231void MainWindow::SetDoxyHeaderColor(QString TextString)
232{
233 if (TextString.length() == 0) ui->DoxyHeader->setStyleSheet(grey_stylesheet); else ui->DoxyHeader->setStyleSheet(no_color_stylesheet);
234}
235
236void MainWindow::SetExeNameColor(QString TextString)
237{
238 if (TextString.length() == 0) ui->ExecutableName->setStyleSheet(red_stylesheet); else ui->ExecutableName->setStyleSheet(no_color_stylesheet);
239}
240
241
242void MainWindow::SetDoxyFooterColor(QString TextString)
243{
244 if (TextString.length() == 0) ui->DoxyFooter->setStyleSheet(grey_stylesheet); else ui->DoxyFooter->setStyleSheet(no_color_stylesheet);
245}
246
248{
249 if (TextString.length() == 0) ui->DoxyStylesheet->setStyleSheet(grey_stylesheet); else ui->DoxyStylesheet->setStyleSheet(no_color_stylesheet);
250}
251
252void MainWindow::SetProjectIdentColor(QString TextString)
253{
254 if (TextString.length() == 0) ui->ProjectIdent->setStyleSheet(red_stylesheet); else ui->ProjectIdent->setStyleSheet(no_color_stylesheet);
255}
256
257void MainWindow::SetProgramName(QString DirectoryName)
258{
259 QString exe_name; exe_name.clear();
260 QDir build_dir(DirectoryName);
261
262 if (build_dir.exists())
263 {
264 build_dir.setFilter(QDir::Files | QDir::NoSymLinks | QDir::Executable);
265 QFileInfoList list = build_dir.entryInfoList();
266 if (list.size() == 1)
267 {
268 QFileInfo file_info = list.at(0);
269 exe_name = file_info.fileName();
270 }
271 }
272 ui->ExecutableName->setText(exe_name);
273}
274
276{
277 QString dir_name = QFileDialog::getExistingDirectory(this, "Select Directory", ui->ExecutableDirectory->text(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
278 if (!dir_name.isEmpty()) ui->ExecutableDirectory->setText(dir_name);
279}
280
282{
283 ui->DepartureURL->setText(ui->DefaultReturnAddress->text());
284}
Class to control the opening of the Database.
Clasas to Control the Project's Development Family Information.
Class for utilising the Doxygen tool.
Class to Manager the Project Licences.
ProgramIdentification * program_id
Point to the Program's identification.
Definition mainwindow.h:64
void SetBriefDescriptionColor(QString TextString)
Set the Colour of the Project's Brief Description.
void SetDoxyProjectLogoColor(QString TextString)
Set the Colour of the Doxygen Project Logo.
QString grey_stylesheet
Stylesheet for the colour grey.
Definition mainwindow.h:118
void SetDoxyFooterColor(QString TextString)
Set the Colour of the Doxygen Footer Colour.
QString red_stylesheet
Stylesheet for the colour red.
Definition mainwindow.h:106
LicenceManager * licence_manager
Pointer to the Licence Class.
Definition mainwindow.h:82
Ui::MainWindow * ui
POinter to the Main Window.
Definition mainwindow.h:58
DevelopmentFamily * dev_manager
Pointer to the Development Class.
Definition mainwindow.h:76
ProgramVersion * version_manager
Pointer to the Progra's Version Class.
Definition mainwindow.h:100
void SetProgramName(QString ProgramName)
Set the Program Name.
void UpdateFullDescription(QString DescText)
Emit the Full Description text.
void SetVersionDesriptionColor()
Set the Colour of the Version Description.
void SelectExeDir(void)
QString no_color_stylesheet
Stylesheet for no colour definition.
Definition mainwindow.h:124
ProjectStatus * status_manager
Pointer to the Status Class.
Definition mainwindow.h:88
void SetDoxyHeaderColor(QString TextString)
Set the Colour of the Doxygen Header Colour.
Logger * log
Pointer to the Log Class.
Definition mainwindow.h:50
void SetProjectIconColor(QString TextString)
Set the Colour of the Project Icon.
MainWindow(QWidget *parent=nullptr)
Constructor for Main Window.
ProjectIdentifier * project_id_manager
Pointer to the Project Id3entification Class.
Definition mainwindow.h:94
void SetDoxyStylesheetColor(QString TextString)
Set the Colour of the Doxygen Stylesheet Colour.
void SetExeNameColor(QString TextString)
Set the Colour of the Exe Name Stylesheet Colour.
void SetDepartureURLColor(QString TextString)
Set the Colour of the Project's Departure URL.
void SetProjectNameColor(QString TextString)
Set the Colour of the Project Name.
DatabaseManager * db_manager
Pointer to the Database Class.
Definition mainwindow.h:70
QString purple_stylesheet
Stylesheet for the colour purple.
Definition mainwindow.h:112
void SetExeDirColor(QString TextString)
Set the Colour of the Exe Directory Stylesheet Colour.
~MainWindow()
Main Window Deconstructor.
void SetDefaultDeparture(void)
Set the Default Departure URL.
void SetFullDesriptionColor()
void SetProjectIdentColor(QString TextString)
Set the Colour of the Project Identifier.
Program Identification Class.
Class for Program Vesrion.
Project Document Control Class.
Common Structure Defintitions.
Class Controlling the Database Creation.
ProjectListManager * project_list_manager
ReadProjectInfo * read_project_info
Doxygen Defintitions.
@ LOG_DEBUG
Definition logger.h:56
@ MODE_CONFIG
Definition logger.h:26
ProjectOptionsManager * project_opts_manager
PROJECT_INFORMATION project_information
DoxygenManager * doxy_manager
ProjectSubstitute * project_subs_manager
ProjectDocManager * project_doc_manager
Project List Manager Class.
Class Controlling Text Substitution.
Class for Reading Projects.
Summary of Project Types.
Assigned Software, Hardware and COgumenttaion Licences.
Project Information Passed Between Functions.
Definition logger.h:60
Information about the Development Status.