depot/third_party/nixpkgs/pkgs/tools/misc/calamares/packagechooserq.patch
Default email 22017988c6 Project import generated by Copybara.
GitOrigin-RevId: c777cdf5c564015d5f63b09cc93bef4178b19b01
2022-04-27 11:35:20 +02:00

136 lines
4.7 KiB
Diff

diff --git a/src/modules/packagechooser/Config.cpp b/src/modules/packagechooser/Config.cpp
index 491fe5c25..667621597 100644
--- a/src/modules/packagechooser/Config.cpp
+++ b/src/modules/packagechooser/Config.cpp
@@ -237,6 +237,12 @@ Config::setPackageChoice( const QString& packageChoice )
emit packageChoiceChanged( m_packageChoice.value_or( QString() ) );
}
+QString
+Config::prettyName() const
+{
+ return m_stepName ? m_stepName->get() : tr( "Packages" );
+}
+
QString
Config::prettyStatus() const
{
@@ -343,4 +349,14 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
cWarning() << "Single-selection QML module must use 'Legacy' method.";
}
}
+
+ bool labels_ok = false;
+ auto labels = CalamaresUtils::getSubMap( configurationMap, "labels", labels_ok );
+ if ( labels_ok )
+ {
+ if ( labels.contains( "step" ) )
+ {
+ m_stepName = new CalamaresUtils::Locale::TranslatedString( labels, "step" );
+ }
+ }
}
diff --git a/src/modules/packagechooser/Config.h b/src/modules/packagechooser/Config.h
index b04b1c30b..d1b783a8d 100644
--- a/src/modules/packagechooser/Config.h
+++ b/src/modules/packagechooser/Config.h
@@ -98,6 +98,7 @@ public:
QString packageChoice() const { return m_packageChoice.value_or( QString() ); }
void setPackageChoice( const QString& packageChoice );
+ QString prettyName() const;
QString prettyStatus() const;
signals:
@@ -120,6 +121,7 @@ private:
* Reading the property will return an empty QString.
*/
std::optional< QString > m_packageChoice;
+ CalamaresUtils::Locale::TranslatedString* m_stepName; // As it appears in the sidebar
};
diff --git a/src/modules/packagechooser/PackageChooserViewStep.cpp b/src/modules/packagechooser/PackageChooserViewStep.cpp
index 9057004de..8eacf82ec 100644
--- a/src/modules/packagechooser/PackageChooserViewStep.cpp
+++ b/src/modules/packagechooser/PackageChooserViewStep.cpp
@@ -29,7 +29,6 @@ PackageChooserViewStep::PackageChooserViewStep( QObject* parent )
: Calamares::ViewStep( parent )
, m_config( new Config( this ) )
, m_widget( nullptr )
- , m_stepName( nullptr )
{
emit nextStatusChanged( false );
}
@@ -41,14 +40,12 @@ PackageChooserViewStep::~PackageChooserViewStep()
{
m_widget->deleteLater();
}
- delete m_stepName;
}
-
QString
PackageChooserViewStep::prettyName() const
{
- return m_stepName ? m_stepName->get() : tr( "Packages" );
+ return m_config->prettyName();
}
@@ -139,16 +136,6 @@ PackageChooserViewStep::setConfigurationMap( const QVariantMap& configurationMap
m_config->setDefaultId( moduleInstanceKey() );
m_config->setConfigurationMap( configurationMap );
- bool labels_ok = false;
- auto labels = CalamaresUtils::getSubMap( configurationMap, "labels", labels_ok );
- if ( labels_ok )
- {
- if ( labels.contains( "step" ) )
- {
- m_stepName = new CalamaresUtils::Locale::TranslatedString( labels, "step" );
- }
- }
-
if ( m_widget )
{
hookupModel();
diff --git a/src/modules/packagechooser/PackageChooserViewStep.h b/src/modules/packagechooser/PackageChooserViewStep.h
index 7561f2bd7..76b35aed8 100644
--- a/src/modules/packagechooser/PackageChooserViewStep.h
+++ b/src/modules/packagechooser/PackageChooserViewStep.h
@@ -50,7 +50,6 @@ private:
Config* m_config;
PackageChooserPage* m_widget;
- CalamaresUtils::Locale::TranslatedString* m_stepName; // As it appears in the sidebar
};
CALAMARES_PLUGIN_FACTORY_DECLARATION( PackageChooserViewStepFactory )
diff --git a/src/modules/packagechooserq/PackageChooserQmlViewStep.cpp b/src/modules/packagechooserq/PackageChooserQmlViewStep.cpp
index 543c9771d..7c4d5fda7 100644
--- a/src/modules/packagechooserq/PackageChooserQmlViewStep.cpp
+++ b/src/modules/packagechooserq/PackageChooserQmlViewStep.cpp
@@ -29,7 +29,7 @@ PackageChooserQmlViewStep::PackageChooserQmlViewStep( QObject* parent )
QString
PackageChooserQmlViewStep::prettyName() const
{
- return tr( "Packages" );
+ return m_config->prettyName();
}
QString
@@ -83,4 +83,13 @@ PackageChooserQmlViewStep::setConfigurationMap( const QVariantMap& configuration
m_config->setDefaultId( moduleInstanceKey() );
m_config->setConfigurationMap( configurationMap );
Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last
+ /*bool labels_ok = false;
+ auto labels = CalamaresUtils::getSubMap( configurationMap, "labels", labels_ok );
+ if ( labels_ok )
+ {
+ if ( labels.contains( "step" ) )
+ {
+ m_stepName = new CalamaresUtils::Locale::TranslatedString( labels, "step" );
+ }
+ }*/
}