~ubuntu-branches/ubuntu/trusty/libusermetrics/trusty-proposed

« back to all changes in this revision

Viewing changes to src/libusermetricsoutput/DataSet.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Pete Woods, Ubuntu daily release
  • Date: 2013-07-02 02:02:52 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130702020252-53yuhnlabsq1cq8x
Tags: 1.0.1+13.10.20130702-0ubuntu1
[ Pete Woods ]
* Implement most of storage service and wire up input API.
* Wire up the output API to the storage service.

[ Ubuntu daily release ]
* Automatic snapshot from revision 80

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
DataSet::~DataSet() {
28
28
}
29
29
 
30
 
const QString & DataSet::formatString() const {
31
 
        return m_formatString;
32
 
}
33
 
 
34
30
const QVariantList & DataSet::data() const {
35
31
        return m_data;
36
32
}
39
35
        return m_lastUpdated;
40
36
}
41
37
 
42
 
void DataSet::setFormatString(const QString &formatString) {
43
 
        if (formatString != m_formatString) {
44
 
                m_formatString = formatString;
45
 
                formatStringChanged(m_formatString);
46
 
        }
47
 
}
48
 
 
49
 
void DataSet::setData(const QDate &lastUpdated, const QVariantList &data) {
50
 
        m_lastUpdated = lastUpdated;
 
38
void DataSet::setData(const QVariantList &data) {
51
39
        m_data = data;
52
 
        lastUpdatedChanged(m_lastUpdated);
 
40
        for (QVariant &variant : m_data) {
 
41
                if (variant.type() == QVariant::String) {
 
42
                        variant = QVariant();
 
43
                }
 
44
        }
53
45
        dataChanged(&m_data);
54
46
}
 
47
 
 
48
void DataSet::setLastUpdated(const QDate &lastUpdated) {
 
49
        if (m_lastUpdated != lastUpdated) {
 
50
                m_lastUpdated = lastUpdated;
 
51
                lastUpdatedChanged(m_lastUpdated);
 
52
        }
 
53
}
 
54
 
 
55
void DataSet::update(const uint lastUpdated, const QVariantList &data) {
 
56
        setLastUpdated(QDateTime::fromTime_t(lastUpdated).date());
 
57
        setData(data);
 
58
}