Changeset View
Changeset View
Standalone View
Standalone View
src/libkirigami/platformtheme.cpp
Show First 20 Lines • Show All 691 Lines • ▼ Show 20 Line(s) | |||||
692 | { | 692 | { | ||
693 | static bool s_factoryChecked = false; | 693 | static bool s_factoryChecked = false; | ||
694 | 694 | | |||
695 | //check for the plugin only once: it's an heavy operation | 695 | //check for the plugin only once: it's an heavy operation | ||
696 | if (PlatformThemePrivate::s_pluginFactory) { | 696 | if (PlatformThemePrivate::s_pluginFactory) { | ||
697 | return PlatformThemePrivate::s_pluginFactory->createPlatformTheme(object); | 697 | return PlatformThemePrivate::s_pluginFactory->createPlatformTheme(object); | ||
698 | } else if (!s_factoryChecked) { | 698 | } else if (!s_factoryChecked) { | ||
699 | s_factoryChecked = true; | 699 | s_factoryChecked = true; | ||
700 | #if QT_CONFIG(library) | ||||
700 | for (const QString &path : QCoreApplication::libraryPaths()) { | 701 | for (const QString &path : QCoreApplication::libraryPaths()) { | ||
701 | QDir dir(path + "/kf5/kirigami"); | 702 | QDir dir(path + "/kf5/kirigami"); | ||
702 | for (const QString &fileName : dir.entryList(QDir::Files)) { | 703 | for (const QString &fileName : dir.entryList(QDir::Files)) { | ||
703 | //TODO: env variable? | 704 | //TODO: env variable? | ||
704 | if (fileName.startsWith(QQuickStyle::name())) { | 705 | if (fileName.startsWith(QQuickStyle::name())) { | ||
705 | QPluginLoader loader(dir.absoluteFilePath(fileName)); | 706 | QPluginLoader loader(dir.absoluteFilePath(fileName)); | ||
706 | QObject *plugin = loader.instance(); | 707 | QObject *plugin = loader.instance(); | ||
707 | //TODO: load actually a factory as plugin | 708 | //TODO: load actually a factory as plugin | ||
708 | 709 | | |||
709 | KirigamiPluginFactory *factory = qobject_cast<KirigamiPluginFactory *>(plugin); | 710 | KirigamiPluginFactory *factory = qobject_cast<KirigamiPluginFactory *>(plugin); | ||
710 | if (factory) { | 711 | if (factory) { | ||
711 | PlatformThemePrivate::s_pluginFactory = factory; | 712 | PlatformThemePrivate::s_pluginFactory = factory; | ||
712 | return factory->createPlatformTheme(object); | 713 | return factory->createPlatformTheme(object); | ||
713 | } | 714 | } | ||
714 | } | 715 | } | ||
715 | } | 716 | } | ||
716 | } | 717 | } | ||
718 | #endif | ||||
717 | } | 719 | } | ||
718 | 720 | | |||
719 | return new BasicTheme(object); | 721 | return new BasicTheme(object); | ||
720 | } | 722 | } | ||
721 | 723 | | |||
722 | } | 724 | } | ||
723 | 725 | | |||
724 | #include "moc_platformtheme.cpp" | 726 | #include "moc_platformtheme.cpp" |