SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
Qt et QML dans AsteroidOS par l'exemple
Par Florent Revest
Le 19 Novembre 2016
Qt et QML dans AsteroidOS par l'exemple
Présentation générale de Qt dans AsteroidOS
QPA, Launcher, BTSyncd, Apps, QML-Asteroid
Qt et QML dans AsteroidOS par l'exemple
Intégration de Qt dans AsteroidOS
Cross-compilé avec meta-qt5 dans OE
Launcher intégré avec un QPA
Applications et compositor intégrés avec QtWayland
Qt et QML dans AsteroidOS par l'exemple
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans AsteroidOS
Launcher
Démons Nemomobile
Démon de synchronisation Bluetooth
Applications
QML-Asteroid
Qt et QML dans AsteroidOS par l'exemple
asteroid-launcher
Watchfaces, .desktop, ShaderEffect...
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans asteroid-launcher
asteroid-launcher
Lipstick
QML/qml-asteroid Démons NemoQtWayland
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans asteroid-launcher
Watchfaces:
Loader {
width: desktop.width;
height: desktop.height;
source: watchFaceSource.value
}
ConfigurationValue {
id: watchFaceSource
key: "/desktop/asteroid/watchface"
defaultValue: "file:///usr/share/
asteroid-launcher/watchfaces/000-default-digital.qml"
}
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans asteroid-launcher
Fichiers .desktop
Format standardQColor AppLauncherBackground::centerColor(QString filePath)
{
if(m_centerColors.contains(filePath))
return m_centerColors.value(filePath);
QSettings settings(filePath, QSettings::NativeFormat);
QColor ret(settings.value("Desktop Entry/X-Asteroid-Center-Color",
QColor("#888888")).toString());
m_centerColors.insert(filePath, ret);
return ret;
}
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans asteroid-launcher
Fenêtres rondes
Item {
layer.enabled: DeviceInfo.hasRoundScreen
layer.effect: ShaderEffect {
property real adjustX: Math.max(width / height, 1)
property real adjustY: Math.max(1 / (width / height), 1)
fragmentShader: "
#extension GL_OES_standard_derivatives: enable
#ifdef GL_ES
precision lowp float;
#endif // GL_ES
varying highp vec2 qt_TexCoord0;
uniform highp float qt_Opacity;
uniform lowp sampler2D source;
uniform lowp float adjustX;
uniform lowp float adjustY;
void main(void) {
...
}"
}
Qt et QML dans AsteroidOS par l'exemple
asteroid-btsyncd
API BlueZ GATT DBus, MPRIS, adapteurs QtDBus
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans asteroid-btsyncd
asteroid-btsyncd
BlueZ
Bluetooth Low-Energy
AsteroidOS-Sync
Applications(weather, music, settings etc…)
D-Bus
D-Bus
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans asteroid-btsyncd
Multiplexeur DBus
Characteristic::Characteristic(QDBusConnection bus, ..., QObject *parent) :
QObject(parent), mBus(QDBusConnection::systemBus())
{
bus.registerObject("/char", this, QDBusConnection::ExportAllSlots |
QDBusConnection::ExportAllProperties);
}
class Characteristic : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", GATT_CHRC_IFACE)
Q_PROPERTY(QDBusObjectPath Service READ getService())
Q_PROPERTY(QString UUID READ getUuid())
Q_PROPERTY(QStringList Flags READ getFlags())
…
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans asteroid-btsyncd
Multiplexeur DBus
class WeatherCityChrc : public Characteristic
{
public:
WeatherCityChrc(QDBusConnection bus, int index, Service *service) :
Characteristic(bus, index, WEAT_CITY_UUID, {"write"}, service) {}
public slots:
void WriteValue(QByteArray value, QVariantMap)
{
const Glib::RefPtr<Gio::Settings> settings =
Gio::Settings::create("org.asteroidos.weather");
settings->set_string("city-name", value.data());
}
};
Qt et QML dans AsteroidOS par l'exemple
qml-asteroid
Application, LayerStack, FlatMesh, DeviceInfo...
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans qml-asteroid
Applications(weather, music, settings etc…)
QML
Qml-asteroid
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans qml-asteroid
Application/LayerStack
Flickable {
id: contentArea
anchors.fill: parent
interactive: false
Row { id: content }
}
NumberAnimation {
id: pushAnim
target: contentArea
property: "contentX"
duration: 200
easing.type: Easing.OutQuint
}
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans qml-asteroid
Application/LayerStack
void Application::setOverridesSystemGestures(bool enable)
{
if(m_overridesSystemGestures != enable)
{
m_overridesSystemGestures = enable;
if(enable)
window()->setFlags(window()->flags() |
Qt::WindowOverridesSystemGestures);
else
window()->setFlags(window()->flags() &
~Qt::WindowOverridesSystemGestures);
emit overridesSystemGesturesChanged();
}
}
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans qml-asteroid
DeviceInfo
bool DeviceInfo::hasRoundScreen()
{
#ifdef ROUND_SCREEN
return true;
#else
return false;
#endif
}
Qt et QML dans AsteroidOS par l'exemple
Utilisation de Qt dans qml-asteroid
FlatMesh
FlatMesh::FlatMesh(QQuickItem *parent) : QQuickItem(parent)
{
setFlag(ItemHasContents);
}
QSGNode *FlatMesh::updatePaintNode(QSGNode *old, UpdatePaintNodeData *)
{
FlatMeshNode *n = static_cast<FlatMeshNode *>(old);
if (!n)
n = new FlatMeshNode(window(), boundingRect());
return n;
}
Qt et QML dans AsteroidOS par l'exemple
Merci … Des questions ?
Site: http://asteroidos.org/
GitHub: AsteroidOS
Twitter: @AsteroidOS
IRC: #asteroid@irc.freenode.net

Contenu connexe

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Qt et QML dans AsteroidOS par l'exemple

  • 1. Qt et QML dans AsteroidOS par l'exemple Par Florent Revest Le 19 Novembre 2016
  • 2. Qt et QML dans AsteroidOS par l'exemple Présentation générale de Qt dans AsteroidOS QPA, Launcher, BTSyncd, Apps, QML-Asteroid
  • 3. Qt et QML dans AsteroidOS par l'exemple Intégration de Qt dans AsteroidOS Cross-compilé avec meta-qt5 dans OE Launcher intégré avec un QPA Applications et compositor intégrés avec QtWayland
  • 4. Qt et QML dans AsteroidOS par l'exemple
  • 5. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans AsteroidOS Launcher Démons Nemomobile Démon de synchronisation Bluetooth Applications QML-Asteroid
  • 6. Qt et QML dans AsteroidOS par l'exemple asteroid-launcher Watchfaces, .desktop, ShaderEffect...
  • 7. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans asteroid-launcher asteroid-launcher Lipstick QML/qml-asteroid Démons NemoQtWayland
  • 8. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans asteroid-launcher Watchfaces: Loader { width: desktop.width; height: desktop.height; source: watchFaceSource.value } ConfigurationValue { id: watchFaceSource key: "/desktop/asteroid/watchface" defaultValue: "file:///usr/share/ asteroid-launcher/watchfaces/000-default-digital.qml" }
  • 9. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans asteroid-launcher Fichiers .desktop Format standardQColor AppLauncherBackground::centerColor(QString filePath) { if(m_centerColors.contains(filePath)) return m_centerColors.value(filePath); QSettings settings(filePath, QSettings::NativeFormat); QColor ret(settings.value("Desktop Entry/X-Asteroid-Center-Color", QColor("#888888")).toString()); m_centerColors.insert(filePath, ret); return ret; }
  • 10. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans asteroid-launcher Fenêtres rondes Item { layer.enabled: DeviceInfo.hasRoundScreen layer.effect: ShaderEffect { property real adjustX: Math.max(width / height, 1) property real adjustY: Math.max(1 / (width / height), 1) fragmentShader: " #extension GL_OES_standard_derivatives: enable #ifdef GL_ES precision lowp float; #endif // GL_ES varying highp vec2 qt_TexCoord0; uniform highp float qt_Opacity; uniform lowp sampler2D source; uniform lowp float adjustX; uniform lowp float adjustY; void main(void) { ... }" }
  • 11. Qt et QML dans AsteroidOS par l'exemple asteroid-btsyncd API BlueZ GATT DBus, MPRIS, adapteurs QtDBus
  • 12. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans asteroid-btsyncd asteroid-btsyncd BlueZ Bluetooth Low-Energy AsteroidOS-Sync Applications(weather, music, settings etc…) D-Bus D-Bus
  • 13. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans asteroid-btsyncd Multiplexeur DBus Characteristic::Characteristic(QDBusConnection bus, ..., QObject *parent) : QObject(parent), mBus(QDBusConnection::systemBus()) { bus.registerObject("/char", this, QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllProperties); } class Characteristic : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", GATT_CHRC_IFACE) Q_PROPERTY(QDBusObjectPath Service READ getService()) Q_PROPERTY(QString UUID READ getUuid()) Q_PROPERTY(QStringList Flags READ getFlags()) …
  • 14. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans asteroid-btsyncd Multiplexeur DBus class WeatherCityChrc : public Characteristic { public: WeatherCityChrc(QDBusConnection bus, int index, Service *service) : Characteristic(bus, index, WEAT_CITY_UUID, {"write"}, service) {} public slots: void WriteValue(QByteArray value, QVariantMap) { const Glib::RefPtr<Gio::Settings> settings = Gio::Settings::create("org.asteroidos.weather"); settings->set_string("city-name", value.data()); } };
  • 15. Qt et QML dans AsteroidOS par l'exemple qml-asteroid Application, LayerStack, FlatMesh, DeviceInfo...
  • 16. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans qml-asteroid Applications(weather, music, settings etc…) QML Qml-asteroid
  • 17. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans qml-asteroid Application/LayerStack Flickable { id: contentArea anchors.fill: parent interactive: false Row { id: content } } NumberAnimation { id: pushAnim target: contentArea property: "contentX" duration: 200 easing.type: Easing.OutQuint }
  • 18. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans qml-asteroid Application/LayerStack void Application::setOverridesSystemGestures(bool enable) { if(m_overridesSystemGestures != enable) { m_overridesSystemGestures = enable; if(enable) window()->setFlags(window()->flags() | Qt::WindowOverridesSystemGestures); else window()->setFlags(window()->flags() & ~Qt::WindowOverridesSystemGestures); emit overridesSystemGesturesChanged(); } }
  • 19. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans qml-asteroid DeviceInfo bool DeviceInfo::hasRoundScreen() { #ifdef ROUND_SCREEN return true; #else return false; #endif }
  • 20. Qt et QML dans AsteroidOS par l'exemple Utilisation de Qt dans qml-asteroid FlatMesh FlatMesh::FlatMesh(QQuickItem *parent) : QQuickItem(parent) { setFlag(ItemHasContents); } QSGNode *FlatMesh::updatePaintNode(QSGNode *old, UpdatePaintNodeData *) { FlatMeshNode *n = static_cast<FlatMeshNode *>(old); if (!n) n = new FlatMeshNode(window(), boundingRect()); return n; }
  • 21. Qt et QML dans AsteroidOS par l'exemple Merci … Des questions ? Site: http://asteroidos.org/ GitHub: AsteroidOS Twitter: @AsteroidOS IRC: #asteroid@irc.freenode.net