=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2013-09-26 09:12:58 +0000
+++ CMakeLists.txt 2014-02-04 12:08:09 +0000
@@ -19,18 +19,9 @@
find_package(Qt5Gui REQUIRED)
include_directories(${Qt5Gui_INCLUDE_DIRS})
-find_package(Qt5DBus COMPONENTS Qt5DBusMacros REQUIRED)
-include_directories(${Qt5DBus_INCLUDE_DIRS})
-
-find_package(Qt5Sql REQUIRED)
-include_directories(${Qt5Sql_INCLUDE_DIRS})
-
find_package(Qt5XmlPatterns REQUIRED)
include_directories(${Qt5XmlPatterns_INCLUDE_DIRS})
-pkg_check_modules(APPARMOR REQUIRED libapparmor REQUIRED)
-include_directories(${APPARMOR_INCLUDE_DIRS})
-
pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt REQUIRED)
include_directories(${GSETTINGS_QT_INCLUDE_DIRS})
@@ -40,12 +31,6 @@
find_package(Qt5Qml REQUIRED)
include_directories(${Qt5Qml_INCLUDE_DIRS})
-pkg_check_modules(QDJANGO_DB REQUIRED qdjango-db REQUIRED)
-include_directories(${QDJANGO_DB_INCLUDE_DIRS})
-
-pkg_check_modules(QTDBUSTEST REQUIRED libqtdbustest-1 REQUIRED)
-include_directories(${QTDBUSTEST_INCLUDE_DIRS})
-
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -98,4 +83,4 @@
ADD_CUSTOM_TARGET(
check
${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure
-)
\ No newline at end of file
+)
=== modified file 'cmake/FindValgrind.cmake'
--- cmake/FindValgrind.cmake 2013-09-26 09:12:58 +0000
+++ cmake/FindValgrind.cmake 2014-02-04 12:08:09 +0000
@@ -26,7 +26,7 @@
)
function(add_valgrind_test NAME EXECUTABLE)
- if(ENABLE_MEMCHECK_OPTION)
+ if(ENABLE_MEMCHECK_OPTION AND VALGRIND_PROGRAM)
add_test(${NAME} ${VALGRIND_PROGRAM} ${VALGRIND_PROGRAM_OPTIONS} "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}")
else()
add_test(${NAME} ${EXECUTABLE})
=== modified file 'data/CMakeLists.txt'
--- data/CMakeLists.txt 2013-10-22 16:59:17 +0000
+++ data/CMakeLists.txt 2014-02-04 12:08:09 +0000
@@ -28,45 +28,3 @@
DESTINATION ${DBUSCONFDIR}
)
-###########################
-# Dbus Interfaces
-###########################
-
-set(
- DBUSIFACEDIR
- "${CMAKE_INSTALL_DATADIR}/dbus-1/interfaces/"
-)
-
-install(
- FILES
- com.canonical.usermetrics.DataSet.xml
- com.canonical.usermetrics.DataSource.xml
- com.canonical.usermetrics.UserData.xml
- com.canonical.UserMetrics.xml
- DESTINATION ${DBUSIFACEDIR}
-)
-
-###########################
-# Dbus Services
-###########################
-
-set(
- DBUSSERVICEDIR
- "${CMAKE_INSTALL_DATADIR}/dbus-1/system-services/"
-)
-
-set(USERMETRICS_SERVICE
- "${CMAKE_CURRENT_BINARY_DIR}/com.canonical.UserMetrics.service"
-)
-
-configure_file(
- "com.canonical.UserMetrics.service.in"
- ${USERMETRICS_SERVICE}
- @ONLY
-)
-
-install(
- FILES
- ${USERMETRICS_SERVICE}
- DESTINATION ${DBUSSERVICEDIR}
-)
=== 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 @@
-[D-BUS Service]
-Name=com.canonical.UserMetrics
-Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/libusermetrics/usermetricsservice
-User=usermetrics
-StandardOutput=syslog
=== 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 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
=== 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 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
=== 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 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
=== 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 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
=== modified file 'debian/changelog'
--- debian/changelog 2014-01-20 18:09:31 +0000
+++ debian/changelog 2014-02-04 12:08:09 +0000
@@ -1,3 +1,10 @@
+libusermetrics (2.0.0-0ubuntu1) UNRELEASED; urgency=medium
+
+ * Remove the usermetrics database and store metrics in json files
+ inside the ~/.cache directory.
+
+ -- Pete Woods Mon, 06 Jan 2014 09:36:20 +0000
+
libusermetrics (1.1.1+14.04.20140120-0ubuntu1) trusty; urgency=low
[ Pete Woods ]
=== modified file 'debian/control'
--- debian/control 2013-09-26 12:43:32 +0000
+++ debian/control 2014-02-04 12:08:09 +0000
@@ -7,21 +7,17 @@
doxygen,
gettext,
google-mock (>= 1.6.0+svn437),
- libapparmor-dev,
libgsettings-qt-dev,
libgtest-dev,
- libqdjango-dev,
- libqt5sql5-sqlite,
libqt5xmlpatterns5-dev,
libqtdbustest1-dev,
pkg-config,
qtbase5-dev,
- sqlite3,
- valgrind,
+ valgrind [!arm64 !ppc64el],
qtdeclarative5-dev,
qtdeclarative5-qtquick2-plugin,
qtdeclarative5-test-plugin,
-Standards-Version: 3.9.4
+Standards-Version: 3.9.5
Section: libs
Homepage: http://launchpad.net/libusermetrics
# If you aren't a member of ~indicator-applet-developers but need to upload packaging changes,
=== modified file 'debian/libusermetricsinput1.symbols'
--- debian/libusermetricsinput1.symbols 2013-09-04 13:44:30 +0000
+++ debian/libusermetricsinput1.symbols 2014-02-04 12:08:09 +0000
@@ -17,15 +17,25 @@
(c++)"UserMetricsInput::MetricParameters::maximum(double)@Base" 1.1.1
(c++)"UserMetricsInput::MetricParameters::minimum(double)@Base" 1.1.1
(c++)"UserMetricsInput::MetricParameters::MetricParameters(QString const&)@Base" 1.1.1
+ (c++)"UserMetricsInput::MetricParameters::MetricParameters(UserMetricsInput::MetricParameters const&)@Base" 2.0.0
(c++)"UserMetricsInput::MetricParameters::MetricParameters(QString const&)@Base" 1.1.1
- (c++)"UserMetricsInput::MetricParameters::~MetricParameters()@Base" 1.1.1
- (c++)"UserMetricsInput::MetricParameters::~MetricParameters()@Base" 1.1.1
- (c++)"UserMetricsInput::MetricParameters::~MetricParameters()@Base" 1.1.1
- (c++)"UserMetricsInput::Metric::Metric(QObject*)@Base" 1.0.1
- (c++)"UserMetricsInput::Metric::Metric(QObject*)@Base" 1.0.1
- (c++)"UserMetricsInput::Metric::~Metric()@Base" 1.0.1
- (c++)"UserMetricsInput::Metric::~Metric()@Base" 1.0.1
- (c++)"UserMetricsInput::Metric::~Metric()@Base" 1.0.1
+ (c++)"UserMetricsInput::MetricParameters::MetricParameters(UserMetricsInput::MetricParameters const&)@Base" 2.0.0
+ (c++)"UserMetricsInput::MetricParameters::~MetricParameters()@Base" 1.1.1
+ (c++)"UserMetricsInput::MetricParameters::~MetricParameters()@Base" 1.1.1
+ (c++)"UserMetricsInput::MetricParameters::~MetricParameters()@Base" 1.1.1
+ (c++)"UserMetricsInput::MetricParameters::operator=(UserMetricsInput::MetricParameters const&)@Base" 2.0.0
+ (c++)"UserMetricsInput::Metric::Metric(QObject*)@Base" 1.0.1
+ (c++)"UserMetricsInput::Metric::Metric(QObject*)@Base" 1.0.1
+ (c++)"UserMetricsInput::Metric::~Metric()@Base" 1.0.1
+ (c++)"UserMetricsInput::Metric::~Metric()@Base" 1.0.1
+ (c++)"UserMetricsInput::Metric::~Metric()@Base" 1.0.1
+ (c++)"UserMetricsInput::MetricParameters::textDomain() const@Base" 2.0.0
+ (c++)"UserMetricsInput::MetricParameters::formatString() const@Base" 2.0.0
+ (c++)"UserMetricsInput::MetricParameters::emptyDataString() const@Base" 2.0.0
+ (c++)"UserMetricsInput::MetricParameters::id() const@Base" 2.0.0
+ (c++)"UserMetricsInput::MetricParameters::type() const@Base" 2.0.0
+ (c++)"UserMetricsInput::MetricParameters::options() const@Base" 2.0.0
+ (c++)"UserMetricsInput::MetricParameters::operator==(UserMetricsInput::MetricParameters const&) const@Base" 2.0.0
(c++)"typeinfo for UserMetricsInput::MetricUpdate@Base" 1.0.1
(c++)"typeinfo for UserMetricsInput::MetricManager@Base" 1.0.1
(c++)"typeinfo for UserMetricsInput::MetricParameters@Base" 1.1.1
=== modified file 'debian/usermetricsservice.install'
--- debian/usermetricsservice.install 2013-09-26 09:12:58 +0000
+++ debian/usermetricsservice.install 2014-02-04 12:08:09 +0000
@@ -1,6 +1,5 @@
etc
usr/lib/*/libusermetrics
-usr/share/dbus-1
usr/share/glib-2.0
usr/share/libusermetrics
usr/share/locale
=== 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 @@
-#!/bin/sh
-
-set -e
-
-. /usr/share/debconf/confmodule
-
-dbus-send --system --print-reply \
- --dest=org.freedesktop.DBus \
- /org/freedesktop/DBus \
- org.freedesktop.DBus.StartServiceByName \
- string:"com.canonical.UserMetrics" uint32:0 \
- || true
-
-#DEBHELPER#
-
-exit 0
=== 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 @@
-#!/bin/sh
-set -e
-
-if [ "$1" = "purge" ] ; then
- if getent passwd usermetrics >/dev/null; then
- if [ -x /usr/sbin/deluser ]; then
- deluser --system usermetrics
- fi
- fi
-
- if getent group usermetrics >/dev/null; then
- if [ -x /usr/sbin/delgroup ]; then
- delgroup --system usermetrics
- fi
- fi
-
- # we cannot use the --remove-home option when we delete the user above
- # because it will refuse to remove things in /var, so clean it up this
- # way
- if [ -d /var/lib/usermetrics ]; then
- rm -r /var/lib/usermetrics
- fi
-
-fi
-#DEBHELPER#
-exit 0
=== 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 @@
-#!/bin/sh
-
-set -e
-
-. /usr/share/debconf/confmodule
-
-THIS_PACKAGE=usermetricsservice
-
-# creating usermetrics group if he isn't already there
-if ! getent group usermetrics >/dev/null; then
- addgroup --system usermetrics
-fi
-
-# creating usermetrics user if he isn't already there
-if ! getent passwd usermetrics >/dev/null; then
- adduser --system --ingroup usermetrics --home /var/lib/usermetrics usermetrics
- usermod -c "User Metrics" usermetrics
- usermod -d "/var/lib/usermetrics" usermetrics
- usermod -g "usermetrics" usermetrics
- usermod -s "/bin/false" usermetrics
-fi
-
-if [ -d /var/lib/usermetrics ]; then
- chown -R usermetrics:usermetrics /var/lib/usermetrics
- chmod 0750 /var/lib/usermetrics
-fi
-
-#DEBHELPER#
-
-exit 0
=== 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 @@
-#!/bin/sh
-
-set -e
-
-pkill -U usermetrics 2>/dev/null || true
-
-#DEBHELPER#
\ No newline at end of file
=== added symlink 'include/libusermetricsinput/MetricParameters.h'
=== target is u'../../src/libusermetricsinput/MetricParameters.h'
=== modified file 'po/en_GB.po'
--- po/en_GB.po 2013-10-22 08:53:23 +0000
+++ po/en_GB.po 2014-02-04 12:08:09 +0000
@@ -7,7 +7,7 @@
msgstr ""
"Project-Id-Version: libusermetrics\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-10-22 09:33+0100\n"
+"POT-Creation-Date: 2014-01-03 12:51+0000\n"
"PO-Revision-Date: 2013-07-05 15:09+0100\n"
"Last-Translator: Pete Woods \n"
"Language-Team: British English \n"
@@ -17,70 +17,11 @@
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-#: src/usermetricsservice/DBusUserData.cpp:101
-msgid "Attempt to create data set owned by another application"
-msgstr "Attempt to create data set owned by another application"
-
-#: src/usermetricsservice/DBusUserData.cpp:90
-msgid "Attempt to create data set owned by another user"
-msgstr "Attempt to create data set owned by another user"
-
-#: src/usermetricsservice/DBusUserMetrics.cpp:249
-#, fuzzy
-msgid "Attempt to create user data owned by another user"
-msgstr "Attempt to create user data owned by another user"
-
-#: src/usermetricsservice/DBusDataSet.cpp:178
-msgid "Attempt to increment data owned by another application"
-msgstr "Attempt to increment data owned by another application"
-
-#: src/usermetricsservice/DBusDataSet.cpp:170
-msgid "Attempt to increment data owned by another user"
-msgstr "Attempt to increment data owned by another user"
-
-#: src/usermetricsservice/DBusDataSet.cpp:151
-msgid "Attempt to update data owned by another application"
-msgstr "Attempt to update data owned by another application"
-
-#: src/usermetricsservice/DBusDataSet.cpp:143
-msgid "Attempt to update data owned by another user"
-msgstr "Attempt to update data owned by another user"
-
-#: src/libusermetricsoutput/GSettingsColorThemeProvider.cpp:99
+#: src/libusermetricsoutput/GSettingsColorThemeProvider.cpp:100
#, qt-format
msgid "Cannot open XML file '%1' for reading"
msgstr ""
-#: src/usermetricsservice/main.cpp:59
-msgid "Could not open database"
-msgstr "Could not open database"
-
-#: src/usermetricsservice/DBusUserData.cpp:51
-msgid "Could not register user data object with DBus"
-msgstr "Could not register user data object with DBus"
-
-#: src/usermetricsservice/DBusDataSet.cpp:127
-#: src/usermetricsservice/DBusUserData.cpp:125
-msgid "Could not save data set"
-msgstr "Could not save data set"
-
-#: src/usermetricsservice/DBusDataSource.cpp:68
-#: src/usermetricsservice/DBusDataSource.cpp:86
-#: src/usermetricsservice/DBusDataSource.cpp:104
-#: src/usermetricsservice/DBusDataSource.cpp:116
-#: src/usermetricsservice/DBusDataSource.cpp:134
-#: src/usermetricsservice/DBusDataSource.cpp:172
-#: src/usermetricsservice/DBusDataSource.cpp:190
-#: src/usermetricsservice/DBusDataSource.cpp:216
-#: src/usermetricsservice/DBusDataSource.cpp:234
-#: src/usermetricsservice/DBusUserMetrics.cpp:187
-msgid "Could not save data source"
-msgstr "Couldn't save data source"
-
-#: src/usermetricsservice/DBusUserMetrics.cpp:267
-msgid "Could not save user data"
-msgstr "Couldn't save user data"
-
#: src/libusermetricsinput/main.cpp:37
msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME "
msgstr "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME "
@@ -90,19 +31,10 @@
msgid "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME [AMOUNT]"
msgstr "DATA_SOURCE_ID FORMAT_STRING EMPTY_DATA_STRING USERNAME [AMOUNT]"
-#: src/usermetricsservice/DBusUserData.cpp:112
-msgid "Data set query failed"
-msgstr "Data set query failed"
-
#: src/libusermetricsoutput/UserMetricsImpl.cpp:255
msgid "Data source not found"
msgstr "Data source not found"
-#: src/usermetricsservice/DBusUserMetrics.cpp:141
-#: src/usermetricsservice/DBusUserMetrics.cpp:153
-msgid "Data source query failed"
-msgstr "Data source query failed"
-
#: src/modules/UserMetrics/Metric.cpp:30
msgid "Failed to connect to metrics service:"
msgstr "Failed to connect to metrics service:"
@@ -119,11 +51,7 @@
msgid "Failed to update metric:"
msgstr "Failed to update metric:"
-#: src/usermetricsservice/DBusUserData.cpp:135
-msgid "New data set could not be found"
-msgstr "New data set couldn't be found"
-
-#: src/libusermetricsoutput/UserMetricsImpl.cpp:266
+#: src/libusermetricsoutput/UserMetricsImpl.cpp:267
msgid "No data for today"
msgstr "No data for today"
@@ -131,30 +59,71 @@
msgid "No data sources available"
msgstr "No data sources available"
-#: src/usermetricsservice/DBusUserMetrics.cpp:54
-msgid "Unable to register user metrics object on DBus"
-msgstr "Unable to register user metrics object on DBus"
-
-#: src/usermetricsservice/main.cpp:72
-msgid "Unable to register user metrics service on DBus"
-msgstr "Unable to register user metrics service on DBus"
-
-#: src/usermetricsservice/main.cpp:82
-msgid "Unable to unregister user metrics service on DBus"
-msgstr "Unable to unregister user metrics service on DBus"
-
-#: src/usermetricsservice/DBusUserData.cpp:81
-msgid "Unknown data source"
-msgstr "Unknown data source"
-
#: src/libusermetricsinput/main-increment.cpp:35
#: src/libusermetricsinput/main.cpp:35
msgid "Usage: "
msgstr "Usage: "
-#: src/usermetricsservice/DBusUserMetrics.cpp:258
-msgid "User data query failed"
-msgstr "User data query failed"
+#~ msgid "Attempt to create data set owned by another application"
+#~ msgstr "Attempt to create data set owned by another application"
+
+#~ msgid "Attempt to create data set owned by another user"
+#~ msgstr "Attempt to create data set owned by another user"
#~ msgid "Attempt to create data source owned by another application"
#~ msgstr "Attempt to create data source owned by another application"
+
+#, fuzzy
+#~ msgid "Attempt to create user data owned by another user"
+#~ msgstr "Attempt to create user data owned by another user"
+
+#~ msgid "Attempt to increment data owned by another application"
+#~ msgstr "Attempt to increment data owned by another application"
+
+#~ msgid "Attempt to increment data owned by another user"
+#~ msgstr "Attempt to increment data owned by another user"
+
+#~ msgid "Attempt to update data owned by another application"
+#~ msgstr "Attempt to update data owned by another application"
+
+#~ msgid "Attempt to update data owned by another user"
+#~ msgstr "Attempt to update data owned by another user"
+
+#~ msgid "Could not open database"
+#~ msgstr "Could not open database"
+
+#~ msgid "Could not register user data object with DBus"
+#~ msgstr "Could not register user data object with DBus"
+
+#~ msgid "Could not save data set"
+#~ msgstr "Could not save data set"
+
+#~ msgid "Could not save data source"
+#~ msgstr "Couldn't save data source"
+
+#~ msgid "Could not save user data"
+#~ msgstr "Couldn't save user data"
+
+#~ msgid "Data set query failed"
+#~ msgstr "Data set query failed"
+
+#~ msgid "Data source query failed"
+#~ msgstr "Data source query failed"
+
+#~ msgid "New data set could not be found"
+#~ msgstr "New data set couldn't be found"
+
+#~ msgid "Unable to register user metrics object on DBus"
+#~ msgstr "Unable to register user metrics object on DBus"
+
+#~ msgid "Unable to register user metrics service on DBus"
+#~ msgstr "Unable to register user metrics service on DBus"
+
+#~ msgid "Unable to unregister user metrics service on DBus"
+#~ msgstr "Unable to unregister user metrics service on DBus"
+
+#~ msgid "Unknown data source"
+#~ msgstr "Unknown data source"
+
+#~ msgid "User data query failed"
+#~ msgstr "User data query failed"
=== modified file 'po/libusermetrics.pot'
--- po/libusermetrics.pot 2013-10-22 08:53:23 +0000
+++ po/libusermetrics.pot 2014-02-04 12:08:09 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: libusermetrics\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-10-22 09:33+0100\n"
+"POT-Creation-Date: 2014-01-03 12:51+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -17,97 +17,6 @@
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/usermetricsservice/main.cpp:59
-msgid "Could not open database"
-msgstr ""
-
-#: src/usermetricsservice/main.cpp:72
-msgid "Unable to register user metrics service on DBus"
-msgstr ""
-
-#: src/usermetricsservice/main.cpp:82
-msgid "Unable to unregister user metrics service on DBus"
-msgstr ""
-
-#: src/usermetricsservice/DBusDataSource.cpp:68
-#: src/usermetricsservice/DBusDataSource.cpp:86
-#: src/usermetricsservice/DBusDataSource.cpp:104
-#: src/usermetricsservice/DBusDataSource.cpp:116
-#: src/usermetricsservice/DBusDataSource.cpp:134
-#: src/usermetricsservice/DBusDataSource.cpp:172
-#: src/usermetricsservice/DBusDataSource.cpp:190
-#: src/usermetricsservice/DBusDataSource.cpp:216
-#: src/usermetricsservice/DBusDataSource.cpp:234
-#: src/usermetricsservice/DBusUserMetrics.cpp:187
-msgid "Could not save data source"
-msgstr ""
-
-#: src/usermetricsservice/DBusUserMetrics.cpp:54
-msgid "Unable to register user metrics object on DBus"
-msgstr ""
-
-#: src/usermetricsservice/DBusUserMetrics.cpp:141
-#: src/usermetricsservice/DBusUserMetrics.cpp:153
-msgid "Data source query failed"
-msgstr ""
-
-#: src/usermetricsservice/DBusUserMetrics.cpp:249
-msgid "Attempt to create user data owned by another user"
-msgstr ""
-
-#: src/usermetricsservice/DBusUserMetrics.cpp:258
-msgid "User data query failed"
-msgstr ""
-
-#: src/usermetricsservice/DBusUserMetrics.cpp:267
-msgid "Could not save user data"
-msgstr ""
-
-#: src/usermetricsservice/DBusDataSet.cpp:127
-#: src/usermetricsservice/DBusUserData.cpp:125
-msgid "Could not save data set"
-msgstr ""
-
-#: src/usermetricsservice/DBusDataSet.cpp:143
-msgid "Attempt to update data owned by another user"
-msgstr ""
-
-#: src/usermetricsservice/DBusDataSet.cpp:151
-msgid "Attempt to update data owned by another application"
-msgstr ""
-
-#: src/usermetricsservice/DBusDataSet.cpp:170
-msgid "Attempt to increment data owned by another user"
-msgstr ""
-
-#: src/usermetricsservice/DBusDataSet.cpp:178
-msgid "Attempt to increment data owned by another application"
-msgstr ""
-
-#: src/usermetricsservice/DBusUserData.cpp:51
-msgid "Could not register user data object with DBus"
-msgstr ""
-
-#: src/usermetricsservice/DBusUserData.cpp:81
-msgid "Unknown data source"
-msgstr ""
-
-#: src/usermetricsservice/DBusUserData.cpp:90
-msgid "Attempt to create data set owned by another user"
-msgstr ""
-
-#: src/usermetricsservice/DBusUserData.cpp:101
-msgid "Attempt to create data set owned by another application"
-msgstr ""
-
-#: src/usermetricsservice/DBusUserData.cpp:112
-msgid "Data set query failed"
-msgstr ""
-
-#: src/usermetricsservice/DBusUserData.cpp:135
-msgid "New data set could not be found"
-msgstr ""
-
#: src/modules/UserMetrics/Metric.cpp:30
msgid "Failed to connect to metrics service:"
msgstr ""
@@ -145,11 +54,11 @@
msgid "Data source not found"
msgstr ""
-#: src/libusermetricsoutput/UserMetricsImpl.cpp:266
+#: src/libusermetricsoutput/UserMetricsImpl.cpp:267
msgid "No data for today"
msgstr ""
-#: src/libusermetricsoutput/GSettingsColorThemeProvider.cpp:99
+#: src/libusermetricsoutput/GSettingsColorThemeProvider.cpp:100
#, qt-format
msgid "Cannot open XML file '%1' for reading"
msgstr ""
=== modified file 'src/libusermetricscommon/CMakeLists.txt'
--- src/libusermetricscommon/CMakeLists.txt 2013-07-17 10:22:05 +0000
+++ src/libusermetricscommon/CMakeLists.txt 2014-02-04 12:08:09 +0000
@@ -2,38 +2,9 @@
set(USERMETRICS_COMMON_SOURCES
DateFactory.cpp
DateFactoryImpl.cpp
- DBusPaths.cpp
Localisation.cpp
)
-set(USERMETRICS_COMMON_DEPENDENCIES
- Core
-)
-
-qt5_add_dbus_interface(
- USERMETRICS_COMMON_SOURCES
- "${DATA_DIR}/com.canonical.UserMetrics.xml"
- UserMetricsInterface
-)
-
-qt5_add_dbus_interface(
- USERMETRICS_COMMON_SOURCES
- "${DATA_DIR}/com.canonical.usermetrics.DataSource.xml"
- DataSourceInterface
-)
-
-qt5_add_dbus_interface(
- USERMETRICS_COMMON_SOURCES
- "${DATA_DIR}/com.canonical.usermetrics.UserData.xml"
- UserDataInterface
-)
-
-qt5_add_dbus_interface(
- USERMETRICS_COMMON_SOURCES
- "${DATA_DIR}/com.canonical.usermetrics.DataSet.xml"
- DataSetInterface
-)
-
add_library(
usermetricscommon
STATIC
@@ -42,6 +13,6 @@
qt5_use_modules(
usermetricscommon
- ${USERMETRICS_COMMON_DEPENDENCIES}
+ Core
)
=== 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 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of version 3 of the GNU Lesser General Public License as published
- * by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#include
-
-using namespace UserMetricsCommon;
-
-QString DBusPaths::serviceName() {
- return "com.canonical.UserMetrics";
-}
-
-QString DBusPaths::userMetrics() {
- return "/com/canonical/UserMetrics";
-}
-
-QString DBusPaths::userData(int id) {
- return QString("/com/canonical/UserMetrics/UserData/%1").arg(id);
-}
-
-QString DBusPaths::dataSource(int id) {
- return QString("/com/canonical/UserMetrics/DataSource/%1").arg(id);
-}
-
-QString DBusPaths::dataSet(int id) {
- return QString("/com/canonical/UserMetrics/DataSet/%1").arg(id);
-}
=== 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 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of version 3 of the GNU Lesser General Public License as published
- * by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#ifndef USERMETRICSCOMMON_DBUSPATHS_H_
-#define USERMETRICSCOMMON_DBUSPATHS_H_
-
-#include
-
-namespace UserMetricsCommon {
-
-class DBusPaths {
-public:
- static QString serviceName();
-
- static QString userMetrics();
-
- static QString userData(int id);
-
- static QString dataSource(int id);
-
- static QString dataSet(int id);
-};
-
-}
-
-#endif // USERMETRICSCOMMON_DBUSPATHS_H_
=== modified file 'src/libusermetricsinput/CMakeLists.txt'
--- src/libusermetricsinput/CMakeLists.txt 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/CMakeLists.txt 2014-02-04 12:08:09 +0000
@@ -13,11 +13,13 @@
)
set(USERMETRICSINPUT_SOURCES
+ Factory.cpp
Metric.cpp
MetricImpl.cpp
MetricManager.cpp
MetricManagerImpl.cpp
MetricManagerImpl.cpp
+ MetricParameters.cpp
MetricUpdate.cpp
MetricUpdateImpl.cpp
usermetricsinput.cpp
=== added file 'src/libusermetricsinput/Factory.cpp'
--- src/libusermetricsinput/Factory.cpp 1970-01-01 00:00:00 +0000
+++ src/libusermetricsinput/Factory.cpp 2014-02-04 12:08:09 +0000
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2013 Canonical, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of version 3 of the GNU Lesser General Public License as published
+ * by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Author: Pete Woods
+ */
+
+#include
+#include
+#include
+
+namespace UserMetricsInput {
+
+Factory::Factory() {
+}
+
+Factory::~Factory() {
+}
+
+MetricPtr Factory::newMetric(const QDir &metricsDirectory,
+ const MetricParameters ¶meters, Factory::Ptr factory) {
+ QSharedPointer metric(
+ new MetricImpl(metricsDirectory, parameters, factory));
+ metric->setSelf(metric);
+ return metric;
+}
+
+MetricUpdatePtr Factory::newMetricUpdate(MetricPtr metric) {
+ return MetricUpdatePtr(
+ new MetricUpdateImpl(metric.staticCast()));
+}
+
+QDate Factory::currentDate() const {
+ return QDate::currentDate();
+}
+
+}
=== added file 'src/libusermetricsinput/Factory.h'
--- src/libusermetricsinput/Factory.h 1970-01-01 00:00:00 +0000
+++ src/libusermetricsinput/Factory.h 2014-02-04 12:08:09 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013 Canonical, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of version 3 of the GNU Lesser General Public License as published
+ * by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Author: Pete Woods
+ */
+
+#ifndef USERMETRICSINPUT_FACTORY_H_
+#define USERMETRICSINPUT_FACTORY_H_
+
+#include
+
+#include
+#include
+
+namespace UserMetricsInput {
+
+class Factory {
+public:
+ typedef QSharedPointer Ptr;
+
+ Factory();
+
+ virtual ~Factory();
+
+ virtual MetricPtr newMetric(const QDir &metricsDirectory,
+ const MetricParameters ¶meters, Factory::Ptr factory);
+
+ virtual MetricUpdatePtr newMetricUpdate(MetricPtr metric);
+
+ virtual QDate currentDate() const;
+};
+
+}
+
+#endif /* USERMETRICSINPUT_FACTORY_H_ */
=== modified file 'src/libusermetricsinput/Metric.h'
--- src/libusermetricsinput/Metric.h 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/Metric.h 2014-02-04 12:08:09 +0000
@@ -68,7 +68,7 @@
* The MetricUpdate object must be deleted - this is when the
* actual update will be sent to the storage service.
*/
- virtual MetricUpdate * update(const QString &username = "") = 0;
+ virtual MetricUpdatePtr update(const QString &username = "") = 0;
/**
* @brief Update the "today" value for a simple user metric
=== modified file 'src/libusermetricsinput/MetricImpl.cpp'
--- src/libusermetricsinput/MetricImpl.cpp 2013-09-24 16:20:00 +0000
+++ src/libusermetricsinput/MetricImpl.cpp 2014-02-04 12:08:09 +0000
@@ -18,98 +18,234 @@
#include
+#include
#include
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
using namespace std;
-using namespace UserMetricsCommon;
using namespace UserMetricsInput;
-MetricImpl::MetricImpl(const QString &dataSourceId, const QString &formatString,
- const QString &dataSourcePath, const QDBusConnection &dbusConnection,
+MetricImpl::MetricImpl(const QDir &metricDirectory,
+ const MetricParameters ¶meters, Factory::Ptr factory,
QObject *parent) :
- Metric(parent), m_dbusConnection(dbusConnection), m_userMetrics(
- DBusPaths::serviceName(), DBusPaths::userMetrics(),
- dbusConnection), m_dataSource(DBusPaths::serviceName(),
- dataSourcePath, dbusConnection), m_dataSourceId(dataSourceId), m_formatString(
- formatString) {
+ Metric(parent), m_metricDirectory(metricDirectory), m_parameters(
+ parameters), m_factory(factory) {
}
MetricImpl::~MetricImpl() {
}
-QDBusObjectPath MetricImpl::createDataSet(const QString &usernameIn) {
- QString username;
- if (m_dataSource.metricType() == MetricType::SYSTEM) {
- username = "";
- } else if (usernameIn.isEmpty()) {
- username = QString::fromUtf8(qgetenv("USER"));
- } else {
- username = usernameIn;
- }
-
- QDBusPendingReply userDataReply(
- m_userMetrics.createUserData(username));
-
- userDataReply.waitForFinished();
- if (userDataReply.isError()) {
- throw logic_error(userDataReply.error().message().toStdString());
- }
-
- QDBusObjectPath userDataPath(userDataReply);
-
- com::canonical::usermetrics::UserData userDataInterface(
- DBusPaths::serviceName(), userDataPath.path(), m_dbusConnection);
- if (!userDataInterface.isValid()) {
- throw logic_error("user data interface invalid");
- }
-
- QDBusPendingReply dataSetReply(
- userDataInterface.createDataSet(m_dataSourceId));
-
- dataSetReply.waitForFinished();
- if (dataSetReply.isError()) {
- throw logic_error(dataSetReply.error().message().toStdString());
- }
-
- return dataSetReply;
-}
-
-MetricUpdate * MetricImpl::update(const QString &username) {
- QDBusObjectPath dataSetPath(createDataSet(username));
-
- return new MetricUpdateImpl(dataSetPath.path(), m_dbusConnection);
+void MetricImpl::setSelf(QSharedPointer self) {
+ m_self = self;
+}
+
+void MetricImpl::setParameters(const MetricParameters ¶meters) {
+ m_parameters = parameters;
+}
+
+MetricUpdatePtr MetricImpl::update(const QString &username) {
+ Q_UNUSED(username);
+ loadData();
+ return m_factory->newMetricUpdate(m_self);
}
void MetricImpl::update(double value, const QString &username) {
- QDBusObjectPath dataSetPath(createDataSet(username));
-
- com::canonical::usermetrics::DataSet dataSetInterface(
- DBusPaths::serviceName(), dataSetPath.path(), m_dbusConnection);
-
- QDBusPendingReply<> reply(dataSetInterface.update(QVariantList() << value));
-
- reply.waitForFinished();
- if (reply.isError()) {
- throw logic_error(reply.error().message().toStdString());
- }
+ Q_UNUSED(username);
+ loadData();
+ update(QVariantList() << value);
}
void MetricImpl::increment(double amount, const QString &username) {
- QDBusObjectPath dataSetPath(createDataSet(username));
-
- com::canonical::usermetrics::DataSet dataSetInterface(
- DBusPaths::serviceName(), dataSetPath.path(), m_dbusConnection);
-
- QDBusPendingReply<> reply(dataSetInterface.increment(amount));
-
- reply.waitForFinished();
- if (reply.isError()) {
- throw logic_error(reply.error().message().toStdString());
+ Q_UNUSED(username);
+ loadData();
+
+ QVariantList data;
+
+ QDate currentDate(m_factory->currentDate());
+ if (m_lastUpdated == currentDate && !m_currentData.empty()) {
+ double value(m_currentData.first().toDouble());
+ value += amount;
+ data << value;
+ } else {
+ data << amount;
+ }
+
+ update(data);
+}
+
+void MetricImpl::update(const QVariantList &data) {
+ QDate currentDate(m_factory->currentDate());
+ int daysSinceLastUpdate(m_lastUpdated.daysTo(currentDate));
+
+ QVariantList newData(data);
+
+ // if we are in this situation we do nothing
+ // new: |4|5|6|7|8|9|0|
+ // old: |1|2|3|
+ // res: |4|5|6|7|8|9|0|
+ if (daysSinceLastUpdate + m_currentData.size() > newData.size()) {
+ if (daysSinceLastUpdate < newData.size()) {
+ // if we are in this situation - we need the
+ // protruding data from old
+ // new: |6|7|8|9|0|
+ // old: |1|2|3|4|5|
+ // res: |6|7|8|9|0|4|5|
+ auto oldDataIt(m_currentData.constBegin());
+ // wind forward until the data we want
+ for (int i(daysSinceLastUpdate); i < newData.size(); ++i) {
+ ++oldDataIt;
+ }
+ // append the rest of the data
+ for (; oldDataIt != m_currentData.constEnd(); ++oldDataIt) {
+ newData.append(*oldDataIt);
+ }
+ } else {
+ // we are in this situation - there is a gap
+ // and we want the whole of the old data appending
+ // new: |6|7|8|9|0|
+ // old: |1|2|3|4|5|
+ // res: |6|7|8|9|0|n|1|2|3|4|5|
+ const int daysToPad(daysSinceLastUpdate - newData.size());
+ // pad the data will null variants
+ for (int i(0); i < daysToPad; ++i) {
+ newData.append(QVariant());
+ }
+ // append the whole of the old data
+ newData.append(m_currentData);
+ }
+ }
+
+ while (newData.size() > 62) {
+ newData.pop_back();
+ }
+
+ m_lastUpdated = currentDate;
+ m_currentData = newData;
+ scaleData();
+ writeData();
+}
+
+void MetricImpl::scaleData() {
+ m_scaledData = m_currentData;
+
+ const QVariantMap &options(m_parameters.options());
+
+ bool hasMinimum(options.contains("minimum"));
+ bool hasMaximum(options.contains("maximum"));
+
+ double min(numeric_limits::max());
+ double max(numeric_limits::min());
+
+ if (hasMinimum) {
+ min = options["minimum"].toDouble();
+ }
+ if (hasMaximum) {
+ max = options["maximum"].toDouble();
+ }
+
+ // if we need to find either the max or the min
+ if (!hasMinimum || !hasMaximum) {
+ for (QVariant &variant : m_scaledData) {
+ if (variant.type() == QVariant::String) {
+ variant = QVariant();
+ } else if (variant.type() == QVariant::Double) {
+ double value(variant.toDouble());
+ if (!hasMinimum && value < min) {
+ min = value;
+ }
+ if (!hasMaximum && value > max) {
+ max = value;
+ }
+ }
+ }
+ }
+
+ for (QVariant &variant : m_scaledData) {
+ if (variant.type() == QVariant::Double) {
+ if (min != max) {
+ double value(variant.toDouble());
+ if (hasMaximum && value > max) {
+ value = max;
+ }
+ if (hasMinimum && value < min) {
+ value = min;
+ }
+ variant = (value - min) / (max - min);
+ } else {
+ variant = 0.5;
+ }
+ }
+ }
+}
+
+QString MetricImpl::buildJsonFile() {
+ return m_metricDirectory.filePath(m_parameters.id() + ".json");
+}
+
+void MetricImpl::loadData() {
+ if (m_parameters.type() == MetricType::SYSTEM) {
+// qDebug() << "we'd like to do something different with";
+ }
+
+ QVariantList existingData;
+
+ QFile jsonFile(buildJsonFile());
+ if (jsonFile.open(QIODevice::ReadOnly)) {
+ QJsonParseError error;
+ QJsonDocument document(
+ QJsonDocument::fromJson(jsonFile.readAll(), &error));
+ jsonFile.close();
+ QVariantMap map(document.toVariant().toMap());
+ // There's no point reading the rest of the information.
+ // We'll just overwrite it anyway.
+ m_currentData = map["data"].toList();
+ m_lastUpdated = map["lastUpdated"].toDate();
+ }
+}
+
+QString MetricImpl::label() const {
+ if (m_currentData.isEmpty() || m_currentData.first().isNull()
+ || m_parameters.formatString().isEmpty()
+ || m_factory->currentDate() != m_lastUpdated) {
+ const QString &emptyDataString = m_parameters.emptyDataString();
+ if (emptyDataString.isEmpty()) {
+ QString empty(_("No data for today"));
+ empty.append(" (");
+ empty.append(m_parameters.id());
+ empty.append(")");
+ return empty;
+ } else {
+ return emptyDataString;
+ }
+ }
+
+ return QString(_(qPrintable(m_parameters.formatString()))).arg(
+ m_currentData.first().toString());
+}
+
+void MetricImpl::writeData() {
+ QVariantMap root;
+ root["lastUpdated"] = m_lastUpdated;
+ root["data"] = m_currentData;
+ root["scaledData"] = m_scaledData;
+ root["id"] = m_parameters.id();
+ root["label"] = label();
+ root["formatString"] = m_parameters.formatString();
+ root["emptyDataString"] = m_parameters.emptyDataString();
+ root["textDomain"] = m_parameters.textDomain();
+ root["options"] = m_parameters.options();
+
+ QJsonDocument document(QJsonDocument::fromVariant(root));
+
+ QFile jsonFile(buildJsonFile());
+ if (jsonFile.open(QIODevice::WriteOnly)) {
+ jsonFile.write(document.toJson());
+ jsonFile.close();
+ } else {
+ qWarning() << "Could not write usermetrics file" << jsonFile.fileName();
}
}
=== modified file 'src/libusermetricsinput/MetricImpl.h'
--- src/libusermetricsinput/MetricImpl.h 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/MetricImpl.h 2014-02-04 12:08:09 +0000
@@ -19,42 +19,63 @@
#ifndef USERMETRICSINPUT_METRICIMPL_H_
#define USERMETRICSINPUT_METRICIMPL_H_
-#include
-#include
-#include
+#include
+#include
+#include
-#include
+#include
+#include
#include
-#include
namespace UserMetricsInput {
class MetricImpl: public Metric {
public:
- explicit MetricImpl(const QString &dataSourceId,
- const QString &formatString, const QString &dataSourcePath,
- const QDBusConnection &dbusConnection, QObject *parent = 0);
+ typedef QSharedPointer Ptr;
+
+ explicit MetricImpl(const QDir &metriccDirectory,
+ const MetricParameters ¶meters,
+ Factory::Ptr factory,
+ QObject *parent = 0);
virtual ~MetricImpl();
- virtual MetricUpdate * update(const QString &username = "");
+ virtual MetricUpdatePtr update(const QString &username = "");
virtual void update(double value, const QString &username = "");
virtual void increment(double amount = 1.0f, const QString &username = "");
+ void setParameters(const MetricParameters ¶meters);
+
+ void setSelf(QSharedPointer self);
+
+ void update(const QVariantList &data);
+
protected:
- virtual QDBusObjectPath createDataSet(const QString &usernameIn);
-
- QDBusConnection m_dbusConnection;
-
- com::canonical::UserMetrics m_userMetrics;
-
- com::canonical::usermetrics::DataSource m_dataSource;
-
- QString m_dataSourceId;
-
- QString m_formatString;
+ QString label() const;
+
+ void scaleData();
+
+ void loadData();
+
+ void writeData();
+
+ QString buildJsonFile();
+
+ QDir m_metricDirectory;
+
+ MetricParameters m_parameters;
+
+ Factory::Ptr m_factory;
+
+ QWeakPointer m_self;
+
+ QVariantList m_currentData;
+
+ QVariantList m_scaledData;
+
+ QDate m_lastUpdated;
};
}
=== modified file 'src/libusermetricsinput/MetricManager.cpp'
--- src/libusermetricsinput/MetricManager.cpp 2013-07-02 14:26:11 +0000
+++ src/libusermetricsinput/MetricManager.cpp 2014-02-04 12:08:09 +0000
@@ -17,28 +17,18 @@
*/
#include
-#include
-#include
-using namespace UserMetricsCommon;
using namespace UserMetricsInput;
MetricManager::MetricManager(QObject *parent) :
QObject(parent) {
-
}
MetricManager::~MetricManager() {
}
MetricManager * MetricManager::getInstance() {
- QDBusConnection dbusConnection(QDBusConnection::systemBus());
-
- QDBusConnectionInterface* interface = dbusConnection.interface();
- if (!interface->isServiceRegistered(DBusPaths::serviceName())) {
- QDBusReply reply(
- interface->startService(DBusPaths::serviceName()));
- }
-
- return new MetricManagerImpl(dbusConnection);
+ Factory::Ptr factory(new Factory());
+ return new MetricManagerImpl(factory, QDir::home().filePath(".cache"),
+ qgetenv("APP_ID"));
}
=== modified file 'src/libusermetricsinput/MetricManager.h'
--- src/libusermetricsinput/MetricManager.h 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/MetricManager.h 2014-02-04 12:08:09 +0000
@@ -20,6 +20,7 @@
#define USERMETRICSINPUT_METRICMANAGER_H_
#include
+#include
/**
* @{
@@ -31,35 +32,12 @@
namespace UserMetricsInput {
class MetricManager;
-class MetricParametersPrivate;
/**
* @brief Shared pointer for the MetricManager
**/
typedef QScopedPointer MetricManagerPtr;
-class Q_DECL_EXPORT MetricParameters {
-public:
-
- explicit MetricParameters(const QString &dataSourceId);
-
- MetricParameters & formatString(const QString &formatString);
-
- MetricParameters & emptyDataString(const QString &emptyDataString);
-
- MetricParameters & textDomain(const QString &textDomain);
-
- MetricParameters & minimum(double minimum);
-
- MetricParameters & maximum(double maximum);
-
- MetricParameters & type(MetricType type);
-
- virtual ~MetricParameters();
-
- QScopedPointer p;
-};
-
/**
* @brief Central place for registering and updating user metrics.
*
@@ -97,6 +75,7 @@
* acceptable to call this method more than once. The same Metric instance
* will be returned.
*/
+ Q_DECL_DEPRECATED
virtual MetricPtr add(const QString &dataSourceId,
const QString &formatString, const QString &emptyDataString = "",
const QString &textDomain = "") = 0;
=== modified file 'src/libusermetricsinput/MetricManagerImpl.cpp'
--- src/libusermetricsinput/MetricManagerImpl.cpp 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/MetricManagerImpl.cpp 2014-02-04 12:08:09 +0000
@@ -18,86 +18,25 @@
#include
#include
-#include
-
-#include
-#include
#include
+#include
using namespace std;
-using namespace UserMetricsCommon;
using namespace UserMetricsInput;
-class UserMetricsInput::MetricParametersPrivate {
- friend class MetricManagerImpl;
- friend class MetricParameters;
-
-public:
- explicit MetricParametersPrivate(const QString &dataSourceId) :
- m_dataSourceId(dataSourceId), m_type(MetricType::USER) {
- }
-
- ~MetricParametersPrivate() {
- }
-
-protected:
- QString m_dataSourceId;
-
- QString m_formatString;
-
- QString m_emptyDataString;
-
- QString m_textDomain;
-
- MetricType m_type;
-
- QVariantMap m_options;
-};
-
-MetricParameters::MetricParameters(const QString &dataSourceId) :
- p(new MetricParametersPrivate(dataSourceId)) {
-}
-
-MetricParameters::~MetricParameters() {
-}
-
-MetricParameters & MetricParameters::formatString(const QString &formatString) {
- p->m_formatString = formatString;
- return *this;
-}
-
-MetricParameters & MetricParameters::emptyDataString(
- const QString &emptyDataString) {
- p->m_emptyDataString = emptyDataString;
- return *this;
-}
-
-MetricParameters & MetricParameters::textDomain(const QString &textDomain) {
- p->m_textDomain = textDomain;
- return *this;
-}
-
-MetricParameters & MetricParameters::minimum(double minimum) {
- p->m_options["minimum"] = minimum;
- return *this;
-}
-
-MetricParameters & MetricParameters::maximum(double maximum) {
- p->m_options["maximum"] = maximum;
- return *this;
-}
-
-MetricParameters & MetricParameters::type(MetricType type) {
- p->m_type = type;
- return *this;
-}
-
-MetricManagerImpl::MetricManagerImpl(const QDBusConnection &dbusConnection,
+MetricManagerImpl::MetricManagerImpl(Factory::Ptr factory,
+ const QDir &cacheDirectory, const QString &applicationId,
QObject *parent) :
- MetricManager(parent), m_dbusConnection(dbusConnection), m_interface(
- DBusPaths::serviceName(), DBusPaths::userMetrics(),
- dbusConnection) {
+ MetricManager(parent), m_factory(factory) {
+ if (applicationId.isEmpty()) {
+ throw logic_error("Invalid application ID");
+ }
+ QDir applicationDirectory(cacheDirectory.filePath(applicationId));
+ if (!applicationDirectory.mkpath("usermetrics")) {
+ throw logic_error("Cannot write to cache directory");
+ }
+ m_metricDirectory = applicationDirectory.filePath("usermetrics");
}
MetricManagerImpl::~MetricManagerImpl() {
@@ -112,27 +51,17 @@
}
MetricPtr MetricManagerImpl::add(const MetricParameters ¶meters) {
- QDBusPendingReply reply(
- m_interface.createDataSource(parameters.p->m_dataSourceId,
- parameters.p->m_formatString,
- parameters.p->m_emptyDataString, parameters.p->m_textDomain,
- parameters.p->m_type, parameters.p->m_options));
-
- reply.waitForFinished();
-
- if (reply.isError()) {
- throw logic_error(reply.error().message().toStdString());
- }
-
- QDBusObjectPath path(reply.value());
-
- auto metric(m_metrics.find(parameters.p->m_dataSourceId));
+ const QString &dataSourceId(parameters.id());
+ auto metric(m_metrics.find(dataSourceId));
if (metric == m_metrics.end()) {
MetricPtr newMetric(
- new MetricImpl(parameters.p->m_dataSourceId,
- parameters.p->m_formatString, path.path(),
- m_dbusConnection));
- metric = m_metrics.insert(parameters.p->m_dataSourceId, newMetric);
+ m_factory->newMetric(m_metricDirectory, parameters, m_factory));
+ metric = m_metrics.insert(dataSourceId, newMetric);
+ } else {
+ MetricImpl::Ptr existingMetric(metric->dynamicCast());
+ if(existingMetric) {
+ existingMetric->setParameters(parameters);
+ }
}
return *metric;
}
=== modified file 'src/libusermetricsinput/MetricManagerImpl.h'
--- src/libusermetricsinput/MetricManagerImpl.h 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/MetricManagerImpl.h 2014-02-04 12:08:09 +0000
@@ -19,8 +19,8 @@
#ifndef USERMETRICSINPUT_METRICMANAGERIMPL_H_
#define USERMETRICSINPUT_METRICMANAGERIMPL_H_
+#include
#include
-#include
#include
@@ -28,11 +28,13 @@
class MetricManagerImpl: public MetricManager {
public:
- explicit MetricManagerImpl(const QDBusConnection &dbusConnection,
+ explicit MetricManagerImpl(Factory::Ptr factory,
+ const QDir &cacheDirectory, const QString &applicationId,
QObject *parent = 0);
virtual ~MetricManagerImpl();
+ Q_DECL_DEPRECATED
virtual MetricPtr add(const QString &dataSourceId,
const QString &formatString, const QString &emptyDataString = "",
const QString &textDomain = "");
@@ -40,9 +42,9 @@
virtual MetricPtr add(const MetricParameters ¶meters);
protected:
- QDBusConnection m_dbusConnection;
+ Factory::Ptr m_factory;
- com::canonical::UserMetrics m_interface;
+ QDir m_metricDirectory;
QMap m_metrics;
};
=== added file 'src/libusermetricsinput/MetricParameters.cpp'
--- src/libusermetricsinput/MetricParameters.cpp 1970-01-01 00:00:00 +0000
+++ src/libusermetricsinput/MetricParameters.cpp 2014-02-04 12:08:09 +0000
@@ -0,0 +1,132 @@
+/*
+ * MetricParametersy.cpp
+ *
+ * Created on: 11 Dec 2013
+ * Author: pete
+ */
+
+#include
+
+#include
+
+namespace UserMetricsInput {
+
+class MetricParametersPrivate {
+ friend class MetricManagerImpl;
+ friend class MetricParameters;
+
+public:
+ explicit MetricParametersPrivate(const QString &dataSourceId) :
+ m_dataSourceId(dataSourceId), m_type(MetricType::USER) {
+ }
+
+ explicit MetricParametersPrivate(const MetricParametersPrivate &other) :
+ m_dataSourceId(other.m_dataSourceId), m_formatString(
+ other.m_formatString), m_emptyDataString(
+ other.m_emptyDataString), m_textDomain(other.m_textDomain), m_type(
+ other.m_type), m_options(other.m_options) {
+ }
+
+ ~MetricParametersPrivate() {
+ }
+
+protected:
+ QString m_dataSourceId;
+
+ QString m_formatString;
+
+ QString m_emptyDataString;
+
+ QString m_textDomain;
+
+ MetricType m_type;
+
+ QVariantMap m_options;
+};
+
+MetricParameters::MetricParameters(const QString &dataSourceId) :
+ p(new MetricParametersPrivate(dataSourceId)) {
+}
+
+MetricParameters::MetricParameters(const MetricParameters &other) :
+ p(new MetricParametersPrivate(*other.p)) {
+}
+
+MetricParameters::~MetricParameters() {
+}
+
+MetricParameters & MetricParameters::operator=(const MetricParameters &other) {
+ p->m_dataSourceId = other.p->m_dataSourceId;
+ p->m_formatString = other.p->m_formatString;
+ p->m_emptyDataString = other.p->m_emptyDataString;
+ p->m_textDomain = other.p->m_textDomain;
+ p->m_type = other.p->m_type;
+ p->m_options = other.p->m_options;
+ return *this;
+}
+
+bool MetricParameters::operator==(const MetricParameters &other) const {
+ return p->m_dataSourceId == other.p->m_dataSourceId
+ && p->m_formatString == other.p->m_formatString
+ && p->m_emptyDataString == other.p->m_emptyDataString
+ && p->m_textDomain == other.p->m_textDomain
+ && p->m_type == other.p->m_type
+ && p->m_options == other.p->m_options;
+}
+
+MetricParameters & MetricParameters::formatString(const QString &formatString) {
+ p->m_formatString = formatString;
+ return *this;
+}
+
+MetricParameters & MetricParameters::emptyDataString(
+ const QString &emptyDataString) {
+ p->m_emptyDataString = emptyDataString;
+ return *this;
+}
+
+MetricParameters & MetricParameters::textDomain(const QString &textDomain) {
+ p->m_textDomain = textDomain;
+ return *this;
+}
+
+MetricParameters & MetricParameters::minimum(double minimum) {
+ p->m_options["minimum"] = minimum;
+ return *this;
+}
+
+MetricParameters & MetricParameters::maximum(double maximum) {
+ p->m_options["maximum"] = maximum;
+ return *this;
+}
+
+MetricParameters & MetricParameters::type(MetricType type) {
+ p->m_type = type;
+ return *this;
+}
+
+const QString & MetricParameters::id() const {
+ return p->m_dataSourceId;
+}
+
+const QString & MetricParameters::formatString() const {
+ return p->m_formatString;
+}
+
+const QString & MetricParameters::emptyDataString() const {
+ return p->m_emptyDataString;
+}
+
+const QString & MetricParameters::textDomain() const {
+ return p->m_textDomain;
+}
+
+MetricType MetricParameters::type() const {
+ return p->m_type;
+}
+
+const QVariantMap & MetricParameters::options() const {
+ return p->m_options;
+}
+
+}
=== added file 'src/libusermetricsinput/MetricParameters.h'
--- src/libusermetricsinput/MetricParameters.h 1970-01-01 00:00:00 +0000
+++ src/libusermetricsinput/MetricParameters.h 2014-02-04 12:08:09 +0000
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2013 Canonical, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of version 3 of the GNU Lesser General Public License as published
+ * by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Author: Pete Woods
+ */
+
+#ifndef USERMETRICSINPUT_METRICPARAMETERS_H_
+#define USERMETRICSINPUT_METRICPARAMETERS_H_
+
+#include
+
+#include
+#include
+
+namespace UserMetricsInput {
+
+class MetricParametersPrivate;
+
+class Q_DECL_EXPORT MetricParameters {
+public:
+
+ explicit MetricParameters(const QString &dataSourceId);
+
+ MetricParameters(const MetricParameters &other);
+
+ virtual ~MetricParameters();
+
+ MetricParameters & operator=(const MetricParameters &other);
+
+ bool operator==(const MetricParameters &other) const;
+
+ MetricParameters & formatString(const QString &formatString);
+
+ MetricParameters & emptyDataString(const QString &emptyDataString);
+
+ MetricParameters & textDomain(const QString &textDomain);
+
+ MetricParameters & minimum(double minimum);
+
+ MetricParameters & maximum(double maximum);
+
+ MetricParameters & type(MetricType type);
+
+ const QString & id() const;
+
+ const QString & formatString() const;
+
+ const QString & emptyDataString() const;
+
+ const QString & textDomain() const;
+
+ MetricType type() const;
+
+ const QVariantMap & options() const;
+
+protected:
+ QScopedPointer p;
+};
+
+}
+
+#endif // USERMETRICSINPUT_METRICPARAMETERS_H_
=== modified file 'src/libusermetricsinput/MetricUpdate.h'
--- src/libusermetricsinput/MetricUpdate.h 2013-07-09 16:51:58 +0000
+++ src/libusermetricsinput/MetricUpdate.h 2014-02-04 12:08:09 +0000
@@ -33,7 +33,7 @@
/**
* @brief Useful to store your instance of MetricUpdate in.
**/
-typedef QScopedPointer MetricUpdatePtr;
+typedef QSharedPointer MetricUpdatePtr;
/**
* @brief An update to a Metric
=== modified file 'src/libusermetricsinput/MetricUpdateImpl.cpp'
--- src/libusermetricsinput/MetricUpdateImpl.cpp 2013-09-24 16:20:00 +0000
+++ src/libusermetricsinput/MetricUpdateImpl.cpp 2014-02-04 12:08:09 +0000
@@ -16,28 +16,21 @@
* Author: Pete Woods
*/
+#include
#include
-#include
#include
using namespace std;
-using namespace UserMetricsCommon;
using namespace UserMetricsInput;
-MetricUpdateImpl::MetricUpdateImpl(const QString &path,
- const QDBusConnection &dbusConnection, QObject *parent) :
- MetricUpdate(parent), m_dbusConnection(dbusConnection), m_interface(
- DBusPaths::serviceName(), path, dbusConnection) {
+MetricUpdateImpl::MetricUpdateImpl(QSharedPointer metric,
+ QObject *parent) :
+ MetricUpdate(parent), m_metric(metric) {
}
MetricUpdateImpl::~MetricUpdateImpl() {
- QDBusPendingReply reply(m_interface.update(m_data));
- reply.waitForFinished();
-
- if (reply.isError()) {
- throw logic_error(reply.error().message().toStdString());
- }
+ m_metric->update(m_data);
}
void MetricUpdateImpl::addData(double data) {
@@ -45,5 +38,5 @@
}
void MetricUpdateImpl::addNull() {
- m_data << "";
+ m_data << QVariant();
}
=== modified file 'src/libusermetricsinput/MetricUpdateImpl.h'
--- src/libusermetricsinput/MetricUpdateImpl.h 2013-07-02 14:26:11 +0000
+++ src/libusermetricsinput/MetricUpdateImpl.h 2014-02-04 12:08:09 +0000
@@ -20,20 +20,19 @@
#define USERMETRICSINPUT_METRICUPDATEIMPL_H_
#include
+#include
#include
-#include
#include
-#include
namespace UserMetricsInput {
-class Metric;
+class MetricImpl;
class MetricUpdateImpl: public MetricUpdate {
public:
- explicit MetricUpdateImpl(const QString &path,
- const QDBusConnection &dbusConnection, QObject *parent = 0);
+ explicit MetricUpdateImpl(QSharedPointer metric,
+ QObject *parent = 0);
virtual ~MetricUpdateImpl();
@@ -42,9 +41,7 @@
virtual void addNull();
protected:
- QDBusConnection m_dbusConnection;
-
- com::canonical::usermetrics::DataSet m_interface;
+ QSharedPointer m_metric;
QVariantList m_data;
};
=== modified file 'src/libusermetricsinput/usermetricsinput.cpp'
--- src/libusermetricsinput/usermetricsinput.cpp 2013-09-03 14:59:00 +0000
+++ src/libusermetricsinput/usermetricsinput.cpp 2014-02-04 12:08:09 +0000
@@ -176,9 +176,10 @@
UserMetricsInputMetric m, const char *username) {
try {
Metric *metric(reinterpret_cast(m));
- MetricUpdatePtr metricUpdate(
- metric->update(QString::fromUtf8(username)));
- return reinterpret_cast(metricUpdate.take());
+ MetricUpdatePtr* metricUpdate(
+ new MetricUpdatePtr(
+ metric->update(QString::fromUtf8(username))));
+ return reinterpret_cast(metricUpdate);
} catch (exception &e) {
fprintf(stderr, "Error creating MetricUpdate: %s\n", e.what());
}
@@ -188,7 +189,7 @@
void usermetricsinput_metricupdate_delete(
UserMetricsInputMetricUpdate metricUpdate) {
try {
- delete reinterpret_cast(metricUpdate);
+ delete reinterpret_cast(metricUpdate);
} catch (exception &e) {
fprintf(stderr, "Error deleting MetricUpdate: %s\n", e.what());
}
@@ -197,8 +198,8 @@
void usermetricsinput_metricupdate_add_data(UserMetricsInputMetricUpdate u,
double data) {
try {
- MetricUpdate *metricUpdate = reinterpret_cast(u);
- metricUpdate->addData(data);
+ MetricUpdatePtr *metricUpdate = reinterpret_cast(u);
+ (*metricUpdate)->addData(data);
} catch (exception &e) {
fprintf(stderr, "Error adding data: %s\n", e.what());
}
@@ -206,8 +207,8 @@
void usermetricsinput_metricupdate_add_null(UserMetricsInputMetricUpdate u) {
try {
- MetricUpdate *metricUpdate = reinterpret_cast(u);
- metricUpdate->addNull();
+ MetricUpdatePtr *metricUpdate = reinterpret_cast(u);
+ (*metricUpdate)->addNull();
} catch (exception &e) {
fprintf(stderr, "Error adding null: %s\n", e.what());
}
=== modified file 'src/libusermetricsoutput/CMakeLists.txt'
--- src/libusermetricsoutput/CMakeLists.txt 2013-09-26 09:12:58 +0000
+++ src/libusermetricsoutput/CMakeLists.txt 2014-02-04 12:08:09 +0000
@@ -12,10 +12,6 @@
GSettingsColorThemeProvider.cpp
DataSet.cpp
DataSource.cpp
- SyncedDataSet.cpp
- SyncedDataSource.cpp
- SyncedUserMetricsStore.cpp
- SyncedUserData.cpp
UserData.cpp
UserMetrics.cpp
UserMetricsImpl.cpp
=== modified file 'src/libusermetricsoutput/ColorThemeProvider.h'
--- src/libusermetricsoutput/ColorThemeProvider.h 2013-09-20 16:33:35 +0000
+++ src/libusermetricsoutput/ColorThemeProvider.h 2014-02-04 12:08:09 +0000
@@ -36,6 +36,7 @@
ColorThemeProvider(QObject *parent = 0);
public:
+ typedef QSharedPointer Ptr;
virtual ~ColorThemeProvider();
=== removed file 'src/libusermetricsoutput/SyncedDataSet.cpp'
--- src/libusermetricsoutput/SyncedDataSet.cpp 2013-09-03 17:14:46 +0000
+++ src/libusermetricsoutput/SyncedDataSet.cpp 1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of version 3 of the GNU Lesser General Public License as published
- * by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#include
-
-using namespace UserMetricsOutput;
-
-SyncedDataSet::SyncedDataSet(
- QSharedPointer interface,
- DataSourcePtr dataSource, QObject *parent) :
- DataSet(dataSource, parent), m_interface(interface) {
-
- connect(m_interface.data(), SIGNAL(updated(uint, const QVariantList &)),
- this, SLOT(update(uint, const QVariantList &)));
- update(m_interface->lastUpdated(), m_interface->data());
-}
-
-SyncedDataSet::~SyncedDataSet() {
-}
=== removed file 'src/libusermetricsoutput/SyncedDataSet.h'
--- src/libusermetricsoutput/SyncedDataSet.h 2013-09-03 17:14:46 +0000
+++ src/libusermetricsoutput/SyncedDataSet.h 1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of version 3 of the GNU Lesser General Public License as published
- * by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#ifndef USERMETRICSOUTPUT_SYNCEDDATASET_H_
-#define USERMETRICSOUTPUT_SYNCEDDATASET_H_
-
-#include
-#include
-
-namespace UserMetricsOutput {
-
-class SyncedDataSet: public DataSet {
-Q_OBJECT
-
-public:
- explicit SyncedDataSet(
- QSharedPointer interface,
- DataSourcePtr dataSource, QObject *parent = 0);
-
- virtual ~SyncedDataSet();
-
-protected:
- QSharedPointer m_interface;
-};
-
-}
-
-#endif // USERMETRICSOUTPUT_SYNCEDDATASET_H_
=== removed file 'src/libusermetricsoutput/SyncedDataSource.cpp'
--- src/libusermetricsoutput/SyncedDataSource.cpp 2013-09-04 09:09:23 +0000
+++ src/libusermetricsoutput/SyncedDataSource.cpp 1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of version 3 of the GNU Lesser General Public License as published
- * by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#include
-
-using namespace UserMetricsOutput;
-
-SyncedDataSource::SyncedDataSource(
- QSharedPointer interface,
- const QString &localeDir, QObject *parent) :
- DataSource(localeDir, parent), m_interface(interface) {
-
- connect(m_interface.data(), SIGNAL(formatStringChanged(const QString &)),
- this, SLOT(setFormatString(const QString &)));
- connect(m_interface.data(), SIGNAL(emptyDataStringChanged(const QString &)),
- this, SLOT(setEmptyDataString(const QString &)));
- connect(m_interface.data(), SIGNAL(textDomainChanged(const QString &)),
- this, SLOT(setTextDomain(const QString &)));
- connect(m_interface.data(), SIGNAL(metricTypeChanged(uint)), this,
- SLOT(setTypeUint(uint)));
- connect(m_interface.data(), SIGNAL(optionsChanged(const QVariantMap &)),
- this, SLOT(setOptions(const QVariantMap &)));
- setFormatString(m_interface->formatString());
- setEmptyDataString(m_interface->emptyDataString());
- setTextDomain(m_interface->textDomain());
- setTypeUint(m_interface->metricType());
- setOptions(m_interface->options());
-}
-
-SyncedDataSource::~SyncedDataSource() {
-}
-
-void SyncedDataSource::setTypeUint(uint t) {
- MetricType type(USER);
- if (t == SYSTEM) {
- type = SYSTEM;
- }
- setType(type);
-}
=== removed file 'src/libusermetricsoutput/SyncedDataSource.h'
--- src/libusermetricsoutput/SyncedDataSource.h 2013-09-04 09:09:23 +0000
+++ src/libusermetricsoutput/SyncedDataSource.h 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of version 3 of the GNU Lesser General Public License as published
- * by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#ifndef SYNCEDDATASOURCE_H_
-#define SYNCEDDATASOURCE_H_
-
-#include
-#include
-
-namespace UserMetricsOutput {
-
-class SyncedDataSource: public DataSource {
-Q_OBJECT
-
-public:
- SyncedDataSource(
- QSharedPointer interface,
- const QString &localeDir = LOCALEDIR, QObject *parent = 0);
-
- virtual ~SyncedDataSource();
-
-protected Q_SLOTS:
- void setTypeUint(uint type);
-
-protected:
- QSharedPointer m_interface;
-};
-
-}
-
-#endif /* SYNCEDDATASOURCE_H_ */
=== removed file 'src/libusermetricsoutput/SyncedUserData.cpp'
--- src/libusermetricsoutput/SyncedUserData.cpp 2013-10-22 08:53:23 +0000
+++ src/libusermetricsoutput/SyncedUserData.cpp 1970-01-01 00:00:00 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of version 3 of the GNU Lesser General Public License as published
- * by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#include
-#include
-#include
-#include
-#include
-
-using namespace com;
-using namespace UserMetricsCommon;
-using namespace UserMetricsOutput;
-
-SyncedUserData::SyncedUserData(UserMetricsStore &userMetricsStore,
- QSharedPointer interface,
- QObject *parent) :
- UserData(userMetricsStore, parent) {
- attachUserData(interface);
-}
-
-SyncedUserData::~SyncedUserData() {
-}
-
-void SyncedUserData::attachUserData(
- QSharedPointer interface) {
- if (m_userDatas.contains(interface)) {
- return;
- }
-
- m_userDatas.insert(interface);
-
- connect(interface.data(),
- SIGNAL(dataSetAdded(const QDBusObjectPath &, const QDBusObjectPath &)),
- this,
- SLOT(addDataSet(const QDBusObjectPath &, const QDBusObjectPath &)));
-
- connect(interface.data(),
- SIGNAL(dataSetRemoved(const QDBusObjectPath &, const QDBusObjectPath &)),
- this,
- SLOT(removeDataSet(const QDBusObjectPath &, const QDBusObjectPath &)));
-
- for (const QDBusObjectPath &path : interface->dataSets()) {
-
- QSharedPointer dataSet(
- new canonical::usermetrics::DataSet(DBusPaths::serviceName(),
- path.path(), interface->connection()));
-
- QString dataSourcePath(dataSet->dataSource().path());
- insert(dataSourcePath,
- DataSetPtr(
- new SyncedDataSet(dataSet,
- m_userMetricsStore.dataSource(
- dataSourcePath))));
- }
-}
-
-void SyncedUserData::addDataSet(const QDBusObjectPath &dataSourcePath,
- const QDBusObjectPath &path) {
- QSharedPointer dataSet(
- new canonical::usermetrics::DataSet(DBusPaths::serviceName(),
- path.path(), (*m_userDatas.begin())->connection()));
-
- insert(dataSourcePath.path(),
- DataSetPtr(
- new SyncedDataSet(dataSet,
- m_userMetricsStore.dataSource(
- dataSourcePath.path()))));
-}
-
-void SyncedUserData::removeDataSet(const QDBusObjectPath &dataSourcePath,
- const QDBusObjectPath &path) {
- Q_UNUSED(path);
- m_dataSets.remove(dataSourcePath.path());
-}
=== removed file 'src/libusermetricsoutput/SyncedUserData.h'
--- src/libusermetricsoutput/SyncedUserData.h 2013-10-22 08:53:23 +0000
+++ src/libusermetricsoutput/SyncedUserData.h 1970-01-01 00:00:00 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of version 3 of the GNU Lesser General Public License as published
- * by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#ifndef USERMETRICSOUTPUT_SYNCEDUSERDATA_H_
-#define USERMETRICSOUTPUT_SYNCEDUSERDATA_H_
-
-#include
-#include
-#include
-
-namespace UserMetricsOutput {
-
-class UserMetricsStore;
-
-class SyncedUserData: public UserData {
-Q_OBJECT
-
-public:
- explicit SyncedUserData(UserMetricsStore &userMetricsStore,
- QSharedPointer interface,
- QObject *parent = 0);
-
- virtual ~SyncedUserData();
-
- void attachUserData(
- QSharedPointer interface);
-
-public Q_SLOTS:
- void addDataSet(const QDBusObjectPath &dataSourcePath,
- const QDBusObjectPath &path);
-
- void removeDataSet(const QDBusObjectPath &dataSourcePath,
- const QDBusObjectPath &path);
-
-protected:
- QSet> m_userDatas;
-};
-
-}
-
-#endif // USERMETRICSOUTPUT_SYNCEDUSERDATA_H_
=== removed file 'src/libusermetricsoutput/SyncedUserMetricsStore.cpp'
--- src/libusermetricsoutput/SyncedUserMetricsStore.cpp 2013-10-22 08:53:23 +0000
+++ src/libusermetricsoutput/SyncedUserMetricsStore.cpp 1970-01-01 00:00:00 +0000
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of version 3 of the GNU Lesser General Public License as published
- * by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#include
-#include
-#include
-
-#include
-#include
-
-using namespace com;
-using namespace UserMetricsCommon;
-using namespace UserMetricsOutput;
-
-SyncedUserMetricsStore::SyncedUserMetricsStore(
- const QDBusConnection &dbusConnection, const QString &localeDir,
- QObject *parent) :
- UserMetricsStore(parent), m_interface(DBusPaths::serviceName(),
- DBusPaths::userMetrics(), dbusConnection), m_localeDir(
- localeDir) {
- QTimer::singleShot(0, this, SLOT(sync()));
-}
-
-SyncedUserMetricsStore::~SyncedUserMetricsStore() {
-}
-
-void SyncedUserMetricsStore::sync() {
- QDBusConnectionInterface* interface = m_interface.connection().interface();
- if (!interface->isServiceRegistered(DBusPaths::serviceName())) {
- QDBusReply reply(
- interface->startService(DBusPaths::serviceName()));
- }
-
- connect(&m_interface,
- SIGNAL(dataSourceAdded(const QDBusObjectPath &)), this,
- SLOT(addDataSource(const QDBusObjectPath &)));
-
- connect(&m_interface,
- SIGNAL(dataSourceRemoved(const QDBusObjectPath &)), this,
- SLOT(removeDataSource(const QDBusObjectPath &)));
-
- connect(&m_interface,
- SIGNAL(userDataAdded(const QString &, const QDBusObjectPath &)), this,
- SLOT(addUserData(const QString &, const QDBusObjectPath &)));
-
- connect(&m_interface,
- SIGNAL(userDataRemoved(const QString &, const QDBusObjectPath &)), this,
- SLOT(removeUserData(const QString &, const QDBusObjectPath &)));
-
- for (const QDBusObjectPath &path : m_interface.dataSources()) {
- addDataSource(path);
- }
-
- QSharedPointer systemData;
-
- for (const QDBusObjectPath &path : m_interface.userDatas()) {
-
- QSharedPointer userData(
- new canonical::usermetrics::UserData(DBusPaths::serviceName(),
- path.path(), m_interface.connection()));
-
- QString username(userData->username());
- if (username == "") {
- systemData = userData;
- continue;
- }
- insert(username, UserDataPtr(new SyncedUserData(*this, userData)));
- }
-
- // if we have system data we must attach it to each of the user datas
- if (!systemData.isNull()) {
- attachSystemData(systemData);
- }
-
- connectionEstablished();
-}
-
-void SyncedUserMetricsStore::attachSystemData(
- QSharedPointer systemData) {
- for (UserDataPtr userData : m_userData.values()) {
- SyncedUserData *syncedData = qobject_cast(
- userData.data());
- syncedData->attachUserData(systemData);
- }
-}
-
-void SyncedUserMetricsStore::addUserData(const QString &username,
- const QDBusObjectPath &path) {
-
- QSharedPointer userData(
- new canonical::usermetrics::UserData(DBusPaths::serviceName(),
- path.path(), m_interface.connection()));
-
- // if we're adding system data for the first time, we must attach it
- // to all of the user datas
- if (username == "") {
- attachSystemData(userData);
- } else {
- insert(username, UserDataPtr(new SyncedUserData(*this, userData)));
- }
-}
-
-void SyncedUserMetricsStore::removeUserData(const QString &username,
- const QDBusObjectPath &path) {
- Q_UNUSED(path);
-
- //FIXME Handle system user data being removed
- if (username == "") {
- return;
- }
-
- m_dataSources.remove(username);
-}
-
-void SyncedUserMetricsStore::addDataSource(const QDBusObjectPath &path) {
-
- QSharedPointer dataSource(
- new canonical::usermetrics::DataSource(DBusPaths::serviceName(),
- path.path(), m_interface.connection()));
-
- insert(path.path(),
- DataSourcePtr(new SyncedDataSource(dataSource, m_localeDir)));
-}
-
-void SyncedUserMetricsStore::removeDataSource(const QDBusObjectPath &path) {
- m_userData.remove(path.path());
-}
=== removed file 'src/libusermetricsoutput/SyncedUserMetricsStore.h'
--- src/libusermetricsoutput/SyncedUserMetricsStore.h 2013-10-22 08:53:23 +0000
+++ src/libusermetricsoutput/SyncedUserMetricsStore.h 1970-01-01 00:00:00 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of version 3 of the GNU Lesser General Public License as published
- * by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#ifndef USERMETRICSOUTPUT_SYNCEDUSERMETRICSSTORE_H_
-#define USERMETRICSOUTPUT_SYNCEDUSERMETRICSSTORE_H_
-
-#include
-#include
-#include
-
-namespace UserMetricsOutput {
-
-class SyncedUserMetricsStore: public UserMetricsStore {
-Q_OBJECT
-
-public:
- explicit SyncedUserMetricsStore(const QDBusConnection &dbusConnection,
- const QString &localeDir = LOCALEDIR, QObject *parent = 0);
-
- virtual ~SyncedUserMetricsStore();
-
-Q_SIGNALS:
- void connectionEstablished();
-
-public Q_SLOTS:
- void addUserData(const QString &username, const QDBusObjectPath &path);
-
- void removeUserData(const QString &username, const QDBusObjectPath &path);
-
- void addDataSource(const QDBusObjectPath &path);
-
- void removeDataSource(const QDBusObjectPath &path);
-
- void sync();
-
-protected:
- void attachSystemData(
- QSharedPointer systemData);
-
- com::canonical::UserMetrics m_interface;
-
- QString m_localeDir;
-}
-;
-
-}
-
-#endif // USERMETRICSOUTPUT_SYNCEDUSERMETRICSSTORE_H_
=== modified file 'src/libusermetricsoutput/UserMetrics.cpp'
--- src/libusermetricsoutput/UserMetrics.cpp 2013-09-20 12:20:49 +0000
+++ src/libusermetricsoutput/UserMetrics.cpp 2014-02-04 12:08:09 +0000
@@ -16,14 +16,13 @@
* Author: Pete Woods
*/
-#include
#include
#include
+#include
#include
-#include
+using namespace UserMetricsCommon;
using namespace UserMetricsOutput;
-using namespace UserMetricsCommon;
UserMetrics::UserMetrics(QObject *parent) :
QObject(parent) {
@@ -33,12 +32,8 @@
}
UserMetrics * UserMetrics::getInstance() {
- QDBusConnection dbusConnection(QDBusConnection::systemBus());
-
return new UserMetricsImpl(
QSharedPointer(new DateFactoryImpl()),
- QSharedPointer(
- new SyncedUserMetricsStore(dbusConnection)),
- QSharedPointer(
- new GSettingsColorThemeProvider()));
+ UserMetricsStore::Ptr(new UserMetricsStore()),
+ ColorThemeProvider::Ptr(new GSettingsColorThemeProvider()));
}
=== modified file 'src/libusermetricsoutput/UserMetricsImpl.cpp'
--- src/libusermetricsoutput/UserMetricsImpl.cpp 2013-10-22 08:53:23 +0000
+++ src/libusermetricsoutput/UserMetricsImpl.cpp 2014-02-04 12:08:09 +0000
@@ -30,8 +30,8 @@
using namespace UserMetricsCommon;
UserMetricsImpl::UserMetricsImpl(QSharedPointer dateFactory,
- QSharedPointer userDataStore,
- QSharedPointer colorThemeProvider, QObject *parent) :
+ UserMetricsStore::Ptr userDataStore,
+ ColorThemeProvider::Ptr colorThemeProvider, QObject *parent) :
UserMetrics(parent), m_dateFactory(dateFactory), m_userMetricsStore(
userDataStore), m_colorThemeProvider(colorThemeProvider), m_firstColor(
new ColorThemeImpl(this)), m_firstMonth(
@@ -41,8 +41,8 @@
false), m_oldNoDataForUser(false) {
connect(this, SIGNAL(nextDataSource()), this, SLOT(nextDataSourceSlot()),
Qt::QueuedConnection);
- connect(this, SIGNAL(readyForDataChange()), this, SLOT(
- readyForDataChangeSlot()), Qt::QueuedConnection);
+ connect(this, SIGNAL(readyForDataChange()), this,
+ SLOT(readyForDataChangeSlot()), Qt::QueuedConnection);
// set up a watch for new user data appearing
connect(m_userMetricsStore.data(),
@@ -252,7 +252,8 @@
DataSourcePtr dataSource(m_userMetricsStore->dataSource(dataSourcePath));
if (dataSource.isNull()) {
- qWarning() << _("Data source not found") << " [" << dataSourcePath << "]";
+ qWarning() << _("Data source not found") << " [" << dataSourcePath
+ << "]";
} else {
ColorThemePtrPair colorTheme(
m_colorThemeProvider->getColorTheme(dataSourcePath));
=== modified file 'src/libusermetricsoutput/UserMetricsStore.h'
--- src/libusermetricsoutput/UserMetricsStore.h 2013-10-22 08:53:23 +0000
+++ src/libusermetricsoutput/UserMetricsStore.h 2014-02-04 12:08:09 +0000
@@ -30,6 +30,8 @@
class UserMetricsStore: public QObject {
Q_OBJECT
public:
+ typedef QSharedPointer Ptr;
+
typedef QMap UserDataMap;
typedef UserDataMap::iterator iterator;
=== removed file 'src/usermetricsservice/Authentication.cpp'
--- src/usermetricsservice/Authentication.cpp 2013-10-01 10:22:38 +0000
+++ src/usermetricsservice/Authentication.cpp 1970-01-01 00:00:00 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-namespace UserMetricsService {
-
-Authentication::Authentication() :
- m_clickRegex(
- "[a-z0-9][a-z0-9+.-]+_[a-zA-Z0-9+.-]+_[0-9][a-zA-Z0-9.+:~-]*") {
-}
-
-Authentication::~Authentication() {
-}
-
-QString Authentication::getConfinementContext(
- const QDBusContext& context) const {
- if (!context.calledFromDBus()
- || qEnvironmentVariableIsSet("USERMETRICS_NO_AUTH")) {
- return "unconfined";
- }
-
- const QDBusConnectionInterface &interface(
- *context.connection().interface());
- unsigned int servicePid = interface.servicePid(context.message().service());
-
- char *con(0);
- aa_gettaskcon(servicePid, &con, 0);
- QString confinementContext(QString::fromUtf8(con));
- free(con);
-
- canonicalizeConfinementContext(confinementContext);
-
- return confinementContext;
-}
-
-QString Authentication::getUsername(const QDBusContext& context) const {
- if (!context.calledFromDBus()
- || qEnvironmentVariableIsSet("USERMETRICS_NO_AUTH")) {
- return "";
- }
-
- const QDBusConnectionInterface &interface(
- *context.connection().interface());
- unsigned int serviceUid = interface.serviceUid(context.message().service());
-
- struct passwd* pwd;
- char x_buf[1024 * sizeof(*pwd)];
- size_t size = sizeof(x_buf);
- char* buf = x_buf;
-
- int x_errno = getpwuid_r(serviceUid, (struct passwd*) (buf),
- buf + sizeof(*pwd), size - sizeof(*pwd), &pwd);
- if (x_errno) {
- pwd = 0;
- return "";
- }
-
- QString username(pwd->pw_name);
-
- if (buf != x_buf) {
- delete[] buf;
- }
-
- return username;
-}
-
-void Authentication::sendErrorReply(const QDBusContext &context,
- QDBusError::ErrorType type, const QString &msg) const {
- if (context.calledFromDBus()) {
- context.sendErrorReply(type, msg);
- }
-}
-
-void Authentication::canonicalizeConfinementContext(
- QString &confinementContext) const {
- if (m_clickRegex.exactMatch(confinementContext)) {
- QStringList split(confinementContext.split("_"));
- confinementContext = split.first();
- }
-}
-
-} /* namespace UserMetricsService */
=== removed file 'src/usermetricsservice/Authentication.h'
--- src/usermetricsservice/Authentication.h 2013-10-01 10:22:38 +0000
+++ src/usermetricsservice/Authentication.h 1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#ifndef USERMETRICSSERVICE_AUTHENTICATION_H_
-#define USERMETRICSSERVICE_AUTHENTICATION_H_
-
-#include
-#include
-#include
-
-QT_BEGIN_NAMESPACE
-class QDBusConnection;
-class QDBusContext;
-QT_END_NAMESPACE
-
-namespace UserMetricsService {
-
-class Authentication {
-public:
- Authentication();
-
- virtual ~Authentication();
-
- virtual QString getConfinementContext(const QDBusContext &context) const;
-
- virtual QString getUsername(const QDBusContext &context) const;
-
- virtual void sendErrorReply(const QDBusContext &context,
- QDBusError::ErrorType type, const QString &msg = QString()) const;
-
- virtual void canonicalizeConfinementContext(
- QString &confinementContext) const;
-
-protected:
- QRegExp m_clickRegex;
-};
-
-}
-#endif // USERMETRICSSERVICE_AUTHENTICATION_H_
=== modified file 'src/usermetricsservice/CMakeLists.txt'
--- src/usermetricsservice/CMakeLists.txt 2013-09-24 11:26:56 +0000
+++ src/usermetricsservice/CMakeLists.txt 2014-02-04 12:08:09 +0000
@@ -1,66 +1,17 @@
-set(USERMETRICSSERVICE_SOURCES
- database/DataSet.cpp
- database/DataSource.cpp
- database/UserData.cpp
- Authentication.cpp
- DBusDataSet.cpp
- DBusDataSource.cpp
- DBusUserData.cpp
- DBusUserMetrics.cpp
-)
-
-qt5_add_dbus_adaptor(
- USERMETRICSSERVICE_SOURCES
- "${DATA_DIR}/com.canonical.UserMetrics.xml"
- usermetricsservice/DBusUserMetrics.h
- UserMetricsService::DBusUserMetrics
- UserMetricsAdaptor
-)
-
-qt5_add_dbus_adaptor(
- USERMETRICSSERVICE_SOURCES
- "${DATA_DIR}/com.canonical.usermetrics.DataSource.xml"
- usermetricsservice/DBusDataSource.h
- UserMetricsService::DBusDataSource
- DataSourceAdaptor
-)
-
-qt5_add_dbus_adaptor(
- USERMETRICSSERVICE_SOURCES
- "${DATA_DIR}/com.canonical.usermetrics.UserData.xml"
- usermetricsservice/DBusUserData.h
- UserMetricsService::DBusUserData
- UserDataAdaptor
-)
-
-qt5_add_dbus_adaptor(
- USERMETRICSSERVICE_SOURCES
- "${DATA_DIR}/com.canonical.usermetrics.DataSet.xml"
- usermetricsservice/DBusDataSet.h
- UserMetricsService::DBusDataSet
- DataSetAdaptor
-)
-
-add_library(
- usermetricsservice
- STATIC
- ${USERMETRICSSERVICE_SOURCES}
-)
-
-qt5_use_modules(
- usermetricsservice
- Core
- DBus
- Sql
-)
-
-target_link_libraries(
- usermetricsservice
- usermetricscommon
- ${QDJANGO_DB_LIBRARIES}
- ${APPARMOR_LIBRARIES}
-)
+#set(USERMETRICSSERVICE_SOURCES
+#)
+
+#add_library(
+# usermetricsservice
+# STATIC
+# ${USERMETRICSSERVICE_SOURCES}
+#)
+
+#target_link_libraries(
+# usermetricsservice
+# ${APPARMOR_LIBRARIES}
+#)
############################
# Service executable
@@ -77,15 +28,10 @@
OUTPUT_NAME "usermetricsservice"
)
-qt5_use_modules(
- usermetricsservice-bin
- Core
-)
-
-target_link_libraries(
- usermetricsservice-bin
- usermetricsservice
-)
+#target_link_libraries(
+# usermetricsservice-bin
+# usermetricsservice
+#)
#########################
# Installation
@@ -94,4 +40,4 @@
install(
TARGETS usermetricsservice-bin
RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/libusermetrics"
-)
\ No newline at end of file
+)
=== removed file 'src/usermetricsservice/DBusDataSet.cpp'
--- src/usermetricsservice/DBusDataSet.cpp 2013-10-22 08:53:23 +0000
+++ src/usermetricsservice/DBusDataSet.cpp 1970-01-01 00:00:00 +0000
@@ -1,221 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-#include
-
-using namespace std;
-using namespace UserMetricsCommon;
-using namespace UserMetricsService;
-
-DBusDataSet::DBusDataSet(int id, const QString &dataSource,
- QDBusConnection &dbusConnection,
- QSharedPointer dateFactory,
- QSharedPointer authentication, QObject *parent) :
- QObject(parent), m_dbusConnection(dbusConnection), m_adaptor(
- new DataSetAdaptor(this)), m_dateFactory(dateFactory), m_authentication(
- authentication), m_id(id), m_path(DBusPaths::dataSet(m_id)), m_dataSource(
- dataSource) {
-
- // DBus setup
- m_dbusConnection.registerObject(m_path, this);
-}
-
-DBusDataSet::~DBusDataSet() {
- QDBusConnection connection(QDBusConnection::sessionBus());
- connection.unregisterObject(m_path);
-}
-
-void DBusDataSet::getData(DataSet &dataSet, QVariantList &data) {
- QDataStream dataStream(dataSet.data());
- dataStream >> data;
-}
-
-QVariantList DBusDataSet::data() const {
- DataSet dataSet;
- DataSet::findById(m_id, &dataSet);
-
- QVariantList data;
- getData(dataSet, data);
-
- return data;
-}
-
-void DBusDataSet::internalUpdate(DataSet &dataSet, const QVariantList &oldData,
- const QVariantList &data) {
- QDate currentDate(m_dateFactory->currentDate());
- int daysSinceLastUpdate(dataSet.lastUpdated().daysTo(currentDate));
-
- QVariantList newData(data);
-
- // if we are in this situation we do nothing
- // new: |4|5|6|7|8|9|0|
- // old: |1|2|3|
- // res: |4|5|6|7|8|9|0|
- if (daysSinceLastUpdate + oldData.size() > newData.size()) {
- if (daysSinceLastUpdate < newData.size()) {
- // if we are in this situation - we need the
- // protruding data from old
- // new: |6|7|8|9|0|
- // old: |1|2|3|4|5|
- // res: |6|7|8|9|0|4|5|
- auto oldDataIt(oldData.constBegin());
- // wind forward until the data we want
- for (int i(daysSinceLastUpdate); i < newData.size(); ++i) {
- ++oldDataIt;
- }
- // append the rest of the data
- for (; oldDataIt != oldData.constEnd(); ++oldDataIt) {
- newData.append(*oldDataIt);
- }
- } else {
- // we are in this situation - there is a gap
- // and we want the whole of the old data appending
- // new: |6|7|8|9|0|
- // old: |1|2|3|4|5|
- // res: |6|7|8|9|0|n|1|2|3|4|5|
- const int daysToPad(daysSinceLastUpdate - newData.size());
- // pad the data will null variants
- for (int i(0); i < daysToPad; ++i) {
- newData.append(QVariant(""));
- }
- // append the whole of the old data
- newData.append(oldData);
- }
- }
-
- while (newData.size() > 62) {
- newData.pop_back();
- }
-
- QByteArray byteArray;
- {
- QDataStream dataStream(&byteArray, QIODevice::WriteOnly);
- dataStream << newData;
- }
-
- dataSet.setLastUpdated(currentDate);
- dataSet.setData(byteArray);
- if (!dataSet.save()) {
- throw logic_error(_("Could not save data set"));
- }
-
- QDateTime dateTime(currentDate);
- m_adaptor->updated(dateTime.toTime_t(), newData);
-}
-
-void DBusDataSet::update(const QVariantList &data) {
- DataSet dataSet;
- DataSet::findByIdRelated(m_id, &dataSet);
-
- QString dbusUsername(m_authentication->getUsername(*this));
- const QString &username(dataSet.userData()->username());
- if (!dbusUsername.isEmpty() && !username.isEmpty()
- && dbusUsername != username) {
- m_authentication->sendErrorReply(*this, QDBusError::AccessDenied,
- _("Attempt to update data owned by another user"));
- return;
- }
-
- QString confinementContext(m_authentication->getConfinementContext(*this));
- const QString &secret(dataSet.dataSource()->secret());
- if (secret != "unconfined" && secret != confinementContext) {
- m_authentication->sendErrorReply(*this, QDBusError::AccessDenied,
- _("Attempt to update data owned by another application"));
- return;
- }
-
- QVariantList oldData;
- getData(dataSet, oldData);
-
- internalUpdate(dataSet, oldData, data);
-}
-
-void DBusDataSet::increment(double amount) {
- DataSet dataSet;
- DataSet::findByIdRelated(m_id, &dataSet);
-
- QString dbusUsername(m_authentication->getUsername(*this));
- const QString &username(dataSet.userData()->username());
- if (!dbusUsername.isEmpty() && !username.isEmpty()
- && dbusUsername != username) {
- m_authentication->sendErrorReply(*this, QDBusError::AccessDenied,
- _("Attempt to increment data owned by another user"));
- return;
- }
-
- QString confinementContext(m_authentication->getConfinementContext(*this));
- const QString &secret(dataSet.dataSource()->secret());
- if (secret != "unconfined" && secret != confinementContext) {
- m_authentication->sendErrorReply(*this, QDBusError::AccessDenied,
- _("Attempt to increment data owned by another application"));
- return;
- }
-
- QVariantList oldData;
- getData(dataSet, oldData);
-
- QVariantList data;
-
- QDate currentDate(m_dateFactory->currentDate());
- if (dataSet.lastUpdated() == currentDate && !oldData.empty()) {
- double value(oldData.first().toDouble());
- value += amount;
- data << value;
- } else {
- data << amount;
- }
-
- internalUpdate(dataSet, oldData, data);
-}
-
-uint DBusDataSet::lastUpdated() const {
- const QDate &lastUpdated(lastUpdatedDate());
- QDateTime dateTime(lastUpdated);
- return dateTime.toTime_t();
-}
-
-QDate DBusDataSet::lastUpdatedDate() const {
- DataSet dataSet;
- DataSet::findById(m_id, &dataSet);
- return dataSet.lastUpdated();
-}
-
-int DBusDataSet::id() const {
- return m_id;
-}
-
-QString DBusDataSet::path() const {
- return m_path;
-}
-
-QDBusObjectPath DBusDataSet::dataSource() const {
- return QDBusObjectPath(m_dataSource);
-}
=== removed file 'src/usermetricsservice/DBusDataSet.h'
--- src/usermetricsservice/DBusDataSet.h 2013-10-22 08:53:23 +0000
+++ src/usermetricsservice/DBusDataSet.h 1970-01-01 00:00:00 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#ifndef USERMETRICSSERVICE_DBUSDATASET_H_
-#define USERMETRICSSERVICE_DBUSDATASET_H_
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-class DataSetAdaptor;
-
-namespace UserMetricsCommon {
-class DateFactory;
-}
-
-namespace UserMetricsService {
-
-class Authentication;
-class DataSet;
-class DBusDataSet;
-
-typedef QSharedPointer DBusDataSetPtr;
-
-class DBusDataSet: public QObject, protected QDBusContext {
-Q_OBJECT
-
-Q_PROPERTY(QVariantList data READ data)
-
-Q_PROPERTY(uint lastUpdated READ lastUpdated)
-
-Q_PROPERTY(QDBusObjectPath dataSource READ dataSource)
-
-public:
- DBusDataSet(int id, const QString &dataSource,
- QDBusConnection &dbusConnection,
- QSharedPointer dateFactory,
- QSharedPointer authentication, QObject *parent = 0);
-
- virtual ~DBusDataSet();
-
- QString path() const;
-
- QDBusObjectPath dataSource() const;
-
- int id() const;
-
- QVariantList data() const;
-
- uint lastUpdated() const;
-
- QDate lastUpdatedDate() const;
-
-public Q_SLOTS:
- void update(const QVariantList &data);
-
- void increment(double amount);
-
-protected:
- static void getData(DataSet &dataSet, QVariantList &data);
-
- void internalUpdate(DataSet &dataSet, const QVariantList &oldData,
- const QVariantList &data);
-
- QDBusConnection m_dbusConnection;
-
- QScopedPointer m_adaptor;
-
- QSharedPointer m_dateFactory;
-
- QSharedPointer m_authentication;
-
- int m_id;
-
- QString m_path;
-
- QString m_dataSource;
-};
-
-}
-
-#endif // USERMETRICSSERVICE_DBUSDATASET_H_
=== removed file 'src/usermetricsservice/DBusDataSource.cpp'
--- src/usermetricsservice/DBusDataSource.cpp 2013-09-25 09:42:13 +0000
+++ src/usermetricsservice/DBusDataSource.cpp 1970-01-01 00:00:00 +0000
@@ -1,244 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-using namespace std;
-using namespace UserMetricsCommon;
-using namespace UserMetricsService;
-
-DBusDataSource::DBusDataSource(int id, const QString &name,
- QDBusConnection &dbusConnection, QObject *parent) :
- QObject(parent), m_dbusConnection(dbusConnection), m_adaptor(
- new DataSourceAdaptor(this)), m_id(id), m_path(
- DBusPaths::dataSource(m_id)), m_name(name) {
-
- // DBus setup
- m_dbusConnection.registerObject(m_path, this);
-}
-
-DBusDataSource::~DBusDataSource() {
- QDBusConnection connection(QDBusConnection::sessionBus());
- connection.unregisterObject(m_path);
-}
-
-QString DBusDataSource::path() const {
- return m_path;
-}
-
-QString DBusDataSource::name() const {
- return m_name;
-}
-
-QString DBusDataSource::formatString() const {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- return dataSource.formatString();
-}
-
-void DBusDataSource::setFormatString(const QString &formatString) {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- if (formatString != dataSource.formatString()) {
- dataSource.setFormatString(formatString);
- if (!dataSource.save()) {
- throw logic_error(_("Could not save data source"));
- }
- m_adaptor->formatStringChanged(formatString);
- }
-}
-
-QString DBusDataSource::emptyDataString() const {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- return dataSource.emptyDataString();
-}
-
-void DBusDataSource::setEmptyDataString(const QString &emptyDataString) {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- if (emptyDataString != dataSource.emptyDataString()) {
- dataSource.setEmptyDataString(emptyDataString);
- if (!dataSource.save()) {
- throw logic_error(_("Could not save data source"));
- }
- m_adaptor->emptyDataStringChanged(emptyDataString);
- }
-}
-
-QString DBusDataSource::textDomain() const {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- return dataSource.textDomain();
-}
-
-void DBusDataSource::setTextDomain(const QString &textDomain) {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- if (textDomain != dataSource.textDomain()) {
- dataSource.setTextDomain(textDomain);
- if (!dataSource.save()) {
- throw logic_error(_("Could not save data source"));
- }
- m_adaptor->textDomainChanged(textDomain);
- }
-}
-
-void DBusDataSource::setSecret(const QString &secret) {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- if (secret != dataSource.secret()) {
- dataSource.setSecret(secret);
- if (!dataSource.save()) {
- throw logic_error(_("Could not save data source"));
- }
- }
-}
-
-unsigned int DBusDataSource::metricType() const {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- return dataSource.type();
-}
-
-void DBusDataSource::setMetricType(unsigned int type) {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- unsigned int t(dataSource.type());
- if (type != t) {
- dataSource.setType(type);
- if (!dataSource.save()) {
- throw logic_error(_("Could not save data source"));
- }
- m_adaptor->metricTypeChanged(type);
- }
-}
-
-QVariantMap DBusDataSource::generateOptions(
- const DataSource &dataSource) const {
- QVariantMap options;
- if (dataSource.hasMinimum()) {
- options["minimum"] = dataSource.minimum();
- }
- if (dataSource.hasMaximum()) {
- options["maximum"] = dataSource.maximum();
- }
- return options;
-}
-
-bool DBusDataSource::hasMinimum() const {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- return dataSource.hasMinimum();
-}
-
-void DBusDataSource::setMinimum(double minimum) {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- bool changed(false);
- if (!dataSource.hasMinimum()) {
- dataSource.setHasMinimum(true);
- changed = true;
- }
- if (dataSource.minimum() != minimum) {
- dataSource.setMinimum(minimum);
- changed = true;
- }
- if (changed) {
- if (!dataSource.save()) {
- throw logic_error(_("Could not save data source"));
- }
- m_adaptor->optionsChanged(generateOptions(dataSource));
- }
-}
-
-double DBusDataSource::minimum() const {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- return dataSource.minimum();
-}
-
-void DBusDataSource::noMinimum() {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- if (dataSource.hasMinimum()) {
- dataSource.setHasMinimum(false);
- if (!dataSource.save()) {
- throw logic_error(_("Could not save data source"));
- }
- m_adaptor->optionsChanged(generateOptions(dataSource));
- }
-}
-
-bool DBusDataSource::hasMaximum() const {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- return dataSource.hasMaximum();
-}
-
-void DBusDataSource::setMaximum(double maximum) {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- bool changed(false);
- if (!dataSource.hasMaximum()) {
- dataSource.setHasMaximum(true);
- changed = true;
- }
- if (dataSource.maximum() != maximum) {
- dataSource.setMaximum(maximum);
- changed = true;
- }
- if (changed) {
- if (!dataSource.save()) {
- throw logic_error(_("Could not save data source"));
- }
- m_adaptor->optionsChanged(generateOptions(dataSource));
- }
-}
-
-double DBusDataSource::maximum() const {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- return dataSource.maximum();
-}
-
-void DBusDataSource::noMaximum() {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- if (dataSource.hasMaximum()) {
- dataSource.setHasMaximum(false);
- if (!dataSource.save()) {
- throw logic_error(_("Could not save data source"));
- }
- m_adaptor->optionsChanged(generateOptions(dataSource));
- }
-}
-
-QVariantMap DBusDataSource::options() const {
- DataSource dataSource;
- DataSource::findById(m_id, &dataSource);
- return generateOptions(dataSource);
-}
=== removed file 'src/usermetricsservice/DBusDataSource.h'
--- src/usermetricsservice/DBusDataSource.h 2013-09-25 09:42:13 +0000
+++ src/usermetricsservice/DBusDataSource.h 1970-01-01 00:00:00 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#ifndef USERMETRICSSERVICE_DBUSDATASOURCE_H_
-#define USERMETRICSSERVICE_DBUSDATASOURCE_H_
-
-#include
-#include
-#include
-#include
-
-class DataSourceAdaptor;
-
-namespace UserMetricsService {
-
-class DataSource;
-class DBusDataSource;
-
-typedef QSharedPointer DBusDataSourcePtr;
-
-class DBusDataSource: public QObject, protected QDBusContext {
-Q_OBJECT
-
-Q_PROPERTY(QString name READ name)
-
-Q_PROPERTY(QString formatString READ formatString WRITE setFormatString)
-
-Q_PROPERTY(QString emptyDataString READ emptyDataString WRITE setEmptyDataString)
-
-Q_PROPERTY(QString textDomain READ textDomain WRITE setTextDomain)
-
-Q_PROPERTY(unsigned int metricType READ metricType WRITE setMetricType)
-
-Q_PROPERTY(QVariantMap options READ options)
-
-public:
- DBusDataSource(int id, const QString &name, QDBusConnection &dbusConnection,
- QObject *parent = 0);
-
- virtual ~DBusDataSource();
-
- QString path() const;
-
- QString name() const;
-
- QString formatString() const;
-
- void setFormatString(const QString &formatString);
-
- QString emptyDataString() const;
-
- void setEmptyDataString(const QString &emptyDataString);
-
- QString textDomain() const;
-
- void setTextDomain(const QString &textDomain);
-
- void setSecret(const QString &secret);
-
- unsigned int metricType() const;
-
- void setMetricType(unsigned int type);
-
- bool hasMinimum() const;
-
- void noMinimum();
-
- double minimum() const;
-
- void setMinimum(double minimum);
-
- bool hasMaximum() const;
-
- void noMaximum();
-
- double maximum() const;
-
- void setMaximum(double maximum);
-
- QVariantMap options() const;
-
-protected:
- void lookupDataSource(DataSource *dataSource) const;
-
- QVariantMap generateOptions(const DataSource &dataSource) const;
-
- QDBusConnection m_dbusConnection;
-
- QScopedPointer m_adaptor;
-
- int m_id;
-
- QString m_path;
-
- QString m_name;
-};
-
-}
-
-#endif // USERMETRICSSERVICE_DBUSDATASOURCE_H_
=== removed file 'src/usermetricsservice/DBusUserData.h'
--- src/usermetricsservice/DBusUserData.h 2013-09-24 11:26:56 +0000
+++ src/usermetricsservice/DBusUserData.h 1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#ifndef USERMETRICSSERVICE_DBUSUSERDATA_H_
-#define USERMETRICSSERVICE_DBUSUSERDATA_H_
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-class UserDataAdaptor;
-
-namespace UserMetricsCommon {
-class DateFactory;
-}
-
-namespace UserMetricsService {
-
-class Authentication;
-class UserData;
-class DBusDataSet;
-class DBusUserData;
-class DBusUserMetrics;
-
-typedef QSharedPointer DBusUserDataPtr;
-
-class DBusUserData: public QObject, protected QDBusContext {
-Q_OBJECT
-
-Q_PROPERTY(QString username READ username)
-
-Q_PROPERTY(QList dataSets READ dataSets)
-
-public:
- DBusUserData(int id, const QString &username, DBusUserMetrics &userMetrics,
- QDBusConnection &dbusConnection,
- QSharedPointer dateFactory,
- QSharedPointer authentication, QObject *parent = 0);
-
- virtual ~DBusUserData();
-
- QString path() const;
-
- QString username() const;
-
- QList dataSets() const;
-
- QDBusObjectPath createDataSet(const QString &dataSource);
-
- QSharedPointer dataSet(const QString &dataSource) const;
-
-protected:
- void syncDatabase();
-
- QDBusConnection m_dbusConnection;
-
- QScopedPointer m_adaptor;
-
- QSharedPointer m_dateFactory;
-
- QSharedPointer m_authentication;
-
- DBusUserMetrics &m_userMetrics;
-
- int m_id;
-
- QString m_path;
-
- QString m_username;
-
- QHash> m_dataSets;
-};
-
-}
-
-#endif // USERMETRICSSERVICE_DBUSUSERDATA_H_
=== removed file 'src/usermetricsservice/DBusUserMetrics.cpp'
--- src/usermetricsservice/DBusUserMetrics.cpp 2013-10-22 08:53:23 +0000
+++ src/usermetricsservice/DBusUserMetrics.cpp 1970-01-01 00:00:00 +0000
@@ -1,291 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical, Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- * Author: Pete Woods
- */
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include