added a second user-collection

This commit is contained in:
plc-user
2023-12-09 12:02:04 +01:00
parent 457aeb6883
commit f519499a66
30 changed files with 589 additions and 335 deletions

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());
@@ -320,6 +323,25 @@ void ElementsCollectionModel::addCommonCollection(bool set_data)
delete feci;
}
/**
@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
@@ -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,6 +590,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(
if (eci->type() == FileElementCollectionItem::Type) {
if (FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci)) {
if ( (location.isCommonCollection() && feci->isCommonCollection()) ||
(location.isCompanyCollection() && feci->isCompanyCollection()) ||
(location.isCustomCollection() && !feci->isCommonCollection()) ) {
match_eci = feci->itemAtPath(location.collectionPath(false));
}

View File

@@ -42,9 +42,10 @@ 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 addCompanyCollection(bool set_data = true);
void addCustomCollection(bool set_data = true);
void addLocation(const ElementsLocation& location);

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,7 +290,7 @@ 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://"))
@@ -298,6 +298,11 @@ void ElementsLocation::setPath(const QString &path)
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://");
@@ -320,6 +325,12 @@ void ElementsLocation::setPath(const QString &path)
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()+="/");
@@ -336,6 +347,12 @@ void ElementsLocation::setPath(const QString &path)
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()+="/");
@@ -493,6 +510,16 @@ bool ElementsLocation::isCommonCollection() const
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());
}
/**
@brief ElementsLocation::isCustomCollection
@return

View File

@@ -76,6 +76,7 @@ class ElementsLocation
bool isDirectory() const;
bool isFileSystem() const;
bool isCommonCollection() const;
bool isCompanyCollection() const;
bool isCustomCollection() const;
bool isProject() const;
bool exist() const;

View File

@@ -122,6 +122,8 @@ QString FileElementCollectionItem::localName()
if (isCollectionRoot()) {
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
@@ -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,6 +221,7 @@ QString FileElementCollectionItem::collectionPath() const
bool FileElementCollectionItem::isCollectionRoot() const
{
if (m_path == QETApp::commonElementsDirN()
|| m_path == QETApp::companyElementsDirN()
|| m_path == QETApp::customElementsDirN())
return true;
else
@@ -232,6 +237,15 @@ bool FileElementCollectionItem::isCommonCollection() const
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());
}
/**
@brief FileElementCollectionItem::isCustomCollection
@return True if this item represent the custom collection
@@ -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

@@ -48,6 +48,7 @@ class FileElementCollectionItem : public ElementCollectionItem
QString collectionPath() const override;
bool isCollectionRoot() const override;
bool isCommonCollection() const;
bool isCompanyCollection() const;
bool isCustomCollection() const;
void addChildAtPath(const QString &collection_name) override;

View File

@@ -217,7 +217,8 @@ void CustomElementGraphicPart::stylesToXml(QDomElement &qde) const
{HTMLYellowYellowFilling, "HTMLYellowYellow"},
{HTMLYellowLightYellowFilling, "HTMLYellowLightYellow"},
{HTMLYellowLemonChiffonFilling, "HTMLYellowLemonChiffon"},
{HTMLYellowLightGoldenrodYellowFilling, "HTMLYellowLightGoldenrodYellow"},
{HTMLYellowLightGoldenrodYellowFilling,
"HTMLYellowLightGoldenrodYellow"},
{HTMLYellowPapayaWhipFilling, "HTMLYellowPapayaWhip"},
{HTMLYellowMoccasinFilling, "HTMLYellowMoccasin"},
{HTMLYellowPeachPuffFilling, "HTMLYellowPeachPuff"},
@@ -594,7 +595,8 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
{"HTMLYellowYellow", HTMLYellowYellowFilling},
{"HTMLYellowLightYellow", HTMLYellowLightYellowFilling},
{"HTMLYellowLemonChiffon", HTMLYellowLemonChiffonFilling},
{"HTMLYellowLightGoldenrodYellow", HTMLYellowLightGoldenrodYellowFilling},
{"HTMLYellowLightGoldenrodYellow",
HTMLYellowLightGoldenrodYellowFilling},
{"HTMLYellowPapayaWhip", HTMLYellowPapayaWhipFilling},
{"HTMLYellowMoccasin", HTMLYellowMoccasinFilling},
{"HTMLYellowPeachPuff", HTMLYellowPeachPuffFilling},
@@ -629,7 +631,8 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
{"HTMLGreenChartreuse", HTMLGreenChartreuseFilling},
{"HTMLGreenGreenYellow", HTMLGreenGreenYellowFilling},
{"HTMLGreenSpringGreen", HTMLGreenSpringGreenFilling},
{"HTMLGreenMediumSpringGreen", HTMLGreenMediumSpringGreenFilling},
{"HTMLGreenMediumSpringGreen",
HTMLGreenMediumSpringGreenFilling},
{"HTMLGreenLightGreen", HTMLGreenLightGreenFilling},
{"HTMLGreenPaleGreen", HTMLGreenPaleGreenFilling},
{"HTMLGreenDarkSeaGreen", HTMLGreenDarkSeaGreenFilling},
@@ -759,7 +762,8 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
{"HTMLYellowYellow", HTMLYellowYellowColor},
{"HTMLYellowLightYellow", HTMLYellowLightYellowColor},
{"HTMLYellowLemonChiffon", HTMLYellowLemonChiffonColor},
{"HTMLYellowLightGoldenrodYellow", HTMLYellowLightGoldenrodYellowColor},
{"HTMLYellowLightGoldenrodYellow",
HTMLYellowLightGoldenrodYellowColor},
{"HTMLYellowPapayaWhip", HTMLYellowPapayaWhipColor},
{"HTMLYellowMoccasin", HTMLYellowMoccasinColor},
{"HTMLYellowPeachPuff", HTMLYellowPeachPuffColor},

View File

@@ -176,6 +176,7 @@ qreal PartTerminal::rotation() const {
case Qet::South : return 180;
case Qet::West : return 270;
}
return 0;
}
/**

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,6 +221,7 @@ 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

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

@@ -362,6 +362,7 @@ QString ElementData::masterTypeToString(ElementData::MasterType type)
case ElementData::Commutator:
return QStringLiteral("commutator");
}
return QStringLiteral("coil");
}
ElementData::MasterType ElementData::masterTypeFromString(const QString &string)
@@ -394,6 +395,7 @@ QString ElementData::slaveTypeToString(ElementData::SlaveType type)
case ElementData::delayOnOff:
return QStringLiteral("delayOnOff");
}
return QStringLiteral("simple");
}
ElementData::SlaveType ElementData::slaveTypeFromString(const QString &string)
@@ -428,6 +430,7 @@ QString ElementData::slaveStateToString(ElementData::SlaveState type)
case Other:
return QStringLiteral("Other");
}
return QStringLiteral("Other");
}
ElementData::SlaveState ElementData::slaveStateFromString(const QString &string)
@@ -462,6 +465,7 @@ QString ElementData::terminalTypeToString(ElementData::TerminalType type)
case ElementData::TTGround:
return QStringLiteral("ground");
}
return QStringLiteral("generic");
}
ElementData::TerminalType ElementData::terminalTypeFromString(const QString &string)
@@ -498,6 +502,7 @@ QString ElementData::translatedTerminalType(ElementData::TerminalType type)
case ElementData::TTGround:
return QObject::tr("Terre", "ground terminal element type");
}
return QObject::tr("Générique", "generic terminal element type");
}
QString ElementData::terminalFunctionToString(ElementData::TerminalFunction function)
@@ -510,6 +515,7 @@ QString ElementData::terminalFunctionToString(ElementData::TerminalFunction func
case ElementData::TFNeutral:
return QStringLiteral("neutral");
}
return QStringLiteral("generic");
}
ElementData::TerminalFunction ElementData::terminalFunctionFromString(const QString &string)
@@ -535,6 +541,7 @@ QString ElementData::translatedTerminalFunction(ElementData::TerminalFunction fu
case TFPhase : return QObject::tr("Phase", "phase terminal element function" );
case TFNeutral : return QObject::tr("Neutre", "neutral terminal element function");
}
return QObject::tr("Générique", "generic terminal element function");
}
void ElementData::kindInfoFromXml(const QDomElement &xml_element)

View File

@@ -172,6 +172,7 @@ QString TerminalData::typeToString(TerminalData::Type type)
case Outer :
return QString("Outer");
}
return QString("Generic");
}
/**

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;
@@ -592,6 +595,43 @@ QString QETApp::customElementsDir()
}
}
/**
@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
@@ -604,6 +644,18 @@ QString QETApp::commonElementsDirN()
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;
}
/**
@brief QETApp::customElementsDirN
like QString QETApp::customElementsDir but without "/" at the end
@@ -758,6 +810,10 @@ QString QETApp::realPath(const QString &sym_path) {
QString directory;
if (sym_path.startsWith("common://")) {
directory = commonElementsDir();
} 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 "://")) {
@@ -790,6 +846,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 +855,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(
@@ -1917,6 +1978,10 @@ void QETApp::initConfiguration()
if (!custom_elements_dir.exists())
custom_elements_dir.mkpath(QETApp::customElementsDir());
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

@@ -80,8 +80,10 @@ class QETApp : public QObject
static TitleBlockTemplatesCollection *titleBlockTemplatesCollection(const QString &);
static QString commonElementsDir();
static QString companyElementsDir();
static QString customElementsDir();
static QString commonElementsDirN();
static QString companyElementsDirN();
static QString customElementsDirN();
static void resetCollectionsPath();
static QString commonTitleBlockTemplatesDir();
@@ -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

@@ -970,10 +970,12 @@ bool QetShapeItem::toDXF(const QString &filepath,const QPen &pen)
Createdxf::dxfColor(pen));
return true;
case Polygon:
if(m_polygon.isClosed())
if(m_polygon.isClosed()) {
Createdxf::drawPolygon(filepath,m_polygon,Createdxf::dxfColor(pen));
else
}
else {
Createdxf::drawPolyline(filepath,m_polygon,Createdxf::dxfColor(pen));
}
return true;
default:
return false;

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,6 +509,9 @@ void QETProject::setDefaultTitleBlockProperties(const TitleBlockProperties &titl
case QET::Common :
collection = QETApp::commonTitleBlockTemplatesCollection();
break;
case QET::Company :
// collection = QETApp::companyTitleBlockTemplatesCollection();
break;
case QET::Custom :
collection = QETApp::customTitleBlockTemplatesCollection();
break;

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)

View File

@@ -17,7 +17,7 @@
*/
#include "macosxopenevent.h"
#include "singleapplication.h"
#include "../singleapplication.h"
#include <QFileOpenEvent>