about summary refs log tree commit diff
path: root/pkgs/tools/misc/calamares/packagechooserq.patch
blob: 90a7b22de8b54211eecc86141ec574c4a220ec69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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" );
+        }
+    }*/
 }