Compare commits

2 Commits
Author SHA1 Message Date
Niels Ørgaard 89b8f6f1e8 Migrating to libQTIoT
adding support for libQTIoT
Removing Python bits
- some Python bits left in, to be replaced or removed as applicable
2015-01-04 20:37:21 +01:00
Niels Ørgaard e6eb46966e small fixes
Due to GIT missing basic features I’m used to from SVN, there were (and
are) issues with the lifx-python integration.
2014-10-23 18:30:06 +02:00
20 changed files with 1629 additions and 911 deletions

No files matched your search

+15 -18
View File
@@ -14,7 +14,8 @@ TARGET = LightFish
CONFIG += sailfishapp
SOURCES += src/LightFish.cpp
SOURCES += src/LightFish.cpp \
src/lifxlightsmodel.cpp
OTHER_FILES += qml/LightFish.qml \
qml/cover/CoverPage.qml \
@@ -25,18 +26,7 @@ OTHER_FILES += qml/LightFish.qml \
translations/*.ts \
$${TARGET}.desktop \
qml/pages/BulbListPage.qml \
qml/pages/lightfish.py \
qml/pages/lifx3/packetcodec.py \
qml/pages/lifx3/network.py \
qml/pages/lifx3/listen.py \
qml/pages/lifx3/lifxconstants.py \
qml/pages/lifx3/lifx3.py \
lightfish_test_3.png \
qml/lifx3/lifxconstants.py \
qml/lifx3/packetcodec.py \
qml/lifx3/network.py \
qml/lifx3/listen.py \
qml/lightfish.py \
qml/pages/BulbDetails.qml \
qml/pages/storage.js \
qml/images/lifx-icon.png \
@@ -45,15 +35,22 @@ OTHER_FILES += qml/LightFish.qml \
qml/images/logo_lifx.png \
qml/images/logo_lifx_grey.png \
qml/perl/iwpriv_helper.pl \
qml/lifx3/lifx.py \
../lifx-python/lifx/packetcodec.py \
../lifx-python/lifx/network.py \
../lifx-python/lifx/listen.py \
../lifx-python/lifx/lifxconstants.py \
../lifx-python/lifx/lifx.py
qml/pages/IntroPage.qml \
qml/analytics.js \
qml/images/LIFX_Bulb_bg.jpg \
qml/images/LIFX_Bulb_bg.png \
# to disable building translations every time, comment out the
# following CONFIG line
CONFIG += sailfishapp_i18n
TRANSLATIONS += translations/$${TARGET}-de.ts
HEADERS += \
src/lifxlightsmodel.h
#INCLUDEPATH += ../libQTIoT_sailfish/src/
INCLUDEPATH += ../libQTIoT/src/
#unix:LIBS += "-L../build-QTIoT-Desktop_Qt_Qt_Version_clang_64bit-Debug" "-lQTIoT"
unix:LIBS += "-L../libQTIoT/build-QTIoT_SF-MerSDK_SailfishOS_armv7hl-Debug" "-lQTIoT"
unix:LIBS += "-L../libQTIoT/build-QTIoT_SF-MerSDK_SailfishOS_i486-Debug" "-lQTIoT"
#unix:LIBS += "-L../libQTIoT/build-QTIoT_SF-MerSDK_SailfishOS_armv7hl-Release" "-lQTIoT"
+321 -35
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 2.8.2, 2014-10-23T15:53:29. -->
<!-- Written by QtCreator 3.1.2, 2015-01-04T20:33:36. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -9,19 +9,19 @@
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">false</value>
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QString" key="CurrentPreferences">CppGlobal</value>
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
@@ -29,14 +29,17 @@
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">4</value>
<value type="bool" key="EditorConfiguration.UseGlobal">false</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
@@ -53,13 +56,20 @@
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">MerSDK-SailfishOS-armv7hl</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">MerSDK-SailfishOS-armv7hl</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{3abb43b3-4d4a-433f-8714-aa5574cd8f40}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{216954c1-1b0f-45db-872a-8e3239d8d48b}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">2</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/nc/projects/build-LightFish-MerSDK_SailfishOS_armv7hl-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Start SDK</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Mer.MerSdkStartStep</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
@@ -69,7 +79,7 @@
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.2">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
@@ -82,13 +92,19 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">3</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Start SDK</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Mer.MerSdkStartStep</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
@@ -101,7 +117,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
@@ -113,12 +129,18 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/Users/nc/projects/build-LightFish-MerSDK_SailfishOS_armv7hl-Debug</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/nc/projects/build-LightFish-MerSDK_SailfishOS_armv7hl-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Start SDK</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Mer.MerSdkStartStep</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
@@ -128,7 +150,7 @@
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.2">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
@@ -141,13 +163,19 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">3</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Start SDK</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Mer.MerSdkStartStep</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
@@ -160,7 +188,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
@@ -172,7 +200,6 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/Users/nc/projects/build-LightFish-MerSDK_SailfishOS_armv7hl-Release</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
@@ -182,7 +209,7 @@
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Rpm</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MerRpmBuildStep</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerRpmBuildStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
@@ -192,7 +219,7 @@
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy By Building An RPM Package</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MerArmDeployConfiguration</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerArmDeployConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
@@ -200,7 +227,7 @@
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Rsync</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MerRsyncDeployStep</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerRsyncDeployStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
@@ -210,7 +237,7 @@
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy By Copying Binaries</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MerRSyncDeployConfiguration</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerRSyncDeployConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.2">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
@@ -218,7 +245,7 @@
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Rpm</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MerRpmDeployStep</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerRpmDeployStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
@@ -228,12 +255,11 @@
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy As RPM Package</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MerRpmDeployConfiguration</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerRpmDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Project.UseGlobal">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
@@ -243,8 +269,12 @@
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
@@ -266,34 +296,290 @@
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">1</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">LightFish (on Remote Device)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">LightFish (on Mer Device)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MerRunConfiguration:/Users/nc/projects/LightFish/LightFish.pro</value>
<value type="QString" key="Qt4ProjectManager.MaemoRunConfiguration.Arguments"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerRunConfiguration:/Users/nc/projects/LightFish/LightFish.pro</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.Arguments"/>
<value type="QString" key="Qt4ProjectManager.MaemoRunConfiguration.ProFile">LightFish.pro</value>
<value type="QString" key="RemoteLinux.RunConfig.AlternateRemoteExecutable"></value>
<value type="bool" key="RemoteLinux.RunConfig.UseAlternateRemoteExecutable">false</value>
<value type="QString" key="RemoteLinux.RunConfig.WorkingDirectory"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.1</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">MerSDK-SailfishOS-i486</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">MerSDK-SailfishOS-i486</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{b3b5f56a-11fd-477f-bb4d-35380ea1f06a}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/nc/projects/build-LightFish-MerSDK_SailfishOS_i486-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Start SDK</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Mer.MerSdkStartStep</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.2">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">3</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Start SDK</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Mer.MerSdkStartStep</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/nc/projects/build-LightFish-MerSDK_SailfishOS_i486-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Start SDK</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Mer.MerSdkStartStep</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.2">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">3</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Start SDK</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Mer.MerSdkStartStep</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Start Emulator</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerEmulatorStartStep</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Rsync</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerRsyncDeployStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy By Copying Binaries</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerRSyncDeployConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Start Emulator</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerEmulatorStartStep</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Rpm</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerRpmDeployStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy As RPM Package</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.MerRpmDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">-1</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
<value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
<value type="int">2</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QByteArray">{4bbf78bd-75d4-402c-b0af-409e42c77d80}</value>
<value type="QByteArray">{40056d7f-eeb4-437b-bbb1-9b51ef8cc539}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">14</value>
<value type="int">15</value>
</data>
</qtcreator>
+270 -150
View File
@@ -31,171 +31,291 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import "pages"
import io.thp.pyotherside 1.0
//import pyotherside 1.2
//import io.thp.pyotherside 1.0
import IoTQuick 1.0
import IoTQuick.LIFXLightsModel 1.0
import "storage.js" as Storage
import "analytics.js" as Analytics
ApplicationWindow
{
property int bulbsAreOn: 0
id: p
property int bulbsAreOn: 0
id: p
property string analyticsID : ""
property string appName : "LightFish"
property string appVersion: "0.2a"
property string appUUID : quuid;
Python
{
id: py
Component.onCompleted:
{
// Add the directory of this .qml file to the search path
addImportPath(Qt.resolvedUrl('.'));
/*Python
{
id: py
Component.onCompleted:
{
Storage.initialize();
var oldUUID = Storage.getSetting("analytics","UUID");
if(oldUUID != "Unknown")
appUUID = oldUUID;
else
Storage.setSetting("analytics", "UUID", appUUID);
//function register( trackingID_in, clientID_in, appName_in, appVersion_in, appID_in )
Analytics.register(analyticsID, appUUID /*"Jolla"* /, appName, appVersion, "dk.thang.lightfish");
Analytics.registerAdditionSettings("screenres",""+p.width+"x"+p.height);
// Import the main module and load the data
importModule('lightfish', function ()
{
console.log('lightfish imported');
py.call('lightfish.get_bulbs', [], function(result)
{
console.log('lightfish chewing');
// Load the received data into the list model
for (var i=0; i<result.length; i++) {
console.log('lightfish @'+result[i]['bulb_name']);
//listModel.append(result[i]);
}
console.log('lightfish done');
});
console.log('lightfish processed');
});
}
//Component.onDestruction:
}
// Add the directory of this .qml file to the search path
addImportPath(Qt.resolvedUrl('.'));
// Import the main module and load the data
console.log('lightfish importing');
importModule('lightfish', function ()
{
console.log('lightfish imported');
py.call('lightfish.get_bulbs', [], function(result)
{
console.log('lightfish chewing');
// Load the received data into the list model
for (var i=0; i<result.length; i++) {
console.log('lightfish @'+result[i]['bulb_name']);
//listModel.append(result[i]);
}
console.log('lightfish done');
pageStack.replace(Qt.resolvedUrl("pages/FirstPage.qml"), { /*py: py* /})
});
console.log('lightfish processed');
callScreenView();
});
setHandler('bulbs.found', function (count)
{
pageStack.replace(Qt.resolvedUrl("FirstPage.qml"), { /*py: py* /})
});
}
//Component.onDestruction:
}*/
// initialPage: Component { FirstPage { py: py } }
initialPage: Component { FirstPage { } }
cover: Qt.resolvedUrl("cover/CoverPage.qml")
initialPage: Qt.resolvedUrl("pages/IntroPage.qml")
// initialPage: Component { FirstPage { } }
cover: Qt.resolvedUrl("cover/CoverPage.qml")
//bulbslistPage: Qt.resolvedUrl("pages/BulbListPage.qml")
/*ListModel{id: lightsModel}*/
LIFXLightsModel
{
id: lightsModel
}
function lifxGetBulbs( page )
{
console.log("lifxGetBulbs")
py.call('lightfish.get_bulbs', [], function(result)
{
console.log("lifxGetBulbs: "+result.length+" lights");
page.setLights(result);
});
}
function lifxBulbGetObject(addr,page)
{
console.log("lifxBulbGetObject")
py.call('lightfish.get_bulb', [addr], function(result)
{
console.log("lifxBulbGetObject: got object");
page.setBulb(result);
});
}
function lifxBulbGetObject_sync(addr)
{
console.log("lifxBulbGetObject_sync ("+addr+")")
var result = py.call_sync('lightfish.get_bulb', [addr])
console.log("lifxBulbGetObject_sync - got bulb: "+result.bulb_name+"@"+result.bulb_addr)
LIFXDiscoveryClient
{
id: discoveryClient
onNewGatewayClient:{discoveryClient.startDiscoveryTimer(60000);}
onNewIoTItem:
{ //item.power = !item.power; textlabel.text = item.label; console.log("New IoTItem!");
lightsModel.appendLight(item)
if(lightsModel.rowCount() == 1)
pageStack.replace(Qt.resolvedUrl("pages/FirstPage.qml"), { /*py: py*/})
}
}
Timer //Timer used for Party-Mode
{
id: partyTimer
interval: 300
running: false
repeat: true
onTriggered:
{
var n = 0;
var lightsCount = lightsModel.rowCount()
for( ; n<lightsCount; n++)
{
if( lightsModel.isSelectedLight(n))
{
var light = lightsModel.getLight(n);
//setColourAll(int red, int green, int blue, float brightnesspercent, int saturation, int kelvin);
light.setColourAll(Math.random()*255, Math.random()*255, Math.random()*255, Math.random()*100, 255, 8000 );
}
}
return result;
}
}
function coverLeftClicked()
{
console.log("coverLeftClicked")
}
function coverRightClicked()
{
console.log("coverRightClicked")
if( bulbsAreOn == 0)
{
lifxBulbsSelectedOn();
bulbsAreOn = 1;
}
else
{
lifxBulbsSelectedOff()
bulbsAreOn = 0;
}
}
}
function lifxBulbsSelectedOff()
{
console.log("lifxBulbsSelectedOff")
py.call('lightfish.turn_off_all', [], function(result)
{
console.log('lightfish unlight!');
});
}
function lifxBulbsSelectedCount()
{
console.log("lifxBulbsSelectedCount")
/* py.call('lightfish.get_selected_count', [], function(result)
{
console.log('lightfish light!');
});*/
var n = py.call_sync('lightfish.get_selected_count', []);
console.log("lifxBulbsSelectedCount: "+n+"pcs")
return n;
}
function lifxBulbsSelectedOn()
{
console.log("lifxBulbsSelectedOn")
py.call('lightfish.turn_on_all', [], function(result)
{
console.log('lightfish light!');
});
}
function lifxBulbSelect(addr)
{
console.log("lifxBulbSelect")
py.call('lightfish.set_active', [addr], function(result)
{
console.log('lightfish added: '+ name);
});
}
function lifxBulbDeSelect(addr)
{
console.log("lifxBulbDeSelect")
py.call('lightfish.set_inactive', [addr], function(result)
{
console.log('lightfish removed: '+ name);
});
}
function lifxBulbsSelectedBrightness(value)
{
console.log("lifxBulbsSelectedBrightness")
py.call('lightfish.set_brightness', [value], function(result)
{
console.log('lightfish brightly: '+ value);
});
}
function lifxBulbsSelectedSaturation(value)
{
console.log("lifxBulbsSelectedSaturation")
py.call('lightfish.set_saturation', [value], function(result)
{
console.log('lightfish whitely: '+ value);
});
}
function lifxBulbsSelectedKelvin(value)
{
console.log("lifxBulbsSelectedKelvin")
py.call('lightfish.set_kelvin', [value], function(result)
{
console.log('lightfish temperature: '+ value);
});
}
function pythonShutdown()
{
console.log("pythonShutdown")
py.call('lightfish.pythonShutdown', [value], function(result)
{
console.log('lightfish temperature: '+ value);
});
}
function lifxGetBulbs( page )
{
console.log("lifxGetBulbs")
}
function lifxBulbGetObject(addr,page)
{
console.log("lifxBulbGetObject")
}
function lifxBulbGetObject_sync(addr)
{
console.log("lifxBulbGetObject_sync ("+addr+")")
var result = undefined;
return result;
}
function coverLeftClicked()
{
console.log("coverLeftClicked")
}
function coverRightClicked()
{
console.log("coverRightClicked")
if( bulbsAreOn == 0)
{
lifxBulbsSelectedOn();
bulbsAreOn = 1;
}
else
{
lifxBulbsSelectedOff()
bulbsAreOn = 0;
}
}
function lifxBulbsSelectedOff()
{
console.log("lifxBulbsSelectedOff")
var n = 0;
var lightsCount = lightsModel.rowCount()
for( ; n<lightsCount; n++)
{
if( lightsModel.isSelectedLight(n))
{
var light = lightsModel.getLight(n);
light.power = false;
}
}
}
function lifxBulbsSelectedCount()
{
console.log("lifxBulbsSelectedCount")
var n = lightsModel.countSelectedLights();
//console.log("lifxBulbsSelectedCount: "+n+"pcs")
return n;
}
function lifxBulbsSelectedOn()
{
console.log("lifxBulbsSelectedOn")
var n = 0;
var lightsCount = lightsModel.rowCount()
for( ; n<lightsCount; n++)
{
if( lightsModel.isSelectedLight(n))
{
var light = lightsModel.getLight(n);
light.power = true;
}
}
}
function lifxBulbSelect(addr)
{
console.log("lifxBulbSelect")
}
function lifxBulbDeSelect(addr)
{
console.log("lifxBulbDeSelect")
}
function lifxBulbsSelectedBrightness(value)
{
if (value < 1)
value = 1;
if (value > 100)
value = 100;
//log(n)/log(100)
//var logval = Math.log(value) * 100 / Math.log(100);
//n^3/10000
var logval = value^3/10000;
console.log("lifxBulbsSelectedBrightness("+value+")=>"+logval);
var n = 0;
var lightsCount = lightsModel.rowCount();
for( ; n<lightsCount; n++)
{
if( lightsModel.isSelectedLight(n))
{
var light = lightsModel.getLight(n);
light.brightness = logval; //value;
}
}
}
function lifxBulbsSelectedSaturation(value)
{
var saturation = value * 2.55
console.log("lifxBulbsSelectedSaturation("+value+")->"+saturation)
var n = 0;
var lightsCount = lightsModel.rowCount()
for( ; n<lightsCount; n++)
{
if( lightsModel.isSelectedLight(n))
{
var light = lightsModel.getLight(n);
light.saturation = saturation;
}
}
}
function lifxBulbsSelectedKelvin(value)
{
var kelvin = (8000-2700)/100*value + 2700 //int((kelvin* (8000-2700))/100)+2700
console.log("lifxBulbsSelectedKelvin("+value+")->"+kelvin)
var n = 0;
var lightsCount = lightsModel.rowCount()
for( ; n<lightsCount; n++)
{
if( lightsModel.isSelectedLight(n))
{
var light = lightsModel.getLight(n);
light.temperature = kelvin;
}
}
}
function lifxBulbsSelectedColor(value)
{
console.log("lifxBulbsSelectedColor")
var n = 0;
var lightsCount = lightsModel.rowCount()
for( ; n<lightsCount; n++)
{
if( lightsModel.isSelectedLight(n))
{
var light = lightsModel.getLight(n);
light.colour = value;
}
}
}
function callScreenView(screen)
{
if(!Analytics.isInitialized())
{
Storage.initialize();
var oldUUID = Storage.getSetting("analytics","UUID");
if(oldUUID != "Unknown")
p.appUUID = oldUUID;
else
Storage.setSetting("analytics", "UUID", p.appUUID);
//function register( trackingID_in, clientID_in, appName_in, appVersion_in, appID_in )
Analytics.register(p.analyticsID, p.appUUID , p.appName, p.appVersion, "dk.thang.lightfish");
Analytics.registerAdditionSettings("screenres",""+p.width+"x"+p.height);
Analytics.appstart();
}
console.log("pythonShutdown")
Analytics.screenview(screen);
}
}
+211
View File
@@ -0,0 +1,211 @@
.pragma library
/***************************************************************************************************
Google Analytics
Measurement Protocol Overview - https://developers.google.com/analytics/devguides/collection/protocol/v1/
Developer Guide - https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide
Parameter Reference Guide - https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
Protocol Policy - https://developers.google.com/analytics/devguides/collection/protocol/policy
***************************************************************************************************/
var analyticsVersion = 1;
var propertyID = "";
//var trackingID ="";
var clientID ;
var appName;
var appVersion = "0.1a";
var appID;
// Advanced Parameters
var deviceScreen;
/*
v=1 // Version.
&tid=UA-XXXX-Y // Tracking ID / Property ID.
&cid=555 // Anonymous Client ID.
&t=screenview // Screenview hit type.
&an=funTimes // App name.
&av=4.2.0 // App version.
&aid=com.foo.App // App Id.
&aiid=com.android.vending // App Installer Id.
&cd=Home // Screen name / content description.
*/
function register( trackingID_in, clientID_in, appName_in, appVersion_in, appID_in )
{
analyticsVersion = 1;
propertyID = trackingID_in;
clientID = clientID_in;
appName = appName_in;
appVersion = appVersion_in;
appID = appID_in;
}
function registerAdditionSettings( parameter, value )
{
if(parameter == "screenres")
deviceScreen = value;
}
function screenview2( screenName, other)
{
if( propertyID === undefined || clientID === undefined || appName === undefined )
return FALSE;
if(appVersion === undefined)
appVersion = "0.1a";
var http = new XMLHttpRequest();
var url = "https://ssl.google-analytics.com/collect";
var params = "v=1" +
"&tid=" + propertyID +
"&cid=" + clientID +
"&t=screenview" +
"&an=" + appName +
"&av=" + appVersion;
if(screenName != undefined)
params = params + "&cd="+screenName;
if(appID != undefined)
params = params + "&aid="+appID;
// if(appotherID != undefined)
// params = params + "&"+other;
// if(appotherID != undefined)
// params = params + "&"+other;
http.open("POST", url, true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
//alert(http.responseText);
console.log("Analytics replied: state="+http.readyState+" - status="+http.statusText+"("+http.status+")");
}
}
console.log("Analytics prepped: "+url+"?"+params);
console.log(http.toString());
http.send(params);
console.log("Analytics sent ");
}
function appstart( )
{
//if( propertyID === undefined || clientID === undefined || appName === undefined )
if(!isInitialized())
return FALSE;
/*if(appVersion === undefined)
appVersion = "0.1a";
/*var params = "v=1" +
"&tid=" + propertyID +
"&cid=" + clientID +
"&t=screenview" +
"&an=" + appName +
"&av=" + appVersion + */
var params = "&sc=start";
callGoogleAnalytics( params );
}
function appstop( )
{
//if( propertyID === undefined || clientID === undefined || appName === undefined )
if(!isInitialized())
return FALSE;
/*if(appVersion === undefined)
appVersion = "0.1a";
/*var params = "v=1" +
"&tid=" + propertyID +
"&cid=" + clientID +
"&t=screenview" +
"&an=" + appName +
"&av=" + appVersion + */
var params = "&sc=end";
callGoogleAnalytics( params );
}
function screenview( screenName, other)
{
//if( propertyID === undefined || clientID === undefined || appName === undefined )
if(!isInitialized())
return FALSE;
/*if(appVersion === undefined)
appVersion = "0.1a";
/*var params = "v=1" +
"&tid=" + propertyID +
"&cid=" + clientID +
"&t=screenview" +
"&an=" + appName +
"&av=" + appVersion;*/
var params = "&t=screenview" // Type
if(screenName != undefined)
params = params + "&cd="+screenName;
// if(appotherID != undefined)
// params = params + "&"+other;
// if(appotherID != undefined)
// params = params + "&"+other;
callGoogleAnalytics( params );
}
function callGoogleAnalytics( params )
{
var http = new XMLHttpRequest(); // This is used for sending our call
var url = "https://ssl.google-analytics.com/collect"; // Destination URL
params = "v=1" + // API Version
"&tid=" + propertyID + // Analytics code
"&cid=" + clientID + // Unique ID (Device/User)
//"&t=screenview" + // Type
"&an=" + appName + // Application Name
"&av=" + appVersion + params; // Application Version and rest of Parameters
if(appID != undefined)
params = params + "&aid="+appID;
if(deviceScreen != undefined)
params = params + "&sr="+deviceScreen;
http.open("POST", url, true); // Use POST for more efficient transmission, per Google
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //
http.setRequestHeader("Content-length", params.length); //
http.setRequestHeader("Connection", "close"); //
http.onreadystatechange = function() // Call function when the state changes.
{
if(http.readyState == 4 && http.status == 200) // If success
{
console.log("Analytics replied: state="+http.readyState+" - status="+http.statusText+"("+http.status+")");
}
}
console.log("Analytics prepped: "+url+"?"+params); // Log the call (in GET format) for debuggin'
http.send(params); // Make the call
console.log("Analytics sent "); // Debug
}
function isInitialized()
{
return !(propertyID === undefined || clientID === undefined || appName === undefined);
}
+1 -1
View File
@@ -29,7 +29,7 @@
*/
import QtQuick 2.0
import QtGraphicalEffects 1.0
//import QtGraphicalEffects 1.0
import Sailfish.Silica 1.0
import QtQml 2.0
Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

-249
View File
@@ -1,249 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import threading
from threading import Thread
import time
usleep = lambda x: time.sleep(x/1000000.0)
import colorsys
import random
import lifx3
import lifx3.lifx
BulbList = dict()
BulbListSelected = dict()
# Example how to fill a list model with data from Python.
def get_data():
lights = lifx3.lifx.get_lights()
data = []
for bulb in lights:
data.append({'bulb_name': bulb.get_addr(), 'bulb_addr': bulb.get_addr()})
return data
return [
{'name': 'Alpha', 'team': 'red'},
{'name': 'Beta', 'team': 'blue'},
{'name': 'Gamma', 'team': 'green'},
{'name': 'Delta', 'team': 'yellow'},
{'name': 'Epsilon', 'team': 'orange'},
]
def get_bulbs(discovery = False):
if( (len(BulbList) < 1) or (discovery) ):
print("Getting bulbs from network")
lights = lifx3.lifx.get_lights()
else:
print("Getting bulbs from memory")
lights = BulbList.values()
data = []
for bulb in lights:
#bulb.get_label()
data.append({'bulb_name': bulb.bulb_label, 'bulb_addr': bulb.get_addr()})
#data.append({'name': bulb.bulb_label, 'addr': bulb.addr})
BulbList[bulb.get_addr()] = bulb
return data
# def recv_lightstatus(self, lightstatus):
# self.addr = lightstatus.target
# self.hue = lightstatus.payload.data['hue']
# self.saturation = lightstatus.payload.data['saturation']
# self.brightness = lightstatus.payload.data['brightness']
# self.kelvin = lightstatus.payload.data['kelvin']
# self.dim = lightstatus.payload.data['dim']
# if lightstatus.payload.data['power'] > 0:
# self.power = True
# else:
# self.power = False
# self.bulb_label = str(lightstatus.payload.data['bulb_label'],
# encoding='utf-8').strip('\00')
# self.tags = lightstatus.payload.data['tags']
def get_bulb(addr):
if( len(BulbList) < 1):
get_bulbs()
bulb = BulbList[addr]
data = {}
data['bulb_name'] = bulb.bulb_label
data['bulb_addr'] = addr #bulb.addr
data['bulb_power'] = bulb.power
data['bulb_hue'] = bulb.hue
data['bulb_saturation'] = bulb.saturation
data['bulb_brightness'] = bulb.brightness
data['bulb_kelvin'] = bulb.kelvin
data['bulb_tags'] = bulb.tags
data['bulb_selected'] = addr in BulbListSelected
return data
def set_active(addr):
if( addr in BulbList):
if( addr not in BulbListSelected):
BulbListSelected[addr] = BulbList[addr]
def set_inactive(addr):
if( addr in BulbListSelected):
del BulbListSelected[addr]
def get_selected_count():
return len(BulbListSelected)
def turn_on_all():
for addr in BulbListSelected:
#BulbListSelected[addr].set_power(1)
lifx3.lifx.set_power(addr, 1)
lifx3.lifx.pause(0.2)
def turn_off_all():
for addr in BulbListSelected:
#BulbListSelected[addr].set_power(0)
lifx3.lifx.set_power(addr, 0)
lifx3.lifx.pause(0.2)
def set_power(addr, power):
lifx3.lifx.set_power(addr, power)
lifx3.lifx.pause(0.2)
return 1
def set_color_rgbhex(colorstring):
rh = colorstring[1:3]
gh = colorstring[3:5]
bh = colorstring[5:7]
print( rh + " - " + gh + " - " + bh)
r = int(rh, 16)
g = int(gh, 16)
b = int(bh, 16)
print( str(r) + " - " + str(g) + " - " + str(b))
hls = colorsys.rgb_to_hls( r , g, b )
hsv = colorsys.rgb_to_hsv( r , g, b )
for addr in BulbListSelected:
#set_color(self, hue, saturation, brightness, kelvin, fade_time):
BulbListSelected[addr].hue = int(hsv[0]*65535)
BulbListSelected[addr].saturation = int(hsv[1]*65535)
#BulbListSelected[addr].brightness = int(hsv[2]*65535/255)
#BulbListSelected[addr].set_color( int(hsv[0]*65535), int(hsv[1]*65535), int(hsv[2]*65535/255), 3500, 1000)
set_color()
def set_brightness(brightness):
for addr in BulbListSelected:
#set_color(self, hue, saturation, brightness, kelvin, fade_time):
#BulbListSelected[addr].get_state()
BulbListSelected[addr].brightness = int(brightness*65535/100)
#BulbListSelected[addr].set_color( BulbListSelected[addr].hue, BulbListSelected[addr].saturation, int(brightness*65535/100), BulbListSelected[addr].kelvin, 100)
set_color()
def set_saturation(saturation):
for addr in BulbListSelected:
BulbListSelected[addr].saturation = int(saturation*65535/100)
#BulbListSelected[addr].set_color( BulbListSelected[addr].hue, int(saturation*65535/100), BulbListSelected[addr].brightness, BulbListSelected[addr].kelvin, 100)
set_color()
def set_kelvin(kelvin):
for addr in BulbListSelected:
BulbListSelected[addr].kelvin = int((kelvin* (8000-2700))/100)+2700
BulbListSelected[addr].saturation = 0
#BulbListSelected[addr].set_color( BulbListSelected[addr].hue, int(saturation*65535/100), BulbListSelected[addr].brightness, BulbListSelected[addr].kelvin, 100)
set_color()
def set_color():
for addr in BulbListSelected:
#BulbListSelected[addr].set_color( BulbListSelected[addr].hue, BulbListSelected[addr].saturation, BulbListSelected[addr].brightness, BulbListSelected[addr].kelvin, 300)
lifx3.lifx.set_color(addr, BulbListSelected[addr].hue, BulbListSelected[addr].saturation, BulbListSelected[addr].brightness, BulbListSelected[addr].kelvin, 500)
lifx3.lifx.pause(0.01) #0.2
#def set_color_rgb(red, green, blue):
# hue = 0
# saturation = 0
# brightness = 0
#
# min = min( red, green, blue )
# max = max( red, green, blue )
# brightness = max # v
#
# delta = max - min
#
# if( max == 0 ):
# saturation = 0
# hue = 0 //-1;
# return;
# else:
# saturation = delta / max # s
#
# if( red == max ):
# hue = ( green - blue ) / delta # between yellow & magenta
# elif( green == max ):
# hue = 2 + ( blue - red ) / delta # between cyan & yellow
# else:
# hue = 4 + ( red - green ) / delta # between magenta & cyan
#
# hue *= 60 # degrees
# if( hue < 0 ):
# hue += 360
killThreads = False #Master-switch, in case need to kill all threads
#threadPartyRun = False #Indicate whether to let Party-Thread run
def pythonShutdown():
party_stop()
killThreads = False #Kill all threads
#threadPartyRun = False #Indicate whether to let Party-Thread run
#def thread_party_func():
# sys.stderr.write('party thread launched')
# print( "threadPartyRun: "+str(threadPartyRun))
# print( "killThreads: "+str(killThreads))
# while( (not killThreads) and (threadPartyRun) ): #Loop
# for addr in BulbListSelected: #Loop through all bulbs
# #set_color(self, hue, saturation, brightness, kelvin, fade_time):
# #BulbListSelected[addr].set_color( random.randint(1, 65534), 65535, BulbListSelected[addr].brightness, 3500, 400)
# BulbListSelected[addr].set_color( random.randint(1, 65534), 65535, random.randint(1, 65534), 3500, 400) #Randomize hue and brightness
# usleep(100) #sleep during 100ms
# sys.stderr.write('party thread stopping')
#
#def party_start():
# partythread = threading.Thread(target=thread_party_func)
# threadPartyRun = True #This is by no means proper - use semaphores
# print( "threadPartyRun: "+str(threadPartyRun))
# print( "killThreads: "+str(killThreads))
# partythread.start() #Start the party
#
#def party_stop():
# threadPartyRun = False #This is by no means proper - use semaphores
# partythread.join() #Wait and merge
class PartyThread(Thread):
def __init__(self):
Thread.__init__(self)
#killThreads = False #Master-switch, in case need to kill all threads
threadPartyRun = False #Indicate whether to let Party-Thread run
def run(self):
sys.stderr.write('party thread launched')
#print( "C:self.threadPartyRun: "+str(self.threadPartyRun))
#print( "C:killThreads: "+str(killThreads))
while( (not killThreads) and (self.threadPartyRun) ): #Loop
#print( "C:loooop ")
for addr in BulbListSelected: #Loop through all bulbs
hue = random.randint(1, 65534) #Randomize hue
brightness = (random.randint(0, 1)) * 65534 #Randomize brightness
#set_color(self, hue, saturation, brightness, kelvin, fade_time):
#BulbListSelected[addr].set_color( hue, 65535, brightness, 3500, 400)
lifx3.lifx.set_color(addr, hue, 65535, brightness, 3500, 400)
usleep(100) #sleep during 100ms
lifx3.lifx.pause(0.01)
#sys.stderr.write('party thread stopping')
partythread = PartyThread()
def party_start():
partythread.threadPartyRun = True #This is by no means proper - use semaphores
#print( "G:partythread.threadPartyRun: "+str(partythread.threadPartyRun))
#print( "G:killThreads: "+str(killThreads))
partythread.start() #Start the party
def party_stop():
partythread.threadPartyRun = False #This is by no means proper - use semaphores
partythread.join() #Wait and merge
#partythread = PartyThread()
+116 -110
View File
@@ -9,127 +9,133 @@ import Sailfish.Silica 1.0
Page
{
id: page
property string bulbAddress
id: page
property string bulbAddress
// To enable PullDownMenu, place our content in a SilicaFlickable
SilicaFlickable
{
anchors.fill: parent
// To enable PullDownMenu, place our content in a SilicaFlickable
SilicaFlickable
{
anchors.fill: parent
// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
PullDownMenu
{
id: pullDownMenu
MenuItem
{
text: qsTr("Dummy Item")
//onClicked: pageStack.push(Qt.resolvedUrl("SecondPage.qml"))
}
}
PushUpMenu
{
id: pushUpMenu
MenuItem
{
text: qsTr("Dummy Item")
//onClicked: pageStack.push(Qt.resolvedUrl("SecondPage.qml"))
}
}
// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
PullDownMenu
{
id: pullDownMenu
MenuItem
{
text: qsTr("Dummy Item")
//onClicked: pageStack.push(Qt.resolvedUrl("SecondPage.qml"))
}
}
PushUpMenu
{
id: pushUpMenu
MenuItem
{
text: qsTr("Dummy Item")
//onClicked: pageStack.push(Qt.resolvedUrl("SecondPage.qml"))
}
}
// Tell SilicaFlickable the height of its content.
contentHeight: column.height
// Tell SilicaFlickable the height of its content.
contentHeight: column.height
// Place our content in a Column. The PageHeader is always placed at the top
// of the page, followed by our content.
Column {
id: column
// Place our content in a Column. The PageHeader is always placed at the top
// of the page, followed by our content.
Column {
id: column
width: page.width
spacing: Theme.paddingLarge
anchors.fill: parent
PageHeader {
title: qsTr("LightFish")
}
Item
{
id: iconItem
width: parent.width / 2 //* 0.8//ListView.view.width
height: Theme.itemSizeSmall
width: page.width
spacing: Theme.paddingLarge
anchors.fill: parent
PageHeader {
title: qsTr("LightFish")
}
Item
{
id: iconItem
width: parent.width / 2 //* 0.8//ListView.view.width
height: Theme.itemSizeSmall
Image
{
id: icon
anchors.horizontalCenter: parent.horizontalCenter
source: "../images/logo_lifx_grey_gaussian.png"
sourceSize: Qt.size(parent.width*0.9, parent.height*0.9)
smooth: true
visible: true//false
}
Image
{
id: icon
anchors.horizontalCenter: parent.horizontalCenter
source: "../images/logo_lifx_grey_gaussian.png"
sourceSize: Qt.size(parent.width*0.9, parent.height*0.9)
smooth: true
visible: true//false
}
Colorize
{
id: iconColotize
//hue/65535, saturation/65535, brightness/65535
anchors.fill: icon
source: icon
//hue: bulb_hue/65535
//saturation: bulb_saturation/65535
//lightness: bulb_power ? (bulb_brightness*2/65535) -1 : -1
}
}
Label
{
x: Theme.paddingLarge
text: qsTr("Just some random text being shown here until I figure out what to actually put into this place")
color: Theme.secondaryHighlightColor
font.pixelSize: Theme.fontSizeLarge
}
TextField
{
id: textBulbName
text: qsTr("Please Wait")
enabled: false
}
Colorize
{
id: iconColotize
//hue/65535, saturation/65535, brightness/65535
anchors.fill: icon
source: icon
//hue: bulb_hue/65535
//saturation: bulb_saturation/65535
//lightness: bulb_power ? (bulb_brightness*2/65535) -1 : -1
}
}
Label
{
x: Theme.paddingLarge
text: qsTr("Just some random text being shown here until I figure out what to actually put into this place")
color: Theme.secondaryHighlightColor
font.pixelSize: Theme.fontSizeLarge
}
TextField
{
id: textBulbName
text: qsTr("Please Wait")
enabled: false
}
Rectangle
{
width: 60
height: width
color: "red"
border.color: "black"
border.width: 1
radius: width*0.5
Text
{
//anchor.fill : parent
color: "red"
text: "Boom"
}
}
}
}
Component.onCompleted:
{
lifxBulbGetObject( bulbAddress, page );
}
Rectangle
{
width: 60
height: width
color: "red"
border.color: "black"
border.width: 1
radius: width*0.5
Text
{
//anchor.fill : parent
color: "red"
text: "Boom"
}
}
}
}
Component.onCompleted:
{
BulbListPage("BulbDetails");
lifxBulbGetObject( bulbAddress, page );
}
onStatusChanged:
{
if (status == PageStatus.Active )
{
callScreenView("BulbListPage");
}
}
/* data['bulb_name'] = bulb.bulb_label
data['bulb_addr'] = bulb.addr
data['bulb_hue'] = bulb.hue
data['bulb_saturation'] = bulb.saturation
data['bulb_brightness'] = bulb.brightness
data['bulb_kelvin'] = bulb.kelvin
data['bulb_tags'] = bulb.tags
data['bulb_addr'] = bulb.addr
data['bulb_hue'] = bulb.hue
data['bulb_saturation'] = bulb.saturation
data['bulb_brightness'] = bulb.brightness
data['bulb_kelvin'] = bulb.kelvin
data['bulb_tags'] = bulb.tags
*/ function setBulb(light)
{
console.log("BulbDetails::setBulb ("+light.bulb_name+"@"+light.bulb_addr+")")
{
console.log("BulbDetails::setBulb ("+light.bulb_name+"@"+light.bulb_addr+")")
textBulbName.enabled = true;
textBulbName.text = light.bulb_name;
iconColotize.hue= light.bulb_hue/65535;
}
textBulbName.enabled = true;
textBulbName.text = light.bulb_name;
iconColotize.hue= light.bulb_hue/65535;
}
}
+56 -87
View File
@@ -1,112 +1,81 @@
import QtQuick 2.0
import io.thp.pyotherside 1.0
//import io.thp.pyotherside 1.0
//import "../analytics.js" as Analytics
import Sailfish.Silica 1.0
Page
{
id: page
//property Python py
//property variant lights
SilicaListView
{
id: listView
anchors.fill: parent
model: ListModel
{
id: listModel
}
//model: ListModel {id: listModel;}
model: lightsModel
header: PageHeader
{
title: qsTr("Choose Lightbulbs")
}
// delegate: BackgroundItem
delegate: ListItem
{
delegate: ListItem
{
id: delegate
property Item contextMenu
property Item contextMenu
property bool menuOpen: contextMenu != null && contextMenu.parent === delegate
width: ListView.view.width
height: menuOpen ? contextMenu.height + contentItem.height : contentItem.height
//menu: bulbContextMenuComponent
property bool menuOpen: contextMenu != null && contextMenu.parent === delegate
width: ListView.view.width
height: menuOpen ? contextMenu.height + contentItem.height : contentItem.height
//Label
TextSwitch
TextSwitch
{
x: Theme.paddingLarge
text: bulb_name + " (@" +bulb_addr+ ")"
x: Theme.paddingLarge
text: label
//text: "Item " + index
anchors.verticalCenter: parent.verticalCenter
//color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor
//text: "Active"
description: ""
onCheckedChanged:
{
if(checked)
{
lifxBulbSelect(bulb_addr)
}
else
{
lifxBulbDeSelect(bulb_addr)
}
}
onPressAndHold:
{
if (!contextMenu)
contextMenu = bulbContextMenuComponent.createObject(listView)
contextMenu.show(delegate)
}
anchors.verticalCenter: parent.verticalCenter
description: ""
checked: selected
onCheckedChanged:
{
selected = checked
}
onPressAndHold:
{
if (!contextMenu)
contextMenu = bulbContextMenuComponent.createObject(listView)
contextMenu.show(delegate)
}
}
Component
{
id: bulbContextMenuComponent
ContextMenu
{
MenuItem
{
text: "Rename"
onClicked: pageStack.push(Qt.resolvedUrl("BulbDetails.qml"), { bulbAddress: bulb_addr})
}
MenuItem
{
text: "Power-toggle"
onClicked: {}
}
}
}
}
}
Component.onCompleted:
{
lifxGetBulbs( page );
/* py.call('lightfish.get_bulbs', [], function(result)
{
console.log('lightfish rechewing');
// Load the received data into the list model
for (var i=0; i<result.length; i++) {
console.log('lightfish# @ '+result[i]['name']);
listModel.append(result[i]);
//listView.append(result[i]);
}
console.log('lightfish redone');
});*/
Component
{
id: bulbContextMenuComponent
ContextMenu
{
MenuItem
{
text: "Rename"
// onClicked: pageStack.push(Qt.resolvedUrl("BulbDetails.qml"), { bulbAddress: bulb_addr})
}
MenuItem
{
text: "Power-toggle"
onClicked: { power = !power; }
}
}
}
}
}
function setLights(lights)
{
for (var i=0; i<lights.length; i++) {
console.log('lightfish# @ '+lights[i]['bulb_name']);
listModel.append(lights[i]);
//listView.append(result[i]);
}
}
onStatusChanged:
{
if (status == PageStatus.Active )
{
callScreenView("BulbListPage");
}
}
}
+235 -221
View File
@@ -30,89 +30,83 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import io.thp.pyotherside 1.0
//import io.thp.pyotherside 1.0
Page
{
id: page
//property Python py
property bool isColor : true
property bool isPartyMode : false
id: page
//property Python py
property bool isColor : true
property bool isPartyMode : false
// To enable PullDownMenu, place our content in a SilicaFlickable
SilicaFlickable
{
anchors.fill: parent
// To enable PullDownMenu, place our content in a SilicaFlickable
SilicaFlickable
{
anchors.fill: parent
// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
PullDownMenu
{
id: pushDownFirst
MenuItem
{
text: qsTr("Select groups")
onClicked: pageStack.push(Qt.resolvedUrl("SecondPage.qml"))
}
MenuItem
{
text: qsTr("Select bulbs")
onClicked: pageStack.push(Qt.resolvedUrl("BulbListPage.qml"), { /*py: py*/})
//onClicked: pageStack.push(bulbListPage)
//BulbListPage { id: bulbListPage }
}
}
PushUpMenu
{
id: pushUpFirst
MenuItem
{
text: isColor ? qsTr("White Mode") : qsTr("Colour Mode")
onClicked:
{
isColor = !isColor
console.log('lightfish swapping colour/white');
colorButton.enabled = isColor
sliderSaturation.label = isColor ? "Whiteness" : "Temperature (K)"
}
}
MenuItem
{
id: pushUpPartyMode
property bool isPartyMode: false
text: isPartyMode ? qsTr("Normal Mode") : qsTr("Party Mode")
onClicked:
{
if(pushUpPartyMode.isPartyMode)
{
console.log('lightfish removing fancy');
py.call('lightfish.party_stop', [], function(result)
{
console.log('lightfish non-party');
pushUpPartyMode.isPartyMode = false;
pushUpPartyMode.text = isPartyMode ? qsTr("Normal Mode") : qsTr("Party Mode");
});
}
else
{
remorse.execute("Starting Party mode", function()
{
console.log('lightfish getting fancy');
py.call('lightfish.party_start', [], function(result)
{
console.log('lightfish party');
pushUpPartyMode.isPartyMode = true;
pushUpPartyMode.text = isPartyMode ? qsTr("Normal Mode") : qsTr("Party Mode");
});
});
}
}
}
}
RemorsePopup { id: remorse }
// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
/*PullDownMenu
{
id: pushDownFirst
MenuItem
{
text: qsTr("Select groups")
onClicked: pageStack.push(Qt.resolvedUrl("SecondPage.qml"))
}
MenuItem
{
text: qsTr("Select bulbs")
onClicked: pageStack.push(Qt.resolvedUrl("BulbListPage.qml"), { /*py: py* /})
//onClicked: pageStack.push(bulbListPage)
//BulbListPage { id: bulbListPage }
}
}*/
PushUpMenu
{
id: pushUpFirst
MenuItem
{
text: isColor ? qsTr("White Mode") : qsTr("Colour Mode")
onClicked:
{
isColor = !isColor
console.log('lightfish swapping colour/white');
colorButton.enabled = isColor
sliderSaturation.label = isColor ? "Whiteness" : "Temperature (K)"
}
}
MenuItem
{
id: pushUpPartyMode
property bool isPartyMode: false
text: isPartyMode ? qsTr("Normal Mode") : qsTr("Party Mode")
onClicked:
{
if(isPartyMode)
{
pushUpPartyMode.isPartyMode = !isPartyMode;
pushUpPartyMode.text = isPartyMode ? qsTr("Normal Mode") : qsTr("Party Mode");
partyTimer.running = isPartyMode;
}
else
{
remorse.execute("Starting Party mode", function()
{
pushUpPartyMode.isPartyMode = !isPartyMode;
pushUpPartyMode.text = isPartyMode ? qsTr("Normal Mode") : qsTr("Party Mode");
partyTimer.running = isPartyMode;
});
}
}
}
}
RemorsePopup { id: remorse }
// Tell SilicaFlickable the height of its content.
contentHeight: column.height
contentHeight: column.height
// Place our content in a Column. The PageHeader is always placed at the top
// of the page, followed by our content.
@@ -121,159 +115,179 @@ Page
width: page.width
spacing: Theme.paddingLarge
//anchors.verticalCenter: parent.verticalCenter
//anchors.centerIn: parent
anchors.fill: parent
PageHeader {
title: qsTr("LightFish")
}
Label
{
//anchors.verticalCenter: parent.verticalCenter
//anchors.centerIn: parent
anchors.fill: parent
PageHeader {
title: qsTr("LightFish")
}
Label
{
x: Theme.paddingLarge
text: qsTr("Just some random text being shown here until I figure out what to actually put into this place")
//text: qsTr("Just some random text being shown here until I figure out what to actually put into this place")
color: Theme.secondaryHighlightColor
font.pixelSize: Theme.fontSizeExtraLarge
}
Slider
{
id: sliderBrightness
property int brightness
//label: "Brightness"
//anchors.top: colorButton.bottom
value: 50
minimumValue: 000
maximumValue: 100
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
valueText : Math.round(value) + "%"
onSliderValueChanged:
{
if(brightness < value-2 || brightness > value+2)
{
brightness = Math.round(value)
lifxBulbsSelectedBrightness(brightness);
}
//lifxBulbsSelectedBrightness(Math.round(value));
}
label: "Brightness"
}
Slider
{
id: sliderSaturation
property int saturation
//label: "Brightness"
//anchors.top: colorButton.bottom
value: 50
minimumValue: 000
maximumValue: 100
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
valueText : isColor ? Math.round(value) + "%" : Math.round( (value * (8000-2700)) / 100 )+2700 //2700-8000K
onSliderValueChanged:
{
var adjValue = isColor ? 100-value : value
if(saturation < adjValue-2 || saturation > adjValue+2)
{
saturation = Math.round(adjValue)
if( isColor )
lifxBulbsSelectedSaturation(saturation);
else
lifxBulbsSelectedKelvin(saturation);
}
}
label: isColor ? "Whiteness" : "Temperature (K)"
}
Row
{
id: lightPowerRow
anchors.horizontalCenter: parent.horizontalCenter
Button
{
id: onButton
text: "Turn On"
onClicked:
{
lifxBulbsSelectedOn();
offButton.enabled = true;
}
}
Button
{
id: offButton
text: "Turn Off"
onClicked:
{
lifxBulbsSelectedOff();
onButton.enabled = true;
}
}
}
Button
{
id: colorButton
text: "Choose a color"
anchors.horizontalCenter: parent.horizontalCenter
Slider
{
id: sliderBrightness
property int brightness
//label: "Brightness"
//anchors.top: colorButton.bottom
value: 50
minimumValue: 000
maximumValue: 100
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
valueText : Math.round(value) + "%"
onSliderValueChanged:
{
if(brightness < value-2 || brightness > value+2) //filter small changes
{
brightness = value //Math.round(value)
lifxBulbsSelectedBrightness(brightness);
}
//lifxBulbsSelectedBrightness(Math.round(value));
}
label: "Brightness"
}
Slider
{
id: sliderSaturation
property int saturation
//label: "Brightness"
//anchors.top: colorButton.bottom
value: 50
minimumValue: 000
maximumValue: 100
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
valueText : isColor ? Math.round(value) + "%" : Math.round( (value * (8000-2700)) / 100 )+2700 //2700-8000K
onSliderValueChanged:
{
var adjValue = isColor ? 100-value : value
if(saturation < adjValue-2 || saturation > adjValue+2) //filter small changes
{
saturation = Math.round(adjValue)
if( isColor )
lifxBulbsSelectedSaturation(saturation);
else
lifxBulbsSelectedKelvin(saturation);
}
}
label: isColor ? "Whiteness" : "Temperature (K)"
}
Row
{
id: lightPowerRow
anchors.horizontalCenter: parent.horizontalCenter
Button
{
id: onButton
text: "Turn On"
onClicked:
{
lifxBulbsSelectedOn();
offButton.enabled = true;
}
}
Button
{
id: offButton
text: "Turn Off"
onClicked:
{
lifxBulbsSelectedOff();
onButton.enabled = true;
}
}
}
Button
{
id: colorButton
text: "Choose a color"
anchors.horizontalCenter: parent.horizontalCenter
onClicked:
{
var dialog = pageStack.push("Sailfish.Silica.ColorPickerDialog")
dialog.accepted.connect(function()
{
//colorIndicator.color = dialog.color
colorButton.text = "Choose a color (" + dialog.color+")";
py.call('lightfish.set_color_rgbhex', [""+dialog.color], function(result)
{
console.log('lightfish getting colour');
});
pushDownFirst.highlightColor = dialog.color;
pushUpFirst.highlightColor = dialog.color;
lifxGetBulbs( page );
})
}
}
}
onClicked:
{
var dialog = pageStack.push("Sailfish.Silica.ColorPickerDialog")
dialog.accepted.connect(function()
{
//colorIndicator.color = dialog.color
colorButton.text = "Choose a color (" + dialog.color+")";
lifxBulbsSelectedColor(dialog.color);
//pushDownFirst.highlightColor = dialog.color;
pushUpFirst.highlightColor = dialog.color;
lifxGetBulbs( page );
})
}
}
}
}
onStatusChanged:
{
var cntSelectedBulbs = lifxBulbsSelectedCount();
if (status == PageStatus.Active && cntSelectedBulbs == 0)
{
pageStack.push(Qt.resolvedUrl("BulbListPage.qml"), { /*py: py*/})
}
if (status == PageStatus.Active && cntSelectedBulbs > 0)
{
lifxGetBulbs( page );
}
}
function setLights(lights)
{
var cntSelectedBulbs = lights.length;
var newBrightness = 0;
var newHue = 0;
var newSaturation = 0;
var hasPowerOn = false;
var hasPowerOff = false
for (var i=0; i<lights.length; i++)
{
var light = lifxBulbGetObject_sync(lights[i]['bulb_addr']);
newBrightness += light.bulb_brightness;
newHue += light.bulb_hue;
newSaturation += light.bulb_saturation;
hasPowerOn = light.bulb_power > 0 ? true : hasPowerOn;
hasPowerOff = light.bulb_power == 0 ? false : hasPowerOff;
}
newBrightness = newBrightness/cntSelectedBulbs;
newHue = newHue/cntSelectedBulbs;
newSaturation = newSaturation/cntSelectedBulbs;
if(hasPowerOn)
offButton.enabled = true;
if(hasPowerOff)
onButton.enabled = true;
sliderBrightness.value = 100/65535 * newBrightness;
if(isColor)
sliderSaturation.value = 100- (100/65535 * newSaturation);
}
onStatusChanged:
{
var cntSelectedBulbs = lifxBulbsSelectedCount();
if (status == PageStatus.Active && cntSelectedBulbs == 0)
{
pageStack.push(Qt.resolvedUrl("BulbListPage.qml"), { /*py: py*/})
}
if (status == PageStatus.Active && cntSelectedBulbs > 0)
{
lifxGetBulbs( page );
pageStack.pushAttached(Qt.resolvedUrl("BulbListPage.qml"), { /*py: py*/})
callScreenView("FirstPage");
}
}
function setLights(lights)
{
var cntSelectedBulbs = 0;//lights.length;
var newBrightness = 0;
var newHue = 0;
var newSaturation = 0;
var hasPowerOn = false;
var hasPowerOff = false
var n = 0;
var lightsCount = lightsModel.rowCount()
for( ; n<lightsCount; n++)
{
if( lightsModel.isSelectedLight(n))
{
var light = lightsModel.getLight(n);
newBrightness += light.brightness;
//newHue += light.bulb_hue;
newSaturation += light.saturation;
hasPowerOn = light.power > 0 ? true : hasPowerOn;
hasPowerOff = light.power == 0 ? false : hasPowerOff;
cntSelectedBulbs++;
}
}
/* for (var i=0; i<lights.length; i++)
{
var light = lifxBulbGetObject_sync(lights[i]['bulb_addr']);
newBrightness += light.bulb_brightness;
newHue += light.bulb_hue;
newSaturation += light.bulb_saturation;
hasPowerOn = light.bulb_power > 0 ? true : hasPowerOn;
hasPowerOff = light.bulb_power == 0 ? false : hasPowerOff;
}*/
newBrightness = newBrightness/cntSelectedBulbs;
newHue = newHue/cntSelectedBulbs;
newSaturation = newSaturation/cntSelectedBulbs;
if(hasPowerOn)
offButton.enabled = true;
if(hasPowerOff)
onButton.enabled = true;
sliderBrightness.value = 100/65535 * newBrightness;
if(isColor)
sliderSaturation.value = 100- (100/65535 * newSaturation);
}
}
+92
View File
@@ -0,0 +1,92 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
//import io.thp.pyotherside 1.0
//import "../analytics.js" as Analytics
Page
{
id: page
property string bulbAddress
// To enable PullDownMenu, place our content in a SilicaFlickable
SilicaFlickable
{
anchors.fill: parent
// Tell SilicaFlickable the height of its content.
contentHeight: column.height
Image
{
id: backdrop
//source: "image://LIFX_Bulb_bg.jpg"
source: "../images/LIFX_Bulb_bg.png"
sourceSize { width: parent.width; height: parent.height }
fillMode: Image.PreserveAspectFit
smooth: true
}
Label
{
id: labelScanning
//x: Theme.paddingLarge
//y: 780 / (Math.min( backdrop.paintedWidth/backdrop.width, backdrop.paintedHeight/backdrop.height))
y: 780 / (Math.min( 780 / backdrop.width, 1920 / backdrop.height )) - 60
text: qsTr("Scanning...")
color: "black" // Theme.secondaryHighlightColor
font.pixelSize: Theme.fontSizeLarge
anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter
}
Button
{
id: buttonBuy
//x: Theme.paddingLarge
//y: 780 / (Math.min( backdrop.paintedWidth/backdrop.width, backdrop.paintedHeight/backdrop.height))
//anchors.top: labelScanning.bottom
y: page.height - buttonBuy.height
text: qsTr("Get LIFX bulbs!")
color: "black" // Theme.secondaryHighlightColor
//font.pixelSize: Theme.fontSizeLarge
//anchors.left: parent.left
//anchors.right: parent.right
//width: parent.width * 0.8
width: 500
anchors.horizontalCenter: parent.horizontalCenter
onClicked: Qt.openUrlExternally('http://lifx.co/')
}
// Place our content in a Column. The PageHeader is always placed at the top
// of the page, followed by our content.
Column
{
id: column
width: page.width
spacing: Theme.paddingLarge
anchors.fill: parent
PageHeader {
title: qsTr("LightFish")
}
}
}
Component.onCompleted:
{
callScreenView("BulbListPage");
}
onStatusChanged:
{
if (status == PageStatus.Active )
{
//callScreenView("BulbListPage");
discoveryClient.discover();
discoveryClient.startDiscoveryTimer(5000);
}
}
}
+2 -1
View File
@@ -1,8 +1,9 @@
.import QtQuick.LocalStorage 2.0 as Sql
//storage.js
// First, let's create a short helper function to get the database connection
function getDatabase(appname, dbver)
{
return openDatabaseSync(appname, dbver, "StorageDatabase", 100000);
return Sql.LocalStorage.openDatabaseSync(appname, dbver, "StorageDatabase", 100000);
}
// At the start of the application, we can initialize the tables we need if they haven't been created yet
+3 -4
View File
@@ -13,7 +13,7 @@ Name: LightFish
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: LighFish - UNofficial LIFX for Sailfish
Version: 0.1
Version: 0.2
Release: 1
Group: Qt/Qt
License: LICENSE
@@ -21,7 +21,6 @@ URL: http://lightfish.thang.dk
Source0: %{name}-%{version}.tar.bz2
Source100: LightFish.yaml
Requires: sailfishsilica-qt5 >= 0.10.9
Requires: pyotherside-qml-plugin-python3-qt5
BuildRequires: pkgconfig(sailfishapp) >= 1.0.2
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Qml)
@@ -30,7 +29,7 @@ BuildRequires: desktop-file-utils
%description
LIFX app (UNofficial) for Jolla - Control your lightbulbs from your Jolla phone.
Note: If you do no have any LIFX lightbulbs, this app is not for you (yet). Go buy some: http://mbsy.co/lifx/4479285
Note: If you do no have any LIFX lightbulbs, this app is not for you (yet). Go buy some: http://lifx.co
%prep
@@ -70,6 +69,6 @@ desktop-file-install --delete-original \
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/86x86/apps/%{name}.png
#%attr(4755,root,root) qml/perl/iwpriv_helper.pl
%attr(4755,root,root) %{_datadir}/%{name}/qml/perl/iwpriv_helper.pl
# >> files
# << files
+4 -4
View File
@@ -1,6 +1,6 @@
Name: LightFish
Summary: LighFish - UNofficial LIFX for Sailfish
Version: 0.1
Version: 0.2
Release: 1
# The contents of the Group field must be one of the groups listed here:
# http://gitorious.org/meego-developer-tools/spectacle/blobs/master/data/GROUPS
@@ -13,7 +13,7 @@ Sources:
- '%{name}-%{version}.tar.bz2'
Description: |
LIFX app (UNofficial) for Jolla - Control your lightbulbs from your Jolla phone.
Note: If you do no have any LIFX lightbulbs, this app is not for you (yet). Go buy some: http://mbsy.co/lifx/4479285
Note: If you do no have any LIFX lightbulbs, this app is not for you (yet). Go buy some: http://lifx.co
Configure: none
# The qtc5 builder inserts macros to allow QtCreator to have fine
# control over qmake/make execution
@@ -34,7 +34,7 @@ PkgConfigBR:
# Runtime dependencies which are not automatically detected
Requires:
- sailfishsilica-qt5 >= 0.10.9
- pyotherside-qml-plugin-python3-qt5
# - pyotherside-qml-plugin-python3-qt5
# All installed files
Files:
@@ -43,7 +43,7 @@ Files:
- '%{_datadir}/%{name}'
- '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png'
- '%attr(4755,root,root) qml/perl/iwpriv_helper.pl'
- '%attr(4755,root,root) %{_datadir}/%{name}/qml/perl/iwpriv_helper.pl'
# For more information about yaml and what's supported in Sailfish OS
# build system, please see https://wiki.merproject.org/wiki/Spectacle
+32 -2
View File
@@ -34,6 +34,15 @@
#include <sailfishapp.h>
#include <QQmlEngine>
#include <QtQuick/QQuickView>
#include <QGuiApplication>
#include "lifxdiscoveryclient.h"
#include "lifxgatewayclient.h"
#include "lifxlightclient.h"
#include "lifxlightsmodel.h"
int main(int argc, char *argv[])
{
@@ -46,6 +55,27 @@ int main(int argc, char *argv[])
//
// To display the view, call "show()" (will show fullscreen on device).
return SailfishApp::main(argc, argv);
}
// Register library objects
qmlRegisterType<QTIoT::LIFX::LIFXLightClient>("IoTQuick", 1, 0, "LIFXLightClient");
qmlRegisterType<QTIoT::LIFX::LIFXGatewayClient>("IoTQuick", 1, 0, "LIFXGatewayClient");
qmlRegisterType<QTIoT::LIFX::LIFXDiscoveryClient>("IoTQuick", 1, 0, "LIFXDiscoveryClient" );
// Register library models
qmlRegisterType<LIFXLightsModel>("IoTQuick.LIFXLightsModel", 1, 0, "LIFXLightsModel" );
//Create UniqueID for Analytics.js, even if we only need it on the first run
QGuiApplication *app = SailfishApp::application(argc, argv);
QQuickView *view = SailfishApp::createView();
QQmlContext *rootctxt = view->rootContext();
rootctxt->setContextProperty("quuid", QUuid::createUuid() );
//Load first QML, and show it
view->setSource(SailfishApp::pathTo("qml/LightFish.qml"));
view->show(); //"qml/LightFish.qml"
return app->exec();
//return SailfishApp::main(argc, argv);
}
+182
View File
@@ -0,0 +1,182 @@
#include <iostream>
#include "lifxlightsmodel.h"
LIFXLightsModel::LIFXLightsModel(QObject *parent) :
QAbstractListModel(parent)
{
}
/*bool LIFXLightsModel::insertRow(int row, const QModelIndex & parent = QModelIndex())
{
beginInsertRows( QModelIndex(), 0, 0 ); //notify views and proxy models that a line will be inserted
m_data.prepend( somedata ); // do the modification to the model data
endInsertRows(); //finish insertion, notify views/models
}*/
/*bool LIFXLightsModel::setData(const QModelIndex & index, const QVariant & value, int role /*= Qt::EditRole* /)
{
// Check that the index is valid and within the correct range first:
if (!index.isValid())
return false;
if (index.row() >= m_lightsList.size())
return false;
if (role == Qt::EditRole)
{
// Only returns something for the roles you support (DisplayRole is a minimum)
// Here we assume that the "Employee" class has a "lastName" method but of course any string can be returned
m_lightsList.insert( index.row(), (QTIoT::LIFX::LIFXLightClient) &value);
return true;
}
return false;
}*/
bool LIFXLightsModel::appendLight( QTIoT::LIFX::LIFXLightClient* light, int index)
{
if(index > m_lightsList.size())
return false;
beginInsertRows( QModelIndex(), 0, 0 ); //notify views and proxy models that a line will be inserted
if(index < 0)
m_lightsList.append(light);
else
m_lightsList.insert(index, light);
endInsertRows(); //finish insertion, notify views/models
//emit countChanged();
return true;
}
QTIoT::LIFX::LIFXLightClient* LIFXLightsModel::getLight( int index )
{
std::cout << "index: " << index << " - count: " << m_lightsList.count() << std::endl;
if (index < 0 || index >= m_lightsList.size())
return NULL;// QVariant();
QTIoT::LIFX::LIFXLightClient *light = m_lightsList.at(index);
QByteArray txt_utf8 = light->getLabel().toUtf8();
//std::cout << "returning: " << m_lightsList.at(index)->getLabel().toUtf8().constData() << std::endl;
std::cout << "returning: " << txt_utf8.constData() << "@" << static_cast<void*>(light) << std::endl;
return light;
//return m_lightsList.at(index) ;
}
QVariant LIFXLightsModel::data(const QModelIndex& index, int role) const
{
// Check that the index is valid and within the correct range first:
if (!index.isValid())
return QVariant();
if (index.row() < 0 || index.row() >= m_lightsList.size())
return QVariant();
//if (role == Qt::ObjectRole Qt::ObjectRole)
// return QVariant::fromValue(m_lightsList.at(index.row()));
if (role == Qt::DisplayRole)
{
// Only returns something for the roles you support (DisplayRole is a minimum)
// Here we assume that the "Employee" class has a "lastName" method but of course any string can be returned
// return QVariant( m_lightsList.at(index.row())->getLabel()); // employees_.at(index.row())->lastName());
}
QTIoT::LIFX::LIFXLightClient* light = m_lightsList[index.row()];
switch(role)
{
case (LabelRole): return light->getLabel();
case (ColorRole): return light->getColour();
case (TemperatureRole): return light->getTemperature();
case (BrightnessRole): return light->getBrightness();
case (PowerRole): return light->getPower();
case (TimeRole): return light->getTimeQDateTime();
case (SelectedRole):return m_lightsSelected[index.row()];
}
return QVariant();
}
bool LIFXLightsModel::setData(const QModelIndex & index, const QVariant & value, int role /*= Qt::EditRole*/)
{
// Check that the index is valid and within the correct range first:
if (!index.isValid())
return false;
if (index.row() < 0 || index.row() >= m_lightsList.size())
return false;
//if (role == Qt::ObjectRole Qt::ObjectRole)
// return QVariant::fromValue(m_lightsList.at(index.row()));
if (role == Qt::DisplayRole)
{
// Only returns something for the roles you support (DisplayRole is a minimum)
// Here we assume that the "Employee" class has a "lastName" method but of course any string can be returned
// return QVariant( m_lightsList.at(index.row())->getLabel()); // employees_.at(index.row())->lastName());
}
QTIoT::LIFX::LIFXLightClient* light = m_lightsList[index.row()];
switch(role)
{
case (LabelRole): light->setLabel(value.toString()); return true;
case (ColorRole): light->setColour(value.value<QColor>()); return true;
case (TemperatureRole): light->setTemperature(value.toInt()); return true;
case (BrightnessRole): light->setBrightness(value.toFloat()); return true;
case (SaturationRole): light->setSaturation(value.toFloat()); return true;
case (PowerRole): light->setPower(value.toBool()); return true;
case (TimeRole): light->setTime(value.toDateTime()); return true;
case (SelectedRole): m_lightsSelected[index.row()] = value.toBool(); return true;
}
return false;
}
/*enum LIFXLightsRoles {
LabelRole = Qt::UserRole + 1,
ColorRole,
TemperatureRole,
BrightnessRole,
PowerRole,
TimeRole
};*/
QHash<int, QByteArray> LIFXLightsModel::roleNames() const {
QHash<int, QByteArray> roles;
roles[LabelRole] = "label";
roles[ColorRole] = "color";
roles[TemperatureRole] = "temperature";
roles[BrightnessRole] = "brightness";
roles[SaturationRole] = "saturation";
roles[PowerRole] = "power";
roles[TimeRole] = "time";
//For the UI/UX
roles[SelectedRole] = "selected";
return roles;
}
Qt::ItemFlags LIFXLightsModel::flags(const QModelIndex & /*index*/) const
{
return Qt::ItemIsEnabled;
return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;
}
int LIFXLightsModel::countSelectedLights()
{
int count = 0;
for(int n = 0; n < m_lightsSelected.count(); n++)
{
if(m_lightsSelected[n] == true)
count++;
}
return count;
}
bool LIFXLightsModel::isSelectedLight(int index)
{
if(m_lightsSelected.contains(index))
return m_lightsSelected[index];
return false;
}
+54
View File
@@ -0,0 +1,54 @@
#ifndef LIFXLIGHTSMODEL_H
#define LIFXLIGHTSMODEL_H
#include <QAbstractListModel>
#include <QList>
#include <QMap>
#include "lifxlightclient.h"
class LIFXLightsModel : public QAbstractListModel
{
Q_OBJECT
QList<QTIoT::LIFX::LIFXLightClient*> m_lightsList;
//QList<QPointer> m_lightsList;
QMap<int, bool> m_lightsSelected;
public:
enum LIFXLightsRoles {
LabelRole = Qt::UserRole + 1,
ColorRole,
TemperatureRole,
BrightnessRole,
SaturationRole,
PowerRole,
TimeRole,
//This is purely UI/UX-related
SelectedRole
};
explicit LIFXLightsModel(QObject *parent = 0);
Q_INVOKABLE int rowCount(const QModelIndex & parent = QModelIndex()) const { if(parent.isValid()) {return 0;} return m_lightsList.count();};
//bool insertRow(int row, const QModelIndex & parent = QModelIndex());
//bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
Q_INVOKABLE bool appendLight( QTIoT::LIFX::LIFXLightClient* light, int index = -1);
Q_INVOKABLE QTIoT::LIFX::LIFXLightClient* getLight( int index );
Q_INVOKABLE int countSelectedLights();
Q_INVOKABLE bool isSelectedLight(int index);
QVariant data(const QModelIndex& index, int role) const;
bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
Qt::ItemFlags flags(const QModelIndex & /*index*/) const;
protected:
QHash<int, QByteArray> roleNames() const;
signals:
public slots:
};
#endif // LIFXLIGHTSMODEL_H
+22 -19
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0">
<TS version="2.1">
<context>
<name>BulbDetails</name>
<message>
@@ -28,23 +28,13 @@
<context>
<name>BulbListPage</name>
<message>
<location filename="../qml/pages/BulbListPage.qml" line="21"/>
<location filename="../qml/pages/BulbListPage.qml" line="19"/>
<source>Choose Lightbulbs</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FirstPage</name>
<message>
<location filename="../qml/pages/FirstPage.qml" line="54"/>
<source>Select groups</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/FirstPage.qml" line="59"/>
<source>Select bulbs</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/FirstPage.qml" line="70"/>
<source>White Mode</source>
@@ -57,26 +47,39 @@
</message>
<message>
<location filename="../qml/pages/FirstPage.qml" line="83"/>
<location filename="../qml/pages/FirstPage.qml" line="93"/>
<location filename="../qml/pages/FirstPage.qml" line="105"/>
<location filename="../qml/pages/FirstPage.qml" line="89"/>
<location filename="../qml/pages/FirstPage.qml" line="97"/>
<source>Normal Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/FirstPage.qml" line="83"/>
<location filename="../qml/pages/FirstPage.qml" line="93"/>
<location filename="../qml/pages/FirstPage.qml" line="105"/>
<location filename="../qml/pages/FirstPage.qml" line="89"/>
<location filename="../qml/pages/FirstPage.qml" line="97"/>
<source>Party Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/FirstPage.qml" line="128"/>
<location filename="../qml/pages/FirstPage.qml" line="122"/>
<source>LightFish</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>IntroPage</name>
<message>
<location filename="../qml/pages/FirstPage.qml" line="133"/>
<source>Just some random text being shown here until I figure out what to actually put into this place</source>
<location filename="../qml/pages/IntroPage.qml" line="36"/>
<source>Scanning...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/IntroPage.qml" line="50"/>
<source>Get LIFX bulbs!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/IntroPage.qml" line="72"/>
<source>LightFish</source>
<translation type="unfinished"></translation>
</message>
</context>
+13 -10
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0">
<TS version="2.1">
<context>
<name>BulbDetails</name>
<message>
@@ -29,14 +29,6 @@
</context>
<context>
<name>FirstPage</name>
<message>
<source>Select groups</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select bulbs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>White Mode</source>
<translation type="unfinished"></translation>
@@ -57,8 +49,19 @@
<source>LightFish</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>IntroPage</name>
<message>
<source>Just some random text being shown here until I figure out what to actually put into this place</source>
<source>LightFish</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Scanning...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Get LIFX bulbs!</source>
<translation type="unfinished"></translation>
</message>
</context>