SlideShare una empresa de Scribd logo
1 de 15
Descargar para leer sin conexión
Platform and device-specific settings for your QML layouts,[object Object],Artem Marchenko,[object Object],October 8, 2011,[object Object],After Easy Discount Calculator by Artem Marchenko, JarmoParkkinen, TuukkaLindroos and Ekaterina Kuts,[object Object],Technical solution by Artem Marchenko and TuukkaLindroos,[object Object]
Artem Marchenko,[object Object],Product Manager, Agile Coach, QML engineer for hire,[object Object],Was a Product Manager shipping multi-hundred MEur products,[object Object],Three times Forum Nokia Champion,[object Object],Private entrepreneur,[object Object],Available for hire for all things QML,[object Object],http://fi.linkedin.com/in/artemmarchenko ,[object Object]
Same app running on Harmattan, Android and Symbian,[object Object]
Easy Discount Calculator,[object Object],Symbian, MeeGo/Harmattan - http://store.ovi.com/content/186742,[object Object],Android - http://bit.ly/discountcalculator,[object Object],Free, but has font issues on some models due to porting technology bug.,[object Object],Well working proof of concept for now,[object Object]
All the parameters can be fine-tuned on desktop,[object Object]
Settings system,[object Object],// SettingsBase.QML,[object Object],import Qt 4.7,[object Object],import "GlobalSettings.js" as Js,[object Object],QtObject {,[object Object],    id: settingsObject,[object Object],// logical switches/conditions,[object Object],    property boolexitButtonPresent: true,[object Object],    property boolclearButtonIsBetweenTheLines: true,[object Object],    // element sizes,[object Object],    property introllerHeight: 110,[object Object],    property intdigitRollerWidth: 56,[object Object],    property intpercentageRollerWidth: digitRollerWidth,[object Object]
Settings system,[object Object],// SettingsMaemo.qml,[object Object],import Qt 4.7,[object Object],SettingsBase {,[object Object],    property string platformTitle: "Maemo",[object Object],    property intscreenWidthInPortrait:  480,[object Object],...,[object Object],    property introllerHeight: 160,[object Object],    property introllerNumberLineInnerSpacing:  0,[object Object],    property int digitRollerWidth:69,[object Object],statusLineHeight: 0,[object Object]
Tree of settings,[object Object]
Using platform settings in JS,[object Object],//GlobalSettings.js,[object Object],.pragma library   // - the only QML possibility for global variables,[object Object],varglobalSettings = null,[object Object],// Will fetch the settings object from the item. If the settings object doesn't // exists, will return the global one or generate one on the fly based on base settings. ,[object Object],function getSettings(item) {,[object Object],…,[object Object], if(item.settings) {,[object Object],        if(!globalSettings) {,[object Object],globalSettings = item.settings,[object Object],        },[object Object],if(!globalSettings) {,[object Object],var component = Qt.createComponent("SettingsBase.qml"),[object Object],globalSettings = component.createObject(item),[object Object],    },[object Object],    return globalSettings;,[object Object]
Using Settings in QML,[object Object],// SmallButton.qml,[object Object],import Qt 4.7,[object Object],import "GlobalSettings.js" as Js,[object Object],Rectangle {,[object Object],    id: button,[object Object],    width: Js.getSettings(button).smallButtonWidth,[object Object],    height: Js.getSettings(button).smallButtonHeight,[object Object],    radius: 3,[object Object]
Injecting Settings from C++,[object Object],QStringsettingsPath = "qml/discountcalcui/Settings" + platformTitle + ".qml";,[object Object],// localAdjustPath cares about platform-specific file location details,[object Object],settingsUrl = QUrl::fromLocalFile(CrossPlatformUtils::localAdjustPath(settingsPath));,[object Object],QDeclarativeComponent component(view.engine(), settingsUrl);,[object Object],settingsInstance = component.create();,[object Object],if(!settingsInstance) {           // No settings found - no object to install,[object Object],qWarning() << "Settings not found for this platform!"; qWarning() << component.errorString();,[object Object],} else {,[object Object],settingsInstance->setProperty("shouldInitializeGlobalSettingWithItself", true);,[object Object],view.engine()->rootContext()->setContextProperty("forcedSettings”, settingsInstance);,[object Object],    },[object Object],// continue with normal QML initialization,[object Object]
JavaScript side of initialization,[object Object],//SettingsBase.qml,[object Object],import Qt 4.7,[object Object],import "GlobalSettings.js" as Js,[object Object],QtObject {,[object Object],    id: settingsObject,[object Object],    property boolshouldInitializeGlobalSettingWithItself: false,[object Object],// Is executed way before main QML file is loaded,[object Object],onShouldInitializeGlobalSettingWithItselfChanged: {,[object Object],        if(shouldInitializeGlobalSettingWithItself) {,[object Object],console.log("SBase: initializing global settings with " + settingsObject),[object Object],Js.globalSettings = settingsObject,[object Object],        },[object Object],    },[object Object]
Switching settings for desktop simulation,[object Object],// Simulator for different platforms,[object Object],DiscountCalcUi {,[object Object],        id: main,[object Object],    },[object Object],ListModel {,[object Object],        id: platformsModel,[object Object],ListElement {title: "Symbian"; visualTitle: "S^3"},[object Object],ListElement{title: "Android480x800"; visualTitle: "Andr 800" },[object Object],ListElement{title: "Harmattan" },[object Object],    },[object Object],onButtonClicked: {,[object Object],var component = Qt.createComponent("Settings" + model.title + ".qml"),[object Object],main.settings = component.createObject(main),[object Object],},[object Object],// actually, maybe we should have changed the global JS reference :/,[object Object]
Summary,[object Object],Parameterizing code everywhere is possible and easy,[object Object],Use JavaScript libraries for storing global objects,[object Object],To initialize settings by the moment of QML instantiations, inject settings from C++ before the main QML object,[object Object],Care about ability to change settings object for the desktop simulation of different platforms,[object Object]
Thank you,[object Object],Q&As time,[object Object],You can find these and similar slides at http://agilesoftwaredevelopment.com/tags/qml,[object Object]

Más contenido relacionado

Destacado

Difference Between Open And Closed Cell Foam Insulation
Difference Between Open And Closed Cell Foam InsulationDifference Between Open And Closed Cell Foam Insulation
Difference Between Open And Closed Cell Foam InsulationBill Miller
 
Scrum não é suficiente - ultrapassando o básico
Scrum não é suficiente - ultrapassando o básicoScrum não é suficiente - ultrapassando o básico
Scrum não é suficiente - ultrapassando o básicoIgor Macaubas
 
Fun with QML and JavaScript: Embedded Linux Conference 11th April 2011, Hotel...
Fun with QML and JavaScript: Embedded Linux Conference 11th April 2011, Hotel...Fun with QML and JavaScript: Embedded Linux Conference 11th April 2011, Hotel...
Fun with QML and JavaScript: Embedded Linux Conference 11th April 2011, Hotel...Raj Lal
 
Vídeos - novos hábitos, grandes desafios
Vídeos - novos hábitos, grandes desafiosVídeos - novos hábitos, grandes desafios
Vídeos - novos hábitos, grandes desafiosIgor Macaubas
 
QML demo for makerpro (1)
QML demo for makerpro (1)QML demo for makerpro (1)
QML demo for makerpro (1)diro fan
 
Intro to QML / Declarative UI
Intro to QML / Declarative UIIntro to QML / Declarative UI
Intro to QML / Declarative UIOpenBossa
 
Terraforming organisations
Terraforming organisationsTerraforming organisations
Terraforming organisationsClaudio Perrone
 
Build Cutting edge Mobile Apps using QML and JavaScript for MeeGo N9: Linux F...
Build Cutting edge Mobile Apps using QML and JavaScript for MeeGo N9: Linux F...Build Cutting edge Mobile Apps using QML and JavaScript for MeeGo N9: Linux F...
Build Cutting edge Mobile Apps using QML and JavaScript for MeeGo N9: Linux F...Raj Lal
 
How to Make Your Qt App Look Native
How to Make Your Qt App Look NativeHow to Make Your Qt App Look Native
How to Make Your Qt App Look Nativeaccount inactive
 
Having the Correct Context for an Agile Transformation
Having the Correct Context for an Agile TransformationHaving the Correct Context for an Agile Transformation
Having the Correct Context for an Agile TransformationDerek Huether
 
Fases de RUP - PDF
Fases de RUP - PDFFases de RUP - PDF
Fases de RUP - PDFradoslawkb
 

Destacado (19)

Difference Between Open And Closed Cell Foam Insulation
Difference Between Open And Closed Cell Foam InsulationDifference Between Open And Closed Cell Foam Insulation
Difference Between Open And Closed Cell Foam Insulation
 
Scrum não é suficiente - ultrapassando o básico
Scrum não é suficiente - ultrapassando o básicoScrum não é suficiente - ultrapassando o básico
Scrum não é suficiente - ultrapassando o básico
 
Resumen RUP
Resumen RUPResumen RUP
Resumen RUP
 
Fun with QML and JavaScript: Embedded Linux Conference 11th April 2011, Hotel...
Fun with QML and JavaScript: Embedded Linux Conference 11th April 2011, Hotel...Fun with QML and JavaScript: Embedded Linux Conference 11th April 2011, Hotel...
Fun with QML and JavaScript: Embedded Linux Conference 11th April 2011, Hotel...
 
QtQuick Day 4
QtQuick Day 4QtQuick Day 4
QtQuick Day 4
 
Agile Contracts
Agile ContractsAgile Contracts
Agile Contracts
 
Vídeos - novos hábitos, grandes desafios
Vídeos - novos hábitos, grandes desafiosVídeos - novos hábitos, grandes desafios
Vídeos - novos hábitos, grandes desafios
 
QML demo for makerpro (1)
QML demo for makerpro (1)QML demo for makerpro (1)
QML demo for makerpro (1)
 
Hello, QML
Hello, QMLHello, QML
Hello, QML
 
QtQuick Day 2
QtQuick Day 2QtQuick Day 2
QtQuick Day 2
 
QtQuick Day 3
QtQuick Day 3QtQuick Day 3
QtQuick Day 3
 
Intro to QML / Declarative UI
Intro to QML / Declarative UIIntro to QML / Declarative UI
Intro to QML / Declarative UI
 
Terraforming organisations
Terraforming organisationsTerraforming organisations
Terraforming organisations
 
Qt Qml
Qt QmlQt Qml
Qt Qml
 
Build Cutting edge Mobile Apps using QML and JavaScript for MeeGo N9: Linux F...
Build Cutting edge Mobile Apps using QML and JavaScript for MeeGo N9: Linux F...Build Cutting edge Mobile Apps using QML and JavaScript for MeeGo N9: Linux F...
Build Cutting edge Mobile Apps using QML and JavaScript for MeeGo N9: Linux F...
 
QtQuick Day 1
QtQuick Day 1QtQuick Day 1
QtQuick Day 1
 
How to Make Your Qt App Look Native
How to Make Your Qt App Look NativeHow to Make Your Qt App Look Native
How to Make Your Qt App Look Native
 
Having the Correct Context for an Agile Transformation
Having the Correct Context for an Agile TransformationHaving the Correct Context for an Agile Transformation
Having the Correct Context for an Agile Transformation
 
Fases de RUP - PDF
Fases de RUP - PDFFases de RUP - PDF
Fases de RUP - PDF
 

Más de Artem Marchenko

One code Web, iOS, Android
One code Web, iOS, AndroidOne code Web, iOS, Android
One code Web, iOS, AndroidArtem Marchenko
 
Getting started with coding for Jolla Sailfish OS. 29 Mar 2014, Tampere, Finland
Getting started with coding for Jolla Sailfish OS. 29 Mar 2014, Tampere, FinlandGetting started with coding for Jolla Sailfish OS. 29 Mar 2014, Tampere, Finland
Getting started with coding for Jolla Sailfish OS. 29 Mar 2014, Tampere, FinlandArtem Marchenko
 
Getting started with coding for Jolla Sailfish OS. 22 Feb 2014, Tampere, Finland
Getting started with coding for Jolla Sailfish OS. 22 Feb 2014, Tampere, FinlandGetting started with coding for Jolla Sailfish OS. 22 Feb 2014, Tampere, Finland
Getting started with coding for Jolla Sailfish OS. 22 Feb 2014, Tampere, FinlandArtem Marchenko
 
Misapplied Scrum pattern
Misapplied Scrum patternMisapplied Scrum pattern
Misapplied Scrum patternArtem Marchenko
 
Effective Software Development for the 21st century
Effective Software Development for the 21st centuryEffective Software Development for the 21st century
Effective Software Development for the 21st centuryArtem Marchenko
 

Más de Artem Marchenko (7)

One code Web, iOS, Android
One code Web, iOS, AndroidOne code Web, iOS, Android
One code Web, iOS, Android
 
Getting started with coding for Jolla Sailfish OS. 29 Mar 2014, Tampere, Finland
Getting started with coding for Jolla Sailfish OS. 29 Mar 2014, Tampere, FinlandGetting started with coding for Jolla Sailfish OS. 29 Mar 2014, Tampere, Finland
Getting started with coding for Jolla Sailfish OS. 29 Mar 2014, Tampere, Finland
 
Getting started with coding for Jolla Sailfish OS. 22 Feb 2014, Tampere, Finland
Getting started with coding for Jolla Sailfish OS. 22 Feb 2014, Tampere, FinlandGetting started with coding for Jolla Sailfish OS. 22 Feb 2014, Tampere, Finland
Getting started with coding for Jolla Sailfish OS. 22 Feb 2014, Tampere, Finland
 
Test driving-qml
Test driving-qmlTest driving-qml
Test driving-qml
 
Test driving QML
Test driving QMLTest driving QML
Test driving QML
 
Misapplied Scrum pattern
Misapplied Scrum patternMisapplied Scrum pattern
Misapplied Scrum pattern
 
Effective Software Development for the 21st century
Effective Software Development for the 21st centuryEffective Software Development for the 21st century
Effective Software Development for the 21st century
 

Último

Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 

Último (20)

Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 

QML settings

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.