Commit aa45acc3 authored by Andrew Flegg's avatar Andrew Flegg

Harmattan packaging, desktop fixes (point to the file actually installed)

and ensure display is consistent on Fremantle & Symbian.
parent 7d431071
......@@ -3,8 +3,8 @@ Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=attitude
Exec=/opt/usr/bin/attitude
Name=Attitude
Exec=/opt/Attitude/bin/Attitude
Icon=attitude
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
......
......@@ -3,25 +3,22 @@ folder_01.source = qml/attitude
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01
TARGET=Attitude
VERSION=0.9.0
# Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =
symbian:TARGET.UID3 = 0xE6DA552B
# Allow network access on Symbian
#symbian:TARGET.CAPABILITY += NetworkServices
symbian:TARGET.CAPABILITY =
symbian:TARGET.CAPABILITY = NetworkServices
# Define QMLJSDEBUGGER to allow debugging of QML in debug builds
# (This might significantly increase build time)
# DEFINES += QMLJSDEBUGGER
# If your application uses the Qt Mobility libraries, uncomment
# the following lines and add the respective components to the
# MOBILITY variable.
CONFIG += mobility
MOBILITY += sensors
QT += opengl
# The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp
......@@ -31,3 +28,23 @@ include(qmlapplicationviewer/qmlapplicationviewer.pri)
qtcAddDeployment()
HEADERS += activemonitor.h
OTHER_FILES += \
qtc_packaging/debian_harmattan/rules \
qtc_packaging/debian_harmattan/README \
qtc_packaging/debian_harmattan/copyright \
qtc_packaging/debian_harmattan/control \
qtc_packaging/debian_harmattan/compat \
qtc_packaging/debian_harmattan/changelog
unix:!symbian:!maemo5 {
desktopfile.files = $${TARGET}.desktop
desktopfile.path = /usr/share/applications
INSTALLS += desktopfile
}
unix:!symbian:!maemo5 {
desktopfile.files = $${TARGET}.desktop
desktopfile.path = /usr/share/applications
INSTALLS += desktopfile
}
This diff is collapsed.
#include <QtGui/QApplication>
#include <QtDeclarative>
#include <QGLWidget>
#include "qmlapplicationviewer.h"
#include "activemonitor.h"
#include <stdio.h>
int main(int argc, char *argv[])
{
// This doesn't work; so let's get hacky later on...
// qputenv("N900_PORTRAIT_SENSORS", "1");
QApplication app(argc, argv);
app.setProperty("NoMStyle", true);
QmlApplicationViewer viewer;
/**
......@@ -18,6 +22,7 @@ int main(int argc, char *argv[])
* ActiveMonitor object that has an "active" property to the QML
* context. Inside QML, use "activeMonitor.active" as boolean.
**/
// TODO With Qt Quick Components, we can http://library.developer.nokia.com/topic/MeeGo_1.2_Harmattan_API/html/guide/html/Developer_Library_Application_development_framework_Application_lifecycle_a92f.html
ActiveMonitor *monitor = new ActiveMonitor(&viewer);
QObject::connect(&viewer, SIGNAL(activeChanged(bool)),
monitor, SLOT(activeChanged(bool)));
......@@ -25,17 +30,16 @@ int main(int argc, char *argv[])
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
viewer.engine()->addImportPath(QString("/opt/qtm11/imports"));
viewer.setWindowTitle("Attitude");
viewer.setViewport(new QGLWidget);
#if defined(Q_OS__SYMBIAN)
viewer.engine()->rootContext()->setContextProperty("rotateFudge", -90);
#if defined(Q_WS_MAEMO_5)
viewer.engine()->rootContext()->setContextProperty("rotateFudge", 90);
#else
viewer.engine()->rootContext()->setContextProperty("rotateFudge", 0);
#endif
viewer.setMainQmlFile(QLatin1String("qml/attitude/main.qml"));
viewer.showExpanded();
viewer.setMainQmlFile(QString("qml/attitude/Main.qml"));
// viewer.setMainQmlFile(QString("qml/attitude/qtc-root.qml"));
viewer.showFullScreen();
return app.exec();
}
import QtQuick 1.0
import QtMobility.sensors 1.1
import "priv.js" as P
/**
* The accelerometer control logic.
*
......@@ -13,18 +15,18 @@ import QtMobility.sensors 1.1
*/
Accelerometer {
id: self
property variant previousDip: [ 0.0, 0.0, 0.0, 0.0, 0.0 ]
property variant previousAngle: [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]
property variant calibration: [0.0, 0.0]
property double dip: 0.0
property double angle: 0.0
property variant calibration: [0.0, 0.0]
property int samples: 10
property bool windowActive: activeMonitor.active
signal movement(double dip, double angle)
dataRate: 25 // Harmattan defaults to 0
/**
* Track visibility.
......@@ -43,14 +45,18 @@ Accelerometer {
*/
function calibrate() {
calibration = [dip, angle]
console.log(rotateFudge)
}
/**
* Start receiving values immediately.
*/
Component.onCompleted: start()
Component.onCompleted: {
start();
console.log("Rotate fudge: " + rotateFudge + " deg")
P.priv(self).previousDip = []
P.priv(self).previousAngle = []
}
/**
......@@ -58,40 +64,70 @@ Accelerometer {
*/
onReadingChanged: {
var rawDip = Math.max(Math.min(reading.z / 9.8, 1), -1)
var rawAngle = rotateFudge + Math.atan2(reading.x, reading.y) * 180/Math.PI
var set = [] // Can't update a list property, but can re-assign it
var mean = rawAngle // Total of values contributing to the next
var count = 1 // How many items we're counting
for (var i = 1; i < previousAngle.length; i++) {
if (Math.abs((rawAngle - previousAngle[i]) / 360) < 0.25) {
mean += previousAngle[i]
count++
}
set[i - 1] = previousAngle[i]
}
set[previousAngle.length - 1] = rawAngle
previousAngle = set
var newAngle = Math.round(100 * mean / count) / 100 - calibration[1]
set = []
mean = rawDip
count = 1
for (var i = 1; i < previousDip.length; i++) {
if (Math.abs(rawDip - previousDip[i]) < 0.25) {
mean += previousDip[i]
count++
}
set[i - 1] = previousDip[i]
}
set[previousDip.length - 1] = rawDip
previousDip = set
var newDip = Math.round(1000 * mean / count) / 1000 - calibration[0]
var rawAngle = rotateFudge + Math.atan2(-reading.y, reading.x) * 180/Math.PI
var newDip = _updateList(P.priv(self).previousDip, rawDip, 1, 1000) - calibration[0]
var newAngle = _updateList(P.priv(self).previousAngle, rawAngle, 360.0, 100.0) - calibration[1]
if (newDip != self.dip || newAngle != self.angle) {
self.dip = newDip
self.angle = newAngle
self.movement(newDip, newAngle)
}
}
/**
* Do the repetitive munging of a list, and calculate the rolling
* average.
*
* @param list List of values.
* @param reading The raw reading to add.
* @param bounds Any upper limit when calculating tolerances.
* @param accuracy 10^n, where n == number of dp.
* @return The mean, updated, value.
*/
function _updateList(list, reading, bounds, accuracy) {
if (list.length >= samples)
list.pop()
list.unshift(reading)
var count = 0 // How many items we're counting
var mean = 0.0 // The mean value
for (var i = 0; i < list.length; i++) {
if (Math.abs((reading - list[i]) / bounds) < 0.25) {
mean += list[i]
count++
}
}
return Math.round(accuracy * mean / count) / accuracy;
}
// var set = [] // Can't update a list property, but can re-assign it
// var mean = rawAngle // Total of values contributing to the next
// var count = 1 // How many items we're counting
// for (var i = 1; i < previousAngle.length; i++) {
// if (Math.abs((rawAngle - previousAngle[i]) / 360) < 0.25) {
// mean += previousAngle[i]
// count++
// }
// set[i - 1] = previousAngle[i]
// }
// set[previousAngle.length - 1] = rawAngle
// previousAngle = set
// var newAngle = Math.round(100 * mean / count) / 100 - calibration[1]
// set = []
// mean = rawDip
// count = 1
// for (var i = 1; i < previousDip.length; i++) {
// if (Math.abs(rawDip - previousDip[i]) < 0.25) {
// mean += previousDip[i]
// count++
// }
// set[i - 1] = previousDip[i]
// }
// set[previousDip.length - 1] = rawDip
// previousDip = set
// var newDip = Math.round(1000 * mean / count) / 1000 - calibration[0]
}
......@@ -2,14 +2,14 @@ import QtQuick 1.0
Item {
id: window
width: 800
width: 854
height: 480
/**
* Contains the ground and the sky, and the pivot around which
* we rotate.
*/
Rectangle {
Item {
id: world
x: -parent.width
y: -parent.height * 2.5
......@@ -18,7 +18,7 @@ Item {
transformOrigin: Item.Center
rotation: 0
Rectangle {
Item {
id: view
x: 0
y: 0
......@@ -33,7 +33,7 @@ Item {
gradient: Gradient {
GradientStop { position: 0; color: "#006bd6" }
GradientStop { position: 0.66; color: "#1e94ff" }
GradientStop { position: 1; color: "#1e94ff" }
GradientStop { position: 1; color: "#fe94ff" }
}
}
......@@ -51,7 +51,7 @@ Item {
}
}
Rectangle {
Item {
id: horizon
opacity: 0.8
Rectangle {
......@@ -70,7 +70,7 @@ Item {
}
}
Rectangle {
Item {
id: heightBars
opacity: 0.8
......
.pragma library
var _privs = {}
// only works will with qml objects
function priv(key) {
var s = ""
var h = key.toString()
//console.log("hash",h)
var o = _privs[key]
if (!o) {
o = {}
_privs[key] = o
}
return o
}
import QtQuick 1.0
import com.meego 1.0
PageStackWindow {
id: window
anchors.fill: parent
showToolBar: false
showStatusBar: false
/**
* Contains the ground and the sky, and the pivot around which
* we rotate.
*/
initialPage: Main {}
}
The Debian Package attitude
The Package attitude
----------------------------
Comments regarding the Package
......
This package was debianized by Andrew Flegg <andrew@bleb.org> on
Sat, 05 Mar 2011 10:48:31 +0000.
Copyright (c) Andrew Flegg 2011
It was downloaded from <url://example.com>
Upstream Author(s):
The "Artistic License"
<put author's name and email here>
<likewise for another author>
Preamble
Copyright:
The intent of this document is to state the conditions under which a
Package may be copied, such that the Copyright Holder maintains some
semblance of artistic control over the development of the package,
while giving the users of the package the right to use and distribute
the Package in a more-or-less customary fashion, plus the right to make
reasonable modifications.
<Copyright (C) YYYY Name OfAuthor>
<likewise for another author>
Definitions:
License:
"Package" refers to the collection of files distributed by the
Copyright Holder, and derivatives of that collection of files
created through textual modification.
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"Standard Version" refers to such a Package if it has not been
modified, or has been modified in accordance with the wishes
of the Copyright Holder as specified below.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
"Copyright Holder" is whoever is named in the copyright or
copyrights for the package.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"You" is you, if you're thinking about copying or distributing
this Package.
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.
"Reasonable copying fee" is whatever you can justify on the
basis of media cost, duplication charges, time of people involved,
and so on. (You will not be required to justify it to the
Copyright Holder, but only to the computing community at large
as a market that must bear the fee.)
The Debian packaging is (C) 2011, Andrew Flegg <andrew@bleb.org> and
is licensed under the GPL, see above.
"Freely Available" means that no fee is charged for the item
itself, though there may be fees involved in handling the item.
It also means that recipients of the item may redistribute it
under the same conditions they received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
2. You may apply bug fixes, portability fixes and other modifications
derived from the Public Domain or from the Copyright Holder. A Package
modified in such a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided
that you insert a prominent notice in each changed file stating how and
when you changed that file, and provided that you do at least ONE of the
following:
a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or
an equivalent medium, or placing the modifications on a major archive
site such as uunet.uu.net, or by allowing the Copyright Holder to include
your modifications in the Standard Version of the Package.
b) use the modified Package only within your corporation or organization.
c) rename any non-standard executables so the names do not conflict
with standard executables, which must also be provided, and provide
a separate manual page for each non-standard executable that clearly
documents how it differs from the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or
executable form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where
to get the Standard Version.
b) accompany the distribution with the machine-readable source of
the Package with your modifications.
c) give non-standard executables non-standard names, and clearly
document the differences in manual pages (or equivalent), together
with instructions on where to get the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this
Package. You may not charge a fee for this Package itself. However,
you may distribute this Package in aggregate with other (possibly
commercial) programs as part of a larger (possibly commercial) software
distribution provided that you do not advertise this Package as a
product of your own. You may embed this Package's interpreter within
an executable of yours (by linking); this shall be construed as a mere
form of aggregation, provided that the complete Standard Version of the
interpreter is so embedded.
6. The scripts and library files supplied as input to or produced as
output from the programs of this Package do not automatically fall
under the copyright of this Package, but belong to whoever generated
them, and may be sold commercially, and may be aggregated with this
Package. If such scripts or library files are aggregated with this
Package via the so-called "undump" or "unexec" methods of producing a
binary executable image, then distribution of such an image shall
neither be construed as a distribution of this Package nor shall it
fall under the restrictions of Paragraphs 3 and 4, provided that you do
not represent such an executable image as a Standard Version of this
Package.
7. C subroutines (or comparably compiled subroutines in other
languages) supplied by you and linked into this Package in order to
emulate subroutines and variables of the language defined by this
Package shall not be considered part of this Package, but are the
equivalent of input as in Paragraph 6, provided these subroutines do
not change the language in any way that would cause it to fail the
regression tests for the language.
8. Aggregation of this Package with a commercial distribution is always
permitted provided that the use of this Package is embedded; that is,
when no overt attempt is made to make this Package's interfaces visible
to the end user of the commercial distribution. Such use shall not be
construed as a distribution of this Package.
9. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.
10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End
qtc_packaging/debian_fremantle/README
\ No newline at end of file
qtc_packaging/debian_fremantle/changelog
\ No newline at end of file
qtc_packaging/debian_fremantle/control
\ No newline at end of file
qtc_packaging/debian_fremantle/copyright
\ No newline at end of file
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
configure: configure-stamp
configure-stamp:
dh_testdir
# qmake PREFIX=/usr# Uncomment this line for use without Qt Creator
touch configure-stamp
build: build-stamp
build-stamp: configure-stamp
dh_testdir
# Add here commands to compile the package.
# $(MAKE) # Uncomment this line for use without Qt Creator
#docbook-to-man debian/attitude.sgml > attitude.1
touch $@
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
# Add here commands to clean up after the build process.
$(MAKE) clean
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/attitude.
$(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/attitude install
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installexamples
# dh_install
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_python
# dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
# dh_perl
# dh_makeshlibs
dh_installdeb
# dh_shlibdeps # Uncomment this line for use without Qt Creator
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment