15 QObject::connect(
ui->MajorVersion, QOverload<int>::of(&QSpinBox::valueChanged), [=](quint16 i){ SetMajorVersion(i); });
16 QObject::connect(
ui->MinorVersion, QOverload<int>::of(&QSpinBox::valueChanged), [=](quint16 i){ SetMinorVersion(i); });
17 QObject::connect(
ui->Revision, QOverload<int>::of(&QSpinBox::valueChanged), [=](quint16 i){ SetRevision(i); });
18 QObject::connect(
ui->OverrideStepControl, SIGNAL(stateChanged(
int)),
this, SLOT(
SetStepOverride(
int)));
19 QObject::connect(
ui->MajorVersion, SIGNAL(valueChanged(
int)),
this, SLOT(
UpdateMajorVersion(
int)));
20 QObject::connect(
ui->MinorVersion, SIGNAL(valueChanged(
int)),
this, SLOT(
UpdateMinorVersion(
int)));
21 QObject::connect(
ui->Revision, SIGNAL(valueChanged(
int)),
this, SLOT(
UpdateRevision(
int)));
22 QObject::connect(
ui->UpdateVersion, SIGNAL(pressed()),
this, SLOT(
SaveVersion()));
23 QObject::connect(
ui->ProjectStatusDate, SIGNAL(dateTimeChanged(QDateTime)),
this, SLOT(
ReadProjectDateTime(QDateTime)));
28 if (
ui->OverrideStepControl->isChecked() )
30 ui->MajorVersion->setMinimum( 0 );
31 ui->MajorVersion->setMaximum( 999 );
32 ui->MajorVersion->setValue(Value);
36 ui->MajorVersion->setMinimum( Value );
37 ui->MajorVersion->setMaximum( Value + 1 );
45 if (
ui->OverrideStepControl->isChecked() )
47 ui->MinorVersion->setMinimum( 0 );
48 ui->MinorVersion->setMaximum( 999 );
49 ui->MinorVersion->setValue(Value);
53 ui->MinorVersion->setMinimum( Value);
54 ui->MinorVersion->setMaximum( Value + 1 );
62 if (
ui->OverrideStepControl->isChecked() )
64 ui->Revision->setMinimum( 0);
65 ui->Revision->setMaximum( 999 );
66 ui->Revision->setValue(Value);
70 ui->Revision->setMinimum( Value );
71 ui->Revision->setMaximum( Value + 1 );
78 ui->MajorVersion->setMinimum( 0 );
79 ui->MajorVersion->setMaximum( 999 );
80 ui->MajorVersion->setValue( Value );
86 ui->MinorVersion->setMinimum( 0 );
87 ui->MinorVersion->setMaximum( 999 );
88 ui->MinorVersion->setValue( Value );
94 ui->Revision->setMinimum( 0 );
95 ui->Revision->setMaximum( 999 );
96 ui->Revision->setValue( Value );
102 QString message =
"Operator set Version Step Override to ";
103 if ( State == Qt::Checked )
105 ui->MajorVersion->setMinimum( 0 );
106 ui->MajorVersion->setMaximum( 999 );
108 ui->MinorVersion->setMinimum( 0 );
109 ui->MinorVersion->setMaximum( 999 );
111 ui->Revision->setMinimum( 0 );
112 ui->Revision->setMaximum( 999 );
118 ui->MajorVersion->setMinimum(
ui->MajorVersion->value() );
119 ui->MajorVersion->setMaximum(
ui->MajorVersion->value() + 1 );
121 ui->MinorVersion->setMinimum(
ui->MinorVersion->value() );
122 ui->MinorVersion->setMaximum(
ui->MinorVersion->value() + 1 );
124 ui->Revision->setMinimum(
ui->Revision->value() );
125 ui->Revision->setMaximum(
ui->Revision->value() + 1 );
134 ui->OverrideStepControl->setChecked(Enable);
145 ui->VersionDate->setText(version_timestamp);
165 ui->VersionDate->setText(now);
167 ui->VersionDescription->clear();
174 log_entry.
Mode = Mode;
182 QString message_template =
"Program Version is %1, dated %2";
194 ui->VersionDescription->clear();
195 ui->ExecutableDirectory->clear();
196 ui->FullHistory->clear();
202 QString p1 = QString::number(ProjectIndex);
203 QString p2 = QString::number(VersionInstance.
MajorVersion);
204 QString p3 = QString::number(VersionInstance.
MinorVersion);
205 QString p4 = QString::number(VersionInstance.
Revision);
206 QString query_template = QString(
"select description, version_timestamp from proj_version_info where project_id = %1 and major_version = %2 and minor_version = %3 and revision = %4 ");
207 QString query_string = query_template.arg(p1, p2, p3,p4);
208 QSqlQuery version_text_query(query_string);
210 while (version_text_query.next())
212 QString version_string = version_text_query.value(0).toString();
213 ui->VersionDescription->setText(version_string);
214 QDateTime version_datetime = version_text_query.value(1).toDateTime();
215 ui->VersionDate->setText(version_datetime.toLocalTime().toString());
223 bool new_version =
false;
228 QString p2 = QString::number(
ui->MajorVersion->value());
229 QString p3 = QString::number(
ui->MinorVersion->value());
230 QString p4 = QString::number(
ui->Revision->value());
231 QString p5 =
ui->VersionDescription->toPlainText();
232 QString p6 =
ui->ProjectStatus->currentText();
233 QDateTime p7 = QDateTime::currentDateTime();
234 ui->VersionDate->setText(p7.toString());
236 QString query_string = QString(
"select project_id from proj_version_info where project_id = %1 and major_version = %2 and minor_version = %3 and revision = %4").arg(p1, p2, p3, p4);
237 QSqlQuery does_version_exist(query_string);
240 if (does_version_exist.next())
242 query_string = QString(
"update proj_version_info set description = '%1', version_status = '%5' where project_id = %2 and major_version = %3 and minor_version = %4 and revision = %5").arg(p5, p1, p2, p3, p4);
243 QSqlQuery update_version_description(query_string);
244 if (!update_version_description.exec())
LogAdd(
LOG_ERROR,
MODE_DATABASE, QString(
"ERROR - Unable to update Version %1.%2.%3").arg(p2, p3, p4, p5));
252 query_string = QString(
"update project set major_version = %1, minor_version = %2, revision = %3 where project_index = %4").arg(p2, p3, p4, p1);
253 QSqlQuery update_version_query;
254 bool result = update_version_query.exec(query_string);
262 QString(
"INSERT INTO proj_version_info(project_id, major_version, minor_version, revision, description, version_status, version_timestamp) VALUES (%1, %2, %3, %4, '%5', '%6', '%7')").arg(p1, p2, p3, p4, p5, p6, p7.toString(
DATETIME_DATABASE_FORMAT));
263 QSqlQuery insert_version_query;
264 result = insert_version_query.exec(query_string);
304 return(QString::number(MajorVersion).rightJustified(2,
'0') +
"." +
305 QString::number(MinorVersion).rightJustified(2,
'0') +
"." +
306 QString::number(Revision).rightJustified(2,
'0')
312 QString full_history;
313 QString query_string = QString(
"select major_version, minor_version, revision, description, version_status from proj_version_info where project_id = %1 order by major_version desc, minor_version desc, revision desc")
314 .arg(QString::number(ProjectIndex));
315 QSqlQuery version_text_query(query_string);
317 while (version_text_query.next())
319 full_history += QString(
"<P><B>Version ") +
FormatVersion(version_text_query.value(0).toInt(), version_text_query.value(1).toInt(), version_text_query.value(2).toInt()) +
": <I>";
320 full_history += version_text_query.value(4).toString() +
" </I></B>";
321 full_history += version_text_query.value(3).toString() +
"</P>";
323 ui->FullHistory->setText(full_history);
325 return(full_history);
void SetOverrideEnable(bool Enable)
Enable/Disable the Override.
void SetMajorVersion(quint16 Value)
Sets the Project's Major Version to Value.
void SendMajorVersion(int MajorVersion)
Send the Major Version.
void PresetRevision(quint16 Value)
Preset the Revision to a Value.
void SendRevision(int Revision)
Send the Revision.
void DoClear(void)
Reset the Version Information.
REMOTE_VERSION_ENTRY WriteVersion(uint ProjectId)
Read the Version Information into Structure.
QString FormatVersion(int MajorVersion, int MinorVersion, int Revision)
Format the numeric version (major, minor, revision) as text.
void SendLogEntry(REMOTE_LOG_ENTRY LogEntry)
Send Log Entry to the Log \LogEntry Structure holding Log information.
void LogAdd(LOGGING_SEVERITY Severity, LOGGING_MODE Mode, QString Message)
void SendVersionInfo(REMOTE_VERSION_ENTRY VersionEntry)
Send the Version information by the Signal-Slot Method.
void SetMinorVersion(quint16 Value)
Sets the Project's Minor Version to Value.
void ReadProjectInfo(PROJECT_INFORMATION *ProjectId)
Read The Project Information.
ProgramVersion(Ui::MainWindow *UI_Window)
Program Version Class Constructor.
void SaveVersion(void)
Save the Project's Version.
QString ReadFullHistory(int ProjectIndex)
Read the entire history of the Project as a string.
QString timestamp_format_string
DateTime Format String.
void UpdateRevision(int Revision)
Set the Revision to the Value Supplied.
void SendMinorVersion(int MinorVersion)
Send the Minor Version.
void SendProjectDateTime(QString ProjectDateTime)
Send the Current DateTime as the Version DateTime.
uint project_index
Project Index Number.
void LogProgramVersion(REMOTE_VERSION_ENTRY VersionInstance)
Convert the Program Version to Log Message and Send It.
void PresetMinorVersion(quint16 Value)
Preset the Minor Version to a Value.
void SetRevision(quint16 Value)
Sets the Project's Revision to Value.
void SetVersionDate(void)
Set the Version Date.
void UpdateMajorVersion(int MajorVersion)
Set the Major Version to the Value Supplied.
void UpdateMinorVersion(int MinorVersion)
Set the Minor Version to the Value Supplied.
VERSION_INFO version_info
Structure holding Version Information.
void ReadVersionText(uint ProjectIndex, VERSION_INFO Version)
Read the Version Text for the Project's Version.
void SetStepOverride(int State)
Set the Status of Version Step Override.
void PresetMajorVersion(quint16 Value)
Preset the Major Version to a Value.
void ReadProjectDateTime(QDateTime ProjectDateTime)
Read the Project DateTime.
Project Document Control Class.
Common Structure Defintitions.
#define DATETIME_DATABASE_FORMAT
text format of the DateTime used by the Database.
#define DATETIME_DISPLAY_FORMAT
DateTime formatting for the program displays.
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.
ProjectDocManager * project_doc_manager
LOGGING_SEVERITY Severity
Version Structure used between functions.
Information about the Project's Version.
QString FullVersionString