2016-06-26 00:26:08 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2016, Luca Giambonini <almack@chakraos.org>
|
2016-06-28 00:00:47 +02:00
|
|
|
* Copyright 2016, Lisa Vitolo <shainer@chakraos.org>
|
2017-01-25 09:34:18 +01:00
|
|
|
* Copyright 2017, Kyle Robbertze <krobbertze@gmail.com>
|
2017-09-06 11:47:11 +02:00
|
|
|
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
2016-06-28 00:00:47 +02:00
|
|
|
*
|
2016-06-26 00:26:08 +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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NETINSTALLPAGE_H
|
|
|
|
#define NETINSTALLPAGE_H
|
|
|
|
|
2017-01-23 13:42:40 +01:00
|
|
|
#include "PackageModel.h"
|
2017-01-25 09:34:18 +01:00
|
|
|
#include "PackageTreeItem.h"
|
2016-06-26 00:26:08 +02:00
|
|
|
#include "Typedefs.h"
|
2017-01-25 09:34:18 +01:00
|
|
|
|
2016-06-26 00:26:08 +02:00
|
|
|
#include <QWidget>
|
|
|
|
#include <QAbstractButton>
|
2016-07-15 14:27:10 +02:00
|
|
|
#include <QNetworkAccessManager>
|
2016-06-26 00:26:08 +02:00
|
|
|
|
|
|
|
// required forward declarations
|
|
|
|
class QByteArray;
|
2016-07-15 14:27:10 +02:00
|
|
|
class QNetworkReply;
|
2016-06-26 00:26:08 +02:00
|
|
|
|
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class Page_NetInst;
|
|
|
|
}
|
|
|
|
|
|
|
|
class NetInstallPage : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2016-06-28 00:03:15 +02:00
|
|
|
NetInstallPage( QWidget* parent = nullptr );
|
2016-07-15 14:27:10 +02:00
|
|
|
|
2016-06-26 00:26:08 +02:00
|
|
|
void onActivate();
|
|
|
|
|
|
|
|
// Retrieves the groups, with name, description and packages, from
|
|
|
|
// the remote URL configured in the settings. Assumes the URL is already
|
|
|
|
// in the global storage. This should be called before displaying the page.
|
|
|
|
void loadGroupList();
|
|
|
|
|
2017-11-06 11:14:42 +01:00
|
|
|
// Sets the "required" state of netinstall data. Influences whether
|
|
|
|
// corrupt or unavailable data causes checkReady() to be emitted
|
|
|
|
// true (not-required) or false.
|
|
|
|
void setRequired( bool );
|
|
|
|
bool getRequired() const { return m_required; }
|
|
|
|
|
2017-01-23 13:42:40 +01:00
|
|
|
// Returns the list of packages belonging to groups that are
|
|
|
|
// selected in the view in this given moment. No data is cached here, so
|
|
|
|
// this function does not have constant time.
|
2017-01-25 09:34:18 +01:00
|
|
|
QList<PackageTreeItem::ItemData> selectedPackages() const;
|
2016-06-26 00:26:08 +02:00
|
|
|
|
|
|
|
public slots:
|
2016-07-15 14:27:10 +02:00
|
|
|
void dataIsHere( QNetworkReply* );
|
2016-06-26 00:26:08 +02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void checkReady( bool );
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Takes the YAML data representing the groups and reads them into the
|
|
|
|
// m_groups and m_groupOrder internal structures. See the README.md
|
|
|
|
// of this module to know the format expected of the YAML files.
|
2017-09-06 11:47:11 +02:00
|
|
|
bool readGroups( const QByteArray& yamlData );
|
2016-06-26 00:26:08 +02:00
|
|
|
|
|
|
|
Ui::Page_NetInst* ui;
|
|
|
|
|
2016-07-15 14:27:10 +02:00
|
|
|
// Handles connection with the remote URL storing the configuration.
|
|
|
|
QNetworkAccessManager m_networkManager;
|
|
|
|
|
2017-01-23 13:42:40 +01:00
|
|
|
PackageModel* m_groups;
|
2017-11-06 11:14:42 +01:00
|
|
|
bool m_required;
|
2016-06-26 00:26:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NETINSTALLPAGE_H
|