From: Ivan Gorinov Date: Tue, 4 Oct 2011 04:43:02 +0000 (-0700) Subject: First commit X-Git-Url: https://vcs.maemo.org/git/?p=ameter;a=commitdiff_plain;h=cb0175cc79af386e8662b934fc627197bceac837 First commit --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..486f27c --- /dev/null +++ b/Makefile @@ -0,0 +1,282 @@ +############################################################################# +# Makefile for building: ameter +# Generated by qmake (2.01a) (Qt 4.7.0) on: Sun Aug 7 15:34:40 2011 +# Project: ameter.pro +# Template: app +# Command: /usr/bin/qmake PREFIX=/usr -o Makefile ameter.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_GL_NO_SCISSOR_TEST -DQT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wall -W -D_REENTRANT $(DEFINES) +CXXFLAGS = -pipe -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wall -W -D_REENTRANT $(DEFINES) +INCPATH = -I/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/linux-g++-maemo5 -I. -I/targets/FREMANTLE_ARMEL/usr/include/QtCore -I/targets/FREMANTLE_ARMEL/usr/include/QtGui -I/targets/FREMANTLE_ARMEL/usr/include -I/targets/FREMANTLE_ARMEL/usr/include/QtSensors -I/targets/FREMANTLE_ARMEL/usr/include -I. +LINK = g++ +LFLAGS = -Wl,-rpath-link,/usr/lib -Wl,-O1 -Wl,--hash-style=gnu -Wl,-rpath,/usr/lib +LIBS = $(SUBLIBS) -L/usr/lib -L/usr/lib -lQtSensors -lQtGui -L/usr/X11R6/lib -lQtDBus -lQtXml -lQtCore -lpthread +AR = ar cqs +RANLIB = +QMAKE = /usr/bin/qmake +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +STRIP = strip +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = main.cpp \ + mainwindow.cpp \ + ameterwidget.cpp \ + asettings.cpp moc_mainwindow.cpp \ + moc_ameterwidget.cpp \ + moc_asettings.cpp +OBJECTS = main.o \ + mainwindow.o \ + ameterwidget.o \ + asettings.o \ + moc_mainwindow.o \ + moc_ameterwidget.o \ + moc_asettings.o +DIST = /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/common/unix.conf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/common/linux.conf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/qconfig.pri \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt_functions.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt_config.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/default_pre.prf \ + deployment.pri \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/release.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/default_post.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/mobility.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/warn_on.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/unix/thread.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/moc.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/resources.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/uic.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/yacc.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/lex.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/include_source_dir.prf \ + ameter.pro +QMAKE_TARGET = ameter +DESTDIR = +TARGET = ameter + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): $(OBJECTS) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +Makefile: ameter.pro /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/linux-g++-maemo5/qmake.conf /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/common/unix.conf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/common/linux.conf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/qconfig.pri \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt_functions.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt_config.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/default_pre.prf \ + deployment.pri \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/release.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/default_post.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/mobility.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/warn_on.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/unix/thread.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/moc.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/resources.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/uic.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/yacc.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/lex.prf \ + /targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/include_source_dir.prf \ + /usr/lib/libQtGui.prl \ + /usr/lib/libQtDBus.prl \ + /usr/lib/libQtXml.prl \ + /usr/lib/libQtCore.prl + $(QMAKE) PREFIX=/usr -o Makefile ameter.pro +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/common/unix.conf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/common/linux.conf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/qconfig.pri: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt_functions.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt_config.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/exclusive_builds.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/default_pre.prf: +deployment.pri: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/release.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/default_post.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/mobility.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/warn_on.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/qt.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/unix/thread.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/moc.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/resources.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/uic.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/yacc.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/lex.prf: +/targets/FREMANTLE_ARMEL/usr/share/qt4/mkspecs/features/include_source_dir.prf: +/usr/lib/libQtGui.prl: +/usr/lib/libQtDBus.prl: +/usr/lib/libQtXml.prl: +/usr/lib/libQtCore.prl: +qmake: FORCE + @$(QMAKE) PREFIX=/usr -o Makefile ameter.pro + +dist: + @$(CHK_DIR_EXISTS) .tmp/ameter1.0.0 || $(MKDIR) .tmp/ameter1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/ameter1.0.0/ && $(COPY_FILE) --parents mainwindow.h ameterwidget.h asettings.h .tmp/ameter1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp ameterwidget.cpp asettings.cpp .tmp/ameter1.0.0/ && (cd `dirname .tmp/ameter1.0.0` && $(TAR) ameter1.0.0.tar ameter1.0.0 && $(COMPRESS) ameter1.0.0.tar) && $(MOVE) `dirname .tmp/ameter1.0.0`/ameter1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/ameter1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +check: first + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: moc_mainwindow.cpp moc_ameterwidget.cpp moc_asettings.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_mainwindow.cpp moc_ameterwidget.cpp moc_asettings.cpp +moc_mainwindow.cpp: ameterwidget.h \ + mainwindow.h + /usr/bin/moc $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp + +moc_ameterwidget.cpp: ameterwidget.h + /usr/bin/moc $(DEFINES) $(INCPATH) ameterwidget.h -o moc_ameterwidget.cpp + +moc_asettings.cpp: asettings.h + /usr/bin/moc $(DEFINES) $(INCPATH) asettings.h -o moc_asettings.cpp + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: +compiler_uic_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean + +####### Compile + +main.o: main.cpp mainwindow.h \ + ameterwidget.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp + +mainwindow.o: mainwindow.cpp mainwindow.h \ + ameterwidget.h \ + asettings.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp + +ameterwidget.o: ameterwidget.cpp ameterwidget.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ameterwidget.o ameterwidget.cpp + +asettings.o: asettings.cpp asettings.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o asettings.o asettings.cpp + +moc_mainwindow.o: moc_mainwindow.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp + +moc_ameterwidget.o: moc_ameterwidget.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_ameterwidget.o moc_ameterwidget.cpp + +moc_asettings.o: moc_asettings.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_asettings.o moc_asettings.cpp + +####### Install + +install_desktopfile: first FORCE + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/applications/hildon/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/applications/hildon/ + -$(INSTALL_FILE) /home/igorinov/Projects/ameter/ameter.desktop $(INSTALL_ROOT)/usr/share/applications/hildon/ + + +uninstall_desktopfile: FORCE + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/applications/hildon/ameter.desktop + -$(DEL_DIR) $(INSTALL_ROOT)/usr/share/applications/hildon/ + + +install_icon: first FORCE + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/ + -$(INSTALL_FILE) /home/igorinov/Projects/ameter/ameter.png $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/ + + +uninstall_icon: FORCE + -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/ameter.png + -$(DEL_DIR) $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/ + + +install_target: first FORCE + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/bin/ || $(MKDIR) $(INSTALL_ROOT)/usr/bin/ + -$(INSTALL_PROGRAM) "$(QMAKE_TARGET)" "$(INSTALL_ROOT)/usr/bin/$(QMAKE_TARGET)" + -$(STRIP) "$(INSTALL_ROOT)/usr/bin/$(QMAKE_TARGET)" + +uninstall_target: FORCE + -$(DEL_FILE) "$(INSTALL_ROOT)/usr/bin/$(QMAKE_TARGET)" + -$(DEL_DIR) $(INSTALL_ROOT)/usr/bin/ + + +install: install_desktopfile install_icon install_target FORCE + +uninstall: uninstall_desktopfile uninstall_icon uninstall_target FORCE + +FORCE: + diff --git a/README b/README new file mode 100644 index 0000000..e31edc3 --- /dev/null +++ b/README @@ -0,0 +1,6 @@ +The Debian Package ameter +---------------------------- + +Comments regarding the Package + + -- Ivan Gorinov Mon, 27 Jun 2011 22:36:07 -0700 diff --git a/ameter.desktop b/ameter.desktop new file mode 100644 index 0000000..d916a37 --- /dev/null +++ b/ameter.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=ameter +Exec=/usr/bin/ameter +Icon=ameter +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/ameter.png b/ameter.png new file mode 100644 index 0000000..3985de7 Binary files /dev/null and b/ameter.png differ diff --git a/ameter.pro b/ameter.pro new file mode 100644 index 0000000..6f10375 --- /dev/null +++ b/ameter.pro @@ -0,0 +1,43 @@ +# Add files and directories to ship with the application +# by adapting the examples below. +# file1.source = myfile +# dir1.source = mydir +DEPLOYMENTFOLDERS = # file1 dir1 + +symbian:TARGET.UID3 = 0xE7516F88 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Allow network access on Symbian +symbian:TARGET.CAPABILITY += NetworkServices + +# 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 + +SOURCES += main.cpp mainwindow.cpp \ + ameterwidget.cpp \ + asettings.cpp +HEADERS += mainwindow.h \ + ameterwidget.h \ + asettings.h +FORMS += + +# Please do not modify the following two lines. Required for deployment. +include(deployment.pri) +qtcAddDeployment() + +OTHER_FILES += \ + qtc_packaging/debian_fremantle/rules \ + qtc_packaging/debian_fremantle/README \ + qtc_packaging/debian_fremantle/copyright \ + qtc_packaging/debian_fremantle/control \ + qtc_packaging/debian_fremantle/compat \ + qtc_packaging/debian_fremantle/changelog diff --git a/ameter.pro.user b/ameter.pro.user new file mode 100644 index 0000000..c218d47 --- /dev/null +++ b/ameter.pro.user @@ -0,0 +1,388 @@ + + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + System + false + false + 4 + true + 1 + true + false + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.Target.0 + + Maemo5 + Maemo5 + Qt4ProjectManager.Target.MaemoDeviceTarget + 0 + 0 + 0 + + Qt4ProjectManager.ToolChain.Maemo:/opt/QtSDK/Maemo/4.6.2/targets/fremantle-pr13/bin/gcc.arm-linux-generic-elf-32bit. + + + qmake + + QtProjectManager.QMakeBuildStep + false + + false + + + Make + + Qt4ProjectManager.MakeStep + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + Make + + Qt4ProjectManager.MakeStep + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Qt for Fremantle PR1.3 Devices (Qt SDK) Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + /home/igorinov/Projects/ameter-build-maemo + 2 + Qt4ProjectManager.ToolChain.Maemo:/opt/QtSDK/Maemo/4.6.2/targets/fremantle-pr13/bin/gcc.arm-linux-generic-elf-32bit. + true + + + Qt4ProjectManager.ToolChain.Maemo:/opt/QtSDK/Maemo/4.6.2/targets/fremantle-pr13/bin/gcc.arm-linux-generic-elf-32bit. + + + qmake + + QtProjectManager.QMakeBuildStep + false + + false + + + Make + + Qt4ProjectManager.MakeStep + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + Make + + Qt4ProjectManager.MakeStep + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Qt for Fremantle PR1.3 Devices (Qt SDK) Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + /home/igorinov/Projects/ameter-build-maemo + 2 + Qt4ProjectManager.ToolChain.Maemo:/opt/QtSDK/Maemo/4.6.2/targets/fremantle-pr13/bin/gcc.arm-linux-generic-elf-32bit. + true + + 2 + + + + true + Packaging for Maemo + + Qt4ProjectManager.MaemoPackageCreationStep + + + Deploy to Maemo5 device + + Qt4ProjectManager.MaemoDeployStep + true + 1 + + + + + + 2 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy to Maemo5 device + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + true + 25 + + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + ameter + + Qt4ProjectManager.MaemoRunConfiguration + + 1 + + ameter.pro + + false + + 3768 + true + false + + 1 + + + + ProjectExplorer.Project.Target.1 + + Qt Simulator + Qt Simulator + Qt4ProjectManager.Target.QtSimulatorTarget + 0 + 0 + 0 + + ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit. + + + qmake + + QtProjectManager.QMakeBuildStep + false + + false + + + Make + + Qt4ProjectManager.MakeStep + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + Make + + Qt4ProjectManager.MakeStep + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Simulator Qt for GCC (Qt SDK) Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + /home/igorinov/Projects/ameter-build-simulator + 4 + ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit. + true + + + ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit. + + + qmake + + QtProjectManager.QMakeBuildStep + false + + false + + + Make + + Qt4ProjectManager.MakeStep + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + Make + + Qt4ProjectManager.MakeStep + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Simulator Qt for GCC (Qt SDK) Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + /home/igorinov/Projects/ameter-build-simulator + 4 + ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit. + true + + 2 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + No deployment + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + true + 25 + + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + ameter + + Qt4ProjectManager.Qt4RunConfiguration + 2 + + ameter.pro + false + false + + + 3768 + true + false + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.EnvironmentId + {14ebc74d-1fb9-4bf4-8b9f-cb58d053742a} + + + ProjectExplorer.Project.Updater.FileVersion + 9 + + diff --git a/ameter.svg b/ameter.svg new file mode 100644 index 0000000..8cefeca --- /dev/null +++ b/ameter.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ameterwidget-dbus.cpp b/ameterwidget-dbus.cpp new file mode 100644 index 0000000..446fc96 --- /dev/null +++ b/ameterwidget-dbus.cpp @@ -0,0 +1,183 @@ +#include +#include + +#include + +#include "ameterwidget.h" + +#define SET_IM_STATUS 1 + +AMeterWidget::AMeterWidget(QWidget *parent) + : QWidget(parent) +{ + // Reciprocal of gravity + rg = 1.0 / G_N; +// timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(tick())); +// timer->start(250); + image = 0; + + ax = 0; + ay = 0; + az = 0; + + bx = 0; + by = 0; + bz = 0; + + status = 2; + telepathist = new Telepathist(this); + tt = 0; + + m_sensor = new QAccelerometer(this); + m_sensor->addFilter(this); + m_sensor->start(); +} + +AMeterWidget::~AMeterWidget() +{ + +} + +void AMeterWidget::paintEvent(QPaintEvent *e) +{ + QPainter paint(this); + qreal cx, cy, rx, ry; + qreal x1, y1, a; + + a = sqrt(ax * ax + ay * ay + az * az); + + if (image) + { + paint.drawImage(QPoint(0, 0), *image); + } + + paint.setRenderHints(QPainter::Antialiasing); + + cx = width() / 2; + cy = height() / 2; + rx = cy / 2; + ry = cy / 2; + + x1 = cx - ax * rx; + y1 = cy + ay * ry; + + paint.setPen(QPen(QBrush(QColor(255, 255, 255, 255)), 1)); + paint.setBrush(QBrush(QColor(255, 255, 255, 255))); + paint.drawEllipse(QPointF(x1, y1), 3, 3); + paint.drawLine(QPointF(cx, cy), QPointF(x1, y1)); +} + +void AMeterWidget::resizeEvent(QResizeEvent *e) +{ + QPainter *paint; + qreal cx, cy, rx, ry; + + if (image) + { + delete image; + image = 0; + } + + image = new QImage(size(), QImage::Format_ARGB32); + paint = new QPainter(image); + paint->setRenderHints(QPainter::Antialiasing); + + cx = width() / 2; + cy = height() / 2; + rx = cy / 2; + ry = cy / 2; + + paint->setPen(QPen(QBrush(QColor(64, 64, 64, 255)), 3)); + + paint->drawLine(QPointF(cx, 0), QPointF(cx, cy + cy)); + paint->drawLine(QPointF(0, cy), QPointF(cx + cx, cy)); + + paint->drawEllipse(QPointF(cx, cy), rx, ry); + paint->drawEllipse(QPointF(cx, cy), 2 * rx, 2 * ry); + paint->drawEllipse(QPointF(cx, cy), 3 * rx, 3 * ry); + paint->drawEllipse(QPointF(cx, cy), 4 * rx, 4 * ry); + + paint->setPen(QPen(QBrush(QColor(64, 64, 64, 255)), 1)); + + paint->drawLine(QPointF(cx - cx, cy + cx), QPointF(cx + cx, cy - cx)); + paint->drawLine(QPointF(cx - cx, cy - cx), QPointF(cx + cx, cy + cx)); + + paint->drawEllipse(QPointF(cx, cy), 0.25 * rx, 0.25 * ry); + paint->drawEllipse(QPointF(cx, cy), 0.50 * rx, 0.50 * ry); + paint->drawEllipse(QPointF(cx, cy), 0.75 * rx, 0.75 * ry); + + paint->drawEllipse(QPointF(cx, cy), 1.25 * rx, 1.25 * ry); + paint->drawEllipse(QPointF(cx, cy), 1.50 * rx, 1.50 * ry); + paint->drawEllipse(QPointF(cx, cy), 1.75 * rx, 1.75 * ry); + + paint->drawEllipse(QPointF(cx, cy), 2.25 * rx, 2.25 * ry); + paint->drawEllipse(QPointF(cx, cy), 2.50 * rx, 2.50 * ry); + paint->drawEllipse(QPointF(cx, cy), 2.75 * rx, 2.75 * ry); + + + paint->drawEllipse(QPointF(cx, cy), 3.25 * rx, 3.25 * ry); + paint->drawEllipse(QPointF(cx, cy), 3.50 * rx, 3.50 * ry); + paint->drawEllipse(QPointF(cx, cy), 3.75 * rx, 3.75 * ry); + + delete paint; +} + +bool AMeterWidget::filter(QAccelerometerReading *reading) +{ + ax = reading->x() * rg; + ay = reading->y() * rg; + az = reading->z() * rg; + + update(); + + return true; +} + +void AMeterWidget::tick() +{ + char strbuf[128]; + int x, y, z; + QFile *f; + + bx = ax; + by = ay; + bz = az; + + f = new QFile("/sys/class/i2c-adapter/i2c-3/3-001d/coord"); + if (f->open(QFile::ReadOnly)) + { + f->read(strbuf, 127); + if (sscanf(strbuf, "%d %d %d", &x, &y, &z) == 3) + { + ax = x * 0.001; + ay = y * 0.001; + az = z * 0.001; + } + } + delete f; + +#ifdef SET_IM_STATUS + + if (fabs(ax - bx) > 0.125 || fabs(ay - by) > 0.125 || fabs(az - bz) > 0.125) + { + tt = 0; + if (status != 2) + { + telepathist->setStatus(2, "available", "In the pocket"); + status = 0; + } + } else { + tt++; + } + + if (tt == 480) + { + telepathist->setStatus(3, "away", "Fishing"); + status = 3; + } + +#endif + + update(); +} diff --git a/ameterwidget-dbus.h b/ameterwidget-dbus.h new file mode 100644 index 0000000..5c09c13 --- /dev/null +++ b/ameterwidget-dbus.h @@ -0,0 +1,51 @@ +#ifndef AMETERWIDGET_H +#define AMETERWIDGET_H + +#include +#include + +#include + +/* +#include +#include +*/ + +// Neccessary for Qt Mobility API usage +QTM_USE_NAMESPACE + +#include "telepathist.h" + +#define G_N 9.80665 + +class AMeterWidget : public QWidget, public QAccelerometerFilter +{ + Q_OBJECT + +public: + AMeterWidget(QWidget *parent = 0); + ~AMeterWidget(); + +public slots: + void tick(); + virtual bool filter(QAccelerometerReading *reading); + +protected: + virtual void paintEvent(QPaintEvent *); + virtual void resizeEvent(QResizeEvent *); + + QTimer *timer; + QImage *image; + + qreal ax, ay, az; + qreal bx, by, bz; + unsigned status; + Telepathist *telepathist; + unsigned tt; + +private: + QAccelerometer* m_sensor; + qreal rg; +}; + +#endif // AMETERWIDGET_H diff --git a/ameterwidget.cpp b/ameterwidget.cpp new file mode 100644 index 0000000..f2377e2 --- /dev/null +++ b/ameterwidget.cpp @@ -0,0 +1,164 @@ +#include +#include + +#include + +#include "ameterwidget.h" + +qreal g_n = 9.80665; +qreal a_max = 2; +int angle_step = 30; +int divisions = 4; +qreal filter_k = 0.5; + +AMeterWidget::AMeterWidget(QWidget *parent) + : QWidget(parent) +{ + // Reciprocal of gravity + r_g = 1.0 / g_n; + r_a_max = 1.0 / a_max; + + background = 0; + + ax = 0; + ay = 0; + az = 0; + + bx = 0; + by = 0; + bz = 0; +} + +AMeterWidget::~AMeterWidget() +{ + +} + +int AMeterWidget::setGravity(qreal g) +{ + // Reciprocal of gravity + r_g = 1.0 / g; + + drawScale(); + + return 0; +} + +void AMeterWidget::paintEvent(QPaintEvent *e) +{ + QPainter paint(this); + qreal cx, cy, rx, ry; + qreal x1, y1, a; + + a = sqrt(ax * ax + ay * ay + az * az); + + if (background) + { + paint.drawImage(QPoint(0, 0), *background); + } + + paint.setRenderHints(QPainter::Antialiasing); + + cx = width() / 2; + cy = height() / 2; + rx = cy * r_a_max; + ry = cy * r_a_max; + + x1 = cx - ax * rx; + y1 = cy + ay * ry; + + paint.setPen(QPen(QBrush(QColor(255, 255, 255, 255)), 3)); + paint.setBrush(QBrush(QColor(255, 255, 255, 255))); + paint.drawEllipse(QPointF(x1, y1), 3, 3); + paint.drawLine(QPointF(cx, cy), QPointF(x1, y1)); +} + +#define DEG2RAD (M_PI / 180.0) + +void AMeterWidget::resizeEvent(QResizeEvent *e) +{ + drawScale(); +} + +void AMeterWidget::drawScale() +{ + QPainter *paint; + qreal cx, cy, rx, ry, dx, dy; + qreal r, a; + qreal id = 1.0 / divisions; + int i, j; + + if (background) + { + delete background; + background = 0; + } + + r_a_max = 1.0 / a_max; + + background = new QImage(size(), QImage::Format_ARGB32); + paint = new QPainter(background); + paint->setRenderHints(QPainter::Antialiasing); + + cx = width() / 2; + cy = height() / 2; + + if (cx > cy) + { + ry = cy * r_a_max; + rx = ry; + } else { + rx = cx * r_a_max; + ry = rx; + } + + r = sqrt(cx * cx + cy * cy); + + paint->setPen(QPen(QBrush(QColor(64, 64, 64, 255)), 3)); + + paint->drawLine(QPointF(cx, 0), QPointF(cx, cy + cy)); + paint->drawLine(QPointF(0, cy), QPointF(cx + cx, cy)); + + for (i = 0; i * rx < cx; i++) + { + paint->setPen(QPen(QBrush(QColor(64, 64, 64, 255)), 3)); + if (i > 0) + { + paint->drawEllipse(QPointF(cx, cy), rx * i, ry * i); + } + paint->setPen(QPen(QBrush(QColor(64, 64, 64, 255)), 1)); + for (j = 0; j < divisions; j++) + { + paint->drawEllipse(QPointF(cx, cy), rx * (i + id * j), ry * (i + id * j)); + } + } + + for (i = 0; i < 360; i += angle_step) + { + a = i * DEG2RAD; + dx = sin(a) * r; + dy = cos(a) * r; + paint->drawLine(QPointF(cx, cy), QPointF(cx + dx, cy + dy)); + } + + delete paint; +} + +bool AMeterWidget::filter(QAccelerometerReading *reading) +{ + bx = ax; + by = ay; + bz = az; + + ax = reading->x() * r_g; + ay = reading->y() * r_g; + az = reading->z() * r_g; + + ax = ax * (1.0 - filter_k) + bx * filter_k; + ay = ay * (1.0 - filter_k) + by * filter_k; + az = az * (1.0 - filter_k) + bz * filter_k; + + update(); + + return true; +} diff --git a/ameterwidget.h b/ameterwidget.h new file mode 100644 index 0000000..35cd895 --- /dev/null +++ b/ameterwidget.h @@ -0,0 +1,42 @@ +#ifndef AMETERWIDGET_H +#define AMETERWIDGET_H + +#include +#include + +#include + +// Neccessary for Qt Mobility API usage +QTM_USE_NAMESPACE + +class AMeterWidget : public QWidget, public QAccelerometerFilter +{ + Q_OBJECT + +public: + AMeterWidget(QWidget *parent = 0); + ~AMeterWidget(); + + int setGravity(qreal g); + +public slots: + virtual bool filter(QAccelerometerReading *reading); + +protected: + virtual void paintEvent(QPaintEvent *); + virtual void resizeEvent(QResizeEvent *); + + void drawScale(); + + // Background with scale + QImage *background; + + qreal ax, ay, az; + qreal bx, by, bz; + +private: + qreal r_g; // 1/g + qreal r_a_max; // 1/a_max +}; + +#endif // AMETERWIDGET_H diff --git a/asettings.cpp b/asettings.cpp new file mode 100644 index 0000000..1ae9225 --- /dev/null +++ b/asettings.cpp @@ -0,0 +1,93 @@ +#include "asettings.h" + +extern qreal g_n; +extern qreal a_max; +extern qreal filter_k; +extern int angle_step; +extern int divisions; +extern int data_rate; + +SettingsDialog::SettingsDialog(QWidget *parent): QDialog(parent) +{ + QHBoxLayout *hbox; + QVBoxLayout *vbox; + + vbox = new QVBoxLayout(); + + hbox = new QHBoxLayout(); + label = new QLabel(QString::fromUtf8("&g, m/s²"), this); + hbox->addWidget(label); + editG = new QLineEdit(this); + hbox->addWidget(editG); + editG->setInputMethodHints(Qt::ImhFormattedNumbersOnly); + editG->setText(QString::number(g_n)); + label->setBuddy(editG); + label = new QLabel(QString::fromUtf8("&Scale limit, g"), this); + hbox->addWidget(label); + editMax = new QLineEdit(this); + hbox->addWidget(editMax); + editMax->setInputMethodHints(Qt::ImhFormattedNumbersOnly); + editMax->setText(QString::number(a_max)); + label->setBuddy(editMax); + vbox->addLayout(hbox); + + hbox = new QHBoxLayout(); + label = new QLabel(QString::fromUtf8("g scale &divisions"), this); + hbox->addWidget(label); + editDiv = new QLineEdit(this); + hbox->addWidget(editDiv); + editDiv->setInputMethodHints(Qt::ImhDigitsOnly); + editDiv->setText(QString::number(divisions)); + label->setBuddy(editDiv); + vbox->addLayout(hbox); + + hbox = new QHBoxLayout(); + label = new QLabel(QString::fromUtf8("&Angle scale, °"), this); + hbox->addWidget(label); + editAngle = new QLineEdit(this); + hbox->addWidget(editAngle); + editAngle->setInputMethodHints(Qt::ImhDigitsOnly); + editAngle->setText(QString::number(angle_step)); + label->setBuddy(editAngle); + vbox->addLayout(hbox); + + hbox = new QHBoxLayout(); + label = new QLabel(QString::fromUtf8("Data &rate, Hz"), this); + hbox->addWidget(label); + editRate = new QLineEdit(this); + hbox->addWidget(editRate); + editRate->setInputMethodHints(Qt::ImhDigitsOnly); + editRate->setText(QString::number(data_rate)); + label->setBuddy(editRate); + label = new QLabel(QString::fromUtf8("&Filter depth"), this); + hbox->addWidget(label); + editFilter = new QLineEdit(this); + hbox->addWidget(editFilter); + editFilter->setInputMethodHints(Qt::ImhFormattedNumbersOnly); + editFilter->setText(QString::number(filter_k)); + label->setBuddy(editFilter); + vbox->addLayout(hbox); + + buttonOk = new QPushButton("Ok"); + vbox->addWidget(buttonOk); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); + + setLayout(vbox); + + layout()->setSizeConstraint( QLayout::SetFixedSize ); +} + +SettingsDialog::~SettingsDialog() +{ +} + +void SettingsDialog::accept() +{ + g_n = editG->text().toDouble(); + a_max = editMax->text().toDouble(); + filter_k = editFilter->text().toDouble(); + divisions = editDiv->text().toInt(); + angle_step = editAngle->text().toInt(); + data_rate = editRate->text().toInt(); + QDialog::accept(); +} diff --git a/asettings.h b/asettings.h new file mode 100644 index 0000000..2ac0289 --- /dev/null +++ b/asettings.h @@ -0,0 +1,32 @@ +#ifndef ASETTINGS_H +#define ASETTINGS_H + +#include +#include +#include +#include +#include +#include + +class SettingsDialog: public QDialog +{ +Q_OBJECT +public: + SettingsDialog(QWidget *parent); + ~SettingsDialog(); + +private: + QLabel *label; + QLineEdit *editG; + QLineEdit *editMax; + QLineEdit *editFilter; + QLineEdit *editDiv; + QLineEdit *editAngle; + QLineEdit *editRate; + QPushButton *buttonOk; + +public slots: + virtual void accept(); +}; + +#endif // ASETTINGS_H diff --git a/build-stamp b/build-stamp new file mode 100644 index 0000000..e69de29 diff --git a/clean b/clean new file mode 100644 index 0000000..e69de29 diff --git a/configure-stamp b/configure-stamp new file mode 100644 index 0000000..e69de29 diff --git a/debian/ameter/DEBIAN/control b/debian/ameter/DEBIAN/control new file mode 100644 index 0000000..5ae2c8b --- /dev/null +++ b/debian/ameter/DEBIAN/control @@ -0,0 +1,11 @@ +Package: ameter +Version: 0.0.1 +Section: user/utilities +Priority: optional +Architecture: armel +Installed-Size: 108 +Maintainer: Ivan Gorinov +Description: Graphical acceleration indicator + This application displays a 2D acceleration indicator +Maemo-Display-Name: ameter +Maemo-Icon-26: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAB8RJREFUaIHtmWtsVMcVx3/n3l3vw2vv2oBZzCu80kahiPCqmhdBLWlTRYrUSIRQoQhaAe2HqrRVSSulxY1aNYqqkC9taWiUSlHUikhtJScFWuJS0pRHGyAkvGyDg7ExrPH6sV7b67339MMuu3vXuzZrm0iR+H/x3ZkzM///zJkzZ8bwKYcULN0yP0jU8k0Lu8u3PTm32m3atpW0b9wbqWldt26v9QlzHBVZAVvmB0kaz6FsXTy/PPDoyhDBgIlqgVaqNnAFpF3Rj1HZhyEtpiVtlg5fqltzKPnJC9i08HngWRDX99fXEiw3sVUptkgOqNoqDAgSBT2i0IwtTaaphy3DHaktu9G3dcX/hm+zgEUdCNMNgZ2bZ2PbmmOieX9HVQMIqqhgX0WkA7isIvtBL1pJq9W8Pr25bt3exOQJeGauF7NsAIV5Mzw881jNCEKFiZJTl/97bKREakSRiIge3/lQw6bS6IMLAI/pIe21blc+gWKECtkV2jDFIYKA1AjUAL6SGqdhjE6sNEIjRd16e1UpdTDg5goUHdTp94ZAbNAiEh3mc+FVzKoKU+71c62/ic6BVvoTUUSMvPZjUi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..56e1529 --- /dev/null +++ b/debian/ameter/DEBIAN/md5sums @@ -0,0 +1,5 @@ +543e88aeaabbf8b2b0e973a9acad747a usr/share/applications/hildon/ameter.desktop +d2a682ad86b8f28e24ba18cbe3404e5a usr/share/icons/hicolor/64x64/apps/ameter.png +be215c9369fe1807fcf328e806230563 usr/share/doc/ameter/copyright +d70f30584982d3eda0c2c3c6c9468092 usr/share/doc/ameter/changelog.gz +8dd134475c980cfd9fac24e9b467ac17 usr/bin/ameter diff --git a/debian/ameter/usr/bin/ameter b/debian/ameter/usr/bin/ameter new file mode 100755 index 0000000..920735a Binary files /dev/null and b/debian/ameter/usr/bin/ameter differ diff --git a/debian/ameter/usr/share/applications/hildon/ameter.desktop b/debian/ameter/usr/share/applications/hildon/ameter.desktop new file mode 100644 index 0000000..d916a37 --- /dev/null +++ b/debian/ameter/usr/share/applications/hildon/ameter.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=ameter +Exec=/usr/bin/ameter +Icon=ameter +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/debian/ameter/usr/share/doc/ameter/changelog.gz b/debian/ameter/usr/share/doc/ameter/changelog.gz new file mode 100644 index 0000000..0ec279f Binary files /dev/null and b/debian/ameter/usr/share/doc/ameter/changelog.gz differ diff --git a/debian/ameter/usr/share/doc/ameter/copyright b/debian/ameter/usr/share/doc/ameter/copyright new file mode 100644 index 0000000..0c5e9be --- /dev/null +++ b/debian/ameter/usr/share/doc/ameter/copyright @@ -0,0 +1,40 @@ +This package was debianized by Ivan Gorinov on +Mon, 27 Jun 2011 22:36:07 -0700. + +It was downloaded from + +Upstream Author(s): + + + + +Copyright: + + + + +License: + + 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. + + 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. + + 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 + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2011, Ivan Gorinov and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/debian/ameter/usr/share/icons/hicolor/64x64/apps/ameter.png b/debian/ameter/usr/share/icons/hicolor/64x64/apps/ameter.png new file mode 100644 index 0000000..3985de7 Binary files /dev/null and b/debian/ameter/usr/share/icons/hicolor/64x64/apps/ameter.png differ diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..43efb3a --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +ameter (0.0.1) unstable; urgency=low + + * Initial Release. + + -- Ivan Gorinov Mon, 27 Jun 2011 22:36:07 -0700 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..16ff0a2 --- /dev/null +++ b/debian/control @@ -0,0 +1,15 @@ +Source: ameter +Section: user/utilities +Priority: optional +Maintainer: Ivan Gorinov +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: http://catori.ru/igorinov/software/ameter/ + +Package: ameter +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Graphical acceleration indicator + This application displays a 2D acceleration indicator +XB-Maemo-Display-Name: ameter +XB-Maemo-Icon-26: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAB8RJREFUaIHtmWtsVMcVx3/n3l3vw2vv2oBZzCu80kahiPCqmhdBLWlTRYrUSIRQoQ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BytrH8bj8pXWYIvBuiQ2A8QZfYPV9Idpizfzyrd1F+Iz4KPIbFG014c/j4ZGNQpbZjV0sChViJ+k7gBIfFKr8lXjdXuLJ7nQSl7UbrQ/Qn6iv/Fd1K+rj4xGQjUIlrfjNV7dURAn4lIR2MzRE+uYmDrscJBX6BPsEyEVFz5O0d9WtqB933j3KQZY7e6P9j0DQ9PVQRpp0o3SCXlFhPypNGFaLeivO7FxePyAy8dw0JSB6MUbFol4g5+lh9KVXtEfQG6rahsgBEaNRbKvFtvQjHnkkXid1o2ZndRNlnkZKwF4sNusOVH8OVBegbIlqv4qcBr0o0GiI8Q9bpc1vxKM7Hnyvz9ni0CTRGxs5L7VNr+BbGDNNeVGVcqBLhDZF/y5iNKptX/Ibg6fjD6zt3znG7N7BHdzBHdzBpwb/BzqK/6HhZmA8AAAAAElFTkSuQmCC diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..0c5e9be --- /dev/null +++ b/debian/copyright @@ -0,0 +1,40 @@ +This package was debianized by Ivan Gorinov on +Mon, 27 Jun 2011 22:36:07 -0700. + +It was downloaded from + +Upstream Author(s): + + + + +Copyright: + + + + +License: + + 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. + + 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. + + 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 + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2011, Ivan Gorinov and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..11c0158 --- /dev/null +++ b/debian/files @@ -0,0 +1 @@ +ameter_0.0.1_armel.deb user/utilities optional diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..3ccf3e1 --- /dev/null +++ b/debian/rules @@ -0,0 +1,91 @@ +#!/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 + +APPNAME := ameter + + + +configure: configure-stamp +configure-stamp: + dh_testdir + qmake PREFIX=/usr $(APPNAME).pro + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/ameter.sgml > ameter.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/ameter. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/$(APPNAME) 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 diff --git a/deployment.pri b/deployment.pri new file mode 100644 index 0000000..a6c17ee --- /dev/null +++ b/deployment.pri @@ -0,0 +1,116 @@ +# checksum 0x9840 version 0x40002 +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + isEmpty(ICON):exists($${TARGET}.svg):ICON = $${TARGET}.svg + isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 +} else:win32 { + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, /, \\) + sourcePathSegments = $$split(source, \\) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments) + target = $$replace(target, /, \\) + !isEqual(source,$$target) { + !isEmpty(copyCommand):copyCommand += && + isEqual(QMAKE_DIR_SEP, \\) { + copyCommand += $(COPY_DIR) \"$$source\" \"$$target\" + } else { + source = $$replace(source, \\\\, /) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + target = $$replace(target, \\\\, /) + copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\" + } + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + desktopfile.path = /usr/share/applications/hildon + } else { + desktopfile.path = /usr/share/applications + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, \\\\, /) + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + target = $$replace(target, \\\\, /) + sourcePathSegments = $$split(source, /) + targetFullPath = $$target/$$last(sourcePathSegments) + !isEqual(source,$$targetFullPath) { + !isEmpty(copyCommand):copyCommand += && + copyCommand += $(MKDIR) \"$$target\" + copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\" + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + installPrefix = /usr + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + desktopfile.path = /usr/share/applications/hildon + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..6028dbd --- /dev/null +++ b/main.cpp @@ -0,0 +1,14 @@ +#include "mainwindow.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + MainWindow mainWindow; + mainWindow.setOrientation(MainWindow::ScreenOrientationLockLandscape); + mainWindow.showExpanded(); + + return app.exec(); +} diff --git a/mainwindow.cpp b/mainwindow.cpp new file mode 100644 index 0000000..6efe040 --- /dev/null +++ b/mainwindow.cpp @@ -0,0 +1,119 @@ +#include "mainwindow.h" +#include "asettings.h" + +extern qreal g_n; +extern qreal a_max; +extern int divisions; +extern int angle_step; + +int data_rate = 0; + +#include + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ + QMenuBar *bar = menuBar(); + QAction *action; + QSettings settings("igorinov", "ameter", this); + + g_n = settings.value("g", g_n).toDouble(); + a_max = settings.value("max", a_max).toDouble(); + divisions = settings.value("divisions", divisions).toInt(); + angle_step = settings.value("angle_step", angle_step).toInt(); + data_rate = settings.value("rate", data_rate).toInt(); + + awidget = new AMeterWidget(this); + setCentralWidget(awidget); + action = bar->addAction("&About"); + action = bar->addAction("&Settings"); + connect(action, SIGNAL(triggered()), this, SLOT(changeSettings())); + accelerometer = new QAccelerometer(this); + accelerometer->setProperty("alwaysOn", true); + accelerometer->addFilter(awidget); + accelerometer->setDataRate(data_rate); + accelerometer->start(); + +} + +MainWindow::~MainWindow() +{ + delete awidget; + delete accelerometer; +} + +void MainWindow::changeSettings() +{ + SettingsDialog dialog(this); + QSettings settings("igorinov", "ameter", this); + + if (dialog.exec() != QDialog::Accepted) + { + return; + } + + settings.setValue("g", g_n); + settings.setValue("max", a_max); + settings.setValue("divisions", divisions); + settings.setValue("angle_step", angle_step); + settings.setValue("rate", data_rate); + + awidget->setGravity(g_n); + accelerometer->stop(); + accelerometer->setDataRate(data_rate); + accelerometer->start(); +} + +void MainWindow::setOrientation(ScreenOrientation orientation) +{ +#if defined(Q_OS_SYMBIAN) + // If the version of Qt on the device is < 4.7.2, that attribute won't work + if (orientation != ScreenOrientationAuto) { + const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); + if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { + qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); + return; + } + } +#endif // Q_OS_SYMBIAN + + Qt::WidgetAttribute attribute; + switch (orientation) { +#if QT_VERSION < 0x040702 + // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes + case ScreenOrientationLockPortrait: + attribute = static_cast(128); + break; + case ScreenOrientationLockLandscape: + attribute = static_cast(129); + break; + default: + case ScreenOrientationAuto: + attribute = static_cast(130); + break; +#else // QT_VERSION < 0x040702 + case ScreenOrientationLockPortrait: + attribute = Qt::WA_LockPortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_LockLandscapeOrientation; + break; + default: + case ScreenOrientationAuto: + attribute = Qt::WA_AutoOrientation; + break; +#endif // QT_VERSION < 0x040702 + }; + setAttribute(attribute, true); +} + +void MainWindow::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) + showMaximized(); +#else + show(); +#endif +} diff --git a/mainwindow.h b/mainwindow.h new file mode 100644 index 0000000..6189ba3 --- /dev/null +++ b/mainwindow.h @@ -0,0 +1,42 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +#include +#include + +#include + +// Neccessary for Qt Mobility API usage +QTM_USE_NAMESPACE + +#include "ameterwidget.h" + +class MainWindow : public QMainWindow +{ + Q_OBJECT +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit MainWindow(QWidget *parent = 0); + virtual ~MainWindow(); + + // Note that this will only have an effect on Symbian and Fremantle. + void setOrientation(ScreenOrientation orientation); + + void showExpanded(); + +public slots: + void changeSettings(); + +private: + QAccelerometer *accelerometer; + AMeterWidget *awidget; +}; + +#endif // MAINWINDOW_H diff --git a/moc_ameterwidget.cpp b/moc_ameterwidget.cpp new file mode 100644 index 0000000..3b44483 --- /dev/null +++ b/moc_ameterwidget.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'ameterwidget.h' +** +** Created: Sun Aug 7 15:34:40 2011 +** by: The Qt Meta Object Compiler version 62 (Qt 4.7.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "ameterwidget.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'ameterwidget.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.7.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_AMeterWidget[] = { + + // content: + 5, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // slots: signature, parameters, type, tag, flags + 27, 19, 14, 13, 0x0a, + + 0 // eod +}; + +static const char qt_meta_stringdata_AMeterWidget[] = { + "AMeterWidget\0\0bool\0reading\0" + "filter(QAccelerometerReading*)\0" +}; + +const QMetaObject AMeterWidget::staticMetaObject = { + { &QWidget::staticMetaObject, qt_meta_stringdata_AMeterWidget, + qt_meta_data_AMeterWidget, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &AMeterWidget::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *AMeterWidget::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *AMeterWidget::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_AMeterWidget)) + return static_cast(const_cast< AMeterWidget*>(this)); + if (!strcmp(_clname, "QAccelerometerFilter")) + return static_cast< QAccelerometerFilter*>(const_cast< AMeterWidget*>(this)); + return QWidget::qt_metacast(_clname); +} + +int AMeterWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QWidget::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: { bool _r = filter((*reinterpret_cast< QAccelerometerReading*(*)>(_a[1]))); + if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; + default: ; + } + _id -= 1; + } + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/moc_asettings.cpp b/moc_asettings.cpp new file mode 100644 index 0000000..8718770 --- /dev/null +++ b/moc_asettings.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'asettings.h' +** +** Created: Sun Aug 7 15:34:40 2011 +** by: The Qt Meta Object Compiler version 62 (Qt 4.7.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "asettings.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'asettings.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.7.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_SettingsDialog[] = { + + // content: + 5, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // slots: signature, parameters, type, tag, flags + 16, 15, 15, 15, 0x0a, + + 0 // eod +}; + +static const char qt_meta_stringdata_SettingsDialog[] = { + "SettingsDialog\0\0accept()\0" +}; + +const QMetaObject SettingsDialog::staticMetaObject = { + { &QDialog::staticMetaObject, qt_meta_stringdata_SettingsDialog, + qt_meta_data_SettingsDialog, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &SettingsDialog::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *SettingsDialog::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *SettingsDialog::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_SettingsDialog)) + return static_cast(const_cast< SettingsDialog*>(this)); + return QDialog::qt_metacast(_clname); +} + +int SettingsDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QDialog::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: accept(); break; + default: ; + } + _id -= 1; + } + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/moc_mainwindow.cpp b/moc_mainwindow.cpp new file mode 100644 index 0000000..5eed179 --- /dev/null +++ b/moc_mainwindow.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'mainwindow.h' +** +** Created: Sun Aug 7 15:34:40 2011 +** by: The Qt Meta Object Compiler version 62 (Qt 4.7.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "mainwindow.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'mainwindow.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.7.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_MainWindow[] = { + + // content: + 5, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // slots: signature, parameters, type, tag, flags + 12, 11, 11, 11, 0x0a, + + 0 // eod +}; + +static const char qt_meta_stringdata_MainWindow[] = { + "MainWindow\0\0changeSettings()\0" +}; + +const QMetaObject MainWindow::staticMetaObject = { + { &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow, + qt_meta_data_MainWindow, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &MainWindow::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *MainWindow::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *MainWindow::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_MainWindow)) + return static_cast(const_cast< MainWindow*>(this)); + return QMainWindow::qt_metacast(_clname); +} + +int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QMainWindow::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: changeSettings(); break; + default: ; + } + _id -= 1; + } + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/telepathist.cpp b/telepathist.cpp new file mode 100644 index 0000000..e99482a --- /dev/null +++ b/telepathist.cpp @@ -0,0 +1,77 @@ +#include "telepathist.h" + +#include + +struct SimplePresence +{ + unsigned type; + QString status; + QString message; +}; + +Q_DECLARE_METATYPE(SimplePresence) + + +QDBusArgument &operator<<(QDBusArgument &argument, const SimplePresence &mystatus) +{ + argument.beginStructure(); + argument << mystatus.type; + argument << mystatus.status; + argument << mystatus.message; + argument.endStructure(); + + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, SimplePresence &mystatus) +{ + argument.beginStructure(); + argument >> mystatus.type; + argument >> mystatus.status; + argument >> mystatus.message; + argument.endStructure(); + + return argument; +} + +Telepathist::Telepathist(QObject *parent) +{ + qDBusRegisterMetaType(); +} + +Telepathist::~Telepathist() +{ +} + +void Telepathist::setStatus(unsigned type, QString status, QString message) +{ + QDBusConnection bus = QDBusConnection::sessionBus(); + + QDBusInterface *dbi, *dbi2; + QDBusArgument a; + SimplePresence ms; + + ms.type = type; // 3; + ms.status = status; // "away"; + ms.message = message; // "Fishing."; + + dbi = new QDBusInterface("org.freedesktop.Telepathy.AccountManager", "/org/freedesktop/Telepathy/AccountManager", "", bus, this); + QDBusReply reply = dbi->call(QDBus::AutoDetect, "Get", "org.freedesktop.Telepathy.AccountManager", "ValidAccounts"); + + if (reply.isValid()) { + QDBusVariant validAccounts = reply.value(); + const QVariant var = validAccounts.variant(); + const QDBusArgument arg = var.value(); + a << ms; + + arg.beginArray(); + while (!arg.atEnd()) { + QDBusObjectPath opath; + arg >> opath; + dbi2 = new QDBusInterface("org.freedesktop.Telepathy.AccountManager", opath.path(), "org.freedesktop.DBus.Properties", bus, this); + dbi2->call(QDBus::AutoDetect, "Set", "org.freedesktop.Telepathy.Account", "RequestedPresence", /* a.asVariant()*/ + QVariant::fromValue(QDBusVariant(QVariant::fromValue(a))) ); + } + arg.endArray(); + } +} diff --git a/telepathist.h b/telepathist.h new file mode 100644 index 0000000..9217835 --- /dev/null +++ b/telepathist.h @@ -0,0 +1,21 @@ +#ifndef TELEPATHIST_H +#define TELEPATHIST_H + +#include + +class Telepathist: public QObject +{ + Q_OBJECT + +public: + Telepathist(QObject *parent = 0); + ~Telepathist(); + +public slots: + void setStatus(unsigned type, QString status, QString Message); + +protected: +}; + +#endif // TELEPATHIST_H +