mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02: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:
parent
d8ed6a5130
commit
a76feeef07
@ -61,6 +61,7 @@ RecentFiles *QETApp::m_elements_recent_files = nullptr;
|
||||
TitleBlockTemplate *QETApp::default_titleblock_template_ = nullptr;
|
||||
QString QETApp::m_user_common_elements_dir = QString();
|
||||
QString QETApp::m_user_custom_elements_dir = QString();
|
||||
QString QETApp::m_user_custom_tbt_dir = QString();
|
||||
QETApp *QETApp::m_qetapp = nullptr;
|
||||
|
||||
|
||||
@ -559,6 +560,27 @@ QString QETApp::commonTitleBlockTemplatesDir() {
|
||||
templates collection.
|
||||
*/
|
||||
QString QETApp::customTitleBlockTemplatesDir() {
|
||||
if (m_user_custom_tbt_dir.isEmpty())
|
||||
{
|
||||
QSettings settings;
|
||||
QString path = settings.value("elements-collections/custom-tbt-collection-path", "default").toString();
|
||||
if (path != "default" && !path.isEmpty())
|
||||
{
|
||||
QDir dir(path);
|
||||
if (dir.exists())
|
||||
{
|
||||
m_user_custom_tbt_dir = path;
|
||||
return m_user_custom_tbt_dir;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_user_custom_tbt_dir = "default";
|
||||
}
|
||||
}
|
||||
else if (m_user_custom_tbt_dir != "default") {
|
||||
return m_user_custom_tbt_dir;
|
||||
}
|
||||
|
||||
return(configDir() + "titleblocks/");
|
||||
}
|
||||
|
||||
|
@ -189,6 +189,7 @@ class QETApp : public QObject
|
||||
static TitleBlockTemplate *default_titleblock_template_;
|
||||
static QString m_user_common_elements_dir;
|
||||
static QString m_user_custom_elements_dir;
|
||||
static QString m_user_custom_tbt_dir;
|
||||
|
||||
public slots:
|
||||
void systray(QSystemTrayIcon::ActivationReason);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,6 +43,12 @@ class GeneralConfigurationPage : public ConfigPage
|
||||
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);
|
||||
void on_m_custom_tbt_path_cb_currentIndexChanged(int index);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
void fillLang();
|
||||
|
@ -41,7 +41,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
@ -238,14 +238,14 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<item row="1" 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">
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_common_elmt_path_cb">
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -259,14 +259,14 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Chemin de la collection utilisateur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="m_custom_elmt_path_cb">
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -280,13 +280,34 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="m_custom_tbt_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="4" 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>Chemin des cartouches utilisateur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -315,7 +336,14 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="m_default_elements_info"/>
|
||||
<widget class="QTextEdit" name="m_default_elements_info">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user