2014-08-21 17:50:37 +02:00
|
|
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
|
|
|
*
|
2015-01-29 20:24:09 +01:00
|
|
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
2014-08-21 17:50:37 +02:00
|
|
|
*
|
|
|
|
* Calamares is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Calamares 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-05-14 18:00:26 +02:00
|
|
|
#ifndef REQUIREMENTSCHECKER_H
|
|
|
|
#define REQUIREMENTSCHECKER_H
|
2014-11-13 16:51:23 +01:00
|
|
|
|
2014-08-21 17:50:37 +02:00
|
|
|
#include <QObject>
|
2014-08-26 17:26:40 +02:00
|
|
|
#include <QStringList>
|
2014-08-21 17:50:37 +02:00
|
|
|
|
2014-11-13 16:51:23 +01:00
|
|
|
#include <functional>
|
2014-08-21 17:50:37 +02:00
|
|
|
|
2015-05-14 18:00:26 +02:00
|
|
|
class CheckerWidget;
|
|
|
|
class QWidget;
|
2014-08-21 17:50:37 +02:00
|
|
|
|
2014-08-26 17:26:40 +02:00
|
|
|
struct PrepareEntry
|
|
|
|
{
|
|
|
|
QString name;
|
2014-11-13 16:51:23 +01:00
|
|
|
std::function< QString() > text;
|
2014-08-26 17:26:40 +02:00
|
|
|
bool checked;
|
|
|
|
bool required;
|
|
|
|
};
|
|
|
|
|
2015-05-14 18:00:26 +02:00
|
|
|
class RequirementsChecker : public QObject
|
2014-08-21 17:50:37 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-05-14 18:00:26 +02:00
|
|
|
explicit RequirementsChecker( QObject* parent = nullptr );
|
|
|
|
virtual ~RequirementsChecker();
|
2014-08-21 17:50:37 +02:00
|
|
|
|
2015-05-14 18:00:26 +02:00
|
|
|
QWidget* widget() const;
|
2014-08-21 17:50:37 +02:00
|
|
|
|
2015-05-14 18:00:26 +02:00
|
|
|
void setConfigurationMap( const QVariantMap& configurationMap );
|
2014-08-21 17:50:37 +02:00
|
|
|
|
2015-05-14 18:00:26 +02:00
|
|
|
bool verdict() const;
|
2014-08-21 17:50:37 +02:00
|
|
|
|
2015-05-14 18:00:26 +02:00
|
|
|
signals:
|
|
|
|
void verdictChanged( bool );
|
2014-08-21 17:50:37 +02:00
|
|
|
|
|
|
|
private:
|
2014-08-26 17:26:40 +02:00
|
|
|
QStringList m_entriesToCheck;
|
|
|
|
QStringList m_entriesToRequire;
|
|
|
|
|
2014-08-22 15:16:45 +02:00
|
|
|
bool checkEnoughStorage( qint64 requiredSpace );
|
|
|
|
bool checkEnoughRam( qint64 requiredRam );
|
2014-08-25 15:02:09 +02:00
|
|
|
bool checkBatteryExists();
|
2014-08-21 17:50:37 +02:00
|
|
|
bool checkHasPower();
|
|
|
|
bool checkHasInternet();
|
2014-11-19 13:58:18 +01:00
|
|
|
void detectFirmwareType();
|
2014-08-21 17:50:37 +02:00
|
|
|
|
|
|
|
QWidget* m_widget;
|
2014-08-22 15:16:45 +02:00
|
|
|
qreal m_requiredStorageGB;
|
|
|
|
qreal m_requiredRamGB;
|
2014-08-21 17:50:37 +02:00
|
|
|
|
2015-05-14 18:00:26 +02:00
|
|
|
CheckerWidget* m_actualWidget;
|
|
|
|
bool m_verdict;
|
2014-08-21 17:50:37 +02:00
|
|
|
};
|
|
|
|
|
2015-05-14 18:00:26 +02:00
|
|
|
#endif // REQUIREMENTSCHECKER_H
|