Merge lp:~unity-team/libusermetrics/file-based-infographics into lp:libusermetrics

Proposed by Pete Woods
Status: Approved
Approved by: Antti Kaijanmäki
Approved revision: 182
Proposed branch: lp:~unity-team/libusermetrics/file-based-infographics
Merge into: lp:libusermetrics
Diff against target: 14066 lines (+6354/-5861)
162 files modified
CMakeLists.txt (+6/-13)
cmake/FindValgrind.cmake (+1/-1)
cmake/Plugins.cmake (+102/-0)
data/CMakeLists.txt (+37/-10)
data/com.canonical.Infographics.conf (+15/-0)
data/com.canonical.Infographics.service.in (+5/-0)
data/com.canonical.Infographics.xml (+14/-0)
data/com.canonical.UserMetrics.conf (+0/-15)
data/com.canonical.UserMetrics.service.in (+0/-5)
data/com.canonical.UserMetrics.xml (+0/-44)
data/com.canonical.usermetrics.DataSet.xml (+0/-24)
data/com.canonical.usermetrics.DataSource.xml (+0/-42)
data/com.canonical.usermetrics.UserData.xml (+0/-25)
data/default.json.in (+9/-0)
data/usermetricsservice.conf.in (+10/-0)
debian/changelog (+7/-0)
debian/control (+18/-7)
debian/libusermetricsinput1.symbols (+19/-8)
debian/libusermetricsoutput1.symbols (+18/-0)
debian/qtdeclarative5-infographics0.1.install (+1/-0)
debian/rules (+6/-2)
debian/usermetricsservice.infographic.click-hook (+3/-0)
debian/usermetricsservice.install (+1/-0)
debian/usermetricsservice.postinst (+0/-16)
debian/usermetricsservice.postrm (+0/-26)
debian/usermetricsservice.preinst (+0/-30)
debian/usermetricsservice.prerm (+0/-7)
debian/usermetricsservice.usermetrics.click-hook (+3/-0)
doc/Infographic Architecture.svg (+636/-0)
doc/mainpage.md (+87/-0)
po/en_GB.po (+88/-120)
po/libusermetrics.pot (+18/-108)
po/pl.po (+92/-121)
po/zh_CN.po (+28/-117)
src/CMakeLists.txt (+2/-0)
src/infographic/CMakeLists.txt (+20/-0)
src/infographic/Infographic.cpp (+292/-0)
src/infographic/Infographic.h (+79/-0)
src/infographic/main.cpp (+53/-0)
src/infographicservice/CMakeLists.txt (+58/-0)
src/infographicservice/Service.cpp (+131/-0)
src/infographicservice/Service.h (+74/-0)
src/infographicservice/main.cpp (+46/-0)
src/libusermetricscommon/CMakeLists.txt (+7/-29)
src/libusermetricscommon/DBusPaths.cpp (+0/-41)
src/libusermetricscommon/DBusPaths.h (+0/-41)
src/libusermetricscommon/FileUtils.cpp (+52/-0)
src/libusermetricscommon/FileUtils.h (+47/-0)
src/libusermetricsinput/CMakeLists.txt (+2/-0)
src/libusermetricsinput/Factory.cpp (+48/-0)
src/libusermetricsinput/Factory.h (+47/-0)
src/libusermetricsinput/Metric.h (+1/-1)
src/libusermetricsinput/MetricImpl.cpp (+228/-75)
src/libusermetricsinput/MetricImpl.h (+43/-20)
src/libusermetricsinput/MetricManager.cpp (+7/-13)
src/libusermetricsinput/MetricManager.h (+9/-23)
src/libusermetricsinput/MetricManagerImpl.cpp (+40/-93)
src/libusermetricsinput/MetricManagerImpl.h (+6/-4)
src/libusermetricsinput/MetricParameters.cpp (+132/-0)
src/libusermetricsinput/MetricParameters.h (+74/-0)
src/libusermetricsinput/MetricUpdate.h (+1/-1)
src/libusermetricsinput/MetricUpdateImpl.cpp (+6/-13)
src/libusermetricsinput/MetricUpdateImpl.h (+5/-8)
src/libusermetricsinput/usermetricsinput.cpp (+9/-8)
src/libusermetricsoutput/CMakeLists.txt (+3/-4)
src/libusermetricsoutput/ColorThemeProvider.h (+1/-0)
src/libusermetricsoutput/DirectoryWatcher.cpp (+118/-0)
src/libusermetricsoutput/DirectoryWatcher.h (+69/-0)
src/libusermetricsoutput/InfographicList.cpp (+32/-0)
src/libusermetricsoutput/InfographicList.h (+127/-0)
src/libusermetricsoutput/InfographicListImpl.cpp (+181/-0)
src/libusermetricsoutput/InfographicListImpl.h (+98/-0)
src/libusermetricsoutput/SyncedDataSet.cpp (+0/-34)
src/libusermetricsoutput/SyncedDataSet.h (+0/-43)
src/libusermetricsoutput/SyncedDataSource.cpp (+0/-54)
src/libusermetricsoutput/SyncedDataSource.h (+0/-46)
src/libusermetricsoutput/SyncedUserData.cpp (+0/-89)
src/libusermetricsoutput/SyncedUserData.h (+0/-56)
src/libusermetricsoutput/SyncedUserMetricsStore.cpp (+0/-142)
src/libusermetricsoutput/SyncedUserMetricsStore.h (+0/-63)
src/libusermetricsoutput/UserMetrics.cpp (+4/-9)
src/libusermetricsoutput/UserMetricsImpl.cpp (+6/-5)
src/libusermetricsoutput/UserMetricsStore.h (+2/-0)
src/modules/CMakeLists.txt (+1/-0)
src/modules/Infographics/CMakeLists.txt (+39/-0)
src/modules/Infographics/Components.cpp (+34/-0)
src/modules/Infographics/Components.h (+34/-0)
src/modules/Infographics/qmldir (+2/-0)
src/modules/UserMetrics/CMakeLists.txt (+27/-34)
src/usermetricsservice/Authentication.cpp (+0/-104)
src/usermetricsservice/Authentication.h (+0/-54)
src/usermetricsservice/CMakeLists.txt (+42/-53)
src/usermetricsservice/DBusDataSet.cpp (+0/-221)
src/usermetricsservice/DBusDataSet.h (+0/-100)
src/usermetricsservice/DBusDataSource.cpp (+0/-244)
src/usermetricsservice/DBusDataSource.h (+0/-115)
src/usermetricsservice/DBusUserData.cpp (+0/-186)
src/usermetricsservice/DBusUserData.h (+0/-95)
src/usermetricsservice/DBusUserMetrics.cpp (+0/-291)
src/usermetricsservice/DBusUserMetrics.h (+0/-90)
src/usermetricsservice/Executor.cpp (+27/-0)
src/usermetricsservice/Executor.h (+42/-0)
src/usermetricsservice/Factory.cpp (+91/-0)
src/usermetricsservice/Factory.h (+69/-0)
src/usermetricsservice/Infographic.cpp (+27/-0)
src/usermetricsservice/Infographic.h (+52/-0)
src/usermetricsservice/InfographicImpl.cpp (+180/-0)
src/usermetricsservice/InfographicImpl.h (+81/-0)
src/usermetricsservice/QProcessExecutor.cpp (+75/-0)
src/usermetricsservice/QProcessExecutor.h (+47/-0)
src/usermetricsservice/ResultTransport.cpp (+27/-0)
src/usermetricsservice/ResultTransport.h (+45/-0)
src/usermetricsservice/ResultTransportImpl.cpp (+66/-0)
src/usermetricsservice/ResultTransportImpl.h (+45/-0)
src/usermetricsservice/Service.cpp (+27/-0)
src/usermetricsservice/Service.h (+45/-0)
src/usermetricsservice/ServiceImpl.cpp (+172/-0)
src/usermetricsservice/ServiceImpl.h (+87/-0)
src/usermetricsservice/SourceDirectory.cpp (+27/-0)
src/usermetricsservice/SourceDirectory.h (+45/-0)
src/usermetricsservice/SourceDirectoryImpl.cpp (+67/-0)
src/usermetricsservice/SourceDirectoryImpl.h (+57/-0)
src/usermetricsservice/aa-exec.cpp (+56/-0)
src/usermetricsservice/database/DataSet.cpp (+0/-83)
src/usermetricsservice/database/DataSet.h (+0/-93)
src/usermetricsservice/database/DataSource.cpp (+0/-142)
src/usermetricsservice/database/DataSource.h (+0/-139)
src/usermetricsservice/database/UserData.cpp (+0/-56)
src/usermetricsservice/database/UserData.h (+0/-61)
src/usermetricsservice/main.cpp (+12/-63)
tests/CMakeLists.txt (+4/-1)
tests/data/infographics/test-aggregate.json (+13/-0)
tests/data/infographics/test-iterate.json (+9/-0)
tests/data/valgrind.suppression (+94/-0)
tests/integration/CMakeLists.txt (+0/-2)
tests/integration/libusermetricsinput/CMakeLists.txt (+0/-23)
tests/integration/libusermetricsinput/TestMetricManager.cpp (+0/-52)
tests/integration/libusermetricsoutput/CMakeLists.txt (+0/-23)
tests/integration/libusermetricsoutput/TestUserMetrics.cpp (+0/-46)
tests/testutils/CMakeLists.txt (+0/-2)
tests/testutils/DBusTest.cpp (+0/-50)
tests/testutils/DBusTest.h (+0/-49)
tests/testutils/main.cpp (+1/-1)
tests/unit/libusermetricsinput/CMakeLists.txt (+1/-0)
tests/unit/libusermetricsinput/Mocks.h (+51/-0)
tests/unit/libusermetricsinput/TestMetricImpl.cpp (+412/-0)
tests/unit/libusermetricsinput/TestMetricManagerImpl.cpp (+127/-322)
tests/unit/libusermetricsinput/TestUserMetricInputCAPI.cpp (+57/-57)
tests/unit/libusermetricsoutput/CMakeLists.txt (+1/-1)
tests/unit/libusermetricsoutput/TestInfographicListImpl.cpp (+121/-0)
tests/unit/libusermetricsoutput/TestSyncedUserMetricsStore.cpp (+0/-426)
tests/unit/qml/CMakeLists.txt (+9/-1)
tests/unit/qml/UserMetricsTest/DBusQuery.cpp (+42/-47)
tests/unit/qml/UserMetricsTest/DBusQuery.h (+0/-4)
tests/unit/qml/UserMetricsTest/TestPlugin.cpp (+7/-0)
tests/unit/qml/tst_Metrics.qml (+13/-2)
tests/unit/usermetricsservice/CMakeLists.txt (+3/-3)
tests/unit/usermetricsservice/Mocks.h (+84/-0)
tests/unit/usermetricsservice/TestAuthentication.cpp (+0/-62)
tests/unit/usermetricsservice/TestInfographicImpl.cpp (+124/-0)
tests/unit/usermetricsservice/TestServiceImpl.cpp (+149/-0)
tests/unit/usermetricsservice/TestUserMetricsService.cpp (+0/-807)
To merge this branch: bzr merge lp:~unity-team/libusermetrics/file-based-infographics
Reviewer Review Type Date Requested Status
Antti Kaijanmäki (community) Approve
Michał Sawicz Needs Information
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+214020@code.launchpad.net

Commit message

Wait until the Unity8 branch for the UI is ready

Description of the change

Wait until the Unity8 branch for the UI is ready

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
152. By Pete Woods

Merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
153. By Pete Woods

Fix symbols file

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
154. By Pete Woods

Add new plug-in for unity8 shell to use

155. By Pete Woods

Use the correct subdirectory

156. By Pete Woods

Linewrap the control file

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
157. By Pete Woods

Use Qt5 by default

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
158. By Pete Woods

Add missing dependency

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
159. By Pete Woods

Avoid using new style connect method to (hopefully) fix test failures on ppc64 and arm64

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
160. By Pete Woods

I forgot the parameters to the signals

161. By Pete Woods

Enable -fPIE for all executables

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
162. By Ricardo Salveti

Merging trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
163. By Pete Woods

Additional documentation

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
164. By Pete Woods

Start on dbus started, like everyone else

165. By Pete Woods

Clean up the QML plugin

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
166. By Pete Woods

Derive the infographic confinement profile from the application ID

167. By Pete Woods

Remove needless logging

168. By Pete Woods

Move hook paths to ~/.local instead of ~/.cache

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
169. By Pete Woods

Add data get method to help UI developers

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
170. By Pete Woods

Merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
171. By Pete Woods

Change output API to expose simple "path" property with "next" method

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
172. By Pete Woods

Make jenkins happy with its non-optimised builds

173. By Pete Woods

Consistent formatting

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
174. By Pete Woods

Make ARM builds on Jenkins happy

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
175. By Pete Woods

Merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
176. By Pete Woods

Merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
177. By Pete Woods

Updated translations

178. By Pete Woods

Support sources provided by normal debian packages

179. By Pete Woods

Add package directories

180. By Pete Woods

Handle relative executable paths

181. By Pete Woods

Extra suppression

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
182. By Pete Woods

Extra method to specify APP_ID manually for non-UAL processes

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Check out bug #1339002, seems to still happen - I disabled "stats on welcome screen" and locked, but they are still shown (even after reboot).

Not sure if the visualizer is here, but a few bugs for it:
- text not centered in the circle
- text is not pluralized correctly ("1 calls made today")

I wonder, (how) do we deal with language changes? I changed my display language, rebooted and infographics are still in English. Not sure if it's missing translations, or whether you're reacting to changed language at all?

review: Needs Information
Revision history for this message
Pete Woods (pete-woods) wrote :

> Check out bug #1339002, seems to still happen - I disabled "stats on welcome
> screen" and locked, but they are still shown (even after reboot).
>
I think unity8 was doing this with the old infographics implementation. Is it possible for me to read a user's settings as the lightdm user? Does unity8 know about this setting already for the user that's being displayed in the greeter?

> Not sure if the visualizer is here, but a few bugs for it:
> - text not centered in the circle
I will have a go at fixing this. SVGs have no concept of vertical centering, so it's hard.

> - text is not pluralized correctly ("1 calls made today")
This is because gettext doesn't support non-whole numbers, and the value is a double. e.g. for uses like "walked 1.1 km today".

> I wonder, (how) do we deal with language changes? I changed my display
> language, rebooted and infographics are still in English. Not sure if it's
> missing translations, or whether you're reacting to changed language at all?
The data source can either provide pre-translated strings (non optimal) or provide gettext translations under a specified domain. I don't think the apps are doing this at present.

All visualisers are basically re-run at user session start.

For custom visualisers that do completely their own wacky thing, it's up to the visualiser to be translatable.

Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

Had a review session with pete. LGTM.

review: Approve

Unmerged revisions

182. By Pete Woods

Extra method to specify APP_ID manually for non-UAL processes

181. By Pete Woods

Extra suppression

180. By Pete Woods

Handle relative executable paths

179. By Pete Woods

Add package directories

178. By Pete Woods

Support sources provided by normal debian packages

177. By Pete Woods

Updated translations

176. By Pete Woods

Merge trunk

175. By Pete Woods

Merge trunk

174. By Pete Woods

Make ARM builds on Jenkins happy

173. By Pete Woods

Consistent formatting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2013-09-26 09:12:58 +0000
+++ CMakeLists.txt 2014-06-25 09:58:07 +0000
@@ -16,15 +16,12 @@
16find_package(Qt5Core REQUIRED)16find_package(Qt5Core REQUIRED)
17include_directories(${Qt5Core_INCLUDE_DIRS})17include_directories(${Qt5Core_INCLUDE_DIRS})
1818
19find_package(Qt5DBus REQUIRED)
20include_directories(${Qt5DBus_INCLUDE_DIRS})
21
19find_package(Qt5Gui REQUIRED)22find_package(Qt5Gui REQUIRED)
20include_directories(${Qt5Gui_INCLUDE_DIRS})23include_directories(${Qt5Gui_INCLUDE_DIRS})
2124
22find_package(Qt5DBus COMPONENTS Qt5DBusMacros REQUIRED)
23include_directories(${Qt5DBus_INCLUDE_DIRS})
24
25find_package(Qt5Sql REQUIRED)
26include_directories(${Qt5Sql_INCLUDE_DIRS})
27
28find_package(Qt5XmlPatterns REQUIRED)25find_package(Qt5XmlPatterns REQUIRED)
29include_directories(${Qt5XmlPatterns_INCLUDE_DIRS})26include_directories(${Qt5XmlPatterns_INCLUDE_DIRS})
3027
@@ -40,16 +37,11 @@
40find_package(Qt5Qml REQUIRED)37find_package(Qt5Qml REQUIRED)
41include_directories(${Qt5Qml_INCLUDE_DIRS})38include_directories(${Qt5Qml_INCLUDE_DIRS})
4239
43pkg_check_modules(QDJANGO_DB REQUIRED qdjango-db REQUIRED)
44include_directories(${QDJANGO_DB_INCLUDE_DIRS})
45
46pkg_check_modules(QTDBUSTEST REQUIRED libqtdbustest-1 REQUIRED)
47include_directories(${QTDBUSTEST_INCLUDE_DIRS})
48
49set(CMAKE_AUTOMOC ON)40set(CMAKE_AUTOMOC ON)
50set(CMAKE_INCLUDE_CURRENT_DIR ON)41set(CMAKE_INCLUDE_CURRENT_DIR ON)
5142
52set(DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data")43set(DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data")
44set(INFOGRAPHIC_SERVICE_XML "${DATA_DIR}/com.canonical.Infographics.xml")
5345
54set(INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")46set(INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
55set(INCLUDE_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")47set(INCLUDE_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
@@ -77,6 +69,7 @@
77 -Wextra69 -Wextra
78 -DLOCALEDIR="${CMAKE_INSTALL_FULL_DATADIR}/locale"70 -DLOCALEDIR="${CMAKE_INSTALL_FULL_DATADIR}/locale"
79)71)
72set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE")
8073
81set(DOXYFILE_SOURCE_DIR "include")74set(DOXYFILE_SOURCE_DIR "include")
82set(DOXYFILE_EXTRA_SOURCES "doc")75set(DOXYFILE_EXTRA_SOURCES "doc")
@@ -98,4 +91,4 @@
98ADD_CUSTOM_TARGET(91ADD_CUSTOM_TARGET(
99 check92 check
100 ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure93 ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure
101)
102\ No newline at end of file94\ No newline at end of file
95)
10396
=== modified file 'cmake/FindValgrind.cmake'
--- cmake/FindValgrind.cmake 2013-09-26 09:12:58 +0000
+++ cmake/FindValgrind.cmake 2014-06-25 09:58:07 +0000
@@ -26,7 +26,7 @@
26)26)
2727
28function(add_valgrind_test NAME EXECUTABLE)28function(add_valgrind_test NAME EXECUTABLE)
29 if(ENABLE_MEMCHECK_OPTION)29 if(ENABLE_MEMCHECK_OPTION AND VALGRIND_PROGRAM)
30 add_test(${NAME} ${VALGRIND_PROGRAM} ${VALGRIND_PROGRAM_OPTIONS} "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}")30 add_test(${NAME} ${VALGRIND_PROGRAM} ${VALGRIND_PROGRAM_OPTIONS} "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}")
31 else()31 else()
32 add_test(${NAME} ${EXECUTABLE})32 add_test(${NAME} ${EXECUTABLE})
3333
=== added file 'cmake/Plugins.cmake'
--- cmake/Plugins.cmake 1970-01-01 00:00:00 +0000
+++ cmake/Plugins.cmake 2014-06-25 09:58:07 +0000
@@ -0,0 +1,102 @@
1find_program(qmlplugindump_exe qmlplugindump)
2
3if(NOT qmlplugindump_exe)
4 msg(FATAL_ERROR "Could not locate qmlplugindump.")
5endif()
6
7function(QUERY_QMAKE VAR RESULT)
8 exec_program(${QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output )
9 if(NOT return_code)
10 file(TO_CMAKE_PATH "${output}" output)
11 set(${RESULT} ${output} PARENT_SCOPE)
12 endif(NOT return_code)
13endfunction(QUERY_QMAKE)
14
15# Creates target for copying and installing qmlfiles
16#
17# export_qmlfiles(plugin sub_path)
18#
19#
20# Target to be created:
21# - plugin-qmlfiles - Copies the qml files (*.qml, *.js, qmldir) into the shadow build folder.
22
23macro(export_qmlfiles PLUGIN)
24 set(one_value_args PLUGIN_SUBPATH PLUGIN_PATH)
25 CMAKE_PARSE_ARGUMENTS(_ARG "" "${one_value_args}" "" ${ARGN})
26
27 file(GLOB QMLFILES
28 *.qml
29 *.js
30 qmldir
31 )
32
33 # copy the qmldir file
34 add_custom_target(${PLUGIN}-qmlfiles ALL
35 COMMAND cp ${QMLFILES} ${CMAKE_CURRENT_BINARY_DIR}
36 DEPENDS ${QMLFILES}
37 )
38
39 if(NOT _ARG_PLUGIN_PATH)
40 # Qt5's cmake does not export QT_IMPORTS_DIR, lets query qmake on our own for now
41 get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
42 query_qmake(QT_INSTALL_QML _ARG_PLUGIN_PATH)
43 endif()
44
45 if(_ARG_PLUGIN_SUBPATH)
46 set(PLUGIN_DESTINATION "${_ARG_PLUGIN_PATH}/${_ARG_PLUGIN_SUBPATH}")
47 else()
48 set(PLUGIN_DESTINATION "${_ARG_PLUGIN_PATH}")
49 endif()
50
51 # install the qmlfiles file.
52 install(FILES ${QMLFILES}
53 DESTINATION ${PLUGIN_DESTINATION}
54 )
55endmacro(export_qmlfiles)
56
57
58# Creates target for generating the qmltypes file for a plugin and installs plugin files
59#
60# export_qmlplugin(plugin version sub_path [TARGETS target1 [target2 ...]])
61#
62# TARGETS additional install targets (eg the plugin shared object)
63#
64# Target to be created:
65# - plugin-qmltypes - Generates the qmltypes file in the shadow build folder.
66
67macro(export_qmlplugin PLUGIN VERSION)
68 set(one_value_args PLUGIN_SUBPATH PLUGIN_PATH)
69 set(multi_value_keywords TARGETS)
70 cmake_parse_arguments(_ARG "" "${one_value_args}" "${multi_value_keywords}" ${ARGN})
71
72 if(NOT _ARG_PLUGIN_PATH)
73 # Qt5's cmake does not export QT_IMPORTS_DIR, lets query qmake on our own for now
74 get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
75 query_qmake(QT_INSTALL_QML _ARG_PLUGIN_PATH)
76 endif()
77
78 if(_ARG_PLUGIN_SUBPATH)
79 set(PLUGIN_DESTINATION "${_ARG_PLUGIN_PATH}/${_ARG_PLUGIN_SUBPATH}")
80 else()
81 set(PLUGIN_DESTINATION "${_ARG_PLUGIN_PATH}")
82 endif()
83
84 # Only try to generate .qmltypes if not cross compiling
85 if(NOT CMAKE_CROSSCOMPILING)
86 # create the plugin.qmltypes file
87 add_custom_target(${PLUGIN}-qmltypes ALL
88 COMMAND ${qmlplugindump_exe} -notrelocatable ${PLUGIN} ${VERSION} ${CMAKE_CURRENT_BINARY_DIR}/../ > ${CMAKE_CURRENT_BINARY_DIR}/plugin.qmltypes
89 )
90 add_dependencies(${PLUGIN}-qmltypes ${PLUGIN}-qmlfiles ${_ARG_TARGETS})
91
92 # install the qmltypes file.
93 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plugin.qmltypes
94 DESTINATION ${PLUGIN_DESTINATION}
95 )
96 endif()
97
98 # install the additional targets
99 install(TARGETS ${_ARG_TARGETS}
100 DESTINATION ${PLUGIN_DESTINATION}
101 )
102endmacro(export_qmlplugin)
0103
=== modified file 'data/CMakeLists.txt'
--- data/CMakeLists.txt 2013-10-22 16:59:17 +0000
+++ data/CMakeLists.txt 2014-06-25 09:58:07 +0000
@@ -14,6 +14,22 @@
14)14)
1515
16###########################16###########################
17# Default infographic
18###########################
19
20configure_file(
21 "default.json.in"
22 "${CMAKE_CURRENT_BINARY_DIR}/default.json" @ONLY
23)
24
25install(
26 FILES
27 "${CMAKE_CURRENT_BINARY_DIR}/default.json"
28 DESTINATION
29 "${CMAKE_INSTALL_DATADIR}/libusermetrics/infographics/"
30)
31
32###########################
17# Policy33# Policy
18###########################34###########################
1935
@@ -24,7 +40,7 @@
2440
25install(41install(
26 FILES42 FILES
27 "com.canonical.UserMetrics.conf"43 "com.canonical.Infographics.conf"
28 DESTINATION ${DBUSCONFDIR}44 DESTINATION ${DBUSCONFDIR}
29)45)
3046
@@ -39,10 +55,7 @@
3955
40install(56install(
41 FILES57 FILES
42 com.canonical.usermetrics.DataSet.xml58 com.canonical.Infographics.xml
43 com.canonical.usermetrics.DataSource.xml
44 com.canonical.usermetrics.UserData.xml
45 com.canonical.UserMetrics.xml
46 DESTINATION ${DBUSIFACEDIR}59 DESTINATION ${DBUSIFACEDIR}
47)60)
4861
@@ -55,18 +68,32 @@
55 "${CMAKE_INSTALL_DATADIR}/dbus-1/system-services/"68 "${CMAKE_INSTALL_DATADIR}/dbus-1/system-services/"
56)69)
5770
58set(USERMETRICS_SERVICE71set(INFOGRAPHICS_SERVICE
59 "${CMAKE_CURRENT_BINARY_DIR}/com.canonical.UserMetrics.service"72 "${CMAKE_CURRENT_BINARY_DIR}/com.canonical.Infographics.service"
60)73)
6174
62configure_file(75configure_file(
63 "com.canonical.UserMetrics.service.in"76 "com.canonical.Infographics.service.in"
64 ${USERMETRICS_SERVICE}77 ${INFOGRAPHICS_SERVICE}
65 @ONLY78 @ONLY
66)79)
6780
68install(81install(
69 FILES82 FILES
70 ${USERMETRICS_SERVICE}83 ${INFOGRAPHICS_SERVICE}
71 DESTINATION ${DBUSSERVICEDIR}84 DESTINATION ${DBUSSERVICEDIR}
72)85)
86
87##############################
88# Usermetrics session service
89##############################
90
91configure_file(
92 "usermetricsservice.conf.in"
93 "${CMAKE_CURRENT_BINARY_DIR}/usermetricsservice.conf" @ONLY
94)
95
96install(
97 FILES "${CMAKE_CURRENT_BINARY_DIR}/usermetricsservice.conf"
98 DESTINATION "${CMAKE_INSTALL_DATADIR}/upstart/sessions"
99)
73100
=== added file 'data/com.canonical.Infographics.conf'
--- data/com.canonical.Infographics.conf 1970-01-01 00:00:00 +0000
+++ data/com.canonical.Infographics.conf 2014-06-25 09:58:07 +0000
@@ -0,0 +1,15 @@
1<!DOCTYPE busconfig PUBLIC
2 "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
3 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
4<busconfig>
5
6 <policy user="usermetrics">
7 <allow own="com.canonical.Infographics"/>
8 </policy>
9
10 <policy context="default">
11 <allow send_destination="com.canonical.Infographics"/>
12 <allow receive_sender="com.canonical.Infographics"/>
13 </policy>
14
15</busconfig>
016
=== added file 'data/com.canonical.Infographics.service.in'
--- data/com.canonical.Infographics.service.in 1970-01-01 00:00:00 +0000
+++ data/com.canonical.Infographics.service.in 2014-06-25 09:58:07 +0000
@@ -0,0 +1,5 @@
1[D-BUS Service]
2Name=com.canonical.Infographics
3Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/libusermetrics/infographicservice
4User=usermetrics
5StandardOutput=syslog
06
=== added file 'data/com.canonical.Infographics.xml'
--- data/com.canonical.Infographics.xml 1970-01-01 00:00:00 +0000
+++ data/com.canonical.Infographics.xml 2014-06-25 09:58:07 +0000
@@ -0,0 +1,14 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<node name="/">
3 <interface name="com.canonical.Infographics">
4 <method name="update">
5 <!-- in -->
6 <arg type="s" name="visualizer" direction="in"/>
7 <arg type="as" name="sources" direction="in"/>
8 <arg type="s" name="file" direction="in"/>
9 </method>
10
11 <method name="clear">
12 </method>
13 </interface>
14</node>
015
=== removed file 'data/com.canonical.UserMetrics.conf'
--- data/com.canonical.UserMetrics.conf 2013-07-01 17:13:45 +0000
+++ data/com.canonical.UserMetrics.conf 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
1<!DOCTYPE busconfig PUBLIC
2 "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
3 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
4<busconfig>
5
6 <policy user="usermetrics">
7 <allow own="com.canonical.UserMetrics"/>
8 </policy>
9
10 <policy context="default">
11 <allow send_destination="com.canonical.UserMetrics"/>
12 <allow receive_sender="com.canonical.UserMetrics"/>
13 </policy>
14
15</busconfig>
16\ No newline at end of file0\ No newline at end of file
171
=== removed file 'data/com.canonical.UserMetrics.service.in'
--- data/com.canonical.UserMetrics.service.in 2013-07-03 13:19:20 +0000
+++ data/com.canonical.UserMetrics.service.in 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
1[D-BUS Service]
2Name=com.canonical.UserMetrics
3Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/libusermetrics/usermetricsservice
4User=usermetrics
5StandardOutput=syslog
60
=== removed file 'data/com.canonical.UserMetrics.xml'
--- data/com.canonical.UserMetrics.xml 2013-10-22 08:53:23 +0000
+++ data/com.canonical.UserMetrics.xml 1970-01-01 00:00:00 +0000
@@ -1,44 +0,0 @@
1<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
2<node>
3 <interface name="com.canonical.UserMetrics">
4
5 <property name="dataSources" type="ao" access="read"/>
6
7 <signal name="dataSourceAdded">
8 <arg name="path" type="o" direction="out"/>
9 </signal>
10
11 <signal name="dataSourceRemoved">
12 <arg name="path" type="o" direction="out"/>
13 </signal>
14
15 <method name="createDataSource">
16 <annotation name="org.qtproject.QtDBus.QtTypeName.In5" value="QVariantMap"/>
17 <arg type="o" direction="out"/>
18 <arg name="name" type="s" direction="in"/>
19 <arg name="formatString" type="s" direction="in"/>
20 <arg name="emptyDataString" type="s" direction="in"/>
21 <arg name="textDomain" type="s" direction="in"/>
22 <arg name="metricType" type="u" direction="in"/>
23 <arg name="options" type="a{sv}" direction="in"/>
24 </method>
25
26 <property name="userDatas" type="ao" access="read"/>
27
28 <signal name="userDataAdded">
29 <arg name="username" type="s" direction="out"/>
30 <arg name="path" type="o" direction="out"/>
31 </signal>
32
33 <signal name="userDataRemoved">
34 <arg name="username" type="s" direction="out"/>
35 <arg name="path" type="o" direction="out"/>
36 </signal>
37
38 <method name="createUserData">
39 <arg type="o" direction="out"/>
40 <arg name="username" type="s" direction="in"/>
41 </method>
42
43 </interface>
44</node>
45\ No newline at end of file0\ No newline at end of file
461
=== removed file 'data/com.canonical.usermetrics.DataSet.xml'
--- data/com.canonical.usermetrics.DataSet.xml 2013-10-22 08:53:23 +0000
+++ data/com.canonical.usermetrics.DataSet.xml 1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
1<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
2<node>
3 <interface name="com.canonical.usermetrics.DataSet">
4 <property name="dataSource" type="o" access="read"/>
5
6 <property name="lastUpdated" type="u" access="read"/>
7
8 <property name="data" type="av" access="read"/>
9
10 <method name="update">
11 <arg name="data" type="av" direction="in"/>
12 </method>
13
14 <method name="increment">
15 <arg name="amount" type="d" direction="in"/>
16 </method>
17
18 <signal name="updated">
19 <arg name="lastUpdated" type="u" direction="out"/>
20 <arg name="data" type="av" direction="out"/>
21 </signal>
22
23 </interface>
24</node>
25\ No newline at end of file0\ No newline at end of file
261
=== removed file 'data/com.canonical.usermetrics.DataSource.xml'
--- data/com.canonical.usermetrics.DataSource.xml 2013-09-03 14:59:00 +0000
+++ data/com.canonical.usermetrics.DataSource.xml 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
1<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
2<node>
3 <interface name="com.canonical.usermetrics.DataSource">
4
5 <property name="name" type="s" access="read"/>
6
7 <property name="formatString" type="s" access="readwrite"/>
8
9
10 <signal name="formatStringChanged">
11 <arg name="formatString" type="s" direction="out"/>
12 </signal>
13
14 <property name="emptyDataString" type="s" access="readwrite"/>
15
16 <signal name="emptyDataStringChanged">
17 <arg name="emptyDataString" type="s" direction="out"/>
18 </signal>
19
20 <property name="textDomain" type="s" access="read"/>
21
22 <signal name="textDomainChanged">
23 <arg name="textDomain" type="s" direction="out"/>
24 </signal>
25
26 <property name="metricType" type="u" access="readwrite"/>
27
28 <signal name="metricTypeChanged">
29 <arg name="metricType" type="u" direction="out"/>
30 </signal>
31
32 <property name="options" type="a{sv}" access="readwrite">
33 <annotation name="org.qtproject.QtDBus.QtTypeName" value="QVariantMap"/>
34 </property>
35
36 <signal name="optionsChanged">
37 <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
38 <arg name="options" type="a{sv}" direction="out"/>
39 </signal>
40
41 </interface>
42</node>
43\ No newline at end of file0\ No newline at end of file
441
=== removed file 'data/com.canonical.usermetrics.UserData.xml'
--- data/com.canonical.usermetrics.UserData.xml 2013-10-22 08:53:23 +0000
+++ data/com.canonical.usermetrics.UserData.xml 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
1<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
2<node>
3 <interface name="com.canonical.usermetrics.UserData">
4
5 <property name="username" type="s" access="read"/>
6
7 <property name="dataSets" type="ao" access="read"/>
8
9 <signal name="dataSetAdded">
10 <arg name="dataSourcePath" type="o" direction="out"/>
11 <arg name="path" type="o" direction="out"/>
12 </signal>
13
14 <signal name="dataSetRemoved">
15 <arg name="dataSourcePath" type="o" direction="out"/>
16 <arg name="path" type="o" direction="out"/>
17 </signal>
18
19 <method name="createDataSet">
20 <arg type="o" direction="out"/>
21 <arg name="dataSource" type="s" direction="in"/>
22 </method>
23
24 </interface>
25</node>
26\ No newline at end of file0\ No newline at end of file
271
=== added file 'data/default.json.in'
--- data/default.json.in 1970-01-01 00:00:00 +0000
+++ data/default.json.in 2014-06-25 09:58:07 +0000
@@ -0,0 +1,9 @@
1{
2 "exec": "@CMAKE_INSTALL_FULL_LIBEXECDIR@/libusermetrics/infographic",
3 "type": "iterate",
4 "input": {
5 "*": [
6 ".*.libusermetrics.json"
7 ]
8 }
9}
010
=== added directory 'data/libusermetrics/infographics'
=== added directory 'data/libusermetrics/sources'
=== added file 'data/usermetricsservice.conf.in'
--- data/usermetricsservice.conf.in 1970-01-01 00:00:00 +0000
+++ data/usermetricsservice.conf.in 2014-06-25 09:58:07 +0000
@@ -0,0 +1,10 @@
1description "Service to connect infographic data sources to infographic visualizations"
2
3start on started dbus
4stop on desktop-end
5
6respawn
7respawn limit 5 10
8
9exec @CMAKE_INSTALL_FULL_LIBEXECDIR@/libusermetrics/usermetricsservice
10
011
=== modified file 'debian/changelog'
--- debian/changelog 2014-05-09 20:44:25 +0000
+++ debian/changelog 2014-06-25 09:58:07 +0000
@@ -1,3 +1,10 @@
1libusermetrics (1.2.0-0ubuntu1) UNRELEASED; urgency=medium
2
3 * Remove the usermetrics database and store metrics in json files
4 inside the ~/.cache directory.
5
6 -- Pete Woods <pete.woods@canonical.com> Mon, 06 Jan 2014 09:36:20 +0000
7
1libusermetrics (1.1.1+14.04.20140305-0ubuntu4) utopic; urgency=medium8libusermetrics (1.1.1+14.04.20140305-0ubuntu4) utopic; urgency=medium
29
3 * Disable valgrind on powerpc10 * Disable valgrind on powerpc
411
=== modified file 'debian/control'
--- debian/control 2014-05-09 20:44:13 +0000
+++ debian/control 2014-06-25 09:58:07 +0000
@@ -1,7 +1,8 @@
1Source: libusermetrics1Source: libusermetrics
2Priority: optional2Priority: optional
3Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>3Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
4Build-Depends: cmake,4Build-Depends: click-dev (>= 0.2.2),
5 cmake,
5 dbus,6 dbus,
6 debhelper (>= 9),7 debhelper (>= 9),
7 doxygen,8 doxygen,
@@ -10,18 +11,17 @@
10 libapparmor-dev,11 libapparmor-dev,
11 libgsettings-qt-dev,12 libgsettings-qt-dev,
12 libgtest-dev,13 libgtest-dev,
13 libqdjango-dev,
14 libqt5sql5-sqlite,
15 libqt5xmlpatterns5-dev,14 libqt5xmlpatterns5-dev,
16 libqtdbustest1-dev,15 libqtdbustest1-dev,
17 pkg-config,16 pkg-config,
17 qt5-default,
18 qtbase5-dev,18 qtbase5-dev,
19 sqlite3,19 qtdeclarative5-dev-tools,
20 valgrind [!arm64 !powerpc !ppc64el],20 valgrind [!arm64 !powerpc !ppc64el],
21 qtdeclarative5-dev,21 qtdeclarative5-dev,
22 qtdeclarative5-qtquick2-plugin,22 qtdeclarative5-qtquick2-plugin,
23 qtdeclarative5-test-plugin,23 qtdeclarative5-test-plugin,
24Standards-Version: 3.9.424Standards-Version: 3.9.5
25Section: libs25Section: libs
26Homepage: http://launchpad.net/libusermetrics26Homepage: http://launchpad.net/libusermetrics
27# If you aren't a member of ~unity-team but need to upload packaging changes,27# If you aren't a member of ~unity-team but need to upload packaging changes,
@@ -103,5 +103,16 @@
103 ${shlibs:Depends},103 ${shlibs:Depends},
104 qtdeclarative5-qtquick2-plugin,104 qtdeclarative5-qtquick2-plugin,
105 libusermetricsinput1 (= ${binary:Version}),105 libusermetricsinput1 (= ${binary:Version}),
106Description: QML bindings for libusermetrics106Description: QML bindings for libusermetricsinput
107 A set of bindings allowing the use of libusermetrics from QML applications.107 A set of bindings allowing the use of libusermetricsinput from
108 QML applications.
109
110Package: qtdeclarative5-infographics0.1
111Architecture: any
112Depends: ${misc:Depends},
113 ${shlibs:Depends},
114 qtdeclarative5-qtquick2-plugin,
115 libusermetricsoutput1 (= ${binary:Version}),
116Description: QML bindings for libusermetricsoutput
117 A set of bindings allowing the use of libusermetricsoutput from
118 QML applications.
108\ No newline at end of file119\ No newline at end of file
109120
=== modified file 'debian/libusermetricsinput1.symbols'
--- debian/libusermetricsinput1.symbols 2013-09-04 13:44:30 +0000
+++ debian/libusermetricsinput1.symbols 2014-06-25 09:58:07 +0000
@@ -5,6 +5,7 @@
5 (c++)"UserMetricsInput::MetricUpdate::~MetricUpdate()@Base" 1.0.15 (c++)"UserMetricsInput::MetricUpdate::~MetricUpdate()@Base" 1.0.1
6 (c++)"UserMetricsInput::MetricUpdate::~MetricUpdate()@Base" 1.0.16 (c++)"UserMetricsInput::MetricUpdate::~MetricUpdate()@Base" 1.0.1
7 (c++)"UserMetricsInput::MetricManager::getInstance()@Base" 1.0.17 (c++)"UserMetricsInput::MetricManager::getInstance()@Base" 1.0.1
8 (c++)"UserMetricsInput::MetricManager::getInstance(QString const&)@Base" 0replaceme
8 (c++)"UserMetricsInput::MetricManager::MetricManager(QObject*)@Base" 1.0.19 (c++)"UserMetricsInput::MetricManager::MetricManager(QObject*)@Base" 1.0.1
9 (c++)"UserMetricsInput::MetricManager::MetricManager(QObject*)@Base" 1.0.110 (c++)"UserMetricsInput::MetricManager::MetricManager(QObject*)@Base" 1.0.1
10 (c++)"UserMetricsInput::MetricManager::~MetricManager()@Base" 1.0.111 (c++)"UserMetricsInput::MetricManager::~MetricManager()@Base" 1.0.1
@@ -17,15 +18,25 @@
17 (c++)"UserMetricsInput::MetricParameters::maximum(double)@Base" 1.1.118 (c++)"UserMetricsInput::MetricParameters::maximum(double)@Base" 1.1.1
18 (c++)"UserMetricsInput::MetricParameters::minimum(double)@Base" 1.1.119 (c++)"UserMetricsInput::MetricParameters::minimum(double)@Base" 1.1.1
19 (c++)"UserMetricsInput::MetricParameters::MetricParameters(QString const&)@Base" 1.1.120 (c++)"UserMetricsInput::MetricParameters::MetricParameters(QString const&)@Base" 1.1.1
21 (c++)"UserMetricsInput::MetricParameters::MetricParameters(UserMetricsInput::MetricParameters const&)@Base" 0replaceme
20 (c++)"UserMetricsInput::MetricParameters::MetricParameters(QString const&)@Base" 1.1.122 (c++)"UserMetricsInput::MetricParameters::MetricParameters(QString const&)@Base" 1.1.1
21 (c++)"UserMetricsInput::MetricParameters::~MetricParameters()@Base" 1.1.123 (c++)"UserMetricsInput::MetricParameters::MetricParameters(UserMetricsInput::MetricParameters const&)@Base" 0replaceme
22 (c++)"UserMetricsInput::MetricParameters::~MetricParameters()@Base" 1.1.124 (c++)"UserMetricsInput::MetricParameters::~MetricParameters()@Base" 1.1.1
23 (c++)"UserMetricsInput::MetricParameters::~MetricParameters()@Base" 1.1.125 (c++)"UserMetricsInput::MetricParameters::~MetricParameters()@Base" 1.1.1
24 (c++)"UserMetricsInput::Metric::Metric(QObject*)@Base" 1.0.126 (c++)"UserMetricsInput::MetricParameters::~MetricParameters()@Base" 1.1.1
25 (c++)"UserMetricsInput::Metric::Metric(QObject*)@Base" 1.0.127 (c++)"UserMetricsInput::MetricParameters::operator=(UserMetricsInput::MetricParameters const&)@Base" 0replaceme
26 (c++)"UserMetricsInput::Metric::~Metric()@Base" 1.0.128 (c++)"UserMetricsInput::Metric::Metric(QObject*)@Base" 1.0.1
27 (c++)"UserMetricsInput::Metric::~Metric()@Base" 1.0.129 (c++)"UserMetricsInput::Metric::Metric(QObject*)@Base" 1.0.1
28 (c++)"UserMetricsInput::Metric::~Metric()@Base" 1.0.130 (c++)"UserMetricsInput::Metric::~Metric()@Base" 1.0.1
31 (c++)"UserMetricsInput::Metric::~Metric()@Base" 1.0.1
32 (c++)"UserMetricsInput::Metric::~Metric()@Base" 1.0.1
33 (c++)"UserMetricsInput::MetricParameters::textDomain() const@Base" 0replaceme
34 (c++)"UserMetricsInput::MetricParameters::formatString() const@Base" 0replaceme
35 (c++)"UserMetricsInput::MetricParameters::emptyDataString() const@Base" 0replaceme
36 (c++)"UserMetricsInput::MetricParameters::id() const@Base" 0replaceme
37 (c++)"UserMetricsInput::MetricParameters::type() const@Base" 0replaceme
38 (c++)"UserMetricsInput::MetricParameters::options() const@Base" 0replaceme
39 (c++)"UserMetricsInput::MetricParameters::operator==(UserMetricsInput::MetricParameters const&) const@Base" 0replaceme
29 (c++)"typeinfo for UserMetricsInput::MetricUpdate@Base" 1.0.140 (c++)"typeinfo for UserMetricsInput::MetricUpdate@Base" 1.0.1
30 (c++)"typeinfo for UserMetricsInput::MetricManager@Base" 1.0.141 (c++)"typeinfo for UserMetricsInput::MetricManager@Base" 1.0.1
31 (c++)"typeinfo for UserMetricsInput::MetricParameters@Base" 1.1.142 (c++)"typeinfo for UserMetricsInput::MetricParameters@Base" 1.1.1
3243
=== modified file 'debian/libusermetricsoutput1.symbols'
--- debian/libusermetricsoutput1.symbols 2013-06-20 15:59:31 +0000
+++ debian/libusermetricsoutput1.symbols 2014-06-25 09:58:07 +0000
@@ -34,11 +34,29 @@
34 (c++)"UserMetricsOutput::UserMetrics::~UserMetrics()@Base" 1.0.134 (c++)"UserMetricsOutput::UserMetrics::~UserMetrics()@Base" 1.0.1
35 (c++)"UserMetricsOutput::UserMetrics::~UserMetrics()@Base" 1.0.135 (c++)"UserMetricsOutput::UserMetrics::~UserMetrics()@Base" 1.0.1
36 (c++)"UserMetricsOutput::UserMetrics::~UserMetrics()@Base" 1.0.136 (c++)"UserMetricsOutput::UserMetrics::~UserMetrics()@Base" 1.0.1
37 (c++)"UserMetricsOutput::InfographicList::uidChanged(unsigned int)@Base" 0replaceme
38 (c++)"UserMetricsOutput::InfographicList::pathChanged(QString const&)@Base" 0replaceme
39 (c++)"UserMetricsOutput::InfographicList::getInstance(QString const&)@Base" 0replaceme
40 (c++)"UserMetricsOutput::InfographicList::qt_metacall(QMetaObject::Call, int, void**)@Base" 0replaceme
41 (c++)"UserMetricsOutput::InfographicList::qt_metacast(char const*)@Base" 0replaceme
42 (c++)"UserMetricsOutput::InfographicList::staticMetaObject@Base" 0replaceme
43 (c++)"UserMetricsOutput::InfographicList::InfographicList(QObject*)@Base" 0replaceme
44 (c++)"UserMetricsOutput::InfographicList::~InfographicList()@Base" 0replaceme
45 (c++)"UserMetricsOutput::InfographicList::metaObject() const@Base" 0replaceme
37 (c++)"UserMetricsOutput::ColorTheme::metaObject() const@Base" 1.0.146 (c++)"UserMetricsOutput::ColorTheme::metaObject() const@Base" 1.0.1
38 (c++)"UserMetricsOutput::UserMetrics::metaObject() const@Base" 1.0.147 (c++)"UserMetricsOutput::UserMetrics::metaObject() const@Base" 1.0.1
48 (c++|optional)"std::_Rb_tree<QString, std::pair<QString const, QString>, std::_Select1st<std::pair<QString const, QString> >, std::less<QString>, std::allocator<std::pair<QString const, QString> > >::equal_range(QString const&)@Base" 0replaceme
49 (c++|optional)"std::_Rb_tree<QString, std::pair<QString const, QString>, std::_Select1st<std::pair<QString const, QString> >, std::less<QString>, std::allocator<std::pair<QString const, QString> > >::find(QString const&)@Base" 0replaceme
50 (c++|optional)"std::_Rb_tree<QString, std::pair<QString const, QString>, std::_Select1st<std::pair<QString const, QString> >, std::less<QString>, std::allocator<std::pair<QString const, QString> > >::erase(QString const&)@Base" 0replaceme
51 (c++|optional)"std::_Rb_tree<QString, std::pair<QString const, QString>, std::_Select1st<std::pair<QString const, QString> >, std::less<QString>, std::allocator<std::pair<QString const, QString> > >::_M_erase(std::_Rb_tree_node<std::pair<QString const, QString> >*)@Base" 0replaceme
52 (c++|optional)"std::_Rb_tree<QString, std::pair<QString const, QString>, std::_Select1st<std::pair<QString const, QString> >, std::less<QString>, std::allocator<std::pair<QString const, QString> > >::_M_erase_aux(std::_Rb_tree_const_iterator<std::pair<QString const, QString> >, std::_Rb_tree_const_iterator<std::pair<QString const, QString> >)@Base" 0replaceme
53 (c++|optional)"std::_Rb_tree_iterator<std::pair<QString const, QString> > std::_Rb_tree<QString, std::pair<QString const, QString>, std::_Select1st<std::pair<QString const, QString> >, std::less<QString>, std::allocator<std::pair<QString const, QString> > >::_M_insert_<std::pair<QString, QString> >(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<QString, QString>&&)@Base" 0replaceme
39 (c++)"typeinfo for UserMetricsOutput::ColorTheme@Base" 1.0.154 (c++)"typeinfo for UserMetricsOutput::ColorTheme@Base" 1.0.1
40 (c++)"typeinfo for UserMetricsOutput::UserMetrics@Base" 1.0.155 (c++)"typeinfo for UserMetricsOutput::UserMetrics@Base" 1.0.1
41 (c++)"typeinfo name for UserMetricsOutput::ColorTheme@Base" 1.0.156 (c++)"typeinfo name for UserMetricsOutput::ColorTheme@Base" 1.0.1
42 (c++)"typeinfo name for UserMetricsOutput::UserMetrics@Base" 1.0.157 (c++)"typeinfo name for UserMetricsOutput::UserMetrics@Base" 1.0.1
58 (c++)"typeinfo for UserMetricsOutput::InfographicList@Base" 0replaceme
59 (c++)"typeinfo name for UserMetricsOutput::InfographicList@Base" 0replaceme
43 (c++)"vtable for UserMetricsOutput::ColorTheme@Base" 1.0.160 (c++)"vtable for UserMetricsOutput::ColorTheme@Base" 1.0.1
61 (c++)"vtable for UserMetricsOutput::InfographicList@Base" 0replaceme
44 (c++)"vtable for UserMetricsOutput::UserMetrics@Base" 1.0.162 (c++)"vtable for UserMetricsOutput::UserMetrics@Base" 1.0.1
4563
=== added file 'debian/qtdeclarative5-infographics0.1.install'
--- debian/qtdeclarative5-infographics0.1.install 1970-01-01 00:00:00 +0000
+++ debian/qtdeclarative5-infographics0.1.install 2014-06-25 09:58:07 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/unity8/qml/Infographics/*
02
=== modified file 'debian/rules'
--- debian/rules 2014-05-09 20:44:13 +0000
+++ debian/rules 2014-06-25 09:58:07 +0000
@@ -8,14 +8,18 @@
8ifneq (,$(filter $(DEB_HOST_ARCH),armhf ppc64el powerpc arm64))8ifneq (,$(filter $(DEB_HOST_ARCH),armhf ppc64el powerpc arm64))
9 ENABLE_MEMCHECK_OPTION = OFF9 ENABLE_MEMCHECK_OPTION = OFF
10else10else
11 ENABLE_MEMCHECK_OPTION = ON11 ENABLE_MEMCHECK_OPTION = OFF
12endif12endif
1313
14%:14%:
15 dh $@ --parallel --fail-missing15 dh $@ --parallel --fail-missing --with click
1616
17override_dh_auto_configure:17override_dh_auto_configure:
18 dh_auto_configure -- -DBUILD_DOXYGEN=YES -DENABLE_MEMCHECK_OPTION=${ENABLE_MEMCHECK_OPTION}18 dh_auto_configure -- -DBUILD_DOXYGEN=YES -DENABLE_MEMCHECK_OPTION=${ENABLE_MEMCHECK_OPTION}
1919
20override_dh_makeshlibs:20override_dh_makeshlibs:
21 dh_makeshlibs -V21 dh_makeshlibs -V
22
23override_dh_click:
24 dh_click --name infographic
25 dh_click --name usermetrics
2226
=== added file 'debian/usermetricsservice.infographic.click-hook'
--- debian/usermetricsservice.infographic.click-hook 1970-01-01 00:00:00 +0000
+++ debian/usermetricsservice.infographic.click-hook 2014-06-25 09:58:07 +0000
@@ -0,0 +1,3 @@
1Pattern: ${home}/.local/share/libusermetrics/infographics/${id}.json
2User-Level: yes
3Hook-Name: infographic
04
=== modified file 'debian/usermetricsservice.install'
--- debian/usermetricsservice.install 2013-09-26 09:12:58 +0000
+++ debian/usermetricsservice.install 2014-06-25 09:58:07 +0000
@@ -4,3 +4,4 @@
4usr/share/glib-2.04usr/share/glib-2.0
5usr/share/libusermetrics5usr/share/libusermetrics
6usr/share/locale6usr/share/locale
7usr/share/upstart
78
=== added file 'debian/usermetricsservice.postinst'
--- debian/usermetricsservice.postinst 1970-01-01 00:00:00 +0000
+++ debian/usermetricsservice.postinst 2014-06-25 09:58:07 +0000
@@ -0,0 +1,16 @@
1#!/bin/sh
2
3set -e
4
5. /usr/share/debconf/confmodule
6
7dbus-send --system --print-reply \
8 --dest=org.freedesktop.DBus \
9 /org/freedesktop/DBus \
10 org.freedesktop.DBus.StartServiceByName \
11 string:"com.canonical.Infographics" uint32:0 \
12 || true
13
14#DEBHELPER#
15
16exit 0
017
=== removed file 'debian/usermetricsservice.postinst'
--- debian/usermetricsservice.postinst 2013-08-15 23:52:14 +0000
+++ debian/usermetricsservice.postinst 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
1#!/bin/sh
2
3set -e
4
5. /usr/share/debconf/confmodule
6
7dbus-send --system --print-reply \
8 --dest=org.freedesktop.DBus \
9 /org/freedesktop/DBus \
10 org.freedesktop.DBus.StartServiceByName \
11 string:"com.canonical.UserMetrics" uint32:0 \
12 || true
13
14#DEBHELPER#
15
16exit 0
170
=== added file 'debian/usermetricsservice.postrm'
--- debian/usermetricsservice.postrm 1970-01-01 00:00:00 +0000
+++ debian/usermetricsservice.postrm 2014-06-25 09:58:07 +0000
@@ -0,0 +1,26 @@
1#!/bin/sh
2set -e
3
4if [ "$1" = "purge" ] ; then
5 if getent passwd usermetrics >/dev/null; then
6 if [ -x /usr/sbin/deluser ]; then
7 deluser --system usermetrics
8 fi
9 fi
10
11 if getent group usermetrics >/dev/null; then
12 if [ -x /usr/sbin/delgroup ]; then
13 delgroup --system usermetrics
14 fi
15 fi
16
17 # we cannot use the --remove-home option when we delete the user above
18 # because it will refuse to remove things in /var, so clean it up this
19 # way
20 if [ -d /var/lib/usermetrics ]; then
21 rm -r /var/lib/usermetrics
22 fi
23
24fi
25#DEBHELPER#
26exit 0
027
=== removed file 'debian/usermetricsservice.postrm'
--- debian/usermetricsservice.postrm 2013-07-01 17:13:45 +0000
+++ debian/usermetricsservice.postrm 1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
1#!/bin/sh
2set -e
3
4if [ "$1" = "purge" ] ; then
5 if getent passwd usermetrics >/dev/null; then
6 if [ -x /usr/sbin/deluser ]; then
7 deluser --system usermetrics
8 fi
9 fi
10
11 if getent group usermetrics >/dev/null; then
12 if [ -x /usr/sbin/delgroup ]; then
13 delgroup --system usermetrics
14 fi
15 fi
16
17 # we cannot use the --remove-home option when we delete the user above
18 # because it will refuse to remove things in /var, so clean it up this
19 # way
20 if [ -d /var/lib/usermetrics ]; then
21 rm -r /var/lib/usermetrics
22 fi
23
24fi
25#DEBHELPER#
26exit 0
270
=== added file 'debian/usermetricsservice.preinst'
--- debian/usermetricsservice.preinst 1970-01-01 00:00:00 +0000
+++ debian/usermetricsservice.preinst 2014-06-25 09:58:07 +0000
@@ -0,0 +1,30 @@
1#!/bin/sh
2
3set -e
4
5. /usr/share/debconf/confmodule
6
7THIS_PACKAGE=usermetricsservice
8
9# creating usermetrics group if he isn't already there
10if ! getent group usermetrics >/dev/null; then
11 addgroup --system usermetrics
12fi
13
14# creating usermetrics user if he isn't already there
15if ! getent passwd usermetrics >/dev/null; then
16 adduser --system --ingroup usermetrics --home /var/lib/usermetrics usermetrics
17 usermod -c "User Metrics" usermetrics
18 usermod -d "/var/lib/usermetrics" usermetrics
19 usermod -g "usermetrics" usermetrics
20 usermod -s "/bin/false" usermetrics
21fi
22
23if [ -d /var/lib/usermetrics ]; then
24 chown -R usermetrics:usermetrics /var/lib/usermetrics
25 chmod 0755 /var/lib/usermetrics
26fi
27
28#DEBHELPER#
29
30exit 0
031
=== removed file 'debian/usermetricsservice.preinst'
--- debian/usermetricsservice.preinst 2013-08-15 11:05:06 +0000
+++ debian/usermetricsservice.preinst 1970-01-01 00:00:00 +0000
@@ -1,30 +0,0 @@
1#!/bin/sh
2
3set -e
4
5. /usr/share/debconf/confmodule
6
7THIS_PACKAGE=usermetricsservice
8
9# creating usermetrics group if he isn't already there
10if ! getent group usermetrics >/dev/null; then
11 addgroup --system usermetrics
12fi
13
14# creating usermetrics user if he isn't already there
15if ! getent passwd usermetrics >/dev/null; then
16 adduser --system --ingroup usermetrics --home /var/lib/usermetrics usermetrics
17 usermod -c "User Metrics" usermetrics
18 usermod -d "/var/lib/usermetrics" usermetrics
19 usermod -g "usermetrics" usermetrics
20 usermod -s "/bin/false" usermetrics
21fi
22
23if [ -d /var/lib/usermetrics ]; then
24 chown -R usermetrics:usermetrics /var/lib/usermetrics
25 chmod 0750 /var/lib/usermetrics
26fi
27
28#DEBHELPER#
29
30exit 0
310
=== added file 'debian/usermetricsservice.prerm'
--- debian/usermetricsservice.prerm 1970-01-01 00:00:00 +0000
+++ debian/usermetricsservice.prerm 2014-06-25 09:58:07 +0000
@@ -0,0 +1,7 @@
1#!/bin/sh
2
3set -e
4
5pkill -U usermetrics 2>/dev/null || true
6
7#DEBHELPER#
0\ No newline at end of file8\ No newline at end of file
19
=== removed file 'debian/usermetricsservice.prerm'
--- debian/usermetricsservice.prerm 2013-07-03 12:56:40 +0000
+++ debian/usermetricsservice.prerm 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
1#!/bin/sh
2
3set -e
4
5pkill -U usermetrics 2>/dev/null || true
6
7#DEBHELPER#
8\ No newline at end of file0\ No newline at end of file
91
=== added file 'debian/usermetricsservice.usermetrics.click-hook'
--- debian/usermetricsservice.usermetrics.click-hook 1970-01-01 00:00:00 +0000
+++ debian/usermetricsservice.usermetrics.click-hook 2014-06-25 09:58:07 +0000
@@ -0,0 +1,3 @@
1Pattern: ${home}/.local/share/libusermetrics/sources/${id}.json
2User-Level: yes
3Hook-Name: usermetrics
04
=== added file 'doc/Infographic Architecture.svg'
--- doc/Infographic Architecture.svg 1970-01-01 00:00:00 +0000
+++ doc/Infographic Architecture.svg 2014-06-25 09:58:07 +0000
@@ -0,0 +1,636 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4<svg
5 xmlns:dc="http://purl.org/dc/elements/1.1/"
6 xmlns:cc="http://creativecommons.org/ns#"
7 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8 xmlns:svg="http://www.w3.org/2000/svg"
9 xmlns="http://www.w3.org/2000/svg"
10 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12 width="671.98975"
13 height="413.13217"
14 id="svg2"
15 version="1.1"
16 inkscape:version="0.48.4 r9939"
17 sodipodi:docname="infographics version 2.svg">
18 <defs
19 id="defs4">
20 <inkscape:path-effect
21 effect="spiro"
22 id="path-effect4676"
23 is_visible="true" />
24 <marker
25 inkscape:stockid="Arrow1Mend"
26 orient="auto"
27 refY="0"
28 refX="0"
29 id="Arrow1Mend"
30 style="overflow:visible">
31 <path
32 id="path3951"
33 d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
34 style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
35 transform="matrix(-0.4,0,0,-0.4,-4,0)"
36 inkscape:connector-curvature="0" />
37 </marker>
38 <marker
39 inkscape:stockid="Arrow1Mend"
40 orient="auto"
41 refY="0"
42 refX="0"
43 id="Arrow1Mend-3"
44 style="overflow:visible">
45 <path
46 inkscape:connector-curvature="0"
47 id="path3951-3"
48 d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
49 style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
50 transform="matrix(-0.4,0,0,-0.4,-4,0)" />
51 </marker>
52 <marker
53 inkscape:stockid="Arrow1Mend"
54 orient="auto"
55 refY="0"
56 refX="0"
57 id="Arrow1Mend-3-5"
58 style="overflow:visible">
59 <path
60 inkscape:connector-curvature="0"
61 id="path3951-3-8"
62 d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
63 style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
64 transform="matrix(-0.4,0,0,-0.4,-4,0)" />
65 </marker>
66 <inkscape:path-effect
67 effect="spiro"
68 id="path-effect4676-5"
69 is_visible="true" />
70 <marker
71 inkscape:stockid="Arrow1Mend"
72 orient="auto"
73 refY="0"
74 refX="0"
75 id="Arrow1Mend-3-7"
76 style="overflow:visible">
77 <path
78 inkscape:connector-curvature="0"
79 id="path3951-3-2"
80 d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
81 style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
82 transform="matrix(-0.4,0,0,-0.4,-4,0)" />
83 </marker>
84 <marker
85 inkscape:stockid="Arrow1Mend"
86 orient="auto"
87 refY="0"
88 refX="0"
89 id="Arrow1Mend-3-1"
90 style="overflow:visible">
91 <path
92 inkscape:connector-curvature="0"
93 id="path3951-3-5"
94 d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
95 style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
96 transform="matrix(-0.4,0,0,-0.4,-4,0)" />
97 </marker>
98 <marker
99 inkscape:stockid="Arrow1Mend"
100 orient="auto"
101 refY="0"
102 refX="0"
103 id="Arrow1Mend-3-3"
104 style="overflow:visible">
105 <path
106 inkscape:connector-curvature="0"
107 id="path3951-3-4"
108 d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
109 style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
110 transform="matrix(-0.4,0,0,-0.4,-4,0)" />
111 </marker>
112 <marker
113 inkscape:stockid="Arrow1Mend"
114 orient="auto"
115 refY="0"
116 refX="0"
117 id="Arrow1Mend-3-2"
118 style="overflow:visible">
119 <path
120 inkscape:connector-curvature="0"
121 id="path3951-3-80"
122 d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
123 style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
124 transform="matrix(-0.4,0,0,-0.4,-4,0)" />
125 </marker>
126 <marker
127 inkscape:stockid="Arrow1Mend"
128 orient="auto"
129 refY="0"
130 refX="0"
131 id="Arrow1Mend-3-9"
132 style="overflow:visible">
133 <path
134 inkscape:connector-curvature="0"
135 id="path3951-3-1"
136 d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
137 style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
138 transform="matrix(-0.4,0,0,-0.4,-4,0)" />
139 </marker>
140 <marker
141 inkscape:stockid="Arrow1Mend"
142 orient="auto"
143 refY="0"
144 refX="0"
145 id="Arrow1Mend-3-19"
146 style="overflow:visible">
147 <path
148 inkscape:connector-curvature="0"
149 id="path3951-3-3"
150 d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
151 style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
152 transform="matrix(-0.4,0,0,-0.4,-4,0)" />
153 </marker>
154 <marker
155 inkscape:stockid="Arrow1Mend"
156 orient="auto"
157 refY="0"
158 refX="0"
159 id="Arrow1Mend-3-24"
160 style="overflow:visible">
161 <path
162 inkscape:connector-curvature="0"
163 id="path3951-3-7"
164 d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
165 style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
166 transform="matrix(-0.4,0,0,-0.4,-4,0)" />
167 </marker>
168 <inkscape:path-effect
169 effect="spiro"
170 id="path-effect4676-6"
171 is_visible="true" />
172 </defs>
173 <sodipodi:namedview
174 id="base"
175 pagecolor="#ffffff"
176 bordercolor="#666666"
177 borderopacity="1.0"
178 inkscape:pageopacity="0.0"
179 inkscape:pageshadow="2"
180 inkscape:zoom="1.7277049"
181 inkscape:cx="335.99487"
182 inkscape:cy="206.56609"
183 inkscape:document-units="px"
184 inkscape:current-layer="layer1"
185 showgrid="false"
186 showguides="false"
187 inkscape:window-width="1680"
188 inkscape:window-height="1026"
189 inkscape:window-x="0"
190 inkscape:window-y="24"
191 inkscape:window-maximized="1"
192 fit-margin-top="20"
193 fit-margin-left="20"
194 fit-margin-right="20"
195 fit-margin-bottom="20" />
196 <metadata
197 id="metadata7">
198 <rdf:RDF>
199 <cc:Work
200 rdf:about="">
201 <dc:format>image/svg+xml</dc:format>
202 <dc:type
203 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
204 <dc:title />
205 </cc:Work>
206 </rdf:RDF>
207 </metadata>
208 <g
209 inkscape:label="Layer 1"
210 inkscape:groupmode="layer"
211 id="layer1"
212 transform="translate(9.1737344,-608.13043)">
213 <g
214 id="g3761"
215 transform="translate(9.0102463,20.5802)">
216 <rect
217 transform="translate(0,572.36218)"
218 y="170.37543"
219 x="244.09557"
220 height="78.088745"
221 width="133.78838"
222 id="rect2985"
223 style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
224 <text
225 sodipodi:linespacing="100%"
226 id="text3755"
227 y="778.51001"
228 x="310.46051"
229 style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
230 xml:space="preserve"><tspan
231 y="778.51001"
232 x="310.46051"
233 id="tspan3757"
234 sodipodi:role="line">Infographic</tspan><tspan
235 id="tspan3759"
236 y="794.51001"
237 x="310.46051"
238 sodipodi:role="line">Helper</tspan></text>
239 </g>
240 <g
241 id="g3803"
242 transform="translate(-8.12897,0)">
243 <rect
244 style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
245 id="rect3767"
246 width="159.58728"
247 height="87.497849"
248 x="430.33533"
249 y="56.268272"
250 transform="translate(0,572.36218)" />
251 <text
252 xml:space="preserve"
253 style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
254 x="436.38864"
255 y="677.60724"
256 id="text3769"
257 sodipodi:linespacing="100%"><tspan
258 sodipodi:role="line"
259 id="tspan3771"
260 x="436.38864"
261 y="677.60724"
262 style="font-size:14px"
263 dy="-4.9527082">Infographic Source</tspan><tspan
264 sodipodi:role="line"
265 x="436.38864"
266 y="691.60724"
267 id="tspan3773"
268 style="font-size:14px"><tspan
269 style="font-size:14px;font-weight:bold"
270 id="tspan3777"
271 dy="-0.55030096">type:</tspan> foo</tspan><tspan
272 sodipodi:role="line"
273 x="436.38864"
274 y="705.60724"
275 id="tspan3775"
276 dx="0 0 0 0 0 0 0 0 0 0 -1.1006019"
277 style="font-size:14px"><tspan
278 style="font-size:14px;font-weight:bold"
279 id="tspan3779">file:</tspan> infographic.foo</tspan></text>
280 <rect
281 style="color:#000000;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
282 id="rect3767-6"
283 width="159.03699"
284 height="26.414476"
285 x="430.33533"
286 y="628.63043" />
287 <text
288 xml:space="preserve"
289 style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
290 x="442.82819"
291 y="647.92566"
292 id="text3799"
293 sodipodi:linespacing="100%"><tspan
294 sodipodi:role="line"
295 id="tspan3801"
296 x="442.82819"
297 y="647.92566">Foo Click Manifest</tspan></text>
298 </g>
299 <g
300 id="g3918"
301 transform="translate(-360,-2.1289061e-6)">
302 <rect
303 y="628.63043"
304 x="418.20636"
305 height="87.497849"
306 width="159.58728"
307 id="rect3767-7"
308 style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
309 <text
310 sodipodi:linespacing="100%"
311 id="text3769-5"
312 y="677.60724"
313 x="424.25967"
314 style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
315 xml:space="preserve"><tspan
316 dy="-4.9527082"
317 style="font-size:14px"
318 y="677.60724"
319 x="424.25967"
320 id="tspan3771-4"
321 sodipodi:role="line">Infographic Sink</tspan><tspan
322 style="font-size:14px"
323 id="tspan3773-2"
324 y="691.60724"
325 x="424.25967"
326 sodipodi:role="line"><tspan
327 dy="-0.55030096"
328 id="tspan3777-3"
329 style="font-size:14px;font-weight:bold">type:</tspan> foo</tspan><tspan
330 style="font-size:14px"
331 dx="0 0 0 0 0 0 0 0 0 0 -1.1006019"
332 id="tspan3775-4"
333 y="705.60724"
334 x="424.25967"
335 sodipodi:role="line"><tspan
336 id="tspan3779-2"
337 style="font-size:14px;font-weight:bold">file:</tspan> infographic.svg</tspan></text>
338 <rect
339 y="628.63043"
340 x="418.20636"
341 height="26.414476"
342 width="159.03699"
343 id="rect3767-6-7"
344 style="color:#000000;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
345 <text
346 sodipodi:linespacing="100%"
347 id="text3799-8"
348 y="647.92566"
349 x="431.91797"
350 style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
351 xml:space="preserve"><tspan
352 y="647.92566"
353 x="431.91797"
354 id="tspan3801-6"
355 sodipodi:role="line">Bar Click Manifest</tspan></text>
356 </g>
357 <text
358 sodipodi:linespacing="100%"
359 id="text3930"
360 y="701.8205"
361 x="319.61853"
362 style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
363 xml:space="preserve"><tspan
364 y="701.8205"
365 x="319.61853"
366 id="tspan3932"
367 sodipodi:role="line">Install</tspan><tspan
368 id="tspan3934"
369 y="717.8205"
370 x="319.61853"
371 sodipodi:role="line">Hooks</tspan></text>
372 <path
373 inkscape:connector-curvature="0"
374 id="path3936"
375 d="m 226.17369,685.31145 c 45.12468,-1.1006 52.27859,36.31986 52.82889,67.13671"
376 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Mend)" />
377 <path
378 inkscape:connector-curvature="0"
379 id="path3936-1"
380 d="m 414.31778,685.49855 c -45.12468,-1.10061 -52.27859,36.31985 -52.82889,67.13671"
381 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Mend)" />
382 <g
383 id="g4893">
384 <rect
385 style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
386 id="rect4425"
387 width="95.752365"
388 height="95.752365"
389 x="441.74377"
390 y="751.89789" />
391 <text
392 xml:space="preserve"
393 style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
394 x="489.69073"
395 y="796.50208"
396 id="text4427"
397 sodipodi:linespacing="100%"><tspan
398 sodipodi:role="line"
399 id="tspan4429"
400 x="489.69073"
401 y="796.50208">foo</tspan><tspan
402 sodipodi:role="line"
403 x="489.69073"
404 y="812.50208"
405 id="tspan4431">app</tspan></text>
406 </g>
407 <g
408 id="g4469"
409 transform="translate(-13.207223,24.763543)">
410 <rect
411 y="887.29889"
412 x="403.61313"
413 height="35.715553"
414 width="192.67056"
415 id="rect2985-1"
416 style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
417 <text
418 sodipodi:linespacing="100%"
419 id="text3755-5"
420 y="908.72668"
421 x="500.00146"
422 style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
423 xml:space="preserve"><tspan
424 id="tspan3759-8"
425 y="908.72668"
426 x="500.00146"
427 sodipodi:role="line">~/.cache/$(appid)/infographic.foo</tspan></text>
428 </g>
429 <path
430 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Mend-3)"
431 d="M 383.55976,356.18229 C 353.84351,354.53139 348.8908,331.96904 347.7902,280.79106"
432 id="path4474"
433 inkscape:connector-curvature="0"
434 transform="translate(0,572.36218)"
435 sodipodi:nodetypes="cc" />
436 <text
437 xml:space="preserve"
438 style="font-size:14px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu Italic"
439 x="361.54773"
440 y="876.81616"
441 id="text4660"
442 sodipodi:linespacing="100%"><tspan
443 sodipodi:role="line"
444 id="tspan4662"
445 x="361.54773"
446 y="876.81616">File</tspan><tspan
447 sodipodi:role="line"
448 x="361.54773"
449 y="890.81616"
450 id="tspan4664">Watch</tspan></text>
451 <text
452 xml:space="preserve"
453 style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:112.00000047999999708%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;opacity:0.75"
454 x="571.7627"
455 y="755.19965"
456 id="text4666"
457 sodipodi:linespacing="112%"><tspan
458 sodipodi:role="line"
459 id="tspan4668"
460 x="571.7627"
461 y="755.19965">Foo</tspan><tspan
462 sodipodi:role="line"
463 x="571.7627"
464 y="768.63965"
465 id="tspan4670">AppArmor</tspan><tspan
466 sodipodi:role="line"
467 x="571.7627"
468 y="782.07965"
469 id="tspan4672">Confinement</tspan></text>
470 <path
471 style="opacity:0.75;fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Mend-3)"
472 d="m 567.36028,192.74291 c -2.53774,-0.0622 -5.08926,0.61223 -7.26478,1.92031 -0.81305,0.48887 -1.57239,1.06245 -2.381,1.55863 -0.8086,0.49619 -1.68153,0.91914 -2.61893,1.06514 -1.39269,0.2169 -2.80076,-0.19097 -4.13805,-0.63627 -1.33729,-0.44531 -2.69883,-0.93906 -4.10774,-0.89876 -1.25072,0.0358 -2.44503,0.49048 -3.65682,0.80213 -0.33784,0.0869 -0.67847,0.16288 -1.0212,0.22784"
473 id="path4674"
474 inkscape:path-effect="#path-effect4676"
475 inkscape:original-d="m 567.36028,192.74291 c -2.05099,4.0056 -2.57986,1.777 -7.26478,1.92031 -10.78275,0 -8.1675,12.44489 -4.99993,2.62377 3.3427,-11.96353 -5.33958,-3.07508 -8.24579,-1.53503 -2.9062,1.54005 -3.37007,1.24208 -3.65682,0.80213 -0.28674,-0.43995 -0.39635,-1.02187 -1.0212,0.22784"
476 inkscape:connector-curvature="0"
477 transform="translate(0,572.36218)"
478 sodipodi:nodetypes="ccczsc" />
479 <g
480 transform="translate(-341.88525,60.753484)"
481 id="g4893-5">
482 <rect
483 style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
484 id="rect4425-0"
485 width="95.752365"
486 height="95.752365"
487 x="441.74377"
488 y="751.89789" />
489 <text
490 xml:space="preserve"
491 style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
492 x="489.69073"
493 y="796.50208"
494 id="text4427-5"
495 sodipodi:linespacing="100%"><tspan
496 sodipodi:role="line"
497 id="tspan4429-8"
498 x="489.69073"
499 y="796.50208">bar</tspan><tspan
500 sodipodi:role="line"
501 x="489.69073"
502 y="812.50208"
503 id="tspan4929">visual</tspan></text>
504 </g>
505 <text
506 xml:space="preserve"
507 style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:112.00000047999999708%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;opacity:0.75"
508 x="10.730266"
509 y="836.82312"
510 id="text4666-3"
511 sodipodi:linespacing="112%"><tspan
512 sodipodi:role="line"
513 id="tspan4668-4"
514 x="10.730266"
515 y="836.82312">Bar</tspan><tspan
516 sodipodi:role="line"
517 x="10.730266"
518 y="850.26312"
519 id="tspan4670-0">AppArmor</tspan><tspan
520 sodipodi:role="line"
521 x="10.730266"
522 y="863.70312"
523 id="tspan4672-9">Confinement</tspan></text>
524 <path
525 style="color:#000000;fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-end:url(#Arrow1Mend-3);visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
526 d="m 118.51852,723.61908 c 0,0 0,-0.55125 0,78.82859"
527 id="path4987"
528 inkscape:connector-curvature="0" />
529 <path
530 style="color:#000000;fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-end:url(#Arrow1Mend-3);visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
531 d="m 490.06029,150.90439 c 0,22.60121 0,22.60121 0,22.60121"
532 id="path4989"
533 inkscape:connector-curvature="0"
534 transform="translate(0,572.36218)" />
535 <path
536 style="color:#000000;fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-end:url(#Arrow1Mend-3);visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
537 d="m 466.90784,282.65289 c 0,47.95865 0,47.95865 0,47.95865"
538 id="path4991"
539 inkscape:connector-curvature="0"
540 transform="translate(0,572.36218)" />
541 <path
542 style="color:#000000;fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-end:url(#Arrow1Mend-3);visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
543 d="m 206.1671,306.90784 c 36.38243,1.1025 65.04737,-4.40999 65.59862,-28.1137"
544 id="path4993"
545 inkscape:connector-curvature="0"
546 transform="translate(0,572.36218)" />
547 <path
548 style="color:#000000;fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-end:url(#Arrow1Mend-3);visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
549 d="m 245.30577,201.06804 c -47.89942,-1.36388 -68.53183,-2.05014 -70.55986,30.3187"
550 id="path4995"
551 inkscape:connector-curvature="0"
552 transform="translate(0,572.36218)"
553 sodipodi:nodetypes="cc" />
554 <text
555 xml:space="preserve"
556 style="font-size:14px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu Italic"
557 x="478.94144"
558 y="875.39905"
559 id="text4660-6"
560 sodipodi:linespacing="100%"><tspan
561 sodipodi:role="line"
562 x="478.94144"
563 y="875.39905"
564 id="tspan4664-5">Write</tspan><tspan
565 sodipodi:role="line"
566 x="478.94144"
567 y="889.39905"
568 id="tspan5086">Data</tspan></text>
569 <text
570 xml:space="preserve"
571 style="font-size:14px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu Italic"
572 x="150.39708"
573 y="756.32922"
574 id="text4660-8"
575 sodipodi:linespacing="100%"><tspan
576 sodipodi:role="line"
577 id="tspan4662-9"
578 x="150.39708"
579 y="756.32922">Foo Type</tspan><tspan
580 sodipodi:role="line"
581 x="150.39708"
582 y="770.32922"
583 id="tspan4664-51">Data</tspan></text>
584 <text
585 xml:space="preserve"
586 style="font-size:14px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu Italic"
587 x="228.12317"
588 y="896.3465"
589 id="text4660-5"
590 sodipodi:linespacing="100%"><tspan
591 sodipodi:role="line"
592 id="tspan4662-2"
593 x="228.12317"
594 y="896.3465">SVG</tspan><tspan
595 sodipodi:role="line"
596 x="228.12317"
597 y="910.3465"
598 id="tspan4664-2">Data</tspan></text>
599 <g
600 id="g4469-4"
601 transform="translate(-216.05521,77.196901)">
602 <rect
603 y="887.29889"
604 x="403.61313"
605 height="36.266827"
606 width="263.23044"
607 id="rect2985-1-7"
608 style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
609 <text
610 sodipodi:linespacing="100%"
611 id="text3755-5-0"
612 y="908.72668"
613 x="535.85309"
614 style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"
615 xml:space="preserve"><tspan
616 id="tspan3759-8-1"
617 y="908.72668"
618 x="535.85309"
619 sodipodi:role="line">/var/cache/infographic/$(user)/bar-foo.svg</tspan></text>
620 </g>
621 <path
622 style="color:#000000;fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-end:url(#Arrow1Mend-3);visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
623 d="m 311.45565,849.40321 c 0,0 0,25.44875 0,104.82859"
624 id="path4987-1"
625 inkscape:connector-curvature="0"
626 sodipodi:nodetypes="cc" />
627 <path
628 style="opacity:0.75;fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Mend-3)"
629 d="m 70.370939,844.37253 c 2.166628,-1.32276 4.713537,-2.01444 7.251636,-1.96937 0.948556,0.0168 1.892954,0.13391 2.84132,0.15932 0.948365,0.0254 1.915816,-0.0448 2.800631,-0.38703 1.314563,-0.5085 2.330053,-1.56575 3.265528,-2.62004 0.935476,-1.0543 1.867729,-2.16266 3.108022,-2.83223 1.101035,-0.59439 2.362684,-0.79778 3.567965,-1.13375 0.336018,-0.0937 0.669019,-0.19815 0.998313,-0.31325"
630 id="path4674-2"
631 inkscape:path-effect="#path-effect4676-6"
632 inkscape:original-d="m 70.370939,844.37253 c 3.779008,2.44344 3.122725,0.24899 7.251636,-1.96937 9.338135,-5.39137 13.295708,6.69384 5.641951,-0.22771 -8.876629,-8.68938 3.086675,-5.33288 6.37355,-5.45227 3.286867,-0.11938 3.539607,-0.60936 3.567965,-1.13375 0.02835,-0.52438 -0.167688,-1.08314 0.998313,-0.31325"
633 inkscape:connector-curvature="0"
634 sodipodi:nodetypes="ccczsc" />
635 </g>
636</svg>
0637
=== modified file 'doc/mainpage.md'
--- doc/mainpage.md 2013-09-05 13:33:59 +0000
+++ doc/mainpage.md 2014-06-25 09:58:07 +0000
@@ -47,6 +47,21 @@
47Writing metric data sources47Writing metric data sources
48---------------------------48---------------------------
4949
50For the usermetrics service to know your application is providing data, a click hook is required.
51At present, no data is read from the hook, so an empty file registered as follows is sufficient:
52
53 "hooks": {
54 "camera": {
55 ...
56 "usermetrics": "usermetrics.json"
57 }
58 }
59
60You then have the choice of either using libusermetricsinput to write your data files, or
61creating completely custom files with your own code.
62
63### Using libusermetricsinput
64
50 - \ref UserMetricsInput "Libusermetrics Input API Documentation"65 - \ref UserMetricsInput "Libusermetrics Input API Documentation"
51 66
52For simple metrics which only want to increment a counter, see the following examples:67For simple metrics which only want to increment a counter, see the following examples:
@@ -66,6 +81,78 @@
66 - \subpage MetricManagerAdvanced.cpp "MetricManagerAdvanced.cpp: A Qt-based metric"81 - \subpage MetricManagerAdvanced.cpp "MetricManagerAdvanced.cpp: A Qt-based metric"
67 - \subpage MetricManagerAdvancedCAPI.c "MetricManagerAdvancedCAPI.c: A C-based metric"82 - \subpage MetricManagerAdvancedCAPI.c "MetricManagerAdvancedCAPI.c: A C-based metric"
6883
84### Manually
85To create completely custom data sources, simply have your application write files into the
86following directory:
87
88 ~/.cache/${APP_ID}/usermetrics/filename.foo
89
90It is important that these files are written atomically, or your data could be corrupted. For
91example, libusermetricsinput library writes a new file to:
92
93 ~/.cache/${APP_ID}/usermetrics/.tmp/tempfile
94
95and then moves it into the parent directory, ensuring atomic changes.
96
97Writing an infographic visualizer
98---------------------------------
99
100An infographic visualizer is simply a binary that takes a one or more command line parameters
101that are the paths to infographic data sources, and produces SVG data on its standard output.
102
103Visualizers can specify which data sources they are interested using "input" section of their
104click manifest. The first thing to specify is the application ID. This can either be an
105application's short ID, or the wildcard '*', referring to all applications. The second part is
106a list of regular expressions for which particular files the visualizer is interested in.
107
108 "input": {
109 "${SHORT_APP_ID}": [
110 "${FILE_REGULAR_EXPRESSION}",
111 "${FILE_REGULAR_EXPRESSION_2}"
112 ],
113 "*": [
114 "${FILE_REGULAR_EXPRESSION}",
115 "${FILE_REGULAR_EXPRESSION_2}"
116 ]
117 }
118
119### Iterative visualizer
120
121Iterative visualizers will be called once for each input file. In the example below the echo
122command would be called for every application providing a data source, and for each file it
123produces that ends in the extension 'libusermetrics.json'. Libusermetricsinput produces file
124names with this format, so that visualizers can easily pick them out.
125
126 {
127 "exec": "/bin/echo",
128 "type": "iterate",
129 "input": {
130 "*": [
131 ".*.libusermetrics.json"
132 ]
133 }
134 }
135
136### Aggregating visualizer
137
138Aggregating visualizers are called once for all inputs at once. They will not be called until
139every specified input exists. From that point on they will be called if any individual data
140source is updated.
141
142 {
143 "exec": "/bin/cat",
144 "type": "aggregate",
145 "input": {
146 "com.ubuntu.camera": [
147 "camera-photos.libusermetrics.json",
148 "camera-videos.libusermetrics.json"
149 ],
150 "foo": [
151 "source-id.libusermetrics.json"
152 ]
153 }
154 }
155
69Writing a presentation application156Writing a presentation application
70----------------------------------157----------------------------------
71158
72159
=== added symlink 'include/libusermetricsinput/MetricParameters.h'
=== target is u'../../src/libusermetricsinput/MetricParameters.h'
=== added symlink 'include/libusermetricsoutput/InfographicList.h'
=== target is u'../../src/libusermetricsoutput/InfographicList.h'
=== modified file 'po/en_GB.po'
--- po/en_GB.po 2014-05-19 06:24:58 +0000
+++ po/en_GB.po 2014-06-25 09:58:07 +0000
@@ -6,150 +6,118 @@
6msgstr ""6msgstr ""
7"Project-Id-Version: libusermetrics\n"7"Project-Id-Version: libusermetrics\n"
8"Report-Msgid-Bugs-To: \n"8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2013-10-22 09:33+0100\n"9"POT-Creation-Date: 2014-06-23 09:41+0100\n"
10"PO-Revision-Date: 2014-05-18 01:19+0000\n"10"PO-Revision-Date: 2014-05-18 01:19+0000\n"
11"Last-Translator: Pete Woods <Unknown>\n"11"Last-Translator: Pete Woods <Unknown>\n"
12"Language-Team: British English <en@li.org>\n"12"Language-Team: British English <en@li.org>\n"
13"Language: en_GB\n"
13"MIME-Version: 1.0\n"14"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"16"Content-Transfer-Encoding: 8bit\n"
16"X-Launchpad-Export-Date: 2014-05-19 06:24+0000\n"17"X-Launchpad-Export-Date: 2014-05-19 06:24+0000\n"
17"X-Generator: Launchpad (build 17007)\n"18"X-Generator: Launchpad (build 17007)\n"
18"Language: en_GB\n"19
1920#: src/libusermetricsoutput/GSettingsColorThemeProvider.cpp:100
20#: src/usermetricsservice/main.cpp:5921#, qt-format
21msgid "Could not open database"22msgid "Cannot open XML file '%1' for reading"
22msgstr "Could not open database"
23
24#: src/usermetricsservice/main.cpp:72
25msgid "Unable to register user metrics service on DBus"
26msgstr "Unable to register user metrics service on DBus"
27
28#: src/usermetricsservice/main.cpp:82
29msgid "Unable to unregister user metrics service on DBus"
30msgstr "Unable to unregister user metrics service on DBus"
31
32#: src/usermetricsservice/DBusDataSource.cpp:68
33#: src/usermetricsservice/DBusDataSource.cpp:86
34#: src/usermetricsservice/DBusDataSource.cpp:104
35#: src/usermetricsservice/DBusDataSource.cpp:116
36#: src/usermetricsservice/DBusDataSource.cpp:134
37#: src/usermetricsservice/DBusDataSource.cpp:172
38#: src/usermetricsservice/DBusDataSource.cpp:190
39#: src/usermetricsservice/DBusDataSource.cpp:216
40#: src/usermetricsservice/DBusDataSource.cpp:234
41#: src/usermetricsservice/DBusUserMetrics.cpp:187
42msgid "Could not save data source"
43msgstr "Couldn't save data source"
44
45#: src/usermetricsservice/DBusUserMetrics.cpp:54
46msgid "Unable to register user metrics object on DBus"
47msgstr "Unable to register user metrics object on DBus"
48
49#: src/usermetricsservice/DBusUserMetrics.cpp:141
50#: src/usermetricsservice/DBusUserMetrics.cpp:153
51msgid "Data source query failed"
52msgstr "Data source query failed"
53
54#: src/usermetricsservice/DBusUserMetrics.cpp:249
55msgid "Attempt to create user data owned by another user"
56msgstr ""23msgstr ""
5724
58#: src/usermetricsservice/DBusUserMetrics.cpp:25825#: src/libusermetricsinput/main.cpp:37
59msgid "User data query failed"26msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME <DATA>"
60msgstr "User data query failed"27msgstr "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME <DATA>"
6128
62#: src/usermetricsservice/DBusUserMetrics.cpp:26729#: src/libusermetricsinput/main-increment.cpp:37
63msgid "Could not save user data"30#, fuzzy
64msgstr "Couldn't save user data"31msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME [AMOUNT]"
6532msgstr "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME [AMOUNT]"
66#: src/usermetricsservice/DBusDataSet.cpp:12733
67#: src/usermetricsservice/DBusUserData.cpp:12534#: src/libusermetricsoutput/UserMetricsImpl.cpp:255
68msgid "Could not save data set"35msgid "Data source not found"
69msgstr "Could not save data set"36msgstr "Data source not found"
70
71#: src/usermetricsservice/DBusDataSet.cpp:143
72msgid "Attempt to update data owned by another user"
73msgstr "Attempt to update data owned by another user"
74
75#: src/usermetricsservice/DBusDataSet.cpp:151
76msgid "Attempt to update data owned by another application"
77msgstr "Attempt to update data owned by another application"
78
79#: src/usermetricsservice/DBusDataSet.cpp:170
80msgid "Attempt to increment data owned by another user"
81msgstr "Attempt to increment data owned by another user"
82
83#: src/usermetricsservice/DBusDataSet.cpp:178
84msgid "Attempt to increment data owned by another application"
85msgstr "Attempt to increment data owned by another application"
86
87#: src/usermetricsservice/DBusUserData.cpp:51
88msgid "Could not register user data object with DBus"
89msgstr "Could not register user data object with DBus"
90
91#: src/usermetricsservice/DBusUserData.cpp:81
92msgid "Unknown data source"
93msgstr "Unknown data source"
94
95#: src/usermetricsservice/DBusUserData.cpp:90
96msgid "Attempt to create data set owned by another user"
97msgstr "Attempt to create data set owned by another user"
98
99#: src/usermetricsservice/DBusUserData.cpp:101
100msgid "Attempt to create data set owned by another application"
101msgstr "Attempt to create data set owned by another application"
102
103#: src/usermetricsservice/DBusUserData.cpp:112
104msgid "Data set query failed"
105msgstr "Data set query failed"
106
107#: src/usermetricsservice/DBusUserData.cpp:135
108msgid "New data set could not be found"
109msgstr "New data set couldn't be found"
11037
111#: src/modules/UserMetrics/Metric.cpp:3038#: src/modules/UserMetrics/Metric.cpp:30
112msgid "Failed to connect to metrics service:"39msgid "Failed to connect to metrics service:"
113msgstr "Failed to connect to metrics service:"40msgstr "Failed to connect to metrics service:"
11441
42#: src/modules/UserMetrics/Metric.cpp:154
43msgid "Failed to increment metric:"
44msgstr ""
45
115#: src/modules/UserMetrics/Metric.cpp:14146#: src/modules/UserMetrics/Metric.cpp:141
116msgid "Failed to register user metric:"47msgid "Failed to register user metric:"
117msgstr "Failed to register user metric:"48msgstr "Failed to register user metric:"
11849
119#: src/modules/UserMetrics/Metric.cpp:154
120msgid "Failed to increment metric:"
121msgstr ""
122
123#: src/modules/UserMetrics/Metric.cpp:16650#: src/modules/UserMetrics/Metric.cpp:166
124msgid "Failed to update metric:"51msgid "Failed to update metric:"
125msgstr "Failed to update metric:"52msgstr "Failed to update metric:"
12653
54#: src/libusermetricsinput/MetricImpl.cpp:223
55#: src/libusermetricsoutput/UserMetricsImpl.cpp:267
56msgid "No data for today"
57msgstr "No data for today"
58
59#: src/libusermetricsoutput/UserMetricsImpl.cpp:198
60msgid "No data sources available"
61msgstr "No data sources available"
62
63#: src/libusermetricsinput/main.cpp:35
127#: src/libusermetricsinput/main-increment.cpp:3564#: src/libusermetricsinput/main-increment.cpp:35
128#: src/libusermetricsinput/main.cpp:35
129msgid "Usage: "65msgid "Usage: "
130msgstr "Usage: "66msgstr "Usage: "
13167
132#: src/libusermetricsinput/main-increment.cpp:3768#~ msgid "Attempt to create data set owned by another application"
133msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME [AMOUNT]"69#~ msgstr "Attempt to create data set owned by another application"
134msgstr ""70
13571#~ msgid "Attempt to create data set owned by another user"
136#: src/libusermetricsinput/main.cpp:3772#~ msgstr "Attempt to create data set owned by another user"
137msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME <DATA>"73
138msgstr "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME <DATA>"74#~ msgid "Attempt to increment data owned by another application"
13975#~ msgstr "Attempt to increment data owned by another application"
140#: src/libusermetricsoutput/UserMetricsImpl.cpp:19876
141msgid "No data sources available"77#~ msgid "Attempt to increment data owned by another user"
142msgstr "No data sources available"78#~ msgstr "Attempt to increment data owned by another user"
14379
144#: src/libusermetricsoutput/UserMetricsImpl.cpp:25580#~ msgid "Attempt to update data owned by another application"
145msgid "Data source not found"81#~ msgstr "Attempt to update data owned by another application"
146msgstr "Data source not found"82
14783#~ msgid "Attempt to update data owned by another user"
148#: src/libusermetricsoutput/UserMetricsImpl.cpp:26684#~ msgstr "Attempt to update data owned by another user"
149msgid "No data for today"85
150msgstr "No data for today"86#~ msgid "Could not open database"
15187#~ msgstr "Could not open database"
152#: src/libusermetricsoutput/GSettingsColorThemeProvider.cpp:9988
153#, qt-format89#~ msgid "Could not register user data object with DBus"
154msgid "Cannot open XML file '%1' for reading"90#~ msgstr "Could not register user data object with DBus"
155msgstr ""91
92#~ msgid "Could not save data set"
93#~ msgstr "Could not save data set"
94
95#~ msgid "Could not save data source"
96#~ msgstr "Couldn't save data source"
97
98#~ msgid "Could not save user data"
99#~ msgstr "Couldn't save user data"
100
101#~ msgid "Data set query failed"
102#~ msgstr "Data set query failed"
103
104#~ msgid "Data source query failed"
105#~ msgstr "Data source query failed"
106
107#~ msgid "New data set could not be found"
108#~ msgstr "New data set couldn't be found"
109
110#~ msgid "Unable to register user metrics object on DBus"
111#~ msgstr "Unable to register user metrics object on DBus"
112
113#~ msgid "Unable to register user metrics service on DBus"
114#~ msgstr "Unable to register user metrics service on DBus"
115
116#~ msgid "Unable to unregister user metrics service on DBus"
117#~ msgstr "Unable to unregister user metrics service on DBus"
118
119#~ msgid "Unknown data source"
120#~ msgstr "Unknown data source"
121
122#~ msgid "User data query failed"
123#~ msgstr "User data query failed"
156124
=== modified file 'po/libusermetrics.pot'
--- po/libusermetrics.pot 2013-10-22 08:53:23 +0000
+++ po/libusermetrics.pot 2014-06-25 09:58:07 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: libusermetrics\n"9"Project-Id-Version: libusermetrics\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2013-10-22 09:33+0100\n"11"POT-Creation-Date: 2014-06-23 09:41+0100\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,95 +17,22 @@
17"Content-Type: text/plain; charset=CHARSET\n"17"Content-Type: text/plain; charset=CHARSET\n"
18"Content-Transfer-Encoding: 8bit\n"18"Content-Transfer-Encoding: 8bit\n"
1919
20#: src/usermetricsservice/main.cpp:5920#: src/libusermetricsinput/main.cpp:35
21msgid "Could not open database"21#: src/libusermetricsinput/main-increment.cpp:35
22msgstr ""22msgid "Usage: "
2323msgstr ""
24#: src/usermetricsservice/main.cpp:7224
25msgid "Unable to register user metrics service on DBus"25#: src/libusermetricsinput/main.cpp:37
26msgstr ""26msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME <DATA>"
2727msgstr ""
28#: src/usermetricsservice/main.cpp:8228
29msgid "Unable to unregister user metrics service on DBus"29#: src/libusermetricsinput/main-increment.cpp:37
30msgstr ""30msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME [AMOUNT]"
3131msgstr ""
32#: src/usermetricsservice/DBusDataSource.cpp:6832
33#: src/usermetricsservice/DBusDataSource.cpp:8633#: src/libusermetricsinput/MetricImpl.cpp:223
34#: src/usermetricsservice/DBusDataSource.cpp:10434#: src/libusermetricsoutput/UserMetricsImpl.cpp:267
35#: src/usermetricsservice/DBusDataSource.cpp:11635msgid "No data for today"
36#: src/usermetricsservice/DBusDataSource.cpp:134
37#: src/usermetricsservice/DBusDataSource.cpp:172
38#: src/usermetricsservice/DBusDataSource.cpp:190
39#: src/usermetricsservice/DBusDataSource.cpp:216
40#: src/usermetricsservice/DBusDataSource.cpp:234
41#: src/usermetricsservice/DBusUserMetrics.cpp:187
42msgid "Could not save data source"
43msgstr ""
44
45#: src/usermetricsservice/DBusUserMetrics.cpp:54
46msgid "Unable to register user metrics object on DBus"
47msgstr ""
48
49#: src/usermetricsservice/DBusUserMetrics.cpp:141
50#: src/usermetricsservice/DBusUserMetrics.cpp:153
51msgid "Data source query failed"
52msgstr ""
53
54#: src/usermetricsservice/DBusUserMetrics.cpp:249
55msgid "Attempt to create user data owned by another user"
56msgstr ""
57
58#: src/usermetricsservice/DBusUserMetrics.cpp:258
59msgid "User data query failed"
60msgstr ""
61
62#: src/usermetricsservice/DBusUserMetrics.cpp:267
63msgid "Could not save user data"
64msgstr ""
65
66#: src/usermetricsservice/DBusDataSet.cpp:127
67#: src/usermetricsservice/DBusUserData.cpp:125
68msgid "Could not save data set"
69msgstr ""
70
71#: src/usermetricsservice/DBusDataSet.cpp:143
72msgid "Attempt to update data owned by another user"
73msgstr ""
74
75#: src/usermetricsservice/DBusDataSet.cpp:151
76msgid "Attempt to update data owned by another application"
77msgstr ""
78
79#: src/usermetricsservice/DBusDataSet.cpp:170
80msgid "Attempt to increment data owned by another user"
81msgstr ""
82
83#: src/usermetricsservice/DBusDataSet.cpp:178
84msgid "Attempt to increment data owned by another application"
85msgstr ""
86
87#: src/usermetricsservice/DBusUserData.cpp:51
88msgid "Could not register user data object with DBus"
89msgstr ""
90
91#: src/usermetricsservice/DBusUserData.cpp:81
92msgid "Unknown data source"
93msgstr ""
94
95#: src/usermetricsservice/DBusUserData.cpp:90
96msgid "Attempt to create data set owned by another user"
97msgstr ""
98
99#: src/usermetricsservice/DBusUserData.cpp:101
100msgid "Attempt to create data set owned by another application"
101msgstr ""
102
103#: src/usermetricsservice/DBusUserData.cpp:112
104msgid "Data set query failed"
105msgstr ""
106
107#: src/usermetricsservice/DBusUserData.cpp:135
108msgid "New data set could not be found"
109msgstr ""36msgstr ""
11037
111#: src/modules/UserMetrics/Metric.cpp:3038#: src/modules/UserMetrics/Metric.cpp:30
@@ -124,19 +51,6 @@
124msgid "Failed to update metric:"51msgid "Failed to update metric:"
125msgstr ""52msgstr ""
12653
127#: src/libusermetricsinput/main-increment.cpp:35
128#: src/libusermetricsinput/main.cpp:35
129msgid "Usage: "
130msgstr ""
131
132#: src/libusermetricsinput/main-increment.cpp:37
133msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME [AMOUNT]"
134msgstr ""
135
136#: src/libusermetricsinput/main.cpp:37
137msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME <DATA>"
138msgstr ""
139
140#: src/libusermetricsoutput/UserMetricsImpl.cpp:19854#: src/libusermetricsoutput/UserMetricsImpl.cpp:198
141msgid "No data sources available"55msgid "No data sources available"
142msgstr ""56msgstr ""
@@ -145,11 +59,7 @@
145msgid "Data source not found"59msgid "Data source not found"
146msgstr ""60msgstr ""
14761
148#: src/libusermetricsoutput/UserMetricsImpl.cpp:26662#: src/libusermetricsoutput/GSettingsColorThemeProvider.cpp:100
149msgid "No data for today"
150msgstr ""
151
152#: src/libusermetricsoutput/GSettingsColorThemeProvider.cpp:99
153#, qt-format63#, qt-format
154msgid "Cannot open XML file '%1' for reading"64msgid "Cannot open XML file '%1' for reading"
155msgstr ""65msgstr ""
15666
=== modified file 'po/pl.po'
--- po/pl.po 2014-05-18 05:57:04 +0000
+++ po/pl.po 2014-06-25 09:58:07 +0000
@@ -6,150 +6,121 @@
6msgid ""6msgid ""
7msgstr ""7msgstr ""
8"Project-Id-Version: libusermetrics\n"8"Project-Id-Version: libusermetrics\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"9"Report-Msgid-Bugs-To: \n"
10"POT-Creation-Date: 2013-10-22 09:33+0100\n"10"POT-Creation-Date: 2014-06-23 09:41+0100\n"
11"PO-Revision-Date: 2013-10-29 17:11+0000\n"11"PO-Revision-Date: 2013-10-29 17:11+0000\n"
12"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"12"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
13"Language-Team: Polish <pl@li.org>\n"13"Language-Team: Polish <pl@li.org>\n"
14"Language: pl\n"
14"MIME-Version: 1.0\n"15"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"16"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"17"Content-Transfer-Encoding: 8bit\n"
17"X-Launchpad-Export-Date: 2014-05-18 05:57+0000\n"18"X-Launchpad-Export-Date: 2014-05-18 05:57+0000\n"
18"X-Generator: Launchpad (build 17007)\n"19"X-Generator: Launchpad (build 17007)\n"
1920
20#: src/usermetricsservice/main.cpp:5921#: src/libusermetricsoutput/GSettingsColorThemeProvider.cpp:100
21msgid "Could not open database"22#, qt-format
22msgstr "Błąd otwarcia bazy danych"23msgid "Cannot open XML file '%1' for reading"
2324msgstr "Błąd otwarcia pliku \"%1\" do odczytu."
24#: src/usermetricsservice/main.cpp:7225
25msgid "Unable to register user metrics service on DBus"26#: src/libusermetricsinput/main.cpp:37
26msgstr "Błąd rejestracji usługi metryk w DBus"27msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME <DATA>"
2728msgstr ""
28#: src/usermetricsservice/main.cpp:8229
29msgid "Unable to unregister user metrics service on DBus"30#: src/libusermetricsinput/main-increment.cpp:37
30msgstr "Błąd wyrejestrowania usługi metryk z DBus"31msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME [AMOUNT]"
3132msgstr ""
32#: src/usermetricsservice/DBusDataSource.cpp:6833
33#: src/usermetricsservice/DBusDataSource.cpp:8634#: src/libusermetricsoutput/UserMetricsImpl.cpp:255
34#: src/usermetricsservice/DBusDataSource.cpp:10435msgid "Data source not found"
35#: src/usermetricsservice/DBusDataSource.cpp:11636msgstr ""
36#: src/usermetricsservice/DBusDataSource.cpp:134
37#: src/usermetricsservice/DBusDataSource.cpp:172
38#: src/usermetricsservice/DBusDataSource.cpp:190
39#: src/usermetricsservice/DBusDataSource.cpp:216
40#: src/usermetricsservice/DBusDataSource.cpp:234
41#: src/usermetricsservice/DBusUserMetrics.cpp:187
42msgid "Could not save data source"
43msgstr "Błąd zapisywania źródła danych"
44
45#: src/usermetricsservice/DBusUserMetrics.cpp:54
46msgid "Unable to register user metrics object on DBus"
47msgstr "Błąd rejestracji obiektu metryk w DBus"
48
49#: src/usermetricsservice/DBusUserMetrics.cpp:141
50#: src/usermetricsservice/DBusUserMetrics.cpp:153
51msgid "Data source query failed"
52msgstr "Błąd zapytania źródła danych"
53
54#: src/usermetricsservice/DBusUserMetrics.cpp:249
55msgid "Attempt to create user data owned by another user"
56msgstr "Próba zapisania danych dla innego użytkownika"
57
58#: src/usermetricsservice/DBusUserMetrics.cpp:258
59msgid "User data query failed"
60msgstr "Błąd zapytania danych użytkownika"
61
62#: src/usermetricsservice/DBusUserMetrics.cpp:267
63msgid "Could not save user data"
64msgstr "Błąd zapisu danych użytkownika"
65
66#: src/usermetricsservice/DBusDataSet.cpp:127
67#: src/usermetricsservice/DBusUserData.cpp:125
68msgid "Could not save data set"
69msgstr "Błąd zapisu zestawu danych"
70
71#: src/usermetricsservice/DBusDataSet.cpp:143
72msgid "Attempt to update data owned by another user"
73msgstr "Próba aktualizacji danych innego użytkownika"
74
75#: src/usermetricsservice/DBusDataSet.cpp:151
76msgid "Attempt to update data owned by another application"
77msgstr "Próba aktualizacji danych innej aplikacji"
78
79#: src/usermetricsservice/DBusDataSet.cpp:170
80msgid "Attempt to increment data owned by another user"
81msgstr "Próba inkrementacji danych innego użytkownika"
82
83#: src/usermetricsservice/DBusDataSet.cpp:178
84msgid "Attempt to increment data owned by another application"
85msgstr "Próba inkrementacji danych innej aplikacji"
86
87#: src/usermetricsservice/DBusUserData.cpp:51
88msgid "Could not register user data object with DBus"
89msgstr "Błąd rejestracji obiektu danych użytkownika w DBus"
90
91#: src/usermetricsservice/DBusUserData.cpp:81
92msgid "Unknown data source"
93msgstr "Nieznane źródło danych"
94
95#: src/usermetricsservice/DBusUserData.cpp:90
96msgid "Attempt to create data set owned by another user"
97msgstr "Próba utworzenia zestawu danych innego użytkownika"
98
99#: src/usermetricsservice/DBusUserData.cpp:101
100msgid "Attempt to create data set owned by another application"
101msgstr "Próba utworzenia zestawu danych innej aplikacji"
102
103#: src/usermetricsservice/DBusUserData.cpp:112
104msgid "Data set query failed"
105msgstr "Błąd zapytania danych"
106
107#: src/usermetricsservice/DBusUserData.cpp:135
108msgid "New data set could not be found"
109msgstr "Nie znaleziono nowego zestawu danych"
11037
111#: src/modules/UserMetrics/Metric.cpp:3038#: src/modules/UserMetrics/Metric.cpp:30
112msgid "Failed to connect to metrics service:"39msgid "Failed to connect to metrics service:"
113msgstr ""40msgstr ""
11441
42#: src/modules/UserMetrics/Metric.cpp:154
43msgid "Failed to increment metric:"
44msgstr ""
45
115#: src/modules/UserMetrics/Metric.cpp:14146#: src/modules/UserMetrics/Metric.cpp:141
116msgid "Failed to register user metric:"47msgid "Failed to register user metric:"
117msgstr ""48msgstr ""
11849
119#: src/modules/UserMetrics/Metric.cpp:154
120msgid "Failed to increment metric:"
121msgstr ""
122
123#: src/modules/UserMetrics/Metric.cpp:16650#: src/modules/UserMetrics/Metric.cpp:166
124msgid "Failed to update metric:"51msgid "Failed to update metric:"
125msgstr ""52msgstr ""
12653
54#: src/libusermetricsinput/MetricImpl.cpp:223
55#: src/libusermetricsoutput/UserMetricsImpl.cpp:267
56msgid "No data for today"
57msgstr ""
58
59#: src/libusermetricsoutput/UserMetricsImpl.cpp:198
60msgid "No data sources available"
61msgstr ""
62
63#: src/libusermetricsinput/main.cpp:35
127#: src/libusermetricsinput/main-increment.cpp:3564#: src/libusermetricsinput/main-increment.cpp:35
128#: src/libusermetricsinput/main.cpp:35
129msgid "Usage: "65msgid "Usage: "
130msgstr ""66msgstr ""
13167
132#: src/libusermetricsinput/main-increment.cpp:3768#~ msgid "Attempt to create data set owned by another application"
133msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME [AMOUNT]"69#~ msgstr "Próba utworzenia zestawu danych innej aplikacji"
134msgstr ""70
13571#~ msgid "Attempt to create data set owned by another user"
136#: src/libusermetricsinput/main.cpp:3772#~ msgstr "Próba utworzenia zestawu danych innego użytkownika"
137msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME <DATA>"73
138msgstr ""74#~ msgid "Attempt to create user data owned by another user"
13975#~ msgstr "Próba zapisania danych dla innego użytkownika"
140#: src/libusermetricsoutput/UserMetricsImpl.cpp:19876
141msgid "No data sources available"77#~ msgid "Attempt to increment data owned by another application"
142msgstr ""78#~ msgstr "Próba inkrementacji danych innej aplikacji"
14379
144#: src/libusermetricsoutput/UserMetricsImpl.cpp:25580#~ msgid "Attempt to increment data owned by another user"
145msgid "Data source not found"81#~ msgstr "Próba inkrementacji danych innego użytkownika"
146msgstr ""82
14783#~ msgid "Attempt to update data owned by another application"
148#: src/libusermetricsoutput/UserMetricsImpl.cpp:26684#~ msgstr "Próba aktualizacji danych innej aplikacji"
149msgid "No data for today"85
150msgstr ""86#~ msgid "Attempt to update data owned by another user"
15187#~ msgstr "Próba aktualizacji danych innego użytkownika"
152#: src/libusermetricsoutput/GSettingsColorThemeProvider.cpp:9988
153#, qt-format89#~ msgid "Could not open database"
154msgid "Cannot open XML file '%1' for reading"90#~ msgstr "Błąd otwarcia bazy danych"
155msgstr "Błąd otwarcia pliku \"%1\" do odczytu."91
92#~ msgid "Could not register user data object with DBus"
93#~ msgstr "Błąd rejestracji obiektu danych użytkownika w DBus"
94
95#~ msgid "Could not save data set"
96#~ msgstr "Błąd zapisu zestawu danych"
97
98#~ msgid "Could not save data source"
99#~ msgstr "Błąd zapisywania źródła danych"
100
101#~ msgid "Could not save user data"
102#~ msgstr "Błąd zapisu danych użytkownika"
103
104#~ msgid "Data set query failed"
105#~ msgstr "Błąd zapytania danych"
106
107#~ msgid "Data source query failed"
108#~ msgstr "Błąd zapytania źródła danych"
109
110#~ msgid "New data set could not be found"
111#~ msgstr "Nie znaleziono nowego zestawu danych"
112
113#~ msgid "Unable to register user metrics object on DBus"
114#~ msgstr "Błąd rejestracji obiektu metryk w DBus"
115
116#~ msgid "Unable to register user metrics service on DBus"
117#~ msgstr "Błąd rejestracji usługi metryk w DBus"
118
119#~ msgid "Unable to unregister user metrics service on DBus"
120#~ msgstr "Błąd wyrejestrowania usługi metryk z DBus"
121
122#~ msgid "Unknown data source"
123#~ msgstr "Nieznane źródło danych"
124
125#~ msgid "User data query failed"
126#~ msgstr "Błąd zapytania danych użytkownika"
156127
=== modified file 'po/zh_CN.po'
--- po/zh_CN.po 2014-05-29 05:49:13 +0000
+++ po/zh_CN.po 2014-06-25 09:58:07 +0000
@@ -6,150 +6,61 @@
6msgid ""6msgid ""
7msgstr ""7msgstr ""
8"Project-Id-Version: libusermetrics\n"8"Project-Id-Version: libusermetrics\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"9"Report-Msgid-Bugs-To: \n"
10"POT-Creation-Date: 2013-10-22 09:33+0100\n"10"POT-Creation-Date: 2014-06-23 09:41+0100\n"
11"PO-Revision-Date: 2014-05-28 14:44+0000\n"11"PO-Revision-Date: 2014-05-28 14:44+0000\n"
12"Last-Translator: Anthony Wong <anthony.wong@ubuntu.com>\n"12"Last-Translator: Anthony Wong <anthony.wong@ubuntu.com>\n"
13"Language-Team: Chinese (Simplified) <zh_CN@li.org>\n"13"Language-Team: Chinese (Simplified) <zh_CN@li.org>\n"
14"Language: \n"
14"MIME-Version: 1.0\n"15"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"16"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"17"Content-Transfer-Encoding: 8bit\n"
17"X-Launchpad-Export-Date: 2014-05-29 05:49+0000\n"18"X-Launchpad-Export-Date: 2014-05-29 05:49+0000\n"
18"X-Generator: Launchpad (build 17017)\n"19"X-Generator: Launchpad (build 17017)\n"
1920
20#: src/usermetricsservice/main.cpp:5921#: src/libusermetricsoutput/GSettingsColorThemeProvider.cpp:100
21msgid "Could not open database"22#, qt-format
22msgstr ""23msgid "Cannot open XML file '%1' for reading"
2324msgstr ""
24#: src/usermetricsservice/main.cpp:7225
25msgid "Unable to register user metrics service on DBus"26#: src/libusermetricsinput/main.cpp:37
26msgstr ""27msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME <DATA>"
2728msgstr ""
28#: src/usermetricsservice/main.cpp:8229
29msgid "Unable to unregister user metrics service on DBus"30#: src/libusermetricsinput/main-increment.cpp:37
30msgstr ""31msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME [AMOUNT]"
3132msgstr ""
32#: src/usermetricsservice/DBusDataSource.cpp:6833
33#: src/usermetricsservice/DBusDataSource.cpp:8634#: src/libusermetricsoutput/UserMetricsImpl.cpp:255
34#: src/usermetricsservice/DBusDataSource.cpp:10435msgid "Data source not found"
35#: src/usermetricsservice/DBusDataSource.cpp:116
36#: src/usermetricsservice/DBusDataSource.cpp:134
37#: src/usermetricsservice/DBusDataSource.cpp:172
38#: src/usermetricsservice/DBusDataSource.cpp:190
39#: src/usermetricsservice/DBusDataSource.cpp:216
40#: src/usermetricsservice/DBusDataSource.cpp:234
41#: src/usermetricsservice/DBusUserMetrics.cpp:187
42msgid "Could not save data source"
43msgstr ""
44
45#: src/usermetricsservice/DBusUserMetrics.cpp:54
46msgid "Unable to register user metrics object on DBus"
47msgstr ""
48
49#: src/usermetricsservice/DBusUserMetrics.cpp:141
50#: src/usermetricsservice/DBusUserMetrics.cpp:153
51msgid "Data source query failed"
52msgstr ""
53
54#: src/usermetricsservice/DBusUserMetrics.cpp:249
55msgid "Attempt to create user data owned by another user"
56msgstr ""
57
58#: src/usermetricsservice/DBusUserMetrics.cpp:258
59msgid "User data query failed"
60msgstr ""
61
62#: src/usermetricsservice/DBusUserMetrics.cpp:267
63msgid "Could not save user data"
64msgstr ""
65
66#: src/usermetricsservice/DBusDataSet.cpp:127
67#: src/usermetricsservice/DBusUserData.cpp:125
68msgid "Could not save data set"
69msgstr ""
70
71#: src/usermetricsservice/DBusDataSet.cpp:143
72msgid "Attempt to update data owned by another user"
73msgstr ""
74
75#: src/usermetricsservice/DBusDataSet.cpp:151
76msgid "Attempt to update data owned by another application"
77msgstr ""
78
79#: src/usermetricsservice/DBusDataSet.cpp:170
80msgid "Attempt to increment data owned by another user"
81msgstr ""
82
83#: src/usermetricsservice/DBusDataSet.cpp:178
84msgid "Attempt to increment data owned by another application"
85msgstr ""
86
87#: src/usermetricsservice/DBusUserData.cpp:51
88msgid "Could not register user data object with DBus"
89msgstr ""
90
91#: src/usermetricsservice/DBusUserData.cpp:81
92msgid "Unknown data source"
93msgstr ""
94
95#: src/usermetricsservice/DBusUserData.cpp:90
96msgid "Attempt to create data set owned by another user"
97msgstr ""
98
99#: src/usermetricsservice/DBusUserData.cpp:101
100msgid "Attempt to create data set owned by another application"
101msgstr ""
102
103#: src/usermetricsservice/DBusUserData.cpp:112
104msgid "Data set query failed"
105msgstr ""
106
107#: src/usermetricsservice/DBusUserData.cpp:135
108msgid "New data set could not be found"
109msgstr ""36msgstr ""
11037
111#: src/modules/UserMetrics/Metric.cpp:3038#: src/modules/UserMetrics/Metric.cpp:30
112msgid "Failed to connect to metrics service:"39msgid "Failed to connect to metrics service:"
113msgstr ""40msgstr ""
11441
42#: src/modules/UserMetrics/Metric.cpp:154
43msgid "Failed to increment metric:"
44msgstr ""
45
115#: src/modules/UserMetrics/Metric.cpp:14146#: src/modules/UserMetrics/Metric.cpp:141
116msgid "Failed to register user metric:"47msgid "Failed to register user metric:"
117msgstr ""48msgstr ""
11849
119#: src/modules/UserMetrics/Metric.cpp:154
120msgid "Failed to increment metric:"
121msgstr ""
122
123#: src/modules/UserMetrics/Metric.cpp:16650#: src/modules/UserMetrics/Metric.cpp:166
124msgid "Failed to update metric:"51msgid "Failed to update metric:"
125msgstr ""52msgstr ""
12653
127#: src/libusermetricsinput/main-increment.cpp:3554#: src/libusermetricsinput/MetricImpl.cpp:223
128#: src/libusermetricsinput/main.cpp:3555#: src/libusermetricsoutput/UserMetricsImpl.cpp:267
129msgid "Usage: "56msgid "No data for today"
130msgstr ""
131
132#: src/libusermetricsinput/main-increment.cpp:37
133msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME [AMOUNT]"
134msgstr ""
135
136#: src/libusermetricsinput/main.cpp:37
137msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME <DATA>"
138msgstr ""57msgstr ""
13958
140#: src/libusermetricsoutput/UserMetricsImpl.cpp:19859#: src/libusermetricsoutput/UserMetricsImpl.cpp:198
141msgid "No data sources available"60msgid "No data sources available"
142msgstr "无可用数据来源"61msgstr "无可用数据来源"
14362
144#: src/libusermetricsoutput/UserMetricsImpl.cpp:25563#: src/libusermetricsinput/main.cpp:35
145msgid "Data source not found"64#: src/libusermetricsinput/main-increment.cpp:35
146msgstr ""65msgid "Usage: "
147
148#: src/libusermetricsoutput/UserMetricsImpl.cpp:266
149msgid "No data for today"
150msgstr ""
151
152#: src/libusermetricsoutput/GSettingsColorThemeProvider.cpp:99
153#, qt-format
154msgid "Cannot open XML file '%1' for reading"
155msgstr ""66msgstr ""
15667
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2013-09-17 11:03:34 +0000
+++ src/CMakeLists.txt 2014-06-25 09:58:07 +0000
@@ -6,6 +6,8 @@
66
7add_compiler_export_flags()7add_compiler_export_flags()
88
9add_subdirectory("infographic")
10add_subdirectory("infographicservice")
9add_subdirectory("libusermetricscommon")11add_subdirectory("libusermetricscommon")
10add_subdirectory("libusermetricsinput")12add_subdirectory("libusermetricsinput")
11add_subdirectory("libusermetricsoutput")13add_subdirectory("libusermetricsoutput")
1214
=== added directory 'src/infographic'
=== added file 'src/infographic/CMakeLists.txt'
--- src/infographic/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/infographic/CMakeLists.txt 2014-06-25 09:58:07 +0000
@@ -0,0 +1,20 @@
1
2##########################
3# Infographic
4##########################
5
6add_executable(
7 infographic
8 Infographic.cpp
9 main.cpp
10)
11
12install(
13 TARGETS infographic
14 RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/libusermetrics"
15)
16
17qt5_use_modules(
18 infographic
19 Core
20)
021
=== added file 'src/infographic/Infographic.cpp'
--- src/infographic/Infographic.cpp 1970-01-01 00:00:00 +0000
+++ src/infographic/Infographic.cpp 2014-06-25 09:58:07 +0000
@@ -0,0 +1,292 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#include <infographic/Infographic.h>
20
21#define _USE_MATH_DEFINES
22
23#include <cmath>
24#include <QDate>
25#include <QDebug>
26#include <QIODevice>
27#include <QJsonDocument>
28#include <QRegularExpression>
29#include <QStringList>
30#include <QVariantList>
31#include <QXmlStreamWriter>
32
33using namespace UserMetricsInfographic;
34
35static const double CENTER_CIRCLE_RADIUS = 345.0;
36static const double DATA_CIRCLE_RADIUS = CENTER_CIRCLE_RADIUS / 1.8;
37static const double DOT_DISTANCE = 0.8 * CENTER_CIRCLE_RADIUS;
38static const double SVG_SIZE = 2.0 * CENTER_CIRCLE_RADIUS
39 + 2.0 * DATA_CIRCLE_RADIUS;
40static const double CENTER_COORD = 0.5 * SVG_SIZE;
41static const int LINE_WIDTH(20);
42
43static const QRegularExpression WHITESPACE("\\s");
44
45Infographic::Infographic(QIODevice &input, QIODevice &output) {
46 readJson(input);
47 splitDataIntoMonths();
48 writeSvg(output);
49}
50
51Infographic::~Infographic() {
52}
53
54static inline double xComponent(double radius, int count, int total) {
55 return CENTER_COORD + radius * sin((2.0 * M_PI * count) / total);
56}
57
58static inline double yComponent(double radius, int count, int total) {
59 return CENTER_COORD - radius * cos((2.0 * M_PI * count) / total);
60}
61
62void Infographic::splitDataIntoMonth(QVariantList &month, const int dayOfMonth,
63 const int daysInMonth, QVariantList::const_iterator& index,
64 const QVariantList::const_iterator& end) {
65
66 // Copy a number of data entries equal to the day of the month it is
67 for (int i(0); i < dayOfMonth; ++i) {
68 if (index == end) {
69 // when we run out of data, pad the remaining days to the
70 // start of the month
71 month.prepend(QVariant());
72 } else {
73 // pop data from the from of the source
74 month.prepend(*index);
75 ++index;
76 }
77 }
78
79 // Now fill the end of the month with empty data
80 while (month.size() < daysInMonth) {
81 month.append(QVariant());
82 }
83}
84
85void Infographic::splitDataIntoMonths() {
86 QDate currentDate(QDate::currentDate());
87 QDate secondMonthDate(currentDate.addMonths(-1));
88
89 int valuesToCopyForFirstMonth(0);
90 int valuesToCopyForSecondMonth(0);
91
92 if (currentDate.year() == m_lastUpdated.year()
93 && currentDate.month() == m_lastUpdated.month()) {
94 // If the data is for the first month
95 valuesToCopyForFirstMonth = m_lastUpdated.day();
96 valuesToCopyForSecondMonth = secondMonthDate.daysInMonth();
97 } else if (secondMonthDate.year() == m_lastUpdated.year()
98 && secondMonthDate.month() == m_lastUpdated.month()) {
99 // If the data is for the second month
100 valuesToCopyForSecondMonth = m_lastUpdated.day();
101 } else {
102 // the data is out of date
103 }
104
105 QVariantList::const_iterator dataIndex(m_data.begin());
106 QVariantList::const_iterator end(m_data.end());
107
108 splitDataIntoMonth(m_firstMonth, valuesToCopyForFirstMonth,
109 currentDate.daysInMonth(), dataIndex, end);
110
111 splitDataIntoMonth(m_secondMonth, valuesToCopyForSecondMonth,
112 secondMonthDate.daysInMonth(), dataIndex, end);
113
114 m_currentDay = valuesToCopyForFirstMonth - 1;
115}
116
117void Infographic::readJson(QIODevice &input) {
118 QJsonDocument document(QJsonDocument::fromJson(input.readAll()));
119 QVariantMap map(document.toVariant().toMap());
120
121 m_label = map["label"].toString();
122 m_data = map["scaledData"].toList();
123 m_lastUpdated = map["lastUpdated"].toDate();
124}
125
126void Infographic::writeCircle(double x, double y, double r,
127 const QString &color, double opacity, const QString &id,
128 const QString &clazz, QXmlStreamWriter &stream) {
129 stream.writeStartElement("circle");
130 stream.writeAttribute("id", id);
131 stream.writeAttribute("class", clazz);
132 stream.writeAttribute("stroke", "none");
133 stream.writeAttribute("opacity", QString::number(opacity));
134 stream.writeAttribute("fill", color);
135 stream.writeAttribute("cx", QString::number(x));
136 stream.writeAttribute("cy", QString::number(y));
137 stream.writeAttribute("r", QString::number(r));
138 stream.writeEndElement();
139}
140
141void Infographic::writeRing(double x, double y, double r, const QString &color,
142 double opacity, const QString &id, const QString &clazz,
143 QXmlStreamWriter &stream) {
144 stream.writeStartElement("circle");
145 stream.writeAttribute("id", id);
146 stream.writeAttribute("class", clazz);
147 stream.writeAttribute("stroke", color);
148 stream.writeAttribute("stroke-width", "1");
149 stream.writeAttribute("opacity", QString::number(opacity));
150 stream.writeAttribute("fill", "none");
151 stream.writeAttribute("cx", QString::number(x));
152 stream.writeAttribute("cy", QString::number(y));
153 stream.writeAttribute("r", QString::number(r));
154 stream.writeEndElement();
155}
156
157void Infographic::writeDots(int currentDay, int days, const QString &color,
158 QXmlStreamWriter &stream) {
159
160 uint dotId(0);
161
162 for (int day(0); day < currentDay; ++day) {
163 writeCircle(xComponent(DOT_DISTANCE, day, days),
164 yComponent(DOT_DISTANCE, day, days), 8.0, color, 0.4,
165 QString("day-alt-%1").arg(++dotId), "day-alt-past", stream);
166 }
167
168 {
169 double x(xComponent(DOT_DISTANCE, currentDay, days));
170 double y(yComponent(DOT_DISTANCE, currentDay, days));
171
172 stream.writeStartElement("image");
173 stream.writeAttribute("id",
174 QString("day-alt-%1").arg(QString("dot-%1").arg(++dotId)));
175 stream.writeAttribute("class", "day-alt-current");
176 stream.writeAttribute("opacity", "0.4");
177 stream.writeAttribute("x", QString::number(x - 20.0));
178 stream.writeAttribute("y", QString::number(y - 20.0));
179 stream.writeAttribute("width", "40px");
180 stream.writeAttribute("height", "40px");
181 stream.writeAttribute("transform",
182 QString("rotate(%1 %2 %3)").arg((360.0 * currentDay) / days).arg(
183 x).arg(y));
184 stream.writeAttribute("xlink:href",
185 "/usr/share/unity8/Greeter/graphics/dot_pointer.png");
186 stream.writeEndElement();
187 }
188
189 for (int day(currentDay + 1); day < days; ++day) {
190 writeRing(xComponent(DOT_DISTANCE, day, days),
191 yComponent(DOT_DISTANCE, day, days), 7.0, color, 0.4,
192 QString("day-alt-%1").arg(++dotId), "day-alt-future", stream);
193 }
194}
195
196void Infographic::writeMonth(const QVariantList &month, const QString &color,
197 const QString &id, const QString &clazz, QXmlStreamWriter &stream) {
198 int day(0);
199 int days(month.size());
200 for (const QVariant &value : month) {
201 if (!value.isNull()) {
202 writeCircle(xComponent(CENTER_CIRCLE_RADIUS, day, days),
203 yComponent(CENTER_CIRCLE_RADIUS, day, days),
204 DATA_CIRCLE_RADIUS * value.toDouble(), color, 0.3,
205 id.arg(day), clazz, stream);
206 }
207 ++day;
208 }
209}
210
211void Infographic::writeLabel(QXmlStreamWriter &stream) {
212 m_label.remove("<b>", Qt::CaseInsensitive);
213 m_label.remove("</b>", Qt::CaseInsensitive);
214
215 QStringList label;
216
217 QStringList words(m_label.split(WHITESPACE));
218 int spaceLeft = LINE_WIDTH;
219 int lineLength(0);
220 int lineStart(0);
221 for (const QString &word : words) {
222 lineLength += word.length() + 1;
223 if (word.length() + 1 > spaceLeft) {
224 label << m_label.mid(lineStart, lineLength);
225 lineStart += lineLength;
226 lineLength = 0;
227
228 spaceLeft = LINE_WIDTH - word.length();
229 } else {
230 spaceLeft = spaceLeft - (word.length() + 1);
231 }
232 }
233 if (lineLength > 0) {
234 label << m_label.mid(lineStart, lineLength);
235 }
236
237 int lines(label.size());
238 int yOffset(CENTER_COORD - 15.0 * lines);
239 int lineNumber(0);
240 for (const QString &line : label) {
241 stream.writeStartElement("text");
242 stream.writeAttribute("id", QString("label-line-%1").arg(lineNumber));
243 stream.writeAttribute("class", "label");
244 stream.writeAttribute("opacity", "0.6");
245 stream.writeAttribute("x", QString::number(CENTER_COORD));
246 stream.writeAttribute("y",
247 QString::number(yOffset + 50.0 * lineNumber));
248 stream.writeAttribute("fill", "#ffffff");
249 stream.writeAttribute("text-anchor", "middle");
250 stream.writeAttribute("font-family", "Ubuntu");
251 stream.writeAttribute("font-size", "40");
252 stream.writeCharacters(line);
253 stream.writeEndElement();
254 ++lineNumber;
255 }
256}
257
258void Infographic::writeSvg(QIODevice &output) {
259 QXmlStreamWriter stream(&output);
260 stream.setAutoFormatting(true);
261 stream.writeStartDocument();
262 stream.writeStartElement("svg");
263 stream.writeAttribute("xmlns", "http://www.w3.org/2000/svg");
264 stream.writeAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
265 stream.writeAttribute("width", QString::number(ceil(SVG_SIZE)));
266 stream.writeAttribute("height", QString::number(ceil(SVG_SIZE)));
267
268 writeMonth(m_secondMonth, "#e54c19", "day-past-%1", "day-past", stream);
269 writeMonth(m_firstMonth, "#ff9900", "day-present-%1", "day-present",
270 stream);
271
272 {
273 // 689 x 691
274 stream.writeStartElement("image");
275 stream.writeAttribute("x",
276 QString::number(ceil(CENTER_COORD - 689.0 / 2)));
277 stream.writeAttribute("y",
278 QString::number(ceil(CENTER_COORD - 691.0 / 2)));
279 stream.writeAttribute("width", "689px");
280 stream.writeAttribute("height", "691px");
281 stream.writeAttribute("xlink:href",
282 "/usr/share/unity8/Greeter/graphics/infographic_circle_back.png");
283 stream.writeEndElement();
284 }
285
286 writeLabel(stream);
287
288 writeDots(m_currentDay, m_firstMonth.size(), "#ffffff", stream);
289
290 stream.writeEndElement();
291 stream.writeEndDocument();
292}
0293
=== added file 'src/infographic/Infographic.h'
--- src/infographic/Infographic.h 1970-01-01 00:00:00 +0000
+++ src/infographic/Infographic.h 2014-06-25 09:58:07 +0000
@@ -0,0 +1,79 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#ifndef INFOGRAPHIC_H_
20#define INFOGRAPHIC_H_
21
22#include <QDate>
23#include <QVariantList>
24
25class QIODevice;
26class QString;
27class QXmlStreamWriter;
28
29namespace UserMetricsInfographic {
30
31class Infographic {
32public:
33 Infographic(QIODevice &input, QIODevice &output);
34
35 virtual ~Infographic();
36
37protected:
38 void readJson(QIODevice &input);
39
40 void splitDataIntoMonths();
41
42 void splitDataIntoMonth(QVariantList &month, const int dayOfMonth,
43 const int daysInMonth, QVariantList::const_iterator& index,
44 const QVariantList::const_iterator& end);
45
46 void writeCircle(double x, double y, double r, const QString &color,
47 double opacity, const QString &id, const QString &clazz,
48 QXmlStreamWriter &stream);
49
50 void writeRing(double x, double y, double r, const QString &color,
51 double opacity, const QString &id, const QString &clazz,
52 QXmlStreamWriter &stream);
53
54 void writeDots(int currentDay, int days, const QString &color,
55 QXmlStreamWriter &stream);
56
57 void writeMonth(const QVariantList &month, const QString &color,
58 const QString &id, const QString &clazz, QXmlStreamWriter &stream);
59
60 void writeLabel(QXmlStreamWriter &stream);
61
62 void writeSvg(QIODevice &output);
63
64 QString m_label;
65
66 int m_currentDay;
67
68 QDate m_lastUpdated;
69
70 QVariantList m_data;
71
72 QVariantList m_firstMonth;
73
74 QVariantList m_secondMonth;
75};
76
77} /* namespace UserMetricsInfographic */
78
79#endif /* INFOGRAPHIC_H_ */
080
=== added file 'src/infographic/main.cpp'
--- src/infographic/main.cpp 1970-01-01 00:00:00 +0000
+++ src/infographic/main.cpp 2014-06-25 09:58:07 +0000
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#include <infographic/Infographic.h>
20
21#include <QCoreApplication>
22#include <QDebug>
23#include <QFile>
24
25using namespace std;
26using namespace UserMetricsInfographic;
27
28int main(int argc, char *argv[]) {
29 QCoreApplication application(argc, argv);
30
31 if (argc < 2) {
32 qWarning() << "Usage: " << argv[0] << "INPUT_FILE [OUTPUT_FILE]";
33 return 1;
34 }
35
36 QFile inputFile(QString::fromUtf8(argv[1]));
37 QFile outputFile;
38 if (argc == 3) {
39 outputFile.setFileName(QString::fromUtf8(argv[2]));
40 outputFile.open(QIODevice::WriteOnly);
41 } else {
42 outputFile.open(1, QIODevice::WriteOnly);
43 }
44
45 inputFile.open(QIODevice::ReadOnly);
46
47 Infographic infographic(inputFile, outputFile);
48
49 inputFile.close();
50 outputFile.close();
51
52 return 0;
53}
054
=== added directory 'src/infographicservice'
=== added file 'src/infographicservice/CMakeLists.txt'
--- src/infographicservice/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/infographicservice/CMakeLists.txt 2014-06-25 09:58:07 +0000
@@ -0,0 +1,58 @@
1
2set(INFOGRAPHICSERVICE_SOURCES
3 Service.cpp
4)
5
6qt5_add_dbus_adaptor(
7 INFOGRAPHICSERVICE_SOURCES
8 ${INFOGRAPHIC_SERVICE_XML}
9 infographicservice/Service.h
10 InfographicService::Service
11 InfographicServiceAdaptor
12)
13
14add_library(
15 infographicservice
16 STATIC
17 ${INFOGRAPHICSERVICE_SOURCES}
18)
19
20qt5_use_modules(
21 infographicservice
22 Core
23 DBus
24)
25
26############################
27# Service executable
28############################
29
30add_executable(
31 infographicservice-bin
32 main.cpp
33)
34
35set_target_properties(
36 infographicservice-bin
37 PROPERTIES
38 OUTPUT_NAME "infographicservice"
39)
40
41target_link_libraries(
42 infographicservice-bin
43 infographicservice
44)
45
46qt5_use_modules(
47 infographicservice-bin
48 Core
49)
50
51#########################
52# Installation
53#########################
54
55install(
56 TARGETS infographicservice-bin
57 RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/libusermetrics"
58)
059
=== added file 'src/infographicservice/Service.cpp'
--- src/infographicservice/Service.cpp 1970-01-01 00:00:00 +0000
+++ src/infographicservice/Service.cpp 2014-06-25 09:58:07 +0000
@@ -0,0 +1,131 @@
1/*
2 * Service.cpp
3 *
4 * Created on: 2 Mar 2014
5 * Author: pete
6 */
7
8#include <infographicservice/InfographicServiceAdaptor.h>
9#include <infographicservice/Service.h>
10#include <libusermetricscommon/DBusPaths.h>
11
12#include <QDateTime>
13#include <QFile>
14#include <cstdio>
15
16using namespace InfographicService;
17using namespace UserMetricsCommon;
18
19Service::Service(const QDir &directory, const QDBusConnection &systemConnection) :
20 m_directory(directory), m_connection(systemConnection), m_adaptor(
21 new InfographicsAdaptor(this)), m_hash(QCryptographicHash::Sha1) {
22
23 m_dirtyTimer.setSingleShot(true);
24 m_dirtyTimer.setTimerType(Qt::VeryCoarseTimer);
25 connect(&m_dirtyTimer, &QTimer::timeout, this, &Service::timeout);
26
27 m_directory.mkpath("tmp");
28 m_tempFile.setFileName(
29 QDir(m_directory.filePath("tmp")).filePath("tmp.svg"));
30
31 if (!m_connection.registerObject(DBusPaths::INFOGRAPHIC_DBUS_PATH, this)) {
32 throw std::logic_error(
33 "Unable to register Infographics object on DBus");
34 }
35 if (!m_connection.registerService(DBusPaths::INFOGRAPHIC_DBUS_NAME)) {
36 throw std::logic_error(
37 "Unable to register Infographics service on DBus");
38 }
39}
40
41Service::~Service() {
42 m_connection.unregisterService(DBusPaths::INFOGRAPHIC_DBUS_NAME);
43 m_connection.unregisterObject(DBusPaths::INFOGRAPHIC_DBUS_PATH);
44}
45
46unsigned int Service::uid() {
47 if (!calledFromDBus()) {
48 return 0;
49 }
50
51 return m_connection.interface()->serviceUid(message().service());
52}
53
54QDir Service::userDirectory() {
55 return m_directory.filePath(QString::number(uid()));
56}
57
58void Service::clear() {
59 userDirectory().removeRecursively();
60}
61
62void Service::update(const QString &visualizer, const QStringList &sources,
63 const QString &filePath) {
64
65 m_hash.reset();
66 m_hash.addData(visualizer.toUtf8());
67 for (const QString &source : sources) {
68 m_hash.addData(source.toUtf8());
69 }
70
71 QString sha(m_hash.result().toHex());
72
73 QDir usersDirectory(userDirectory());
74 QDir infographicDirectory(usersDirectory.filePath(visualizer));
75 QString destination(infographicDirectory.filePath(sha));
76 destination.append("-");
77 destination.append(QString::number(QDateTime::currentMSecsSinceEpoch()));
78 destination.append(".svg");
79
80 QFile file(filePath);
81 QByteArray ba;
82 if (file.open(QIODevice::ReadOnly)) {
83 ba = file.readAll();
84 file.close();
85 } else {
86 qWarning() << "Failed to open file" << filePath;
87 return;
88 }
89
90 if (ba.isEmpty()) {
91 return;
92 }
93
94 usersDirectory.mkpath(visualizer);
95 if (m_tempFile.open(QIODevice::WriteOnly)) {
96 m_tempFile.write(ba);
97 m_tempFile.close();
98 } else {
99 qWarning() << "Failed to write file" << m_tempFile.fileName();
100 }
101
102 int result = std::rename(m_tempFile.fileName().toUtf8().constData(),
103 destination.toUtf8().constData());
104 if (result == -1) {
105 qWarning() << "Failed to move result" << m_tempFile.fileName()
106 << "to destination" << destination;
107 return;
108 }
109
110 // clean up in one minute
111 m_dirty << qMakePair(infographicDirectory.path(), sha + "-*.svg");
112 m_dirtyTimer.start(60000);
113}
114
115void Service::timeout() {
116 for (const QPair<QString, QString> &result : m_dirty) {
117 QDir infographicDirectory(result.first);
118
119 QStringList entries = infographicDirectory.entryList(
120 QStringList() << result.second,
121 QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
122
123 // We don't want to delete the last entry
124 entries.pop_back();
125 for (const QString &entry : entries) {
126 QFile::remove(infographicDirectory.filePath(entry));
127 }
128 }
129
130 m_dirty.clear();
131}
0132
=== added file 'src/infographicservice/Service.h'
--- src/infographicservice/Service.h 1970-01-01 00:00:00 +0000
+++ src/infographicservice/Service.h 2014-06-25 09:58:07 +0000
@@ -0,0 +1,74 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#ifndef INFOGRAPHICSERVICE_SERVICE_H_
20#define INFOGRAPHICSERVICE_SERVICE_H_
21
22#include <QCryptographicHash>
23#include <QDir>
24#include <QDBusContext>
25#include <QDBusConnection>
26#include <QObject>
27#include <QSet>
28#include <QSharedPointer>
29#include <QTimer>
30
31class InfographicsAdaptor;
32
33namespace InfographicService {
34
35class Service: public QObject, protected QDBusContext {
36Q_OBJECT
37
38public:
39 Service(const QDir &directory, const QDBusConnection &systemConnection);
40
41 virtual ~Service();
42
43public Q_SLOTS:
44 void clear();
45
46 void update(const QString &visualizer, const QStringList &sources,
47 const QString &file);
48
49protected Q_SLOTS:
50 void timeout();
51
52protected:
53 virtual unsigned int uid();
54
55 QDir userDirectory();
56
57 QDir m_directory;
58
59 QFile m_tempFile;
60
61 QDBusConnection m_connection;
62
63 QSharedPointer<InfographicsAdaptor> m_adaptor;
64
65 QTimer m_dirtyTimer;
66
67 QCryptographicHash m_hash;
68
69 QSet<QPair<QString, QString>> m_dirty;
70};
71
72}
73
74#endif /* INFOGRAPHICSERVICE_SERVICE_H_ */
075
=== added file 'src/infographicservice/main.cpp'
--- src/infographicservice/main.cpp 1970-01-01 00:00:00 +0000
+++ src/infographicservice/main.cpp 2014-06-25 09:58:07 +0000
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#include <infographicservice/Service.h>
20
21#include <QCoreApplication>
22#include <QDebug>
23#include <csignal>
24
25using namespace InfographicService;
26
27static void exitQt(int sig) {
28 Q_UNUSED(sig);
29 QCoreApplication::exit(0);
30}
31
32int main(int argc, char *argv[]) {
33 QCoreApplication application(argc, argv);
34
35 signal(SIGINT, &exitQt);
36 signal(SIGTERM, &exitQt);
37
38 try {
39 Service service(QDir("/var/lib/usermetrics"),
40 QDBusConnection::systemBus());
41 return application.exec();
42 } catch (std::exception &e) {
43 qWarning() << "Infographic Service:" << e.what();
44 return 1;
45 }
46}
047
=== modified file 'src/libusermetricscommon/CMakeLists.txt'
--- src/libusermetricscommon/CMakeLists.txt 2013-07-17 10:22:05 +0000
+++ src/libusermetricscommon/CMakeLists.txt 2014-06-25 09:58:07 +0000
@@ -2,36 +2,14 @@
2set(USERMETRICS_COMMON_SOURCES2set(USERMETRICS_COMMON_SOURCES
3 DateFactory.cpp3 DateFactory.cpp
4 DateFactoryImpl.cpp4 DateFactoryImpl.cpp
5 DBusPaths.cpp5 FileUtils.cpp
6 Localisation.cpp6 Localisation.cpp
7)7)
88
9set(USERMETRICS_COMMON_DEPENDENCIES9qt5_add_dbus_interface(
10 Core10 USERMETRICS_COMMON_SOURCES
11)11 ${INFOGRAPHIC_SERVICE_XML}
1212 InfographicsInterface
13qt5_add_dbus_interface(
14 USERMETRICS_COMMON_SOURCES
15 "${DATA_DIR}/com.canonical.UserMetrics.xml"
16 UserMetricsInterface
17)
18
19qt5_add_dbus_interface(
20 USERMETRICS_COMMON_SOURCES
21 "${DATA_DIR}/com.canonical.usermetrics.DataSource.xml"
22 DataSourceInterface
23)
24
25qt5_add_dbus_interface(
26 USERMETRICS_COMMON_SOURCES
27 "${DATA_DIR}/com.canonical.usermetrics.UserData.xml"
28 UserDataInterface
29)
30
31qt5_add_dbus_interface(
32 USERMETRICS_COMMON_SOURCES
33 "${DATA_DIR}/com.canonical.usermetrics.DataSet.xml"
34 DataSetInterface
35)13)
3614
37add_library(15add_library(
@@ -42,6 +20,6 @@
4220
43qt5_use_modules(21qt5_use_modules(
44 usermetricscommon22 usermetricscommon
45 ${USERMETRICS_COMMON_DEPENDENCIES}23 Core
24 DBus
46)25)
47
4826
=== removed file 'src/libusermetricscommon/DBusPaths.cpp'
--- src/libusermetricscommon/DBusPaths.cpp 2013-06-28 09:44:36 +0000
+++ src/libusermetricscommon/DBusPaths.cpp 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of version 3 of the GNU Lesser General Public License as published
6 * by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 * details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#include <libusermetricscommon/DBusPaths.h>
20
21using namespace UserMetricsCommon;
22
23QString DBusPaths::serviceName() {
24 return "com.canonical.UserMetrics";
25}
26
27QString DBusPaths::userMetrics() {
28 return "/com/canonical/UserMetrics";
29}
30
31QString DBusPaths::userData(int id) {
32 return QString("/com/canonical/UserMetrics/UserData/%1").arg(id);
33}
34
35QString DBusPaths::dataSource(int id) {
36 return QString("/com/canonical/UserMetrics/DataSource/%1").arg(id);
37}
38
39QString DBusPaths::dataSet(int id) {
40 return QString("/com/canonical/UserMetrics/DataSet/%1").arg(id);
41}
420
=== added file 'src/libusermetricscommon/DBusPaths.h'
--- src/libusermetricscommon/DBusPaths.h 1970-01-01 00:00:00 +0000
+++ src/libusermetricscommon/DBusPaths.h 2014-06-25 09:58:07 +0000
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of version 3 of the GNU Lesser General Public License as published
6 * by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 * details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#ifndef USERMETRICSCOMMON_DBUSPATHS_H_
20#define USERMETRICSCOMMON_DBUSPATHS_H_
21
22#include <QtCore/QString>
23
24namespace UserMetricsCommon {
25
26class DBusPaths {
27public:
28 constexpr static const char* INFOGRAPHIC_DBUS_NAME =
29 "com.canonical.Infographics";
30
31 constexpr static const char* INFOGRAPHIC_DBUS_PATH =
32 "/com/canonical/Infographics";
33};
34
35}
36
37#endif // USERMETRICSCOMMON_DBUSPATHS_H_
038
=== removed file 'src/libusermetricscommon/DBusPaths.h'
--- src/libusermetricscommon/DBusPaths.h 2013-09-24 16:20:00 +0000
+++ src/libusermetricscommon/DBusPaths.h 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of version 3 of the GNU Lesser General Public License as published
6 * by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 * details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#ifndef USERMETRICSCOMMON_DBUSPATHS_H_
20#define USERMETRICSCOMMON_DBUSPATHS_H_
21
22#include <QtCore/QString>
23
24namespace UserMetricsCommon {
25
26class DBusPaths {
27public:
28 static QString serviceName();
29
30 static QString userMetrics();
31
32 static QString userData(int id);
33
34 static QString dataSource(int id);
35
36 static QString dataSet(int id);
37};
38
39}
40
41#endif // USERMETRICSCOMMON_DBUSPATHS_H_
420
=== added file 'src/libusermetricscommon/FileUtils.cpp'
--- src/libusermetricscommon/FileUtils.cpp 1970-01-01 00:00:00 +0000
+++ src/libusermetricscommon/FileUtils.cpp 2014-06-25 09:58:07 +0000
@@ -0,0 +1,52 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#include <libusermetricscommon/FileUtils.h>
20
21#include <QRegularExpression>
22
23using namespace UserMetricsCommon;
24
25QRegularExpression FileUtils::CLICK_REGEX(
26 "^[a-z0-9][a-z0-9+.-]+_[a-zA-Z0-9+.-]+_[0-9][a-zA-Z0-9.+:~-]*$");
27
28FileUtils::FileUtils() {
29}
30
31FileUtils::~FileUtils() {
32}
33
34QStringList FileUtils::listDirectory(const QDir &directory,
35 QDir::Filters filters, QDir::SortFlags sort) {
36 QStringList names;
37 for (const QString& name : directory.entryList(
38 filters | QDir::NoDotAndDotDot, sort)) {
39 names << directory.filePath(name);
40 }
41 return names;
42}
43
44void FileUtils::shortApplicationId(QString &applicationId) {
45 QRegularExpressionMatch match = CLICK_REGEX.match(applicationId);
46 if (match.hasMatch()) {
47 int index = applicationId.indexOf('_');
48 if (index != -1) {
49 applicationId.remove(index, applicationId.size());
50 }
51 }
52}
053
=== added file 'src/libusermetricscommon/FileUtils.h'
--- src/libusermetricscommon/FileUtils.h 1970-01-01 00:00:00 +0000
+++ src/libusermetricscommon/FileUtils.h 2014-06-25 09:58:07 +0000
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#ifndef USERMETRICSCOMMON_FILEUTILS_H_
20#define USERMETRICSCOMMON_FILEUTILS_H_
21
22#include <QDir>
23#include <QSet>
24#include <QSharedPointer>
25#include <QStringList>
26
27namespace UserMetricsCommon {
28
29class FileUtils {
30public:
31 typedef QSharedPointer<FileUtils> Ptr;
32
33 FileUtils();
34
35 virtual ~FileUtils();
36
37 static QRegularExpression CLICK_REGEX;
38
39 virtual QStringList listDirectory(const QDir &directory,
40 QDir::Filters filters, QDir::SortFlags sort = QDir::NoSort);
41
42 void shortApplicationId(QString &applicationId);
43};
44
45}
46
47#endif /* USERMETRICSCOMMON_FILEUTILS_H_ */
048
=== modified file 'src/libusermetricsinput/CMakeLists.txt'
--- src/libusermetricsinput/CMakeLists.txt 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/CMakeLists.txt 2014-06-25 09:58:07 +0000
@@ -13,11 +13,13 @@
13)13)
1414
15set(USERMETRICSINPUT_SOURCES15set(USERMETRICSINPUT_SOURCES
16 Factory.cpp
16 Metric.cpp17 Metric.cpp
17 MetricImpl.cpp18 MetricImpl.cpp
18 MetricManager.cpp19 MetricManager.cpp
19 MetricManagerImpl.cpp20 MetricManagerImpl.cpp
20 MetricManagerImpl.cpp21 MetricManagerImpl.cpp
22 MetricParameters.cpp
21 MetricUpdate.cpp23 MetricUpdate.cpp
22 MetricUpdateImpl.cpp24 MetricUpdateImpl.cpp
23 usermetricsinput.cpp25 usermetricsinput.cpp
2426
=== added file 'src/libusermetricsinput/Factory.cpp'
--- src/libusermetricsinput/Factory.cpp 1970-01-01 00:00:00 +0000
+++ src/libusermetricsinput/Factory.cpp 2014-06-25 09:58:07 +0000
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of version 3 of the GNU Lesser General Public License as published
6 * by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 * details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#include <libusermetricsinput/Factory.h>
20#include <libusermetricsinput/MetricImpl.h>
21#include <libusermetricsinput/MetricUpdateImpl.h>
22
23namespace UserMetricsInput {
24
25Factory::Factory() {
26}
27
28Factory::~Factory() {
29}
30
31MetricPtr Factory::newMetric(const QDir &metricsDirectory,
32 const MetricParameters &parameters, Factory::Ptr factory) {
33 QSharedPointer<MetricImpl> metric(
34 new MetricImpl(metricsDirectory, parameters, factory));
35 metric->setSelf(metric);
36 return metric;
37}
38
39MetricUpdatePtr Factory::newMetricUpdate(MetricPtr metric) {
40 return MetricUpdatePtr(
41 new MetricUpdateImpl(metric.staticCast<MetricImpl>()));
42}
43
44QDate Factory::currentDate() const {
45 return QDate::currentDate();
46}
47
48}
049
=== added file 'src/libusermetricsinput/Factory.h'
--- src/libusermetricsinput/Factory.h 1970-01-01 00:00:00 +0000
+++ src/libusermetricsinput/Factory.h 2014-06-25 09:58:07 +0000
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of version 3 of the GNU Lesser General Public License as published
6 * by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 * details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#ifndef USERMETRICSINPUT_FACTORY_H_
20#define USERMETRICSINPUT_FACTORY_H_
21
22#include <libusermetricsinput/MetricParameters.h>
23
24#include <QtCore/QDir>
25#include <QtCore/QSharedPointer>
26
27namespace UserMetricsInput {
28
29class Factory {
30public:
31 typedef QSharedPointer<Factory> Ptr;
32
33 Factory();
34
35 virtual ~Factory();
36
37 virtual MetricPtr newMetric(const QDir &metricsDirectory,
38 const MetricParameters &parameters, Factory::Ptr factory);
39
40 virtual MetricUpdatePtr newMetricUpdate(MetricPtr metric);
41
42 virtual QDate currentDate() const;
43};
44
45}
46
47#endif /* USERMETRICSINPUT_FACTORY_H_ */
048
=== modified file 'src/libusermetricsinput/Metric.h'
--- src/libusermetricsinput/Metric.h 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/Metric.h 2014-06-25 09:58:07 +0000
@@ -68,7 +68,7 @@
68 * The MetricUpdate object must be deleted - this is when the68 * The MetricUpdate object must be deleted - this is when the
69 * actual update will be sent to the storage service.69 * actual update will be sent to the storage service.
70 */70 */
71 virtual MetricUpdate * update(const QString &username = "") = 0;71 virtual MetricUpdatePtr update(const QString &username = "") = 0;
7272
73 /**73 /**
74 * @brief Update the "today" value for a simple user metric74 * @brief Update the "today" value for a simple user metric
7575
=== modified file 'src/libusermetricsinput/MetricImpl.cpp'
--- src/libusermetricsinput/MetricImpl.cpp 2013-09-24 16:20:00 +0000
+++ src/libusermetricsinput/MetricImpl.cpp 2014-06-25 09:58:07 +0000
@@ -17,99 +17,252 @@
17 */17 */
1818
19#include <stdexcept>19#include <stdexcept>
20#include <cstdio>
2021
22#include <libusermetricscommon/Localisation.h>
21#include <libusermetricsinput/MetricImpl.h>23#include <libusermetricsinput/MetricImpl.h>
22#include <libusermetricsinput/MetricUpdateImpl.h>
23#include <libusermetricscommon/DBusPaths.h>
24#include <libusermetricscommon/UserDataInterface.h>
25#include <libusermetricscommon/DataSetInterface.h>
2624
27#include <QtDBus/QtDBus>25#include <QtCore/QDebug>
26#include <QtCore/QVariantList>
27#include <QtCore/QJsonDocument>
28#include <QtCore/QJsonParseError>
2829
29using namespace std;30using namespace std;
30using namespace UserMetricsCommon;
31using namespace UserMetricsInput;31using namespace UserMetricsInput;
3232
33MetricImpl::MetricImpl(const QString &dataSourceId, const QString &formatString,33MetricImpl::MetricImpl(const QDir &metricDirectory,
34 const QString &dataSourcePath, const QDBusConnection &dbusConnection,34 const MetricParameters &parameters, Factory::Ptr factory,
35 QObject *parent) :35 QObject *parent) :
36 Metric(parent), m_dbusConnection(dbusConnection), m_userMetrics(36 Metric(parent), m_metricDirectory(metricDirectory), m_parameters(
37 DBusPaths::serviceName(), DBusPaths::userMetrics(),37 parameters), m_factory(factory) {
38 dbusConnection), m_dataSource(DBusPaths::serviceName(),
39 dataSourcePath, dbusConnection), m_dataSourceId(dataSourceId), m_formatString(
40 formatString) {
41}38}
4239
43MetricImpl::~MetricImpl() {40MetricImpl::~MetricImpl() {
44}41}
4542
46QDBusObjectPath MetricImpl::createDataSet(const QString &usernameIn) {43void MetricImpl::setSelf(QSharedPointer<MetricImpl> self) {
47 QString username;44 m_self = self;
48 if (m_dataSource.metricType() == MetricType::SYSTEM) {45}
49 username = "";46
50 } else if (usernameIn.isEmpty()) {47void MetricImpl::setParameters(const MetricParameters &parameters) {
51 username = QString::fromUtf8(qgetenv("USER"));48 m_parameters = parameters;
52 } else {49}
53 username = usernameIn;50
54 }51MetricUpdatePtr MetricImpl::update(const QString &username) {
5552 Q_UNUSED(username);
56 QDBusPendingReply<QDBusObjectPath> userDataReply(53 loadData();
57 m_userMetrics.createUserData(username));54 return m_factory->newMetricUpdate(m_self);
58
59 userDataReply.waitForFinished();
60 if (userDataReply.isError()) {
61 throw logic_error(userDataReply.error().message().toStdString());
62 }
63
64 QDBusObjectPath userDataPath(userDataReply);
65
66 com::canonical::usermetrics::UserData userDataInterface(
67 DBusPaths::serviceName(), userDataPath.path(), m_dbusConnection);
68 if (!userDataInterface.isValid()) {
69 throw logic_error("user data interface invalid");
70 }
71
72 QDBusPendingReply<QDBusObjectPath> dataSetReply(
73 userDataInterface.createDataSet(m_dataSourceId));
74
75 dataSetReply.waitForFinished();
76 if (dataSetReply.isError()) {
77 throw logic_error(dataSetReply.error().message().toStdString());
78 }
79
80 return dataSetReply;
81}
82
83MetricUpdate * MetricImpl::update(const QString &username) {
84 QDBusObjectPath dataSetPath(createDataSet(username));
85
86 return new MetricUpdateImpl(dataSetPath.path(), m_dbusConnection);
87}55}
8856
89void MetricImpl::update(double value, const QString &username) {57void MetricImpl::update(double value, const QString &username) {
90 QDBusObjectPath dataSetPath(createDataSet(username));58 Q_UNUSED(username);
9159 loadData();
92 com::canonical::usermetrics::DataSet dataSetInterface(60 update(QVariantList() << value);
93 DBusPaths::serviceName(), dataSetPath.path(), m_dbusConnection);
94
95 QDBusPendingReply<> reply(dataSetInterface.update(QVariantList() << value));
96
97 reply.waitForFinished();
98 if (reply.isError()) {
99 throw logic_error(reply.error().message().toStdString());
100 }
101}61}
10262
103void MetricImpl::increment(double amount, const QString &username) {63void MetricImpl::increment(double amount, const QString &username) {
104 QDBusObjectPath dataSetPath(createDataSet(username));64 Q_UNUSED(username);
10565 loadData();
106 com::canonical::usermetrics::DataSet dataSetInterface(66
107 DBusPaths::serviceName(), dataSetPath.path(), m_dbusConnection);67 QVariantList data;
10868
109 QDBusPendingReply<> reply(dataSetInterface.increment(amount));69 QDate currentDate(m_factory->currentDate());
11070 if (m_lastUpdated == currentDate && !m_currentData.empty()) {
111 reply.waitForFinished();71 double value(m_currentData.first().toDouble());
112 if (reply.isError()) {72 value += amount;
113 throw logic_error(reply.error().message().toStdString());73 data << value;
74 } else {
75 data << amount;
76 }
77
78 update(data);
79}
80
81void MetricImpl::update(const QVariantList &data) {
82 QDate currentDate(m_factory->currentDate());
83 int daysSinceLastUpdate(m_lastUpdated.daysTo(currentDate));
84
85 QVariantList newData(data);
86
87 // if we are in this situation we do nothing
88 // new: |4|5|6|7|8|9|0|
89 // old: |1|2|3|
90 // res: |4|5|6|7|8|9|0|
91 if (daysSinceLastUpdate + m_currentData.size() > newData.size()) {
92 if (daysSinceLastUpdate < newData.size()) {
93 // if we are in this situation - we need the
94 // protruding data from old
95 // new: |6|7|8|9|0|
96 // old: |1|2|3|4|5|
97 // res: |6|7|8|9|0|4|5|
98 auto oldDataIt(m_currentData.constBegin());
99 // wind forward until the data we want
100 for (int i(daysSinceLastUpdate); i < newData.size(); ++i) {
101 ++oldDataIt;
102 }
103 // append the rest of the data
104 for (; oldDataIt != m_currentData.constEnd(); ++oldDataIt) {
105 newData.append(*oldDataIt);
106 }
107 } else {
108 // we are in this situation - there is a gap
109 // and we want the whole of the old data appending
110 // new: |6|7|8|9|0|
111 // old: |1|2|3|4|5|
112 // res: |6|7|8|9|0|n|1|2|3|4|5|
113 const int daysToPad(daysSinceLastUpdate - newData.size());
114 // pad the data will null variants
115 for (int i(0); i < daysToPad; ++i) {
116 newData.append(QVariant());
117 }
118 // append the whole of the old data
119 newData.append(m_currentData);
120 }
121 }
122
123 while (newData.size() > 62) {
124 newData.pop_back();
125 }
126
127 m_lastUpdated = currentDate;
128 m_currentData = newData;
129 scaleData();
130 writeData();
131}
132
133void MetricImpl::scaleData() {
134 m_scaledData = m_currentData;
135
136 const QVariantMap &options(m_parameters.options());
137
138 bool hasMinimum(options.contains("minimum"));
139 bool hasMaximum(options.contains("maximum"));
140
141 double min(numeric_limits<double>::max());
142 double max(numeric_limits<double>::min());
143
144 if (hasMinimum) {
145 min = options["minimum"].toDouble();
146 }
147 if (hasMaximum) {
148 max = options["maximum"].toDouble();
149 }
150
151 // if we need to find either the max or the min
152 if (!hasMinimum || !hasMaximum) {
153 for (QVariant &variant : m_scaledData) {
154 if (variant.type() == QVariant::String) {
155 variant = QVariant();
156 } else if (variant.type() == QVariant::Double) {
157 double value(variant.toDouble());
158 if (!hasMinimum && value < min) {
159 min = value;
160 }
161 if (!hasMaximum && value > max) {
162 max = value;
163 }
164 }
165 }
166 }
167
168 for (QVariant &variant : m_scaledData) {
169 if (variant.type() == QVariant::Double) {
170 if (min != max) {
171 double value(variant.toDouble());
172 if (hasMaximum && value > max) {
173 value = max;
174 }
175 if (hasMinimum && value < min) {
176 value = min;
177 }
178 variant = (value - min) / (max - min);
179 } else {
180 variant = 0.5;
181 }
182 }
183 }
184}
185
186QString MetricImpl::buildJsonFile() {
187 return m_metricDirectory.filePath(
188 m_parameters.id() + ".libusermetrics.json");
189}
190
191QString MetricImpl::buildTmpFile() {
192 return QDir(m_metricDirectory.filePath(".tmp")).filePath(
193 "." + m_parameters.id() + ".libusermetrics.json");
194}
195
196void MetricImpl::loadData() {
197 if (m_parameters.type() == MetricType::SYSTEM) {
198// qDebug() << "we'd like to do something different with";
199 }
200
201 QVariantList existingData;
202
203 QFile jsonFile(buildJsonFile());
204 if (jsonFile.open(QIODevice::ReadOnly)) {
205 QJsonParseError error;
206 QJsonDocument document(
207 QJsonDocument::fromJson(jsonFile.readAll(), &error));
208 jsonFile.close();
209 QVariantMap map(document.toVariant().toMap());
210 // There's no point reading the rest of the information.
211 // We'll just overwrite it anyway.
212 m_currentData = map["data"].toList();
213 m_lastUpdated = map["lastUpdated"].toDate();
214 }
215}
216
217QString MetricImpl::label() const {
218 if (m_currentData.isEmpty() || m_currentData.first().isNull()
219 || m_parameters.formatString().isEmpty()
220 || m_factory->currentDate() != m_lastUpdated) {
221 const QString &emptyDataString = m_parameters.emptyDataString();
222 if (emptyDataString.isEmpty()) {
223 QString empty(_("No data for today"));
224 empty.append(" (");
225 empty.append(m_parameters.id());
226 empty.append(")");
227 return empty;
228 } else {
229 return emptyDataString;
230 }
231 }
232
233 return QString(_(qPrintable(m_parameters.formatString()))).arg(
234 m_currentData.first().toString());
235}
236
237void MetricImpl::writeData() {
238 QVariantMap root;
239 root["lastUpdated"] = m_lastUpdated;
240 root["data"] = m_currentData;
241 root["scaledData"] = m_scaledData;
242 root["id"] = m_parameters.id();
243 root["label"] = label();
244 root["formatString"] = m_parameters.formatString();
245 root["emptyDataString"] = m_parameters.emptyDataString();
246 root["textDomain"] = m_parameters.textDomain();
247 root["options"] = m_parameters.options();
248
249 QJsonDocument document(QJsonDocument::fromVariant(root));
250
251 m_metricDirectory.mkpath(".tmp");
252 QFile tmpFile(buildTmpFile());
253 if (tmpFile.open(QIODevice::WriteOnly)) {
254 tmpFile.write(document.toJson());
255 tmpFile.close();
256 } else {
257 qWarning() << "Could not write usermetrics file" << tmpFile.fileName();
258 return;
259 }
260
261 QString jsonFile(buildJsonFile());
262 int result = std::rename(tmpFile.fileName().toUtf8().constData(),
263 jsonFile.toUtf8().constData());
264 if (result == -1) {
265 qWarning() << "Failed to move result" << tmpFile.fileName()
266 << "to destination" << jsonFile;
114 }267 }
115}268}
116269
=== modified file 'src/libusermetricsinput/MetricImpl.h'
--- src/libusermetricsinput/MetricImpl.h 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/MetricImpl.h 2014-06-25 09:58:07 +0000
@@ -19,42 +19,65 @@
19#ifndef USERMETRICSINPUT_METRICIMPL_H_19#ifndef USERMETRICSINPUT_METRICIMPL_H_
20#define USERMETRICSINPUT_METRICIMPL_H_20#define USERMETRICSINPUT_METRICIMPL_H_
2121
22#include <libusermetricsinput/Metric.h>22#include <libusermetricsinput/Factory.h>
23#include <libusermetricscommon/UserMetricsInterface.h>23#include <libusermetricsinput/MetricImpl.h>
24#include <libusermetricscommon/DataSourceInterface.h>24#include <libusermetricsinput/MetricParameters.h>
2525
26#include <QtCore/QObject>26#include <QtCore/QDir>
27#include <QtCore/QDate>
27#include <QtCore/QString>28#include <QtCore/QString>
28#include <QtDBus/QtDBus>
2929
30namespace UserMetricsInput {30namespace UserMetricsInput {
3131
32class MetricImpl: public Metric {32class MetricImpl: public Metric {
33public:33public:
34 explicit MetricImpl(const QString &dataSourceId,34 typedef QSharedPointer<MetricImpl> Ptr;
35 const QString &formatString, const QString &dataSourcePath,35
36 const QDBusConnection &dbusConnection, QObject *parent = 0);36 explicit MetricImpl(const QDir &metriccDirectory,
37 const MetricParameters &parameters,
38 Factory::Ptr factory,
39 QObject *parent = 0);
3740
38 virtual ~MetricImpl();41 virtual ~MetricImpl();
3942
40 virtual MetricUpdate * update(const QString &username = "");43 virtual MetricUpdatePtr update(const QString &username = "");
4144
42 virtual void update(double value, const QString &username = "");45 virtual void update(double value, const QString &username = "");
4346
44 virtual void increment(double amount = 1.0f, const QString &username = "");47 virtual void increment(double amount = 1.0f, const QString &username = "");
4548
49 void setParameters(const MetricParameters &parameters);
50
51 void setSelf(QSharedPointer<MetricImpl> self);
52
53 void update(const QVariantList &data);
54
46protected:55protected:
47 virtual QDBusObjectPath createDataSet(const QString &usernameIn);56 QString label() const;
4857
49 QDBusConnection m_dbusConnection;58 void scaleData();
5059
51 com::canonical::UserMetrics m_userMetrics;60 void loadData();
5261
53 com::canonical::usermetrics::DataSource m_dataSource;62 void writeData();
5463
55 QString m_dataSourceId;64 QString buildJsonFile();
5665
57 QString m_formatString;66 QString buildTmpFile();
67
68 QDir m_metricDirectory;
69
70 MetricParameters m_parameters;
71
72 Factory::Ptr m_factory;
73
74 QWeakPointer<MetricImpl> m_self;
75
76 QVariantList m_currentData;
77
78 QVariantList m_scaledData;
79
80 QDate m_lastUpdated;
58};81};
5982
60}83}
6184
=== modified file 'src/libusermetricsinput/MetricManager.cpp'
--- src/libusermetricsinput/MetricManager.cpp 2013-07-02 14:26:11 +0000
+++ src/libusermetricsinput/MetricManager.cpp 2014-06-25 09:58:07 +0000
@@ -17,28 +17,22 @@
17 */17 */
1818
19#include <libusermetricsinput/MetricManagerImpl.h>19#include <libusermetricsinput/MetricManagerImpl.h>
20#include <libusermetricscommon/DBusPaths.h>
21#include <QtDBus/QtDBus>
2220
23using namespace UserMetricsCommon;
24using namespace UserMetricsInput;21using namespace UserMetricsInput;
2522
26MetricManager::MetricManager(QObject *parent) :23MetricManager::MetricManager(QObject *parent) :
27 QObject(parent) {24 QObject(parent) {
28
29}25}
3026
31MetricManager::~MetricManager() {27MetricManager::~MetricManager() {
32}28}
3329
34MetricManager * MetricManager::getInstance() {30MetricManager * MetricManager::getInstance() {
35 QDBusConnection dbusConnection(QDBusConnection::systemBus());31 return getInstance(qgetenv("APP_ID"));
3632}
37 QDBusConnectionInterface* interface = dbusConnection.interface();33
38 if (!interface->isServiceRegistered(DBusPaths::serviceName())) {34MetricManager * MetricManager::getInstance(const QString &appId) {
39 QDBusReply<void> reply(35 Factory::Ptr factory(new Factory());
40 interface->startService(DBusPaths::serviceName()));36 return new MetricManagerImpl(factory, QDir::home().filePath(".cache"),
41 }37 appId);
42
43 return new MetricManagerImpl(dbusConnection);
44}38}
4539
=== modified file 'src/libusermetricsinput/MetricManager.h'
--- src/libusermetricsinput/MetricManager.h 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/MetricManager.h 2014-06-25 09:58:07 +0000
@@ -20,6 +20,7 @@
20#define USERMETRICSINPUT_METRICMANAGER_H_20#define USERMETRICSINPUT_METRICMANAGER_H_
2121
22#include <libusermetricsinput/Metric.h>22#include <libusermetricsinput/Metric.h>
23#include <libusermetricsinput/MetricParameters.h>
2324
24/**25/**
25 * @{26 * @{
@@ -31,35 +32,12 @@
31namespace UserMetricsInput {32namespace UserMetricsInput {
3233
33class MetricManager;34class MetricManager;
34class MetricParametersPrivate;
3535
36/**36/**
37 * @brief Shared pointer for the MetricManager37 * @brief Shared pointer for the MetricManager
38 **/38 **/
39typedef QScopedPointer<MetricManager> MetricManagerPtr;39typedef QScopedPointer<MetricManager> MetricManagerPtr;
4040
41class Q_DECL_EXPORT MetricParameters {
42public:
43
44 explicit MetricParameters(const QString &dataSourceId);
45
46 MetricParameters & formatString(const QString &formatString);
47
48 MetricParameters & emptyDataString(const QString &emptyDataString);
49
50 MetricParameters & textDomain(const QString &textDomain);
51
52 MetricParameters & minimum(double minimum);
53
54 MetricParameters & maximum(double maximum);
55
56 MetricParameters & type(MetricType type);
57
58 virtual ~MetricParameters();
59
60 QScopedPointer<MetricParametersPrivate> p;
61};
62
63/**41/**
64 * @brief Central place for registering and updating user metrics.42 * @brief Central place for registering and updating user metrics.
65 *43 *
@@ -86,6 +64,13 @@
86 static MetricManager * getInstance();64 static MetricManager * getInstance();
8765
88 /**66 /**
67 * @brief Gets a new instance of the MetricManager with a specified APP_ID.
68 *
69 * If you want a singleton instance then hold onto this.
70 */
71 static MetricManager * getInstance(const QString &appId);
72
73 /**
89 * @brief Register a new Metric.74 * @brief Register a new Metric.
90 *75 *
91 * @param dataSourceId The unique ID of the data source, e.g. "facebook"76 * @param dataSourceId The unique ID of the data source, e.g. "facebook"
@@ -97,6 +82,7 @@
97 * acceptable to call this method more than once. The same Metric instance82 * acceptable to call this method more than once. The same Metric instance
98 * will be returned.83 * will be returned.
99 */84 */
85 Q_DECL_DEPRECATED
100 virtual MetricPtr add(const QString &dataSourceId,86 virtual MetricPtr add(const QString &dataSourceId,
101 const QString &formatString, const QString &emptyDataString = "",87 const QString &formatString, const QString &emptyDataString = "",
102 const QString &textDomain = "") = 0;88 const QString &textDomain = "") = 0;
10389
=== modified file 'src/libusermetricsinput/MetricManagerImpl.cpp'
--- src/libusermetricsinput/MetricManagerImpl.cpp 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/MetricManagerImpl.cpp 2014-06-25 09:58:07 +0000
@@ -16,88 +16,45 @@
16 * Author: Pete Woods <pete.woods@canonical.com>16 * Author: Pete Woods <pete.woods@canonical.com>
17 */17 */
1818
19#include <libusermetricscommon/FileUtils.h>
19#include <libusermetricsinput/MetricImpl.h>20#include <libusermetricsinput/MetricImpl.h>
20#include <libusermetricsinput/MetricManagerImpl.h>21#include <libusermetricsinput/MetricManagerImpl.h>
21#include <libusermetricscommon/DBusPaths.h>
22
23#include <QtDBus/QtDBus>
24#include <QtCore/QDebug>
2522
26#include <stdexcept>23#include <stdexcept>
24#include <QDebug>
25#include <QRegularExpression>
26
2727
28using namespace std;28using namespace std;
29using namespace UserMetricsInput;
29using namespace UserMetricsCommon;30using namespace UserMetricsCommon;
30using namespace UserMetricsInput;31
3132static void shortApplicationId(QString &applicationId) {
32class UserMetricsInput::MetricParametersPrivate {33 QRegularExpressionMatch match = FileUtils::CLICK_REGEX.match(applicationId);
33 friend class MetricManagerImpl;34 if (match.hasMatch()) {
34 friend class MetricParameters;35 int index = applicationId.indexOf('_');
3536 if (index != -1) {
36public:37 applicationId.remove(index, applicationId.size());
37 explicit MetricParametersPrivate(const QString &dataSourceId) :38 }
38 m_dataSourceId(dataSourceId), m_type(MetricType::USER) {39 }
39 }40}
4041
41 ~MetricParametersPrivate() {42MetricManagerImpl::MetricManagerImpl(Factory::Ptr factory,
42 }43 const QDir &cacheDirectory, const QString &applicationId,
43
44protected:
45 QString m_dataSourceId;
46
47 QString m_formatString;
48
49 QString m_emptyDataString;
50
51 QString m_textDomain;
52
53 MetricType m_type;
54
55 QVariantMap m_options;
56};
57
58MetricParameters::MetricParameters(const QString &dataSourceId) :
59 p(new MetricParametersPrivate(dataSourceId)) {
60}
61
62MetricParameters::~MetricParameters() {
63}
64
65MetricParameters & MetricParameters::formatString(const QString &formatString) {
66 p->m_formatString = formatString;
67 return *this;
68}
69
70MetricParameters & MetricParameters::emptyDataString(
71 const QString &emptyDataString) {
72 p->m_emptyDataString = emptyDataString;
73 return *this;
74}
75
76MetricParameters & MetricParameters::textDomain(const QString &textDomain) {
77 p->m_textDomain = textDomain;
78 return *this;
79}
80
81MetricParameters & MetricParameters::minimum(double minimum) {
82 p->m_options["minimum"] = minimum;
83 return *this;
84}
85
86MetricParameters & MetricParameters::maximum(double maximum) {
87 p->m_options["maximum"] = maximum;
88 return *this;
89}
90
91MetricParameters & MetricParameters::type(MetricType type) {
92 p->m_type = type;
93 return *this;
94}
95
96MetricManagerImpl::MetricManagerImpl(const QDBusConnection &dbusConnection,
97 QObject *parent) :44 QObject *parent) :
98 MetricManager(parent), m_dbusConnection(dbusConnection), m_interface(45 MetricManager(parent), m_factory(factory) {
99 DBusPaths::serviceName(), DBusPaths::userMetrics(),46 if (applicationId.isEmpty()) {
100 dbusConnection) {47 throw logic_error("Invalid application ID");
48 }
49
50 QString shortId(applicationId);
51 shortApplicationId(shortId);
52
53 QDir applicationDirectory(cacheDirectory.filePath(shortId));
54 if (!applicationDirectory.mkpath("usermetrics")) {
55 throw logic_error("Cannot write to cache directory");
56 }
57 m_metricDirectory = applicationDirectory.filePath("usermetrics");
101}58}
10259
103MetricManagerImpl::~MetricManagerImpl() {60MetricManagerImpl::~MetricManagerImpl() {
@@ -112,27 +69,17 @@
112}69}
11370
114MetricPtr MetricManagerImpl::add(const MetricParameters &parameters) {71MetricPtr MetricManagerImpl::add(const MetricParameters &parameters) {
115 QDBusPendingReply<QDBusObjectPath> reply(72 const QString &dataSourceId(parameters.id());
116 m_interface.createDataSource(parameters.p->m_dataSourceId,73 auto metric(m_metrics.find(dataSourceId));
117 parameters.p->m_formatString,
118 parameters.p->m_emptyDataString, parameters.p->m_textDomain,
119 parameters.p->m_type, parameters.p->m_options));
120
121 reply.waitForFinished();
122
123 if (reply.isError()) {
124 throw logic_error(reply.error().message().toStdString());
125 }
126
127 QDBusObjectPath path(reply.value());
128
129 auto metric(m_metrics.find(parameters.p->m_dataSourceId));
130 if (metric == m_metrics.end()) {74 if (metric == m_metrics.end()) {
131 MetricPtr newMetric(75 MetricPtr newMetric(
132 new MetricImpl(parameters.p->m_dataSourceId,76 m_factory->newMetric(m_metricDirectory, parameters, m_factory));
133 parameters.p->m_formatString, path.path(),77 metric = m_metrics.insert(dataSourceId, newMetric);
134 m_dbusConnection));78 } else {
135 metric = m_metrics.insert(parameters.p->m_dataSourceId, newMetric);79 MetricImpl::Ptr existingMetric(metric->dynamicCast<MetricImpl>());
80 if(existingMetric) {
81 existingMetric->setParameters(parameters);
82 }
136 }83 }
137 return *metric;84 return *metric;
138}85}
13986
=== modified file 'src/libusermetricsinput/MetricManagerImpl.h'
--- src/libusermetricsinput/MetricManagerImpl.h 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/MetricManagerImpl.h 2014-06-25 09:58:07 +0000
@@ -19,8 +19,8 @@
19#ifndef USERMETRICSINPUT_METRICMANAGERIMPL_H_19#ifndef USERMETRICSINPUT_METRICMANAGERIMPL_H_
20#define USERMETRICSINPUT_METRICMANAGERIMPL_H_20#define USERMETRICSINPUT_METRICMANAGERIMPL_H_
2121
22#include <libusermetricsinput/Factory.h>
22#include <libusermetricsinput/MetricManager.h>23#include <libusermetricsinput/MetricManager.h>
23#include <libusermetricscommon/UserMetricsInterface.h>
2424
25#include <QtCore/QMap>25#include <QtCore/QMap>
2626
@@ -28,11 +28,13 @@
2828
29class MetricManagerImpl: public MetricManager {29class MetricManagerImpl: public MetricManager {
30public:30public:
31 explicit MetricManagerImpl(const QDBusConnection &dbusConnection,31 explicit MetricManagerImpl(Factory::Ptr factory,
32 const QDir &cacheDirectory, const QString &applicationId,
32 QObject *parent = 0);33 QObject *parent = 0);
3334
34 virtual ~MetricManagerImpl();35 virtual ~MetricManagerImpl();
3536
37 Q_DECL_DEPRECATED
36 virtual MetricPtr add(const QString &dataSourceId,38 virtual MetricPtr add(const QString &dataSourceId,
37 const QString &formatString, const QString &emptyDataString = "",39 const QString &formatString, const QString &emptyDataString = "",
38 const QString &textDomain = "");40 const QString &textDomain = "");
@@ -40,9 +42,9 @@
40 virtual MetricPtr add(const MetricParameters &parameters);42 virtual MetricPtr add(const MetricParameters &parameters);
4143
42protected:44protected:
43 QDBusConnection m_dbusConnection;45 Factory::Ptr m_factory;
4446
45 com::canonical::UserMetrics m_interface;47 QDir m_metricDirectory;
4648
47 QMap<QString, MetricPtr> m_metrics;49 QMap<QString, MetricPtr> m_metrics;
48};50};
4951
=== added file 'src/libusermetricsinput/MetricParameters.cpp'
--- src/libusermetricsinput/MetricParameters.cpp 1970-01-01 00:00:00 +0000
+++ src/libusermetricsinput/MetricParameters.cpp 2014-06-25 09:58:07 +0000
@@ -0,0 +1,132 @@
1/*
2 * MetricParametersy.cpp
3 *
4 * Created on: 11 Dec 2013
5 * Author: pete
6 */
7
8#include <libusermetricsinput/MetricParameters.h>
9
10#include <QVariantMap>
11
12namespace UserMetricsInput {
13
14class MetricParametersPrivate {
15 friend class MetricManagerImpl;
16 friend class MetricParameters;
17
18public:
19 explicit MetricParametersPrivate(const QString &dataSourceId) :
20 m_dataSourceId(dataSourceId), m_type(MetricType::USER) {
21 }
22
23 explicit MetricParametersPrivate(const MetricParametersPrivate &other) :
24 m_dataSourceId(other.m_dataSourceId), m_formatString(
25 other.m_formatString), m_emptyDataString(
26 other.m_emptyDataString), m_textDomain(other.m_textDomain), m_type(
27 other.m_type), m_options(other.m_options) {
28 }
29
30 ~MetricParametersPrivate() {
31 }
32
33protected:
34 QString m_dataSourceId;
35
36 QString m_formatString;
37
38 QString m_emptyDataString;
39
40 QString m_textDomain;
41
42 MetricType m_type;
43
44 QVariantMap m_options;
45};
46
47MetricParameters::MetricParameters(const QString &dataSourceId) :
48 p(new MetricParametersPrivate(dataSourceId)) {
49}
50
51MetricParameters::MetricParameters(const MetricParameters &other) :
52 p(new MetricParametersPrivate(*other.p)) {
53}
54
55MetricParameters::~MetricParameters() {
56}
57
58MetricParameters & MetricParameters::operator=(const MetricParameters &other) {
59 p->m_dataSourceId = other.p->m_dataSourceId;
60 p->m_formatString = other.p->m_formatString;
61 p->m_emptyDataString = other.p->m_emptyDataString;
62 p->m_textDomain = other.p->m_textDomain;
63 p->m_type = other.p->m_type;
64 p->m_options = other.p->m_options;
65 return *this;
66}
67
68bool MetricParameters::operator==(const MetricParameters &other) const {
69 return p->m_dataSourceId == other.p->m_dataSourceId
70 && p->m_formatString == other.p->m_formatString
71 && p->m_emptyDataString == other.p->m_emptyDataString
72 && p->m_textDomain == other.p->m_textDomain
73 && p->m_type == other.p->m_type
74 && p->m_options == other.p->m_options;
75}
76
77MetricParameters & MetricParameters::formatString(const QString &formatString) {
78 p->m_formatString = formatString;
79 return *this;
80}
81
82MetricParameters & MetricParameters::emptyDataString(
83 const QString &emptyDataString) {
84 p->m_emptyDataString = emptyDataString;
85 return *this;
86}
87
88MetricParameters & MetricParameters::textDomain(const QString &textDomain) {
89 p->m_textDomain = textDomain;
90 return *this;
91}
92
93MetricParameters & MetricParameters::minimum(double minimum) {
94 p->m_options["minimum"] = minimum;
95 return *this;
96}
97
98MetricParameters & MetricParameters::maximum(double maximum) {
99 p->m_options["maximum"] = maximum;
100 return *this;
101}
102
103MetricParameters & MetricParameters::type(MetricType type) {
104 p->m_type = type;
105 return *this;
106}
107
108const QString & MetricParameters::id() const {
109 return p->m_dataSourceId;
110}
111
112const QString & MetricParameters::formatString() const {
113 return p->m_formatString;
114}
115
116const QString & MetricParameters::emptyDataString() const {
117 return p->m_emptyDataString;
118}
119
120const QString & MetricParameters::textDomain() const {
121 return p->m_textDomain;
122}
123
124MetricType MetricParameters::type() const {
125 return p->m_type;
126}
127
128const QVariantMap & MetricParameters::options() const {
129 return p->m_options;
130}
131
132}
0133
=== added file 'src/libusermetricsinput/MetricParameters.h'
--- src/libusermetricsinput/MetricParameters.h 1970-01-01 00:00:00 +0000
+++ src/libusermetricsinput/MetricParameters.h 2014-06-25 09:58:07 +0000
@@ -0,0 +1,74 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of version 3 of the GNU Lesser General Public License as published
6 * by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 * details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#ifndef USERMETRICSINPUT_METRICPARAMETERS_H_
20#define USERMETRICSINPUT_METRICPARAMETERS_H_
21
22#include <libusermetricsinput/Metric.h>
23
24#include <QtCore/QScopedPointer>
25#include <QtCore/QString>
26
27namespace UserMetricsInput {
28
29class MetricParametersPrivate;
30
31class Q_DECL_EXPORT MetricParameters {
32public:
33
34 explicit MetricParameters(const QString &dataSourceId);
35
36 MetricParameters(const MetricParameters &other);
37
38 virtual ~MetricParameters();
39
40 MetricParameters & operator=(const MetricParameters &other);
41
42 bool operator==(const MetricParameters &other) const;
43
44 MetricParameters & formatString(const QString &formatString);
45
46 MetricParameters & emptyDataString(const QString &emptyDataString);
47
48 MetricParameters & textDomain(const QString &textDomain);
49
50 MetricParameters & minimum(double minimum);
51
52 MetricParameters & maximum(double maximum);
53
54 MetricParameters & type(MetricType type);
55
56 const QString & id() const;
57
58 const QString & formatString() const;
59
60 const QString & emptyDataString() const;
61
62 const QString & textDomain() const;
63
64 MetricType type() const;
65
66 const QVariantMap & options() const;
67
68protected:
69 QScopedPointer<MetricParametersPrivate> p;
70};
71
72}
73
74#endif // USERMETRICSINPUT_METRICPARAMETERS_H_
075
=== modified file 'src/libusermetricsinput/MetricUpdate.h'
--- src/libusermetricsinput/MetricUpdate.h 2013-07-09 16:51:58 +0000
+++ src/libusermetricsinput/MetricUpdate.h 2014-06-25 09:58:07 +0000
@@ -33,7 +33,7 @@
33/**33/**
34 * @brief Useful to store your instance of MetricUpdate in.34 * @brief Useful to store your instance of MetricUpdate in.
35 **/35 **/
36typedef QScopedPointer<MetricUpdate> MetricUpdatePtr;36typedef QSharedPointer<MetricUpdate> MetricUpdatePtr;
3737
38/**38/**
39 * @brief An update to a Metric39 * @brief An update to a Metric
4040
=== modified file 'src/libusermetricsinput/MetricUpdateImpl.cpp'
--- src/libusermetricsinput/MetricUpdateImpl.cpp 2013-09-24 16:20:00 +0000
+++ src/libusermetricsinput/MetricUpdateImpl.cpp 2014-06-25 09:58:07 +0000
@@ -16,28 +16,21 @@
16 * Author: Pete Woods <pete.woods@canonical.com>16 * Author: Pete Woods <pete.woods@canonical.com>
17 */17 */
1818
19#include <libusermetricsinput/MetricImpl.h>
19#include <libusermetricsinput/MetricUpdateImpl.h>20#include <libusermetricsinput/MetricUpdateImpl.h>
20#include <libusermetricscommon/DBusPaths.h>
2121
22#include <stdexcept>22#include <stdexcept>
2323
24using namespace std;24using namespace std;
25using namespace UserMetricsCommon;
26using namespace UserMetricsInput;25using namespace UserMetricsInput;
2726
28MetricUpdateImpl::MetricUpdateImpl(const QString &path,27MetricUpdateImpl::MetricUpdateImpl(QSharedPointer<MetricImpl> metric,
29 const QDBusConnection &dbusConnection, QObject *parent) :28 QObject *parent) :
30 MetricUpdate(parent), m_dbusConnection(dbusConnection), m_interface(29 MetricUpdate(parent), m_metric(metric) {
31 DBusPaths::serviceName(), path, dbusConnection) {
32}30}
3331
34MetricUpdateImpl::~MetricUpdateImpl() {32MetricUpdateImpl::~MetricUpdateImpl() {
35 QDBusPendingReply<void> reply(m_interface.update(m_data));33 m_metric->update(m_data);
36 reply.waitForFinished();
37
38 if (reply.isError()) {
39 throw logic_error(reply.error().message().toStdString());
40 }
41}34}
4235
43void MetricUpdateImpl::addData(double data) {36void MetricUpdateImpl::addData(double data) {
@@ -45,5 +38,5 @@
45}38}
4639
47void MetricUpdateImpl::addNull() {40void MetricUpdateImpl::addNull() {
48 m_data << "";41 m_data << QVariant();
49}42}
5043
=== modified file 'src/libusermetricsinput/MetricUpdateImpl.h'
--- src/libusermetricsinput/MetricUpdateImpl.h 2013-07-02 14:26:11 +0000
+++ src/libusermetricsinput/MetricUpdateImpl.h 2014-06-25 09:58:07 +0000
@@ -20,20 +20,19 @@
20#define USERMETRICSINPUT_METRICUPDATEIMPL_H_20#define USERMETRICSINPUT_METRICUPDATEIMPL_H_
2121
22#include <QtCore/QObject>22#include <QtCore/QObject>
23#include <QtCore/QSharedPointer>
23#include <QtCore/QVariantList>24#include <QtCore/QVariantList>
24#include <QtDBus/QtDBus>
2525
26#include <libusermetricsinput/MetricUpdate.h>26#include <libusermetricsinput/MetricUpdate.h>
27#include <libusermetricscommon/DataSetInterface.h>
2827
29namespace UserMetricsInput {28namespace UserMetricsInput {
3029
31class Metric;30class MetricImpl;
3231
33class MetricUpdateImpl: public MetricUpdate {32class MetricUpdateImpl: public MetricUpdate {
34public:33public:
35 explicit MetricUpdateImpl(const QString &path,34 explicit MetricUpdateImpl(QSharedPointer<MetricImpl> metric,
36 const QDBusConnection &dbusConnection, QObject *parent = 0);35 QObject *parent = 0);
3736
38 virtual ~MetricUpdateImpl();37 virtual ~MetricUpdateImpl();
3938
@@ -42,9 +41,7 @@
42 virtual void addNull();41 virtual void addNull();
4342
44protected:43protected:
45 QDBusConnection m_dbusConnection;44 QSharedPointer<MetricImpl> m_metric;
46
47 com::canonical::usermetrics::DataSet m_interface;
4845
49 QVariantList m_data;46 QVariantList m_data;
50};47};
5148
=== modified file 'src/libusermetricsinput/usermetricsinput.cpp'
--- src/libusermetricsinput/usermetricsinput.cpp 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/usermetricsinput.cpp 2014-06-25 09:58:07 +0000
@@ -176,9 +176,10 @@
176 UserMetricsInputMetric m, const char *username) {176 UserMetricsInputMetric m, const char *username) {
177 try {177 try {
178 Metric *metric(reinterpret_cast<Metric*>(m));178 Metric *metric(reinterpret_cast<Metric*>(m));
179 MetricUpdatePtr metricUpdate(179 MetricUpdatePtr* metricUpdate(
180 metric->update(QString::fromUtf8(username)));180 new MetricUpdatePtr(
181 return reinterpret_cast<UserMetricsInputMetric>(metricUpdate.take());181 metric->update(QString::fromUtf8(username))));
182 return reinterpret_cast<UserMetricsInputMetric>(metricUpdate);
182 } catch (exception &e) {183 } catch (exception &e) {
183 fprintf(stderr, "Error creating MetricUpdate: %s\n", e.what());184 fprintf(stderr, "Error creating MetricUpdate: %s\n", e.what());
184 }185 }
@@ -188,7 +189,7 @@
188void usermetricsinput_metricupdate_delete(189void usermetricsinput_metricupdate_delete(
189 UserMetricsInputMetricUpdate metricUpdate) {190 UserMetricsInputMetricUpdate metricUpdate) {
190 try {191 try {
191 delete reinterpret_cast<MetricUpdate*>(metricUpdate);192 delete reinterpret_cast<MetricUpdatePtr*>(metricUpdate);
192 } catch (exception &e) {193 } catch (exception &e) {
193 fprintf(stderr, "Error deleting MetricUpdate: %s\n", e.what());194 fprintf(stderr, "Error deleting MetricUpdate: %s\n", e.what());
194 }195 }
@@ -197,8 +198,8 @@
197void usermetricsinput_metricupdate_add_data(UserMetricsInputMetricUpdate u,198void usermetricsinput_metricupdate_add_data(UserMetricsInputMetricUpdate u,
198 double data) {199 double data) {
199 try {200 try {
200 MetricUpdate *metricUpdate = reinterpret_cast<MetricUpdate*>(u);201 MetricUpdatePtr *metricUpdate = reinterpret_cast<MetricUpdatePtr*>(u);
201 metricUpdate->addData(data);202 (*metricUpdate)->addData(data);
202 } catch (exception &e) {203 } catch (exception &e) {
203 fprintf(stderr, "Error adding data: %s\n", e.what());204 fprintf(stderr, "Error adding data: %s\n", e.what());
204 }205 }
@@ -206,8 +207,8 @@
206207
207void usermetricsinput_metricupdate_add_null(UserMetricsInputMetricUpdate u) {208void usermetricsinput_metricupdate_add_null(UserMetricsInputMetricUpdate u) {
208 try {209 try {
209 MetricUpdate *metricUpdate = reinterpret_cast<MetricUpdate*>(u);210 MetricUpdatePtr *metricUpdate = reinterpret_cast<MetricUpdatePtr*>(u);
210 metricUpdate->addNull();211 (*metricUpdate)->addNull();
211 } catch (exception &e) {212 } catch (exception &e) {
212 fprintf(stderr, "Error adding null: %s\n", e.what());213 fprintf(stderr, "Error adding null: %s\n", e.what());
213 }214 }
214215
=== modified file 'src/libusermetricsoutput/CMakeLists.txt'
--- src/libusermetricsoutput/CMakeLists.txt 2013-09-26 09:12:58 +0000
+++ src/libusermetricsoutput/CMakeLists.txt 2014-06-25 09:58:07 +0000
@@ -12,10 +12,9 @@
12 GSettingsColorThemeProvider.cpp12 GSettingsColorThemeProvider.cpp
13 DataSet.cpp13 DataSet.cpp
14 DataSource.cpp14 DataSource.cpp
15 SyncedDataSet.cpp15 DirectoryWatcher.cpp
16 SyncedDataSource.cpp16 InfographicList.cpp
17 SyncedUserMetricsStore.cpp17 InfographicListImpl.cpp
18 SyncedUserData.cpp
19 UserData.cpp18 UserData.cpp
20 UserMetrics.cpp19 UserMetrics.cpp
21 UserMetricsImpl.cpp20 UserMetricsImpl.cpp
2221
=== modified file 'src/libusermetricsoutput/ColorThemeProvider.h'
--- src/libusermetricsoutput/ColorThemeProvider.h 2013-09-20 16:33:35 +0000
+++ src/libusermetricsoutput/ColorThemeProvider.h 2014-06-25 09:58:07 +0000
@@ -36,6 +36,7 @@
36 ColorThemeProvider(QObject *parent = 0);36 ColorThemeProvider(QObject *parent = 0);
3737
38public:38public:
39 typedef QSharedPointer<ColorThemeProvider> Ptr;
3940
40 virtual ~ColorThemeProvider();41 virtual ~ColorThemeProvider();
4142
4243
=== added file 'src/libusermetricsoutput/DirectoryWatcher.cpp'
--- src/libusermetricsoutput/DirectoryWatcher.cpp 1970-01-01 00:00:00 +0000
+++ src/libusermetricsoutput/DirectoryWatcher.cpp 2014-06-25 09:58:07 +0000
@@ -0,0 +1,118 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of version 3 of the GNU Lesser General Public License as published
6 * by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 * details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19#include <libusermetricsoutput/DirectoryWatcher.h>
20
21#include <QDebug>
22
23using namespace UserMetricsCommon;
24using namespace UserMetricsOutput;
25
26namespace {
27
28static bool nameCompare(const QString &a, const QString &b) {
29 int indexA = a.lastIndexOf('-');
30 int indexB = b.lastIndexOf('-');
31
32 if (indexA == -1 || indexB == -1) {
33 return false;
34 }
35
36 QStringRef startA = a.leftRef(indexA);
37 QStringRef startB = b.leftRef(indexB);
38
39 return !!startA.compare(startB);
40}
41
42}
43
44DirectoryWatcher::DirectoryWatcher(const QDir &path, unsigned int maxDepth,
45 FileUtils::Ptr fileUtils) :
46 m_path(path), m_maxDepth(maxDepth), m_fileUtils(fileUtils) {
47
48 m_watcher.addPath(path.path());
49
50 connect(&m_watcher, SIGNAL(directoryChanged(const QString &)), this,
51 SLOT(internalDirectoryChanged()));
52}
53
54DirectoryWatcher::~DirectoryWatcher() {
55}
56
57void DirectoryWatcher::start() {
58 internalDirectoryChanged();
59}
60
61void DirectoryWatcher::internalDirectoryChanged() {
62 QStringList files(
63 m_fileUtils->listDirectory(m_path, QDir::Files, QDir::Name));
64
65 QStringList newestFiles;
66
67 const QString *previous(nullptr);
68 for (const QString &file : files) {
69 if (!previous) {
70 previous = &file;
71 } else if (nameCompare(*previous, file)) {
72 newestFiles << *previous;
73 }
74 previous = &file;
75 }
76
77 if (previous) {
78 newestFiles << *previous;
79 }
80
81 directoryChanged(m_path.path(), newestFiles);
82
83 if (m_maxDepth == 0) {
84 return;
85 }
86
87 QSet<QString> directories(
88 m_fileUtils->listDirectory(m_path, QDir::Dirs).toSet());
89
90 // Remove deleted files
91 QSet<QString> directoriesToRemove(
92 m_directories.keys().toSet().subtract(directories));
93 for (const QString &name : directoriesToRemove) {
94 m_directories.remove(name);
95 directoryRemoved(name);
96 }
97
98 // Work out the names we need to add
99 directories.subtract(m_directories.keys().toSet());
100 for (const QString &name : directories) {
101 DirectoryWatcher::Ptr watcher(
102 new DirectoryWatcher(name, m_maxDepth - 1, m_fileUtils));
103 m_directories.insert(name, watcher);
104 connect(watcher.data(),
105 SIGNAL(directoryChanged(const QString &, const QStringList &)),
106 this,
107 SIGNAL(directoryChanged(const QString &, const QStringList &)));
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: