Revert "some minor changes"

This commit is contained in:
Laurent Trinques
2024-04-10 14:31:01 +02:00
committed by GitHub
parent 7e6befdf0a
commit f4ac69a805
21 changed files with 727 additions and 759 deletions

View File

@@ -170,7 +170,7 @@ QETApp::~QETApp()
ElementFactory::dropInstance();
ElementPictureFactory::dropInstance();
MachineInfo::dropInstance();
TerminalStripEditorWindow::dropInstance();
TerminalStripEditorWindow::dropInstance();
}
@@ -589,101 +589,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::companyElementsDir
@return the dir path of company elements collection appended with a
"/" separator
@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;
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;
}
}
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-company/";
return m_company_element_dir;
}
m_company_element_dir = configDir() + "elements-company/";
return m_company_element_dir;
}
}
/**
@brief QETApp::commonElementsDirN
like QString QETApp::commonElementsDir but without "/" at the end
@return QString path
@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
@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;
QString path = companyElementsDir();
if (path.endsWith("/")) path.remove(path.length()-1, 1);
return path;
}
/**
@@ -1263,7 +1263,7 @@ QFont QETApp::indiTextsItemFont(qreal size)
*/
QList<QETDiagramEditor *> QETApp::diagramEditors()
{
return(QETApp::instance() -> detectWindows<QETDiagramEditor>());
return(QETApp::instance() -> detectWindows<QETDiagramEditor>());
}
/**
@@ -1273,18 +1273,18 @@ QList<QETDiagramEditor *> QETApp::diagramEditors()
*/
QETDiagramEditor *QETApp::diagramEditor(QETProject *project)
{
for (const auto &editor : QETApp::instance()->detectWindows<QETDiagramEditor>())
{
for (const auto &project_view : editor->openedProjects())
{
if (project_view->project() == project)
{
return editor;
}
}
}
for (const auto &editor : QETApp::instance()->detectWindows<QETDiagramEditor>())
{
for (const auto &project_view : editor->openedProjects())
{
if (project_view->project() == project)
{
return editor;
}
}
}
return nullptr;
return nullptr;
}
/**
@@ -2044,21 +2044,21 @@ 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 company_elements_dir(QETApp::companyElementsDir());
if (!company_elements_dir.exists())
company_elements_dir.mkpath(QETApp::companyElementsDir());
QDir company_elements_dir(QETApp::companyElementsDir());
if (!company_elements_dir.exists())
company_elements_dir.mkpath(QETApp::companyElementsDir());
QDir company_tbt_dir(QETApp::companyTitleBlockTemplatesDir());
if (!company_tbt_dir.exists())
company_tbt_dir.mkpath(QETApp::companyTitleBlockTemplatesDir());
QDir company_tbt_dir(QETApp::companyTitleBlockTemplatesDir());
if (!company_tbt_dir.exists())
company_tbt_dir.mkpath(QETApp::companyTitleBlockTemplatesDir());
QDir custom_tbt_dir(QETApp::customTitleBlockTemplatesDir());
if (!custom_tbt_dir.exists())
custom_tbt_dir.mkpath(QETApp::customTitleBlockTemplatesDir());
QDir custom_tbt_dir(QETApp::customTitleBlockTemplatesDir());
if (!custom_tbt_dir.exists())
custom_tbt_dir.mkpath(QETApp::customTitleBlockTemplatesDir());
/* recent files
* note:
@@ -2454,7 +2454,7 @@ void QETApp::printHelp()
*/
void QETApp::printVersion()
{
std::cout << qPrintable(QetVersion::displayedVersion()) << std::endl;
std::cout << qPrintable(QetVersion::displayedVersion()) << std::endl;
}
/**