[welcome] Remove the QML testing bits

- The welcomeq module has actual QML support
This commit is contained in:
Adriaan de Groot 2020-02-19 13:39:24 +01:00
parent bff07ded25
commit 25e3f91754
5 changed files with 0 additions and 191 deletions

View File

@ -40,13 +40,3 @@ calamares_add_plugin( welcome
Qt5::Network
SHARED_LIB
)
add_executable( welcomeqmltest qmlmain.cpp Config.cpp )
target_link_libraries( welcomeqmltest PRIVATE calamaresui Qt5::Core )
set_target_properties( welcomeqmltest
PROPERTIES
ENABLE_EXPORTS TRUE
RUNTIME_OUTPUT_NAME welcomeqmltest
)
calamares_automoc( welcomeqmltest )
calamares_autouic( welcomeqmltest )

View File

@ -1,28 +0,0 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2019, 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 "Config.h"
Config::Config()
: m_helpUrl( "https://www.kde.org/" )
{
}
Config::~Config()
{
}

View File

@ -1,40 +0,0 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2019, 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 WELCOME_CONFIG_H
#define WELCOME_CONFIG_H
#include <QObject>
#include <QUrl>
class Config : public QObject
{
Q_OBJECT
Q_PROPERTY( QUrl helpUrl READ helpUrl WRITE setHelpUrl CONSTANT )
public:
Config();
virtual ~Config();
QUrl helpUrl() const { return m_helpUrl; }
void setHelpUrl( const QUrl& url ) { m_helpUrl = url; }
private:
QUrl m_helpUrl;
};
#endif

View File

@ -1,84 +0,0 @@
/* Example executable showing a QML page and using the
* models from libcalamares for displaying a welcome.
*/
#include <memory>
#include <QApplication>
#include <QLabel>
#include <QMainWindow>
#include <QQmlEngine>
#include <QQuickWidget>
#include <QString>
#include <QTimer>
#include <QUrl>
#include <QVBoxLayout>
#include <QWidget>
#include <KAboutData>
#include "Branding.h"
#include "JobQueue.h"
#include "Settings.h"
#include "locale/LabelModel.h"
#include "utils/Logger.h"
#include "Config.h"
static Config* theConfig()
{
static Config* cnf = new Config();
return cnf;
}
int main(int argc, char **argv)
{
QApplication a( argc, argv );
KAboutData aboutData( "calamares",
"Calamares",
"0.1",
"Calamares QML Test Application",
KAboutLicense::GPL_V3,
QString(),
QString(),
"https://calamares.io",
"https://github.com/calamares/calamares/issues" );
KAboutData::setApplicationData( aboutData );
a.setApplicationDisplayName( QString() ); // To avoid putting an extra "Calamares/" into the log-file
Logger::setupLogLevel( Logger::LOGVERBOSE );
std::unique_ptr< Calamares::Settings > settings_p( Calamares::Settings::init( QString() ) );
std::unique_ptr< Calamares::JobQueue > jobqueue_p( new Calamares::JobQueue( nullptr ) );
Calamares::Branding defaultBrand( "src/branding/default/branding.desc" );
cDebug() << "Branding @" << (void *)Calamares::Branding::instance();
QMainWindow mw;
QWidget background;
QVBoxLayout vl;
QLabel l( "Hello, world", &mw );
QQuickWidget qqw( &mw );
vl.addWidget( &qqw );
vl.addWidget( &l );
background.setLayout( &vl );
mw.setCentralWidget( &background );
mw.resize( QSize( 400, 400 ) );
mw.show();
Config cnf;
if ( argc > 1 )
{
cnf.setHelpUrl( QUrl( argv[1] ) );
}
// TODO: this should put the one config object in the context, rather than adding a factory function to share it everywhere
qmlRegisterSingletonType< Config >( "io.calamares.modules.welcome", 1, 0, "PotatoConfig", [](QQmlEngine*, QJSEngine*) -> QObject* { return theConfig(); });
qmlRegisterSingletonType< CalamaresUtils::Locale::LabelModel >( "io.calamares.locale", 1, 0, "LocaleModel", [](QQmlEngine*, QJSEngine*) -> QObject* { return CalamaresUtils::Locale::availableTranslations(); } );
qqw.setSource( QUrl::fromLocalFile("../src/modules/welcome/welcome.qml") );
return a.exec();
}

View File

@ -1,29 +0,0 @@
import QtQuick 2.0;
import QtQuick.Controls 2.3;
import io.calamares.modules.welcome 1.0;
import io.calamares.locale 1.0;
Rectangle {
width: 200;
height: 200;
color: "pink";
Label {
id: label;
anchors.centerIn: parent;
text: "Welcome to Calamares";
}
Button {
id: thebutton;
anchors.top: label.bottom;
text: PotatoConfig.helpUrl;
}
ListView {
anchors.fill: parent;
model: LocaleModel;
delegate: Label { text: display }
}
}