mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +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:
@@ -61,6 +61,24 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
||||
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());
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -97,6 +115,28 @@ void GeneralConfigurationPage::applyConf()
|
||||
settings.setValue("genericpanel/folio",ui->m_use_folio_label->isChecked());
|
||||
settings.setValue("nomenclature/terminal-exportlist",ui->m_export_terminal->isChecked());
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user