Apply clang-format to Lts/Common and DTC/enum headers
- Formatted all CodeGen module files (9 files) - Formatted LtsAppDescriptor module files - Formatted LtsAppManager/AppChooser files - Applied clang-format to all DTC and enum headers across modules - Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/) Cosmetic changes only, no functional modifications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
848 files changed
+89305
-100020
No files matched your search
Executable → Regular
+69
-83
@@ -1,114 +1,100 @@
|
||||
|
||||
|
||||
|
||||
#include "style_manager.h"
|
||||
|
||||
#include <LtsPluginManager/lts_plugin_loader.h>
|
||||
#include <PluginInterfaces/style_plugin_interface.h>
|
||||
|
||||
#include <QPluginLoader>
|
||||
#include <QDebug>
|
||||
|
||||
#include <QPluginLoader>
|
||||
|
||||
namespace LtsUtils
|
||||
{
|
||||
|
||||
struct StyleManagerHandler
|
||||
{
|
||||
StyleManager styleManager;
|
||||
StyleManager styleManager;
|
||||
};
|
||||
Q_GLOBAL_STATIC(StyleManagerHandler, s_styleManagerHandler)
|
||||
|
||||
|
||||
StyleManager *StyleManager::getInstance()
|
||||
StyleManager* StyleManager::getInstance()
|
||||
{
|
||||
return &s_styleManagerHandler->styleManager;
|
||||
return &s_styleManagerHandler->styleManager;
|
||||
}
|
||||
|
||||
bool StyleManager::loadStyle(const QString &stylePluginName, bool highDpi)
|
||||
bool StyleManager::loadStyle(const QString& stylePluginName, bool highDpi)
|
||||
{
|
||||
if (m_currentStylePluginLoader != nullptr)
|
||||
{
|
||||
|
||||
if (m_currentStylePluginLoader != nullptr)
|
||||
{
|
||||
|
||||
QObject *pluginInstance = m_currentStylePluginLoader->instance();
|
||||
StylePlugin::Plugin *sp = qobject_cast<StylePlugin::Plugin *>(pluginInstance);
|
||||
QObject* pluginInstance = m_currentStylePluginLoader->instance();
|
||||
StylePlugin::Plugin* sp = qobject_cast<StylePlugin::Plugin*>(pluginInstance);
|
||||
|
||||
if (sp == nullptr)
|
||||
{
|
||||
qWarning() << "StyleManager::loadStyle: could not unload style plugin - wrong type ("
|
||||
<< pluginInstance->metaObject()->className() << ") - new style not loaded";
|
||||
return false;
|
||||
}
|
||||
|
||||
sp->unloadStyle();
|
||||
|
||||
m_currentStylePluginLoader = nullptr;
|
||||
}
|
||||
|
||||
LtsPluginManager::LtsPluginLoader* pluginLoader = LtsPluginManager::LtsPluginLoader::getInstance();
|
||||
|
||||
QPluginLoader* stylePluginLoader = nullptr;
|
||||
int pluginsLoaded = 0;
|
||||
|
||||
std::function<bool(const LtsPluginManager::PluginInstance& pi)> loadPluginFn =
|
||||
[&stylePluginLoader, &pluginsLoaded](const LtsPluginManager::PluginInstance& pi) {
|
||||
stylePluginLoader = pi.pluginLoader;
|
||||
pluginsLoaded++;
|
||||
return true;
|
||||
};
|
||||
|
||||
if (!pluginLoader->loadPlugins(LtsPluginManager::PluginType::STYLE, loadPluginFn, QStringList() << stylePluginName))
|
||||
{
|
||||
qWarning() << "StyleManager::loadStyle: Error loading Style Plugin - using default Qt style";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pluginsLoaded == 0)
|
||||
{
|
||||
qWarning() << "StyleManager::loadStyle: Could not find Style Plugin" << stylePluginName
|
||||
<< "- using default Qt style";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pluginsLoaded > 1)
|
||||
{
|
||||
qWarning() << "StyleManager::loadStyle: Style Plugin" << stylePluginName
|
||||
<< " is ambiguous - using default Qt style";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stylePluginLoader == nullptr)
|
||||
{
|
||||
qWarning() << "StyleManager::loadStyle: No Style Plugin loader available - using default Qt style";
|
||||
return false;
|
||||
}
|
||||
|
||||
StylePlugin::Plugin* sp = qobject_cast<StylePlugin::Plugin*>(stylePluginLoader->instance());
|
||||
|
||||
if (sp == nullptr)
|
||||
{
|
||||
qWarning() << "StyleManager::loadStyle: could not unload style plugin - wrong type ("
|
||||
<< pluginInstance->metaObject()->className() << ") - new style not loaded";
|
||||
return false;
|
||||
qWarning() << "StyleManager::loadStyle: could not load style plugin - wrong type ("
|
||||
<< stylePluginLoader->instance()->metaObject()->className() << ") - new style not loaded";
|
||||
return false;
|
||||
}
|
||||
|
||||
sp->unloadStyle();
|
||||
sp->loadStyle(highDpi);
|
||||
|
||||
|
||||
m_currentStylePluginLoader = stylePluginLoader;
|
||||
m_stylePluginName = stylePluginName;
|
||||
emit signalStyleChanged(stylePluginName);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
m_currentStylePluginLoader = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LtsPluginManager::LtsPluginLoader *pluginLoader = LtsPluginManager::LtsPluginLoader::getInstance();
|
||||
|
||||
QPluginLoader *stylePluginLoader = nullptr;
|
||||
int pluginsLoaded = 0;
|
||||
|
||||
std::function<bool(const LtsPluginManager::PluginInstance &pi)> loadPluginFn = [&stylePluginLoader, &pluginsLoaded]
|
||||
(const LtsPluginManager::PluginInstance &pi)
|
||||
{
|
||||
stylePluginLoader = pi.pluginLoader;
|
||||
pluginsLoaded++;
|
||||
return true;
|
||||
};
|
||||
|
||||
if (!pluginLoader->loadPlugins(LtsPluginManager::PluginType::STYLE, loadPluginFn, QStringList() << stylePluginName))
|
||||
{
|
||||
qWarning() << "StyleManager::loadStyle: Error loading Style Plugin - using default Qt style";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pluginsLoaded == 0)
|
||||
{
|
||||
qWarning() << "StyleManager::loadStyle: Could not find Style Plugin" << stylePluginName << "- using default Qt style";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pluginsLoaded > 1)
|
||||
{
|
||||
qWarning() << "StyleManager::loadStyle: Style Plugin" << stylePluginName << " is ambiguous - using default Qt style";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stylePluginLoader == nullptr)
|
||||
{
|
||||
qWarning() << "StyleManager::loadStyle: No Style Plugin loader available - using default Qt style";
|
||||
return false;
|
||||
}
|
||||
|
||||
StylePlugin::Plugin *sp = qobject_cast<StylePlugin::Plugin *>(stylePluginLoader->instance());
|
||||
|
||||
if (sp == nullptr)
|
||||
{
|
||||
qWarning() << "StyleManager::loadStyle: could not load style plugin - wrong type ("
|
||||
<< stylePluginLoader->instance()->metaObject()->className() << ") - new style not loaded";
|
||||
return false;
|
||||
}
|
||||
|
||||
sp->loadStyle(highDpi);
|
||||
|
||||
m_currentStylePluginLoader = stylePluginLoader;
|
||||
m_stylePluginName = stylePluginName;
|
||||
emit signalStyleChanged(stylePluginName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace LtsUtils
|
||||
Reference in new issue
Block a user