use "%" for string-concatenation

Qt-Docs says it's less memory-usage...
This commit is contained in:
plc-user 2025-05-22 21:33:32 +02:00
parent 3a8e6b16f5
commit ad29893842
30 changed files with 167 additions and 167 deletions

View File

@ -44,7 +44,7 @@ ECHSFileToFile::ECHSFileToFile(ElementsLocation &source, ElementsLocation &desti
ElementsLocation ECHSFileToFile::copy() ElementsLocation ECHSFileToFile::copy()
{ {
//Check if the destination already have an item with the same name of the item to copy //Check if the destination already have an item with the same name of the item to copy
ElementsLocation location(m_destination.fileSystemPath() + "/" + m_source.fileName()); ElementsLocation location(m_destination.fileSystemPath() % "/" % m_source.fileName());
QString rename; QString rename;
if (location.exist()) if (location.exist())
{ {
@ -92,10 +92,10 @@ ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, Element
if (destination_dir.mkdir(new_dir_name)) if (destination_dir.mkdir(new_dir_name))
{ {
//The new created directory //The new created directory
QDir created_dir(destination_dir.canonicalPath() + "/" + new_dir_name); QDir created_dir(destination_dir.canonicalPath() % "/" % new_dir_name);
//Copy the qet_directory file //Copy the qet_directory file
QFile::copy(source_dir.canonicalPath() + "/qet_directory", created_dir.canonicalPath() + "/qet_directory"); QFile::copy(source_dir.canonicalPath() % "/qet_directory", created_dir.canonicalPath() % "/qet_directory");
//Copy all dirs found in source_dir to destination_dir //Copy all dirs found in source_dir to destination_dir
ElementsLocation created_location(created_dir.canonicalPath()); ElementsLocation created_location(created_dir.canonicalPath());
@ -115,7 +115,7 @@ ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, Element
} }
} }
ElementsLocation sub_source(source.fileSystemPath() + "/" + str); ElementsLocation sub_source(source.fileSystemPath() % "/" % str);
copyDirectory(sub_source, created_location); copyDirectory(sub_source, created_location);
} }
@ -123,7 +123,7 @@ ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, Element
source_dir.setNameFilters(QStringList() << "*.elmt"); source_dir.setNameFilters(QStringList() << "*.elmt");
foreach(QString str, source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name)) foreach(QString str, source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
{ {
ElementsLocation sub_source(source.fileSystemPath() + "/" + str); ElementsLocation sub_source(source.fileSystemPath() % "/" % str);
copyElement(sub_source, created_location); copyElement(sub_source, created_location);
} }
@ -136,7 +136,7 @@ ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, Element
ElementsLocation ECHSFileToFile::copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename) ElementsLocation ECHSFileToFile::copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename)
{ {
QString new_elmt_name = rename.isEmpty() ? source.fileName() : rename; QString new_elmt_name = rename.isEmpty() ? source.fileName() : rename;
bool rb = QFile::copy(source.fileSystemPath(), destination.fileSystemPath() + "/" + new_elmt_name); bool rb = QFile::copy(source.fileSystemPath(), destination.fileSystemPath() % "/" % new_elmt_name);
if (rb) if (rb)
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -145,7 +145,7 @@ ElementsLocation ECHSFileToFile::copyElement(ElementsLocation &source, ElementsL
//user can't save the element //user can't save the element
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
qt_ntfs_permission_lookup++; qt_ntfs_permission_lookup++;
QFile file(destination.fileSystemPath() + "/" + new_elmt_name); QFile file(destination.fileSystemPath() % "/" % new_elmt_name);
if (!file.isWritable()) { if (!file.isWritable()) {
if (!file.setPermissions(file.permissions() | QFileDevice::WriteUser)) { if (!file.setPermissions(file.permissions() | QFileDevice::WriteUser)) {
qDebug() << "Failed to change file permission of : " << QFileInfo(file).canonicalFilePath() \ qDebug() << "Failed to change file permission of : " << QFileInfo(file).canonicalFilePath() \
@ -154,7 +154,7 @@ ElementsLocation ECHSFileToFile::copyElement(ElementsLocation &source, ElementsL
} }
qt_ntfs_permission_lookup--; qt_ntfs_permission_lookup--;
#endif #endif
return ElementsLocation (destination.fileSystemPath() + "/" + new_elmt_name); return ElementsLocation (destination.fileSystemPath() % "/" % new_elmt_name);
} }
else else
return ElementsLocation(); return ElementsLocation();
@ -169,7 +169,7 @@ ECHSXmlToFile::ECHSXmlToFile(ElementsLocation &source, ElementsLocation &destina
ElementsLocation ECHSXmlToFile::copy() ElementsLocation ECHSXmlToFile::copy()
{ {
//Check if the destination already have an item with the same name of the item to copy //Check if the destination already have an item with the same name of the item to copy
ElementsLocation location(m_destination.fileSystemPath() + "/" + m_source.fileName()); ElementsLocation location(m_destination.fileSystemPath() % "/" % m_source.fileName());
QString rename; QString rename;
if (location.exist()) if (location.exist())
{ {
@ -215,7 +215,7 @@ ElementsLocation ECHSXmlToFile::copyDirectory(ElementsLocation &source, Elements
//Create new dir //Create new dir
if (destination_dir.mkdir(new_dir_name)) if (destination_dir.mkdir(new_dir_name))
{ {
QDir created_dir(destination_dir.canonicalPath() + "/" + new_dir_name); QDir created_dir(destination_dir.canonicalPath() % "/" % new_dir_name);
ElementsLocation created_location(created_dir.canonicalPath()); ElementsLocation created_location(created_dir.canonicalPath());
//Create the qet-directory file //Create the qet-directory file
@ -224,7 +224,7 @@ ElementsLocation ECHSXmlToFile::copyDirectory(ElementsLocation &source, Elements
document.appendChild(root); document.appendChild(root);
root.appendChild(source.nameList().toXml(document)); root.appendChild(source.nameList().toXml(document));
QString filepath = created_dir.canonicalPath() + "/qet_directory"; QString filepath = created_dir.canonicalPath() % "/qet_directory";
QET::writeXmlFile(document, filepath); QET::writeXmlFile(document, filepath);
//Create all directory found in source to created_dir //Create all directory found in source to created_dir
@ -233,7 +233,7 @@ ElementsLocation ECHSXmlToFile::copyDirectory(ElementsLocation &source, Elements
QStringList directories_names = project_collection->directoriesNames( project_collection->directory(source.collectionPath(false)) ); QStringList directories_names = project_collection->directoriesNames( project_collection->directory(source.collectionPath(false)) );
foreach(QString name, directories_names) foreach(QString name, directories_names)
{ {
ElementsLocation sub_source_dir(source.projectCollectionPath() + "/" + name); ElementsLocation sub_source_dir(source.projectCollectionPath() % "/" % name);
copyDirectory(sub_source_dir, created_location); copyDirectory(sub_source_dir, created_location);
} }
@ -241,7 +241,7 @@ ElementsLocation ECHSXmlToFile::copyDirectory(ElementsLocation &source, Elements
QStringList elements_names = project_collection->elementsNames( project_collection->directory(source.collectionPath(false))) ; QStringList elements_names = project_collection->elementsNames( project_collection->directory(source.collectionPath(false))) ;
foreach (QString name, elements_names) foreach (QString name, elements_names)
{ {
ElementsLocation source_element(source.projectCollectionPath() + "/" + name); ElementsLocation source_element(source.projectCollectionPath() % "/" % name);
copyElement(source_element, created_location); copyElement(source_element, created_location);
} }
@ -262,7 +262,7 @@ ElementsLocation ECHSXmlToFile::copyElement(ElementsLocation &source, ElementsLo
document.appendChild(document.importNode(source.xml(), true)); document.appendChild(document.importNode(source.xml(), true));
//Create the .elmt file //Create the .elmt file
QString filepath = destination.fileSystemPath() + "/" + new_element_name; QString filepath = destination.fileSystemPath() % "/" % new_element_name;
if (QET::writeXmlFile(document, filepath)) if (QET::writeXmlFile(document, filepath))
return ElementsLocation(filepath); return ElementsLocation(filepath);
else else
@ -280,7 +280,7 @@ ElementsLocation ECHSToXml::copy()
if (!(m_source.exist() && m_destination.isDirectory() && m_destination.isProject())) return ElementsLocation(); if (!(m_source.exist() && m_destination.isDirectory() && m_destination.isProject())) return ElementsLocation();
//Check if the destination already have an item with the same name of the item to copy //Check if the destination already have an item with the same name of the item to copy
ElementsLocation location(m_destination.projectCollectionPath() + "/" + m_source.fileName()); ElementsLocation location(m_destination.projectCollectionPath() % "/" % m_source.fileName());
QString rename; QString rename;
if (location.exist()) if (location.exist())
@ -370,7 +370,7 @@ ElementsLocation ElementCollectionHandler::createDir(ElementsLocation &parent, c
document.appendChild(root); document.appendChild(root);
root.appendChild(name_list.toXml(document)); root.appendChild(name_list.toXml(document));
QString filepath = created_dir.fileSystemPath() + "/qet_directory"; QString filepath = created_dir.fileSystemPath() % "/qet_directory";
if (!QET::writeXmlFile(document, filepath)) { if (!QET::writeXmlFile(document, filepath)) {
qDebug() << "ElementCollectionHandler::createDir : write qet-directory file failed"; qDebug() << "ElementCollectionHandler::createDir : write qet-directory file failed";
} }

View File

@ -620,7 +620,7 @@ void ElementsCollectionWidget::dirProperties()
QMessageBox::information( QMessageBox::information(
this, this,
tr("Propriété du dossier %1").arg(eci->localName()), tr("Propriété du dossier %1").arg(eci->localName()),
txt1 + " " + txt2 + " " + txt3 + "\n\n" + txt4 + "\n" + txt5); txt1 % " " % txt2 % " " % txt3 % "\n\n" % txt4 % "\n" % txt5);
} }
} }

View File

@ -196,9 +196,9 @@ QString ElementsLocation::projectCollectionPath() const
return QString(); return QString();
else else
return QString("project" return QString("project"
+ QString::number(QETApp::projectId(m_project)) % QString::number(QETApp::projectId(m_project))
+ "+" % "+"
+ collectionPath()); % collectionPath());
} }
/** /**
@ -296,17 +296,17 @@ void ElementsLocation::setPath(const QString &path)
if (path.startsWith("common://")) if (path.startsWith("common://"))
{ {
tmp_path.remove("common://"); tmp_path.remove("common://");
p = QETApp::commonElementsDirN() + "/" + tmp_path; p = QETApp::commonElementsDirN() % "/" % tmp_path;
} }
else if (path.startsWith("company://")) else if (path.startsWith("company://"))
{ {
tmp_path.remove("company://"); tmp_path.remove("company://");
p = QETApp::companyElementsDirN() + "/" + tmp_path; p = QETApp::companyElementsDirN() % "/" % tmp_path;
} }
else else
{ {
tmp_path.remove("custom://"); tmp_path.remove("custom://");
p = QETApp::customElementsDirN() + "/" + tmp_path; p = QETApp::customElementsDirN() % "/" % tmp_path;
} }
m_file_system_path = p; m_file_system_path = p;
@ -464,7 +464,7 @@ QString ElementsLocation::toString() const
if (m_project) { if (m_project) {
int project_id = QETApp::projectId(m_project); int project_id = QETApp::projectId(m_project);
if (project_id != -1) { if (project_id != -1) {
result += "project" + QString().setNum(project_id) + "+"; result += "project" % QString().setNum(project_id) % "+";
} }
} }
result += m_collection_path; result += m_collection_path;
@ -624,7 +624,7 @@ NamesList ElementsLocation::nameList()
{ {
//Open the qet_directory file, //Open the qet_directory file,
// to get the traductions name of this dir // to get the traductions name of this dir
QFile dir_conf(fileSystemPath() + "/qet_directory"); QFile dir_conf(fileSystemPath() % "/qet_directory");
if (dir_conf.exists() && dir_conf.open( if (dir_conf.exists() && dir_conf.open(
QIODevice::ReadOnly QIODevice::ReadOnly
| QIODevice::Text)) | QIODevice::Text))

View File

@ -67,7 +67,7 @@ QString FileElementCollectionItem::fileSystemPath() const
FileElementCollectionItem *feci = FileElementCollectionItem *feci =
static_cast<FileElementCollectionItem *> (parent()); static_cast<FileElementCollectionItem *> (parent());
if (feci) if (feci)
return feci->fileSystemPath() + "/" + m_path; return feci->fileSystemPath() % "/" % m_path;
else else
return QString();//Null string return QString();//Null string
} }
@ -131,7 +131,7 @@ QString FileElementCollectionItem::localName()
} }
else else
{ {
QString str(fileSystemPath() + "/qet_directory"); QString str(fileSystemPath() % "/qet_directory");
pugi::xml_document docu; pugi::xml_document docu;
if(docu.load_file(str.toStdString().c_str())) if(docu.load_file(str.toStdString().c_str()))
{ {
@ -208,7 +208,7 @@ QString FileElementCollectionItem::collectionPath() const
if (eci->isCollectionRoot()) if (eci->isCollectionRoot())
return eci->collectionPath() + m_path; return eci->collectionPath() + m_path;
else else
return eci->collectionPath() + "/" + m_path; return eci->collectionPath() % "/" % m_path;
} }
else else
return QString(); return QString();

View File

@ -446,7 +446,7 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
if (path.isEmpty()) if (path.isEmpty())
path = str; path = str;
else else
path = path + "/" + str; path = path % "/" % str;
QDomElement child_element = child(parent_element, str); QDomElement child_element = child(parent_element, str);
@ -530,7 +530,7 @@ bool XmlElementCollection::addElementDefinition(
dom_elmt.appendChild(xml_definition.cloneNode(true)); dom_elmt.appendChild(xml_definition.cloneNode(true));
dom_dir.appendChild(dom_elmt); dom_dir.appendChild(dom_elmt);
emit elementAdded(dir_path + "/" + name); emit elementAdded(dir_path % "/" % name);
return true; return true;
} }
@ -617,7 +617,7 @@ bool XmlElementCollection::createDir(const QString& path,
const QString& name, const QString& name,
const NamesList &name_list) const NamesList &name_list)
{ {
QString new_dir_path = path + "/" + name; QString new_dir_path = path % "/" % name;
if (!directory(new_dir_path).isNull()) { if (!directory(new_dir_path).isNull()) {
return true; return true;
@ -724,7 +724,7 @@ ElementsLocation XmlElementCollection::domToLocation(
dom_element = dom_element.parentNode().toElement(); dom_element = dom_element.parentNode().toElement();
if (dom_element.tagName() == "category") if (dom_element.tagName() == "category")
path.prepend(dom_element.attribute("name") + "/"); path.prepend(dom_element.attribute("name") % "/");
} }
return ElementsLocation(path, m_project); return ElementsLocation(path, m_project);
@ -789,11 +789,11 @@ ElementsLocation XmlElementCollection::copyDirectory(
//Remove the previous directory with the same path //Remove the previous directory with the same path
QDomElement element = child(destination.collectionPath(false) QDomElement element = child(destination.collectionPath(false)
+ "/" + new_dir_name); % "/" % new_dir_name);
if (!element.isNull()) { if (!element.isNull()) {
element.parentNode().removeChild(element); element.parentNode().removeChild(element);
emit directoryRemoved(destination.collectionPath(false) emit directoryRemoved(destination.collectionPath(false)
+ "/" + new_dir_name); % "/" % new_dir_name);
} }
ElementsLocation created_location; ElementsLocation created_location;
@ -813,7 +813,7 @@ ElementsLocation XmlElementCollection::copyDirectory(
parent_dir_dom.appendChild(elmt_dom); parent_dir_dom.appendChild(elmt_dom);
created_location.setPath(destination.projectCollectionPath() created_location.setPath(destination.projectCollectionPath()
+ "/" + new_dir_name); % "/" % new_dir_name);
if (deep_copy) if (deep_copy)
{ {
@ -823,7 +823,7 @@ ElementsLocation XmlElementCollection::copyDirectory(
QDir::Name)) QDir::Name))
{ {
ElementsLocation sub_source(source.fileSystemPath() ElementsLocation sub_source(source.fileSystemPath()
+ "/" + str); % "/" % str);
copyDirectory(sub_source, created_location); copyDirectory(sub_source, created_location);
} }
@ -834,7 +834,7 @@ ElementsLocation XmlElementCollection::copyDirectory(
QDir::Name)) QDir::Name))
{ {
ElementsLocation sub_source(source.fileSystemPath() ElementsLocation sub_source(source.fileSystemPath()
+ "/" + str); % "/" % str);
copyElement(sub_source, created_location); copyElement(sub_source, created_location);
} }
} }
@ -861,7 +861,7 @@ ElementsLocation XmlElementCollection::copyDirectory(
other_collection_dom_dir.setAttribute("name", new_dir_name); other_collection_dom_dir.setAttribute("name", new_dir_name);
parent_dir_dom.appendChild(other_collection_dom_dir); parent_dir_dom.appendChild(other_collection_dom_dir);
created_location.setPath(destination.projectCollectionPath() + "/" + new_dir_name); created_location.setPath(destination.projectCollectionPath() % "/" % new_dir_name);
} }
emit directorieAdded(created_location.collectionPath(false)); emit directorieAdded(created_location.collectionPath(false));
@ -906,7 +906,7 @@ ElementsLocation XmlElementCollection::copyElement(
//Remove the previous element with the same path //Remove the previous element with the same path
QDomElement element = child(destination.collectionPath(false) QDomElement element = child(destination.collectionPath(false)
+ "/" + new_elmt_name); % "/" % new_elmt_name);
bool removed = false; bool removed = false;
if (!element.isNull()) { if (!element.isNull()) {
element.parentNode().removeChild(element); element.parentNode().removeChild(element);
@ -919,7 +919,7 @@ ElementsLocation XmlElementCollection::copyElement(
dir_dom.appendChild(elmt_dom); dir_dom.appendChild(elmt_dom);
ElementsLocation copy_loc(destination.projectCollectionPath() ElementsLocation copy_loc(destination.projectCollectionPath()
+ "/" + new_elmt_name); % "/" % new_elmt_name);
if (removed) { if (removed) {
emit elementChanged(copy_loc.collectionPath(false)); emit elementChanged(copy_loc.collectionPath(false));

View File

@ -108,7 +108,7 @@ QString XmlProjectElementCollectionItem::embeddedPath() const
if (xpeci->isCollectionRoot()) if (xpeci->isCollectionRoot())
return xpeci->embeddedPath() + name(); return xpeci->embeddedPath() + name();
else else
return xpeci->embeddedPath() + "/" + name(); return xpeci->embeddedPath() % "/" % name();
} }
else else
return QString(); return QString();

View File

@ -419,7 +419,7 @@ void SearchAndReplaceWidget::search()
else else
{ {
//entire word //entire word
QRegularExpression rx("\\b" + str + "\\b"); QRegularExpression rx("\\b" % str % "\\b");
if (!rx.isValid()) if (!rx.isValid())
{ {
qWarning() <<QObject::tr("this is an error in the code") qWarning() <<QObject::tr("this is an error in the code")

View File

@ -41,7 +41,7 @@ AddTerminalToStripCommand::AddTerminalToStripCommand(QSharedPointer<RealTerminal
const auto str_2 = ts_name.isEmpty() ? QObject::tr("à un groupe de bornes") : const auto str_2 = ts_name.isEmpty() ? QObject::tr("à un groupe de bornes") :
QObject::tr("au groupe de bornes %1").arg(ts_name); QObject::tr("au groupe de bornes %1").arg(ts_name);
setText(str_1 + " " + str_2); setText(str_1 % " " % str_2);
} }
AddTerminalToStripCommand::AddTerminalToStripCommand(QVector<QSharedPointer<RealTerminal>> terminals, TerminalStrip *strip, QUndoCommand *parent) : AddTerminalToStripCommand::AddTerminalToStripCommand(QVector<QSharedPointer<RealTerminal>> terminals, TerminalStrip *strip, QUndoCommand *parent) :
@ -57,7 +57,7 @@ AddTerminalToStripCommand::AddTerminalToStripCommand(QVector<QSharedPointer<Real
const auto str_2 = ts_name.isEmpty() ? QObject::tr("à un groupe de bornes") : const auto str_2 = ts_name.isEmpty() ? QObject::tr("à un groupe de bornes") :
QObject::tr("au groupe de bornes %1").arg(ts_name); QObject::tr("au groupe de bornes %1").arg(ts_name);
setText(str_1 + " " + str_2); setText(str_1 % " " % str_2);
} }
@ -143,7 +143,7 @@ void RemoveTerminalFromStripCommand::setCommandTitle()
const auto str_2 = strip_name.isEmpty() ? QObject::tr("d'un groupe de bornes") : const auto str_2 = strip_name.isEmpty() ? QObject::tr("d'un groupe de bornes") :
QObject::tr("du groupe de bornes %1").arg(strip_name); QObject::tr("du groupe de bornes %1").arg(strip_name);
setText(str_1 + " " + str_2); setText(str_1 % " " % str_2);
} }
/** /**
@ -178,7 +178,7 @@ MoveTerminalCommand::MoveTerminalCommand(QSharedPointer<PhysicalTerminal> termin
auto str_3 = new_strip_name.isEmpty() ? QObject::tr("vers un groupe de bornes") : auto str_3 = new_strip_name.isEmpty() ? QObject::tr("vers un groupe de bornes") :
QObject::tr("vers le groupe de bornes %1").arg(new_strip_name); QObject::tr("vers le groupe de bornes %1").arg(new_strip_name);
setText(str_1 + " " + str_2 + " " + str_3); setText(str_1 % " " % str_2 % " " % str_3);
} }
MoveTerminalCommand::MoveTerminalCommand(QVector<QSharedPointer<PhysicalTerminal>> terminals, TerminalStrip *old_strip, MoveTerminalCommand::MoveTerminalCommand(QVector<QSharedPointer<PhysicalTerminal>> terminals, TerminalStrip *old_strip,
@ -201,7 +201,7 @@ MoveTerminalCommand::MoveTerminalCommand(QVector<QSharedPointer<PhysicalTerminal
const auto str_3 = new_strip_name.isEmpty() ? QObject::tr("vers un groupe de bornes") : const auto str_3 = new_strip_name.isEmpty() ? QObject::tr("vers un groupe de bornes") :
QObject::tr("vers le groupe de bornes %1").arg(new_strip_name); QObject::tr("vers le groupe de bornes %1").arg(new_strip_name);
setText(str_1 + " " + str_2 + " " + str_3); setText(str_1 % " " % str_2 % " " % str_3);
} }
void MoveTerminalCommand::undo() void MoveTerminalCommand::undo()

View File

@ -177,7 +177,7 @@ void AutoNumberingManagementW::on_m_to_folios_cb_currentIndexChanged(int index)
QString from = ui->m_from_folios_cb->currentText(); QString from = ui->m_from_folios_cb->currentText();
QString to = ui->m_to_folios_cb->currentText(); QString to = ui->m_to_folios_cb->currentText();
ui->m_selected_folios_le->clear(); ui->m_selected_folios_le->clear();
ui->m_selected_folios_le->insert(from + " - " + to); ui->m_selected_folios_le->insert(from % " - " % to);
ui->m_selected_folios_le->setDisabled(true); ui->m_selected_folios_le->setDisabled(true);
} }
applyEnable(true); applyEnable(true);

View File

@ -138,12 +138,12 @@ void BorderProperties::fromXml(QDomElement &e) {
*/ */
void BorderProperties::toSettings(QSettings &settings, const QString &prefix) const void BorderProperties::toSettings(QSettings &settings, const QString &prefix) const
{ {
settings.setValue(prefix + "cols", columns_count); settings.setValue(prefix % "cols", columns_count);
settings.setValue(prefix + "colsize", columns_width); settings.setValue(prefix % "colsize", columns_width);
settings.setValue(prefix + "displaycols", display_columns); settings.setValue(prefix % "displaycols", display_columns);
settings.setValue(prefix + "rows", rows_count); settings.setValue(prefix % "rows", rows_count);
settings.setValue(prefix + "rowsize", rows_height); settings.setValue(prefix % "rowsize", rows_height);
settings.setValue(prefix + "displayrows", display_rows); settings.setValue(prefix % "displayrows", display_rows);
} }
/** /**
@ -156,13 +156,13 @@ void BorderProperties::toSettings(QSettings &settings, const QString &prefix) co
\~French prefixe a ajouter devant les noms des parametres \~French prefixe a ajouter devant les noms des parametres
*/ */
void BorderProperties::fromSettings(QSettings &settings, const QString &prefix) { void BorderProperties::fromSettings(QSettings &settings, const QString &prefix) {
columns_count = settings.value(prefix + "cols", columns_count).toInt(); columns_count = settings.value(prefix % "cols", columns_count).toInt();
columns_width = qRound(settings.value(prefix + "colsize", columns_width).toDouble()); columns_width = qRound(settings.value(prefix % "colsize", columns_width).toDouble());
display_columns = settings.value(prefix + "displaycols", display_columns).toBool(); display_columns = settings.value(prefix % "displaycols", display_columns).toBool();
rows_count = settings.value(prefix + "rows", rows_count).toInt(); rows_count = settings.value(prefix % "rows", rows_count).toInt();
rows_height = qRound(settings.value(prefix + "rowsize", rows_height).toDouble()); rows_height = qRound(settings.value(prefix % "rowsize", rows_height).toDouble());
display_rows = settings.value(prefix + "displayrows", display_rows).toBool(); display_rows = settings.value(prefix % "displayrows", display_rows).toBool();
} }
/** /**

View File

@ -949,7 +949,7 @@ QString BorderTitleBlock::incrementLetters(const QString &string) {
last_digit = (char)(string[string.length()-1].unicode()) + 1; last_digit = (char)(string[string.length()-1].unicode()) + 1;
return(first_digits + QString(last_digit)); return(first_digits + QString(last_digit));
} else { } else {
return(incrementLetters(first_digits) + "A"); return(incrementLetters(first_digits) % "A");
} }
} }
} }

View File

@ -49,7 +49,7 @@ bool ConductorNumExport::toCsv()
//save in csv file in same directory as project by default //save in csv file in same directory as project by default
QString dir = m_project->currentDir(); QString dir = m_project->currentDir();
if (dir.isEmpty()) dir = QETApp::documentDir(); if (dir.isEmpty()) dir = QETApp::documentDir();
QString name = dir + "/" + QObject::tr("numero_de_fileries_") + m_project->title() + ".csv"; QString name = dir % "/" % QObject::tr("numero_de_fileries_") % m_project->title() % ".csv";
// if(!name.endsWith(".csv")) { // if(!name.endsWith(".csv")) {
// name += ".csv"; // name += ".csv";
// } // }
@ -105,7 +105,7 @@ QString ConductorNumExport::wiresNum() const
for (QString key : list) for (QString key : list)
{ {
for (int i=0; i<m_hash.value(key) ; ++i) { for (int i=0; i<m_hash.value(key) ; ++i) {
csv.append(key + "\n"); csv.append(key % "\n");
} }
} }

View File

@ -549,7 +549,7 @@ void projectDataBase::prepareQuery()
//UPDATE DIAGRAM INFO //UPDATE DIAGRAM INFO
QString update_diagram_str("UPDATE diagram_info SET "); QString update_diagram_str("UPDATE diagram_info SET ");
for (auto str : QETInformation::diagramInfoKeys()) { for (auto str : QETInformation::diagramInfoKeys()) {
update_diagram_str.append(str + " = :" + str + ", "); update_diagram_str.append(str % " = :" % str % ", ");
} }
update_diagram_str.remove(update_diagram_str.length()-2, 2); //Remove the last ", " update_diagram_str.remove(update_diagram_str.length()-2, 2); //Remove the last ", "
update_diagram_str.append(" WHERE diagram_uuid = :uuid"); update_diagram_str.append(" WHERE diagram_uuid = :uuid");
@ -589,7 +589,7 @@ void projectDataBase::prepareQuery()
//UPDATE ELEMENT INFO //UPDATE ELEMENT INFO
QString update_str("UPDATE element_info SET "); QString update_str("UPDATE element_info SET ");
for (auto string : QETInformation::elementInfoKeys()) { for (auto string : QETInformation::elementInfoKeys()) {
update_str.append(string + " = :" + string + ", "); update_str.append(string % " = :" % string % ", ");
} }
update_str.remove(update_str.length()-2, 2); //Remove the last ", " update_str.remove(update_str.length()-2, 2); //Remove the last ", "
update_str.append(" WHERE element_uuid = :uuid"); update_str.append(" WHERE element_uuid = :uuid");
@ -678,7 +678,7 @@ void projectDataBase::exportDb(projectDataBase *db,
if(dir_.isEmpty()) { if(dir_.isEmpty()) {
dir_ = db->project()->filePath(); dir_ = db->project()->filePath();
if (dir_.isEmpty()) { if (dir_.isEmpty()) {
dir_ = QETApp::documentDir() + "/" + tr("sans_nom") + ".sqlite"; dir_ = QETApp::documentDir() % "/" % tr("sans_nom") % ".sqlite";
} else { } else {
dir_.remove(".qet"); dir_.remove(".qet");
dir_.append(".sqlite"); dir_.append(".sqlite");
@ -690,7 +690,7 @@ void projectDataBase::exportDb(projectDataBase *db,
return; return;
} }
QString connection_name("export_project_db_" + db->project()->uuid().toString()); QString connection_name("export_project_db_" % db->project()->uuid().toString());
if (true) //Enter in a scope only to nicely use QSqlDatabase::removeDatabase just after the end of the scope if (true) //Enter in a scope only to nicely use QSqlDatabase::removeDatabase just after the end of the scope
{ {

View File

@ -416,7 +416,7 @@ void ElementQueryWidget::setGroupBy(QString text, bool set)
void ElementQueryWidget::setCount(QString text, bool set) void ElementQueryWidget::setCount(QString text, bool set)
{ {
if (set) { if (set) {
m_count = QString(", " + text + " "); m_count = QString(", " % text % " ");
} else { } else {
m_count.clear(); m_count.clear();
} }
@ -489,7 +489,7 @@ QPair<int, QString> ElementQueryWidget::FilterFor(const QString &key) const
*/ */
void ElementQueryWidget::fillSavedQuery() void ElementQueryWidget::fillSavedQuery()
{ {
QFile file(QETApp::configDir() + "/nomenclature.json"); QFile file(QETApp::configDir() % "/nomenclature.json");
if (file.open(QFile::ReadOnly)) if (file.open(QFile::ReadOnly))
{ {
QJsonDocument jsd(QJsonDocument::fromJson(file.readAll())); QJsonDocument jsd(QJsonDocument::fromJson(file.readAll()));
@ -625,7 +625,7 @@ void ElementQueryWidget::on_m_load_pb_clicked()
return; return;
} }
QFile file_(QETApp::configDir() + "/nomenclature.json"); QFile file_(QETApp::configDir() % "/nomenclature.json");
if (!file_.open(QFile::ReadOnly)) { if (!file_.open(QFile::ReadOnly)) {
return; return;
} }
@ -650,7 +650,7 @@ void ElementQueryWidget::on_m_load_pb_clicked()
*/ */
void ElementQueryWidget::on_m_save_current_conf_pb_clicked() void ElementQueryWidget::on_m_save_current_conf_pb_clicked()
{ {
QFile file_(QETApp::configDir() + "/nomenclature.json"); QFile file_(QETApp::configDir() % "/nomenclature.json");
if (file_.open(QFile::ReadWrite)) if (file_.open(QFile::ReadWrite))
{ {

View File

@ -143,7 +143,7 @@ void SummaryQueryWidget::setUpItems()
*/ */
void SummaryQueryWidget::fillSavedQuery() void SummaryQueryWidget::fillSavedQuery()
{ {
QFile file(QETApp::configDir() + "/summary.json"); QFile file(QETApp::configDir() % "/summary.json");
if (file.open(QFile::ReadOnly)) if (file.open(QFile::ReadOnly))
{ {
QJsonDocument jsd(QJsonDocument::fromJson(file.readAll())); QJsonDocument jsd(QJsonDocument::fromJson(file.readAll()));
@ -296,7 +296,7 @@ void SummaryQueryWidget::reset()
*/ */
void SummaryQueryWidget::saveConfig() void SummaryQueryWidget::saveConfig()
{ {
QFile file_(QETApp::configDir() + "/summary.json"); QFile file_(QETApp::configDir() % "/summary.json");
if (file_.open(QFile::ReadWrite)) if (file_.open(QFile::ReadWrite))
{ {
@ -331,7 +331,7 @@ void SummaryQueryWidget::loadConfig()
return; return;
} }
QFile file_(QETApp::configDir() + "/summary.json"); QFile file_(QETApp::configDir() % "/summary.json");
if (!file_.open(QFile::ReadOnly)) { if (!file_.open(QFile::ReadOnly)) {
return; return;
} }

View File

@ -71,7 +71,7 @@ QByteArray dxfToElmt(const QString &file_path)
QString dxf2ElmtDirPath() QString dxf2ElmtDirPath()
{ {
return QETApp::dataDir() + "/binary"; return QETApp::dataDir() % "/binary";
} }
/** /**
@ -81,11 +81,11 @@ QString dxf2ElmtDirPath()
QString dxf2ElmtBinaryPath() QString dxf2ElmtBinaryPath()
{ {
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
return dxf2ElmtDirPath() + QStringLiteral("/dxf2elmt.exe"); return dxf2ElmtDirPath() % QStringLiteral("/dxf2elmt.exe");
#elif defined(Q_OS_MACOS) #elif defined(Q_OS_MACOS)
return dxf2ElmtDirPath() + QStringLiteral("/./dxf2elmt"); return dxf2ElmtDirPath() % QStringLiteral("/./dxf2elmt");
#else #else
return dxf2ElmtDirPath() + QStringLiteral("/dxf2elmt"); return dxf2ElmtDirPath() % QStringLiteral("/dxf2elmt");
#endif #endif
} }

View File

@ -59,7 +59,7 @@ ExportElementTextPattern::ExportElementTextPattern(Element *elmt) :
return; return;
//Check if a conf with the same name already exist //Check if a conf with the same name already exist
if (QFileInfo::exists(dir.absoluteFilePath(m_name + ".xml"))) if (QFileInfo::exists(dir.absoluteFilePath(m_name % ".xml")))
{ {
bool r = QMessageBox::question(parentWidget(), bool r = QMessageBox::question(parentWidget(),
QObject::tr("Configuration de textes"), QObject::tr("Configuration de textes"),
@ -71,7 +71,7 @@ ExportElementTextPattern::ExportElementTextPattern(Element *elmt) :
} }
QDomDocument doc = xmlConf(); QDomDocument doc = xmlConf();
QET::writeXmlFile(doc, dir.absoluteFilePath(m_name + ".xml")); QET::writeXmlFile(doc, dir.absoluteFilePath(m_name % ".xml"));
} }
/** /**
@ -202,7 +202,7 @@ void ImportElementTextPattern::apply(QString name, bool erase) const
if(!name.endsWith(".xml")) if(!name.endsWith(".xml"))
name.append(".xml"); name.append(".xml");
QFile conf_file(QETApp::configDir() + "/element_texts_pattern/" + name); QFile conf_file(QETApp::configDir() % "/element_texts_pattern/" % name);
if(!conf_file.open(QIODevice::ReadOnly | QIODevice::Text)) if(!conf_file.open(QIODevice::ReadOnly | QIODevice::Text))
return; return;

View File

@ -1014,7 +1014,7 @@ ExportDialog::ExportDiagramLine::ExportDiagramLine(Diagram *dia, QSize diagram_s
if (diagram_title.isEmpty()) diagram_title = QObject::tr("Folio sans titre"); if (diagram_title.isEmpty()) diagram_title = QObject::tr("Folio sans titre");
QString diagram_filename = diagram -> title(); QString diagram_filename = diagram -> title();
if (diagram_filename.isEmpty()) diagram_filename = QObject::tr("schema"); if (diagram_filename.isEmpty()) diagram_filename = QObject::tr("schema");
diagram_filename = QET::stringToFileName(diagram_index + "_" + diagram_filename); diagram_filename = QET::stringToFileName(diagram_index % "_" % diagram_filename);
title_label = new QLabel(diagram_title); title_label = new QLabel(diagram_title);

View File

@ -54,24 +54,24 @@ ExportProperties::~ExportProperties()
void ExportProperties::toSettings(QSettings &settings, void ExportProperties::toSettings(QSettings &settings,
const QString &prefix) const const QString &prefix) const
{ {
settings.setValue(prefix + "path", settings.setValue(prefix % "path",
QDir::toNativeSeparators( QDir::toNativeSeparators(
destination_directory.absolutePath())); destination_directory.absolutePath()));
settings.setValue(prefix + "format", settings.setValue(prefix % "format",
format); format);
settings.setValue(prefix + "drawgrid", settings.setValue(prefix % "drawgrid",
draw_grid); draw_grid);
settings.setValue(prefix + "drawborder", settings.setValue(prefix % "drawborder",
draw_border); draw_border);
settings.setValue(prefix + "drawtitleblock", settings.setValue(prefix % "drawtitleblock",
draw_titleblock); draw_titleblock);
settings.setValue(prefix + "drawterminals", settings.setValue(prefix % "drawterminals",
draw_terminals); draw_terminals);
settings.setValue(prefix + "drawbgtransparent", settings.setValue(prefix % "drawbgtransparent",
draw_bg_transparent); draw_bg_transparent);
settings.setValue(prefix + "drawcoloredconductors", settings.setValue(prefix % "drawcoloredconductors",
draw_colored_conductors); draw_colored_conductors);
settings.setValue(prefix + "area", settings.setValue(prefix % "area",
QET::diagramAreaToString(exported_area)); QET::diagramAreaToString(exported_area));
} }
@ -85,30 +85,30 @@ void ExportProperties::fromSettings(QSettings &settings,
QString export_path = QETApp::documentDir(); QString export_path = QETApp::documentDir();
destination_directory.setPath( destination_directory.setPath(
settings.value( settings.value(
prefix + "path", prefix % "path",
export_path).toString()); export_path).toString());
if (!destination_directory.exists()) if (!destination_directory.exists())
destination_directory.setPath(export_path); destination_directory.setPath(export_path);
format = settings.value(prefix + "format").toString(); format = settings.value(prefix % "format").toString();
draw_grid = settings.value(prefix + "drawgrid", draw_grid = settings.value(prefix % "drawgrid",
false).toBool(); false).toBool();
draw_border = settings.value(prefix + "drawborder", draw_border = settings.value(prefix % "drawborder",
true ).toBool(); true ).toBool();
draw_titleblock = settings.value(prefix + "drawtitleblock", draw_titleblock = settings.value(prefix % "drawtitleblock",
true ).toBool(); true ).toBool();
draw_terminals = settings.value(prefix + "drawterminals", draw_terminals = settings.value(prefix % "drawterminals",
false).toBool(); false).toBool();
draw_bg_transparent = settings.value(prefix + "drawbgtransparent", draw_bg_transparent = settings.value(prefix % "drawbgtransparent",
false).toBool(); false).toBool();
draw_colored_conductors = settings.value( draw_colored_conductors = settings.value(
prefix + "drawcoloredconductors", prefix % "drawcoloredconductors",
true ).toBool(); true ).toBool();
exported_area = QET::diagramAreaFromString( exported_area = QET::diagramAreaFromString(
settings.value( settings.value(
prefix + "area", prefix % "area",
"border").toString()); "border").toString());
} }

View File

@ -202,7 +202,7 @@ void AddTableDialog::on_m_table_margins_pb_clicked()
void AddTableDialog::saveConfig() void AddTableDialog::saveConfig()
{ {
QFile file_(QETApp::configDir() + "/graphics_table.json"); QFile file_(QETApp::configDir() % "/graphics_table.json");
if (file_.open(QFile::ReadWrite)) if (file_.open(QFile::ReadWrite))
{ {
@ -247,7 +247,7 @@ void AddTableDialog::loadConfig()
return; return;
} }
QFile file_(QETApp::configDir() + "/graphics_table.json"); QFile file_(QETApp::configDir() % "/graphics_table.json");
if (!file_.open(QFile::ReadOnly)) { if (!file_.open(QFile::ReadOnly)) {
return; return;
} }
@ -297,7 +297,7 @@ void AddTableDialog::loadConfig()
void AddTableDialog::fillSavedQuery() void AddTableDialog::fillSavedQuery()
{ {
QFile file(QETApp::configDir() + "/graphics_table.json"); QFile file(QETApp::configDir() % "/graphics_table.json");
if (file.open(QFile::ReadOnly)) if (file.open(QFile::ReadOnly))
{ {
QJsonDocument jsd(QJsonDocument::fromJson(file.readAll())); QJsonDocument jsd(QJsonDocument::fromJson(file.readAll()));

View File

@ -132,7 +132,7 @@ void myMessageOutput(QtMsgType type,
void delete_old_log_files(int days) void delete_old_log_files(int days)
{ {
const QDate today = QDate::currentDate(); const QDate today = QDate::currentDate();
const QString path = QETApp::dataDir() + "/"; const QString path = QETApp::dataDir() % "/";
QString filter("%1%1%1%1%1%1%1%1.log"); // pattern QString filter("%1%1%1%1%1%1%1%1.log"); // pattern
filter = filter.arg("[0123456789]"); // valid characters filter = filter.arg("[0123456789]"); // valid characters
@ -148,7 +148,7 @@ void delete_old_log_files(int days)
QDir deletefile; QDir deletefile;
deletefile.setPath(filepath); deletefile.setPath(filepath);
deletefile.remove(filepath); deletefile.remove(filepath);
qDebug() << "File " + filepath + " is deleted!"; qDebug() << "File " % filepath % " is deleted!";
} }
} }
} }

View File

@ -47,24 +47,24 @@ XRefProperties::XRefProperties()
void XRefProperties::toSettings(QSettings &settings, void XRefProperties::toSettings(QSettings &settings,
const QString prefix) const const QString prefix) const
{ {
settings.setValue(prefix + "showpowerctc", m_show_power_ctc); settings.setValue(prefix % "showpowerctc", m_show_power_ctc);
QString display = m_display == Cross? "cross" : "contacts"; QString display = m_display == Cross? "cross" : "contacts";
settings.setValue(prefix + "displayhas", display); settings.setValue(prefix % "displayhas", display);
QString snap = m_snap_to == Bottom? "bottom" : "label"; QString snap = m_snap_to == Bottom? "bottom" : "label";
settings.setValue(prefix + "snapto", snap); settings.setValue(prefix % "snapto", snap);
int offset = m_offset; int offset = m_offset;
settings.setValue(prefix + "offset", offset); settings.setValue(prefix % "offset", offset);
QString master_label = m_master_label; QString master_label = m_master_label;
settings.setValue(prefix + "master_label", master_label); settings.setValue(prefix % "master_label", master_label);
QString slave_label = m_slave_label; QString slave_label = m_slave_label;
settings.setValue(prefix + "slave_label", slave_label); settings.setValue(prefix % "slave_label", slave_label);
QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>(); QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>();
settings.setValue(prefix + "xrefpos", var.valueToKey(m_xref_pos)); settings.setValue(prefix % "xrefpos", var.valueToKey(m_xref_pos));
foreach (QString key, m_prefix.keys()) { foreach (QString key, m_prefix.keys()) {
settings.setValue(prefix + key + "prefix", m_prefix.value(key)); settings.setValue(prefix % key % "prefix", m_prefix.value(key));
} }
} }
@ -77,20 +77,20 @@ void XRefProperties::toSettings(QSettings &settings,
void XRefProperties::fromSettings(const QSettings &settings, void XRefProperties::fromSettings(const QSettings &settings,
const QString prefix) const QString prefix)
{ {
m_show_power_ctc = settings.value(prefix + "showpowerctc", true).toBool(); m_show_power_ctc = settings.value(prefix % "showpowerctc", true).toBool();
QString display = settings.value(prefix + "displayhas", "cross").toString(); QString display = settings.value(prefix % "displayhas", "cross").toString();
display == "cross"? m_display = Cross : m_display = Contacts; display == "cross"? m_display = Cross : m_display = Contacts;
QString snap = settings.value(prefix + "snapto", "label").toString(); QString snap = settings.value(prefix % "snapto", "label").toString();
snap == "bottom"? m_snap_to = Bottom : m_snap_to = Label; snap == "bottom"? m_snap_to = Bottom : m_snap_to = Label;
m_offset = settings.value(prefix + "offset", "0").toInt(); m_offset = settings.value(prefix % "offset", "0").toInt();
m_master_label = settings.value(prefix + "master_label", "%f-%l%c").toString(); m_master_label = settings.value(prefix % "master_label", "%f-%l%c").toString();
m_slave_label = settings.value(prefix + "slave_label", "(%f-%l%c)").toString(); m_slave_label = settings.value(prefix % "slave_label", "(%f-%l%c)").toString();
QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>(); QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>();
m_xref_pos = Qt::AlignmentFlag(var.keyToValue((settings.value(prefix + "xrefpos").toString()).toStdString().data())); m_xref_pos = Qt::AlignmentFlag(var.keyToValue((settings.value(prefix % "xrefpos").toString()).toStdString().data()));
for (QString key : m_prefix_keys) { for (QString key : m_prefix_keys) {
m_prefix.insert(key, settings.value(prefix + key + "prefix").toString()); m_prefix.insert(key, settings.value(prefix + key % "prefix").toString());
} }
} }
@ -124,7 +124,7 @@ QDomElement XRefProperties::toXml(QDomDocument &xml_document) const
QString slave_label = m_slave_label; QString slave_label = m_slave_label;
xml_element.setAttribute("slave_label", slave_label); xml_element.setAttribute("slave_label", slave_label);
foreach (QString key, m_prefix.keys()) { foreach (QString key, m_prefix.keys()) {
xml_element.setAttribute(key + "prefix", m_prefix.value(key)); xml_element.setAttribute(key % "prefix", m_prefix.value(key));
} }
return xml_element; return xml_element;
@ -155,7 +155,7 @@ bool XRefProperties::fromXml(const QDomElement &xml_element) {
m_master_label = xml_element.attribute("master_label", "%f-%l%c"); m_master_label = xml_element.attribute("master_label", "%f-%l%c");
m_slave_label = xml_element.attribute("slave_label","(%f-%l%c)"); m_slave_label = xml_element.attribute("slave_label","(%f-%l%c)");
foreach (QString key, m_prefix_keys) { foreach (QString key, m_prefix_keys) {
m_prefix.insert(key, xml_element.attribute(key + "prefix")); m_prefix.insert(key, xml_element.attribute(key % "prefix"));
} }
return true; return true;
} }

View File

@ -113,7 +113,7 @@ QByteArray ElementScaler(const QString &file_path, QWidget *parent)
QString ElementScalerDirPath() QString ElementScalerDirPath()
{ {
return QETApp::dataDir() + "/binary"; return QETApp::dataDir() % "/binary";
} }
/** /**
@ -123,11 +123,11 @@ QString ElementScalerDirPath()
QString ElementScalerBinaryPath() QString ElementScalerBinaryPath()
{ {
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
return ElementScalerDirPath() + QStringLiteral("/QET_ElementScaler.exe"); return ElementScalerDirPath() % QStringLiteral("/QET_ElementScaler.exe");
#elif defined(Q_OS_MACOS) #elif defined(Q_OS_MACOS)
return ElementScalerDirPath() + QStringLiteral("/./QET_ElementScaler"); return ElementScalerDirPath() % QStringLiteral("/./QET_ElementScaler");
#else #else
return ElementScalerDirPath() + QStringLiteral("/QET_ElementScaler"); return ElementScalerDirPath() % QStringLiteral("/QET_ElementScaler");
#endif #endif
} }

View File

@ -1141,7 +1141,7 @@ ElementsLocation QETProject::importElement(ElementsLocation &location)
do do
{ {
a++; a++;
QString new_path = parent_path + "/" + name_ + QString::number(a) + ".elmt"; QString new_path = parent_path % "/" % name_ % QString::number(a) % ".elmt";
loc = ElementsLocation (new_path); loc = ElementsLocation (new_path);
} while (loc.exist()); } while (loc.exist());

View File

@ -132,7 +132,7 @@ void RecentFiles::extractFilesFromSettings()
QSettings settings; QSettings settings;
for (int i = size_ ; i >= 1 ; -- i) for (int i = size_ ; i >= 1 ; -- i)
{ {
QString key(identifier_ + "-recentfiles/file" + QString::number(i)); QString key(identifier_ % "-recentfiles/file" % QString::number(i));
QString value(settings.value(key, QString()).toString()); QString value(settings.value(key, QString()).toString());
insertFile(value); insertFile(value);
} }
@ -165,7 +165,7 @@ void RecentFiles::saveFilesToSettings()
QSettings settings; QSettings settings;
for (int i = 0 ; i < size_ && i < list_.count() ; ++ i) for (int i = 0 ; i < size_ && i < list_.count() ; ++ i)
{ {
QString key(identifier_ + "-recentfiles/file" + QString::number(i + 1)); QString key(identifier_ % "-recentfiles/file" % QString::number(i + 1));
settings.setValue(key, list_[i]); settings.setValue(key, list_[i]);
} }
} }

View File

@ -312,7 +312,7 @@ void TitleBlockTemplateLogoManager::exportLogo()
QString filepath = QFileDialog::getSaveFileName( QString filepath = QFileDialog::getSaveFileName(
this, this,
tr("Choisir un fichier pour exporter ce logo"), tr("Choisir un fichier pour exporter ce logo"),
open_dialog_dir_.absolutePath() + "/" + current_logo, open_dialog_dir_.absolutePath() % "/" % current_logo,
tr("Tous les fichiers (*);;Images vectorielles (*.svg);;Images bitmap (*.png *.jpg *.jpeg *.gif *.bmp *.xpm)") tr("Tous les fichiers (*);;Images vectorielles (*.svg);;Images bitmap (*.png *.jpg *.jpeg *.gif *.bmp *.xpm)")
); );
if (filepath.isEmpty()) return; if (filepath.isEmpty()) return;

View File

@ -140,20 +140,20 @@ void TitleBlockProperties::fromXml(const QDomElement &e) {
*/ */
void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix) const void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix) const
{ {
settings.setValue(prefix + "title", title); settings.setValue(prefix % "title", title);
settings.setValue(prefix + "author", author); settings.setValue(prefix % "author", author);
settings.setValue(prefix + "filename", filename); settings.setValue(prefix % "filename", filename);
settings.setValue(prefix + "plant", plant); settings.setValue(prefix % "plant", plant);
settings.setValue(prefix + "locmach", locmach); settings.setValue(prefix % "locmach", locmach);
settings.setValue(prefix + "indexrev", indexrev); settings.setValue(prefix % "indexrev", indexrev);
settings.setValue(prefix + "version", version); settings.setValue(prefix % "version", version);
settings.setValue(prefix + "folio", folio); settings.setValue(prefix % "folio", folio);
settings.setValue(prefix + "auto_page_num", auto_page_num); settings.setValue(prefix % "auto_page_num", auto_page_num);
settings.setValue(prefix + "date", exportDate()); settings.setValue(prefix % "date", exportDate());
settings.setValue(prefix + "displayAt", (display_at == Qt::BottomEdge? "bottom" : "right")); settings.setValue(prefix % "displayAt", (display_at == Qt::BottomEdge? "bottom" : "right"));
settings.setValue(prefix + "titleblocktemplate", template_name.isEmpty()? QString() : template_name); settings.setValue(prefix % "titleblocktemplate", template_name.isEmpty()? QString() : template_name);
settings.setValue(prefix + "titleblocktemplateCollection", QET::qetCollectionToString(collection)); settings.setValue(prefix % "titleblocktemplateCollection", QET::qetCollectionToString(collection));
context.toSettings(settings, prefix + "properties"); context.toSettings(settings, prefix % "properties");
} }
/** /**
@ -162,20 +162,20 @@ void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix
@param prefix prefixe a ajouter devant les noms des parametres @param prefix prefixe a ajouter devant les noms des parametres
*/ */
void TitleBlockProperties::fromSettings(QSettings &settings, const QString &prefix) { void TitleBlockProperties::fromSettings(QSettings &settings, const QString &prefix) {
title = settings.value(prefix + "title").toString(); title = settings.value(prefix % "title").toString();
author = settings.value(prefix + "author").toString(); author = settings.value(prefix % "author").toString();
filename = settings.value(prefix + "filename").toString(); filename = settings.value(prefix % "filename").toString();
plant = settings.value(prefix + "plant").toString(); plant = settings.value(prefix % "plant").toString();
locmach = settings.value(prefix + "locmach").toString(); locmach = settings.value(prefix % "locmach").toString();
indexrev = settings.value(prefix + "indexrev").toString(); indexrev = settings.value(prefix % "indexrev").toString();
version = settings.value(prefix + "version").toString(); version = settings.value(prefix % "version").toString();
folio = settings.value(prefix + "folio", "%id/%total").toString(); folio = settings.value(prefix % "folio", "%id/%total").toString();
auto_page_num = settings.value(prefix + "auto_page_num").toString(); auto_page_num = settings.value(prefix % "auto_page_num").toString();
setDateFromString(settings.value(prefix + "date").toString()); setDateFromString(settings.value(prefix % "date").toString());
display_at = (settings.value(prefix + "displayAt", QVariant("bottom")).toString() == "bottom" ? Qt::BottomEdge : Qt::RightEdge); display_at = (settings.value(prefix % "displayAt", QVariant("bottom")).toString() == "bottom" ? Qt::BottomEdge : Qt::RightEdge);
template_name = settings.value(prefix + "titleblocktemplate").toString(); template_name = settings.value(prefix % "titleblocktemplate").toString();
collection = QET::qetCollectionFromString(settings.value(prefix + "titleblocktemplateCollection").toString()); collection = QET::qetCollectionFromString(settings.value(prefix % "titleblocktemplateCollection").toString());
context.fromSettings(settings, prefix + "properties"); context.fromSettings(settings, prefix % "properties");
} }
/** /**

View File

@ -1740,9 +1740,9 @@ QString TitleBlockTemplate::interpreteVariables(
QString interpreted_string = string; QString interpreted_string = string;
foreach (QString key, foreach (QString key,
diagram_context.keys(DiagramContext::DecreasingLength)) { diagram_context.keys(DiagramContext::DecreasingLength)) {
interpreted_string.replace("%{" + key + "}", interpreted_string.replace("%{" % key % "}",
diagram_context[key].toString()); diagram_context[key].toString());
interpreted_string.replace("%" + key, interpreted_string.replace("%" % key,
diagram_context[key].toString()); diagram_context[key].toString());
} }
return(interpreted_string); return(interpreted_string);

View File

@ -65,7 +65,7 @@ int BOMExportDialog::exec()
//save in csv file in same directory as project by default //save in csv file in same directory as project by default
QString dir = m_project->currentDir(); QString dir = m_project->currentDir();
if (dir.isEmpty()) dir = QETApp::documentDir(); if (dir.isEmpty()) dir = QETApp::documentDir();
QString file_name = dir + "/" + tr("nomenclature_") + QString(m_project ->title() + ".csv"); QString file_name = dir % "/" % tr("nomenclature_") % QString(m_project ->title() % ".csv");
QString file_path = QFileDialog::getSaveFileName(this, tr("Enregister sous... "), file_name, tr("Fichiers csv (*.csv)")); QString file_path = QFileDialog::getSaveFileName(this, tr("Enregister sous... "), file_name, tr("Fichiers csv (*.csv)"));
QFile file(file_path); QFile file(file_path);
if (!file_path.isEmpty()) if (!file_path.isEmpty())
@ -132,7 +132,7 @@ QString BOMExportDialog::getBom()
} }
} }
return_string = header_name.join(";") + "\n"; return_string = header_name.join(";") % "\n";
} }
//ROWS //ROWS
@ -151,7 +151,7 @@ QString BOMExportDialog::getBom()
++i; ++i;
} }
return_string += values.join(";") + "\n"; return_string += values.join(";") % "\n";
values.clear(); values.clear();
} }
} }

View File

@ -339,9 +339,9 @@ void PrintConfigPage::applyConf()
epw -> exportProperties().toSettings(settings, prefix); epw -> exportProperties().toSettings(settings, prefix);
// annule l'enregistrement de certaines proprietes non pertinentes // annule l'enregistrement de certaines proprietes non pertinentes
settings.remove(prefix + "path"); settings.remove(prefix % "path");
settings.remove(prefix + "format"); settings.remove(prefix % "format");
settings.remove(prefix + "area"); settings.remove(prefix % "area");
} }
/// @return l'icone de cette page /// @return l'icone de cette page