making the skin factory fallback loader configurable
This commit is contained in:
parent
6813d643d3
commit
8413b8db9c
@ -3,21 +3,29 @@
|
|||||||
* This file may be used under the terms of the 3-clause BSD License
|
* This file may be used under the terms of the 3-clause BSD License
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include <QskSkinManager.h>
|
#if defined( ENSURE_SKINS )
|
||||||
|
|
||||||
|
#include <QskSkinManager.h>
|
||||||
#include <squiek/QskSquiekSkinFactory.h>
|
#include <squiek/QskSquiekSkinFactory.h>
|
||||||
#include <material/QskMaterialSkinFactory.h>
|
#include <material/QskMaterialSkinFactory.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( PLUGIN_PATH )
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#define STRINGIFY(x) #x
|
#define STRINGIFY(x) #x
|
||||||
#define STRING(x) STRINGIFY(x)
|
#define STRING(x) STRINGIFY(x)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static void initPlugins()
|
static void initPlugins()
|
||||||
{
|
{
|
||||||
|
#if defined( PLUGIN_PATH )
|
||||||
const char env[] = "QT_PLUGIN_PATH";
|
const char env[] = "QT_PLUGIN_PATH";
|
||||||
|
|
||||||
QByteArray value = qgetenv( env );
|
QByteArray value = qgetenv( env );
|
||||||
@ -27,7 +35,9 @@ static void initPlugins()
|
|||||||
value += STRING( PLUGIN_PATH );
|
value += STRING( PLUGIN_PATH );
|
||||||
|
|
||||||
qputenv( "QT_PLUGIN_PATH", value );
|
qputenv( "QT_PLUGIN_PATH", value );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( ENSURE_SKINS )
|
||||||
if ( qskSkinManager->skinNames().isEmpty() )
|
if ( qskSkinManager->skinNames().isEmpty() )
|
||||||
{
|
{
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -40,8 +50,9 @@ static void initPlugins()
|
|||||||
qskSkinManager->registerFactory( "SquiekFactory", new QskSquiekSkinFactory() );
|
qskSkinManager->registerFactory( "SquiekFactory", new QskSquiekSkinFactory() );
|
||||||
qskSkinManager->registerFactory( "MaterialFactory", new QskMaterialSkinFactory() );
|
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 )
|
Q_COREAPP_STARTUP_FUNCTION( initPlugins )
|
||||||
|
@ -10,6 +10,7 @@ TARGET = qsktestsupport
|
|||||||
DESTDIR = $${QSK_OUT_ROOT}/lib
|
DESTDIR = $${QSK_OUT_ROOT}/lib
|
||||||
|
|
||||||
QT += quick
|
QT += quick
|
||||||
|
CONFIG += ensure_skins
|
||||||
|
|
||||||
contains(QSK_CONFIG, QskDll) {
|
contains(QSK_CONFIG, QskDll) {
|
||||||
|
|
||||||
@ -25,11 +26,6 @@ QSK_DIRS = \
|
|||||||
$${QSK_ROOT}/src/controls \
|
$${QSK_ROOT}/src/controls \
|
||||||
$${QSK_ROOT}/src/graphic
|
$${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}
|
INCLUDEPATH *= $${QSK_DIRS}
|
||||||
DEPENDPATH *= $${QSK_DIRS}
|
DEPENDPATH *= $${QSK_DIRS}
|
||||||
|
|
||||||
@ -50,6 +46,19 @@ SOURCES += \
|
|||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
fonts.qrc
|
fonts.qrc
|
||||||
|
|
||||||
|
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
|
QMAKE_RPATHDIR *= $${QSK_PLUGIN_DIR}/skins
|
||||||
LIBS *= -L$${QSK_PLUGIN_DIR}/skins -lsquiekskin -lmaterialskin
|
LIBS *= -L$${QSK_PLUGIN_DIR}/skins -lsquiekskin -lmaterialskin
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user