2016-06-28 00:00:47 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2016, Luca Giambonini <almack@chakraos.org>
|
|
|
|
* Copyright 2016, Lisa Vitolo <shainer@chakraos.org>
|
2017-01-25 09:34:18 +01:00
|
|
|
* Copyright 2017, Kyle Robbertze <krobbertze@gmail.com>
|
2020-02-18 17:40:15 +01:00
|
|
|
* Copyright 2017-2018, 2020, Adriaan de Groot <groot@kde.org>
|
2017-10-28 02:18:36 +02:00
|
|
|
* Copyright 2017, Gabriel Craciunescu <crazy@frugalware.org>
|
2016-06-28 00:00:47 +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/>.
|
|
|
|
*/
|
|
|
|
|
2016-06-26 00:26:08 +02:00
|
|
|
#include "NetInstallPage.h"
|
|
|
|
|
2017-01-23 13:42:40 +01:00
|
|
|
#include "PackageModel.h"
|
2016-06-26 00:26:08 +02:00
|
|
|
#include "ui_page_netinst.h"
|
2019-09-02 14:10:36 +02:00
|
|
|
|
2016-06-26 00:26:08 +02:00
|
|
|
#include "JobQueue.h"
|
2018-05-21 16:58:57 +02:00
|
|
|
|
2019-09-02 14:10:36 +02:00
|
|
|
#include "network/Manager.h"
|
2016-06-26 00:26:08 +02:00
|
|
|
#include "utils/Logger.h"
|
2017-01-25 09:34:18 +01:00
|
|
|
#include "utils/Retranslator.h"
|
2019-04-29 12:04:55 +02:00
|
|
|
#include "utils/Yaml.h"
|
2016-06-26 00:26:08 +02:00
|
|
|
|
2017-01-23 13:42:40 +01:00
|
|
|
#include <QHeaderView>
|
2019-09-02 14:10:36 +02:00
|
|
|
#include <QNetworkReply>
|
2016-06-26 00:26:08 +02:00
|
|
|
|
2020-03-27 16:12:48 +01:00
|
|
|
NetInstallPage::NetInstallPage( Config* c, QWidget* parent )
|
2016-06-26 00:26:08 +02:00
|
|
|
: QWidget( parent )
|
2020-03-27 16:12:48 +01:00
|
|
|
, m_config( c )
|
2016-06-26 00:26:08 +02:00
|
|
|
, ui( new Ui::Page_NetInst )
|
|
|
|
{
|
|
|
|
ui->setupUi( this );
|
2020-03-27 16:12:48 +01:00
|
|
|
ui->groupswidget->setModel( c->model() );
|
|
|
|
connect( c, &Config::statusChanged, this, &NetInstallPage::setStatus );
|
|
|
|
connect( c, &Config::statusReady, this, &NetInstallPage::expandGroups );
|
|
|
|
|
2020-02-19 09:29:23 +01:00
|
|
|
setPageTitle( nullptr );
|
2020-02-18 23:17:18 +01:00
|
|
|
CALAMARES_RETRANSLATE_SLOT( &NetInstallPage::retranslate );
|
2016-06-26 00:26:08 +02:00
|
|
|
}
|
|
|
|
|
2020-03-27 15:51:03 +01:00
|
|
|
NetInstallPage::~NetInstallPage() {}
|
2020-02-18 17:37:16 +01:00
|
|
|
|
2020-02-19 09:29:23 +01:00
|
|
|
void
|
|
|
|
NetInstallPage::setPageTitle( CalamaresUtils::Locale::TranslatedString* t )
|
|
|
|
{
|
|
|
|
m_title.reset( t );
|
|
|
|
if ( !m_title )
|
|
|
|
{
|
|
|
|
ui->label->hide();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->label->show();
|
|
|
|
}
|
|
|
|
retranslate();
|
|
|
|
}
|
|
|
|
|
2020-02-18 23:17:18 +01:00
|
|
|
void
|
|
|
|
NetInstallPage::retranslate()
|
|
|
|
{
|
2020-03-27 16:12:48 +01:00
|
|
|
if ( m_title )
|
2020-02-19 09:29:23 +01:00
|
|
|
{
|
|
|
|
ui->label->setText( m_title->get() ); // That's get() on the TranslatedString
|
|
|
|
}
|
2020-03-27 16:12:48 +01:00
|
|
|
ui->netinst_status->setText( m_config->status() );
|
2020-02-18 23:17:18 +01:00
|
|
|
}
|
|
|
|
|
2020-03-23 23:08:31 +01:00
|
|
|
void
|
2020-03-27 16:12:48 +01:00
|
|
|
NetInstallPage::expandGroups()
|
2020-03-23 23:08:31 +01:00
|
|
|
{
|
2020-03-27 16:12:48 +01:00
|
|
|
auto* model = m_config->model();
|
2020-03-10 18:59:41 +01:00
|
|
|
// Go backwards because expanding a group may cause rows to appear below it
|
2020-03-27 15:51:03 +01:00
|
|
|
for ( int i = model->rowCount() - 1; i >= 0; --i )
|
2020-03-10 04:44:16 +01:00
|
|
|
{
|
2020-03-27 15:51:03 +01:00
|
|
|
auto index = model->index( i, 0 );
|
|
|
|
if ( model->data( index, PackageModel::MetaExpandRole ).toBool() )
|
2020-03-10 18:37:57 +01:00
|
|
|
{
|
2020-03-23 14:10:48 +01:00
|
|
|
ui->groupswidget->setExpanded( index, true );
|
2020-03-10 18:37:57 +01:00
|
|
|
}
|
2020-03-10 04:44:16 +01:00
|
|
|
}
|
2016-06-26 00:26:08 +02:00
|
|
|
}
|
|
|
|
|
2020-03-27 16:12:48 +01:00
|
|
|
void
|
|
|
|
NetInstallPage::setStatus( QString s )
|
|
|
|
{
|
|
|
|
ui->netinst_status->setText( s );
|
|
|
|
}
|
2017-11-06 11:14:42 +01:00
|
|
|
|
2017-11-06 11:34:57 +01:00
|
|
|
void
|
|
|
|
NetInstallPage::onActivate()
|
2016-06-26 00:26:08 +02:00
|
|
|
{
|
|
|
|
ui->groupswidget->setFocus();
|
|
|
|
}
|