aboutsettings.h 4.09 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
/*
 * Copyright (C) 2013 Jolla Ltd. <pekka.vuorela@jollamobile.com>
 *
 * You may use this file under the terms of the BSD license as follows:
 *
 * "Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *   * Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   * Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in
 *     the documentation and/or other materials provided with the
 *     distribution.
 *   * Neither the name of Nemo Mobile nor the names of its contributors
 *     may be used to endorse or promote products derived from this
 *     software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
 */

#ifndef ABOUTSETTINGS_H
#define ABOUTSETTINGS_H

35
#include <QObject>
36
#include <QVariant>
37

38 39 40
#include <systemsettingsglobal.h>
#include <partitionmanager.h>

41 42
class QNetworkInfo;
class QDeviceInfo;
43
class SYSTEMSETTINGS_EXPORT AboutSettings: public QObject
44 45 46 47 48
{
    Q_OBJECT

    Q_PROPERTY(QString wlanMacAddress READ wlanMacAddress CONSTANT)
    Q_PROPERTY(QString imei READ imei CONSTANT)
49
    Q_PROPERTY(QString serial READ serial CONSTANT)
50
    Q_PROPERTY(QString operatingSystemName READ operatingSystemName CONSTANT)
51
    Q_PROPERTY(QString softwareVersion READ softwareVersion CONSTANT)
52
    Q_PROPERTY(QString softwareVersionId READ softwareVersionId CONSTANT)
53
    Q_PROPERTY(QString adaptationVersion READ adaptationVersion CONSTANT)
54 55
    Q_PROPERTY(QString vendorName READ vendorName CONSTANT)
    Q_PROPERTY(QString vendorVersion READ vendorVersion CONSTANT)
56

57 58 59
    Q_PROPERTY(QVariant internalStorageUsageModel READ diskUsageModel NOTIFY storageChanged)
    Q_PROPERTY(QVariant externalStorageUsageModel READ externalStorageUsageModel NOTIFY storageChanged)

60 61 62 63
public:
    explicit AboutSettings(QObject *parent = 0);
    virtual ~AboutSettings();

64
    // Deprecated -- use diskUsageModel() instead
65
    Q_INVOKABLE qlonglong totalDiskSpace() const;
66
    // Deprecated -- use diskUsageModel() instead
67 68
    Q_INVOKABLE qlonglong availableDiskSpace() const;

69 70 71 72 73 74 75 76
    /**
     * Returns a list of JS objects with the following keys:
     *  - storageType: one of "mass" (mass storage), "system" (system storage) or "user" (user storage)
     *  - path: filesystem path (e.g. "/" or "/home/")
     *  - available: available bytes on the storage
     *  - total: total bytes on the storage
     **/
    Q_INVOKABLE QVariant diskUsageModel() const;
77 78
    QVariant externalStorageUsageModel() const;
    Q_INVOKABLE void refreshStorageModels();
79

80 81
    QString wlanMacAddress() const;
    QString imei() const;
82
    QString serial() const;
83
    QString operatingSystemName() const;
84
    QString softwareVersion() const;
85
    QString softwareVersionId() const;
86
    QString adaptationVersion() const;
87

88 89 90
    QString vendorName() const;
    QString vendorVersion() const;

91 92 93
signals:
    void storageChanged();

94
private:
95 96
    QNetworkInfo *m_netinfo;
    QDeviceInfo *m_devinfo;
97 98 99

    QVariantList m_internalStorage;
    QVariantList m_externalStorage;
100 101
    PartitionManager m_partitionManager;

102 103
    mutable QMap<QString, QString> m_osRelease;
    mutable QMap<QString, QString> m_hardwareRelease;
104 105 106

    QString m_vendorName;
    QString m_vendorVersion;
107 108 109
};

#endif