Skip to content

Commit

Permalink
Merge pull request #72 from introlab/dev
Browse files Browse the repository at this point in the history
Main merge for 1.1.1 release
  • Loading branch information
SBriere authored May 3, 2022
2 parents 9892d56 + 31cd9ae commit 9374ec8
Show file tree
Hide file tree
Showing 41 changed files with 5,637 additions and 1,432 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cmake_policy(SET CMP0043 NEW)
# Software version
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
SET(CPACK_PACKAGE_VERSION_PATCH "1")
SET(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
add_definitions(-DOPENTERAPLUS_VERSION="${CPACK_PACKAGE_VERSION}" )
add_definitions(-DOPENTERAPLUS_VERSION_MAJOR="${CPACK_PACKAGE_VERSION_MAJOR}" )
Expand Down
2 changes: 2 additions & 0 deletions client/resources/TeraClient.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,7 @@
<file>icons/project_new.png</file>
<file>translations/openteraplus_en.qm</file>
<file>translations/openteraplus_fr.qm</file>
<file>icons/test_type.png</file>
<file>icons/qr.png</file>
</qresource>
</RCC>
Binary file added client/resources/icons/qr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified client/resources/icons/test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/resources/icons/test_type.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,609 changes: 940 additions & 669 deletions client/resources/translations/openteraplus_en.ts

Large diffs are not rendered by default.

1,597 changes: 929 additions & 668 deletions client/resources/translations/openteraplus_fr.ts

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions client/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ set(headers
editors/UserGroupWidget.h
editors/ServiceWidget.h
editors/ServiceConfigWidget.h
editors/TestTypeWidget.h
# Wizards
wizards/UserWizard.h
wizards/BaseWizard.h
Expand Down Expand Up @@ -98,6 +99,8 @@ set(headers
widgets/DashboardWidget.h
widgets/AssetsWidget.h
widgets/ResultMessageWidget.h
widgets/TestsWidget.h
widgets/QRWidget.h
# Kits
kit/KitConfigDialog.h
kit/KitConfigManager.h
Expand Down Expand Up @@ -160,6 +163,7 @@ set(srcs
editors/UserGroupWidget.cpp
editors/ServiceWidget.cpp
editors/ServiceConfigWidget.cpp
editors/TestTypeWidget.cpp
# Wizards
wizards/UserWizard.cpp
wizards/BaseWizard.cpp
Expand Down Expand Up @@ -193,6 +197,8 @@ set(srcs
widgets/DashboardWidget.cpp
widgets/AssetsWidget.cpp
widgets/ResultMessageWidget.cpp
widgets/TestsWidget.cpp
widgets/QRWidget.cpp
# Kits
kit/KitConfigDialog.cpp
kit/KitConfigManager.cpp
Expand Down Expand Up @@ -235,6 +241,7 @@ SET(uis
editors/UserGroupWidget.ui
editors/ServiceWidget.ui
editors/ServiceConfigWidget.ui
editors/TestTypeWidget.ui
# Services
services/VideoRehabService/VideoRehabWidget.ui
services/VideoRehabService/VideoRehabSetupWidget.ui
Expand All @@ -252,6 +259,7 @@ SET(uis
widgets/DashboardWidget.ui
widgets/AssetsWidget.ui
widgets/ResultMessageWidget.ui
widgets/TestsWidget.ui
# Kits
kit/KitConfigDialog.ui
kit/KitInSessionDialog.ui
Expand Down
3 changes: 0 additions & 3 deletions client/src/dialogs/LoginDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ QGroupBox#grpLogos{background-color:rgba(200,200,200,200);}
<font>
<family>10px Arial</family>
<pointsize>10</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
Expand Down Expand Up @@ -179,7 +178,6 @@ QGroupBox#grpLogos{background-color:rgba(200,200,200,200);}
<font>
<family>10px Arial</family>
<pointsize>10</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
Expand All @@ -195,7 +193,6 @@ QGroupBox#grpLogos{background-color:rgba(200,200,200,200);}
<font>
<family>10px Arial</family>
<pointsize>10</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
Expand Down
11 changes: 9 additions & 2 deletions client/src/editors/DataListWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "editors/UserGroupWidget.h"
#include "editors/ServiceWidget.h"
#include "editors/ServiceConfigWidget.h"
#include "editors/TestTypeWidget.h"

#include "wizards/UserWizard.h"

Expand Down Expand Up @@ -85,9 +86,13 @@ void DataListWidget::updateDataInList(TeraData* data, bool select_item){
item = getItemForData(data);

// If we don't, create a new one.
QString data_name = tr("Inconnu");
if (data->hasNameField())
data_name = data->getName();
if (!item){
// Check if we have a new item that we could match
item = new QListWidgetItem(data->getName(),ui->lstData);

item = new QListWidgetItem(data_name, ui->lstData);
m_datamap[data] = item;

}else{
Expand All @@ -97,7 +102,6 @@ void DataListWidget::updateDataInList(TeraData* data, bool select_item){
}

item->setIcon(QIcon(TeraData::getIconFilenameForDataType(data->getDataType())));
QString data_name = data->getName();
// If a parent is specified, append the parent name
if (data->hasFieldName(data->getDataTypeName(data->getDataType()) + "_parent"))
data_name = "[" + data->getFieldValue(data->getDataTypeName(data->getDataType()) + "_parent").toString() + "]\n" + data_name;
Expand Down Expand Up @@ -240,6 +244,9 @@ void DataListWidget::showEditor(TeraData *data)
case TERADATA_SERVICE:
m_editor = new ServiceWidget(m_comManager, data);
break;
case TERADATA_TESTTYPE:
m_editor = new TestTypeWidget(m_comManager, data);
break;
default:
LOG_ERROR("Unhandled datatype for editor: " + TeraData::getDataTypeName(data->getDataType()), "DataListWidget::showEditor()");
return;
Expand Down
81 changes: 78 additions & 3 deletions client/src/editors/DeviceWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void DeviceWidget::saveData(bool signal)
// ... and sites
QJsonArray sites = getSelectedSitesAsJsonArray();
if (!sites.isEmpty()){
base_st.insert("device_sites", projects);
base_st.insert("device_sites", sites);
base_obj.insert("device", base_st);
device_data.setObject(base_obj);
}
Expand Down Expand Up @@ -122,9 +122,44 @@ void DeviceWidget::updateFieldsValue()

bool DeviceWidget::validateData()
{
if (dataIsNew())
if (!validateSitesProjects())
return false;

return ui->wdgDevice->validateFormData();
}

bool DeviceWidget::validateSitesProjects()
{
if (!m_comManager->isCurrentUserSuperAdmin()){
bool at_least_one_selected = false;
// Sites
for (QTreeWidgetItem* item: qAsConst(m_treeSites_items)){
if (item->checkState(0) == Qt::Checked){
at_least_one_selected = true;
break;
}
}

// Projects
for (QTreeWidgetItem* item: qAsConst(m_treeProjects_items)){
if (item->checkState(0) == Qt::Checked){
at_least_one_selected = true;
break;
}
}


if (!at_least_one_selected){
// Warning: that user not having any site/projects meaning that it will be not available to the current user
GlobalMessageBox msgbox;
msgbox.showError(tr("Attention"), tr("Aucun site / project n'a été spécifié.\nVous devez spécifier au moins un site / projet"));
return false;
}
}
return true;
}

void DeviceWidget::connectSignals()
{
connect(m_comManager, &ComManager::formReceived, this, &DeviceWidget::processFormsReply);
Expand Down Expand Up @@ -412,6 +447,9 @@ void DeviceWidget::processProjectsReply(QList<TeraData> projects)

void DeviceWidget::btnSaveSites_clicked()
{
if (!validateSitesProjects())
return;

bool has_removed = false;

for(QTreeWidgetItem* item: qAsConst(m_treeSites_items)){
Expand Down Expand Up @@ -439,13 +477,14 @@ void DeviceWidget::btnSaveSites_clicked()

}

if (m_comManager->isCurrentUserSuperAdmin()){
postDeviceSites();
/*if (m_comManager->isCurrentUserSuperAdmin()){
// Save device sites
postDeviceSites();
}else{
// Not super admin - save device projects
postDeviceProjects();
}
}*/

}

Expand Down Expand Up @@ -592,3 +631,39 @@ void DeviceWidget::on_btnRemoveParticipant_clicked()
deleteDataRequest(WEB_DEVICEPARTICIPANTINFO_PATH, id_device_participant);
}
}

void DeviceWidget::on_treeSites_itemChanged(QTreeWidgetItem *item, int column)
{
Q_UNUSED(column)
static bool updating = false;

// Lock to prevent recursive updates
if (updating)
return;

updating = true;
// Uncheck all projects if site was unselected
if (std::find(m_treeSites_items.cbegin(), m_treeSites_items.cend(), item) != m_treeSites_items.cend()){
if (item->checkState(0) == Qt::Unchecked){
for (int i=0; i<item->childCount(); i++){
item->child(i)->setCheckState(0, Qt::Unchecked);
}
}
}

if (std::find(m_treeProjects_items.cbegin(), m_treeProjects_items.cend(), item) != m_treeProjects_items.cend()){
// We have a project - check if we need to check the parent (site)
QTreeWidgetItem* site = item->parent();
if (site){
for(int i=0; i<site->childCount(); i++){
if (site->child(i)->checkState(0) == Qt::Checked){
site->setCheckState(0, Qt::Checked);
updating = false;
return;
}
}
}
}
updating = false;
}

2 changes: 2 additions & 0 deletions client/src/editors/DeviceWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class DeviceWidget : public DataEditorWidget
void updateControlsState();
void updateFieldsValue();
bool validateData();
bool validateSitesProjects();

void connectSignals();

Expand Down Expand Up @@ -65,6 +66,7 @@ private slots:
void on_tabNav_currentChanged(int index);
void on_lstParticipants_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
void on_btnRemoveParticipant_clicked();
void on_treeSites_itemChanged(QTreeWidgetItem *item, int column);
};

#endif // DEVICEWIDGET_H
Loading

0 comments on commit 9374ec8

Please sign in to comment.