File indexing completed on 2024-04-21 05:47:46

0001 /*******************************************************************************
0002  * Copyright (C) 2016 Ragnar Thomsen <rthomsen6@gmail.com>                     *
0003  *                                                                             *
0004  * This program is free software: you can redistribute it and/or modify it     *
0005  * under the terms of the GNU General Public License as published by the Free  *
0006  * Software Foundation, either version 2 of the License, or (at your option)   *
0007  * any later version.                                                          *
0008  *                                                                             *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT *
0010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
0011  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    *
0012  * more details.                                                               *
0013  *                                                                             *
0014  * You should have received a copy of the GNU General Public License along     *
0015  * with this program. If not, see <http://www.gnu.org/licenses/>.              *
0016  *******************************************************************************/
0017 
0018 #ifndef UNITMODEL_H
0019 #define UNITMODEL_H
0020 
0021 #include "systemdunit.h"
0022 
0023 #include <QAbstractTableModel>
0024 
0025 class UnitModel : public QAbstractTableModel
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     explicit UnitModel(QObject *parent = 0);
0031     explicit UnitModel(QObject *parent = 0, const QVector<SystemdUnit> *list = NULL, QString userBusPath = QString());
0032     int rowCount(const QModelIndex & parent = QModelIndex()) const;
0033     int columnCount(const QModelIndex & parent = QModelIndex()) const;
0034     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
0035     QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
0036 
0037 private:
0038     QStringList getLastJrnlEntries(QString unit) const;
0039     const QVector<SystemdUnit> *m_unitList;
0040     QString m_userBus;
0041 };
0042 
0043 #endif // UNITMODEL_H
0044