nymea-app/libnymea-app/types/package.h

92 lines
3.0 KiB
C++

// SPDX-License-Identifier: LGPL-3.0-or-later
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright (C) 2013 - 2024, nymea GmbH
* Copyright (C) 2024 - 2025, chargebyte austria GmbH
*
* This file is part of libnymea-app.
*
* libnymea-app is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* libnymea-app is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libnymea-app. If not, see <https://www.gnu.org/licenses/>.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef PACKAGE_H
#define PACKAGE_H
#include <QObject>
class Package : public QObject
{
Q_OBJECT
Q_PROPERTY(QString id READ id CONSTANT)
Q_PROPERTY(QString displayName READ displayName CONSTANT)
Q_PROPERTY(QString summary READ summary NOTIFY summaryChanged)
Q_PROPERTY(QString installedVersion READ installedVersion NOTIFY installedVersionChanged)
Q_PROPERTY(QString candidateVersion READ candidateVersion NOTIFY candidateVersionChanged)
Q_PROPERTY(QString changelog READ changelog NOTIFY changelogChanged)
Q_PROPERTY(bool updateAvailable READ updateAvailable NOTIFY updateAvailableChanged)
Q_PROPERTY(bool rollbackAvailable READ rollbackAvailable NOTIFY rollbackAvailableChanged)
Q_PROPERTY(bool canRemove READ canRemove NOTIFY canRemoveChanged)
public:
explicit Package(const QString &id, const QString &displayName, QObject *parent = nullptr);
QString id() const;
QString displayName() const;
QString summary() const;
void setSummary(const QString &summary);
QString installedVersion() const;
void setInstalledVersion(const QString &installedVersion);
QString candidateVersion() const;
void setCandidateVersion(const QString &candidateVersion);
QString changelog() const;
void setChangelog(const QString &changelog);
bool updateAvailable() const;
void setUpdateAvailable(bool updateAvailable);
bool rollbackAvailable() const;
void setRollbackAvailable(bool rollbackAvailable);
bool canRemove() const;
void setCanRemove(bool canRemove);
signals:
void summaryChanged();
void installedVersionChanged();
void candidateVersionChanged();
void changelogChanged();
void updateAvailableChanged();
void rollbackAvailableChanged();
void canRemoveChanged();
private:
QString m_id;
QString m_displayName;
QString m_summary;
QString m_installedVersion;
QString m_candidateVersion;
QString m_changelog;
bool m_updateAvailable = false;
bool m_rollbackAvailable = false;
bool m_canRemove = false;
};
#endif // PACKAGE_H