source: calamares/trunk/fuentes/src/modules/netinstall/NetInstallPage.h @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 2.7 KB
Line 
1/*
2 *   Copyright 2016, Luca Giambonini <almack@chakraos.org>
3 *   Copyright 2016, Lisa Vitolo     <shainer@chakraos.org>
4 *   Copyright 2017, Kyle Robbertze  <krobbertze@gmail.com>
5 *   Copyright 2017, Adriaan de Groot <groot@kde.org>
6 *
7 *   Calamares is free software: you can redistribute it and/or modify
8 *   it under the terms of the GNU General Public License as published by
9 *   the Free Software Foundation, either version 3 of the License, or
10 *   (at your option) any later version.
11 *
12 *   Calamares is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef NETINSTALLPAGE_H
22#define NETINSTALLPAGE_H
23
24#include "PackageModel.h"
25#include "PackageTreeItem.h"
26#include "Typedefs.h"
27
28#include <QAbstractButton>
29#include <QNetworkAccessManager>
30#include <QWidget>
31
32// required forward declarations
33class QByteArray;
34class QNetworkReply;
35class QString;
36
37namespace Ui
38{
39class Page_NetInst;
40}
41
42class NetInstallPage : public QWidget
43{
44    Q_OBJECT
45public:
46    NetInstallPage( QWidget* parent = nullptr );
47
48    void onActivate();
49
50    /** @brief Retrieves the groups, with name, description and packages
51     *
52     * Loads data from the given URL. This should be called before
53     * displaying the page.
54     */
55    void loadGroupList( const QString& url );
56
57    // Sets the "required" state of netinstall data. Influences whether
58    // corrupt or unavailable data causes checkReady() to be emitted
59    // true (not-required) or false.
60    void setRequired( bool );
61    bool getRequired() const
62    {
63        return m_required;
64    }
65
66    // Returns the list of packages belonging to groups that are
67    // selected in the view in this given moment. No data is cached here, so
68    // this function does not have constant time.
69    PackageModel::PackageItemDataList selectedPackages() const;
70
71public slots:
72    void dataIsHere( QNetworkReply* );
73
74signals:
75    void checkReady( bool );
76
77private:
78    // Takes the YAML data representing the groups and reads them into the
79    // m_groups and m_groupOrder internal structures. See the README.md
80    // of this module to know the format expected of the YAML files.
81    bool readGroups( const QByteArray& yamlData );
82
83    Ui::Page_NetInst* ui;
84
85    // Handles connection with the remote URL storing the configuration.
86    QNetworkAccessManager m_networkManager;
87
88    PackageModel* m_groups;
89    bool m_required;
90};
91
92#endif // NETINSTALLPAGE_H
Note: See TracBrowser for help on using the repository browser.