File indexing completed on 2024-05-12 05:38:47

0001 /*
0002  *  SPDX-FileCopyrightText: 2023 Jakob Petsovits <jpetso@petsovits.com>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #pragma once
0008 
0009 #include <powerdevilenums.h>
0010 
0011 #include <QAbstractListModel>
0012 #include <QList>
0013 #include <QString>
0014 
0015 #include "powerdevilconfigcommonprivate_export.h"
0016 
0017 namespace PowerDevil
0018 {
0019 class PowerManagement;
0020 }
0021 
0022 class POWERDEVILCONFIGCOMMONPRIVATE_EXPORT SleepModeModel : public QAbstractListModel
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     enum { Name = Qt::DisplayRole, Subtitle = Qt::StatusTipRole, Value = Qt::UserRole };
0028 
0029     SleepModeModel(QObject *parent, PowerDevil::PowerManagement *pm);
0030 
0031     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
0032     int rowCount(const QModelIndex &parent) const override;
0033     QHash<int, QByteArray> roleNames() const override;
0034 
0035 private:
0036     struct Data {
0037         QString name;
0038         QString subtitle;
0039         uint value;
0040     };
0041 
0042     QVector<Data> m_data;
0043 };