Merge pull request #272 from plc-user/master

added "company-collection" as second user-collection
This commit is contained in:
Laurent Trinques 2023-12-11 09:43:26 +01:00 committed by GitHub
commit 5190c0e929
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 570 additions and 328 deletions

BIN
ico/16x16/go-company.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

BIN
ico/22x22/go-company.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -51,6 +51,7 @@
<file>ico/16x16/endline-triangle.png</file>
<file>ico/16x16/folder-new.png</file>
<file>ico/16x16/folder.png</file>
<file>ico/16x16/go-company.png</file>
<file>ico/16x16/go-down.png</file>
<file>ico/16x16/go-home.png</file>
<file>ico/16x16/go-up.png</file>
@ -131,6 +132,7 @@
<file>ico/22x22/folder-delete.png</file>
<file>ico/22x22/folder-edit.png</file>
<file>ico/22x22/folder-new.png</file>
<file>ico/22x22/go-company.png</file>
<file>ico/22x22/go-down.png</file>
<file>ico/22x22/go-home.png</file>
<file>ico/22x22/go-up.png</file>

View File

@ -258,6 +258,7 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data,
@param projects : list of projects to load
*/
void ElementsCollectionModel::loadCollections(bool common_collection,
bool company_collection,
bool custom_collection,
QList<QETProject *> projects)
{
@ -265,10 +266,12 @@ void ElementsCollectionModel::loadCollections(bool common_collection,
if (common_collection)
addCommonCollection(false);
if (company_collection)
addCompanyCollection(false);
if (custom_collection)
addCustomCollection(false);
if (common_collection || custom_collection)
if (common_collection || company_collection || custom_collection)
m_items_list_to_setUp.append(items());
@ -321,22 +324,41 @@ void ElementsCollectionModel::addCommonCollection(bool set_data)
}
/**
@brief ElementsCollectionModel::addCustomCollection
Add the custom elements collection to this model
@param set_data
@brief ElementsCollectionModel::addCompanyCollection
Add the company elements collection to this model
@param set_data
*/
void ElementsCollectionModel::addCompanyCollection(bool set_data)
{
FileElementCollectionItem *feci = new FileElementCollectionItem();
if (feci->setRootPath(QETApp::companyElementsDirN(),
set_data,
m_hide_element)) {
invisibleRootItem()->appendRow(feci);
if (set_data)
feci->setUpData();
}
else
delete feci;
}
/**
@brief ElementsCollectionModel::addCustomCollection
Add the custom elements collection to this model
@param set_data
*/
void ElementsCollectionModel::addCustomCollection(bool set_data)
{
FileElementCollectionItem *feci = new FileElementCollectionItem();
if (feci->setRootPath(QETApp::customElementsDirN(),
set_data,
m_hide_element)) {
invisibleRootItem()->appendRow(feci);
if (set_data)
feci->setUpData();
}
else
delete feci;
FileElementCollectionItem *feci = new FileElementCollectionItem();
if (feci->setRootPath(QETApp::customElementsDirN(),
set_data,
m_hide_element)) {
invisibleRootItem()->appendRow(feci);
if (set_data)
feci->setUpData();
}
else
delete feci;
}
/**
@ -557,8 +579,9 @@ QModelIndex ElementsCollectionModel::indexFromLocation(
{
QList <ElementCollectionItem *> child_list;
for (int i=0 ; i<rowCount() ; i++)
for (int i=0 ; i<rowCount() ; i++){
child_list.append(static_cast<ElementCollectionItem *>(item(i)));
}
foreach(ElementCollectionItem *eci, child_list) {
@ -567,7 +590,8 @@ QModelIndex ElementsCollectionModel::indexFromLocation(
if (eci->type() == FileElementCollectionItem::Type) {
if (FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci)) {
if ( (location.isCommonCollection() && feci->isCommonCollection()) ||
(location.isCustomCollection() && !feci->isCommonCollection()) ) {
(location.isCompanyCollection() && feci->isCompanyCollection()) ||
(location.isCustomCollection() && !feci->isCommonCollection()) ) {
match_eci = feci->itemAtPath(location.collectionPath(false));
}
}

View File

@ -42,10 +42,11 @@ class ElementsCollectionModel : public QStandardItemModel
bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
void loadCollections(bool common_collection, bool custom_collection, QList<QETProject *> projects);
void loadCollections(bool common_collection, bool company_collection, bool custom_collection, QList<QETProject *> projects);
void addCommonCollection(bool set_data = true);
void addCustomCollection(bool set_data = true);
void addCommonCollection(bool set_data = true);
void addCompanyCollection(bool set_data = true);
void addCustomCollection(bool set_data = true);
void addLocation(const ElementsLocation& location);
void addProject(QETProject *project, bool set_data = true);

View File

@ -96,7 +96,7 @@ void ElementsCollectionWidget::addProject(QETProject *project)
m_progress_bar->show();
m_tree_view->setDisabled(true);
QList <QETProject *> prj; prj.append(project);
m_model->loadCollections(false,false, prj);
m_model->loadCollections(false, false, false, prj);
}
else {
m_waiting_project.append(project);
@ -387,7 +387,8 @@ void ElementsCollectionWidget::deleteElement()
if (! (loc.isElement()
&& loc.exist()
&& loc.isFileSystem()
&& loc.collectionPath().startsWith("custom://")) ) return;
&& (loc.collectionPath().startsWith("company://")
|| loc.collectionPath().startsWith("custom://"))) ) return;
if (QET::QetMessageBox::question(
this,
@ -430,7 +431,8 @@ void ElementsCollectionWidget::deleteDirectory()
if (! (loc.isDirectory()
&& loc.exist()
&& loc.isFileSystem()
&& loc.collectionPath().startsWith("custom://")) ) return;
&& (loc.collectionPath().startsWith("company://")
|| loc.collectionPath().startsWith("custom://"))) ) return;
if (QET::QetMessageBox::question(
this,
@ -655,7 +657,7 @@ void ElementsCollectionWidget::reload()
this,
&ElementsCollectionWidget::loadingFinished);
m_new_model->loadCollections(true, true, project_list);
m_new_model->loadCollections(true, true, true, project_list);
}
/**

View File

@ -168,7 +168,7 @@ QString ElementsLocation::baseName() const
@brief ElementsLocation::collectionPath
Return the path of the represented element relative to collection
if protocol is true the path is prepended by
the collection type (common://, custom:// or embed://)
the collection type (common://, company://, custom:// or embed://)
else if false,
only the collection path is returned without the collection type.
@param protocol
@ -181,7 +181,7 @@ QString ElementsLocation::collectionPath(bool protocol) const
else
{
QString path = m_collection_path;
return path.remove(QRegularExpression("common://|custom://|embed://"));
return path.remove(QRegularExpression("common://|company://|custom://|embed://"));
}
}
@ -229,7 +229,7 @@ QString ElementsLocation::path() const
@brief ElementsLocation::setPath
Set the path of this item.
The path can be relative to a collection
(start by common:// , custom:// or embed://) or not.
(start by common://, company://, custom:// or embed://) or not.
@param path
*/
void ElementsLocation::setPath(const QString &path)
@ -290,15 +290,20 @@ void ElementsLocation::setPath(const QString &path)
// The path is in file system,
// the given path is relative to common or custom collection
else if (path.startsWith("common://") || path.startsWith("custom://"))
else if (path.startsWith("common://") || path.startsWith("company://") || path.startsWith("custom://"))
{
QString p;
if (path.startsWith("common://"))
{
tmp_path.remove("common://");
p = QETApp::commonElementsDirN() + "/" + tmp_path;
}
else
if (path.startsWith("common://"))
{
tmp_path.remove("common://");
p = QETApp::commonElementsDirN() + "/" + tmp_path;
}
else if (path.startsWith("company://"))
{
tmp_path.remove("company://");
p = QETApp::companyElementsDirN() + "/" + tmp_path;
}
else
{
tmp_path.remove("custom://");
p = QETApp::customElementsDirN() + "/" + tmp_path;
@ -314,13 +319,19 @@ void ElementsLocation::setPath(const QString &path)
if(path_.endsWith(".elmt"))
{
m_file_system_path = path_;
if (path_.startsWith(QETApp::commonElementsDirN()))
{
path_.remove(QETApp::commonElementsDirN()+="/");
path_.prepend("common://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::customElementsDirN()))
if (path_.startsWith(QETApp::commonElementsDirN()))
{
path_.remove(QETApp::commonElementsDirN()+="/");
path_.prepend("common://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::companyElementsDirN()))
{
path_.remove(QETApp::companyElementsDirN()+="/");
path_.prepend("company://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::customElementsDirN()))
{
path_.remove(QETApp::customElementsDirN()+="/");
path_.prepend("custom://");
@ -330,13 +341,19 @@ void ElementsLocation::setPath(const QString &path)
else
{
m_file_system_path = path_;
if (path_.startsWith(QETApp::commonElementsDirN()))
{
path_.remove(QETApp::commonElementsDirN()+="/");
path_.prepend("common://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::customElementsDirN()))
if (path_.startsWith(QETApp::commonElementsDirN()))
{
path_.remove(QETApp::commonElementsDirN()+="/");
path_.prepend("common://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::companyElementsDirN()))
{
path_.remove(QETApp::companyElementsDirN()+="/");
path_.prepend("company://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::customElementsDirN()))
{
path_.remove(QETApp::customElementsDirN()+="/");
path_.prepend("custom://");
@ -484,13 +501,23 @@ bool ElementsLocation::isFileSystem() const
}
/**
@brief ElementsLocation::isCommonCollection
@return
True if this location represent an item from the common collection
@brief ElementsLocation::isCommonCollection
@return
True if this location represent an item from the common collection
*/
bool ElementsLocation::isCommonCollection() const
{
return fileSystemPath().startsWith(QETApp::commonElementsDirN());
return fileSystemPath().startsWith(QETApp::commonElementsDirN());
}
/**
@brief ElementsLocation::isCompanyCollection
@return
True if this location represent an item from the company collection
*/
bool ElementsLocation::isCompanyCollection() const
{
return fileSystemPath().startsWith(QETApp::companyElementsDirN());
}
/**

View File

@ -75,8 +75,9 @@ class ElementsLocation
bool isElement() const;
bool isDirectory() const;
bool isFileSystem() const;
bool isCommonCollection() const;
bool isCustomCollection() const;
bool isCommonCollection() const;
bool isCompanyCollection() const;
bool isCustomCollection() const;
bool isProject() const;
bool exist() const;
bool isWritable() const;

View File

@ -120,9 +120,11 @@ QString FileElementCollectionItem::localName()
else if (isDir()) {
if (isCollectionRoot()) {
if (m_path == QETApp::commonElementsDirN())
setText(QObject::tr("Collection QET"));
else if (m_path == QETApp::customElementsDirN())
if (m_path == QETApp::commonElementsDirN())
setText(QObject::tr("Collection QET"));
else if (m_path == QETApp::companyElementsDirN())
setText(QObject::tr("Collection Company"));
else if (m_path == QETApp::customElementsDirN())
setText(QObject::tr("Collection utilisateur"));
else
setText(QObject::tr("Collection inconnue"));
@ -194,6 +196,8 @@ QString FileElementCollectionItem::collectionPath() const
if (isCollectionRoot()) {
if (m_path == QETApp::commonElementsDirN())
return "common://";
else if (m_path == QETApp::companyElementsDirN())
return "company://";
else
return "custom://";
}
@ -217,19 +221,29 @@ QString FileElementCollectionItem::collectionPath() const
bool FileElementCollectionItem::isCollectionRoot() const
{
if (m_path == QETApp::commonElementsDirN()
|| m_path == QETApp::customElementsDirN())
return true;
|| m_path == QETApp::companyElementsDirN()
|| m_path == QETApp::customElementsDirN())
return true;
else
return false;
}
/**
@brief FileElementCollectionItem::isCommonCollection
@return True if this item represent the common collection
@brief FileElementCollectionItem::isCommonCollection
@return True if this item represent the common collection
*/
bool FileElementCollectionItem::isCommonCollection() const
{
return fileSystemPath().startsWith(QETApp::commonElementsDirN());
return fileSystemPath().startsWith(QETApp::commonElementsDirN());
}
/**
@brief FileElementCollectionItem::isCompanyCollection
@return True if this item represent the company collection
*/
bool FileElementCollectionItem::isCompanyCollection() const
{
return fileSystemPath().startsWith(QETApp::companyElementsDirN());
}
/**
@ -306,6 +320,8 @@ void FileElementCollectionItem::setUpIcon()
if (isCollectionRoot()) {
if (m_path == QETApp::commonElementsDirN())
setIcon(QIcon(":/ico/16x16/qet.png"));
else if (m_path == QETApp::companyElementsDirN())
setIcon(QIcon(":/ico/16x16/go-company.png"));
else
setIcon(QIcon(":/ico/16x16/go-home.png"));
}

View File

@ -47,8 +47,9 @@ class FileElementCollectionItem : public ElementCollectionItem
QString name() const override;
QString collectionPath() const override;
bool isCollectionRoot() const override;
bool isCommonCollection() const;
bool isCustomCollection() const;
bool isCommonCollection() const;
bool isCompanyCollection() const;
bool isCustomCollection() const;
void addChildAtPath(const QString &collection_name) override;
void setUpData() override;

View File

@ -93,9 +93,9 @@ void ElementDialog::setUpWidget()
prjs.append(prj);
if (m_mode == OpenElement)
m_model->loadCollections(true, true, prjs);
m_model->loadCollections(true, true, true, prjs);
else
m_model->loadCollections(false, true, prjs);
m_model->loadCollections(false, true, true, prjs);
m_tree_view->setModel(m_model);
m_tree_view->setHeaderHidden(true);

View File

@ -221,8 +221,9 @@ bool ElementsPanel::matchesFilter(const QTreeWidgetItem *item,
void ElementsPanel::reload()
{
QIcon system_icon(":/ico/16x16/qet.png");
QIcon company_icon(":/ico/16x16/go-company.png");
QIcon user_icon(":/ico/16x16/go-home.png");
// load the common title block templates collection
TitleBlockTemplatesCollection *common_tbt_collection = QETApp::commonTitleBlockTemplatesCollection();
common_tbt_collection_item_ = addTemplatesCollection(common_tbt_collection, invisibleRootItem());

View File

@ -81,6 +81,7 @@ class ElementsPanel : public GenericPanel {
private:
QSet<QETProject *> projects_to_display_; ///< list of projects that have been added to this panel
QTreeWidgetItem *common_tbt_collection_item_; ///< pointer to the item representing the common templates collection
QTreeWidgetItem *company_tbt_collection_item_; ///< pointer to the item representing the company's templates collection
QTreeWidgetItem *custom_tbt_collection_item_; ///< pointer to the item representing the user templates collection
bool first_reload_; ///< used to distinguish the first time this panel is reloaded
QString filter_; ///< Currently applied filter

View File

@ -687,6 +687,8 @@ QString QET::qetCollectionToString(const QET::QetCollection &c)
{
case Common :
return "common";
case Company :
return "company";
case Custom :
return "custom";
case Embedded :
@ -706,6 +708,8 @@ QET::QetCollection QET::qetCollectionFromString(const QString &str)
{
if (str == "common")
return QetCollection::Common;
else if (str == "company")
return QetCollection::Company;
else if (str == "custom")
return QetCollection::Custom;
else if (str == "embedded")

View File

@ -147,6 +147,7 @@ namespace QET {
///Enum used to specify the origin of a collection of thing (title block, element etc...)
enum QetCollection {
Common, ///< From common collection
Company, ///< From company collection
Custom, ///< From user collection
Embedded ///< From an embedded collection (a project for example)
};

View File

@ -75,6 +75,9 @@ TitleBlockTemplate *QETApp::default_titleblock_template_ = nullptr;
QString QETApp::m_common_element_dir = QString();
bool QETApp::m_common_element_dir_is_set = false;
QString QETApp::m_company_element_dir = QString();
bool QETApp::m_company_element_dir_is_set = false;
QString QETApp::m_custom_element_dir = QString();
bool QETApp::m_custom_element_dir_is_set = false;
@ -556,52 +559,101 @@ QString QETApp::commonElementsDir()
}
/**
@brief QETApp::customElementsDir
@return the dir path of user elements collection appended with a
"/" separator
@brief QETApp::customElementsDir
@return the dir path of user elements collection appended with a
"/" separator
*/
QString QETApp::customElementsDir()
{
if (m_custom_element_dir_is_set)
{
return m_custom_element_dir;
}
else
{
m_custom_element_dir_is_set = true;
if (m_custom_element_dir_is_set)
{
return m_custom_element_dir;
}
else
{
m_custom_element_dir_is_set = true;
QSettings settings;
QString path = settings.value(
"elements-collections/custom-collection-path",
"default").toString();
if (path != "default" && !path.isEmpty())
{
QDir dir(path);
if (dir.exists())
{
m_custom_element_dir = path;
if(!m_custom_element_dir.endsWith("/")) {
m_custom_element_dir.append("/");
}
return m_custom_element_dir;
}
}
QSettings settings;
QString path = settings.value(
"elements-collections/custom-collection-path",
"default").toString();
if (path != "default" && !path.isEmpty())
{
QDir dir(path);
if (dir.exists())
{
m_custom_element_dir = path;
if(!m_custom_element_dir.endsWith("/")) {
m_custom_element_dir.append("/");
}
return m_custom_element_dir;
}
}
m_custom_element_dir = configDir() + "elements/";
return m_custom_element_dir;
}
m_custom_element_dir = configDir() + "elements/";
return m_custom_element_dir;
}
}
/**
@brief QETApp::commonElementsDirN
like QString QETApp::commonElementsDir but without "/" at the end
@return QString path
@brief QETApp::companyElementsDir
@return the dir path of company elements collection appended with a
"/" separator
*/
QString QETApp::companyElementsDir()
{
if (m_company_element_dir_is_set)
{
return m_company_element_dir;
}
else
{
m_company_element_dir_is_set = true;
QSettings settings;
QString path = settings.value(
"elements-collections/company-collection-path",
"default").toString();
if (path != "default" && !path.isEmpty())
{
QDir dir(path);
if (dir.exists())
{
m_company_element_dir = path;
if(!m_company_element_dir.endsWith("/")) {
m_company_element_dir.append("/");
}
return m_company_element_dir;
}
}
m_company_element_dir = configDir() + "elements/";
return m_company_element_dir;
}
}
/**
@brief QETApp::commonElementsDirN
like QString QETApp::commonElementsDir but without "/" at the end
@return QString path
*/
QString QETApp::commonElementsDirN()
{
QString path = commonElementsDir();
if (path.endsWith("/")) path.remove(path.length()-1, 1);
return path;
QString path = commonElementsDir();
if (path.endsWith("/")) path.remove(path.length()-1, 1);
return path;
}
/**
@brief QETApp::companyElementsDirN
like QString QETApp::companyElementsDir but without "/" at the end
@return QString path
*/
QString QETApp::companyElementsDirN()
{
QString path = companyElementsDir();
if (path.endsWith("/")) path.remove(path.length()-1, 1);
return path;
}
/**
@ -627,6 +679,9 @@ void QETApp::resetCollectionsPath()
m_common_element_dir.clear();
m_common_element_dir_is_set = false;
m_company_element_dir.clear();
m_company_element_dir_is_set = false;
m_custom_element_dir.clear();
m_custom_element_dir_is_set = false;
@ -758,9 +813,13 @@ QString QETApp::realPath(const QString &sym_path) {
QString directory;
if (sym_path.startsWith("common://")) {
directory = commonElementsDir();
} else if (sym_path.startsWith("custom://")) {
directory = customElementsDir();
} else if (sym_path.startsWith(QETAPP_COMMON_TBT_PROTOCOL "://")) {
} else if (sym_path.startsWith("company://")) {
directory = companyElementsDir();
} else if (sym_path.startsWith("company://")) {
directory = companyElementsDir();
} else if (sym_path.startsWith("custom://")) {
directory = customElementsDir();
} else if (sym_path.startsWith(QETAPP_COMMON_TBT_PROTOCOL "://")) {
directory = commonTitleBlockTemplatesDir();
} else if (sym_path.startsWith(QETAPP_CUSTOM_TBT_PROTOCOL "://")) {
directory = customTitleBlockTemplatesDir();
@ -790,6 +849,7 @@ QString QETApp::symbolicPath(const QString &real_path) {
// get the common and custom folders
// recupere les dossier common et custom
QString commond = commonElementsDir();
QString companyd = companyElementsDir();
QString customd = customElementsDir();
QString chemin;
// analyzes the file path passed in parameter
@ -798,6 +858,10 @@ QString QETApp::symbolicPath(const QString &real_path) {
chemin = "common://"
+ real_path.right(
real_path.length() - commond.length());
} else if (real_path.startsWith(companyd)) {
chemin = "company://"
+ real_path.right(
real_path.length() - companyd.length());
} else if (real_path.startsWith(customd)) {
chemin = "custom://"
+ real_path.right(
@ -1913,11 +1977,15 @@ void QETApp::initConfiguration()
QDir config_dir(QETApp::configDir());
if (!config_dir.exists()) config_dir.mkpath(QETApp::configDir());
QDir custom_elements_dir(QETApp::customElementsDir());
if (!custom_elements_dir.exists())
custom_elements_dir.mkpath(QETApp::customElementsDir());
QDir custom_elements_dir(QETApp::customElementsDir());
if (!custom_elements_dir.exists())
custom_elements_dir.mkpath(QETApp::customElementsDir());
QDir custom_tbt_dir(QETApp::customTitleBlockTemplatesDir());
QDir company_elements_dir(QETApp::companyElementsDir());
if (!company_elements_dir.exists())
company_elements_dir.mkpath(QETApp::companyElementsDir());
QDir custom_tbt_dir(QETApp::customTitleBlockTemplatesDir());
if (!custom_tbt_dir.exists())
custom_tbt_dir.mkpath(QETApp::customTitleBlockTemplatesDir());

View File

@ -79,10 +79,12 @@ class QETApp : public QObject
static QList<TitleBlockTemplatesCollection *> availableTitleBlockTemplatesCollections();
static TitleBlockTemplatesCollection *titleBlockTemplatesCollection(const QString &);
static QString commonElementsDir();
static QString customElementsDir();
static QString commonElementsDir();
static QString companyElementsDir();
static QString customElementsDir();
static QString commonElementsDirN();
static QString customElementsDirN();
static QString companyElementsDirN();
static QString customElementsDirN();
static void resetCollectionsPath();
static QString commonTitleBlockTemplatesDir();
static QString customTitleBlockTemplatesDir();
@ -213,6 +215,9 @@ class QETApp : public QObject
static QString m_common_element_dir;
static bool m_common_element_dir_is_set;
static QString m_company_element_dir;
static bool m_company_element_dir_is_set;
static QString m_custom_element_dir;
static bool m_custom_element_dir_is_set;

View File

@ -32,6 +32,7 @@ namespace QET {
QIcon Autoconnect;
QIcon BringForward;
QIcon Cancel;
QIcon Company;
QIcon Conductor;
QIcon ConductorEdit;
QIcon ConductorSettings;
@ -395,6 +396,8 @@ void QET::Icons::initIcons()
Autoconnect .addFile(":/ico/22x22/autoconnect.png");
BringForward .addFile(":/ico/22x22/bring_forward.png");
Cancel .addFile(":/ico/16x16/item-cancel.png");
Company .addFile(":/ico/16x16/go-company.png");
Company .addFile(":/ico/22x22/go-company.png");
Conductor .addFile(":/ico/16x16/conductor.png");
ConductorEdit .addFile(":/ico/16x16/conductor-edit.png");
ConductorSettings .addFile(":/ico/16x16/conductor-reset.png");

View File

@ -39,6 +39,7 @@ namespace QET {
extern QIcon Autoconnect;
extern QIcon BringForward;
extern QIcon Cancel;
extern QIcon Company;
extern QIcon Conductor;
extern QIcon ConductorEdit;
extern QIcon ConductorSettings;

View File

@ -509,7 +509,10 @@ void QETProject::setDefaultTitleBlockProperties(const TitleBlockProperties &titl
case QET::Common :
collection = QETApp::commonTitleBlockTemplatesCollection();
break;
case QET::Custom :
case QET::Company :
// collection = QETApp::companyTitleBlockTemplatesCollection();
break;
case QET::Custom :
collection = QETApp::customTitleBlockTemplatesCollection();
break;
case QET::Embedded :

View File

@ -138,6 +138,15 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
ui->m_common_elmt_path_cb->blockSignals(false);
}
path = settings.value("elements-collections/company-collection-path", "default").toString();
if (path != "default")
{
ui->m_company_elmt_path_cb->blockSignals(true);
ui->m_company_elmt_path_cb->setCurrentIndex(1);
ui->m_company_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
ui->m_company_elmt_path_cb->blockSignals(false);
}
path = settings.value("elements-collections/custom-collection-path", "default").toString();
if (path != "default")
{
@ -241,6 +250,21 @@ void GeneralConfigurationPage::applyConf()
QETApp::resetCollectionsPath();
}
path = settings.value("elements-collections/company-collection-path").toString();
if (ui->m_company_elmt_path_cb->currentIndex() == 1)
{
QString path = ui->m_company_elmt_path_cb->currentText();
QDir dir(path);
settings.setValue("elements-collections/company-collection-path",
dir.exists() ? path : "default");
}
else {
settings.setValue("elements-collections/company-collection-path", "default");
}
if (path != settings.value("elements-collections/company-collection-path").toString()) {
QETApp::resetCollectionsPath();
}
path = settings.value("elements-collections/custom-collection-path").toString();
if (ui->m_custom_elmt_path_cb->currentIndex() == 1)
{
@ -398,6 +422,20 @@ void GeneralConfigurationPage::on_m_common_elmt_path_cb_currentIndexChanged(int
}
}
void GeneralConfigurationPage::on_m_company_elmt_path_cb_currentIndexChanged(int index)
{
if (index == 1)
{
QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection company"), QDir::homePath());
if (!path.isEmpty()) {
ui->m_company_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
}
else {
ui->m_company_elmt_path_cb->setCurrentIndex(0);
}
}
}
void GeneralConfigurationPage::on_m_custom_elmt_path_cb_currentIndexChanged(int index)
{
if (index == 1)

View File

@ -42,6 +42,7 @@ class GeneralConfigurationPage : public ConfigPage
void on_m_font_pb_clicked();
void on_m_dyn_text_font_pb_clicked();
void on_m_common_elmt_path_cb_currentIndexChanged(int index);
void on_m_company_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);
void on_m_indi_text_font_pb_clicked();

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>822</width>
<width>872</width>
<height>411</height>
</rect>
</property>
@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
@ -243,13 +243,34 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Répertoire de la collection company</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="m_company_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="3" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Répertoire de la collection utilisateur</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QComboBox" name="m_custom_elmt_path_cb">
<item>
<property name="text">
@ -263,7 +284,14 @@
</item>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Répertoire des cartouches utilisateur</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="m_custom_tbt_path_cb">
<item>
<property name="text">
@ -277,20 +305,13 @@
</item>
</widget>
</item>
<item row="4" column="1">
<item row="5" 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>Répertoire des cartouches utilisateur</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -847,9 +868,9 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_1">
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="label_1">
<property name="text">
<string>Max. parts in Element Editor List</string>
</property>

View File

@ -419,6 +419,8 @@ void TitleBlockPropertiesWidget::updateTemplateList()
QET::QetCollection qc = tbt_c -> collection();
if (qc == QET::QetCollection::Common)
icon = QET::Icons::QETLogo;
else if (qc == QET::QetCollection::Company)
icon = QET::Icons::Company;
else if (qc == QET::QetCollection::Custom)
icon = QET::Icons::Home;
else if (qc == QET::QetCollection::Embedded)