[-]
[+]
|
Changed |
_service:tar_git:onyx-flashlight.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -6,7 +6,7 @@
<service name="tar_git">
<param name="url">https://github.com/kimmoli/onyx-flashlight.git</param>
<param name="branch">master</param>
- <param name="revision">67ad5e6e46f0dc4eb8fa6dc80023f698e470738b</param>
+ <param name="revision">8183ae5c19961cf723ba75796134050da49998cf</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Deleted |
_service:tar_git:onyx-flashlight-0.0.3.tar.bz2/qml/cover/CoverPage.qml
^
|
@@ -1,58 +0,0 @@
-/*
- Copyright (C) 2016 Matti Lehtimäki.
- Contact: Matti Lehtimäki <matti.lehtimaki@gmail.com>
- All rights reserved.
-
- You may use this file under the terms of BSD license as follows:
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Jolla Ltd nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-import QtQuick 2.0
-import Sailfish.Silica 1.0
-import QtMultimedia 5.0
-
-CoverBackground
-{
- Column
- {
- anchors.centerIn: parent
- Label
- {
- anchors.horizontalCenter: parent.horizontalCenter
- text: "Flashlight"
- }
- }
- CoverActionList
- {
- id: coverAction
-
- CoverAction
- {
- iconSource: "image://theme/icon-cover-location"
- onTriggered: tbd
- }
- }
-}
-
-
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-flashlight-0.0.4.tar.bz2/onyx-flashlight.pro
^
|
@@ -14,7 +14,6 @@
src/torch.cpp
OTHER_FILES += qml/flashlight.qml \
- qml/cover/CoverPage.qml \
qml/pages/Flashlight.qml \
qml/pages/AboutPage.qml \
rpm/onyx-flashlight.spec \
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-flashlight-0.0.4.tar.bz2/qml/flashlight.qml
^
|
@@ -4,7 +4,28 @@
ApplicationWindow
{
initialPage: Qt.resolvedUrl("pages/Flashlight.qml")
- cover: Qt.resolvedUrl("cover/CoverPage.qml")
+ cover: CoverBackground
+ {
+ Column
+ {
+ anchors.centerIn: parent
+ Label
+ {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: "Flashlight"
+ }
+ }
+ CoverActionList
+ {
+ id: coverAction
+
+ CoverAction
+ {
+ iconSource: "image://theme/icon-cover-location"
+ onTriggered: Torch.torchState = !Torch.torchState
+ }
+ }
+ }
}
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-flashlight-0.0.4.tar.bz2/qml/pages/Flashlight.qml
^
|
@@ -5,32 +5,6 @@
{
id: page
- property bool torchIsOn: false
- property int brightness: 1
-
- property bool stroboIsOn: false
- property int interval: 200
-
- onBrightnessChanged:
- {
- Torch.set(torchIsOn, stroboIsOn, brightness, interval)
- }
-
- onIntervalChanged:
- {
- Torch.set(torchIsOn, stroboIsOn, brightness, interval)
- }
-
- onTorchIsOnChanged:
- {
- Torch.set(torchIsOn, stroboIsOn, brightness, interval)
- }
-
- onStroboIsOnChanged:
- {
- Torch.set(torchIsOn, stroboIsOn, brightness, interval)
- }
-
SilicaFlickable
{
anchors.fill: parent
@@ -63,16 +37,16 @@
Button
{
anchors.horizontalCenter: parent.horizontalCenter
- enabled: !stroboIsOn
- text: torchIsOn ? "Off" : "On"
- onClicked: torchIsOn = !torchIsOn
+ enabled: !Torch.stroboState
+ text: Torch.torchState ? "Off" : "On"
+ onClicked: Torch.torchState = !Torch.torchState
}
Button
{
anchors.horizontalCenter: parent.horizontalCenter
- enabled: !torchIsOn
+ enabled: !Torch.torchState
text: "Strobo"
- onClicked: stroboIsOn = !stroboIsOn
+ onClicked: Torch.stroboState = !Torch.stroboState
}
Slider
{
@@ -82,9 +56,9 @@
valueText: value
minimumValue: 1
maximumValue: 400
- value: brightness
+ value: Torch.brightness
stepSize: 1
- onValueChanged: brightness = value
+ onValueChanged: Torch.brightness = value
}
Slider
{
@@ -94,9 +68,9 @@
valueText: value
minimumValue: 20
maximumValue: 500
- value: interval
+ value: Torch.interval
stepSize: 1
- onValueChanged: interval = value
+ onValueChanged: Torch.interval = value
}
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-flashlight-0.0.4.tar.bz2/src/main.cpp
^
|
@@ -29,6 +29,11 @@
QScopedPointer<QQuickView> view(SailfishApp::createView());
Torch *t = new Torch();
+
+ t->setProperty("brightness", 1);
+ t->setProperty("interval", 200);
+ t->setProperty("torchState", false);
+ t->setProperty("stroboState", false);
view->rootContext()->setContextProperty("Torch", t);
view->setSource(SailfishApp::pathTo("qml/flashlight.qml"));
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-flashlight-0.0.4.tar.bz2/src/torch.cpp
^
|
@@ -6,6 +6,7 @@
Torch::Torch(QObject *parent) :
QObject(parent)
{
+
strobotimer = new QTimer();
strobotimer->setSingleShot(false);
@@ -15,31 +16,85 @@
strobostate = false;
}
-void Torch::set(bool torchOn, bool stroboOn, int level, int interval)
+void Torch::setTorchState(bool val)
{
- if (stroboOn)
+ if(m_stroboisOn)
{
- strobotimer->setInterval(interval);
- strobotimer->start();
+ setStroboState(false);
}
- else
+
+ if(!val)
{
- strobotimer->stop();
- strobostate = false;
+ p_brightness(0);
+ m_torchIsOn = false;
+ Q_EMIT torchStateChanged(false);
+ }else
+ {
+ p_brightness(m_brightness);
+ m_torchIsOn = true;
+ Q_EMIT torchStateChanged(false);
+
+
+ if(m_brightness > 0)
+ {
+ lastBrightness = m_brightness;
+ }
}
+}
+
+bool Torch::getTorchState()
+{
+ return m_torchIsOn;
+}
- if (torchOn)
+void Torch::setStroboState(bool val)
+{
+ if(!val)
{
- p_brightness(level);
+ strobotimer->stop();
+ m_stroboisOn = false;
+ p_brightness(0);
+ Q_EMIT stroboStateChanged(false);
}
else
{
- p_brightness(0);
+ strobotimer->setInterval(m_interval);
+ strobotimer->start();
+ m_stroboisOn = true;
+ Q_EMIT stroboStateChanged(true);
+
+ if(m_brightness > 0)
+ {
+ lastBrightness = m_brightness;
+ }
}
+}
+
+bool Torch::getStroboState()
+{
+ return m_stroboisOn;
+}
- if (level > 0 )
+void Torch::setBrightness(int val)
+{
+ m_brightness = val;
+ if(this->getStroboState())
+ {
+ setStroboState(true);
+ }
+ if(this->getTorchState())
+ {
+ setTorchState(true);
+ }
+
+}
+
+void Torch::setIntervall(int val)
+{
+ m_interval = val;
+ if(this->getStroboState())
{
- lastBrightness = level;
+ setStroboState(true);
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-flashlight-0.0.4.tar.bz2/src/torch.h
^
|
@@ -8,15 +8,36 @@
class Torch : public QObject
{
Q_OBJECT
+ Q_PROPERTY(int brightness MEMBER m_brightness WRITE setBrightness NOTIFY brightnessChanged)
+ Q_PROPERTY(int interval MEMBER m_interval WRITE setIntervall NOTIFY intervalChanged)
+ Q_PROPERTY(bool torchState READ getTorchState WRITE setTorchState NOTIFY torchStateChanged)
+ Q_PROPERTY(bool stroboState READ getStroboState WRITE setStroboState NOTIFY stroboStateChanged)
public:
explicit Torch(QObject *parent = 0);
- Q_INVOKABLE void set(bool torchOn, bool stroboOn, int level, int interval);
+
+ void setTorchState(bool);
+ bool getTorchState();
+ void setStroboState(bool);
+ bool getStroboState();
+ void setBrightness(int);
+ void setIntervall(int);
+
+signals:
+ void brightnessChanged(int nBrightness);
+ void intervalChanged(int nInterval);
+ void stroboStateChanged(bool state);
+ void torchStateChanged(bool state);
private slots:
void p_strobotimerTimeout();
private:
void p_brightness(int level);
+ bool m_torchIsOn;
+ int m_interval;
+ bool m_stroboisOn;
+ int m_brightness;
+
QTimer *strobotimer;
bool strobostate;
|