Merge branch 'master' of https://github.com/calamares/calamares into development

This commit is contained in:
Philip Müller 2019-05-08 07:09:40 +02:00
commit 3fb500344c
36 changed files with 112 additions and 123 deletions

View File

@ -116,7 +116,7 @@ set( _tx_bad be eo fa fr_CH gu kk kn lo mk ne_NP ur uz )
### Required versions
#
# See DEPENDENCIES section below.
set( QT_VERSION 5.10.0 )
set( QT_VERSION 5.9.0 )
set( YAMLCPP_VERSION 0.5.1 )
set( ECM_VERSION 5.18 )
set( PYTHONLIBS_VERSION 3.3 )

View File

@ -3,15 +3,6 @@ include( CalamaresAddModuleSubdirectory )
include( CalamaresAddLibrary )
include( CalamaresAddBrandingSubdirectory )
include_directories(
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/libcalamares
${CMAKE_CURRENT_LIST_DIR}/libcalamaresui
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/libcalamares
${CMAKE_CURRENT_BINARY_DIR}/libcalamaresui
)
# library
add_subdirectory( libcalamares )

View File

@ -20,8 +20,6 @@
#ifndef CALAMARESAPPLICATION_H
#define CALAMARESAPPLICATION_H
#include "Typedefs.h"
#include <QApplication>
class CalamaresWindow;

View File

@ -1,3 +1,6 @@
# libcalamares is the non-GUI part of Calamares, which includes handling
# translations, configurations, logging, utilities, global storage, and (non-GUI) jobs.
add_definitions(
${QT_DEFINITIONS}
-DQT_SHARED

View File

@ -24,7 +24,6 @@
#include <QVariant>
#include "DllMacro.h"
#include "Typedefs.h"
#include "Job.h"
namespace Calamares

View File

@ -20,9 +20,10 @@
#define CALAMARES_JOB_H
#include "DllMacro.h"
#include "Typedefs.h"
#include <QList>
#include <QObject>
#include <QSharedPointer>
namespace Calamares {
@ -97,6 +98,9 @@ private:
bool m_emergency = false;
};
using job_ptr = QSharedPointer< Job >;
using JobList = QList< job_ptr >;
} // namespace Calamares
#endif // CALAMARES_JOB_H

View File

@ -20,7 +20,7 @@
#define CALAMARES_JOBQUEUE_H
#include "DllMacro.h"
#include "Typedefs.h"
#include "Job.h"
#include <QObject>

View File

@ -21,7 +21,6 @@
#include "Settings.h"
// #include "utils/CalamaresUtils.h"
#include "utils/Dirs.h"
#include "utils/Logger.h"
#include "utils/Yaml.h"

View File

@ -22,8 +22,8 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#include "UiDllMacro.h"
#include "Typedefs.h"
#include "DllMacro.h"
#include "modulesystem/Actions.h"
#include <QObject>
#include <QStringList>
@ -32,7 +32,7 @@
namespace Calamares
{
class UIDLLEXPORT Settings : public QObject
class DLLEXPORT Settings : public QObject
{
Q_OBJECT
public:
@ -41,7 +41,6 @@ public:
QObject* parent = nullptr );
static Settings* instance();
//TODO: load from YAML then emit ready
QStringList modulesSearchPaths() const;
@ -63,9 +62,6 @@ public:
*
* This influences user-visible strings, for instance using the
* word "setup" instead of "install" where relevant.
*
* NOTE: it's a synonym for !doChroot() for now, but may become
* an independent setting.
*/
bool isSetupMode() const { return m_isSetupMode; }

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* 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
@ -16,28 +17,18 @@
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TYPEDEFS_H
#define TYPEDEFS_H
#include <QList>
#include <QSharedPointer>
#ifndef MODULESYSTEM_ACTIONS_H
#define MODULESYSTEM_ACTIONS_H
namespace Calamares
{
class Job;
typedef QSharedPointer< Job > job_ptr;
using JobList = QList< job_ptr >;
enum ModuleAction : char
enum class ModuleAction : char
{
Show,
Exec
};
class ViewStep;
typedef QList< ViewStep* > ViewStepList;
} // namespace
} //ns
#endif // TYPEDEFS_H
#endif

View File

@ -22,7 +22,6 @@
#define BRANDING_H
#include "UiDllMacro.h"
#include "Typedefs.h"
#include "utils/NamedSuffix.h"

View File

@ -1,3 +1,9 @@
# libcalamaresui is the GUI part of Calamares, which includes handling
# view modules, view steps, widgets, and branding.
# The UI libs use the non-UI library
include_directories( ${CMAKE_SOURCE_DIR}/src/libcalamares ${CMAKE_BINARY_DIR}/src/libcalamares )
set( calamaresui_SOURCES
modulesystem/CppJobModule.cpp
modulesystem/Module.cpp

View File

@ -21,19 +21,14 @@
#define VIEWMANAGER_H
#include "UiDllMacro.h"
#include "Typedefs.h"
#include "viewpages/ViewStep.h"
#include <QList>
#include <QPushButton>
#include <QStackedWidget>
namespace Calamares
{
class ViewStep;
class ExecutionViewStep;
/**
* @brief The ViewManager class handles progression through view pages.
* @note Singleton object, only use through ViewManager::instance().

View File

@ -33,14 +33,14 @@ namespace Calamares
Module::Type
CppJobModule::type() const
{
return Job;
return Module::Type::Job;
}
Module::Interface
CppJobModule::interface() const
{
return QtPluginInterface;
return Module::Interface::QtPlugin;
}

View File

@ -235,9 +235,9 @@ Module::typeString() const
{
switch ( type() )
{
case Job:
case Type::Job:
return "Job Module";
case View:
case Type::View:
return "View Module";
}
return QString();
@ -249,13 +249,13 @@ Module::interfaceString() const
{
switch ( interface() )
{
case ProcessInterface:
case Interface::Process:
return "External process";
case PythonInterface:
case Interface::Python:
return "Python (Boost.Python)";
case PythonQtInterface:
case Interface::PythonQt:
return "Python (experimental)";
case QtPluginInterface:
case Interface::QtPlugin:
return "Qt Plugin";
}
return QString();

View File

@ -20,11 +20,10 @@
#ifndef CALAMARES_MODULE_H
#define CALAMARES_MODULE_H
#include "Job.h"
#include "Requirement.h"
#include "UiDllMacro.h"
#include <Typedefs.h>
#include <QStringList>
#include <QVariant>
@ -54,7 +53,7 @@ public:
* A job module is a single Calamares job.
* A view module has a UI (one or more view pages) and zero-to-many jobs.
*/
enum Type
enum class Type
{
Job,
View
@ -65,12 +64,12 @@ public:
* talks to Calamares.
* Not all Type-Interface associations are valid.
*/
enum Interface
enum class Interface
{
QtPluginInterface,
PythonInterface,
ProcessInterface,
PythonQtInterface
QtPlugin, // Jobs or Views
Python, // Jobs only
Process, // Deprecated interface
PythonQt // Views only, available as enum even if PythonQt isn't used
};
/**

View File

@ -277,7 +277,7 @@ ModuleManager::loadModules()
// At this point we most certainly have a pointer to a loaded module in
// thisModule. We now need to enqueue jobs info into an EVS.
if ( currentAction == Calamares::Exec )
if ( currentAction == ModuleAction::Exec )
{
ExecutionViewStep* evs =
qobject_cast< ExecutionViewStep* >(

View File

@ -21,7 +21,6 @@
#define MODULELOADER_H
#include "Requirement.h"
#include "Typedefs.h"
#include <QObject>
#include <QStringList>

View File

@ -29,14 +29,14 @@ namespace Calamares
Module::Type
ProcessJobModule::type() const
{
return Job;
return Module::Type::Job;
}
Module::Interface
ProcessJobModule::interface() const
{
return ProcessInterface;
return Module::Interface::Process;
}

View File

@ -30,14 +30,14 @@ namespace Calamares
Module::Type
PythonJobModule::type() const
{
return Job;
return Module::Type::Job;
}
Module::Interface
PythonJobModule::interface() const
{
return PythonInterface;
return Module::Interface::Python;
}

View File

@ -46,14 +46,14 @@ namespace Calamares
Module::Type
PythonQtViewModule::type() const
{
return View;
return Module::Type::View;
}
Module::Interface
PythonQtViewModule::interface() const
{
return PythonQtInterface;
return Module::Interface::PythonQt;
}

View File

@ -34,14 +34,14 @@ namespace Calamares
Module::Type
ViewModule::type() const
{
return View;
return Module::Type::View;
}
Module::Interface
ViewModule::interface() const
{
return QtPluginInterface;
return Module::Interface::QtPlugin;
}
@ -65,9 +65,6 @@ ViewModule::loadSelf()
}
}
// TODO: allow internal view steps to be created here; they would
// have to be linked into the main application somehow.
// If any method created the view step, use it now.
if ( m_viewStep )
{

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
* 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
@ -17,6 +18,8 @@
*/
#include "DebugWindow.h"
#include "ui_DebugWindow.h"
#include "utils/Retranslator.h"
#include "utils/qjsonmodel.h"
#include "JobQueue.h"
@ -51,26 +54,27 @@ namespace Calamares {
DebugWindow::DebugWindow()
: QWidget( nullptr )
, m_ui( new Ui::DebugWindow )
{
setupUi( this );
m_ui->setupUi( this );
// GlobalStorage page
QJsonModel* jsonModel = new QJsonModel( this );
globalStorageView->setModel( jsonModel );
m_ui->globalStorageView->setModel( jsonModel );
GlobalStorage* gs = JobQueue::instance()->globalStorage();
connect( gs, &GlobalStorage::changed,
this, [ = ]
{
jsonModel->loadJson( QJsonDocument::fromVariant( gs->m ).toJson() );
globalStorageView->expandAll();
m_ui->globalStorageView->expandAll();
} );
jsonModel->loadJson( QJsonDocument::fromVariant( gs->m ).toJson() );
globalStorageView->expandAll();
m_ui->globalStorageView->expandAll();
// JobQueue page
jobQueueText->setReadOnly( true );
m_ui->jobQueueText->setReadOnly( true );
connect( JobQueue::instance(), &JobQueue::queueChanged,
this, [ this ]( const JobList& jobs )
{
@ -80,30 +84,30 @@ DebugWindow::DebugWindow()
text.append( job->prettyName() );
}
jobQueueText->setText( text.join( '\n' ) );
m_ui->jobQueueText->setText( text.join( '\n' ) );
} );
// Modules page
QStringListModel* modulesModel = new QStringListModel( ModuleManager::instance()->loadedInstanceKeys() );
modulesListView->setModel( modulesModel );
modulesListView->setSelectionMode( QAbstractItemView::SingleSelection );
m_ui->modulesListView->setModel( modulesModel );
m_ui->modulesListView->setSelectionMode( QAbstractItemView::SingleSelection );
QJsonModel* moduleConfigModel = new QJsonModel( this );
moduleConfigView->setModel( moduleConfigModel );
m_ui->moduleConfigView->setModel( moduleConfigModel );
#ifdef WITH_PYTHONQT
QPushButton* pythonConsoleButton = new QPushButton;
pythonConsoleButton->setText( "Attach Python console" );
modulesVerticalLayout->insertWidget( 1, pythonConsoleButton );
m_ui->modulesVerticalLayout->insertWidget( 1, pythonConsoleButton );
pythonConsoleButton->hide();
QObject::connect( pythonConsoleButton, &QPushButton::clicked,
this, [ this, moduleConfigModel ]
{
QString moduleName = modulesListView->currentIndex().data().toString();
QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
Module* module = ModuleManager::instance()->moduleInstance( moduleName );
if ( module->interface() != Module::PythonQtInterface ||
module->type() != Module::View )
if ( module->interface() != Module::Interface::PythonQt ||
module->type() != Module::Type::View )
return;
for ( ViewStep* step : ViewManager::instance()->viewSteps() )
@ -159,33 +163,33 @@ DebugWindow::DebugWindow()
#endif
connect( modulesListView->selectionModel(), &QItemSelectionModel::selectionChanged,
connect( m_ui->modulesListView->selectionModel(), &QItemSelectionModel::selectionChanged,
this, [ this, moduleConfigModel
#ifdef WITH_PYTHONQT
, pythonConsoleButton
#endif
]
{
QString moduleName = modulesListView->currentIndex().data().toString();
QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
Module* module = ModuleManager::instance()->moduleInstance( moduleName );
if ( module )
{
moduleConfigModel->loadJson( QJsonDocument::fromVariant( module->configurationMap() ).toJson() );
moduleConfigView->expandAll();
moduleTypeLabel->setText( module->typeString() );
moduleInterfaceLabel->setText( module->interfaceString() );
m_ui->moduleConfigView->expandAll();
m_ui->moduleTypeLabel->setText( module->typeString() );
m_ui->moduleInterfaceLabel->setText( module->interfaceString() );
#ifdef WITH_PYTHONQT
pythonConsoleButton->setVisible(
module->interface() == Module::PythonQtInterface &&
module->type() == Module::View );
module->interface() == Module::Interface::PythonQt &&
module->type() == Module::Type::View );
#endif
}
} );
connect( crashButton, &QPushButton::clicked, this, [] { ::crash(); } );
connect( m_ui->crashButton, &QPushButton::clicked, this, [] { ::crash(); } );
CALAMARES_RETRANSLATE(
retranslateUi( this );
m_ui->retranslateUi( this );
setWindowTitle( tr( "Debug information" ) );
)
}

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
* 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
@ -19,13 +20,18 @@
#ifndef CALAMARES_DEBUGWINDOW_H
#define CALAMARES_DEBUGWINDOW_H
#include "ui_DebugWindow.h"
#include <QWidget>
namespace Calamares {
class DebugWindow : public QWidget, private Ui::DebugWindow
// From the .ui file
namespace Ui
{
class DebugWindow;
}
class DebugWindow : public QWidget
{
Q_OBJECT
@ -38,8 +44,10 @@ signals:
protected:
void closeEvent( QCloseEvent* e ) override;
private:
Ui::DebugWindow *m_ui;
};
} // namespace Calamares
#endif // CALAMARES_DEBUGWINDOW_H
} // namespace
#endif

View File

@ -20,10 +20,11 @@
#ifndef VIEWSTEP_H
#define VIEWSTEP_H
#include <QList>
#include <QObject>
#include <QSize>
#include "Typedefs.h"
#include "Job.h"
#include "UiDllMacro.h"
#include "modulesystem/Requirement.h"
@ -159,6 +160,7 @@ protected:
QString m_instanceKey;
};
using ViewStepList = QList< ViewStep* >;
}
#endif // VIEWSTEP_H

View File

@ -4,6 +4,12 @@
# in this list.
set( LIST_SKIPPED_MODULES "" )
include_directories(
${CMAKE_SOURCE_DIR}/src/libcalamares
${CMAKE_BINARY_DIR}/src/libcalamares
${CMAKE_SOURCE_DIR}/src/libcalamaresui
)
if( BUILD_TESTING )
add_executable( test_conf test_conf.cpp )
target_link_libraries( test_conf ${YAMLCPP_LIBRARY} Qt5::Core )

View File

@ -6,8 +6,7 @@ if ( KPMcore_FOUND )
find_package( Qt5 REQUIRED DBus ) # Needed for KPMCore
find_package( KF5 REQUIRED I18n WidgetsAddons ) # Needed for KPMCore
include_directories( ${KPMCORE_INCLUDE_DIR} )
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamares )
include_directories( ${KPMCORE_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/src/modules/partition )
if ( KPMcore_VERSION VERSION_GREATER "3.3.0")
list( APPEND _partition_defs WITH_KPMCORE331API) # kpmcore > 3.3.0 with deprecations

View File

@ -37,7 +37,8 @@
#include "utils/Units.h"
#include "utils/Variant.h"
#include "modules/partition/core/PartitionIterator.h"
// From partition module
#include "core/PartitionIterator.h"
static const NamedEnumTable<ResizeFSJob::RelativeUnit>&

View File

@ -24,13 +24,11 @@
#ifndef KEYBOARDPAGE_H
#define KEYBOARDPAGE_H
#include "keyboardwidget/keyboardglobal.h"
#include "Typedefs.h"
#include "Job.h"
#include <QListWidgetItem>
#include <QWidget>
#include <QTimer>
#include <QWidget>
namespace Ui
{
@ -50,7 +48,7 @@ public:
QString prettyStatus() const;
QList< Calamares::job_ptr > createJobs( const QString& xOrgConfFileName,
Calamares::JobList createJobs( const QString& xOrgConfFileName,
const QString& convertedKeymapPath,
bool writeEtcDefaultKeyboard );

View File

@ -20,9 +20,8 @@
#ifndef LOCALEPAGE_H
#define LOCALEPAGE_H
#include "Typedefs.h"
#include "LocaleConfiguration.h"
#include "Job.h"
#include <QWidget>
@ -44,7 +43,7 @@ public:
QString prettyStatus() const;
QList< Calamares::job_ptr > createJobs();
Calamares::JobList createJobs();
QMap< QString, QString > localesMap();

View File

@ -23,7 +23,6 @@
#include "PackageModel.h"
#include "PackageTreeItem.h"
#include "Typedefs.h"
#include <QAbstractButton>
#include <QNetworkAccessManager>

View File

@ -50,7 +50,6 @@
#ifdef DEBUG_PARTITION_LAME
#include "JobExample.h"
#endif
#include "Typedefs.h"
#include "utils/Logger.h"
// KPMcore

View File

@ -24,7 +24,8 @@
#include "core/KPMHelpers.h"
#include "core/PartitionLayout.h"
#include "core/PartitionModel.h"
#include "Typedefs.h"
#include "Job.h"
// KPMcore
#include <kpmcore/core/lvmdevice.h>
@ -172,7 +173,7 @@ public:
* requested by the user.
* @return a list of jobs.
*/
QList< Calamares::job_ptr > jobs() const;
Calamares::JobList jobs() const;
bool hasRootMountPoint() const;

View File

@ -22,8 +22,6 @@
#include "core/PartUtils.h"
#include "Typedefs.h"
// KPMcore
#include <kpmcore/core/partitiontable.h>
#include <kpmcore/fs/filesystem.h>

View File

@ -19,7 +19,7 @@
#ifndef SUMMARYPAGE_H
#define SUMMARYPAGE_H
#include "Typedefs.h"
#include "viewpages/ViewStep.h"
#include <QWidget>

View File

@ -24,9 +24,8 @@
#ifndef USERSPAGE_H
#define USERSPAGE_H
#include "Typedefs.h"
#include "CheckPWQuality.h"
#include "Job.h"
#include <QWidget>
@ -44,7 +43,7 @@ public:
bool isReady();
QList< Calamares::job_ptr > createJobs( const QStringList& defaultGroupsList );
Calamares::JobList createJobs( const QStringList& defaultGroupsList );
void onActivate();