source: calamares/trunk/fuentes/src/modules/welcome/WelcomeViewStep.cpp @ 7538

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

sync with github

File size: 3.4 KB
Line 
1/* === This file is part of Calamares - <https://github.com/calamares> ===
2 *
3 *   Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
4 *
5 *   Calamares is free software: you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation, either version 3 of the License, or
8 *   (at your option) any later version.
9 *
10 *   Calamares is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *   GNU General Public License for more details.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "WelcomeViewStep.h"
20
21#include "WelcomePage.h"
22#include "checker/RequirementsChecker.h"
23#include "utils/Logger.h"
24
25
26#include <QVariant>
27
28CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeViewStepFactory, registerPlugin<WelcomeViewStep>(); )
29
30WelcomeViewStep::WelcomeViewStep( QObject* parent )
31    : Calamares::ViewStep( parent )
32    , m_requirementsChecker( new RequirementsChecker( this ) )
33{
34    emit nextStatusChanged( true );
35    m_widget = new WelcomePage( m_requirementsChecker );
36    connect( m_requirementsChecker, &RequirementsChecker::verdictChanged,
37             this, &WelcomeViewStep::nextStatusChanged );
38}
39
40
41WelcomeViewStep::~WelcomeViewStep()
42{
43    if ( m_widget && m_widget->parent() == nullptr )
44        m_widget->deleteLater();
45}
46
47
48QString
49WelcomeViewStep::prettyName() const
50{
51    return tr( "Welcome" );
52}
53
54
55QWidget*
56WelcomeViewStep::widget()
57{
58    return m_widget;
59}
60
61
62void
63WelcomeViewStep::next()
64{
65    emit done();
66}
67
68
69void
70WelcomeViewStep::back()
71{}
72
73
74bool
75WelcomeViewStep::isNextEnabled() const
76{
77    return m_requirementsChecker->verdict();
78}
79
80
81bool
82WelcomeViewStep::isBackEnabled() const
83{
84    return false;
85}
86
87
88bool
89WelcomeViewStep::isAtBeginning() const
90{
91    return true;
92}
93
94
95bool
96WelcomeViewStep::isAtEnd() const
97{
98    return true;
99}
100
101
102QList< Calamares::job_ptr >
103WelcomeViewStep::jobs() const
104{
105    return QList< Calamares::job_ptr >();
106}
107
108
109void
110WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
111{
112    bool showSupportUrl =
113        configurationMap.contains( "showSupportUrl" ) &&
114        configurationMap.value( "showSupportUrl" ).type() == QVariant::Bool &&
115        configurationMap.value( "showSupportUrl" ).toBool();
116    bool showKnownIssuesUrl =
117        configurationMap.contains( "showKnownIssuesUrl" ) &&
118        configurationMap.value( "showKnownIssuesUrl" ).type() == QVariant::Bool &&
119        configurationMap.value( "showKnownIssuesUrl" ).toBool();
120    bool showReleaseNotesUrl =
121        configurationMap.contains( "showReleaseNotesUrl" ) &&
122        configurationMap.value( "showReleaseNotesUrl" ).type() == QVariant::Bool &&
123        configurationMap.value( "showReleaseNotesUrl" ).toBool();
124
125    m_widget->setUpLinks( showSupportUrl,
126                          showKnownIssuesUrl,
127                          showReleaseNotesUrl );
128
129    if ( configurationMap.contains( "requirements" ) &&
130         configurationMap.value( "requirements" ).type() == QVariant::Map )
131        m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
132    else
133        cWarning() << "no valid requirements map found in welcome "
134                    "module configuration.";
135}
136
Note: See TracBrowser for help on using the repository browser.