skins: Switch automatically when color scheme changes
This commit is contained in:
parent
d33e1f1a90
commit
2f7564333f
|
|
@ -146,12 +146,25 @@ namespace
|
||||||
private:
|
private:
|
||||||
void populateMenu( QskMenu* menu ) override
|
void populateMenu( QskMenu* menu ) override
|
||||||
{
|
{
|
||||||
const auto names = qskSkinManager->skinNames();
|
const auto skins = qskSkinManager->skinInfos();
|
||||||
|
|
||||||
for ( const auto& name : names )
|
for ( const auto& skin : skins )
|
||||||
menu->addOption( QUrl(), name );
|
{
|
||||||
|
auto text = skin.first;
|
||||||
|
|
||||||
if ( const auto index = names.indexOf( qskSetup->skinName() ) )
|
if( skin.second == QskSkin::LightScheme )
|
||||||
|
{
|
||||||
|
text.append( " Light" );
|
||||||
|
}
|
||||||
|
else if( skin.second == QskSkin::DarkScheme )
|
||||||
|
{
|
||||||
|
text.append( " Dark" );
|
||||||
|
}
|
||||||
|
|
||||||
|
menu->addOption( QUrl(),text );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( const auto index = skins.indexOf( qskSetup->skinInfo() ) )
|
||||||
menu->setCurrentIndex( index );
|
menu->setCurrentIndex( index );
|
||||||
|
|
||||||
connect( menu, &QskMenu::triggered, this, &SkinButton::changeSkin );
|
connect( menu, &QskMenu::triggered, this, &SkinButton::changeSkin );
|
||||||
|
|
@ -159,10 +172,10 @@ namespace
|
||||||
|
|
||||||
void changeSkin( int index )
|
void changeSkin( int index )
|
||||||
{
|
{
|
||||||
const auto names = qskSkinManager->skinNames();
|
const auto names = qskSkinManager->skinInfos();
|
||||||
|
|
||||||
if ( ( index >= 0 ) && ( index < names.size() )
|
if ( ( index >= 0 ) && ( index < names.size() )
|
||||||
&& ( index != names.indexOf( qskSetup->skinName() ) ) )
|
&& ( index != names.indexOf( qskSetup->skinInfo() ) ) )
|
||||||
{
|
{
|
||||||
Skinny::setSkin( index, 500 );
|
Skinny::setSkin( index, 500 );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,22 +33,26 @@ namespace
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList skinNames() const override
|
QVector< QskSkin::SkinInfo > skins() const override
|
||||||
{
|
{
|
||||||
return { "DaytimeSkin", "NighttimeSkin" };
|
return { qMakePair( QStringLiteral( "Skin" ), QskSkin::LightScheme ),
|
||||||
|
qMakePair( QStringLiteral( "Skin" ), QskSkin::DarkScheme ) };
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkin* createSkin( const QString& skinName ) override
|
QskSkin* createSkin( QskSkin::SkinInfo info ) override
|
||||||
{
|
{
|
||||||
if( skinName == "DaytimeSkin" )
|
if( info.first == "Skin" )
|
||||||
|
{
|
||||||
|
if( info.second == QskSkin::LightScheme )
|
||||||
{
|
{
|
||||||
return new DaytimeSkin;
|
return new DaytimeSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( skinName == "NighttimeSkin" )
|
if( info.second == QskSkin::DarkScheme )
|
||||||
{
|
{
|
||||||
return new NighttimeSkin;
|
return new NighttimeSkin;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -76,7 +80,7 @@ int main( int argc, char* argv[] )
|
||||||
qskSkinManager->registerFactory(
|
qskSkinManager->registerFactory(
|
||||||
QStringLiteral( "SampleSkinFactory" ), new SkinFactory() );
|
QStringLiteral( "SampleSkinFactory" ), new SkinFactory() );
|
||||||
|
|
||||||
qskSetup->setSkin( "DaytimeSkin" );
|
qskSetup->setSkin( { "Skin", QskSkin::LightScheme } );
|
||||||
|
|
||||||
#ifdef USE_SHORTCUTS
|
#ifdef USE_SHORTCUTS
|
||||||
// With CTRL-B you can rotate a couple of visual debug modes
|
// With CTRL-B you can rotate a couple of visual debug modes
|
||||||
|
|
|
||||||
|
|
@ -222,17 +222,18 @@ namespace
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList MySkinFactory::skinNames() const
|
QVector< QskSkin::SkinInfo > MySkinFactory::skins() const
|
||||||
{
|
{
|
||||||
return { QStringLiteral( "Blue" ), QStringLiteral( "Pink" ) };
|
return { qMakePair( QStringLiteral( "Blue" ), QskSkin::UnknownScheme ),
|
||||||
|
qMakePair( QStringLiteral( "Pink" ), QskSkin::UnknownScheme ) };
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkin* MySkinFactory::createSkin( const QString& skinName )
|
QskSkin* MySkinFactory::createSkin( QskSkin::SkinInfo info )
|
||||||
{
|
{
|
||||||
if ( skinName == QStringLiteral( "Blue" ) )
|
if ( info.first == QStringLiteral( "Blue" ) )
|
||||||
return new SkinBlue();
|
return new SkinBlue();
|
||||||
|
|
||||||
if ( skinName == QStringLiteral( "Pink" ) )
|
if ( info.first == QStringLiteral( "Pink" ) )
|
||||||
return new SkinPink();
|
return new SkinPink();
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,6 @@ class MySkinFactory : public QskSkinFactory
|
||||||
using Inherited = QskSkinFactory;
|
using Inherited = QskSkinFactory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QStringList skinNames() const override;
|
virtual QVector< QskSkin::SkinInfo > skins() const override;
|
||||||
QskSkin* createSkin( const QString& skinName ) override;
|
virtual QskSkin* createSkin( QskSkin::SkinInfo ) override;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,8 @@ class Window : public QskWindow
|
||||||
{
|
{
|
||||||
auto button = new MyToggleButton();
|
auto button = new MyToggleButton();
|
||||||
|
|
||||||
button->setText( false, alternativeSkin( false ) );
|
button->setText( false, alternativeSkin( false ).first );
|
||||||
button->setText( true, alternativeSkin( true ) );
|
button->setText( true, alternativeSkin( true ).first );
|
||||||
button->setLayoutAlignmentHint( Qt::AlignRight );
|
button->setLayoutAlignmentHint( Qt::AlignRight );
|
||||||
|
|
||||||
auto box = new QskLinearBox( Qt::Vertical );
|
auto box = new QskLinearBox( Qt::Vertical );
|
||||||
|
|
@ -120,10 +120,10 @@ class Window : public QskWindow
|
||||||
delete oldSkin;
|
delete oldSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString alternativeSkin( bool on ) const
|
QskSkin::SkinInfo alternativeSkin( bool on ) const
|
||||||
{
|
{
|
||||||
const auto skinNames = qskSkinManager->skinNames();
|
const auto skins = qskSkinManager->skinInfos();
|
||||||
return skinNames[ on ];
|
return skins[ on ];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,14 +75,14 @@ namespace
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SkinFactory::skinNames() const
|
QVector< QskSkin::SkinInfo > SkinFactory::skins() const
|
||||||
{
|
{
|
||||||
return { "Skin" };
|
return { qMakePair( QStringLiteral( "Skin" ), QskSkin::UnknownScheme ) };
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkin* SkinFactory::createSkin( const QString& skinName )
|
QskSkin* SkinFactory::createSkin( QskSkin::SkinInfo info )
|
||||||
{
|
{
|
||||||
if ( skinName == "Skin" )
|
if ( info.first == "Skin" )
|
||||||
return new Skin();
|
return new Skin();
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,6 @@ class SkinFactory : public QskSkinFactory
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QStringList skinNames() const override;
|
QVector< QskSkin::SkinInfo > skins() const override;
|
||||||
QskSkin* createSkin( const QString& ) override;
|
QskSkin* createSkin( QskSkin::SkinInfo ) override;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ int main( int argc, char** argv )
|
||||||
|
|
||||||
Skinny::init(); // we need a skin
|
Skinny::init(); // we need a skin
|
||||||
SkinnyShortcut::enable( SkinnyShortcut::Quit | SkinnyShortcut::DebugBackground );
|
SkinnyShortcut::enable( SkinnyShortcut::Quit | SkinnyShortcut::DebugBackground );
|
||||||
qskSetup->setSkin( "squiek" );
|
qskSetup->setSkin( qMakePair( QStringLiteral( "squiek" ), QskSkin::UnknownScheme ) );
|
||||||
|
|
||||||
QskWindow window;
|
QskWindow window;
|
||||||
window.setColor( QskRgb::Wheat );
|
window.setColor( QskRgb::Wheat );
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ QskMain::QskMain( QObject* parent )
|
||||||
this, &QskMain::itemUpdateFlagsChanged, Qt::QueuedConnection );
|
this, &QskMain::itemUpdateFlagsChanged, Qt::QueuedConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList QskMain::skinList() const
|
QVector< QskSkin::SkinInfo > QskMain::skinList() const
|
||||||
{
|
{
|
||||||
auto manager = QskSkinManager::instance();
|
auto manager = QskSkinManager::instance();
|
||||||
return manager ? manager->skinNames() : QStringList();
|
return manager ? manager->skinInfos() : QVector< QskSkin::SkinInfo >();
|
||||||
}
|
}
|
||||||
|
|
||||||
QQmlListProperty< QObject > QskMain::data()
|
QQmlListProperty< QObject > QskMain::data()
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include "QskQmlGlobal.h"
|
#include "QskQmlGlobal.h"
|
||||||
|
|
||||||
#include <QskSetup.h>
|
#include <QskSetup.h>
|
||||||
|
#include <QskSkin.h>
|
||||||
|
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
#include <qqmllist.h>
|
#include <qqmllist.h>
|
||||||
|
|
@ -32,10 +33,10 @@ class QskMain : public QObject
|
||||||
public:
|
public:
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PRIVATE_PROPERTY( setup(), QString skin READ skinName
|
Q_PRIVATE_PROPERTY( setup(), QskSkin::SkinInfo skin READ skinInfo
|
||||||
WRITE setSkin NOTIFY skinChanged )
|
WRITE setSkin NOTIFY skinChanged )
|
||||||
|
|
||||||
Q_PROPERTY( QStringList skinList READ skinList NOTIFY skinListChanged )
|
Q_PROPERTY( QVector< QskSkin::SkinInfo > skinList READ skinList NOTIFY skinListChanged )
|
||||||
|
|
||||||
Q_PRIVATE_PROPERTY( setup(), QskSetupFlagsQml itemUpdateFlags
|
Q_PRIVATE_PROPERTY( setup(), QskSetupFlagsQml itemUpdateFlags
|
||||||
READ itemUpdateFlags WRITE setItemUpdateFlags NOTIFY itemUpdateFlagsChanged )
|
READ itemUpdateFlags WRITE setItemUpdateFlags NOTIFY itemUpdateFlagsChanged )
|
||||||
|
|
@ -46,7 +47,7 @@ class QskMain : public QObject
|
||||||
public:
|
public:
|
||||||
QskMain( QObject* parent = nullptr );
|
QskMain( QObject* parent = nullptr );
|
||||||
|
|
||||||
QStringList skinList() const;
|
QVector< QskSkin::SkinInfo > skinList() const;
|
||||||
QQmlListProperty< QObject > data();
|
QQmlListProperty< QObject > data();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@
|
||||||
#include "QskFluent2Skin.h"
|
#include "QskFluent2Skin.h"
|
||||||
#include "QskFluent2Theme.h"
|
#include "QskFluent2Theme.h"
|
||||||
|
|
||||||
static const QString nameLight = QStringLiteral( "Fluent2 Light" );
|
static const QString fluent2SkinName = QStringLiteral( "Fluent2" );
|
||||||
static const QString nameDark = QStringLiteral( "Fluent2 Dark" );
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
@ -27,27 +26,16 @@ QskFluent2SkinFactory::~QskFluent2SkinFactory()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList QskFluent2SkinFactory::skinNames() const
|
QVector< QskSkin::SkinInfo > QskFluent2SkinFactory::skins() const
|
||||||
{
|
{
|
||||||
return { nameLight, nameDark };
|
return { qMakePair( fluent2SkinName, QskSkin::LightScheme ),
|
||||||
|
qMakePair( fluent2SkinName, QskSkin::DarkScheme ) };
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkin* QskFluent2SkinFactory::createSkin( const QString& skinName )
|
QskSkin* QskFluent2SkinFactory::createSkin( QskSkin::SkinInfo info )
|
||||||
{
|
{
|
||||||
QskSkin::ColorScheme colorScheme;
|
// default to light:
|
||||||
|
const auto colorScheme = info.second == QskSkin::UnknownScheme ? QskSkin::LightScheme : info.second;
|
||||||
if ( QString::compare( skinName, nameLight, Qt::CaseInsensitive ) == 0 )
|
|
||||||
{
|
|
||||||
colorScheme = QskSkin::LightScheme;
|
|
||||||
}
|
|
||||||
else if ( QString::compare( skinName, nameDark, Qt::CaseInsensitive ) == 0 )
|
|
||||||
{
|
|
||||||
colorScheme = QskSkin::DarkScheme;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ class QSK_FLUENT2_EXPORT QskFluent2SkinFactory : public QskSkinFactory
|
||||||
QskFluent2SkinFactory( QObject* parent = nullptr );
|
QskFluent2SkinFactory( QObject* parent = nullptr );
|
||||||
~QskFluent2SkinFactory() override;
|
~QskFluent2SkinFactory() override;
|
||||||
|
|
||||||
QStringList skinNames() const override;
|
QVector< QskSkin::SkinInfo > skins() const override;
|
||||||
QskSkin* createSkin( const QString& skinName ) override;
|
QskSkin* createSkin( QskSkin::SkinInfo ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"FactoryId": "Fluent2Factory",
|
"FactoryId": "Fluent2Factory",
|
||||||
"Skins": [ { "Name": "Fluent2 Light", "Scheme": "Light" },
|
"Skins": [ { "Name": "Fluent2", "Scheme": "LightScheme" },
|
||||||
{ "Name": "Fluent2 Dark", "Scheme": "Dark" } ]
|
{ "Name": "Fluent2", "Scheme": "DarkScheme" } ]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,7 @@
|
||||||
#include "QskMaterial3SkinFactory.h"
|
#include "QskMaterial3SkinFactory.h"
|
||||||
#include "QskMaterial3Skin.h"
|
#include "QskMaterial3Skin.h"
|
||||||
|
|
||||||
static const QString materialLightSkinName = QStringLiteral( "Material3 Light" );
|
static const QString materialSkinName = QStringLiteral( "Material3" );
|
||||||
static const QString materialDarkSkinName = QStringLiteral( "Material3 Dark" );
|
|
||||||
|
|
||||||
QskMaterial3SkinFactory::QskMaterial3SkinFactory( QObject* parent )
|
QskMaterial3SkinFactory::QskMaterial3SkinFactory( QObject* parent )
|
||||||
: QskSkinFactory( parent )
|
: QskSkinFactory( parent )
|
||||||
|
|
@ -18,21 +17,20 @@ QskMaterial3SkinFactory::~QskMaterial3SkinFactory()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList QskMaterial3SkinFactory::skinNames() const
|
QVector< QskSkin::SkinInfo > QskMaterial3SkinFactory::skins() const
|
||||||
{
|
{
|
||||||
return { materialLightSkinName, materialDarkSkinName };
|
return { qMakePair( materialSkinName, QskSkin::LightScheme ),
|
||||||
|
qMakePair( materialSkinName, QskSkin::DarkScheme ) };
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkin* QskMaterial3SkinFactory::createSkin( const QString& skinName )
|
QskSkin* QskMaterial3SkinFactory::createSkin( QskSkin::SkinInfo info )
|
||||||
{
|
{
|
||||||
if ( QString::compare( skinName, materialLightSkinName, Qt::CaseInsensitive ) == 0 )
|
// default to light:
|
||||||
|
const auto scheme = info.second == QskSkin::UnknownScheme ? QskSkin::LightScheme : info.second;
|
||||||
|
|
||||||
|
if( QString::compare( info.first, materialSkinName, Qt::CaseInsensitive ) == 0 )
|
||||||
{
|
{
|
||||||
QskMaterial3Theme theme( QskSkin::LightScheme );
|
QskMaterial3Theme theme( scheme );
|
||||||
return new QskMaterial3Skin( theme );
|
|
||||||
}
|
|
||||||
else if ( QString::compare( skinName, materialDarkSkinName, Qt::CaseInsensitive ) == 0 )
|
|
||||||
{
|
|
||||||
QskMaterial3Theme theme( QskSkin::DarkScheme );
|
|
||||||
return new QskMaterial3Skin( theme );
|
return new QskMaterial3Skin( theme );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ class QSK_MATERIAL3_EXPORT QskMaterial3SkinFactory : public QskSkinFactory
|
||||||
QskMaterial3SkinFactory( QObject* parent = nullptr );
|
QskMaterial3SkinFactory( QObject* parent = nullptr );
|
||||||
~QskMaterial3SkinFactory() override;
|
~QskMaterial3SkinFactory() override;
|
||||||
|
|
||||||
QStringList skinNames() const override;
|
QVector< QskSkin::SkinInfo > skins() const override;
|
||||||
QskSkin* createSkin( const QString& skinName ) override;
|
QskSkin* createSkin( QskSkin::SkinInfo ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"FactoryId": "Material3Factory",
|
"FactoryId": "Material3Factory",
|
||||||
"Skins": [ { "Name": "Material3 Light", "Scheme": "Light" },
|
"Skins": [ { "Name": "Material3", "Scheme": "LightScheme" },
|
||||||
{ "Name": "Material3 Dark", "Scheme": "Dark" } ]
|
{ "Name": "Material3", "Scheme": "DarkScheme" } ]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,15 +17,17 @@ QskSquiekSkinFactory::~QskSquiekSkinFactory()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList QskSquiekSkinFactory::skinNames() const
|
QVector< QskSkin::SkinInfo > QskSquiekSkinFactory::skins() const
|
||||||
{
|
{
|
||||||
return { squiekSkinName };
|
return { qMakePair( squiekSkinName, QskSkin::UnknownScheme ) };
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkin* QskSquiekSkinFactory::createSkin( const QString& skinName )
|
QskSkin* QskSquiekSkinFactory::createSkin( QskSkin::SkinInfo info )
|
||||||
|
{
|
||||||
|
if ( QString::compare( info.first, squiekSkinName, Qt::CaseInsensitive ) == 0 )
|
||||||
{
|
{
|
||||||
if ( QString::compare( skinName, squiekSkinName, Qt::CaseInsensitive ) == 0 )
|
|
||||||
return new QskSquiekSkin();
|
return new QskSquiekSkin();
|
||||||
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ class QSK_SQUIEK_EXPORT QskSquiekSkinFactory : public QskSkinFactory
|
||||||
QskSquiekSkinFactory( QObject* parent = nullptr );
|
QskSquiekSkinFactory( QObject* parent = nullptr );
|
||||||
~QskSquiekSkinFactory() override;
|
~QskSquiekSkinFactory() override;
|
||||||
|
|
||||||
QStringList skinNames() const override;
|
QVector< QskSkin::SkinInfo > skins() const override;
|
||||||
QskSkin* createSkin( const QString& skinName ) override;
|
QskSkin* createSkin( QskSkin::SkinInfo ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"FactoryId": "SquiekFactory",
|
"FactoryId": "SquiekFactory",
|
||||||
"Skins": [ { "Name": "Squiek", "Scheme": "Unknown" } ]
|
"Skins": [ { "Name": "Squiek", "Scheme": "UnknownScheme" } ]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ class QskSetup::PrivateData
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString skinName;
|
QskSkin::SkinInfo skinInfo;
|
||||||
QPointer< QskSkin > skin;
|
QPointer< QskSkin > skin;
|
||||||
|
|
||||||
QskGraphicProviderMap graphicProviders;
|
QskGraphicProviderMap graphicProviders;
|
||||||
|
|
@ -91,6 +91,28 @@ class QskSetup::PrivateData
|
||||||
QskSetup::QskSetup()
|
QskSetup::QskSetup()
|
||||||
: m_data( new PrivateData() )
|
: m_data( new PrivateData() )
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK( 6, 5, 0 )
|
||||||
|
const auto* hints = qGuiApp->styleHints();
|
||||||
|
|
||||||
|
connect( hints, &QStyleHints::colorSchemeChanged, this, [this]( Qt::ColorScheme scheme )
|
||||||
|
{
|
||||||
|
auto info = m_data->skinInfo;
|
||||||
|
|
||||||
|
const auto currentScheme = static_cast< Qt::ColorScheme >( info.second );
|
||||||
|
|
||||||
|
if( currentScheme == scheme )
|
||||||
|
return;
|
||||||
|
|
||||||
|
info.second = static_cast< QskSkin::ColorScheme >( scheme );
|
||||||
|
|
||||||
|
const auto skins = QskSkinManager::instance()->skinInfos();
|
||||||
|
|
||||||
|
if( skins.contains( info ) )
|
||||||
|
{
|
||||||
|
setSkin( info );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSetup::~QskSetup()
|
QskSetup::~QskSetup()
|
||||||
|
|
@ -152,12 +174,12 @@ bool QskSetup::testItemUpdateFlag( QskQuickItem::UpdateFlag flag )
|
||||||
return m_data->itemUpdateFlags.testFlag( flag );
|
return m_data->itemUpdateFlags.testFlag( flag );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkin* QskSetup::setSkin( const QString& skinName )
|
QskSkin* QskSetup::setSkin( QskSkin::SkinInfo info )
|
||||||
{
|
{
|
||||||
if ( m_data->skin && ( skinName == m_data->skinName ) )
|
if ( m_data->skin && ( info == m_data->skinInfo ) )
|
||||||
return m_data->skin;
|
return m_data->skin;
|
||||||
|
|
||||||
auto skin = QskSkinManager::instance()->createSkin( skinName );
|
auto skin = QskSkinManager::instance()->createSkin( info );
|
||||||
if ( skin == nullptr )
|
if ( skin == nullptr )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|
@ -167,7 +189,7 @@ QskSkin* QskSetup::setSkin( const QString& skinName )
|
||||||
const auto oldSkin = m_data->skin;
|
const auto oldSkin = m_data->skin;
|
||||||
|
|
||||||
m_data->skin = skin;
|
m_data->skin = skin;
|
||||||
m_data->skinName = skinName;
|
m_data->skinInfo = info;
|
||||||
|
|
||||||
if ( oldSkin )
|
if ( oldSkin )
|
||||||
{
|
{
|
||||||
|
|
@ -180,20 +202,19 @@ QskSkin* QskSetup::setSkin( const QString& skinName )
|
||||||
return m_data->skin;
|
return m_data->skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QskSetup::skinName() const
|
QskSkin::SkinInfo QskSetup::skinInfo() const
|
||||||
{
|
{
|
||||||
return m_data->skinName;
|
return m_data->skinInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkin* QskSetup::skin()
|
QskSkin* QskSetup::skin()
|
||||||
{
|
{
|
||||||
if ( m_data->skin == nullptr )
|
if ( m_data->skin == nullptr )
|
||||||
{
|
{
|
||||||
m_data->skin = QskSkinManager::instance()->createSkin( QString() );
|
m_data->skin = QskSkinManager::instance()->createSkin( {} );
|
||||||
Q_ASSERT( m_data->skin );
|
Q_ASSERT( m_data->skin );
|
||||||
|
|
||||||
m_data->skin->setParent( this );
|
m_data->skin->setParent( this );
|
||||||
m_data->skinName = m_data->skin->objectName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_data->skin;
|
return m_data->skin;
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@
|
||||||
|
|
||||||
#include "QskGlobal.h"
|
#include "QskGlobal.h"
|
||||||
#include "QskQuickItem.h"
|
#include "QskQuickItem.h"
|
||||||
|
#include "QskSkin.h"
|
||||||
|
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class QskSkin;
|
|
||||||
class QQuickItem;
|
class QQuickItem;
|
||||||
class QskGraphicProvider;
|
class QskGraphicProvider;
|
||||||
|
|
||||||
|
|
@ -38,8 +38,8 @@ class QSK_EXPORT QskSetup : public QObject
|
||||||
void resetItemUpdateFlag( QskQuickItem::UpdateFlag );
|
void resetItemUpdateFlag( QskQuickItem::UpdateFlag );
|
||||||
bool testItemUpdateFlag( QskQuickItem::UpdateFlag );
|
bool testItemUpdateFlag( QskQuickItem::UpdateFlag );
|
||||||
|
|
||||||
QskSkin* setSkin( const QString& );
|
QskSkin* setSkin( QskSkin::SkinInfo );
|
||||||
QString skinName() const;
|
QskSkin::SkinInfo skinInfo() const;
|
||||||
|
|
||||||
QskSkin* skin();
|
QskSkin* skin();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@ class QSK_EXPORT QskSkin : public QObject
|
||||||
Q_ENUM( ColorScheme )
|
Q_ENUM( ColorScheme )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef QPair< QString, QskSkin::ColorScheme > SkinInfo;
|
||||||
|
|
||||||
QskSkin( QObject* parent = nullptr );
|
QskSkin( QObject* parent = nullptr );
|
||||||
~QskSkin() override;
|
~QskSkin() override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@
|
||||||
#define QSK_SKIN_FACTORY_H
|
#define QSK_SKIN_FACTORY_H
|
||||||
|
|
||||||
#include "QskGlobal.h"
|
#include "QskGlobal.h"
|
||||||
#include <qobject.h>
|
#include "QskSkin.h"
|
||||||
|
|
||||||
class QskSkin;
|
#include <qobject.h>
|
||||||
|
|
||||||
class QSK_EXPORT QskSkinFactory : public QObject
|
class QSK_EXPORT QskSkinFactory : public QObject
|
||||||
{
|
{
|
||||||
|
|
@ -19,8 +19,8 @@ class QSK_EXPORT QskSkinFactory : public QObject
|
||||||
QskSkinFactory( QObject* parent = nullptr );
|
QskSkinFactory( QObject* parent = nullptr );
|
||||||
~QskSkinFactory() override;
|
~QskSkinFactory() override;
|
||||||
|
|
||||||
virtual QStringList skinNames() const = 0;
|
virtual QVector< QskSkin::SkinInfo > skins() const = 0;
|
||||||
virtual QskSkin* createSkin( const QString& skinName ) = 0;
|
virtual QskSkin* createSkin( QskSkin::SkinInfo ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define QskSkinFactoryIID "org.qskinny.Qsk.QskSkinFactory/1.0"
|
#define QskSkinFactoryIID "org.qskinny.Qsk.QskSkinFactory/1.0"
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "QskSkinManager.h"
|
#include "QskSkinManager.h"
|
||||||
#include "QskSkinFactory.h"
|
#include "QskSkinFactory.h"
|
||||||
|
#include "QskSkin.h"
|
||||||
|
|
||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
#include <qglobalstatic.h>
|
#include <qglobalstatic.h>
|
||||||
|
|
@ -104,41 +105,42 @@ namespace
|
||||||
const auto& skinObject = skin.toObject();
|
const auto& skinObject = skin.toObject();
|
||||||
const auto& name = skinObject.value( TokenName ).toString();
|
const auto& name = skinObject.value( TokenName ).toString();
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 6, 5, 0 )
|
|
||||||
const auto& schemeString = skinObject.value( TokenScheme ).toString();
|
const auto& schemeString = skinObject.value( TokenScheme ).toString();
|
||||||
Qt::ColorScheme scheme;
|
QskSkin::ColorScheme scheme;
|
||||||
|
|
||||||
if( schemeString == QStringLiteral( "Light" ) )
|
if( schemeString == QStringLiteral( "LightScheme" ) )
|
||||||
{
|
{
|
||||||
scheme = Qt::ColorScheme::Light;
|
scheme = QskSkin::LightScheme;
|
||||||
}
|
}
|
||||||
else if( schemeString == QStringLiteral( "Dark" ) )
|
else if( schemeString == QStringLiteral( "DarkScheme" ) )
|
||||||
{
|
{
|
||||||
scheme = Qt::ColorScheme::Dark;
|
scheme = QskSkin::DarkScheme;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scheme = Qt::ColorScheme::Unknown;
|
scheme = QskSkin::UnknownScheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto pair = qMakePair( name, scheme );
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK( 6, 5, 0 )
|
||||||
const auto systemScheme = qGuiApp->styleHints()->colorScheme();
|
const auto systemScheme = qGuiApp->styleHints()->colorScheme();
|
||||||
|
|
||||||
if( scheme == systemScheme )
|
if( static_cast< Qt::ColorScheme >( scheme ) == systemScheme )
|
||||||
{
|
{
|
||||||
m_skinNames.prepend( name );
|
m_skins.prepend( pair );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_skinNames.append( name );
|
m_skins.append( pair );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Q_UNUSED( TokenScheme )
|
m_skins.append( pair );
|
||||||
m_skinNames += name;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return !m_skinNames.isEmpty();
|
return !m_skins.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QString factoryId() const
|
inline QString factoryId() const
|
||||||
|
|
@ -158,9 +160,9 @@ namespace
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QStringList skinNames() const
|
inline QVector< QskSkin::SkinInfo > skins() const
|
||||||
{
|
{
|
||||||
return m_skinNames;
|
return m_skins;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -168,7 +170,7 @@ namespace
|
||||||
QObject* instance() = delete;
|
QObject* instance() = delete;
|
||||||
|
|
||||||
QString m_factoryId;
|
QString m_factoryId;
|
||||||
QStringList m_skinNames;
|
QVector< QskSkin::SkinInfo > m_skins;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FactoryMap
|
class FactoryMap
|
||||||
|
|
@ -210,17 +212,17 @@ namespace
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
m_skinNames.clear();
|
m_skins.clear();
|
||||||
m_skinMap.clear();
|
m_skinMap.clear();
|
||||||
m_factoryMap.clear();
|
m_factoryMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkinFactory* factory( const QString& skinName )
|
QskSkinFactory* factory( QskSkin::SkinInfo info )
|
||||||
{
|
{
|
||||||
if ( !m_isValid )
|
if ( !m_isValid )
|
||||||
rebuild();
|
rebuild();
|
||||||
|
|
||||||
const auto it = m_skinMap.constFind( skinName );
|
const auto it = m_skinMap.constFind( info );
|
||||||
if ( it != m_skinMap.constEnd() )
|
if ( it != m_skinMap.constEnd() )
|
||||||
{
|
{
|
||||||
auto it2 = m_factoryMap.find( it.value() );
|
auto it2 = m_factoryMap.find( it.value() );
|
||||||
|
|
@ -237,12 +239,12 @@ namespace
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList skinNames() const
|
QVector< QskSkin::SkinInfo > skins() const
|
||||||
{
|
{
|
||||||
if ( !m_isValid )
|
if ( !m_isValid )
|
||||||
const_cast< FactoryMap* >( this )->rebuild();
|
const_cast< FactoryMap* >( this )->rebuild();
|
||||||
|
|
||||||
return m_skinNames;
|
return m_skins;
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertFactory( FactoryLoader* loader )
|
void insertFactory( FactoryLoader* loader )
|
||||||
|
|
@ -269,7 +271,7 @@ namespace
|
||||||
data.factory = factory;
|
data.factory = factory;
|
||||||
|
|
||||||
m_skinMap.clear();
|
m_skinMap.clear();
|
||||||
m_skinNames.clear();
|
m_skins.clear();
|
||||||
m_isValid = false;
|
m_isValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -287,7 +289,7 @@ namespace
|
||||||
for ( auto it = m_skinMap.constBegin();
|
for ( auto it = m_skinMap.constBegin();
|
||||||
it != m_skinMap.constEnd(); ++it )
|
it != m_skinMap.constEnd(); ++it )
|
||||||
{
|
{
|
||||||
if ( it.key() == factoryId )
|
if ( it.key().first == factoryId )
|
||||||
{
|
{
|
||||||
m_isValid = false;
|
m_isValid = false;
|
||||||
break;
|
break;
|
||||||
|
|
@ -296,7 +298,7 @@ namespace
|
||||||
|
|
||||||
if ( !m_isValid )
|
if ( !m_isValid )
|
||||||
{
|
{
|
||||||
m_skinNames.clear();
|
m_skins.clear();
|
||||||
m_skinMap.clear();
|
m_skinMap.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -311,7 +313,7 @@ namespace
|
||||||
void rebuild()
|
void rebuild()
|
||||||
{
|
{
|
||||||
m_skinMap.clear();
|
m_skinMap.clear();
|
||||||
m_skinNames.clear();
|
m_skins.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 )
|
||||||
|
|
@ -319,7 +321,7 @@ namespace
|
||||||
const auto& data = it.value();
|
const auto& data = it.value();
|
||||||
|
|
||||||
if ( data.loader == nullptr && data.factory )
|
if ( data.loader == nullptr && data.factory )
|
||||||
rebuild( it.key(), data.factory->skinNames() );
|
rebuild( it.key(), data.factory->skins() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// all factories from plugins are following
|
// all factories from plugins are following
|
||||||
|
|
@ -327,27 +329,27 @@ namespace
|
||||||
{
|
{
|
||||||
const auto& data = it.value();
|
const auto& data = it.value();
|
||||||
if ( data.loader )
|
if ( data.loader )
|
||||||
rebuild( it.key(), data.loader->skinNames() );
|
rebuild( it.key(), data.loader->skins() );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_isValid = true;
|
m_isValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rebuild( const QString& factoryId, const QStringList& skinNames )
|
void rebuild( const QString& factoryId, const QVector< QskSkin::SkinInfo >& skins )
|
||||||
{
|
{
|
||||||
for ( const auto& name : skinNames )
|
for ( const auto& skin : skins )
|
||||||
{
|
{
|
||||||
if ( !m_skinMap.contains( name ) )
|
if ( !m_skinMap.contains( skin ) )
|
||||||
{
|
{
|
||||||
m_skinMap.insert( name, factoryId );
|
m_skinMap.insert( skin, factoryId );
|
||||||
m_skinNames += name;
|
m_skins += skin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap< QString, Data > m_factoryMap; // factoryId -> data
|
QMap< QString, Data > m_factoryMap; // factoryId -> data
|
||||||
QMap< QString, QString > m_skinMap; // skinName -> factoryId
|
QMap< QskSkin::SkinInfo, QString > m_skinMap; // skinName -> factoryId
|
||||||
QStringList m_skinNames;
|
QVector< QskSkin::SkinInfo > m_skins;
|
||||||
|
|
||||||
bool m_isValid;
|
bool m_isValid;
|
||||||
};
|
};
|
||||||
|
|
@ -515,32 +517,34 @@ void QskSkinManager::unregisterFactories()
|
||||||
m_data->factoryMap.reset();
|
m_data->factoryMap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList QskSkinManager::skinNames() const
|
QVector< QskSkin::SkinInfo > QskSkinManager::skinInfos() const
|
||||||
{
|
{
|
||||||
m_data->ensurePlugins();
|
m_data->ensurePlugins();
|
||||||
return m_data->factoryMap.skinNames();
|
return m_data->factoryMap.skins();
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkin* QskSkinManager::createSkin( const QString& skinName ) const
|
QskSkin* QskSkinManager::createSkin( QskSkin::SkinInfo info ) const
|
||||||
{
|
{
|
||||||
m_data->ensurePlugins();
|
m_data->ensurePlugins();
|
||||||
|
|
||||||
auto& map = m_data->factoryMap;
|
auto& map = m_data->factoryMap;
|
||||||
|
|
||||||
auto name = skinName;
|
auto i = info;
|
||||||
|
|
||||||
|
auto factory = map.factory( info );
|
||||||
|
|
||||||
auto factory = map.factory( name );
|
|
||||||
if ( factory == nullptr )
|
if ( factory == nullptr )
|
||||||
{
|
{
|
||||||
const auto names = map.skinNames();
|
const auto infos = map.skins();
|
||||||
if ( !names.isEmpty() )
|
|
||||||
|
if ( !infos.isEmpty() )
|
||||||
{
|
{
|
||||||
name = names.first();
|
i = infos.first();
|
||||||
factory = map.factory( name );
|
factory = map.factory( i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return factory ? factory->createSkin( name ) : nullptr;
|
return factory ? factory->createSkin( info ) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_QskSkinManager.cpp"
|
#include "moc_QskSkinManager.cpp"
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@
|
||||||
#define QSK_SKIN_MANAGER_H
|
#define QSK_SKIN_MANAGER_H
|
||||||
|
|
||||||
#include "QskGlobal.h"
|
#include "QskGlobal.h"
|
||||||
|
#include "QskSkin.h"
|
||||||
|
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class QskSkin;
|
|
||||||
class QskSkinFactory;
|
class QskSkinFactory;
|
||||||
|
|
||||||
#if defined( qskSkinManager )
|
#if defined( qskSkinManager )
|
||||||
|
|
@ -37,9 +37,9 @@ class QSK_EXPORT QskSkinManager : public QObject
|
||||||
void unregisterFactory( const QString& factoryId );
|
void unregisterFactory( const QString& factoryId );
|
||||||
void unregisterFactories();
|
void unregisterFactories();
|
||||||
|
|
||||||
QStringList skinNames() const;
|
QVector< QskSkin::SkinInfo > skinInfos() const;
|
||||||
|
|
||||||
QskSkin* createSkin( const QString& skinName ) const;
|
QskSkin* createSkin( QskSkin::SkinInfo ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QskSkinManager();
|
QskSkinManager();
|
||||||
|
|
|
||||||
|
|
@ -655,10 +655,10 @@ QskWindow::EventAcceptance QskWindow::eventAcceptance() const
|
||||||
return d_func()->eventAcceptance;
|
return d_func()->eventAcceptance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskWindow::setSkin( const QString& skinName )
|
void QskWindow::setSkin( QskSkin::SkinInfo info )
|
||||||
{
|
{
|
||||||
// we should compare the skinName with the previous one
|
// we should compare the skinName with the previous one
|
||||||
auto skin = QskSkinManager::instance()->createSkin( skinName );
|
auto skin = QskSkinManager::instance()->createSkin( info );
|
||||||
setSkin( skin );
|
setSkin( skin );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,12 @@
|
||||||
#define QSK_WINDOW_H
|
#define QSK_WINDOW_H
|
||||||
|
|
||||||
#include "QskGlobal.h"
|
#include "QskGlobal.h"
|
||||||
|
#include "QskSkin.h"
|
||||||
|
|
||||||
#include <qquickwindow.h>
|
#include <qquickwindow.h>
|
||||||
|
|
||||||
class QskWindowPrivate;
|
class QskWindowPrivate;
|
||||||
class QskObjectAttributes;
|
class QskObjectAttributes;
|
||||||
class QskSkin;
|
|
||||||
|
|
||||||
class QSK_EXPORT QskWindow : public QQuickWindow
|
class QSK_EXPORT QskWindow : public QQuickWindow
|
||||||
{
|
{
|
||||||
|
|
@ -72,7 +73,7 @@ class QSK_EXPORT QskWindow : public QQuickWindow
|
||||||
|
|
||||||
// each window might have its own skin
|
// each window might have its own skin
|
||||||
void setSkin( QskSkin* );
|
void setSkin( QskSkin* );
|
||||||
void setSkin( const QString& );
|
void setSkin( QskSkin::SkinInfo info );
|
||||||
QskSkin* skin() const;
|
QskSkin* skin() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ static bool pluginPath = initPluginPath();
|
||||||
|
|
||||||
static void initSkins()
|
static void initSkins()
|
||||||
{
|
{
|
||||||
auto skinNames = qskSkinManager->skinNames();
|
auto skinNames = qskSkinManager->skinInfos();
|
||||||
|
|
||||||
if ( skinNames.isEmpty() )
|
if ( skinNames.isEmpty() )
|
||||||
{
|
{
|
||||||
|
|
@ -70,7 +70,7 @@ static bool pluginPath = initPluginPath();
|
||||||
|
|
||||||
qWarning() << "Couldn't find skin plugins, adding some manually.";
|
qWarning() << "Couldn't find skin plugins, adding some manually.";
|
||||||
|
|
||||||
skinNames = qskSkinManager->skinNames();
|
skinNames = qskSkinManager->skinInfos();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !skinNames.isEmpty() )
|
if ( !skinNames.isEmpty() )
|
||||||
|
|
@ -133,10 +133,10 @@ Q_COREAPP_STARTUP_FUNCTION( initFonts )
|
||||||
|
|
||||||
void Skinny::changeSkin( QskAnimationHint hint )
|
void Skinny::changeSkin( QskAnimationHint hint )
|
||||||
{
|
{
|
||||||
const auto names = qskSkinManager->skinNames();
|
const auto names = qskSkinManager->skinInfos();
|
||||||
if ( names.size() > 1 )
|
if ( names.size() > 1 )
|
||||||
{
|
{
|
||||||
auto index = names.indexOf( qskSetup->skinName() );
|
auto index = names.indexOf( qskSetup->skinInfo() );
|
||||||
index = ( index + 1 ) % names.size();
|
index = ( index + 1 ) % names.size();
|
||||||
|
|
||||||
setSkin( index, hint );
|
setSkin( index, hint );
|
||||||
|
|
@ -145,11 +145,11 @@ void Skinny::changeSkin( QskAnimationHint hint )
|
||||||
|
|
||||||
void Skinny::setSkin( int index, QskAnimationHint hint )
|
void Skinny::setSkin( int index, QskAnimationHint hint )
|
||||||
{
|
{
|
||||||
const auto names = qskSkinManager->skinNames();
|
const auto names = qskSkinManager->skinInfos();
|
||||||
if ( names.size() <= 1 )
|
if ( names.size() <= 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( index == names.indexOf( qskSetup->skinName() ) )
|
if ( index == names.indexOf( qskSetup->skinInfo() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto oldSkin = qskSetup->skin();
|
auto oldSkin = qskSetup->skin();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue