99#include " dialogs/GeneratePasswordDialog.h"
1010#include " dialogs/PasswordStrengthDialog.h"
1111
12+ #include " services/ActimetryService/ActimetryConfigWidget.h"
1213#include " services/DanceService/DanceConfigWidget.h"
14+ #include " services/MOVEService/MOVEConfigWidget.h"
1315
1416ParticipantWidget::ParticipantWidget (ComManager *comMan, const TeraData *data, QWidget *parent) :
1517 DataEditorWidget(comMan, data, parent),
@@ -393,14 +395,13 @@ void ParticipantWidget::updateServiceTabs()
393395 addServiceTab (service);
394396 }
395397
396- // Remove tabs not anymore present
397- /* for(QWidget* tab: std::as_const(m_services_tabs)){
398- if (!ids_service.contains(m_services_tabs.key(tab))){
399- ui->tabNav->removeTab(ui->tabNav->indexOf(tab));
400- tab->deleteLater();
401- m_services_tabs.remove(m_services_tabs.key(tab));
398+ if (m_services_tabs.count () == 0 ){
399+ // No config widget (maybe because no widget) - hide tab
400+ int indexTabServices = ui->tabNav ->indexOf (ui->tabServices );
401+ if (ui->tabNav ->isTabVisible (indexTabServices)){
402+ ui->tabNav ->setTabVisible (indexTabServices, false );
402403 }
403- }*/
404+ }
404405}
405406
406407void ParticipantWidget::addServiceTab (const TeraData &service)
@@ -411,13 +412,27 @@ void ParticipantWidget::addServiceTab(const TeraData &service)
411412
412413 QString service_key = service.getFieldValue (" service_key" ).toString ();
413414
415+ // Actimetry Service
416+ if (service_key == " ActimetryService" ) {
417+ ActimetryConfigWidget* wdg = new ActimetryConfigWidget (m_comManager, m_data->getFieldValue (" id_project" ).toInt (), m_data->getUuid (), m_data->getName ());
418+ ui->tabServicesDetails ->insertTab (0 , wdg, QIcon (" ://icons/service.png" ), service.getName ());
419+ m_services_tabs.insert (id_service, wdg);
420+ }
421+
414422 // Dance Service
415423 if (service_key == " DanceService" ){
416424 DanceConfigWidget* wdg = new DanceConfigWidget (m_comManager, m_data->getFieldValue (" id_project" ).toInt (), m_data->getUuid ());
417425 ui->tabServicesDetails ->insertTab (0 , wdg, QIcon (" ://icons/service.png" ), service.getName ());
418426 m_services_tabs.insert (id_service, wdg);
419427 }
420428
429+ // MOVE Service
430+ if (service_key == " MOVEService" ){
431+ MOVEConfigWidget* wdg = new MOVEConfigWidget (m_comManager, m_data->getFieldValue (" id_project" ).toInt (), m_data->getUuid (), m_data->getName ());
432+ ui->tabServicesDetails ->insertTab (0 , wdg, QIcon (" ://icons/service.png" ), service.getName ());
433+ m_services_tabs.insert (id_service, wdg);
434+ }
435+
421436 int indexTabServices = ui->tabNav ->indexOf (ui->tabServices );
422437 if (!ui->tabNav ->isTabVisible (indexTabServices)){
423438 ui->tabNav ->setTabVisible (indexTabServices, true );
@@ -428,8 +443,19 @@ void ParticipantWidget::addServiceTab(const TeraData &service)
428443
429444void ParticipantWidget::refreshWebAccessUrl ()
430445{
431- int index = ui->cmbServices ->currentIndex ();
432- if (index >= m_services.count () || index <0 || dataIsNew ())
446+ if (dataIsNew ())
447+ return ;
448+
449+ QString service_key = ui->cmbServices ->currentData ().toString ();
450+ int index = -1 ;
451+ for (int i=0 ; i<m_services.count (); i++){
452+ if (m_services.at (i).getFieldValue (" service_key" ).toString () == service_key){
453+ index = i;
454+ break ;
455+ }
456+ }
457+
458+ if (index < 0 )
433459 return ;
434460
435461 QString service_url = TeraData::getServiceParticipantUrl (m_services[index],
@@ -489,6 +515,9 @@ void ParticipantWidget::processSessionTypesReply(QList<TeraData> session_types)
489515 }
490516 }
491517
518+ if (ui->cmbSessionType ->count () == 0 )
519+ ui->cmbSessionType ->hide ();
520+
492521 // Query sessions for that participant
493522 if (!m_data->isNew ()){
494523 // Select current session type based on last session type used with that participant
@@ -580,14 +609,22 @@ void ParticipantWidget::processServicesReply(QList<TeraData> services, QUrlQuery
580609 bool has_email_service = false ;
581610 foreach (TeraData service, services){
582611 QString service_key = service.getFieldValue (" service_key" ).toString ();
583- if (service_key != " FileTransferService" ){
584- m_services.append (service);
585- ui->cmbServices ->addItem (service.getName (), service_key);
586- }else {
587- m_allowFileTransfers = true ; // We have a file transfer service with that project - allow uploads!
588- ui->wdgSessions ->enableFileTransfers (true );
612+ m_services.append (service);
613+
614+ // Web access combo box
615+ if (service.hasFieldName (" service_endpoint_participant" )){
616+ if (!service.getFieldValue (" service_endpoint_participant" ).isNull ()){
617+ // Ignore specific services...
618+ if (service_key != " FileTransferService" && service_key != " ActimetryService" && service_key != " EmailService" )
619+ ui->cmbServices ->addItem (service.getName (), service_key);
620+ }
589621 }
590622
623+ // Assets
624+ m_allowFileTransfers = service.getFieldValue (" service_has_assets" ).toBool (); // We have a file transfer service with that project - allow uploads!
625+ ui->wdgSessions ->enableFileTransfers (m_allowFileTransfers);
626+
627+ // Email
591628 if (service_key == " EmailService" ){
592629 has_email_service = true ;
593630 }
@@ -613,6 +650,8 @@ void ParticipantWidget::processServicesReply(QList<TeraData> services, QUrlQuery
613650 int default_index = ui->cmbServices ->findData (" VideoRehabService" );
614651 if (default_index>=0 )
615652 ui->cmbServices ->setCurrentIndex (default_index);
653+ ui->chkWebAccess ->setEnabled (ui->cmbServices ->count () > 0 );
654+ ui->chkLogin ->setEnabled (ui->cmbServices ->count () > 0 );
616655
617656 // Add specific services configuration tabs
618657 updateServiceTabs ();
@@ -1003,7 +1042,7 @@ void ParticipantWidget::on_txtUsername_textEdited(const QString ¤t)
10031042 if (current.isEmpty ()){
10041043 ui->txtUsername ->setStyleSheet (" background-color: #ffaaaa;" );
10051044 }else {
1006- ui->txtUsername ->setStyleSheet (" " );
1045+ ui->txtUsername ->setStyleSheet (" " );
10071046 }
10081047}
10091048
@@ -1030,16 +1069,16 @@ void ParticipantWidget::on_txtPassword_textEdited(const QString ¤t)
10301069 if (!m_data->getFieldValue (" participant_login_enabled" ).toBool () && ui->txtPassword ->text ().isEmpty ()){
10311070 ui->txtPassword ->setStyleSheet (" background-color: #ffaaaa;" );
10321071 }else {
1033- ui->txtPassword ->setStyleSheet (" " );
1072+ ui->txtPassword ->setStyleSheet (" " );
10341073 }
10351074
10361075 /* QString confirm_pass = ui->txtPasswordConfirm->text();
10371076 if (current != confirm_pass || ui->txtPassword->text().isEmpty()){
10381077 ui->txtPassword->setStyleSheet("background-color: #ffaaaa;");
10391078 ui->txtPasswordConfirm->setStyleSheet("background-color: #ffaaaa;");
10401079 }else{
1041- ui->txtPassword->setStyleSheet("");
1042- ui->txtPasswordConfirm->setStyleSheet("");
1080+ ui->txtPassword->setStyleSheet(" ");
1081+ ui->txtPasswordConfirm->setStyleSheet(" ");
10431082 }*/
10441083}
10451084
0 commit comments