Material: Rename new skin to Material3
This commit is contained in:
parent
6332a27764
commit
5ff92a9fb8
@ -66,7 +66,7 @@ int main( int argc, char* argv[] )
|
||||
|
||||
// disable default skins
|
||||
qskSkinManager->setPluginPaths( QStringList() ); // no plugins
|
||||
qskSkinManager->unregisterFactory( "materialfactory" );
|
||||
qskSkinManager->unregisterFactory( "material3factory" );
|
||||
qskSkinManager->unregisterFactory( "squiekfactory" );
|
||||
|
||||
qskSkinManager->registerFactory(
|
||||
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"FactoryId": "MaterialFactory",
|
||||
"Skins": [ "materialLight", "materialDark" ]
|
||||
}
|
@ -3,23 +3,23 @@
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_MATERIAL_GLOBAL_H
|
||||
#define QSK_MATERIAL_GLOBAL_H
|
||||
#ifndef QSK_MATERIAL3_GLOBAL_H
|
||||
#define QSK_MATERIAL3_GLOBAL_H
|
||||
|
||||
#include "QskGlobal.h"
|
||||
|
||||
#ifdef QSK_DLL
|
||||
|
||||
#if defined( QSK_MATERIAL_MAKEDLL ) // create a DLL library
|
||||
#define QSK_MATERIAL_EXPORT Q_DECL_EXPORT
|
||||
#if defined( QSK_MATERIAL3_MAKEDLL ) // create a DLL library
|
||||
#define QSK_MATERIAL3_EXPORT Q_DECL_EXPORT
|
||||
#else // use a DLL library
|
||||
#define QSK_MATERIAL_EXPORT Q_DECL_IMPORT
|
||||
#define QSK_MATERIAL3_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif // QSK_DLL
|
||||
|
||||
#ifndef QSK_MATERIAL_EXPORT
|
||||
#define QSK_MATERIAL_EXPORT
|
||||
#ifndef QSK_MATERIAL3_EXPORT
|
||||
#define QSK_MATERIAL3_EXPORT
|
||||
#endif
|
||||
|
||||
#endif
|
@ -3,7 +3,7 @@
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskMaterialSkin.h"
|
||||
#include "QskMaterial3Skin.h"
|
||||
|
||||
#include <QskSkinHintTableEditor.h>
|
||||
|
||||
@ -50,7 +50,7 @@ namespace
|
||||
class Editor : private QskSkinHintTableEditor
|
||||
{
|
||||
public:
|
||||
Editor( QskSkinHintTable* table, const QskMaterialTheme& palette )
|
||||
Editor( QskSkinHintTable* table, const QskMaterial3Theme& palette )
|
||||
: QskSkinHintTableEditor( table )
|
||||
, m_pal( palette )
|
||||
{
|
||||
@ -86,7 +86,7 @@ namespace
|
||||
void setupTextInput();
|
||||
void setupTextLabel();
|
||||
|
||||
const QskMaterialTheme& m_pal;
|
||||
const QskMaterial3Theme& m_pal;
|
||||
const uint rippleSize = 40; // ### remove
|
||||
};
|
||||
|
||||
@ -227,7 +227,7 @@ void Editor::setupMenu()
|
||||
setStrutSize( Q::Graphic, { 46, -1 } );
|
||||
|
||||
setColor( Q::Text, m_pal.onSurface );
|
||||
setFontRole( Q::Text, QskMaterialSkin::M3BodyLarge );
|
||||
setFontRole( Q::Text, QskMaterial3Skin::M3BodyLarge );
|
||||
|
||||
setPosition( Q::Panel, 0 );
|
||||
setPosition( Q::Panel | QskPopup::Closed, 1 );
|
||||
@ -380,7 +380,7 @@ void Editor::setupSegmentedBar()
|
||||
{
|
||||
// Text
|
||||
|
||||
setFontRole( Q::Text, QskMaterialSkin::M3LabelLarge );
|
||||
setFontRole( Q::Text, QskMaterial3Skin::M3LabelLarge );
|
||||
|
||||
setColor( Q::Text, m_pal.onSurface );
|
||||
setColor( Q::Text | Q::Selected, m_pal.onSecondaryContainer );
|
||||
@ -449,7 +449,7 @@ void Editor::setupPushButton()
|
||||
setAlignment( Q::Graphic | A::Alignment, Qt::AlignLeft );
|
||||
setPadding( Q::Graphic, 5 );
|
||||
|
||||
setFontRole( Q::Text, QskMaterialSkin::M3LabelLarge );
|
||||
setFontRole( Q::Text, QskMaterial3Skin::M3LabelLarge );
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
|
||||
|
||||
@ -513,7 +513,7 @@ void Editor::setupDialogButton()
|
||||
setColor( Q::Text, m_pal.onPrimary );
|
||||
setColor( Q::Text | Q::Disabled, m_pal.onSurface38 );
|
||||
|
||||
setFontRole( Q::Text, QskMaterialSkin::M3LabelLarge );
|
||||
setFontRole( Q::Text, QskMaterial3Skin::M3LabelLarge );
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
|
||||
for ( auto state1 : { A::NoState, Q::Focused } )
|
||||
@ -685,7 +685,7 @@ void Editor::setupTabButton()
|
||||
|
||||
setAnimation( Q::Panel | A::Color, qskDuration );
|
||||
|
||||
setFontRole( Q::Text, QskMaterialSkin::M3LabelLarge );
|
||||
setFontRole( Q::Text, QskMaterial3Skin::M3LabelLarge );
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
}
|
||||
|
||||
@ -824,8 +824,8 @@ void Editor::setupSubWindow()
|
||||
|
||||
}
|
||||
|
||||
QskMaterialTheme::QskMaterialTheme( Lightness lightness )
|
||||
: QskMaterialTheme( lightness,
|
||||
QskMaterial3Theme::QskMaterial3Theme( Lightness lightness )
|
||||
: QskMaterial3Theme( lightness,
|
||||
{ // default Material colors:
|
||||
0xff6750A4,
|
||||
0xff625B71,
|
||||
@ -837,7 +837,7 @@ QskMaterialTheme::QskMaterialTheme( Lightness lightness )
|
||||
{
|
||||
}
|
||||
|
||||
QskMaterialTheme::QskMaterialTheme(Lightness lightness,
|
||||
QskMaterial3Theme::QskMaterial3Theme(Lightness lightness,
|
||||
std::array<QskHctColor, NumPaletteTypes> palettes )
|
||||
: m_palettes( palettes )
|
||||
{
|
||||
@ -924,7 +924,7 @@ QskMaterialTheme::QskMaterialTheme(Lightness lightness,
|
||||
elevationLight2 = QskShadowMetrics( -2, 8, { 0, 2 } );
|
||||
}
|
||||
|
||||
QskMaterialSkin::QskMaterialSkin( const QskMaterialTheme& palette, QObject* parent )
|
||||
QskMaterial3Skin::QskMaterial3Skin( const QskMaterial3Theme& palette, QObject* parent )
|
||||
: Inherited( parent )
|
||||
{
|
||||
setupFonts();
|
||||
@ -933,11 +933,11 @@ QskMaterialSkin::QskMaterialSkin( const QskMaterialTheme& palette, QObject* pare
|
||||
editor.setup();
|
||||
}
|
||||
|
||||
QskMaterialSkin::~QskMaterialSkin()
|
||||
QskMaterial3Skin::~QskMaterial3Skin()
|
||||
{
|
||||
}
|
||||
|
||||
void QskMaterialSkin::setupFonts()
|
||||
void QskMaterial3Skin::setupFonts()
|
||||
{
|
||||
Inherited::setupFonts( QStringLiteral( "Roboto" ) );
|
||||
|
||||
@ -945,4 +945,4 @@ void QskMaterialSkin::setupFonts()
|
||||
setFont( M3LabelLarge, createFont( 14 ) );
|
||||
}
|
||||
|
||||
#include "moc_QskMaterialSkin.cpp"
|
||||
#include "moc_QskMaterial3Skin.cpp"
|
@ -3,10 +3,10 @@
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_MATERIAL_SKIN_H
|
||||
#define QSK_MATERIAL_SKIN_H
|
||||
#ifndef QSK_MATERIAL3_SKIN_H
|
||||
#define QSK_MATERIAL3_SKIN_H
|
||||
|
||||
#include "QskMaterialGlobal.h"
|
||||
#include "QskMaterial3Global.h"
|
||||
|
||||
#include <QskHctColor.h>
|
||||
#include <QskSkin.h>
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
class QSK_MATERIAL_EXPORT QskMaterialTheme
|
||||
class QSK_MATERIAL3_EXPORT QskMaterial3Theme
|
||||
{
|
||||
public:
|
||||
enum Lightness
|
||||
@ -35,8 +35,8 @@ class QSK_MATERIAL_EXPORT QskMaterialTheme
|
||||
NumPaletteTypes
|
||||
};
|
||||
|
||||
QskMaterialTheme( Lightness );
|
||||
QskMaterialTheme( Lightness, std::array< QskHctColor, NumPaletteTypes > );
|
||||
QskMaterial3Theme( Lightness );
|
||||
QskMaterial3Theme( Lightness, std::array< QskHctColor, NumPaletteTypes > );
|
||||
|
||||
QRgb primary;
|
||||
QColor primary12;
|
||||
@ -85,15 +85,15 @@ class QSK_MATERIAL_EXPORT QskMaterialTheme
|
||||
std::array< QskHctColor, NumPaletteTypes > m_palettes;
|
||||
};
|
||||
|
||||
class QSK_MATERIAL_EXPORT QskMaterialSkin : public QskSkin
|
||||
class QSK_MATERIAL3_EXPORT QskMaterial3Skin : public QskSkin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
using Inherited = QskSkin;
|
||||
|
||||
public:
|
||||
QskMaterialSkin( const QskMaterialTheme&, QObject* parent = nullptr );
|
||||
~QskMaterialSkin() override;
|
||||
QskMaterial3Skin( const QskMaterial3Theme&, QObject* parent = nullptr );
|
||||
~QskMaterial3Skin() override;
|
||||
|
||||
enum FontRole
|
||||
{
|
@ -3,40 +3,40 @@
|
||||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskMaterialSkinFactory.h"
|
||||
#include "QskMaterialSkin.h"
|
||||
#include "QskMaterial3SkinFactory.h"
|
||||
#include "QskMaterial3Skin.h"
|
||||
|
||||
static const QString materialLightSkinName = QStringLiteral( "materialLight" );
|
||||
static const QString materialDarkSkinName = QStringLiteral( "materialDark" );
|
||||
static const QString materialLightSkinName = QStringLiteral( "material3Light" );
|
||||
static const QString materialDarkSkinName = QStringLiteral( "material3Dark" );
|
||||
|
||||
QskMaterialSkinFactory::QskMaterialSkinFactory( QObject* parent )
|
||||
QskMaterial3SkinFactory::QskMaterial3SkinFactory( QObject* parent )
|
||||
: QskSkinFactory( parent )
|
||||
{
|
||||
}
|
||||
|
||||
QskMaterialSkinFactory::~QskMaterialSkinFactory()
|
||||
QskMaterial3SkinFactory::~QskMaterial3SkinFactory()
|
||||
{
|
||||
}
|
||||
|
||||
QStringList QskMaterialSkinFactory::skinNames() const
|
||||
QStringList QskMaterial3SkinFactory::skinNames() const
|
||||
{
|
||||
return { materialLightSkinName, materialDarkSkinName };
|
||||
}
|
||||
|
||||
QskSkin* QskMaterialSkinFactory::createSkin( const QString& skinName )
|
||||
QskSkin* QskMaterial3SkinFactory::createSkin( const QString& skinName )
|
||||
{
|
||||
if ( QString::compare( skinName, materialLightSkinName, Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
QskMaterialTheme theme( QskMaterialTheme::Light );
|
||||
return new QskMaterialSkin( theme );
|
||||
QskMaterial3Theme theme( QskMaterial3Theme::Light );
|
||||
return new QskMaterial3Skin( theme );
|
||||
}
|
||||
else if ( QString::compare( skinName, materialDarkSkinName, Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
QskMaterialTheme theme( QskMaterialTheme::Dark );
|
||||
return new QskMaterialSkin( theme );
|
||||
QskMaterial3Theme theme( QskMaterial3Theme::Dark );
|
||||
return new QskMaterial3Skin( theme );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#include "moc_QskMaterialSkinFactory.cpp"
|
||||
#include "moc_QskMaterial3SkinFactory.cpp"
|
@ -6,10 +6,10 @@
|
||||
#ifndef QSK_MATERIAL_SKIN_FACTORY_H
|
||||
#define QSK_MATERIAL_SKIN_FACTORY_H
|
||||
|
||||
#include "QskMaterialGlobal.h"
|
||||
#include "QskMaterial3Global.h"
|
||||
#include <QskSkinFactory.h>
|
||||
|
||||
class QSK_MATERIAL_EXPORT QskMaterialSkinFactory : public QskSkinFactory
|
||||
class QSK_MATERIAL3_EXPORT QskMaterial3SkinFactory : public QskSkinFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -17,8 +17,8 @@ class QSK_MATERIAL_EXPORT QskMaterialSkinFactory : public QskSkinFactory
|
||||
Q_INTERFACES( QskSkinFactory )
|
||||
|
||||
public:
|
||||
QskMaterialSkinFactory( QObject* parent = nullptr );
|
||||
~QskMaterialSkinFactory() override;
|
||||
QskMaterial3SkinFactory( QObject* parent = nullptr );
|
||||
~QskMaterial3SkinFactory() override;
|
||||
|
||||
QStringList skinNames() const override;
|
||||
QskSkin* createSkin( const QString& skinName ) override;
|
@ -4,17 +4,17 @@ CONFIG += qskinny
|
||||
TEMPLATE = lib
|
||||
QSK_PLUGIN_SUBDIR = skins
|
||||
|
||||
TARGET = $$qskPluginTarget(materialskin)
|
||||
DEFINES += QSK_MATERIAL_MAKEDLL
|
||||
TARGET = $$qskPluginTarget(material3skin)
|
||||
DEFINES += QSK_MATERIAL3_MAKEDLL
|
||||
|
||||
HEADERS += \
|
||||
QskMaterialGlobal.h \
|
||||
QskMaterialSkin.h \
|
||||
QskMaterialSkinFactory.h
|
||||
QskMaterial3Global.h \
|
||||
QskMaterial3Skin.h \
|
||||
QskMaterial3SkinFactory.h
|
||||
|
||||
SOURCES += \
|
||||
QskMaterialSkin.cpp \
|
||||
QskMaterialSkinFactory.cpp
|
||||
QskMaterial3Skin.cpp \
|
||||
QskMaterial3SkinFactory.cpp
|
||||
|
||||
OTHER_FILES += metadata.json
|
||||
|
4
skins/material3/metadata.json
Normal file
4
skins/material3/metadata.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"FactoryId": "Material3Factory",
|
||||
"Skins": [ "material3Light", "material3Dark" ]
|
||||
}
|
@ -2,4 +2,4 @@ TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += \
|
||||
squiek \
|
||||
material
|
||||
material3
|
||||
|
@ -20,7 +20,7 @@
|
||||
#if defined( ENSURE_SKINS )
|
||||
|
||||
#include <squiek/QskSquiekSkinFactory.h>
|
||||
#include <material/QskMaterialSkinFactory.h>
|
||||
#include <material3/QskMaterial3SkinFactory.h>
|
||||
|
||||
static void initSkins()
|
||||
{
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
qskSkinManager->registerFactory( "SquiekFactory", new QskSquiekSkinFactory() );
|
||||
qskSkinManager->registerFactory( "MaterialFactory", new QskMaterialSkinFactory() );
|
||||
qskSkinManager->registerFactory( "Material3Factory", new QskMaterial3SkinFactory() );
|
||||
|
||||
qWarning() << "Couldn't find skin plugins, adding some manually.";
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ static bool pluginPath = initPluginPath();
|
||||
|
||||
#include <QskSkinManager.h>
|
||||
#include <squiek/QskSquiekSkinFactory.h>
|
||||
#include <material/QskMaterialSkinFactory.h>
|
||||
#include <material3/QskMaterial3SkinFactory.h>
|
||||
#include <QCoreApplication>
|
||||
#include <iostream>
|
||||
|
||||
@ -53,7 +53,7 @@ static void initSkins()
|
||||
*/
|
||||
|
||||
qskSkinManager->registerFactory( "SquiekFactory", new QskSquiekSkinFactory() );
|
||||
qskSkinManager->registerFactory( "MaterialFactory", new QskMaterialSkinFactory() );
|
||||
qskSkinManager->registerFactory( "Material3Factory", new QskMaterial3SkinFactory() );
|
||||
|
||||
cout << "Couldn't find skin plugins, adding some manually." << endl;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ ensure_skins {
|
||||
use_local_rpath: QMAKE_RPATHDIR *= $${QSK_PLUGIN_DIR}/skins
|
||||
|
||||
qskAddLibrary($${QSK_PLUGIN_DIR}/skins, squiekskin)
|
||||
qskAddLibrary($${QSK_PLUGIN_DIR}/skins, materialskin)
|
||||
qskAddLibrary($${QSK_PLUGIN_DIR}/skins, material3skin)
|
||||
}
|
||||
|
||||
fontconfig {
|
||||
|
Loading…
x
Reference in New Issue
Block a user