diff --git a/support/SkinnyPlugin.cpp b/support/SkinnyPlugin.cpp index 9fe6b22d..22fdaa59 100644 --- a/support/SkinnyPlugin.cpp +++ b/support/SkinnyPlugin.cpp @@ -3,21 +3,29 @@ * This file may be used under the terms of the 3-clause BSD License *****************************************************************************/ -#include +#if defined( ENSURE_SKINS ) +#include #include #include +#include + +#endif + +#if defined( PLUGIN_PATH ) #include #include #include -#include #define STRINGIFY(x) #x #define STRING(x) STRINGIFY(x) +#endif + static void initPlugins() { +#if defined( PLUGIN_PATH ) const char env[] = "QT_PLUGIN_PATH"; QByteArray value = qgetenv( env ); @@ -27,7 +35,9 @@ static void initPlugins() value += STRING( PLUGIN_PATH ); qputenv( "QT_PLUGIN_PATH", value ); +#endif +#if defined( ENSURE_SKINS ) if ( qskSkinManager->skinNames().isEmpty() ) { using namespace std; @@ -40,8 +50,9 @@ static void initPlugins() qskSkinManager->registerFactory( "SquiekFactory", new QskSquiekSkinFactory() ); qskSkinManager->registerFactory( "MaterialFactory", new QskMaterialSkinFactory() ); - cout << "Couldn't find skin plugins, adding them manually instead." << endl; + cout << "Couldn't find skin plugins, adding some manually." << endl; } +#endif } Q_COREAPP_STARTUP_FUNCTION( initPlugins ) diff --git a/support/support.pro b/support/support.pro index 16648b77..93db3bd9 100644 --- a/support/support.pro +++ b/support/support.pro @@ -10,6 +10,7 @@ TARGET = qsktestsupport DESTDIR = $${QSK_OUT_ROOT}/lib QT += quick +CONFIG += ensure_skins contains(QSK_CONFIG, QskDll) { @@ -25,11 +26,6 @@ QSK_DIRS = \ $${QSK_ROOT}/src/controls \ $${QSK_ROOT}/src/graphic -QSK_DIRS += $${QSK_ROOT}/skins - -DEFINES += PLUGIN_PATH=$$clean_path( $$QSK_PLUGIN_DIR ) -QSK_DIRS += $${QSK_ROOT}/skins - INCLUDEPATH *= $${QSK_DIRS} DEPENDPATH *= $${QSK_DIRS} @@ -50,6 +46,19 @@ SOURCES += \ RESOURCES += \ fonts.qrc -QMAKE_RPATHDIR *= $${QSK_PLUGIN_DIR}/skins -LIBS *= -L$${QSK_PLUGIN_DIR}/skins -lsquiekskin -lmaterialskin +DEFINES += PLUGIN_PATH=$$clean_path( $$QSK_PLUGIN_DIR ) + +ensure_skins { + + # Enabling fall back code, that inserts some skin factories manually + # when not finding skin factories as plugins + + INCLUDEPATH *= $${QSK_ROOT}/skins + DEPENDPATH *= $${QSK_ROOT}/skins + + DEFINES += ENSURE_SKINS + + QMAKE_RPATHDIR *= $${QSK_PLUGIN_DIR}/skins + LIBS *= -L$${QSK_PLUGIN_DIR}/skins -lsquiekskin -lmaterialskin +}