1 /* === This file is part of Calamares - <https://calamares.io> === 2 * 3 * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac <teo@kde.org> 4 * SPDX-License-Identifier: GPL-3.0-or-later 5 * 6 * Calamares is Free Software: see the License-Identifier above. 7 * 8 */ 9 10 #include "InteractiveTerminalViewStep.h" 11 12 #include "InteractiveTerminalPage.h" 13 14 #include "utils/Logger.h" 15 16 #include <QVariant> 17 CALAMARES_PLUGIN_FACTORY_DEFINITION(InteractiveTerminalViewStepFactory,registerPlugin<InteractiveTerminalViewStep> ();)18CALAMARES_PLUGIN_FACTORY_DEFINITION( InteractiveTerminalViewStepFactory, 19 registerPlugin< InteractiveTerminalViewStep >(); ) 20 21 InteractiveTerminalViewStep::InteractiveTerminalViewStep( QObject* parent ) 22 : Calamares::ViewStep( parent ) 23 , m_widget( new InteractiveTerminalPage() ) 24 { 25 emit nextStatusChanged( true ); 26 } 27 28 ~InteractiveTerminalViewStep()29InteractiveTerminalViewStep::~InteractiveTerminalViewStep() 30 { 31 if ( m_widget && m_widget->parent() == nullptr ) 32 { 33 m_widget->deleteLater(); 34 } 35 } 36 37 38 QString prettyName() const39InteractiveTerminalViewStep::prettyName() const 40 { 41 return tr( "Script" ); 42 } 43 44 45 QWidget* widget()46InteractiveTerminalViewStep::widget() 47 { 48 return m_widget; 49 } 50 51 52 bool isNextEnabled() const53InteractiveTerminalViewStep::isNextEnabled() const 54 { 55 return true; 56 } 57 58 59 bool isBackEnabled() const60InteractiveTerminalViewStep::isBackEnabled() const 61 { 62 return true; 63 } 64 65 66 bool isAtBeginning() const67InteractiveTerminalViewStep::isAtBeginning() const 68 { 69 return true; 70 } 71 72 73 bool isAtEnd() const74InteractiveTerminalViewStep::isAtEnd() const 75 { 76 return true; 77 } 78 79 80 QList< Calamares::job_ptr > jobs() const81InteractiveTerminalViewStep::jobs() const 82 { 83 cDebug() << "InteractiveTerminal" << prettyName() << "asked for jobs(), this is probably wrong."; 84 return QList< Calamares::job_ptr >(); 85 } 86 87 88 void onActivate()89InteractiveTerminalViewStep::onActivate() 90 { 91 cDebug() << "InteractiveTerminal" << prettyName() << "activated."; 92 m_widget->onActivate(); 93 } 94 95 96 void setConfigurationMap(const QVariantMap & configurationMap)97InteractiveTerminalViewStep::setConfigurationMap( const QVariantMap& configurationMap ) 98 { 99 if ( configurationMap.contains( "command" ) && configurationMap.value( "command" ).type() == QVariant::String ) 100 { 101 m_widget->setCommand( configurationMap.value( "command" ).toString() ); 102 } 103 } 104