shift-shell/kcms/powermanagement/batterymodel.h
Devin Lin e147f98aea kcms: Move KCMs from plasma-settings
Having the KCMs that are mobile specific here makes more sense than in the settings application. Historically plasma-settings had a faster release cycle than Plasma, but the application is now moving to the Plasma release schedule and so it makes sense do this now.
2023-03-13 18:45:47 -07:00

42 lines
885 B
C++

/*
* SPDX-FileCopyrightText: 2015 Kai Uwe Broulik <kde@privat.broulik.de>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QAbstractListModel>
#include <QList>
#include <Solid/Battery>
#include <Solid/Device>
class BatteryModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
public:
explicit BatteryModel(QObject *parent);
~BatteryModel() override = default;
enum Roles {
BatteryRole = Qt::UserRole,
UdiRole,
VendorRole,
ProductRole,
};
Q_ENUM(Roles)
QVariant data(const QModelIndex &index, int role) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QHash<int, QByteArray> roleNames() const override;
signals:
void countChanged();
private:
QList<Solid::Device> m_batteries;
};