added a second user-collection

This commit is contained in:
plc-user
2023-12-09 12:02:04 +01:00
parent 457aeb6883
commit f519499a66
30 changed files with 589 additions and 335 deletions

View File

@@ -138,6 +138,15 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
ui->m_common_elmt_path_cb->blockSignals(false);
}
path = settings.value("elements-collections/company-collection-path", "default").toString();
if (path != "default")
{
ui->m_company_elmt_path_cb->blockSignals(true);
ui->m_company_elmt_path_cb->setCurrentIndex(1);
ui->m_company_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
ui->m_company_elmt_path_cb->blockSignals(false);
}
path = settings.value("elements-collections/custom-collection-path", "default").toString();
if (path != "default")
{
@@ -241,6 +250,21 @@ void GeneralConfigurationPage::applyConf()
QETApp::resetCollectionsPath();
}
path = settings.value("elements-collections/company-collection-path").toString();
if (ui->m_company_elmt_path_cb->currentIndex() == 1)
{
QString path = ui->m_company_elmt_path_cb->currentText();
QDir dir(path);
settings.setValue("elements-collections/company-collection-path",
dir.exists() ? path : "default");
}
else {
settings.setValue("elements-collections/company-collection-path", "default");
}
if (path != settings.value("elements-collections/company-collection-path").toString()) {
QETApp::resetCollectionsPath();
}
path = settings.value("elements-collections/custom-collection-path").toString();
if (ui->m_custom_elmt_path_cb->currentIndex() == 1)
{
@@ -398,6 +422,20 @@ void GeneralConfigurationPage::on_m_common_elmt_path_cb_currentIndexChanged(int
}
}
void GeneralConfigurationPage::on_m_company_elmt_path_cb_currentIndexChanged(int index)
{
if (index == 1)
{
QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection company"), QDir::homePath());
if (!path.isEmpty()) {
ui->m_company_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
}
else {
ui->m_company_elmt_path_cb->setCurrentIndex(0);
}
}
}
void GeneralConfigurationPage::on_m_custom_elmt_path_cb_currentIndexChanged(int index)
{
if (index == 1)

View File

@@ -42,6 +42,7 @@ class GeneralConfigurationPage : public ConfigPage
void on_m_font_pb_clicked();
void on_m_dyn_text_font_pb_clicked();
void on_m_common_elmt_path_cb_currentIndexChanged(int index);
void on_m_company_elmt_path_cb_currentIndexChanged(int index);
void on_m_custom_elmt_path_cb_currentIndexChanged(int index);
void on_m_custom_tbt_path_cb_currentIndexChanged(int index);
void on_m_indi_text_font_pb_clicked();

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>822</width>
<width>872</width>
<height>411</height>
</rect>
</property>
@@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
@@ -243,13 +243,34 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Répertoire de la collection company</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="m_company_elmt_path_cb">
<item>
<property name="text">
<string>Par defaut</string>
</property>
</item>
<item>
<property name="text">
<string>Parcourir...</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Répertoire de la collection utilisateur</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QComboBox" name="m_custom_elmt_path_cb">
<item>
<property name="text">
@@ -263,7 +284,14 @@
</item>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Répertoire des cartouches utilisateur</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="m_custom_tbt_path_cb">
<item>
<property name="text">
@@ -277,20 +305,13 @@
</item>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QLabel" name="label_9">
<property name="text">
<string>(Recharger les collections d'éléments pour appliquer les changements)</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Répertoire des cartouches utilisateur</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -847,9 +868,9 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_1">
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="label_1">
<property name="text">
<string>Max. parts in Element Editor List</string>
</property>

View File

@@ -419,6 +419,8 @@ void TitleBlockPropertiesWidget::updateTemplateList()
QET::QetCollection qc = tbt_c -> collection();
if (qc == QET::QetCollection::Common)
icon = QET::Icons::QETLogo;
else if (qc == QET::QetCollection::Company)
icon = QET::Icons::Company;
else if (qc == QET::QetCollection::Custom)
icon = QET::Icons::Home;
else if (qc == QET::QetCollection::Embedded)