6LicenceManager::LicenceManager::LicenceManager(Ui::MainWindow* UI_Window)
11 QObject::connect(ui->UpdateQtLicence, SIGNAL(pressed()),
this, SLOT(SaveQtLicence()));
12 QObject::connect(ui->SoftwareLicenceList, SIGNAL(currentIndexChanged(
int)),
this, SLOT(SetSoftwareLicence(
int)));
13 QObject::connect(ui->HardwareLicenceList, SIGNAL(currentIndexChanged(
int)),
this, SLOT(SetHardwareLicence(
int)));
14 QObject::connect(ui->DocumentationLicenceList, SIGNAL(currentIndexChanged(
int)),
this, SLOT(SetDocumentationLicence(
int)));
19 QSqlDatabase db = QSqlDatabase::database();
22 ui->SoftwareLicenceList->clear();
25 QSqlQuery soft_licence_query(
"select licence_index, short_name from licence where licence_type = 1 or licence_type = 3 order by short_name" );
29 while ( soft_licence_query.next() )
31 int licence_index = soft_licence_query.value(0).toInt();
32 QString software_entry = soft_licence_query.value(1).toString();
33 ui->SoftwareLicenceList->addItem( software_entry, licence_index );
39 ui->DocumentationLicenceList->clear();
42 QSqlQuery doc_licence_query(
"select licence_index, short_name from licence where licence_type = 1 or licence_type = 2 order by short_name" );
46 while ( doc_licence_query.next() )
48 int licence_index = doc_licence_query.value(0).toInt();
49 QString doc_licence_entry = doc_licence_query.value(1).toString();
50 ui->DocumentationLicenceList->addItem( doc_licence_entry, licence_index );
56 ui->HardwareLicenceList->clear();
59 QSqlQuery hardware_licence_query(
"select licence_index, short_name from licence where licence_type = 1 or licence_type = 4 order by short_name" );
63 while ( hardware_licence_query.next() )
65 int licence_index = hardware_licence_query.value(0).toInt();
66 QString hardware_entry = hardware_licence_query.value(1).toString();
67 ui->HardwareLicenceList->addItem( hardware_entry, licence_index );
73 ui->QtLicenceList->clear();
74 ui->QtLicenceList->addItems({QString(
"Community"), QString(
"Professional"), QString(
"Enterprise")});
95 QSettings settings(
"brigadoon/netprojectmanager" );
96 ui->QtLicenceList->setCurrentText(settings.value(
"Qt/Licence",
"Community").toString());
103 QSettings settings(
"brigadoon/netprojectmanager" );
104 settings.setValue(
"Qt/Licence",
ui->QtLicenceList->currentText());
112 log_entry.
Mode = Mode;
120 ui->SoftwareLicenceList->setEnabled(
true);
121 ui->DocumentationLicenceList->setEnabled(
true);
122 ui->HardwareLicenceList->setEnabled(
true);
124 QSqlDatabase db = QSqlDatabase::database();
127 QSqlQuery tool_restriction_query( QString(
"select software_licence_restriction, documentation_licence_restriction, hardware_licence_restriction from compiler_instance where compiler_instance_index = %1").arg(QString::number(ToolIndex+1)));
131 int software_restriction;
int documentation_restriction;
int hardware_restriction;
132 while ( tool_restriction_query.next() )
134 software_restriction = tool_restriction_query.value(0).toInt();
135 documentation_restriction = tool_restriction_query.value(1).toInt();
136 hardware_restriction = tool_restriction_query.value(2).toInt();
144 bool do_software_restriction =
true;
147 if ((ToolIndex == 2) &&(
ui->QtLicenceList->currentIndex() != 0)) do_software_restriction =
false;
153 bool do_documentation_restriction =
false;
162 bool do_hardware_restriction =
false;
174 QString licence_name;
175 bool licence_enabled =
true;
178 if (SoftwareRestriction != 0)
180 QSqlDatabase db = QSqlDatabase::database();
182 QSqlQuery licence_restriction_query(QString(
"select short_name from licence where licence_index = %1").arg(QString::number(SoftwareRestriction)));
183 while ( licence_restriction_query.next() )
185 licence_name = licence_restriction_query.value(0).toString();
191 ui->SoftwareLicenceList->setCurrentText(licence_name);
192 licence_enabled =
false;
195 ui->SoftwareLicenceList->setEnabled(licence_enabled);
200 bool licence_enabled =
true;
203 if (DocumentationRestriction != 0)
205 QString licence_name;
206 QSqlDatabase db = QSqlDatabase::database();
208 QSqlQuery licence_restriction_query(QString(
"select short_name from licence where licence_index = %1").arg(QString::number(DocumentationRestriction)));
209 while ( licence_restriction_query.next() )
211 licence_name = licence_restriction_query.value(0).toString();
217 ui->DocumentationLicenceList->setCurrentText(licence_name);
220 ui->DocumentationLicenceList->setEnabled(licence_enabled);
225 bool licence_enabled =
true;
228 if (HardwareRestriction != 0)
230 QString licence_name;
231 QSqlDatabase db = QSqlDatabase::database();
233 QSqlQuery licence_restriction_query(QString(
"select short_name from licence where licence_index = %1").arg(QString::number(HardwareRestriction)));
234 while ( licence_restriction_query.next() )
236 licence_name = licence_restriction_query.value(0).toString();
242 ui->HardwareLicenceList->setCurrentText(licence_name);
245 ui->HardwareLicenceList->setEnabled(licence_enabled);
266 uint licence_index = 0;
267 QSqlQuery licence_index_query( QString(
"select licence_index from licence where short_name = '%1'").arg(LicenceText));
268 while ( licence_index_query.next() )
270 licence_index = licence_index_query.value(0).toInt();
272 return(licence_index);
288 QString LicenceName =
ui->SoftwareLicenceList->itemText(LicenceIndex);
294 QString LicenceName =
ui->HardwareLicenceList->itemText(LicenceIndex);
300 QString LicenceName =
ui->DocumentationLicenceList->itemText(LicenceIndex);
void SetSoftwareLicence(int LicenceIndex)
Set the Software Licence.
void SendLogEntry(REMOTE_LOG_ENTRY LogEntry)
Send Log Entry to the Log \LogEntry Structure holding Log information.
void ReadPrimaryTool(int ToolIndex)
read Primary Tool & Apply any licence Restrictions
void LoadLicences(void)
Load the Licence Data from the Database.
Ui::MainWindow * ui
Pointer to the Main Window.
void LogAdd(LOGGING_SEVERITY Severity, LOGGING_MODE Mode, const QString Message)
Add a Log Entry.
void SaveQtLicence(void)
Save the Default Qt Licence to settings.
void UpdateHardwareLicence(QString LicenceName)
Emits the Text Name of the Hardware Lidence.
void UpdateDocumentationLicence(QString LicenceName)
Emits the Text Name of the Documentation Lidence.
void TriggerSendLicence(void)
Trigger to send out the Licence states.
uint GetLicenceIndex(QString LicenceText)
Find the Licence Index from the Licence text.
void SendStatusMessage(QString Type, int Counter)
Send the Type of Licence and the number licences loaded.
void UpdateSoftwareLicence(QString LicenceName)
Emits the Text Name of the Software Lidence.
void SetHardwareLicence(int LicenceIndex)
Set the Hardware Licence.
void WriteLicenceState(void)
Read the Current Lilcence Stae on Display & Send out.
void ProcessSoftwareRestriction(int DocumentationRestriction)
Use the Soft Restrictions to limit the possible licence selections.
void SetDocumentationLicence(int LicenceIndex)
Set the Documentation Licence.
void ProcessDocumentationRestriction(int DocumentationRestriction)
Use the Documenrtation Restrictions to limit the possible licence selections.
void LoadQtLicence(void)
Load the Qt Licence from settings.
void ProcessHardwareRestriction(int HardwareRestriction)
Use the Hardware Restrictions to limit the possible licence selections.
void DoClear(void)
Resest the Licences fro the Database.
void ReadLicenceState(LICENCE_STATE LicenceState)
process the Licence state including any restrictions
void SendLicenceState(LICENCE_STATE LicenceState)
Send the State of the Licences.
Class Controlling the project's Licences.
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.
Assigned Software, Hardware and COgumenttaion Licences.
uint DocumentationLicence
LOGGING_SEVERITY Severity