summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2018-05-19 19:02:10 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2018-05-27 06:26:01 -0400
commit89de557499987455f2955c0ae1d46189daf9de88 (patch)
tree412a67cea9942bf8063891f362b990427c23d360
parentf66073b70c76218d1aed7c81668ada4f51d7867f (diff)
implement WM/DE selection
-rw-r--r--settings.conf2
-rw-r--r--src/libcalamares/GlobalStorage.cpp3
-rw-r--r--src/libcalamares/GlobalStorage.h3
-rw-r--r--src/libcalamares/PacstrapCppJob.cpp2
-rw-r--r--src/modules/netinstall/NetInstallPage.cpp38
-rw-r--r--src/modules/netinstall/NetInstallPage.h12
-rw-r--r--src/modules/netinstall/NetInstallViewStep.cpp13
-rw-r--r--src/modules/netinstall/NetInstallViewStep.h2
-rw-r--r--src/modules/netinstall/netinstall.conf11
-rw-r--r--src/modules/netinstall/page_netinst.ui75
10 files changed, 151 insertions, 10 deletions
diff --git a/settings.conf b/settings.conf
index 3e3fe6473..32ea7fd0a 100644
--- a/settings.conf
+++ b/settings.conf
@@ -64,7 +64,7 @@ sequence:
- locale
- keyboard
- users
-# - netinstall
+ - netinstall
- partition
# - tracking
- summary
diff --git a/src/libcalamares/GlobalStorage.cpp b/src/libcalamares/GlobalStorage.cpp
index 02d4fe7df..406c30056 100644
--- a/src/libcalamares/GlobalStorage.cpp
+++ b/src/libcalamares/GlobalStorage.cpp
@@ -171,6 +171,9 @@ const QString GS::HAS_ISOREPO_KEY = "has-isorepo";
const QString GS::IS_ONLINE_KEY = "hasInternet";
const QString GS::INITSYSTEM_KEY = "default-initsystem" ;
const QString GS::DESKTOP_KEY = "default-desktop" ;
+const QString GS::DESKTOPS_KEY = "desktops";
+const QString GS::DE_ICON_KEY = "de-icon";
+const QString GS::DE_NAME_KEY = "de-name";
const QString GS::LOCALE_KEY = "localeConf";
const QString GS::LANG_KEY = "LANG";
const QString GS::ROOT_MOUNTPOINT_KEY = "rootMountPoint";
diff --git a/src/libcalamares/GlobalStorage.h b/src/libcalamares/GlobalStorage.h
index 543c6c6d0..1a821a0fb 100644
--- a/src/libcalamares/GlobalStorage.h
+++ b/src/libcalamares/GlobalStorage.h
@@ -108,6 +108,9 @@ public:
static const QString IS_ONLINE_KEY;
static const QString INITSYSTEM_KEY;
static const QString DESKTOP_KEY;
+ static const QString DESKTOPS_KEY;
+ static const QString DE_ICON_KEY;
+ static const QString DE_NAME_KEY;
static const QString LOCALE_KEY;
static const QString LANG_KEY;
static const QString ROOT_MOUNTPOINT_KEY;
diff --git a/src/libcalamares/PacstrapCppJob.cpp b/src/libcalamares/PacstrapCppJob.cpp
index 4c4b9d998..57c592481 100644
--- a/src/libcalamares/PacstrapCppJob.cpp
+++ b/src/libcalamares/PacstrapCppJob.cpp
@@ -155,8 +155,6 @@ Calamares::JobResult PacstrapCppJob::exec()
{
// globalStorage->insert(GS::INITSYSTEM_KEY , OPENRC_PACKAGES_KEY) ; // TODO: per user option via globalStorage
globalStorage->insert(GS::INITSYSTEM_KEY , SYSTEMD_PACKAGES_KEY) ; // TODO: per user option via globalStorage
-globalStorage->insert(GS::DESKTOP_KEY , LXDE_PACKAGES_KEY ) ; // TODO: per user option via globalStorage
-// globalStorage->insert(GS::DESKTOP_KEY , MATE_PACKAGES_KEY ) ; // TODO: per user option via globalStorage
// cleanup from possibly aborted previous runs
// Teardown() ;
diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp
index a8e37aa0c..399043131 100644
--- a/src/modules/netinstall/NetInstallPage.cpp
+++ b/src/modules/netinstall/NetInstallPage.cpp
@@ -22,6 +22,7 @@
#include "NetInstallPage.h"
#include "PackageModel.h"
+#include "ViewManager.h"
#include "ui_page_netinst.h"
#include "GlobalStorage.h"
@@ -48,6 +49,10 @@
using CalamaresUtils::yamlToVariant;
+
+const char NetInstallPage::WMDE_COMBO_LABEL_TEXT[] = "Select Graphical Environment";
+
+
NetInstallPage::NetInstallPage( QWidget* parent )
: QWidget( parent )
, ui( new Ui::Page_NetInst )
@@ -55,6 +60,9 @@ NetInstallPage::NetInstallPage( QWidget* parent )
, m_groups( nullptr )
{
ui->setupUi( this );
+
+ ui->wmDeLabel->setText( tr( WMDE_COMBO_LABEL_TEXT ) );
+ ui->wmDeCombobox->setToolTip( tr( WMDE_COMBO_LABEL_TEXT ) );
}
bool
@@ -115,6 +123,30 @@ NetInstallPage::dataIsHere( QNetworkReply* reply )
emit checkReady( true );
}
+void
+NetInstallPage::loadEnvironmentComboboxes(QVariantMap local_storage)
+{
+ QVariantMap desktops_data = local_storage.value( GS::DESKTOPS_KEY ).toMap();
+ QVariantMap::iterator desktops_iter = desktops_data.begin();
+
+ for ( ; desktops_iter != desktops_data.end(); ++desktops_iter )
+ {
+cLog() << "NetInstallPage::loadEnvironmentComboboxes() desktops_iter.key()=" << desktops_iter.key();
+
+ QVariantMap desktops_data = desktops_iter.value().toMap();
+ QVariant de_key = QVariant(desktops_iter.key());
+ QIcon de_icon = QIcon(desktops_data.value( GS::DE_ICON_KEY ).toString());
+ QString de_name = desktops_data.value( GS::DE_NAME_KEY ).toString();
+
+ ui->wmDeCombobox->addItem(de_icon, de_name, de_key);
+
+cLog() << "NetInstallPage::loadEnvironmentComboboxes() added de_icon=" <<
+ desktops_data.value( GS::DE_ICON_KEY ).toString() <<
+ " de_key=" << de_key << " de_name" << de_name;
+ }
+ ui->wmDeCombobox->setCurrentIndex( 0 );
+}
+
PackageModel::PackageItemDataList
NetInstallPage::selectedPackages() const
{
@@ -127,6 +159,12 @@ NetInstallPage::selectedPackages() const
}
}
+QString
+NetInstallPage::getWmDeKey() const
+{
+ return ui->wmDeCombobox->itemData(ui->wmDeCombobox->currentIndex()).toString();
+}
+
void
NetInstallPage::loadGroupList()
{
diff --git a/src/modules/netinstall/NetInstallPage.h b/src/modules/netinstall/NetInstallPage.h
index 58308412d..0d39b215b 100644
--- a/src/modules/netinstall/NetInstallPage.h
+++ b/src/modules/netinstall/NetInstallPage.h
@@ -51,6 +51,10 @@ public:
// in the global storage. This should be called before displaying the page.
void loadGroupList();
+ // Loads icon, friendly name, and packages key for WM/DE options
+ // from global storage and populate combobox options
+ void loadEnvironmentComboboxes(QVariantMap local_storage);
+
// Sets the "required" state of netinstall data. Influences whether
// corrupt or unavailable data causes checkReady() to be emitted
// true (not-required) or false.
@@ -65,12 +69,18 @@ public:
// this function does not have constant time.
PackageModel::PackageItemDataList selectedPackages() const;
+ // Returns the value of the WD/DE combobox.
+ // This will determine which pacman.conf to use in the PacstrapCppJob modules.
+ QString getWmDeKey() const;
+
+
public slots:
void dataIsHere( QNetworkReply* );
signals:
void checkReady( bool );
+
private:
// Takes the YAML data representing the groups and reads them into the
// m_groups and m_groupOrder internal structures. See the README.md
@@ -84,6 +94,8 @@ private:
PackageModel* m_groups;
bool m_required;
+
+ static const char WMDE_COMBO_LABEL_TEXT[];
};
#endif // NETINSTALLPAGE_H
diff --git a/src/modules/netinstall/NetInstallViewStep.cpp b/src/modules/netinstall/NetInstallViewStep.cpp
index 50e08486b..2bc4f595c 100644
--- a/src/modules/netinstall/NetInstallViewStep.cpp
+++ b/src/modules/netinstall/NetInstallViewStep.cpp
@@ -28,6 +28,10 @@
CALAMARES_PLUGIN_FACTORY_DEFINITION( NetInstallViewStepFactory, registerPlugin<NetInstallViewStep>(); )
+
+const char NetInstallViewStep::PAGE_TITLE[] = "Packages";
+
+
NetInstallViewStep::NetInstallViewStep( QObject* parent )
: Calamares::ViewStep( parent )
, m_widget( new NetInstallPage() )
@@ -49,7 +53,7 @@ NetInstallViewStep::~NetInstallViewStep()
QString
NetInstallViewStep::prettyName() const
{
- return tr( "Package selection" );
+ return tr( PAGE_TITLE );
}
@@ -173,6 +177,11 @@ NetInstallViewStep::onLeave()
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
gs->insert( "packageOperations", QVariant( packageOperations ) );
}
+
+ Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
+// globalStorage->insert(GS::DESKTOP_KEY , MATE_PACKAGES_KEY ) ; // TODO: per user option via globalStorage
+// globalStorage->insert(GS::DESKTOP_KEY , LXDE_PACKAGES_KEY) ; // TODO: per user option via globalStorage
+ gs->insert( GS::DESKTOP_KEY, m_widget->getWmDeKey() ) ; // TODO:
}
@@ -191,6 +200,8 @@ NetInstallViewStep::setConfigurationMap( const QVariantMap& configurationMap )
"groupsUrl", configurationMap.value( "groupsUrl" ).toString() );
m_widget->loadGroupList();
}
+
+ m_widget->loadEnvironmentComboboxes( configurationMap );
}
void
diff --git a/src/modules/netinstall/NetInstallViewStep.h b/src/modules/netinstall/NetInstallViewStep.h
index ee53f61ce..e3134887a 100644
--- a/src/modules/netinstall/NetInstallViewStep.h
+++ b/src/modules/netinstall/NetInstallViewStep.h
@@ -64,6 +64,8 @@ public slots:
void nextIsReady( bool );
private:
+ static const char PAGE_TITLE[];
+
NetInstallPage* m_widget;
bool m_nextEnabled;
QString m_prettyStatus;
diff --git a/src/modules/netinstall/netinstall.conf b/src/modules/netinstall/netinstall.conf
index f5977a267..38c5ef51d 100644
--- a/src/modules/netinstall/netinstall.conf
+++ b/src/modules/netinstall/netinstall.conf
@@ -1,7 +1,7 @@
---
# This is the URL that is retrieved to get the netinstall groups-and-packages
# data (which should be in the format described in netinstall.yaml).
-groupsUrl: http://chakraos.org/netinstall.php
+# groupsUrl: http://chakraos.org/netinstall.php
# If the installation can proceed without netinstall (e.g. the Live CD
# can create a working installed system, but netinstall is preferred
@@ -11,3 +11,12 @@ groupsUrl: http://chakraos.org/netinstall.php
# This only has an effect if the netinstall data cannot be retrieved,
# or is corrupt: having "required" set, means the install cannot proceed.
required: false
+
+
+desktops:
+ lxde:
+ de-icon: /usr/share/calamares/branding/parabola/parabolaicon.png
+ de-name: LXDE Desktop Environment
+ mate:
+ de-icon: /usr/share/calamares/branding/parabola/parabolaicon.png
+ de-name: Mate Desktop Environment
diff --git a/src/modules/netinstall/page_netinst.ui b/src/modules/netinstall/page_netinst.ui
index 15d27cfb4..ca70ed7fd 100644
--- a/src/modules/netinstall/page_netinst.ui
+++ b/src/modules/netinstall/page_netinst.ui
@@ -15,7 +15,72 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
+ <widget class="QLabel" name="header">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="wmDeLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>wmDeLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="wmDeCombobox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="currentText">
+ <string/>
+ </property>
+ <property name="currentIndex">
+ <number>-1</number>
+ </property>
+ <property name="minimumContentsLength">
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
<widget class="QScrollArea" name="scrollArea">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="maximumSize">
<size>
<width>16777215</width>
@@ -30,14 +95,14 @@
<rect>
<x>0</x>
<y>0</y>
- <width>981</width>
- <height>434</height>
+ <width>977</width>
+ <height>379</height>
</rect>
</property>
<property name="font">
- <font>
- <pointsize>11</pointsize>
- </font>
+ <font>
+ <pointsize>11</pointsize>
+ </font>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3"/>
</widget>