[qet] qet/qet: [5605] Enable the possibility to define the path of user tbt template |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 5605
Author: scorpio810
Date: 2018-11-25 10:55:11 +0100 (Sun, 25 Nov 2018)
Log Message:
-----------
Enable the possibility to define the path of user tbt template
collection.
Modified Paths:
--------------
trunk/sources/qetapp.cpp
trunk/sources/qetapp.h
trunk/sources/ui/configpage/generalconfigurationpage.cpp
trunk/sources/ui/configpage/generalconfigurationpage.h
trunk/sources/ui/configpage/generalconfigurationpage.ui
Modified: trunk/sources/qetapp.cpp
===================================================================
--- trunk/sources/qetapp.cpp 2018-11-24 21:26:24 UTC (rev 5604)
+++ trunk/sources/qetapp.cpp 2018-11-25 09:55:11 UTC (rev 5605)
@@ -61,6 +61,7 @@
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 @@
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/");
}
Modified: trunk/sources/qetapp.h
===================================================================
--- trunk/sources/qetapp.h 2018-11-24 21:26:24 UTC (rev 5604)
+++ trunk/sources/qetapp.h 2018-11-25 09:55:11 UTC (rev 5605)
@@ -189,6 +189,7 @@
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);
Modified: trunk/sources/ui/configpage/generalconfigurationpage.cpp
===================================================================
--- trunk/sources/ui/configpage/generalconfigurationpage.cpp 2018-11-24 21:26:24 UTC (rev 5604)
+++ trunk/sources/ui/configpage/generalconfigurationpage.cpp 2018-11-25 09:55:11 UTC (rev 5605)
@@ -88,6 +88,16 @@
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 @@
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_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);
+ }
+ }
+}
+
+
Modified: trunk/sources/ui/configpage/generalconfigurationpage.h
===================================================================
--- trunk/sources/ui/configpage/generalconfigurationpage.h 2018-11-24 21:26:24 UTC (rev 5604)
+++ trunk/sources/ui/configpage/generalconfigurationpage.h 2018-11-25 09:55:11 UTC (rev 5605)
@@ -43,7 +43,13 @@
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();
Modified: trunk/sources/ui/configpage/generalconfigurationpage.ui
===================================================================
--- trunk/sources/ui/configpage/generalconfigurationpage.ui 2018-11-24 21:26:24 UTC (rev 5604)
+++ trunk/sources/ui/configpage/generalconfigurationpage.ui 2018-11-25 09:55:11 UTC (rev 5605)
@@ -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,7 +238,7 @@
<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>
@@ -245,7 +245,7 @@
</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,7 +259,7 @@
</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>
@@ -266,7 +266,7 @@
</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,7 +280,21 @@
</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>
@@ -287,6 +301,13 @@
</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 @@
</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>