[libcalamaresui] Use InstanceKey instead of strings
- Replace return type of Module::instanceKey() by the structured ModuleSystem::InstanceKey type - Chase API breakage
This commit is contained in:
parent
b5d0acdf81
commit
00deeec8c8
@ -67,7 +67,7 @@ ViewStepItem::data( int role ) const
|
||||
toolTip.append( QString( "<br/>Status:\t%1" ).arg( m_step->prettyStatus() ) );
|
||||
toolTip.append(
|
||||
QString( "<br/>Source:\t%1" )
|
||||
.arg( m_step->moduleInstanceKey().isEmpty() ? "built-in" : m_step->moduleInstanceKey() ) );
|
||||
.arg( m_step->moduleInstanceKey().isValid() ? m_step->moduleInstanceKey().toString() : QStringLiteral("built-in") ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ CppJob::~CppJob() {}
|
||||
|
||||
|
||||
void
|
||||
CppJob::setModuleInstanceKey( const QString& instanceKey )
|
||||
CppJob::setModuleInstanceKey( const Calamares::ModuleSystem::InstanceKey& instanceKey )
|
||||
{
|
||||
m_instanceKey = instanceKey;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
*
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2016, Kevin Kofler <kevin.kofler@chello.at>
|
||||
* Copyright 2020, Adriaan de Groor <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
|
||||
@ -20,12 +21,14 @@
|
||||
#ifndef CALAMARES_CPPJOB_H
|
||||
#define CALAMARES_CPPJOB_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
|
||||
#include "DllMacro.h"
|
||||
#include "Job.h"
|
||||
|
||||
#include "modulesystem/InstanceKey.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
@ -36,13 +39,13 @@ public:
|
||||
explicit CppJob( QObject* parent = nullptr );
|
||||
virtual ~CppJob();
|
||||
|
||||
void setModuleInstanceKey( const QString& instanceKey );
|
||||
QString moduleInstanceKey() const { return m_instanceKey; }
|
||||
void setModuleInstanceKey( const Calamares::ModuleSystem::InstanceKey& instanceKey );
|
||||
Calamares::ModuleSystem::InstanceKey moduleInstanceKey() const { return m_instanceKey; }
|
||||
|
||||
virtual void setConfigurationMap( const QVariantMap& configurationMap );
|
||||
|
||||
protected:
|
||||
QString m_instanceKey;
|
||||
Calamares::ModuleSystem::InstanceKey m_instanceKey;
|
||||
};
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -101,7 +101,7 @@ public:
|
||||
* For instance, "partition\@partition" (default configuration) or
|
||||
* "locale\@someconfig" (custom configuration)
|
||||
*/
|
||||
QString instanceKey() const { return m_key.toString(); }
|
||||
ModuleSystem::InstanceKey instanceKey() const { return m_key; }
|
||||
|
||||
/**
|
||||
* @brief location returns the full path of this module's directory.
|
||||
|
@ -66,7 +66,7 @@ ViewStep::back()
|
||||
|
||||
|
||||
void
|
||||
ViewStep::setModuleInstanceKey( const QString& instanceKey )
|
||||
ViewStep::setModuleInstanceKey( const Calamares::ModuleSystem::InstanceKey& instanceKey )
|
||||
{
|
||||
m_instanceKey = instanceKey;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2017, 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
|
||||
@ -20,15 +20,16 @@
|
||||
#ifndef VIEWSTEP_H
|
||||
#define VIEWSTEP_H
|
||||
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QSize>
|
||||
|
||||
#include "Job.h"
|
||||
#include "UiDllMacro.h"
|
||||
|
||||
#include "modulesystem/InstanceKey.h"
|
||||
#include "modulesystem/Requirement.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QSize>
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
@ -36,9 +37,9 @@ namespace Calamares
|
||||
* @brief The ViewStep class is the base class for all view modules.
|
||||
* A view module is a Calamares module which has at least one UI page (exposed as
|
||||
* ViewStep::widget), and can optionally create Calamares jobs at runtime.
|
||||
* As of early 2017, a view module can be implemented by deriving from ViewStep
|
||||
* in C++ (as a Qt Plugin) or in Python with the PythonQt interface (which also
|
||||
* mimics the ViewStep class).
|
||||
* As of early 2020, a view module can be implemented by deriving from ViewStep
|
||||
* in C++ (as a Qt Plugin or a Qml ViewStep) or in Python with the PythonQt interface
|
||||
* (which also mimics the ViewStep class).
|
||||
*
|
||||
* A ViewStep can describe itself in human-readable format for the SummaryPage
|
||||
* (which shows all of the things which have been collected to be done in the
|
||||
@ -129,8 +130,8 @@ public:
|
||||
*/
|
||||
virtual JobList jobs() const = 0;
|
||||
|
||||
void setModuleInstanceKey( const QString& instanceKey );
|
||||
QString moduleInstanceKey() const { return m_instanceKey; }
|
||||
void setModuleInstanceKey( const Calamares::ModuleSystem::InstanceKey& instanceKey );
|
||||
Calamares::ModuleSystem::InstanceKey moduleInstanceKey() const { return m_instanceKey; }
|
||||
|
||||
virtual void setConfigurationMap( const QVariantMap& configurationMap );
|
||||
|
||||
@ -154,7 +155,7 @@ signals:
|
||||
void enlarge( QSize enlarge ) const;
|
||||
|
||||
protected:
|
||||
QString m_instanceKey;
|
||||
Calamares::ModuleSystem::InstanceKey m_instanceKey;
|
||||
};
|
||||
|
||||
using ViewStepList = QList< ViewStep* >;
|
||||
|
@ -192,8 +192,7 @@ PackageChooserViewStep::setConfigurationMap( const QVariantMap& configurationMap
|
||||
if ( m_id.isEmpty() )
|
||||
{
|
||||
// Not set, so use the instance id
|
||||
// TODO: use a stronger type than QString for structured IDs
|
||||
m_id = moduleInstanceKey().split( '@' ).last();
|
||||
m_id = moduleInstanceKey().id();
|
||||
}
|
||||
|
||||
bool labels_ok = false;
|
||||
|
Loading…
Reference in New Issue
Block a user