respect the ordering from the skin factories instead of sorting them
alphabetically
This commit is contained in:
parent
58de099aca
commit
1f8283b186
@ -200,7 +200,7 @@ namespace
|
|||||||
if ( !m_isValid )
|
if ( !m_isValid )
|
||||||
const_cast< FactoryMap* >( this )->rebuild();
|
const_cast< FactoryMap* >( this )->rebuild();
|
||||||
|
|
||||||
return m_skinMap.keys();
|
return m_skinNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertFactory( FactoryLoader* loader )
|
void insertFactory( FactoryLoader* loader )
|
||||||
@ -269,6 +269,7 @@ namespace
|
|||||||
void rebuild()
|
void rebuild()
|
||||||
{
|
{
|
||||||
m_skinMap.clear();
|
m_skinMap.clear();
|
||||||
|
m_skinNames.clear();
|
||||||
|
|
||||||
// first we try all factories, that have been added manually
|
// first we try all factories, that have been added manually
|
||||||
for ( auto it = m_factoryMap.constBegin(); it != m_factoryMap.constEnd(); ++it )
|
for ( auto it = m_factoryMap.constBegin(); it != m_factoryMap.constEnd(); ++it )
|
||||||
@ -287,7 +288,6 @@ namespace
|
|||||||
rebuild( it.key(), data.loader->skinNames() );
|
rebuild( it.key(), data.loader->skinNames() );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_skinNames = m_skinMap.keys();
|
|
||||||
m_isValid = true;
|
m_isValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +296,10 @@ namespace
|
|||||||
for ( const auto& name : skinNames )
|
for ( const auto& name : skinNames )
|
||||||
{
|
{
|
||||||
if ( !m_skinMap.contains( name ) )
|
if ( !m_skinMap.contains( name ) )
|
||||||
|
{
|
||||||
m_skinMap.insert( name, factoryId );
|
m_skinMap.insert( name, factoryId );
|
||||||
|
m_skinNames += name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,16 +490,10 @@ QskSkin* QskSkinManager::createSkin( const QString& skinName ) const
|
|||||||
auto factory = map.factory( name );
|
auto factory = map.factory( name );
|
||||||
if ( factory == nullptr )
|
if ( factory == nullptr )
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
Once the Fusion skin has been implemented it will be used
|
|
||||||
as fallback. For the moment we implement
|
|
||||||
another stupid fallback. TODO ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
const auto names = map.skinNames();
|
const auto names = map.skinNames();
|
||||||
if ( !names.isEmpty() )
|
if ( !names.isEmpty() )
|
||||||
{
|
{
|
||||||
name = names.last();
|
name = names.first();
|
||||||
factory = map.factory( name );
|
factory = map.factory( name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,9 @@ static bool pluginPath = initPluginPath();
|
|||||||
|
|
||||||
static void initSkins()
|
static void initSkins()
|
||||||
{
|
{
|
||||||
if ( qskSkinManager->skinNames().isEmpty() )
|
auto skinNames = qskSkinManager->skinNames();
|
||||||
|
|
||||||
|
if ( skinNames.isEmpty() )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
To avoid having problems with not finding the skin plugins
|
To avoid having problems with not finding the skin plugins
|
||||||
@ -67,17 +69,12 @@ static bool pluginPath = initPluginPath();
|
|||||||
qskSkinManager->registerFactory( "Fluent2Factory", new QskFluent2SkinFactory() );
|
qskSkinManager->registerFactory( "Fluent2Factory", new QskFluent2SkinFactory() );
|
||||||
|
|
||||||
qWarning() << "Couldn't find skin plugins, adding some manually.";
|
qWarning() << "Couldn't find skin plugins, adding some manually.";
|
||||||
|
|
||||||
|
skinNames = qskSkinManager->skinNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
if ( !skinNames.isEmpty() )
|
||||||
/*
|
qskSetup->setSkin( skinNames[0] );
|
||||||
QskSkinManager is sorting in alphabetic order, but we want to have
|
|
||||||
the light material skin as initial skin. TODO ...
|
|
||||||
*/
|
|
||||||
const auto names = qskSkinManager->skinNames();
|
|
||||||
if ( names.count() > 1 )
|
|
||||||
qskSetup->setSkin( names[1] );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_COREAPP_STARTUP_FUNCTION( initSkins )
|
Q_COREAPP_STARTUP_FUNCTION( initSkins )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user