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

#include <projectstatus.h>

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

Public Slots

void TriggerSendStatus (void)
 Respond to Request for Status by Sending it.
void DoClear (void)
 Reset the Uer Interface Status Display.
void ReadProjectInfo (PROJECT_INFORMATION *Info)
 Read teh Status from the Project Info to the User Interface.

Signals

void SendLogEntry (REMOTE_LOG_ENTRY LogEntry)
 Send Log Entry to the Log \LogEntry Structure holding Log information.
void SendStatus (int StatusIndex)
 Emit the current Status Database Index.
void SendStatusInfo (STATUS_INFO StatusInfo)
 Emit the current Status Information Structure.

Public Member Functions

 ProjectStatus (Ui::MainWindow *UI_Window)
 ProjectStatus Constructor.
void LoadStatus (void)
 Load Status definitions from the Database.

Private Slots

void StatusChanged (int StatusIndex)
 When Status Changes Update the Next Status Level Button.
void DoIncrement (void)
 Increment the Project's Status to the Next Level.
void SetStatusEditing (int EditStatus)
 Turn Custom Status Setting On or Off.
void DoStatusDateNow (void)
 Set the Status Date as the current DateTime.

Private Member Functions

void LogAdd (LOGGING_SEVERITY Severity, LOGGING_MODE Mode, QString Message)
 Add a Log Entry.
void SetNextStatusPrompt (int NewStatus)
 Set the Next Available Status Level in the Increment Button.
void PostStatus (void)
 Get Current Status from User Inface, Save to Database & Forward.

Private Attributes

Ui::MainWindow * ui
 Pointer to the Main Window.
QString project_ident_prefix
 The text prefix of the Project Identifier.
uint project_suffix_size
 Number of digits in the Project Idenifier.
int project_index
 The Database Table index of the Project.

Detailed Description

Definition at line 15 of file projectstatus.h.

Constructor & Destructor Documentation

◆ ProjectStatus()

ProjectStatus::ProjectStatus ( Ui::MainWindow * UI_Window)

ProjectStatus Constructor.

Parameters
UI_WindowPointer to the Main Window

Definition at line 6 of file projectstatus.cpp.

7{
8 ui = UI_Window;
9
10 QObject::connect(ui->ProjectStatus, SIGNAL(currentIndexChanged(int)), this, SLOT(StatusChanged(int)));
11 QObject::connect(ui->IncrementStatus, SIGNAL(pressed()), this, SLOT(DoIncrement()));
12 QObject::connect( ui->EnableStatusEditing, SIGNAL( stateChanged(int) ), this, SLOT( SetStatusEditing(int)));
13 QObject::connect(ui->SetStatusDateNow, SIGNAL(pressed()), this, SLOT(DoStatusDateNow()));
14}
void StatusChanged(int StatusIndex)
When Status Changes Update the Next Status Level Button.
void DoStatusDateNow(void)
Set the Status Date as the current DateTime.
void SetStatusEditing(int EditStatus)
Turn Custom Status Setting On or Off.
Ui::MainWindow * ui
Pointer to the Main Window.
void DoIncrement(void)
Increment the Project's Status to the Next Level.

References DoIncrement(), DoStatusDateNow(), SetStatusEditing(), StatusChanged(), and ui.

Here is the call graph for this function:

Member Function Documentation

◆ DoClear

void ProjectStatus::DoClear ( void )
slot

Reset the Uer Interface Status Display.

Definition at line 110 of file projectstatus.cpp.

111{
112 LoadStatus();
113 ui->IncrementStatus->setText(QString("Set Status to %1").arg(ui->ProjectStatus->itemText(1)));
114}
void LoadStatus(void)
Load Status definitions from the Database.

References LoadStatus(), and ui.

Here is the call graph for this function:

◆ DoIncrement

void ProjectStatus::DoIncrement ( void )
privateslot

Increment the Project's Status to the Next Level.

Definition at line 78 of file projectstatus.cpp.

79{
80 int current_index = ui->ProjectStatus->currentIndex();
81 int top_count = ui->ProjectStatus->count() - 1;
82
83 if (current_index != top_count)
84 {
85 ui->ProjectStatus->setCurrentIndex(current_index + 1);
86 SetNextStatusPrompt(current_index + 1);
87 }
88}
void SetNextStatusPrompt(int NewStatus)
Set the Next Available Status Level in the Increment Button.

References SetNextStatusPrompt(), and ui.

Referenced by ProjectStatus().

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

◆ DoStatusDateNow

void ProjectStatus::DoStatusDateNow ( void )
privateslot

Set the Status Date as the current DateTime.

Definition at line 105 of file projectstatus.cpp.

106{
107 ui->ProjectStatusDate->setDateTime(QDateTime::currentDateTime());
108}

References ui.

Referenced by ProjectStatus().

Here is the caller graph for this function:

◆ LoadStatus()

void ProjectStatus::LoadStatus ( void )

Load Status definitions from the Database.

Definition at line 16 of file projectstatus.cpp.

17{
18 // Clear the Development Family List
19 ui->ProjectStatus->clear();
20 // Get a List of the Development Families from Database
21 QSqlQuery status_query( "select proj_status_index, status_name from project_status order by proj_status_index" );
22
23 // Step through the Results
24 int row_index = 0;
25 while ( status_query.next() )
26 {
27 int status_index = status_query.value(0).toInt();
28 QString status_entry = status_query.value(1).toString();
29 ui->ProjectStatus->addItem( status_entry, status_index );
30 row_index++;
31 }
32 if (row_index == 0)
33 {
34 LogAdd(LOG_ERROR, MODE_DATABASE, "Status List loading FAILED.");
35 }
36 else
37 {
38 LogAdd(LOG_DEBUG, MODE_DATABASE, QString("Status List loaded %1 item.").arg(QString::number(row_index)));
39 }
40}
void LogAdd(LOGGING_SEVERITY Severity, LOGGING_MODE Mode, QString Message)
Add a Log Entry.
@ LOG_ERROR
Definition logger.h:52
@ LOG_DEBUG
Definition logger.h:56
@ MODE_DATABASE
Definition logger.h:35

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

Referenced by DoClear().

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

◆ LogAdd()

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

Add a Log Entry.

Parameters
SeveritySeverity of the Logged Event
ModePart of the Program being Logged
MessageDescription of the Log Event

Definition at line 42 of file projectstatus.cpp.

43{
44 REMOTE_LOG_ENTRY log_entry;
45 log_entry.Severity = Severity;
46 log_entry.Mode = Mode;
47 log_entry.Message = Message;
48 emit SendLogEntry(log_entry);
49}
void SendLogEntry(REMOTE_LOG_ENTRY LogEntry)
Send Log Entry to the Log \LogEntry Structure holding Log information.
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 LoadStatus(), PostStatus(), StatusChanged(), and TriggerSendStatus().

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

◆ PostStatus()

void ProjectStatus::PostStatus ( void )
private

Get Current Status from User Inface, Save to Database & Forward.

Definition at line 116 of file projectstatus.cpp.

117{
118 // Get the Status Information
119 STATUS_INFO status_info;
120 status_info.StatusName = ui->ProjectStatus->currentText();
121 status_info.StatusIndex = ui->ProjectStatus->currentIndex() + 1;
122 status_info.StatusDateTime = ui->ProjectStatusDate->dateTime();
123 status_info.StatusDateTimeString = ui->ProjectStatusDate->dateTime().toString("hh:mm:ss dd-MMM-yyyy");
124 //status_info.ProjectIndex = project_index;
125
126 // Update the Project in the Database
127 QString query_string = QString("update project set project_status = %1, status_date = '%2' where project_index = %3").
128 arg(QString::number(status_info.StatusIndex), status_info.StatusDateTime.toString(DATETIME_DATABASE_FORMAT), QString::number(project_index));
129
130 QSqlQuery update_status_query;
131 bool result = update_status_query.exec(query_string);
132 if (result)
133 {
134 LogAdd(LOG_DEBUG, MODE_DATABASE, QString("Status Update to %1").arg(status_info.StatusName));
135 emit SendStatusInfo(status_info);
136 }
137 else
138 {
139 LogAdd(LOG_ERROR, MODE_DATABASE, QString("Unable to update Status to %1").arg(status_info.StatusName));
140 }
141}
void SendStatusInfo(STATUS_INFO StatusInfo)
Emit the current Status Information Structure.
int project_index
The Database Table index of the Project.
#define DATETIME_DATABASE_FORMAT
text format of the DateTime used by the Database.
QString StatusDateTimeString
QDateTime StatusDateTime

References DATETIME_DATABASE_FORMAT, LOG_DEBUG, LOG_ERROR, LogAdd(), MODE_DATABASE, project_index, SendStatusInfo(), STATUS_INFO::StatusDateTime, STATUS_INFO::StatusDateTimeString, STATUS_INFO::StatusIndex, STATUS_INFO::StatusName, and ui.

Referenced by SetNextStatusPrompt().

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

◆ ReadProjectInfo

void ProjectStatus::ReadProjectInfo ( PROJECT_INFORMATION * Info)
slot

Read teh Status from the Project Info to the User Interface.

Parameters
InfoPointer to ProjectInformation

Definition at line 143 of file projectstatus.cpp.

144{
146 ui->ProjectStatus->setCurrentIndex(Info->StatusInfo.StatusIndex - 1);
147 ui->ProjectStatusDate->setDateTime(Info->StatusInfo.StatusDateTime);
148}
PROJECT_DESCRIPTION ProjectDesc

References project_index, PROJECT_INFORMATION::ProjectDesc, PROJECT_DESCRIPTION::ProjectIndex, STATUS_INFO::StatusDateTime, STATUS_INFO::StatusIndex, PROJECT_INFORMATION::StatusInfo, and ui.

◆ SendLogEntry

void ProjectStatus::SendLogEntry ( REMOTE_LOG_ENTRY LogEntry)
signal

Send Log Entry to the Log \LogEntry Structure holding Log information.

Referenced by LogAdd().

Here is the caller graph for this function:

◆ SendStatus

void ProjectStatus::SendStatus ( int StatusIndex)
signal

Emit the current Status Database Index.

Parameters
StatusIndexDatabase Index of current Status Level

Referenced by TriggerSendStatus().

Here is the caller graph for this function:

◆ SendStatusInfo

void ProjectStatus::SendStatusInfo ( STATUS_INFO StatusInfo)
signal

Emit the current Status Information Structure.

Parameters
StatusInfoStatus Inforamtion Structure

Referenced by PostStatus().

Here is the caller graph for this function:

◆ SetNextStatusPrompt()

void ProjectStatus::SetNextStatusPrompt ( int NewStatus)
private

Set the Next Available Status Level in the Increment Button.

Parameters
Thejust set Status Level

Definition at line 57 of file projectstatus.cpp.

58{
59 int current_index = ui->ProjectStatus->currentIndex();
60 int top_item = ui->ProjectStatus->count();
61
62 // Ignore the Status Selection that Occurs at Load Time
63 if (top_item == 1) return;
64
65 // Set the text for the Status Increment Button, but Not if it is "Inactive"
66 if (current_index == (top_item - 1))
67 {
68 ui->IncrementStatus->setText("No More Levels");
69 }
70 else
71 {
72 ui->IncrementStatus->setText(QString("Set Status to %1").arg(ui->ProjectStatus->itemText(NewStatus+1)));
73 if (!ui->EnableStatusEditing->isChecked()) ui->ProjectStatusDate->setDateTime(QDateTime::currentDateTime());
74 PostStatus();
75 }
76}
void PostStatus(void)
Get Current Status from User Inface, Save to Database & Forward.

References PostStatus(), and ui.

Referenced by DoIncrement(), and StatusChanged().

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

◆ SetStatusEditing

void ProjectStatus::SetStatusEditing ( int EditStatus)
privateslot

Turn Custom Status Setting On or Off.

Parameters
EditStatusOn (true) or Off (false)

Definition at line 90 of file projectstatus.cpp.

91{
92 bool is_checked = (bool)EditStatus;
93
94 ui->ProjectStatus->setEnabled(is_checked);
95 ui->ProjectStatusDate->setEnabled(is_checked);
96 ui->SetStatusDateNow->setEnabled(is_checked);
97}

References ui.

Referenced by ProjectStatus().

Here is the caller graph for this function:

◆ StatusChanged

void ProjectStatus::StatusChanged ( int StatusIndex)
privateslot

When Status Changes Update the Next Status Level Button.

Parameters
StatusIndexThe New Status Level

Definition at line 51 of file projectstatus.cpp.

52{
53 SetNextStatusPrompt(NewStatus);
54 LogAdd(LOG_DEBUG, MODE_OPERATOR, QString("Project Status Changed to %1").arg(ui->ProjectStatus->itemText(NewStatus)));
55}
@ MODE_OPERATOR
Definition logger.h:34

References LOG_DEBUG, LogAdd(), MODE_OPERATOR, SetNextStatusPrompt(), and ui.

Referenced by ProjectStatus().

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

◆ TriggerSendStatus

void ProjectStatus::TriggerSendStatus ( void )
slot

Respond to Request for Status by Sending it.

Definition at line 99 of file projectstatus.cpp.

100{
101 LogAdd(LOG_DEBUG, MODE_OPERATOR, "Request to Send Status Received.");
102 emit SendStatus(ui->ProjectStatus->currentIndex());
103}
void SendStatus(int StatusIndex)
Emit the current Status Database Index.

References LOG_DEBUG, LogAdd(), MODE_OPERATOR, SendStatus(), and ui.

Here is the call graph for this function:

Field Documentation

◆ project_ident_prefix

QString ProjectStatus::project_ident_prefix
private

The text prefix of the Project Identifier.

Definition at line 66 of file projectstatus.h.

◆ project_index

int ProjectStatus::project_index
private

The Database Table index of the Project.

Definition at line 78 of file projectstatus.h.

Referenced by PostStatus(), and ReadProjectInfo().

◆ project_suffix_size

uint ProjectStatus::project_suffix_size
private

Number of digits in the Project Idenifier.

Definition at line 72 of file projectstatus.h.

◆ ui

Ui::MainWindow* ProjectStatus::ui
private

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