mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
let user define the file system path of the common and custom elements collections
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5452 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -59,6 +59,7 @@ RecentFiles *QETApp::m_projects_recent_files = nullptr;
|
|||||||
RecentFiles *QETApp::m_elements_recent_files = nullptr;
|
RecentFiles *QETApp::m_elements_recent_files = nullptr;
|
||||||
TitleBlockTemplate *QETApp::default_titleblock_template_ = nullptr;
|
TitleBlockTemplate *QETApp::default_titleblock_template_ = nullptr;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@param argc Nombre d'arguments passes a l'application
|
@param argc Nombre d'arguments passes a l'application
|
||||||
@@ -455,12 +456,23 @@ QString QETApp::userName() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Renvoie le dossier des elements communs, c-a-d le chemin du dossier dans
|
* @brief QETApp::commonElementsDir
|
||||||
lequel QET doit chercher les definitions XML des elements de la collection QET.
|
* @return the dir path of the common elements collection.
|
||||||
@return Le chemin du dossier des elements communs
|
*/
|
||||||
*/
|
QString QETApp::commonElementsDir()
|
||||||
QString QETApp::commonElementsDir() {
|
{
|
||||||
|
QSettings settings;
|
||||||
|
QString path = settings.value("elements-collections/common-collection-path", "default").toString();
|
||||||
|
if (path != "default" && !path.isEmpty())
|
||||||
|
{
|
||||||
|
QDir dir(path);
|
||||||
|
if (dir.exists()) {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
||||||
if (common_elements_dir != QString()) return(common_elements_dir);
|
if (common_elements_dir != QString()) return(common_elements_dir);
|
||||||
#endif
|
#endif
|
||||||
@@ -479,12 +491,21 @@ QString QETApp::commonElementsDir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Renvoie le dossier des elements de l'utilisateur, c-a-d le chemin du dossier
|
* @brief QETApp::customElementsDir
|
||||||
dans lequel QET chercher les definitions XML des elements propres a
|
* @return the dir path of user elements collection
|
||||||
l'utilisateur.
|
*/
|
||||||
@return Le chemin du dossier des elements persos
|
QString QETApp::customElementsDir()
|
||||||
*/
|
{
|
||||||
QString QETApp::customElementsDir() {
|
QSettings settings;
|
||||||
|
QString path = settings.value("elements-collections/custom-collection-path", "default").toString();
|
||||||
|
if (path != "default" && !path.isEmpty())
|
||||||
|
{
|
||||||
|
QDir dir(path);
|
||||||
|
if (dir.exists()) {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return(configDir() + "elements/");
|
return(configDir() + "elements/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,24 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
|||||||
ui->m_highlight_integrated_elements->setChecked(settings.value("diagrameditor/highlight-integrated-elements", true).toBool());
|
ui->m_highlight_integrated_elements->setChecked(settings.value("diagrameditor/highlight-integrated-elements", true).toBool());
|
||||||
ui->m_default_elements_info->setPlainText(settings.value("elementeditor/default-informations", "").toString());
|
ui->m_default_elements_info->setPlainText(settings.value("elementeditor/default-informations", "").toString());
|
||||||
|
|
||||||
|
QString path = settings.value("elements-collections/common-collection-path", "default").toString();
|
||||||
|
if (path != "default")
|
||||||
|
{
|
||||||
|
ui->m_common_elmt_path_cb->blockSignals(true);
|
||||||
|
ui->m_common_elmt_path_cb->setCurrentIndex(1);
|
||||||
|
ui->m_common_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
||||||
|
ui->m_common_elmt_path_cb->blockSignals(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
path = settings.value("elements-collections/custom-collection-path", "default").toString();
|
||||||
|
if (path != "default")
|
||||||
|
{
|
||||||
|
ui->m_custom_elmt_path_cb->blockSignals(true);
|
||||||
|
ui->m_custom_elmt_path_cb->setCurrentIndex(1);
|
||||||
|
ui->m_custom_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
||||||
|
ui->m_custom_elmt_path_cb->blockSignals(false);
|
||||||
|
}
|
||||||
|
|
||||||
fillLang();
|
fillLang();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,6 +115,28 @@ void GeneralConfigurationPage::applyConf()
|
|||||||
settings.setValue("genericpanel/folio",ui->m_use_folio_label->isChecked());
|
settings.setValue("genericpanel/folio",ui->m_use_folio_label->isChecked());
|
||||||
settings.setValue("nomenclature/terminal-exportlist",ui->m_export_terminal->isChecked());
|
settings.setValue("nomenclature/terminal-exportlist",ui->m_export_terminal->isChecked());
|
||||||
settings.setValue("diagrameditor/autosave-interval", ui->m_autosave_sb->value());
|
settings.setValue("diagrameditor/autosave-interval", ui->m_autosave_sb->value());
|
||||||
|
|
||||||
|
if (ui->m_common_elmt_path_cb->currentIndex() == 1)
|
||||||
|
{
|
||||||
|
QString path = ui->m_common_elmt_path_cb->currentText();
|
||||||
|
QDir dir(path);
|
||||||
|
settings.setValue("elements-collections/common-collection-path",
|
||||||
|
dir.exists() ? path : "default");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
settings.setValue("elements-collections/common-collection-path", "default");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ui->m_custom_elmt_path_cb->currentIndex() == 1)
|
||||||
|
{
|
||||||
|
QString path = ui->m_custom_elmt_path_cb->currentText();
|
||||||
|
QDir dir(path);
|
||||||
|
settings.setValue("elements-collections/custom-collection-path",
|
||||||
|
dir.exists() ? path : "default");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
settings.setValue("elements-collections/custom-collection-path", "default");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -202,3 +242,32 @@ void GeneralConfigurationPage::on_m_folio_list_pb_clicked()
|
|||||||
ui->m_folio_list_pb->setText(fontInfos);
|
ui->m_folio_list_pb->setText(fontInfos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
void GeneralConfigurationPage::on_m_common_elmt_path_cb_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
if (index == 1)
|
||||||
|
{
|
||||||
|
QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection commune"), QDir::homePath());
|
||||||
|
if (!path.isEmpty()) {
|
||||||
|
ui->m_common_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->m_common_elmt_path_cb->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralConfigurationPage::on_m_custom_elmt_path_cb_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
if (index == 1)
|
||||||
|
{
|
||||||
|
QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection utilisateur"), QDir::homePath());
|
||||||
|
if (!path.isEmpty()) {
|
||||||
|
ui->m_custom_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->m_custom_elmt_path_cb->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ class GeneralConfigurationPage : public ConfigPage
|
|||||||
private slots:
|
private slots:
|
||||||
void on_m_font_pb_clicked();
|
void on_m_font_pb_clicked();
|
||||||
void on_m_folio_list_pb_clicked();
|
void on_m_folio_list_pb_clicked();
|
||||||
|
void on_m_common_elmt_path_cb_currentIndexChanged(int index);
|
||||||
|
void on_m_custom_elmt_path_cb_currentIndexChanged(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void fillLang();
|
void fillLang();
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>916</width>
|
<width>827</width>
|
||||||
<height>747</height>
|
<height>779</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -44,6 +44,64 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
|
<property name="title">
|
||||||
|
<string>Collections d'éléments</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>Chemin de la collection utilisateur</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Chemin de la collection commune</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="m_common_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="1" column="1">
|
||||||
|
<widget class="QComboBox" name="m_custom_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="2" 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>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
|||||||
Reference in New Issue
Block a user