From 25e3f917540b9271484094d16b078aaeffacd172 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 19 Feb 2020 13:39:24 +0100 Subject: [PATCH] [welcome] Remove the QML testing bits - The welcomeq module has actual QML support --- src/modules/welcome/CMakeLists.txt | 10 ---- src/modules/welcome/Config.cpp | 28 ---------- src/modules/welcome/Config.h | 40 -------------- src/modules/welcome/qmlmain.cpp | 84 ------------------------------ src/modules/welcome/welcome.qml | 29 ----------- 5 files changed, 191 deletions(-) delete mode 100644 src/modules/welcome/Config.cpp delete mode 100644 src/modules/welcome/Config.h delete mode 100644 src/modules/welcome/qmlmain.cpp delete mode 100644 src/modules/welcome/welcome.qml diff --git a/src/modules/welcome/CMakeLists.txt b/src/modules/welcome/CMakeLists.txt index b25bb6720..e25b7f5d0 100644 --- a/src/modules/welcome/CMakeLists.txt +++ b/src/modules/welcome/CMakeLists.txt @@ -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 ) diff --git a/src/modules/welcome/Config.cpp b/src/modules/welcome/Config.cpp deleted file mode 100644 index b46b85bf3..000000000 --- a/src/modules/welcome/Config.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* === This file is part of Calamares - === - * - * Copyright 2019, Adriaan de Groot - * - * 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 . - */ - -#include "Config.h" - -Config::Config() - : m_helpUrl( "https://www.kde.org/" ) -{ -} - -Config::~Config() -{ -} diff --git a/src/modules/welcome/Config.h b/src/modules/welcome/Config.h deleted file mode 100644 index 7b0cfd734..000000000 --- a/src/modules/welcome/Config.h +++ /dev/null @@ -1,40 +0,0 @@ -/* === This file is part of Calamares - === - * - * Copyright 2019, Adriaan de Groot - * - * 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 . - */ - -#ifndef WELCOME_CONFIG_H -#define WELCOME_CONFIG_H - -#include -#include - -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 diff --git a/src/modules/welcome/qmlmain.cpp b/src/modules/welcome/qmlmain.cpp deleted file mode 100644 index a9dd1875d..000000000 --- a/src/modules/welcome/qmlmain.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* Example executable showing a QML page and using the - * models from libcalamares for displaying a welcome. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#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(); -} diff --git a/src/modules/welcome/welcome.qml b/src/modules/welcome/welcome.qml deleted file mode 100644 index bdb7c4416..000000000 --- a/src/modules/welcome/welcome.qml +++ /dev/null @@ -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 } - } -}