[libcalamaresui] Start QmlViewStep

This commit is contained in:
Adriaan de Groot 2020-01-10 12:13:40 +01:00
parent 16a460adff
commit 4924839217
3 changed files with 149 additions and 0 deletions

View File

@ -19,6 +19,7 @@ set( calamaresui_SOURCES
viewpages/BlankViewStep.cpp
viewpages/ExecutionViewStep.cpp
viewpages/QmlViewStep.cpp
viewpages/ViewStep.cpp
widgets/ClickableLabel.cpp

View File

@ -0,0 +1,87 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2020, Adriaan de Groot <groot@kde.org>
*
* 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/>.
*/
#include "QmlViewStep.h"
namespace Calamares
{
QmlViewStep::QmlViewStep( const QString& name, QObject* parent )
: ViewStep( parent )
, m_name( name )
{
}
QmlViewStep::~QmlViewStep() {}
QString
QmlViewStep::prettyName() const
{
// TODO: query the QML itself
return tr( "QML Step <i>%1</i>" ).arg( m_name );
}
} // namespace Calamares
bool
Calamares::QmlViewStep::isAtBeginning() const
{
return true;
}
bool
Calamares::QmlViewStep::isAtEnd() const
{
return true;
}
bool
Calamares::QmlViewStep::isBackEnabled() const
{
return true;
}
bool
Calamares::QmlViewStep::isNextEnabled() const
{
return true;
}
Calamares::JobList
Calamares::QmlViewStep::jobs() const
{
return JobList();
}
void
Calamares::QmlViewStep::onActivate()
{
// TODO: call into QML
}
void
Calamares::QmlViewStep::onLeave()
{
// TODO: call into QML
}
QWidget*
Calamares::QmlViewStep::widget()
{
return nullptr;
}

View File

@ -0,0 +1,61 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2020, Adriaan de Groot <groot@kde.org>
*
* 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 QMLVIEWSTEP_H
#define QMLVIEWSTEP_H
#include "viewpages/ViewStep.h"
namespace Calamares
{
/** @brief A viewstep that uses QML for the UI
*
* This is generally a **base** class for other view steps, but
* it can be used stand-alone for viewsteps that don't really have
* any functionality.
*/
class QmlViewStep : public Calamares::ViewStep
{
Q_OBJECT
public:
QmlViewStep( const QString& name, QObject* parent = nullptr );
virtual ~QmlViewStep() override;
virtual QString prettyName() const override;
virtual QWidget* widget() override;
virtual bool isNextEnabled() const override;
virtual bool isBackEnabled() const override;
virtual bool isAtBeginning() const override;
virtual bool isAtEnd() const override;
virtual void onActivate() override;
virtual void onLeave() override;
virtual JobList jobs() const override;
private:
QString m_name;
};
} // namespace Calamares
#endif