[oemid] Handle substitution in config-string
This commit is contained in:
parent
7d8b122835
commit
96828c1df0
@ -20,11 +20,13 @@
|
|||||||
|
|
||||||
#include "utils/Variant.h"
|
#include "utils/Variant.h"
|
||||||
|
|
||||||
|
#include <QDate>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
OEMViewStep::OEMViewStep(QObject* parent)
|
OEMViewStep::OEMViewStep(QObject* parent)
|
||||||
: Calamares::ViewStep( parent )
|
: Calamares::ViewStep( parent )
|
||||||
, m_widget( nullptr )
|
, m_widget( nullptr )
|
||||||
|
, m_visited( false )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +54,33 @@ bool OEMViewStep::isAtEnd() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString substitute( QString s )
|
||||||
|
{
|
||||||
|
QString t_date = QStringLiteral( "@@DATE@@" );
|
||||||
|
if ( s.contains( t_date ) )
|
||||||
|
{
|
||||||
|
auto date = QDate::currentDate();
|
||||||
|
s = s.replace( t_date, date.toString( Qt::ISODate ));
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OEMViewStep::onActivate()
|
||||||
|
{
|
||||||
|
if ( !m_visited && m_user_batchIdentifier.isEmpty() )
|
||||||
|
{
|
||||||
|
m_user_batchIdentifier = substitute( m_conf_batchIdentifier );
|
||||||
|
// m_widget->setIdentifier( m_user_batchIdentifier );
|
||||||
|
}
|
||||||
|
m_visited = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OEMViewStep::onLeave()
|
||||||
|
{
|
||||||
|
// m_user_batchIdentifier = m_widget->identifier();
|
||||||
|
}
|
||||||
|
|
||||||
QString OEMViewStep::prettyName() const
|
QString OEMViewStep::prettyName() const
|
||||||
{
|
{
|
||||||
return tr( "OEM Configuration" );
|
return tr( "OEM Configuration" );
|
||||||
@ -69,7 +98,7 @@ Calamares::JobList OEMViewStep::jobs() const
|
|||||||
|
|
||||||
void OEMViewStep::setConfigurationMap(const QVariantMap& configurationMap)
|
void OEMViewStep::setConfigurationMap(const QVariantMap& configurationMap)
|
||||||
{
|
{
|
||||||
m_batch = CalamaresUtils::getString( configurationMap, "batch-identifier" );
|
m_conf_batchIdentifier = CalamaresUtils::getString( configurationMap, "batch-identifier" );
|
||||||
}
|
}
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( OEMViewStepFactory, registerPlugin<OEMViewStep>(); )
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( OEMViewStepFactory, registerPlugin<OEMViewStep>(); )
|
||||||
|
@ -46,13 +46,18 @@ public:
|
|||||||
bool isAtBeginning() const override;
|
bool isAtBeginning() const override;
|
||||||
bool isAtEnd() const override;
|
bool isAtEnd() const override;
|
||||||
|
|
||||||
|
void onActivate() override;
|
||||||
|
void onLeave() override;
|
||||||
|
|
||||||
Calamares::JobList jobs() const override;
|
Calamares::JobList jobs() const override;
|
||||||
|
|
||||||
void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_batch;
|
QString m_conf_batchIdentifier;
|
||||||
|
QString m_user_batchIdentifier;
|
||||||
OEMPage* m_widget;
|
OEMPage* m_widget;
|
||||||
|
bool m_visited;
|
||||||
};
|
};
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( OEMViewStepFactory )
|
CALAMARES_PLUGIN_FACTORY_DECLARATION( OEMViewStepFactory )
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
# The batch-identifier is written to /var/log/installer/oem-id.
|
# The batch-identifier is written to /var/log/installer/oem-id.
|
||||||
# This value is put into the text box as the **suggested**
|
# This value is put into the text box as the **suggested**
|
||||||
# OEM ID. If @@DATE@@ is included in the identifier, then
|
# OEM ID. If @@DATE@@ is included in the identifier, then
|
||||||
# that is replaced by the current date in YYYYMMDD (ISO) format.
|
# that is replaced by the current date in yyyy-MM-dd (ISO) format.
|
||||||
batch-identifier: neon-@@DATE@@
|
batch-identifier: neon-@@DATE@@
|
||||||
|
Loading…
Reference in New Issue
Block a user