mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Enable the possibility to define the path of user tbt template
collection. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5605 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -88,6 +88,16 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
||||
ui->m_custom_elmt_path_cb->blockSignals(false);
|
||||
}
|
||||
|
||||
|
||||
path = settings.value("elements-collections/custom-tbt-path", "default").toString();
|
||||
if (path != "default")
|
||||
{
|
||||
ui->m_custom_tbt_path_cb->blockSignals(true);
|
||||
ui->m_custom_tbt_path_cb->setCurrentIndex(1);
|
||||
ui->m_custom_tbt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
||||
ui->m_custom_tbt_path_cb->blockSignals(false);
|
||||
}
|
||||
|
||||
fillLang();
|
||||
}
|
||||
|
||||
@@ -157,6 +167,20 @@ void GeneralConfigurationPage::applyConf()
|
||||
if (path != settings.value("elements-collections/custom-collection-path").toString()) {
|
||||
QETApp::resetUserElementsDir();
|
||||
}
|
||||
path = settings.value("elements-collections/custom-tbt-collection-path").toString();
|
||||
if (ui->m_custom_tbt_path_cb->currentIndex() == 1)
|
||||
{
|
||||
QString path = ui->m_custom_tbt_path_cb->currentText();
|
||||
QDir dir(path);
|
||||
settings.setValue("elements-collections/custom-tbt-collection-path",
|
||||
dir.exists() ? path : "default");
|
||||
}
|
||||
else {
|
||||
settings.setValue("elements-collections/custom-tbt-collection-path", "default");
|
||||
}
|
||||
if (path != settings.value("elements-collections/custom-tbt-collection-path").toString()) {
|
||||
QETApp::resetUserElementsDir();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -317,3 +341,18 @@ void GeneralConfigurationPage::on_m_custom_elmt_path_cb_currentIndexChanged(int
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralConfigurationPage::on_m_custom_tbt_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_tbt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
||||
}
|
||||
else {
|
||||
ui->m_custom_tbt_path_cb->setCurrentIndex(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user